Add spv.branch-return.vert and fix inReadableOrder().
This commit is contained in:
parent
44bfb0d0cd
commit
baa55a1591
@ -27,10 +27,11 @@ using BlockSet = std::unordered_set<Id>;
|
|||||||
using IdToBool = std::unordered_map<Id, bool>;
|
using IdToBool = std::unordered_map<Id, bool>;
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
// True if any of prerequisites have not yet been visited.
|
// True if any of prerequisites have not yet been visited. May add new,
|
||||||
bool delay(const BlockSet& prereqs, const IdToBool& visited) {
|
// zero-initialized, values to visited, but doesn't modify any existing values.
|
||||||
|
bool delay(const BlockSet& prereqs, IdToBool& visited) {
|
||||||
return std::any_of(prereqs.begin(), prereqs.end(),
|
return std::any_of(prereqs.begin(), prereqs.end(),
|
||||||
[&visited](Id b) { return !visited.count(b); });
|
[&visited](Id b) { return !visited[b]; });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
63
Test/baseResults/spv.branch-return.vert.out
Normal file
63
Test/baseResults/spv.branch-return.vert.out
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
spv.branch-return.vert
|
||||||
|
|
||||||
|
Linked vertex stage:
|
||||||
|
|
||||||
|
|
||||||
|
// Module Version 10000
|
||||||
|
// Generated by (magic number): 80001
|
||||||
|
// Id's are bound by 35
|
||||||
|
|
||||||
|
Capability Shader
|
||||||
|
1: ExtInstImport "GLSL.std.450"
|
||||||
|
MemoryModel Logical GLSL450
|
||||||
|
EntryPoint Vertex 4 "main" 8 19 34
|
||||||
|
Source ESSL 300
|
||||||
|
Name 4 "main"
|
||||||
|
Name 8 "gl_InstanceID"
|
||||||
|
Name 19 "gl_Position"
|
||||||
|
Name 34 "gl_VertexID"
|
||||||
|
Decorate 8(gl_InstanceID) BuiltIn InstanceId
|
||||||
|
Decorate 19(gl_Position) BuiltIn Position
|
||||||
|
Decorate 34(gl_VertexID) BuiltIn VertexId
|
||||||
|
2: TypeVoid
|
||||||
|
3: TypeFunction 2
|
||||||
|
6: TypeInt 32 1
|
||||||
|
7: TypePointer Input 6(int)
|
||||||
|
8(gl_InstanceID): 7(ptr) Variable Input
|
||||||
|
16: TypeFloat 32
|
||||||
|
17: TypeVector 16(float) 4
|
||||||
|
18: TypePointer Output 17(fvec4)
|
||||||
|
19(gl_Position): 18(ptr) Variable Output
|
||||||
|
20: 16(float) Constant 0
|
||||||
|
21: 17(fvec4) ConstantComposite 20 20 20 20
|
||||||
|
26: 16(float) Constant 1039918957
|
||||||
|
27: TypeInt 32 0
|
||||||
|
28: 27(int) Constant 0
|
||||||
|
29: TypePointer Output 16(float)
|
||||||
|
34(gl_VertexID): 7(ptr) Variable Input
|
||||||
|
4(main): 2 Function None 3
|
||||||
|
5: Label
|
||||||
|
9: 6(int) Load 8(gl_InstanceID)
|
||||||
|
SelectionMerge 14 None
|
||||||
|
Switch 9 14
|
||||||
|
case 0: 10
|
||||||
|
case 1: 11
|
||||||
|
case 2: 12
|
||||||
|
case 3: 13
|
||||||
|
10: Label
|
||||||
|
Return
|
||||||
|
11: Label
|
||||||
|
Store 19(gl_Position) 21
|
||||||
|
Branch 14
|
||||||
|
12: Label
|
||||||
|
Return
|
||||||
|
13: Label
|
||||||
|
Return
|
||||||
|
14: Label
|
||||||
|
30: 29(ptr) AccessChain 19(gl_Position) 28
|
||||||
|
31: 16(float) Load 30
|
||||||
|
32: 16(float) FAdd 31 26
|
||||||
|
33: 29(ptr) AccessChain 19(gl_Position) 28
|
||||||
|
Store 33 32
|
||||||
|
Return
|
||||||
|
FunctionEnd
|
||||||
10
Test/spv.branch-return.vert
Normal file
10
Test/spv.branch-return.vert
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#version 300 es
|
||||||
|
void main() {
|
||||||
|
switch (gl_InstanceID) {
|
||||||
|
case 0: return;
|
||||||
|
case 1: gl_Position = vec4(0.0); break;
|
||||||
|
case 2: return;
|
||||||
|
case 3: return;
|
||||||
|
}
|
||||||
|
gl_Position.x += 0.123;
|
||||||
|
}
|
||||||
@ -32,6 +32,7 @@ spv.always-discard.frag
|
|||||||
spv.always-discard2.frag
|
spv.always-discard2.frag
|
||||||
spv.bitCast.frag
|
spv.bitCast.frag
|
||||||
spv.bool.vert
|
spv.bool.vert
|
||||||
|
spv.branch-return.vert
|
||||||
spv.conditionalDiscard.frag
|
spv.conditionalDiscard.frag
|
||||||
spv.conversion.frag
|
spv.conversion.frag
|
||||||
spv.dataOut.frag
|
spv.dataOut.frag
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user