mirror of
https://github.com/RPCS3/glslang.git
synced 2024-11-23 11:19:40 +00:00
SPV: Continue to fix the issue of bool -> uint32
For short-circuit operator (&& and ||), the conversion is missing.
This commit is contained in:
parent
2725323bba
commit
b4fd8d10f0
@ -3876,7 +3876,7 @@ spv::Id TGlslangToSpvTraverser::createShortCircuit(glslang::TOperator op, glslan
|
||||
// emit left operand
|
||||
builder.clearAccessChain();
|
||||
left.traverse(this);
|
||||
spv::Id leftId = builder.accessChainLoad(spv::NoPrecision, boolTypeId);
|
||||
spv::Id leftId = accessChainLoad(left.getType());
|
||||
|
||||
// Operands to accumulate OpPhi operands
|
||||
std::vector<spv::Id> phiOperands;
|
||||
@ -3899,7 +3899,7 @@ spv::Id TGlslangToSpvTraverser::createShortCircuit(glslang::TOperator op, glslan
|
||||
// emit right operand as the "then" part of the "if"
|
||||
builder.clearAccessChain();
|
||||
right.traverse(this);
|
||||
spv::Id rightId = builder.accessChainLoad(spv::NoPrecision, boolTypeId);
|
||||
spv::Id rightId = accessChainLoad(right.getType());
|
||||
|
||||
// accumulate left operand's phi information
|
||||
phiOperands.push_back(rightId);
|
||||
|
@ -7,12 +7,12 @@ Linked fragment stage:
|
||||
|
||||
// Module Version 10000
|
||||
// Generated by (magic number): 80001
|
||||
// Id's are bound by 72
|
||||
// Id's are bound by 107
|
||||
|
||||
Capability Shader
|
||||
1: ExtInstImport "GLSL.std.450"
|
||||
MemoryModel Logical GLSL450
|
||||
EntryPoint Fragment 4 "main"
|
||||
EntryPoint Fragment 4 "main" 75
|
||||
ExecutionMode 4 OriginUpperLeft
|
||||
Source GLSL 450
|
||||
Name 4 "main"
|
||||
@ -28,6 +28,7 @@ Linked fragment stage:
|
||||
Name 41 ""
|
||||
Name 62 "param"
|
||||
Name 67 "param"
|
||||
Name 75 "fragColor"
|
||||
MemberDecorate 24(Buffer) 0 Offset 0
|
||||
Decorate 24(Buffer) BufferBlock
|
||||
Decorate 26 DescriptorSet 0
|
||||
@ -36,6 +37,7 @@ Linked fragment stage:
|
||||
Decorate 39(Uniform) Block
|
||||
Decorate 41 DescriptorSet 0
|
||||
Decorate 41 Binding 0
|
||||
Decorate 75(fragColor) Location 0
|
||||
2: TypeVoid
|
||||
3: TypeFunction 2
|
||||
6: TypeBool
|
||||
@ -65,6 +67,12 @@ Linked fragment stage:
|
||||
41: 40(ptr) Variable Uniform
|
||||
42: TypePointer Uniform 38(ivec4)
|
||||
65: 38(ivec4) ConstantComposite 31 31 31 31
|
||||
72: TypeFloat 32
|
||||
73: TypeVector 72(float) 4
|
||||
74: TypePointer Output 73(fvec4)
|
||||
75(fragColor): 74(ptr) Variable Output
|
||||
87: 72(float) Constant 0
|
||||
88: 72(float) Constant 1065353216
|
||||
4(main): 2 Function None 3
|
||||
5: Label
|
||||
62(param): 8(ptr) Variable Function
|
||||
@ -107,6 +115,43 @@ Linked fragment stage:
|
||||
Store 71 70
|
||||
Branch 61
|
||||
61: Label
|
||||
76: 42(ptr) AccessChain 41 28
|
||||
77: 38(ivec4) Load 76
|
||||
78: 22(int) CompositeExtract 77 0
|
||||
79: 6(bool) INotEqual 78 31
|
||||
SelectionMerge 81 None
|
||||
BranchConditional 79 80 81
|
||||
80: Label
|
||||
82: 42(ptr) AccessChain 41 28
|
||||
83: 38(ivec4) Load 82
|
||||
84: 22(int) CompositeExtract 83 1
|
||||
85: 6(bool) INotEqual 84 31
|
||||
Branch 81
|
||||
81: Label
|
||||
86: 6(bool) Phi 79 61 85 80
|
||||
89: 72(float) Select 86 88 87
|
||||
90: 73(fvec4) CompositeConstruct 89 89 89 89
|
||||
Store 75(fragColor) 90
|
||||
91: 42(ptr) AccessChain 41 28
|
||||
92: 38(ivec4) Load 91
|
||||
93: 22(int) CompositeExtract 92 0
|
||||
94: 6(bool) INotEqual 93 31
|
||||
95: 6(bool) LogicalNot 94
|
||||
SelectionMerge 97 None
|
||||
BranchConditional 95 96 97
|
||||
96: Label
|
||||
98: 42(ptr) AccessChain 41 28
|
||||
99: 38(ivec4) Load 98
|
||||
100: 22(int) CompositeExtract 99 1
|
||||
101: 6(bool) INotEqual 100 31
|
||||
Branch 97
|
||||
97: Label
|
||||
102: 6(bool) Phi 94 81 101 96
|
||||
103: 72(float) Select 102 88 87
|
||||
104: 73(fvec4) CompositeConstruct 103 103 103 103
|
||||
105: 73(fvec4) Load 75(fragColor)
|
||||
106: 73(fvec4) FSub 105 104
|
||||
Store 75(fragColor) 106
|
||||
Return
|
||||
FunctionEnd
|
||||
14(foo(vb4;vb2;): 2 Function None 11
|
||||
|
@ -16,6 +16,8 @@ void foo(bvec4 paramb4, out bvec2 paramb2)
|
||||
paramb2 = bvec2(b1);
|
||||
}
|
||||
|
||||
layout(location = 0) out vec4 fragColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
b2 = bvec2(0.0);
|
||||
@ -23,4 +25,7 @@ void main()
|
||||
b2 = bvec2(b4.x);
|
||||
if (b2.x)
|
||||
foo(b4, b2);
|
||||
|
||||
fragColor = vec4(b4.x && b4.y);
|
||||
fragColor -= vec4(b4.x || b4.y);
|
||||
}
|
Loading…
Reference in New Issue
Block a user