Fix #809: smear scalar condition in OpSelect for selecting vector operands.
This commit is contained in:
parent
4dc835c369
commit
e434ad923e
@ -1823,7 +1823,15 @@ bool TGlslangToSpvTraverser::visitSelection(glslang::TVisit /* visit */, glslang
|
|||||||
node->getFalseBlock()->traverse(this);
|
node->getFalseBlock()->traverse(this);
|
||||||
spv::Id falseValue = accessChainLoad(node->getTrueBlock()->getAsTyped()->getType());
|
spv::Id falseValue = accessChainLoad(node->getTrueBlock()->getAsTyped()->getType());
|
||||||
|
|
||||||
spv::Id select = builder.createTriOp(spv::OpSelect, convertGlslangToSpvType(node->getType()), condition, trueValue, falseValue);
|
// smear condition to vector, if necessary (AST is always scalar)
|
||||||
|
if (builder.isVector(trueValue))
|
||||||
|
condition = builder.smearScalar(spv::NoPrecision, condition,
|
||||||
|
builder.makeVectorType(builder.makeBoolType(),
|
||||||
|
builder.getNumComponents(trueValue)));
|
||||||
|
|
||||||
|
spv::Id select = builder.createTriOp(spv::OpSelect,
|
||||||
|
convertGlslangToSpvType(node->getType()), condition,
|
||||||
|
trueValue, falseValue);
|
||||||
builder.clearAccessChain();
|
builder.clearAccessChain();
|
||||||
builder.setAccessChainRValue(select);
|
builder.setAccessChainRValue(select);
|
||||||
};
|
};
|
||||||
|
@ -3,7 +3,7 @@ Warning, version 450 is not yet complete; most version-specific features are pre
|
|||||||
|
|
||||||
// Module Version 10000
|
// Module Version 10000
|
||||||
// Generated by (magic number): 80001
|
// Generated by (magic number): 80001
|
||||||
// Id's are bound by 44
|
// Id's are bound by 46
|
||||||
|
|
||||||
Capability Shader
|
Capability Shader
|
||||||
1: ExtInstImport "GLSL.std.450"
|
1: ExtInstImport "GLSL.std.450"
|
||||||
@ -56,7 +56,8 @@ Warning, version 450 is not yet complete; most version-specific features are pre
|
|||||||
38: 18(fvec4) ConstantComposite 37 37 37 37
|
38: 18(fvec4) ConstantComposite 37 37 37 37
|
||||||
39: 17(float) Constant 1065353216
|
39: 17(float) Constant 1065353216
|
||||||
40: 18(fvec4) ConstantComposite 39 39 39 39
|
40: 18(fvec4) ConstantComposite 39 39 39 39
|
||||||
42: TypePointer Output 18(fvec4)
|
41: TypeVector 6(bool) 4
|
||||||
|
44: TypePointer Output 18(fvec4)
|
||||||
4(main): 2 Function None 3
|
4(main): 2 Function None 3
|
||||||
5: Label
|
5: Label
|
||||||
30(param): 7(ptr) Variable Function
|
30(param): 7(ptr) Variable Function
|
||||||
@ -65,9 +66,10 @@ Warning, version 450 is not yet complete; most version-specific features are pre
|
|||||||
35: 6(bool) INotEqual 33 34
|
35: 6(bool) INotEqual 33 34
|
||||||
Store 30(param) 35
|
Store 30(param) 35
|
||||||
36: 6(bool) FunctionCall 10(foo(b1;) 30(param)
|
36: 6(bool) FunctionCall 10(foo(b1;) 30(param)
|
||||||
41: 18(fvec4) Select 36 38 40
|
42: 41(bvec4) CompositeConstruct 36 36 36 36
|
||||||
43: 42(ptr) AccessChain 24 26
|
43: 18(fvec4) Select 42 38 40
|
||||||
Store 43 41
|
45: 44(ptr) AccessChain 24 26
|
||||||
|
Store 45 43
|
||||||
Return
|
Return
|
||||||
FunctionEnd
|
FunctionEnd
|
||||||
10(foo(b1;): 6(bool) Function None 8
|
10(foo(b1;): 6(bool) Function None 8
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
spv.deepRvalue.frag
|
spv.deepRvalue.frag
|
||||||
// Module Version 10000
|
// Module Version 10000
|
||||||
// Generated by (magic number): 80001
|
// Generated by (magic number): 80001
|
||||||
// Id's are bound by 150
|
// Id's are bound by 152
|
||||||
|
|
||||||
Capability Shader
|
Capability Shader
|
||||||
1: ExtInstImport "GLSL.std.450"
|
1: ExtInstImport "GLSL.std.450"
|
||||||
MemoryModel Logical GLSL450
|
MemoryModel Logical GLSL450
|
||||||
EntryPoint Fragment 4 "main" 144
|
EntryPoint Fragment 4 "main" 146
|
||||||
ExecutionMode 4 OriginUpperLeft
|
ExecutionMode 4 OriginUpperLeft
|
||||||
Source GLSL 330
|
Source GLSL 330
|
||||||
Name 4 "main"
|
Name 4 "main"
|
||||||
@ -21,12 +21,12 @@ spv.deepRvalue.frag
|
|||||||
Name 106 "h"
|
Name 106 "h"
|
||||||
Name 107 "i"
|
Name 107 "i"
|
||||||
Name 111 "samp2D"
|
Name 111 "samp2D"
|
||||||
Name 129 "str"
|
Name 131 "str"
|
||||||
MemberName 129(str) 0 "a"
|
MemberName 131(str) 0 "a"
|
||||||
MemberName 129(str) 1 "b"
|
MemberName 131(str) 1 "b"
|
||||||
MemberName 129(str) 2 "c"
|
MemberName 131(str) 2 "c"
|
||||||
Name 131 "t"
|
Name 133 "t"
|
||||||
Name 144 "gl_FragColor"
|
Name 146 "gl_FragColor"
|
||||||
Decorate 111(samp2D) DescriptorSet 0
|
Decorate 111(samp2D) DescriptorSet 0
|
||||||
2: TypeVoid
|
2: TypeVoid
|
||||||
3: TypeFunction 2
|
3: TypeFunction 2
|
||||||
@ -77,19 +77,20 @@ spv.deepRvalue.frag
|
|||||||
115: 113(fvec2) ConstantComposite 114 114
|
115: 113(fvec2) ConstantComposite 114 114
|
||||||
119: 6(float) Constant 1036831949
|
119: 6(float) Constant 1036831949
|
||||||
120: TypeBool
|
120: TypeBool
|
||||||
128: TypeArray 113(fvec2) 84
|
124: TypeVector 120(bool) 4
|
||||||
129(str): TypeStruct 81(int) 128 120(bool)
|
130: TypeArray 113(fvec2) 84
|
||||||
130: TypePointer Function 129(str)
|
131(str): TypeStruct 81(int) 130 120(bool)
|
||||||
132: 113(fvec2) ConstantComposite 10 11
|
132: TypePointer Function 131(str)
|
||||||
133: 6(float) Constant 1082130432
|
134: 113(fvec2) ConstantComposite 10 11
|
||||||
134: 113(fvec2) ConstantComposite 133 12
|
135: 6(float) Constant 1082130432
|
||||||
135: 6(float) Constant 1086324736
|
136: 113(fvec2) ConstantComposite 135 12
|
||||||
136: 113(fvec2) ConstantComposite 135 13
|
137: 6(float) Constant 1086324736
|
||||||
137: 128 ConstantComposite 132 134 136
|
138: 113(fvec2) ConstantComposite 137 13
|
||||||
138: 120(bool) ConstantTrue
|
139: 130 ConstantComposite 134 136 138
|
||||||
139: 129(str) ConstantComposite 82 137 138
|
140: 120(bool) ConstantTrue
|
||||||
143: TypePointer Output 7(fvec4)
|
141: 131(str) ConstantComposite 82 139 140
|
||||||
144(gl_FragColor): 143(ptr) Variable Output
|
145: TypePointer Output 7(fvec4)
|
||||||
|
146(gl_FragColor): 145(ptr) Variable Output
|
||||||
4(main): 2 Function None 3
|
4(main): 2 Function None 3
|
||||||
5: Label
|
5: Label
|
||||||
35(m): 34(ptr) Variable Function
|
35(m): 34(ptr) Variable Function
|
||||||
@ -98,7 +99,7 @@ spv.deepRvalue.frag
|
|||||||
87(g): 79(ptr) Variable Function
|
87(g): 79(ptr) Variable Function
|
||||||
106(h): 79(ptr) Variable Function
|
106(h): 79(ptr) Variable Function
|
||||||
107(i): 79(ptr) Variable Function
|
107(i): 79(ptr) Variable Function
|
||||||
131(t): 130(ptr) Variable Function
|
133(t): 132(ptr) Variable Function
|
||||||
Store 9(v1) 14
|
Store 9(v1) 14
|
||||||
Store 15(v2) 20
|
Store 15(v2) 20
|
||||||
Store 21(v3) 26
|
Store 21(v3) 26
|
||||||
@ -174,21 +175,22 @@ spv.deepRvalue.frag
|
|||||||
121: 120(bool) FOrdGreaterThan 118 119
|
121: 120(bool) FOrdGreaterThan 118 119
|
||||||
122: 7(fvec4) Load 9(v1)
|
122: 7(fvec4) Load 9(v1)
|
||||||
123: 7(fvec4) Load 15(v2)
|
123: 7(fvec4) Load 15(v2)
|
||||||
124: 7(fvec4) Select 121 122 123
|
125: 124(bvec4) CompositeConstruct 121 121 121 121
|
||||||
125: 6(float) CompositeExtract 124 3
|
126: 7(fvec4) Select 125 122 123
|
||||||
126: 6(float) Load 107(i)
|
127: 6(float) CompositeExtract 126 3
|
||||||
127: 6(float) FAdd 126 125
|
128: 6(float) Load 107(i)
|
||||||
Store 107(i) 127
|
129: 6(float) FAdd 128 127
|
||||||
Store 131(t) 139
|
Store 107(i) 129
|
||||||
140: 6(float) CompositeExtract 139 1 2 1
|
Store 133(t) 141
|
||||||
141: 6(float) Load 107(i)
|
142: 6(float) CompositeExtract 141 1 2 1
|
||||||
142: 6(float) FAdd 141 140
|
143: 6(float) Load 107(i)
|
||||||
Store 107(i) 142
|
144: 6(float) FAdd 143 142
|
||||||
145: 6(float) Load 80(f)
|
Store 107(i) 144
|
||||||
146: 6(float) Load 87(g)
|
147: 6(float) Load 80(f)
|
||||||
147: 6(float) Load 106(h)
|
148: 6(float) Load 87(g)
|
||||||
148: 6(float) Load 107(i)
|
149: 6(float) Load 106(h)
|
||||||
149: 7(fvec4) CompositeConstruct 145 146 147 148
|
150: 6(float) Load 107(i)
|
||||||
Store 144(gl_FragColor) 149
|
151: 7(fvec4) CompositeConstruct 147 148 149 150
|
||||||
|
Store 146(gl_FragColor) 151
|
||||||
Return
|
Return
|
||||||
FunctionEnd
|
FunctionEnd
|
||||||
|
@ -3,7 +3,7 @@ Warning, version 450 is not yet complete; most version-specific features are pre
|
|||||||
|
|
||||||
// Module Version 10000
|
// Module Version 10000
|
||||||
// Generated by (magic number): 80001
|
// Generated by (magic number): 80001
|
||||||
// Id's are bound by 374
|
// Id's are bound by 376
|
||||||
|
|
||||||
Capability Shader
|
Capability Shader
|
||||||
Capability SampledRect
|
Capability SampledRect
|
||||||
@ -16,7 +16,7 @@ Warning, version 450 is not yet complete; most version-specific features are pre
|
|||||||
Capability StorageImageWriteWithoutFormat
|
Capability StorageImageWriteWithoutFormat
|
||||||
1: ExtInstImport "GLSL.std.450"
|
1: ExtInstImport "GLSL.std.450"
|
||||||
MemoryModel Logical GLSL450
|
MemoryModel Logical GLSL450
|
||||||
EntryPoint Fragment 4 "main" 132 142 152 248 362 373
|
EntryPoint Fragment 4 "main" 132 142 152 248 362 375
|
||||||
ExecutionMode 4 OriginUpperLeft
|
ExecutionMode 4 OriginUpperLeft
|
||||||
Source GLSL 450
|
Source GLSL 450
|
||||||
Name 4 "main"
|
Name 4 "main"
|
||||||
@ -42,7 +42,7 @@ Warning, version 450 is not yet complete; most version-specific features are pre
|
|||||||
Name 248 "value"
|
Name 248 "value"
|
||||||
Name 357 "wo2D"
|
Name 357 "wo2D"
|
||||||
Name 362 "fragData"
|
Name 362 "fragData"
|
||||||
Name 373 "ic4D"
|
Name 375 "ic4D"
|
||||||
Decorate 15(i1D) DescriptorSet 0
|
Decorate 15(i1D) DescriptorSet 0
|
||||||
Decorate 15(i1D) Binding 0
|
Decorate 15(i1D) Binding 0
|
||||||
Decorate 27(i2D) DescriptorSet 0
|
Decorate 27(i2D) DescriptorSet 0
|
||||||
@ -76,7 +76,7 @@ Warning, version 450 is not yet complete; most version-specific features are pre
|
|||||||
Decorate 357(wo2D) DescriptorSet 0
|
Decorate 357(wo2D) DescriptorSet 0
|
||||||
Decorate 357(wo2D) Binding 1
|
Decorate 357(wo2D) Binding 1
|
||||||
Decorate 357(wo2D) NonReadable
|
Decorate 357(wo2D) NonReadable
|
||||||
Decorate 373(ic4D) Flat
|
Decorate 375(ic4D) Flat
|
||||||
2: TypeVoid
|
2: TypeVoid
|
||||||
3: TypeFunction 2
|
3: TypeFunction 2
|
||||||
6: TypeInt 32 1
|
6: TypeInt 32 1
|
||||||
@ -164,9 +164,10 @@ Warning, version 450 is not yet complete; most version-specific features are pre
|
|||||||
361: TypePointer Output 125(fvec4)
|
361: TypePointer Output 125(fvec4)
|
||||||
362(fragData): 361(ptr) Variable Output
|
362(fragData): 361(ptr) Variable Output
|
||||||
367: TypeBool
|
367: TypeBool
|
||||||
371: TypeVector 6(int) 4
|
370: TypeVector 367(bool) 4
|
||||||
372: TypePointer Input 371(ivec4)
|
373: TypeVector 6(int) 4
|
||||||
373(ic4D): 372(ptr) Variable Input
|
374: TypePointer Input 373(ivec4)
|
||||||
|
375(ic4D): 374(ptr) Variable Input
|
||||||
4(main): 2 Function None 3
|
4(main): 2 Function None 3
|
||||||
5: Label
|
5: Label
|
||||||
9(iv): 8(ptr) Variable Function
|
9(iv): 8(ptr) Variable Function
|
||||||
@ -503,7 +504,8 @@ Warning, version 450 is not yet complete; most version-specific features are pre
|
|||||||
366: 18(int) Bitcast 365
|
366: 18(int) Bitcast 365
|
||||||
368: 367(bool) INotEqual 363 366
|
368: 367(bool) INotEqual 363 366
|
||||||
369: 125(fvec4) Load 127(v)
|
369: 125(fvec4) Load 127(v)
|
||||||
370: 125(fvec4) Select 368 369 129
|
371: 370(bvec4) CompositeConstruct 368 368 368 368
|
||||||
Store 362(fragData) 370
|
372: 125(fvec4) Select 371 369 129
|
||||||
|
Store 362(fragData) 372
|
||||||
Return
|
Return
|
||||||
FunctionEnd
|
FunctionEnd
|
||||||
|
@ -3,7 +3,7 @@ Warning, version 450 is not yet complete; most version-specific features are pre
|
|||||||
|
|
||||||
// Module Version 10000
|
// Module Version 10000
|
||||||
// Generated by (magic number): 80001
|
// Generated by (magic number): 80001
|
||||||
// Id's are bound by 160
|
// Id's are bound by 162
|
||||||
|
|
||||||
Capability Shader
|
Capability Shader
|
||||||
Capability Float64
|
Capability Float64
|
||||||
@ -168,7 +168,9 @@ Warning, version 450 is not yet complete; most version-specific features are pre
|
|||||||
156: 154(fvec2) ConstantComposite 155 155
|
156: 154(fvec2) ConstantComposite 155 155
|
||||||
157: 39(float) Constant 1073741824
|
157: 39(float) Constant 1073741824
|
||||||
158: 154(fvec2) ConstantComposite 157 157
|
158: 154(fvec2) ConstantComposite 157 157
|
||||||
159: 154(fvec2) SpecConstantOp 169 153 156 158
|
159: TypeVector 22(bool) 2
|
||||||
|
160: 159(bvec2) SpecConstantComposite 153 153
|
||||||
|
161: 154(fvec2) SpecConstantOp 169 160 156 158
|
||||||
4(main): 2 Function None 3
|
4(main): 2 Function None 3
|
||||||
5: Label
|
5: Label
|
||||||
Return
|
Return
|
||||||
|
@ -3,4 +3,4 @@
|
|||||||
// For the date, it uses the current date (when then script is run).
|
// For the date, it uses the current date (when then script is run).
|
||||||
|
|
||||||
#define GLSLANG_REVISION "Overload400-PrecQual.1939"
|
#define GLSLANG_REVISION "Overload400-PrecQual.1939"
|
||||||
#define GLSLANG_DATE "28-Mar-2017"
|
#define GLSLANG_DATE "30-Mar-2017"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user