SPV: Fix #739: OpSelect can only operate on scalars and vectors.
This commit is contained in:
parent
173c0c01a6
commit
0479437a5c
@ -1789,7 +1789,8 @@ bool TGlslangToSpvTraverser::visitSelection(glslang::TVisit /* visit */, glslang
|
|||||||
// Crucially, side effects must be avoided, and there are performance trade-offs.
|
// Crucially, side effects must be avoided, and there are performance trade-offs.
|
||||||
// Return true if good idea (and safe) for OpSelect, false otherwise.
|
// Return true if good idea (and safe) for OpSelect, false otherwise.
|
||||||
const auto selectPolicy = [&]() -> bool {
|
const auto selectPolicy = [&]() -> bool {
|
||||||
if (node->getBasicType() == glslang::EbtVoid)
|
if ((!node->getType().isScalar() && !node->getType().isVector()) ||
|
||||||
|
node->getBasicType() == glslang::EbtVoid)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (node->getTrueBlock() == nullptr ||
|
if (node->getTrueBlock() == nullptr ||
|
||||||
|
|||||||
@ -3,12 +3,12 @@ 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 509
|
// Id's are bound by 532
|
||||||
|
|
||||||
Capability Shader
|
Capability Shader
|
||||||
1: ExtInstImport "GLSL.std.450"
|
1: ExtInstImport "GLSL.std.450"
|
||||||
MemoryModel Logical GLSL450
|
MemoryModel Logical GLSL450
|
||||||
EntryPoint Fragment 4 "main" 11 22 212 288 485 503 508
|
EntryPoint Fragment 4 "main" 11 22 212 288 485 526 531
|
||||||
ExecutionMode 4 OriginUpperLeft
|
ExecutionMode 4 OriginUpperLeft
|
||||||
Source GLSL 450
|
Source GLSL 450
|
||||||
Name 4 "main"
|
Name 4 "main"
|
||||||
@ -24,13 +24,15 @@ Warning, version 450 is not yet complete; most version-specific features are pre
|
|||||||
Name 305 "b"
|
Name 305 "b"
|
||||||
Name 342 "ub42"
|
Name 342 "ub42"
|
||||||
Name 485 "FragColor"
|
Name 485 "FragColor"
|
||||||
Name 503 "uiv4"
|
Name 503 "m1"
|
||||||
Name 505 "ub"
|
Name 510 "m2"
|
||||||
Name 508 "uuv4"
|
Name 526 "uiv4"
|
||||||
|
Name 528 "ub"
|
||||||
|
Name 531 "uuv4"
|
||||||
Decorate 22(ui) Flat
|
Decorate 22(ui) Flat
|
||||||
Decorate 288(uui) Flat
|
Decorate 288(uui) Flat
|
||||||
Decorate 503(uiv4) Flat
|
Decorate 526(uiv4) Flat
|
||||||
Decorate 508(uuv4) Flat
|
Decorate 531(uuv4) Flat
|
||||||
2: TypeVoid
|
2: TypeVoid
|
||||||
3: TypeFunction 2
|
3: TypeFunction 2
|
||||||
6: TypeFloat 32
|
6: TypeFloat 32
|
||||||
@ -65,14 +67,24 @@ Warning, version 450 is not yet complete; most version-specific features are pre
|
|||||||
472: 18(int) Constant 17
|
472: 18(int) Constant 17
|
||||||
484: TypePointer Output 7(fvec4)
|
484: TypePointer Output 7(fvec4)
|
||||||
485(FragColor): 484(ptr) Variable Output
|
485(FragColor): 484(ptr) Variable Output
|
||||||
501: TypeVector 18(int) 4
|
501: TypeMatrix 7(fvec4) 4
|
||||||
502: TypePointer Input 501(ivec4)
|
502: TypePointer Function 501
|
||||||
503(uiv4): 502(ptr) Variable Input
|
504: 6(float) Constant 0
|
||||||
504: TypePointer Private 178(bool)
|
505: 7(fvec4) ConstantComposite 461 504 504 504
|
||||||
505(ub): 504(ptr) Variable Private
|
506: 7(fvec4) ConstantComposite 504 461 504 504
|
||||||
506: TypeVector 141(int) 4
|
507: 7(fvec4) ConstantComposite 504 504 461 504
|
||||||
507: TypePointer Input 506(ivec4)
|
508: 7(fvec4) ConstantComposite 504 504 504 461
|
||||||
508(uuv4): 507(ptr) Variable Input
|
509: 501 ConstantComposite 505 506 507 508
|
||||||
|
511: 7(fvec4) ConstantComposite 504 504 504 504
|
||||||
|
512: 501 ConstantComposite 511 511 511 511
|
||||||
|
524: TypeVector 18(int) 4
|
||||||
|
525: TypePointer Input 524(ivec4)
|
||||||
|
526(uiv4): 525(ptr) Variable Input
|
||||||
|
527: TypePointer Private 178(bool)
|
||||||
|
528(ub): 527(ptr) Variable Private
|
||||||
|
529: TypeVector 141(int) 4
|
||||||
|
530: TypePointer Input 529(ivec4)
|
||||||
|
531(uuv4): 530(ptr) Variable Input
|
||||||
4(main): 2 Function None 3
|
4(main): 2 Function None 3
|
||||||
5: Label
|
5: Label
|
||||||
9(v): 8(ptr) Variable Function
|
9(v): 8(ptr) Variable Function
|
||||||
@ -81,6 +93,9 @@ Warning, version 450 is not yet complete; most version-specific features are pre
|
|||||||
285(u): 284(ptr) Variable Function
|
285(u): 284(ptr) Variable Function
|
||||||
305(b): 304(ptr) Variable Function
|
305(b): 304(ptr) Variable Function
|
||||||
486: 8(ptr) Variable Function
|
486: 8(ptr) Variable Function
|
||||||
|
503(m1): 502(ptr) Variable Function
|
||||||
|
510(m2): 502(ptr) Variable Function
|
||||||
|
513: 502(ptr) Variable Function
|
||||||
12: 7(fvec4) Load 11(uv4)
|
12: 7(fvec4) Load 11(uv4)
|
||||||
13: 7(fvec4) ExtInst 1(GLSL.std.450) 11(Radians) 12
|
13: 7(fvec4) ExtInst 1(GLSL.std.450) 11(Radians) 12
|
||||||
Store 9(v) 13
|
Store 9(v) 13
|
||||||
@ -666,5 +681,24 @@ Warning, version 450 is not yet complete; most version-specific features are pre
|
|||||||
489: Label
|
489: Label
|
||||||
500: 7(fvec4) Load 486
|
500: 7(fvec4) Load 486
|
||||||
Store 485(FragColor) 500
|
Store 485(FragColor) 500
|
||||||
|
Store 503(m1) 509
|
||||||
|
Store 510(m2) 512
|
||||||
|
514: 178(bool) Load 305(b)
|
||||||
|
SelectionMerge 516 None
|
||||||
|
BranchConditional 514 515 518
|
||||||
|
515: Label
|
||||||
|
517: 501 Load 503(m1)
|
||||||
|
Store 513 517
|
||||||
|
Branch 516
|
||||||
|
518: Label
|
||||||
|
519: 501 Load 510(m2)
|
||||||
|
Store 513 519
|
||||||
|
Branch 516
|
||||||
|
516: Label
|
||||||
|
520: 8(ptr) AccessChain 513 405
|
||||||
|
521: 7(fvec4) Load 520
|
||||||
|
522: 7(fvec4) Load 485(FragColor)
|
||||||
|
523: 7(fvec4) FAdd 522 521
|
||||||
|
Store 485(FragColor) 523
|
||||||
Return
|
Return
|
||||||
FunctionEnd
|
FunctionEnd
|
||||||
|
|||||||
@ -135,4 +135,7 @@ void main()
|
|||||||
b = !b;
|
b = !b;
|
||||||
|
|
||||||
FragColor = b ? vec4(i) + vec4(f) + v : v;
|
FragColor = b ? vec4(i) + vec4(f) + v : v;
|
||||||
|
|
||||||
|
mat4 m1 = mat4(1.0), m2 = mat4(0.0);
|
||||||
|
FragColor += (b ? m1 : m2)[1];
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,5 +2,5 @@
|
|||||||
// For the version, it uses the latest git tag followed by the number of commits.
|
// For the version, it uses the latest git tag followed by the number of commits.
|
||||||
// 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.1865"
|
#define GLSLANG_REVISION "Overload400-PrecQual.1870"
|
||||||
#define GLSLANG_DATE "01-Mar-2017"
|
#define GLSLANG_DATE "01-Mar-2017"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user