Generate SPV_EXT_replicated_composites when requested by pragma.

Implement GL_EXT_spec_constant_composites.
This commit is contained in:
Jeff Bolz 2024-05-31 12:00:03 -05:00 committed by arcady-lunarg
parent 6a8b2b2439
commit 4da479aa6a
19 changed files with 656 additions and 14 deletions

View file

@ -0,0 +1,117 @@
spv.replicate.comp
// Module Version 10000
// Generated by (magic number): 8000b
// Id's are bound by 66
Capability Shader
Capability VulkanMemoryModelKHR
Capability CooperativeMatrixKHR
Capability CapabilityReplicatedCompositesEXT
Extension "SPV_EXT_replicated_composites"
Extension "SPV_KHR_cooperative_matrix"
Extension "SPV_KHR_vulkan_memory_model"
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical VulkanKHR
EntryPoint GLCompute 4 "main"
ExecutionMode 4 LocalSize 1 1 1
Source GLSL 450
SourceExtension "GL_EXT_spec_constant_composites"
SourceExtension "GL_KHR_cooperative_matrix"
SourceExtension "GL_KHR_memory_scope_semantics"
Name 4 "main"
Name 13 "coop"
Name 17 "a"
Name 21 "v"
Name 28 "m"
Name 33 "five"
Name 35 "six"
Name 39 "arr"
Name 44 "arr2"
Name 49 "S"
MemberName 49(S) 0 "a"
MemberName 49(S) 1 "b"
MemberName 49(S) 2 "c"
Name 51 "s2"
Name 54 "SS"
MemberName 54(SS) 0 "s1"
MemberName 54(SS) 1 "s2"
Name 56 "ss"
Decorate 61 BuiltIn WorkgroupSize
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
7: TypeInt 32 0
8: 7(int) Constant 3
9: 7(int) Constant 16
10: 7(int) Constant 0
11: TypeCooperativeMatrixKHR 6(float) 8 9 9 10
12: TypePointer Function 11
14: 6(float) Constant 1065353216
15: 11 ConstantCompositeReplicateEXT 14
16: TypePointer Function 6(float)
18: 6(float) Constant 1073741824
19: TypeVector 6(float) 4
20: TypePointer Function 19(fvec4)
24: 6(float) Constant 1077936128
25: 19(fvec4) ConstantCompositeReplicateEXT 24
26: TypeMatrix 19(fvec4) 4
27: TypePointer Function 26
31: TypeInt 32 1
32: TypePointer Function 31(int)
34: 31(int) Constant 5
36: 31(int) Constant 6
37: TypeArray 31(int) 8
38: TypePointer Function 37
42: TypeArray 37 8
43: TypePointer Function 42
47: 37 ConstantCompositeReplicateEXT 34
48: 42 ConstantCompositeReplicateEXT 47
49(S): TypeStruct 31(int) 31(int) 31(int)
50: TypePointer Function 49(S)
54(SS): TypeStruct 49(S) 49(S)
55: TypePointer Function 54(SS)
59: TypeVector 7(int) 3
60: 7(int) Constant 1
61: 59(ivec3) ConstantCompositeReplicateEXT 60
62: 49(S) ConstantCompositeReplicateEXT 36
63: 54(SS) ConstantCompositeReplicateEXT 62
64: 26 ConstantCompositeReplicateEXT 25
65: 11 ConstantCompositeReplicateEXT 24
4(main): 2 Function None 3
5: Label
13(coop): 12(ptr) Variable Function
17(a): 16(ptr) Variable Function
21(v): 20(ptr) Variable Function
28(m): 27(ptr) Variable Function
33(five): 32(ptr) Variable Function
35(six): 32(ptr) Variable Function
39(arr): 38(ptr) Variable Function
44(arr2): 43(ptr) Variable Function
51(s2): 50(ptr) Variable Function
56(ss): 55(ptr) Variable Function
Store 13(coop) 15
Store 17(a) 18
22: 6(float) Load 17(a)
23: 19(fvec4) CompositeConstructReplicateEXT 22
Store 21(v) 23
Store 21(v) 25
29: 19(fvec4) Load 21(v)
30: 26 CompositeConstructReplicateEXT 29
Store 28(m) 30
Store 33(five) 34
Store 35(six) 36
40: 31(int) Load 33(five)
41: 37 CompositeConstructReplicateEXT 40
Store 39(arr) 41
45: 37 Load 39(arr)
46: 42 CompositeConstructReplicateEXT 45
Store 44(arr2) 46
Store 44(arr2) 48
52: 31(int) Load 35(six)
53: 49(S) CompositeConstructReplicateEXT 52
Store 51(s2) 53
57: 49(S) Load 51(s2)
58: 54(SS) CompositeConstructReplicateEXT 57
Store 56(ss) 58
Return
FunctionEnd

View file

@ -0,0 +1,132 @@
spv.replicatespec.comp
// Module Version 10000
// Generated by (magic number): 8000b
// Id's are bound by 68
Capability Shader
Capability VulkanMemoryModelKHR
Capability CooperativeMatrixKHR
Capability CapabilityReplicatedCompositesEXT
Extension "SPV_EXT_replicated_composites"
Extension "SPV_KHR_cooperative_matrix"
Extension "SPV_KHR_vulkan_memory_model"
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical VulkanKHR
EntryPoint GLCompute 4 "main"
ExecutionMode 4 LocalSize 1 1 1
Source GLSL 450
SourceExtension "GL_EXT_spec_constant_composites"
SourceExtension "GL_KHR_cooperative_matrix"
SourceExtension "GL_KHR_memory_scope_semantics"
Name 4 "main"
Name 13 "coop"
Name 17 "a"
Name 21 "v"
Name 24 "spec_float"
Name 25 "cv"
Name 28 "m"
Name 33 "five"
Name 35 "six"
Name 39 "arr"
Name 44 "arr2"
Name 47 "cfive"
Name 48 "carr"
Name 49 "carr2"
Name 50 "S"
MemberName 50(S) 0 "a"
MemberName 50(S) 1 "b"
MemberName 50(S) 2 "c"
Name 52 "s2"
Name 55 "SS"
MemberName 55(SS) 0 "s1"
MemberName 55(SS) 1 "s2"
Name 57 "ss"
Name 63 "csix"
Name 64 "cs"
Name 65 "css"
Name 66 "cm"
Name 67 "ccoop"
Decorate 24(spec_float) SpecId 2
Decorate 47(cfive) SpecId 0
Decorate 62 BuiltIn WorkgroupSize
Decorate 63(csix) SpecId 1
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
7: TypeInt 32 0
8: 7(int) Constant 3
9: 7(int) Constant 16
10: 7(int) Constant 0
11: TypeCooperativeMatrixKHR 6(float) 8 9 9 10
12: TypePointer Function 11
14: 6(float) Constant 1065353216
15: 11 ConstantCompositeReplicateEXT 14
16: TypePointer Function 6(float)
18: 6(float) Constant 1073741824
19: TypeVector 6(float) 4
20: TypePointer Function 19(fvec4)
24(spec_float): 6(float) SpecConstant 1077936128
25(cv): 19(fvec4) SpecConstantCompositeReplicateEXT 24(spec_float)
26: TypeMatrix 19(fvec4) 4
27: TypePointer Function 26
31: TypeInt 32 1
32: TypePointer Function 31(int)
34: 31(int) Constant 5
36: 31(int) Constant 6
37: TypeArray 31(int) 8
38: TypePointer Function 37
42: TypeArray 37 8
43: TypePointer Function 42
47(cfive): 31(int) SpecConstant 5
48(carr): 37 SpecConstantCompositeReplicateEXT 47(cfive)
49(carr2): 42 SpecConstantCompositeReplicateEXT 48(carr)
50(S): TypeStruct 31(int) 31(int) 31(int)
51: TypePointer Function 50(S)
55(SS): TypeStruct 50(S) 50(S)
56: TypePointer Function 55(SS)
60: TypeVector 7(int) 3
61: 7(int) Constant 1
62: 60(ivec3) ConstantCompositeReplicateEXT 61
63(csix): 31(int) SpecConstant 6
64(cs): 50(S) SpecConstantCompositeReplicateEXT 63(csix)
65(css): 55(SS) SpecConstantCompositeReplicateEXT 64(cs)
66(cm): 26 SpecConstantCompositeReplicateEXT 25(cv)
67(ccoop): 11 SpecConstantCompositeReplicateEXT 24(spec_float)
4(main): 2 Function None 3
5: Label
13(coop): 12(ptr) Variable Function
17(a): 16(ptr) Variable Function
21(v): 20(ptr) Variable Function
28(m): 27(ptr) Variable Function
33(five): 32(ptr) Variable Function
35(six): 32(ptr) Variable Function
39(arr): 38(ptr) Variable Function
44(arr2): 43(ptr) Variable Function
52(s2): 51(ptr) Variable Function
57(ss): 56(ptr) Variable Function
Store 13(coop) 15
Store 17(a) 18
22: 6(float) Load 17(a)
23: 19(fvec4) CompositeConstructReplicateEXT 22
Store 21(v) 23
Store 21(v) 25(cv)
29: 19(fvec4) Load 21(v)
30: 26 CompositeConstructReplicateEXT 29
Store 28(m) 30
Store 33(five) 34
Store 35(six) 36
40: 31(int) Load 33(five)
41: 37 CompositeConstructReplicateEXT 40
Store 39(arr) 41
45: 37 Load 39(arr)
46: 42 CompositeConstructReplicateEXT 45
Store 44(arr2) 46
Store 44(arr2) 49(carr2)
53: 31(int) Load 35(six)
54: 50(S) CompositeConstructReplicateEXT 53
Store 52(s2) 54
58: 50(S) Load 52(s2)
59: 55(SS) CompositeConstructReplicateEXT 58
Store 57(ss) 59
Return
FunctionEnd

View file

@ -0,0 +1,89 @@
spv.specConstantComposite2.vert
// Module Version 10000
// Generated by (magic number): 8000b
// Id's are bound by 43
Capability Shader
Capability Float64
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Vertex 4 "main" 27 42
Source GLSL 450
Name 4 "main"
Name 6 "refer_primary_spec_const("
Name 8 "refer_composite_spec_const("
Name 10 "refer_copmosite_dot_dereference("
Name 12 "refer_composite_bracket_dereference("
Name 16 "refer_spec_const_array_length("
Name 18 "declare_spec_const_in_func("
Name 21 "spec_bool"
Name 27 "color"
Name 28 "spec_int"
Name 33 "len"
Name 37 "spec_float"
Name 39 "spec_double"
Name 42 "global_vec4_array_with_spec_length"
Decorate 21(spec_bool) SpecId 203
Decorate 27(color) Location 0
Decorate 28(spec_int) SpecId 200
Decorate 37(spec_float) SpecId 201
Decorate 39(spec_double) SpecId 202
Decorate 42(global_vec4_array_with_spec_length) Location 0
2: TypeVoid
3: TypeFunction 2
14: TypeInt 32 1
15: TypeFunction 14(int)
20: TypeBool
21(spec_bool): 20(bool) SpecConstantTrue
24: TypeFloat 32
25: TypeVector 24(float) 4
26: TypePointer Output 25(fvec4)
27(color): 26(ptr) Variable Output
28(spec_int): 14(int) SpecConstant 3
32: TypePointer Function 14(int)
37(spec_float): 24(float) SpecConstant 1078523331
38: TypeFloat 64
39(spec_double):38(float64_t) SpecConstant 1413754136 1074340347
40: TypeArray 25(fvec4) 28(spec_int)
41: TypePointer Input 40
42(global_vec4_array_with_spec_length): 41(ptr) Variable Input
4(main): 2 Function None 3
5: Label
Return
FunctionEnd
6(refer_primary_spec_const(): 2 Function None 3
7: Label
SelectionMerge 23 None
BranchConditional 21(spec_bool) 22 23
22: Label
29: 24(float) ConvertSToF 28(spec_int)
30: 25(fvec4) Load 27(color)
31: 25(fvec4) VectorTimesScalar 30 29
Store 27(color) 31
Branch 23
23: Label
Return
FunctionEnd
8(refer_composite_spec_const(): 2 Function None 3
9: Label
Return
FunctionEnd
10(refer_copmosite_dot_dereference(): 2 Function None 3
11: Label
Return
FunctionEnd
12(refer_composite_bracket_dereference(): 2 Function None 3
13: Label
Return
FunctionEnd
16(refer_spec_const_array_length(): 14(int) Function None 15
17: Label
33(len): 32(ptr) Variable Function
Store 33(len) 28(spec_int)
34: 14(int) Load 33(len)
ReturnValue 34
FunctionEnd
18(declare_spec_const_in_func(): 2 Function None 3
19: Label
Return
FunctionEnd