Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/KhronosGroup/SPIRV-Cross.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans-Kristian Arntzen <post@arntzen-software.no>2022-01-18 17:25:17 +0300
committerGitHub <noreply@github.com>2022-01-18 17:25:17 +0300
commit5a29181b357dc572125e7da2b8c24020be848af7 (patch)
tree2b2253b3486fd10b0126c9d4233a80114c1bdde9 /shaders-msl-no-opt
parent08d5f5ed181f489e77f94d168071fb5605f2792a (diff)
parentac46140ba394ba5f85b6cfc72a5f5810084e8191 (diff)
Merge pull request #1851 from KhronosGroup/fix-1835
Handle aliased names in spec constants.
Diffstat (limited to 'shaders-msl-no-opt')
-rw-r--r--shaders-msl-no-opt/asm/comp/constant-lut-name-aliasing.asm.comp81
-rw-r--r--shaders-msl-no-opt/asm/comp/spec-constant-name-aliasing.asm.comp78
2 files changed, 159 insertions, 0 deletions
diff --git a/shaders-msl-no-opt/asm/comp/constant-lut-name-aliasing.asm.comp b/shaders-msl-no-opt/asm/comp/constant-lut-name-aliasing.asm.comp
new file mode 100644
index 00000000..e1dcb0ef
--- /dev/null
+++ b/shaders-msl-no-opt/asm/comp/constant-lut-name-aliasing.asm.comp
@@ -0,0 +1,81 @@
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos Glslang Reference Front End; 10
+; Bound: 49
+; Schema: 0
+ OpCapability Shader
+ %1 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main" %gl_GlobalInvocationID %gl_LocalInvocationID
+ OpExecutionMode %main LocalSize 4 4 1
+ OpSource GLSL 450
+ OpName %main "main"
+ OpName %SSBO "SSBO"
+ OpMemberName %SSBO 0 "values"
+ OpName %_ ""
+ OpName %gl_GlobalInvocationID "gl_GlobalInvocationID"
+ OpName %gl_LocalInvocationID "gl_LocalInvocationID"
+ OpName %indexable "indexable"
+ OpName %indexable_0 "indexable"
+ OpName %25 "indexable"
+ OpName %38 "indexable"
+ OpDecorate %_runtimearr_int ArrayStride 4
+ OpMemberDecorate %SSBO 0 Offset 0
+ OpDecorate %SSBO BufferBlock
+ OpDecorate %_ DescriptorSet 0
+ OpDecorate %_ Binding 0
+ OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId
+ OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId
+ OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize
+ %void = OpTypeVoid
+ %3 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+%_runtimearr_int = OpTypeRuntimeArray %int
+ %SSBO = OpTypeStruct %_runtimearr_int
+%_ptr_Uniform_SSBO = OpTypePointer Uniform %SSBO
+ %_ = OpVariable %_ptr_Uniform_SSBO Uniform
+ %int_0 = OpConstant %int 0
+ %uint = OpTypeInt 32 0
+ %v3uint = OpTypeVector %uint 3
+%_ptr_Input_v3uint = OpTypePointer Input %v3uint
+%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input
+ %uint_0 = OpConstant %uint 0
+%_ptr_Input_uint = OpTypePointer Input %uint
+ %uint_4 = OpConstant %uint 4
+%_arr_int_uint_4 = OpTypeArray %int %uint_4
+ %int_1 = OpConstant %int 1
+ %int_2 = OpConstant %int 2
+ %int_3 = OpConstant %int 3
+ %25 = OpConstantComposite %_arr_int_uint_4 %int_0 %int_1 %int_2 %int_3
+%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input
+%_ptr_Function__arr_int_uint_4 = OpTypePointer Function %_arr_int_uint_4
+%_ptr_Function_int = OpTypePointer Function %int
+ %int_4 = OpConstant %int 4
+ %int_5 = OpConstant %int 5
+ %int_6 = OpConstant %int 6
+ %int_7 = OpConstant %int 7
+ %38 = OpConstantComposite %_arr_int_uint_4 %int_4 %int_5 %int_6 %int_7
+ %uint_1 = OpConstant %uint 1
+%_ptr_Uniform_int = OpTypePointer Uniform %int
+%gl_WorkGroupSize = OpConstantComposite %v3uint %uint_4 %uint_4 %uint_1
+ %main = OpFunction %void None %3
+ %5 = OpLabel
+ %indexable = OpVariable %_ptr_Function__arr_int_uint_4 Function
+%indexable_0 = OpVariable %_ptr_Function__arr_int_uint_4 Function
+ %18 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0
+ %19 = OpLoad %uint %18
+ %27 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0
+ %28 = OpLoad %uint %27
+ OpStore %indexable %25
+ %32 = OpAccessChain %_ptr_Function_int %indexable %28
+ %33 = OpLoad %int %32
+ %40 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_1
+ %41 = OpLoad %uint %40
+ OpStore %indexable_0 %38
+ %43 = OpAccessChain %_ptr_Function_int %indexable_0 %41
+ %44 = OpLoad %int %43
+ %45 = OpIAdd %int %33 %44
+ %47 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %19
+ OpStore %47 %45
+ OpReturn
+ OpFunctionEnd
diff --git a/shaders-msl-no-opt/asm/comp/spec-constant-name-aliasing.asm.comp b/shaders-msl-no-opt/asm/comp/spec-constant-name-aliasing.asm.comp
new file mode 100644
index 00000000..b4e622ba
--- /dev/null
+++ b/shaders-msl-no-opt/asm/comp/spec-constant-name-aliasing.asm.comp
@@ -0,0 +1,78 @@
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos Glslang Reference Front End; 10
+; Bound: 35
+; Schema: 0
+ OpCapability Shader
+ %1 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main" %gl_GlobalInvocationID
+ OpExecutionMode %main LocalSize 1 1 1
+ OpSource GLSL 450
+ OpName %main "main"
+ OpName %SSBO "SSBO"
+ OpMemberName %SSBO 0 "values"
+ OpName %_ ""
+ OpName %gl_GlobalInvocationID "gl_GlobalInvocationID"
+ OpName %A "A"
+ OpName %B "A"
+ OpName %C "A"
+ OpName %D "A"
+ OpName %E "A"
+ OpName %F "A"
+ OpName %G "A"
+ OpName %H "A"
+ OpName %I "A"
+ OpName %J "A"
+ OpName %K "A"
+ OpName %L "A"
+ OpDecorate %_runtimearr_int ArrayStride 4
+ OpMemberDecorate %SSBO 0 Offset 0
+ OpDecorate %SSBO BufferBlock
+ OpDecorate %_ DescriptorSet 0
+ OpDecorate %_ Binding 0
+ OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId
+ OpDecorate %A SpecId 0
+ OpDecorate %B SpecId 1
+ OpDecorate %C SpecId 2
+ OpDecorate %D SpecId 3
+ OpDecorate %E SpecId 4
+ OpDecorate %F SpecId 5
+ OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize
+ %void = OpTypeVoid
+ %3 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+%_runtimearr_int = OpTypeRuntimeArray %int
+ %SSBO = OpTypeStruct %_runtimearr_int
+%_ptr_Uniform_SSBO = OpTypePointer Uniform %SSBO
+ %_ = OpVariable %_ptr_Uniform_SSBO Uniform
+ %int_0 = OpConstant %int 0
+ %uint = OpTypeInt 32 0
+ %v3uint = OpTypeVector %uint 3
+%_ptr_Input_v3uint = OpTypePointer Input %v3uint
+%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input
+ %uint_0 = OpConstant %uint 0
+%_ptr_Input_uint = OpTypePointer Input %uint
+ %A = OpSpecConstant %int 0
+ %B = OpSpecConstant %int 1
+ %C = OpSpecConstant %int 2
+ %D = OpSpecConstant %int 3
+ %E = OpSpecConstant %int 4
+ %F = OpSpecConstant %int 5
+ %G = OpSpecConstantOp %int ISub %A %B
+ %H = OpSpecConstantOp %int ISub %G %C
+ %I = OpSpecConstantOp %int ISub %H %D
+ %J = OpSpecConstantOp %int ISub %I %E
+ %K = OpSpecConstantOp %int ISub %J %F
+ %L = OpSpecConstantOp %int IAdd %K %F
+%_ptr_Uniform_int = OpTypePointer Uniform %int
+ %uint_1 = OpConstant %uint 1
+%gl_WorkGroupSize = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1
+ %main = OpFunction %void None %3
+ %5 = OpLabel
+ %18 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0
+ %19 = OpLoad %uint %18
+ %32 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %19
+ OpStore %32 %L
+ OpReturn
+ OpFunctionEnd