For nonuniformEXT constructor, make a copy of the node to decorate

This commit is contained in:
Jeff Bolz 2019-05-08 10:24:46 -05:00
parent e291f7a09f
commit 88220d507e
9 changed files with 374 additions and 296 deletions

View File

@ -5543,6 +5543,11 @@ spv::Id TGlslangToSpvTraverser::createUnaryOperation(glslang::TOperator op, OpDe
case glslang::EOpConstructReference: case glslang::EOpConstructReference:
unaryOp = spv::OpBitcast; unaryOp = spv::OpBitcast;
break; break;
case glslang::EOpCopyObject:
unaryOp = spv::OpCopyObject;
break;
default: default:
return 0; return 0;
} }

View File

@ -31,8 +31,10 @@ ERROR: node is still EOpNull!
0:27 move second child to first child ( temp int) 0:27 move second child to first child ( temp int)
0:27 'nu_li' ( nonuniform temp int) 0:27 'nu_li' ( nonuniform temp int)
0:27 add ( nonuniform temp int) 0:27 add ( nonuniform temp int)
0:27 'a' ( nonuniform temp int) 0:27 copy object ( nonuniform temp int)
0:27 component-wise multiply ( nonuniform temp int) 0:27 'a' ( temp int)
0:27 copy object ( nonuniform temp int)
0:27 component-wise multiply ( temp int)
0:27 'a' ( temp int) 0:27 'a' ( temp int)
0:27 Constant: 0:27 Constant:
0:27 2 (const int) 0:27 2 (const int)
@ -72,8 +74,10 @@ ERROR: node is still EOpNull!
0:27 move second child to first child ( temp int) 0:27 move second child to first child ( temp int)
0:27 'nu_li' ( nonuniform temp int) 0:27 'nu_li' ( nonuniform temp int)
0:27 add ( nonuniform temp int) 0:27 add ( nonuniform temp int)
0:27 'a' ( nonuniform temp int) 0:27 copy object ( nonuniform temp int)
0:27 component-wise multiply ( nonuniform temp int) 0:27 'a' ( temp int)
0:27 copy object ( nonuniform temp int)
0:27 component-wise multiply ( temp int)
0:27 'a' ( temp int) 0:27 'a' ( temp int)
0:27 Constant: 0:27 Constant:
0:27 2 (const int) 0:27 2 (const int)

View File

@ -1,7 +1,7 @@
spv.nonuniform.frag spv.nonuniform.frag
// Module Version 10000 // Module Version 10000
// Generated by (magic number): 80007 // Generated by (magic number): 80007
// Id's are bound by 210 // Id's are bound by 212
Capability Shader Capability Shader
Capability InputAttachment Capability InputAttachment
@ -22,7 +22,7 @@ spv.nonuniform.frag
Extension "SPV_EXT_descriptor_indexing" Extension "SPV_EXT_descriptor_indexing"
1: ExtInstImport "GLSL.std.450" 1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450 MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 33 90 EntryPoint Fragment 4 "main" 35 92
ExecutionMode 4 OriginUpperLeft ExecutionMode 4 OriginUpperLeft
Source GLSL 450 Source GLSL 450
SourceExtension "GL_EXT_nonuniform_qualifier" SourceExtension "GL_EXT_nonuniform_qualifier"
@ -34,189 +34,189 @@ spv.nonuniform.frag
Name 17 "nu_li" Name 17 "nu_li"
Name 18 "param" Name 18 "param"
Name 20 "param" Name 20 "param"
Name 30 "b" Name 32 "b"
Name 33 "nu_inv4" Name 35 "nu_inv4"
Name 39 "nu_gf" Name 41 "nu_gf"
Name 45 "inputAttachmentDyn" Name 47 "inputAttachmentDyn"
Name 46 "dyn_i" Name 48 "dyn_i"
Name 62 "uniformTexelBufferDyn" Name 64 "uniformTexelBufferDyn"
Name 76 "storageTexelBufferDyn" Name 78 "storageTexelBufferDyn"
Name 85 "uname" Name 87 "uname"
MemberName 85(uname) 0 "a" MemberName 87(uname) 0 "a"
Name 88 "uniformBuffer" Name 90 "uniformBuffer"
Name 90 "nu_ii" Name 92 "nu_ii"
Name 97 "bname" Name 99 "bname"
MemberName 97(bname) 0 "b" MemberName 99(bname) 0 "b"
Name 100 "storageBuffer" Name 102 "storageBuffer"
Name 110 "sampledImage" Name 112 "sampledImage"
Name 125 "storageImage" Name 127 "storageImage"
Name 137 "inputAttachment" Name 139 "inputAttachment"
Name 147 "uniformTexelBuffer" Name 149 "uniformTexelBuffer"
Name 158 "storageTexelBuffer" Name 160 "storageTexelBuffer"
Name 168 "v" Name 170 "v"
Name 183 "uv" Name 185 "uv"
Name 193 "m" Name 195 "m"
Name 201 "S" Name 203 "S"
MemberName 201(S) 0 "a" MemberName 203(S) 0 "a"
Name 203 "s" Name 205 "s"
Decorate 13 DecorationNonUniformEXT Decorate 13 DecorationNonUniformEXT
Decorate 17(nu_li) DecorationNonUniformEXT Decorate 17(nu_li) DecorationNonUniformEXT
Decorate 19 DecorationNonUniformEXT Decorate 19 DecorationNonUniformEXT
Decorate 23 DecorationNonUniformEXT Decorate 24 DecorationNonUniformEXT
Decorate 26 DecorationNonUniformEXT Decorate 28 DecorationNonUniformEXT
Decorate 27 DecorationNonUniformEXT Decorate 29 DecorationNonUniformEXT
Decorate 33(nu_inv4) Location 0 Decorate 35(nu_inv4) Location 0
Decorate 33(nu_inv4) DecorationNonUniformEXT Decorate 35(nu_inv4) DecorationNonUniformEXT
Decorate 38 DecorationNonUniformEXT
Decorate 39(nu_gf) DecorationNonUniformEXT
Decorate 40 DecorationNonUniformEXT Decorate 40 DecorationNonUniformEXT
Decorate 41 DecorationNonUniformEXT Decorate 41(nu_gf) DecorationNonUniformEXT
Decorate 45(inputAttachmentDyn) DescriptorSet 0 Decorate 42 DecorationNonUniformEXT
Decorate 45(inputAttachmentDyn) Binding 0 Decorate 43 DecorationNonUniformEXT
Decorate 45(inputAttachmentDyn) InputAttachmentIndex 0 Decorate 47(inputAttachmentDyn) DescriptorSet 0
Decorate 62(uniformTexelBufferDyn) DescriptorSet 0 Decorate 47(inputAttachmentDyn) Binding 0
Decorate 62(uniformTexelBufferDyn) Binding 1 Decorate 47(inputAttachmentDyn) InputAttachmentIndex 0
Decorate 76(storageTexelBufferDyn) DescriptorSet 0 Decorate 64(uniformTexelBufferDyn) DescriptorSet 0
Decorate 76(storageTexelBufferDyn) Binding 2 Decorate 64(uniformTexelBufferDyn) Binding 1
MemberDecorate 85(uname) 0 Offset 0 Decorate 78(storageTexelBufferDyn) DescriptorSet 0
Decorate 85(uname) Block Decorate 78(storageTexelBufferDyn) Binding 2
Decorate 88(uniformBuffer) DescriptorSet 0 MemberDecorate 87(uname) 0 Offset 0
Decorate 88(uniformBuffer) Binding 3 Decorate 87(uname) Block
Decorate 90(nu_ii) Flat Decorate 90(uniformBuffer) DescriptorSet 0
Decorate 90(nu_ii) Location 1 Decorate 90(uniformBuffer) Binding 3
Decorate 90(nu_ii) DecorationNonUniformEXT Decorate 92(nu_ii) Flat
Decorate 91 DecorationNonUniformEXT Decorate 92(nu_ii) Location 1
Decorate 94 DecorationNonUniformEXT Decorate 92(nu_ii) DecorationNonUniformEXT
MemberDecorate 97(bname) 0 Offset 0 Decorate 93 DecorationNonUniformEXT
Decorate 97(bname) BufferBlock Decorate 96 DecorationNonUniformEXT
Decorate 100(storageBuffer) DescriptorSet 0 MemberDecorate 99(bname) 0 Offset 0
Decorate 100(storageBuffer) Binding 4 Decorate 99(bname) BufferBlock
Decorate 101 DecorationNonUniformEXT Decorate 102(storageBuffer) DescriptorSet 0
Decorate 102(storageBuffer) Binding 4
Decorate 103 DecorationNonUniformEXT Decorate 103 DecorationNonUniformEXT
Decorate 110(sampledImage) DescriptorSet 0 Decorate 105 DecorationNonUniformEXT
Decorate 110(sampledImage) Binding 5 Decorate 112(sampledImage) DescriptorSet 0
Decorate 111 DecorationNonUniformEXT Decorate 112(sampledImage) Binding 5
Decorate 114 DecorationNonUniformEXT Decorate 113 DecorationNonUniformEXT
Decorate 125(storageImage) DescriptorSet 0 Decorate 116 DecorationNonUniformEXT
Decorate 125(storageImage) Binding 6 Decorate 127(storageImage) DescriptorSet 0
Decorate 126 DecorationNonUniformEXT Decorate 127(storageImage) Binding 6
Decorate 129 DecorationNonUniformEXT Decorate 128 DecorationNonUniformEXT
Decorate 137(inputAttachment) DescriptorSet 0 Decorate 131 DecorationNonUniformEXT
Decorate 137(inputAttachment) Binding 7 Decorate 139(inputAttachment) DescriptorSet 0
Decorate 137(inputAttachment) InputAttachmentIndex 1 Decorate 139(inputAttachment) Binding 7
Decorate 138 DecorationNonUniformEXT Decorate 139(inputAttachment) InputAttachmentIndex 1
Decorate 140 DecorationNonUniformEXT Decorate 140 DecorationNonUniformEXT
Decorate 147(uniformTexelBuffer) DescriptorSet 0 Decorate 142 DecorationNonUniformEXT
Decorate 147(uniformTexelBuffer) Binding 8 Decorate 149(uniformTexelBuffer) DescriptorSet 0
Decorate 148 DecorationNonUniformEXT Decorate 149(uniformTexelBuffer) Binding 8
Decorate 150 DecorationNonUniformEXT Decorate 150 DecorationNonUniformEXT
Decorate 158(storageTexelBuffer) DescriptorSet 0 Decorate 152 DecorationNonUniformEXT
Decorate 158(storageTexelBuffer) Binding 9 Decorate 160(storageTexelBuffer) DescriptorSet 0
Decorate 159 DecorationNonUniformEXT Decorate 160(storageTexelBuffer) Binding 9
Decorate 161 DecorationNonUniformEXT Decorate 161 DecorationNonUniformEXT
Decorate 168(v) DecorationNonUniformEXT Decorate 163 DecorationNonUniformEXT
Decorate 171 DecorationNonUniformEXT Decorate 170(v) DecorationNonUniformEXT
Decorate 173 DecorationNonUniformEXT Decorate 173 DecorationNonUniformEXT
Decorate 178 DecorationNonUniformEXT Decorate 175 DecorationNonUniformEXT
Decorate 180 DecorationNonUniformEXT Decorate 180 DecorationNonUniformEXT
Decorate 184 DecorationNonUniformEXT Decorate 182 DecorationNonUniformEXT
Decorate 186 DecorationNonUniformEXT Decorate 186 DecorationNonUniformEXT
Decorate 188 DecorationNonUniformEXT Decorate 188 DecorationNonUniformEXT
Decorate 193(m) DecorationNonUniformEXT Decorate 190 DecorationNonUniformEXT
Decorate 195 DecorationNonUniformEXT Decorate 195(m) DecorationNonUniformEXT
Decorate 203(s) DecorationNonUniformEXT Decorate 197 DecorationNonUniformEXT
Decorate 205 DecorationNonUniformEXT Decorate 205(s) DecorationNonUniformEXT
Decorate 207 DecorationNonUniformEXT Decorate 207 DecorationNonUniformEXT
Decorate 209 DecorationNonUniformEXT
2: TypeVoid 2: TypeVoid
3: TypeFunction 2 3: TypeFunction 2
6: TypeInt 32 1 6: TypeInt 32 1
7: TypePointer Function 6(int) 7: TypePointer Function 6(int)
8: TypeFunction 6(int) 7(ptr) 7(ptr) 8: TypeFunction 6(int) 7(ptr) 7(ptr)
25: 6(int) Constant 2 26: 6(int) Constant 2
28: TypeFloat 32 30: TypeFloat 32
29: TypePointer Function 28(float) 31: TypePointer Function 30(float)
31: TypeVector 28(float) 4 33: TypeVector 30(float) 4
32: TypePointer Input 31(fvec4) 34: TypePointer Input 33(fvec4)
33(nu_inv4): 32(ptr) Variable Input 35(nu_inv4): 34(ptr) Variable Input
34: TypeInt 32 0 36: TypeInt 32 0
35: 34(int) Constant 0 37: 36(int) Constant 0
36: TypePointer Input 28(float) 38: TypePointer Input 30(float)
42: TypeImage 28(float) SubpassData nonsampled format:Unknown 44: TypeImage 30(float) SubpassData nonsampled format:Unknown
43: TypeRuntimeArray 42 45: TypeRuntimeArray 44
44: TypePointer UniformConstant 43 46: TypePointer UniformConstant 45
45(inputAttachmentDyn): 44(ptr) Variable UniformConstant 47(inputAttachmentDyn): 46(ptr) Variable UniformConstant
48: TypePointer UniformConstant 42 50: TypePointer UniformConstant 44
51: 6(int) Constant 0 53: 6(int) Constant 0
52: TypeVector 6(int) 2 54: TypeVector 6(int) 2
53: 52(ivec2) ConstantComposite 51 51 55: 54(ivec2) ConstantComposite 53 53
58: TypeImage 28(float) Buffer sampled format:Unknown 60: TypeImage 30(float) Buffer sampled format:Unknown
59: TypeSampledImage 58 61: TypeSampledImage 60
60: TypeRuntimeArray 59 62: TypeRuntimeArray 61
61: TypePointer UniformConstant 60 63: TypePointer UniformConstant 62
62(uniformTexelBufferDyn): 61(ptr) Variable UniformConstant 64(uniformTexelBufferDyn): 63(ptr) Variable UniformConstant
64: TypePointer UniformConstant 59 66: TypePointer UniformConstant 61
67: 6(int) Constant 1 69: 6(int) Constant 1
73: TypeImage 28(float) Buffer nonsampled format:R32f 75: TypeImage 30(float) Buffer nonsampled format:R32f
74: TypeRuntimeArray 73 76: TypeRuntimeArray 75
75: TypePointer UniformConstant 74 77: TypePointer UniformConstant 76
76(storageTexelBufferDyn): 75(ptr) Variable UniformConstant 78(storageTexelBufferDyn): 77(ptr) Variable UniformConstant
78: TypePointer UniformConstant 73 80: TypePointer UniformConstant 75
85(uname): TypeStruct 28(float) 87(uname): TypeStruct 30(float)
86: TypeRuntimeArray 85(uname) 88: TypeRuntimeArray 87(uname)
87: TypePointer Uniform 86 89: TypePointer Uniform 88
88(uniformBuffer): 87(ptr) Variable Uniform 90(uniformBuffer): 89(ptr) Variable Uniform
89: TypePointer Input 6(int) 91: TypePointer Input 6(int)
90(nu_ii): 89(ptr) Variable Input 92(nu_ii): 91(ptr) Variable Input
92: TypePointer Uniform 28(float) 94: TypePointer Uniform 30(float)
97(bname): TypeStruct 28(float) 99(bname): TypeStruct 30(float)
98: TypeRuntimeArray 97(bname) 100: TypeRuntimeArray 99(bname)
99: TypePointer Uniform 98 101: TypePointer Uniform 100
100(storageBuffer): 99(ptr) Variable Uniform 102(storageBuffer): 101(ptr) Variable Uniform
106: TypeImage 28(float) 2D sampled format:Unknown 108: TypeImage 30(float) 2D sampled format:Unknown
107: TypeSampledImage 106 109: TypeSampledImage 108
108: TypeRuntimeArray 107 110: TypeRuntimeArray 109
109: TypePointer UniformConstant 108 111: TypePointer UniformConstant 110
110(sampledImage): 109(ptr) Variable UniformConstant 112(sampledImage): 111(ptr) Variable UniformConstant
112: TypePointer UniformConstant 107 114: TypePointer UniformConstant 109
115: TypeVector 28(float) 2 117: TypeVector 30(float) 2
116: 28(float) Constant 1056964608 118: 30(float) Constant 1056964608
117: 115(fvec2) ConstantComposite 116 116 119: 117(fvec2) ConstantComposite 118 118
122: TypeImage 28(float) 2D nonsampled format:R32f 124: TypeImage 30(float) 2D nonsampled format:R32f
123: TypeRuntimeArray 122 125: TypeRuntimeArray 124
124: TypePointer UniformConstant 123 126: TypePointer UniformConstant 125
125(storageImage): 124(ptr) Variable UniformConstant 127(storageImage): 126(ptr) Variable UniformConstant
127: TypePointer UniformConstant 122 129: TypePointer UniformConstant 124
130: 52(ivec2) ConstantComposite 67 67 132: 54(ivec2) ConstantComposite 69 69
135: TypeRuntimeArray 42 137: TypeRuntimeArray 44
136: TypePointer UniformConstant 135 138: TypePointer UniformConstant 137
137(inputAttachment): 136(ptr) Variable UniformConstant 139(inputAttachment): 138(ptr) Variable UniformConstant
145: TypeRuntimeArray 59 147: TypeRuntimeArray 61
146: TypePointer UniformConstant 145 148: TypePointer UniformConstant 147
147(uniformTexelBuffer): 146(ptr) Variable UniformConstant 149(uniformTexelBuffer): 148(ptr) Variable UniformConstant
156: TypeRuntimeArray 73 158: TypeRuntimeArray 75
157: TypePointer UniformConstant 156 159: TypePointer UniformConstant 158
158(storageTexelBuffer): 157(ptr) Variable UniformConstant 160(storageTexelBuffer): 159(ptr) Variable UniformConstant
166: TypeVector 6(int) 4 168: TypeVector 6(int) 4
167: TypePointer Function 166(ivec4) 169: TypePointer Function 168(ivec4)
169: 34(int) Constant 1 171: 36(int) Constant 1
176: 34(int) Constant 2 178: 36(int) Constant 2
191: TypeMatrix 31(fvec4) 4 193: TypeMatrix 33(fvec4) 4
192: TypePointer Function 191 194: TypePointer Function 193
201(S): TypeStruct 6(int) 203(S): TypeStruct 6(int)
202: TypePointer Function 201(S) 204: TypePointer Function 203(S)
4(main): 2 Function None 3 4(main): 2 Function None 3
5: Label 5: Label
16(a): 7(ptr) Variable Function 16(a): 7(ptr) Variable Function
17(nu_li): 7(ptr) Variable Function 17(nu_li): 7(ptr) Variable Function
18(param): 7(ptr) Variable Function 18(param): 7(ptr) Variable Function
20(param): 7(ptr) Variable Function 20(param): 7(ptr) Variable Function
30(b): 29(ptr) Variable Function 32(b): 31(ptr) Variable Function
39(nu_gf): 29(ptr) Variable Function 41(nu_gf): 31(ptr) Variable Function
46(dyn_i): 7(ptr) Variable Function 48(dyn_i): 7(ptr) Variable Function
168(v): 167(ptr) Variable Function 170(v): 169(ptr) Variable Function
183(uv): 167(ptr) Variable Function 185(uv): 169(ptr) Variable Function
193(m): 192(ptr) Variable Function 195(m): 194(ptr) Variable Function
203(s): 202(ptr) Variable Function 205(s): 204(ptr) Variable Function
19: 6(int) Load 17(nu_li) 19: 6(int) Load 17(nu_li)
Store 18(param) 19 Store 18(param) 19
21: 6(int) FunctionCall 11(foo(i1;i1;) 18(param) 20(param) 21: 6(int) FunctionCall 11(foo(i1;i1;) 18(param) 20(param)
@ -224,130 +224,132 @@ spv.nonuniform.frag
Store 17(nu_li) 22 Store 17(nu_li) 22
Store 16(a) 21 Store 16(a) 21
23: 6(int) Load 16(a) 23: 6(int) Load 16(a)
24: 6(int) Load 16(a) 24: 6(int) CopyObject 23
26: 6(int) IMul 24 25 25: 6(int) Load 16(a)
27: 6(int) IAdd 23 26 27: 6(int) IMul 25 26
Store 17(nu_li) 27 28: 6(int) CopyObject 27
37: 36(ptr) AccessChain 33(nu_inv4) 35 29: 6(int) IAdd 24 28
38: 28(float) Load 37 Store 17(nu_li) 29
40: 28(float) Load 39(nu_gf) 39: 38(ptr) AccessChain 35(nu_inv4) 37
41: 28(float) FMul 38 40 40: 30(float) Load 39
Store 30(b) 41 42: 30(float) Load 41(nu_gf)
47: 6(int) Load 46(dyn_i) 43: 30(float) FMul 40 42
49: 48(ptr) AccessChain 45(inputAttachmentDyn) 47 Store 32(b) 43
50: 42 Load 49 49: 6(int) Load 48(dyn_i)
54: 31(fvec4) ImageRead 50 53 51: 50(ptr) AccessChain 47(inputAttachmentDyn) 49
55: 28(float) CompositeExtract 54 0 52: 44 Load 51
56: 28(float) Load 30(b) 56: 33(fvec4) ImageRead 52 55
57: 28(float) FAdd 56 55 57: 30(float) CompositeExtract 56 0
Store 30(b) 57 58: 30(float) Load 32(b)
63: 6(int) Load 46(dyn_i) 59: 30(float) FAdd 58 57
65: 64(ptr) AccessChain 62(uniformTexelBufferDyn) 63 Store 32(b) 59
66: 59 Load 65 65: 6(int) Load 48(dyn_i)
68: 58 Image 66 67: 66(ptr) AccessChain 64(uniformTexelBufferDyn) 65
69: 31(fvec4) ImageFetch 68 67 68: 61 Load 67
70: 28(float) CompositeExtract 69 0 70: 60 Image 68
71: 28(float) Load 30(b) 71: 33(fvec4) ImageFetch 70 69
72: 28(float) FAdd 71 70 72: 30(float) CompositeExtract 71 0
Store 30(b) 72 73: 30(float) Load 32(b)
77: 6(int) Load 46(dyn_i) 74: 30(float) FAdd 73 72
79: 78(ptr) AccessChain 76(storageTexelBufferDyn) 77 Store 32(b) 74
80: 73 Load 79 79: 6(int) Load 48(dyn_i)
81: 31(fvec4) ImageRead 80 67 81: 80(ptr) AccessChain 78(storageTexelBufferDyn) 79
82: 28(float) CompositeExtract 81 0 82: 75 Load 81
83: 28(float) Load 30(b) 83: 33(fvec4) ImageRead 82 69
84: 28(float) FAdd 83 82 84: 30(float) CompositeExtract 83 0
Store 30(b) 84 85: 30(float) Load 32(b)
91: 6(int) Load 90(nu_ii) 86: 30(float) FAdd 85 84
93: 92(ptr) AccessChain 88(uniformBuffer) 91 51 Store 32(b) 86
94: 28(float) Load 93 93: 6(int) Load 92(nu_ii)
95: 28(float) Load 30(b) 95: 94(ptr) AccessChain 90(uniformBuffer) 93 53
96: 28(float) FAdd 95 94 96: 30(float) Load 95
Store 30(b) 96 97: 30(float) Load 32(b)
101: 6(int) Load 90(nu_ii) 98: 30(float) FAdd 97 96
102: 92(ptr) AccessChain 100(storageBuffer) 101 51 Store 32(b) 98
103: 28(float) Load 102 103: 6(int) Load 92(nu_ii)
104: 28(float) Load 30(b) 104: 94(ptr) AccessChain 102(storageBuffer) 103 53
105: 28(float) FAdd 104 103 105: 30(float) Load 104
Store 30(b) 105 106: 30(float) Load 32(b)
111: 6(int) Load 90(nu_ii) 107: 30(float) FAdd 106 105
113: 112(ptr) AccessChain 110(sampledImage) 111 Store 32(b) 107
114: 107 Load 113 113: 6(int) Load 92(nu_ii)
118: 31(fvec4) ImageSampleImplicitLod 114 117 115: 114(ptr) AccessChain 112(sampledImage) 113
119: 28(float) CompositeExtract 118 0 116: 109 Load 115
120: 28(float) Load 30(b) 120: 33(fvec4) ImageSampleImplicitLod 116 119
121: 28(float) FAdd 120 119 121: 30(float) CompositeExtract 120 0
Store 30(b) 121 122: 30(float) Load 32(b)
126: 6(int) Load 90(nu_ii) 123: 30(float) FAdd 122 121
128: 127(ptr) AccessChain 125(storageImage) 126 Store 32(b) 123
129: 122 Load 128 128: 6(int) Load 92(nu_ii)
131: 31(fvec4) ImageRead 129 130 130: 129(ptr) AccessChain 127(storageImage) 128
132: 28(float) CompositeExtract 131 0 131: 124 Load 130
133: 28(float) Load 30(b) 133: 33(fvec4) ImageRead 131 132
134: 28(float) FAdd 133 132 134: 30(float) CompositeExtract 133 0
Store 30(b) 134 135: 30(float) Load 32(b)
138: 6(int) Load 90(nu_ii) 136: 30(float) FAdd 135 134
139: 48(ptr) AccessChain 137(inputAttachment) 138 Store 32(b) 136
140: 42 Load 139 140: 6(int) Load 92(nu_ii)
141: 31(fvec4) ImageRead 140 53 141: 50(ptr) AccessChain 139(inputAttachment) 140
142: 28(float) CompositeExtract 141 0 142: 44 Load 141
143: 28(float) Load 30(b) 143: 33(fvec4) ImageRead 142 55
144: 28(float) FAdd 143 142 144: 30(float) CompositeExtract 143 0
Store 30(b) 144 145: 30(float) Load 32(b)
148: 6(int) Load 90(nu_ii) 146: 30(float) FAdd 145 144
149: 64(ptr) AccessChain 147(uniformTexelBuffer) 148 Store 32(b) 146
150: 59 Load 149 150: 6(int) Load 92(nu_ii)
151: 58 Image 150 151: 66(ptr) AccessChain 149(uniformTexelBuffer) 150
152: 31(fvec4) ImageFetch 151 67 152: 61 Load 151
153: 28(float) CompositeExtract 152 0 153: 60 Image 152
154: 28(float) Load 30(b) 154: 33(fvec4) ImageFetch 153 69
155: 28(float) FAdd 154 153 155: 30(float) CompositeExtract 154 0
Store 30(b) 155 156: 30(float) Load 32(b)
159: 6(int) Load 90(nu_ii) 157: 30(float) FAdd 156 155
160: 78(ptr) AccessChain 158(storageTexelBuffer) 159 Store 32(b) 157
161: 73 Load 160 161: 6(int) Load 92(nu_ii)
162: 31(fvec4) ImageRead 161 67 162: 80(ptr) AccessChain 160(storageTexelBuffer) 161
163: 28(float) CompositeExtract 162 0 163: 75 Load 162
164: 28(float) Load 30(b) 164: 33(fvec4) ImageRead 163 69
165: 28(float) FAdd 164 163 165: 30(float) CompositeExtract 164 0
Store 30(b) 165 166: 30(float) Load 32(b)
170: 7(ptr) AccessChain 168(v) 169 167: 30(float) FAdd 166 165
171: 6(int) Load 170 Store 32(b) 167
172: 92(ptr) AccessChain 88(uniformBuffer) 171 51 172: 7(ptr) AccessChain 170(v) 171
173: 28(float) Load 172 173: 6(int) Load 172
174: 28(float) Load 30(b) 174: 94(ptr) AccessChain 90(uniformBuffer) 173 53
175: 28(float) FAdd 174 173 175: 30(float) Load 174
Store 30(b) 175 176: 30(float) Load 32(b)
177: 7(ptr) AccessChain 168(v) 176 177: 30(float) FAdd 176 175
178: 6(int) Load 177 Store 32(b) 177
179: 92(ptr) AccessChain 88(uniformBuffer) 178 51 179: 7(ptr) AccessChain 170(v) 178
180: 28(float) Load 179 180: 6(int) Load 179
181: 28(float) Load 30(b) 181: 94(ptr) AccessChain 90(uniformBuffer) 180 53
182: 28(float) FAdd 181 180 182: 30(float) Load 181
Store 30(b) 182 183: 30(float) Load 32(b)
184: 6(int) Load 90(nu_ii) 184: 30(float) FAdd 183 182
185: 7(ptr) AccessChain 183(uv) 184 Store 32(b) 184
186: 6(int) Load 185 186: 6(int) Load 92(nu_ii)
187: 92(ptr) AccessChain 88(uniformBuffer) 186 51 187: 7(ptr) AccessChain 185(uv) 186
188: 28(float) Load 187 188: 6(int) Load 187
189: 28(float) Load 30(b) 189: 94(ptr) AccessChain 90(uniformBuffer) 188 53
190: 28(float) FAdd 189 188 190: 30(float) Load 189
Store 30(b) 190 191: 30(float) Load 32(b)
194: 29(ptr) AccessChain 193(m) 25 176 192: 30(float) FAdd 191 190
195: 28(float) Load 194 Store 32(b) 192
196: 6(int) ConvertFToS 195 196: 31(ptr) AccessChain 195(m) 26 178
197: 92(ptr) AccessChain 88(uniformBuffer) 196 51 197: 30(float) Load 196
198: 28(float) Load 197 198: 6(int) ConvertFToS 197
199: 28(float) Load 30(b) 199: 94(ptr) AccessChain 90(uniformBuffer) 198 53
200: 28(float) FAdd 199 198 200: 30(float) Load 199
Store 30(b) 200 201: 30(float) Load 32(b)
204: 7(ptr) AccessChain 203(s) 51 202: 30(float) FAdd 201 200
205: 6(int) Load 204 Store 32(b) 202
206: 92(ptr) AccessChain 88(uniformBuffer) 205 51 206: 7(ptr) AccessChain 205(s) 53
207: 28(float) Load 206 207: 6(int) Load 206
208: 28(float) Load 30(b) 208: 94(ptr) AccessChain 90(uniformBuffer) 207 53
209: 28(float) FAdd 208 207 209: 30(float) Load 208
Store 30(b) 209 210: 30(float) Load 32(b)
211: 30(float) FAdd 210 209
Store 32(b) 211
Return Return
FunctionEnd FunctionEnd
11(foo(i1;i1;): 6(int) Function None 8 11(foo(i1;i1;): 6(int) Function None 8

View File

@ -0,0 +1,53 @@
spv.nonuniform2.frag
// Module Version 10000
// Generated by (magic number): 80007
// Id's are bound by 24
Capability Shader
Capability ImageBuffer
Capability CapabilityShaderNonUniformEXT
Capability CapabilityRuntimeDescriptorArrayEXT
Capability CapabilityStorageTexelBufferArrayNonUniformIndexingEXT
Extension "SPV_EXT_descriptor_indexing"
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 9 16
ExecutionMode 4 OriginUpperLeft
Source GLSL 450
SourceExtension "GL_EXT_nonuniform_qualifier"
Name 4 "main"
Name 9 "FragColor"
Name 13 "data"
Name 16 "rIndex"
Decorate 9(FragColor) Location 0
Decorate 13(data) DescriptorSet 0
Decorate 13(data) Binding 4
Decorate 16(rIndex) Flat
Decorate 16(rIndex) Location 3
Decorate 18 DecorationNonUniformEXT
Decorate 21 DecorationNonUniformEXT
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
7: TypeVector 6(float) 4
8: TypePointer Output 7(fvec4)
9(FragColor): 8(ptr) Variable Output
10: TypeImage 6(float) Buffer nonsampled format:Rgba32f
11: TypeRuntimeArray 10
12: TypePointer UniformConstant 11
13(data): 12(ptr) Variable UniformConstant
14: TypeInt 32 1
15: TypePointer Input 14(int)
16(rIndex): 15(ptr) Variable Input
19: TypePointer UniformConstant 10
22: 14(int) Constant 0
4(main): 2 Function None 3
5: Label
17: 14(int) Load 16(rIndex)
18: 14(int) CopyObject 17
20: 19(ptr) AccessChain 13(data) 18
21: 10 Load 20
23: 7(fvec4) ImageRead 21 22
Store 9(FragColor) 23
Return
FunctionEnd

View File

@ -0,0 +1,9 @@
#version 450
#extension GL_EXT_nonuniform_qualifier : require
layout(set=0,binding=4,rgba32f) uniform imageBuffer data[];
layout(location = 0) out vec4 FragColor;
layout(location = 3) in flat int rIndex;
void main()
{
FragColor = imageLoad(data[nonuniformEXT(rIndex)], 0);
}

View File

@ -85,6 +85,8 @@ enum TOperator {
EOpPreIncrement, EOpPreIncrement,
EOpPreDecrement, EOpPreDecrement,
EOpCopyObject,
// (u)int* -> bool // (u)int* -> bool
EOpConvInt8ToBool, EOpConvInt8ToBool,
EOpConvUint8ToBool, EOpConvUint8ToBool,

View File

@ -6951,9 +6951,10 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, T
break; break;
case EOpConstructNonuniform: case EOpConstructNonuniform:
node->getWritableType().getQualifier().nonUniform = true; // Make a nonuniform copy of node
return node; newNode = intermediate.addBuiltInFunctionCall(node->getLoc(), EOpCopyObject, true, node, node->getType());
break; newNode->getWritableType().getQualifier().nonUniform = true;
return newNode;
case EOpConstructReference: case EOpConstructReference:
// construct reference from reference // construct reference from reference

View File

@ -237,6 +237,7 @@ bool TOutputTraverser::visitUnary(TVisit /* visit */, TIntermUnary* node)
case EOpPostDecrement: out.debug << "Post-Decrement"; break; case EOpPostDecrement: out.debug << "Post-Decrement"; break;
case EOpPreIncrement: out.debug << "Pre-Increment"; break; case EOpPreIncrement: out.debug << "Pre-Increment"; break;
case EOpPreDecrement: out.debug << "Pre-Decrement"; break; case EOpPreDecrement: out.debug << "Pre-Decrement"; break;
case EOpCopyObject: out.debug << "copy object"; break;
// * -> bool // * -> bool
case EOpConvInt8ToBool: out.debug << "Convert int8_t to bool"; break; case EOpConvInt8ToBool: out.debug << "Convert int8_t to bool"; break;

View File

@ -335,6 +335,7 @@ INSTANTIATE_TEST_CASE_P(
"spv.noDeadDecorations.vert", "spv.noDeadDecorations.vert",
"spv.nonSquare.vert", "spv.nonSquare.vert",
"spv.nonuniform.frag", "spv.nonuniform.frag",
"spv.nonuniform2.frag",
"spv.noWorkgroup.comp", "spv.noWorkgroup.comp",
"spv.offsets.frag", "spv.offsets.frag",
"spv.Operations.frag", "spv.Operations.frag",