Fix back-branch target for do-while loops.
To ensure back branches always go to a header block, create a header block even for !testFirst loops. Then unify common code between the testFirst/!testFirst cases. Generate the header-block code first, so update golden files. Realize that certain infinite loops generate invalid SPIR-V, so put a TODO to instead abort code generation in such cases. Change-Id: I1e173c8f73daad186cfc666b7d72bd563ed7665d
This commit is contained in:
@@ -5,7 +5,7 @@ Linked fragment stage:
|
||||
|
||||
// Module Version 10000
|
||||
// Generated by (magic number): 80001
|
||||
// Id's are bound by 34
|
||||
// Id's are bound by 35
|
||||
|
||||
Capability Shader
|
||||
1: ExtInstImport "GLSL.std.450"
|
||||
@@ -16,9 +16,9 @@ Linked fragment stage:
|
||||
Name 4 "main"
|
||||
Name 9 "color"
|
||||
Name 11 "BaseColor"
|
||||
Name 17 "bigColor"
|
||||
Name 27 "d"
|
||||
Name 32 "gl_FragColor"
|
||||
Name 18 "bigColor"
|
||||
Name 28 "d"
|
||||
Name 33 "gl_FragColor"
|
||||
2: TypeVoid
|
||||
3: TypeFunction 2
|
||||
6: TypeFloat 32
|
||||
@@ -26,16 +26,16 @@ Linked fragment stage:
|
||||
8: TypePointer Function 7(fvec4)
|
||||
10: TypePointer Input 7(fvec4)
|
||||
11(BaseColor): 10(ptr) Variable Input
|
||||
16: TypePointer UniformConstant 7(fvec4)
|
||||
17(bigColor): 16(ptr) Variable UniformConstant
|
||||
21: TypeInt 32 0
|
||||
22: 21(int) Constant 0
|
||||
23: TypePointer Function 6(float)
|
||||
26: TypePointer UniformConstant 6(float)
|
||||
27(d): 26(ptr) Variable UniformConstant
|
||||
29: TypeBool
|
||||
31: TypePointer Output 7(fvec4)
|
||||
32(gl_FragColor): 31(ptr) Variable Output
|
||||
17: TypePointer UniformConstant 7(fvec4)
|
||||
18(bigColor): 17(ptr) Variable UniformConstant
|
||||
22: TypeInt 32 0
|
||||
23: 22(int) Constant 0
|
||||
24: TypePointer Function 6(float)
|
||||
27: TypePointer UniformConstant 6(float)
|
||||
28(d): 27(ptr) Variable UniformConstant
|
||||
30: TypeBool
|
||||
32: TypePointer Output 7(fvec4)
|
||||
33(gl_FragColor): 32(ptr) Variable Output
|
||||
4(main): 2 Function None 3
|
||||
5: Label
|
||||
9(color): 8(ptr) Variable Function
|
||||
@@ -43,20 +43,22 @@ Linked fragment stage:
|
||||
Store 9(color) 12
|
||||
Branch 13
|
||||
13: Label
|
||||
18: 7(fvec4) Load 17(bigColor)
|
||||
19: 7(fvec4) Load 9(color)
|
||||
20: 7(fvec4) FAdd 19 18
|
||||
Store 9(color) 20
|
||||
Branch 15
|
||||
LoopMerge 15 16 None
|
||||
Branch 14
|
||||
14: Label
|
||||
33: 7(fvec4) Load 9(color)
|
||||
Store 32(gl_FragColor) 33
|
||||
Return
|
||||
19: 7(fvec4) Load 18(bigColor)
|
||||
20: 7(fvec4) Load 9(color)
|
||||
21: 7(fvec4) FAdd 20 19
|
||||
Store 9(color) 21
|
||||
Branch 16
|
||||
15: Label
|
||||
24: 23(ptr) AccessChain 9(color) 22
|
||||
25: 6(float) Load 24
|
||||
28: 6(float) Load 27(d)
|
||||
30: 29(bool) FOrdLessThan 25 28
|
||||
LoopMerge 14 15 None
|
||||
BranchConditional 30 13 14
|
||||
34: 7(fvec4) Load 9(color)
|
||||
Store 33(gl_FragColor) 34
|
||||
Return
|
||||
16: Label
|
||||
25: 24(ptr) AccessChain 9(color) 23
|
||||
26: 6(float) Load 25
|
||||
29: 6(float) Load 28(d)
|
||||
31: 30(bool) FOrdLessThan 26 29
|
||||
BranchConditional 31 13 15
|
||||
FunctionEnd
|
||||
|
||||
Reference in New Issue
Block a user