Commit c4f5ec87 by John Kessenich

nonuniform: expand test for all types that can be arrayed.

parent d89e5afa
spv.nonuniform.frag spv.nonuniform.frag
WARNING: 0:8: '[]' : assuming array size of one for compile-time checking of binding numbers for unsized array
// Module Version 10000 // Module Version 10000
// Generated by (magic number): 80006 // Generated by (magic number): 80006
// Id's are bound by 57 // Id's are bound by 166
Capability Shader Capability Shader
Capability InputAttachment
Capability SampledBuffer
Capability ImageBuffer
Capability CapabilityShaderNonUniformEXT Capability CapabilityShaderNonUniformEXT
Capability CapabilityRuntimeDescriptorArrayEXT Capability CapabilityRuntimeDescriptorArrayEXT
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 48 EntryPoint Fragment 4 "main" 33 90
ExecutionMode 4 OriginUpperLeft ExecutionMode 4 OriginUpperLeft
Source GLSL 450 Source GLSL 450
SourceExtension "GL_EXT_nonuniform_qualifier" SourceExtension "GL_EXT_nonuniform_qualifier"
...@@ -26,8 +27,22 @@ WARNING: 0:8: '[]' : assuming array size of one for compile-time checking of bin ...@@ -26,8 +27,22 @@ WARNING: 0:8: '[]' : assuming array size of one for compile-time checking of bin
Name 30 "b" Name 30 "b"
Name 33 "nu_inv4" Name 33 "nu_inv4"
Name 39 "nu_gf" Name 39 "nu_gf"
Name 46 "s2d" Name 45 "inputAttachmentDyn"
Name 48 "nu_ii" Name 46 "dyn_i"
Name 62 "uniformTexelBufferDyn"
Name 76 "storageTexelBufferDyn"
Name 85 "uname"
MemberName 85(uname) 0 "a"
Name 88 "uniformBuffer"
Name 90 "nu_ii"
Name 97 "bname"
MemberName 97(bname) 0 "b"
Name 100 "storageBuffer"
Name 111 "sampledImage"
Name 125 "storageImage"
Name 137 "inputAttachment"
Name 147 "uniformTexelBuffer"
Name 158 "storageTexelBuffer"
Decorate 13 DecorationNonUniformEXT Decorate 13 DecorationNonUniformEXT
Decorate 17(nu_li) DecorationNonUniformEXT Decorate 17(nu_li) DecorationNonUniformEXT
Decorate 19 DecorationNonUniformEXT Decorate 19 DecorationNonUniformEXT
...@@ -37,12 +52,42 @@ WARNING: 0:8: '[]' : assuming array size of one for compile-time checking of bin ...@@ -37,12 +52,42 @@ WARNING: 0:8: '[]' : assuming array size of one for compile-time checking of bin
Decorate 33(nu_inv4) DecorationNonUniformEXT Decorate 33(nu_inv4) DecorationNonUniformEXT
Decorate 39(nu_gf) DecorationNonUniformEXT Decorate 39(nu_gf) DecorationNonUniformEXT
Decorate 40 DecorationNonUniformEXT Decorate 40 DecorationNonUniformEXT
Decorate 46(s2d) DescriptorSet 0 Decorate 45(inputAttachmentDyn) DescriptorSet 0
Decorate 46(s2d) Binding 0 Decorate 45(inputAttachmentDyn) Binding 0
Decorate 48(nu_ii) Flat Decorate 45(inputAttachmentDyn) InputAttachmentIndex 0
Decorate 48(nu_ii) Location 1 Decorate 62(uniformTexelBufferDyn) DescriptorSet 0
Decorate 48(nu_ii) DecorationNonUniformEXT Decorate 62(uniformTexelBufferDyn) Binding 1
Decorate 49 DecorationNonUniformEXT Decorate 76(storageTexelBufferDyn) DescriptorSet 0
Decorate 76(storageTexelBufferDyn) Binding 2
MemberDecorate 85(uname) 0 Offset 0
Decorate 85(uname) Block
Decorate 88(uniformBuffer) DescriptorSet 0
Decorate 88(uniformBuffer) Binding 3
Decorate 90(nu_ii) Flat
Decorate 90(nu_ii) Location 1
Decorate 90(nu_ii) DecorationNonUniformEXT
Decorate 91 DecorationNonUniformEXT
MemberDecorate 97(bname) 0 Offset 0
Decorate 97(bname) BufferBlock
Decorate 100(storageBuffer) DescriptorSet 0
Decorate 100(storageBuffer) Binding 4
Decorate 101 DecorationNonUniformEXT
Decorate 111(sampledImage) DescriptorSet 0
Decorate 111(sampledImage) Binding 5
Decorate 112 DecorationNonUniformEXT
Decorate 125(storageImage) DescriptorSet 0
Decorate 125(storageImage) Binding 6
Decorate 126 DecorationNonUniformEXT
Decorate 137(inputAttachment) DescriptorSet 0
Decorate 137(inputAttachment) Binding 7
Decorate 137(inputAttachment) InputAttachmentIndex 1
Decorate 138 DecorationNonUniformEXT
Decorate 147(uniformTexelBuffer) DescriptorSet 0
Decorate 147(uniformTexelBuffer) Binding 8
Decorate 148 DecorationNonUniformEXT
Decorate 158(storageTexelBuffer) DescriptorSet 0
Decorate 158(storageTexelBuffer) Binding 9
Decorate 159 DecorationNonUniformEXT
2: TypeVoid 2: TypeVoid
3: TypeFunction 2 3: TypeFunction 2
6: TypeInt 32 1 6: TypeInt 32 1
...@@ -57,17 +102,61 @@ WARNING: 0:8: '[]' : assuming array size of one for compile-time checking of bin ...@@ -57,17 +102,61 @@ WARNING: 0:8: '[]' : assuming array size of one for compile-time checking of bin
34: TypeInt 32 0 34: TypeInt 32 0
35: 34(int) Constant 0 35: 34(int) Constant 0
36: TypePointer Input 28(float) 36: TypePointer Input 28(float)
42: TypeImage 28(float) 2D sampled format:Unknown 42: TypeImage 28(float) SubpassData nonsampled format:Unknown
43: TypeSampledImage 42 43: TypeRuntimeArray 42
44: TypeRuntimeArray 43 44: TypePointer UniformConstant 43
45: TypePointer UniformConstant 44 45(inputAttachmentDyn): 44(ptr) Variable UniformConstant
46(s2d): 45(ptr) Variable UniformConstant 48: TypePointer UniformConstant 42
47: TypePointer Input 6(int) 51: 6(int) Constant 0
48(nu_ii): 47(ptr) Variable Input 52: TypeVector 6(int) 2
50: TypePointer UniformConstant 43 53: 52(ivec2) ConstantComposite 51 51
53: TypeVector 28(float) 2 58: TypeImage 28(float) Buffer sampled format:Unknown
54: 28(float) Constant 1056964608 59: TypeSampledImage 58
55: 53(fvec2) ConstantComposite 54 54 60: TypeRuntimeArray 59
61: TypePointer UniformConstant 60
62(uniformTexelBufferDyn): 61(ptr) Variable UniformConstant
64: TypePointer UniformConstant 59
67: 6(int) Constant 1
73: TypeImage 28(float) Buffer nonsampled format:R32f
74: TypeRuntimeArray 73
75: TypePointer UniformConstant 74
76(storageTexelBufferDyn): 75(ptr) Variable UniformConstant
78: TypePointer UniformConstant 73
85(uname): TypeStruct 28(float)
86: TypeRuntimeArray 85(uname)
87: TypePointer Uniform 86
88(uniformBuffer): 87(ptr) Variable Uniform
89: TypePointer Input 6(int)
90(nu_ii): 89(ptr) Variable Input
92: TypePointer Uniform 28(float)
97(bname): TypeStruct 28(float)
98: TypeRuntimeArray 97(bname)
99: TypePointer Uniform 98
100(storageBuffer): 99(ptr) Variable Uniform
107: TypeImage 28(float) 2D sampled format:Unknown
108: TypeSampledImage 107
109: TypeRuntimeArray 108
110: TypePointer UniformConstant 109
111(sampledImage): 110(ptr) Variable UniformConstant
113: TypePointer UniformConstant 108
116: TypeVector 28(float) 2
117: 28(float) Constant 1056964608
118: 116(fvec2) ConstantComposite 117 117
122: TypeImage 28(float) 2D nonsampled format:R32f
123: TypeRuntimeArray 122
124: TypePointer UniformConstant 123
125(storageImage): 124(ptr) Variable UniformConstant
127: TypePointer UniformConstant 122
130: 52(ivec2) ConstantComposite 67 67
135: TypeRuntimeArray 42
136: TypePointer UniformConstant 135
137(inputAttachment): 136(ptr) Variable UniformConstant
145: TypeRuntimeArray 59
146: TypePointer UniformConstant 145
147(uniformTexelBuffer): 146(ptr) Variable UniformConstant
156: TypeRuntimeArray 73
157: TypePointer UniformConstant 156
158(storageTexelBuffer): 157(ptr) Variable UniformConstant
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
...@@ -76,6 +165,7 @@ WARNING: 0:8: '[]' : assuming array size of one for compile-time checking of bin ...@@ -76,6 +165,7 @@ WARNING: 0:8: '[]' : assuming array size of one for compile-time checking of bin
20(param): 7(ptr) Variable Function 20(param): 7(ptr) Variable Function
30(b): 29(ptr) Variable Function 30(b): 29(ptr) Variable Function
39(nu_gf): 29(ptr) Variable Function 39(nu_gf): 29(ptr) Variable Function
46(dyn_i): 7(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)
...@@ -92,10 +182,83 @@ WARNING: 0:8: '[]' : assuming array size of one for compile-time checking of bin ...@@ -92,10 +182,83 @@ WARNING: 0:8: '[]' : assuming array size of one for compile-time checking of bin
40: 28(float) Load 39(nu_gf) 40: 28(float) Load 39(nu_gf)
41: 28(float) FMul 38 40 41: 28(float) FMul 38 40
Store 30(b) 41 Store 30(b) 41
49: 6(int) Load 48(nu_ii) 47: 6(int) Load 46(dyn_i)
51: 50(ptr) AccessChain 46(s2d) 49 49: 48(ptr) AccessChain 45(inputAttachmentDyn) 47
52: 43 Load 51 50: 42 Load 49
56: 31(fvec4) ImageSampleImplicitLod 52 55 54: 31(fvec4) ImageRead 50 53
55: 28(float) CompositeExtract 54 0
56: 28(float) Load 30(b)
57: 28(float) FAdd 56 55
Store 30(b) 57
63: 6(int) Load 46(dyn_i)
65: 64(ptr) AccessChain 62(uniformTexelBufferDyn) 63
66: 59 Load 65
68: 58 Image 66
69: 31(fvec4) ImageFetch 68 67
70: 28(float) CompositeExtract 69 0
71: 28(float) Load 30(b)
72: 28(float) FAdd 71 70
Store 30(b) 72
77: 6(int) Load 46(dyn_i)
79: 78(ptr) AccessChain 76(storageTexelBufferDyn) 77
80: 73 Load 79
81: 31(fvec4) ImageRead 80 67
82: 28(float) CompositeExtract 81 0
83: 28(float) Load 30(b)
84: 28(float) FAdd 83 82
Store 30(b) 84
91: 6(int) Load 90(nu_ii)
93: 92(ptr) AccessChain 88(uniformBuffer) 91 51
94: 28(float) Load 93
95: 28(float) Load 30(b)
96: 28(float) FAdd 95 94
Store 30(b) 96
101: 6(int) Load 90(nu_ii)
102: 92(ptr) AccessChain 100(storageBuffer) 101 51
103: 28(float) Load 102
104: 28(float) Load 30(b)
105: 28(float) FAdd 104 103
Store 30(b) 105
106: 28(float) Load 30(b)
112: 6(int) Load 90(nu_ii)
114: 113(ptr) AccessChain 111(sampledImage) 112
115: 108 Load 114
119: 31(fvec4) ImageSampleImplicitLod 115 118
120: 28(float) CompositeExtract 119 0
121: 28(float) FAdd 106 120
126: 6(int) Load 90(nu_ii)
128: 127(ptr) AccessChain 125(storageImage) 126
129: 122 Load 128
131: 31(fvec4) ImageRead 129 130
132: 28(float) CompositeExtract 131 0
133: 28(float) Load 30(b)
134: 28(float) FAdd 133 132
Store 30(b) 134
138: 6(int) Load 90(nu_ii)
139: 48(ptr) AccessChain 137(inputAttachment) 138
140: 42 Load 139
141: 31(fvec4) ImageRead 140 53
142: 28(float) CompositeExtract 141 0
143: 28(float) Load 30(b)
144: 28(float) FAdd 143 142
Store 30(b) 144
148: 6(int) Load 90(nu_ii)
149: 64(ptr) AccessChain 147(uniformTexelBuffer) 148
150: 59 Load 149
151: 58 Image 150
152: 31(fvec4) ImageFetch 151 67
153: 28(float) CompositeExtract 152 0
154: 28(float) Load 30(b)
155: 28(float) FAdd 154 153
Store 30(b) 155
159: 6(int) Load 90(nu_ii)
160: 78(ptr) AccessChain 158(storageTexelBuffer) 159
161: 73 Load 160
162: 31(fvec4) ImageRead 161 67
163: 28(float) CompositeExtract 162 0
164: 28(float) Load 30(b)
165: 28(float) FAdd 164 163
Store 30(b) 165
Return Return
FunctionEnd FunctionEnd
11(foo(i1;i1;): 6(int) Function None 8 11(foo(i1;i1;): 6(int) Function None 8
......
...@@ -5,7 +5,17 @@ ...@@ -5,7 +5,17 @@
layout(location=0) nonuniformEXT in vec4 nu_inv4; layout(location=0) nonuniformEXT in vec4 nu_inv4;
nonuniformEXT float nu_gf; nonuniformEXT float nu_gf;
layout(location=1) in nonuniformEXT flat int nu_ii; layout(location=1) in nonuniformEXT flat int nu_ii;
layout(binding=0) uniform sampler2D s2d[];
layout(binding=0, input_attachment_index = 0) uniform subpassInput inputAttachmentDyn[];
layout(binding=1) uniform samplerBuffer uniformTexelBufferDyn[];
layout(binding=2, r32f) uniform imageBuffer storageTexelBufferDyn[];
layout(binding=3) uniform uname { float a; } uniformBuffer[];
layout(binding=4) buffer bname { float b; } storageBuffer[];
layout(binding=5) uniform sampler2D sampledImage[];
layout(binding=6, r32f) uniform image2D storageImage[];
layout(binding=7, input_attachment_index = 1) uniform subpassInput inputAttachment[];
layout(binding=8) uniform samplerBuffer uniformTexelBuffer[];
layout(binding=9, r32f) uniform imageBuffer storageTexelBuffer[];
nonuniformEXT int foo(nonuniformEXT int nupi, nonuniformEXT out int f) nonuniformEXT int foo(nonuniformEXT int nupi, nonuniformEXT out int f)
{ {
...@@ -15,11 +25,21 @@ nonuniformEXT int foo(nonuniformEXT int nupi, nonuniformEXT out int f) ...@@ -15,11 +25,21 @@ nonuniformEXT int foo(nonuniformEXT int nupi, nonuniformEXT out int f)
void main() void main()
{ {
nonuniformEXT int nu_li; nonuniformEXT int nu_li;
int dyn_i;
int a = foo(nu_li, nu_li); int a = foo(nu_li, nu_li);
nu_li = nonuniformEXT(a) + nonuniformEXT(a * 2); nu_li = nonuniformEXT(a) + nonuniformEXT(a * 2);
float b; float b;
b = nu_inv4.x * nu_gf; b = nu_inv4.x * nu_gf;
texture(s2d[nu_ii], vec2(0.5)); b += subpassLoad(inputAttachmentDyn[dyn_i]).x;
} b += texelFetch(uniformTexelBufferDyn[dyn_i], 1).x;
\ No newline at end of file b += imageLoad(storageTexelBufferDyn[dyn_i], 1).x;
b += uniformBuffer[nu_ii].a;
b += storageBuffer[nu_ii].b;
b + texture(sampledImage[nu_ii], vec2(0.5)).x;
b += imageLoad(storageImage[nu_ii], ivec2(1)).x;
b += subpassLoad(inputAttachment[nu_ii]).x;
b += texelFetch(uniformTexelBuffer[nu_ii], 1).x;
b += imageLoad(storageTexelBuffer[nu_ii], 1).x;
}
...@@ -4679,11 +4679,15 @@ void TParseContext::layoutTypeCheck(const TSourceLoc& loc, const TType& type) ...@@ -4679,11 +4679,15 @@ void TParseContext::layoutTypeCheck(const TSourceLoc& loc, const TType& type)
if (type.getBasicType() == EbtSampler) { if (type.getBasicType() == EbtSampler) {
int lastBinding = qualifier.layoutBinding; int lastBinding = qualifier.layoutBinding;
if (type.isArray()) { if (type.isArray()) {
if (type.isSizedArray()) if (spvVersion.vulkan > 0)
lastBinding += type.getCumulativeArraySize();
else {
lastBinding += 1; lastBinding += 1;
warn(loc, "assuming array size of one for compile-time checking of binding numbers for unsized array", "[]", ""); else {
if (type.isSizedArray())
lastBinding += type.getCumulativeArraySize();
else {
lastBinding += 1;
warn(loc, "assuming array size of one for compile-time checking of binding numbers for unsized array", "[]", "");
}
} }
} }
if (spvVersion.vulkan == 0 && lastBinding >= resources.maxCombinedTextureImageUnits) if (spvVersion.vulkan == 0 && lastBinding >= resources.maxCombinedTextureImageUnits)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment