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:
Dejan Mircevski 2016-01-11 15:57:11 -05:00
parent c8fbbab419
commit 832c65c33b
20 changed files with 2062 additions and 2029 deletions

View file

@ -41,24 +41,24 @@ Linked fragment stage:
9(color): 8(ptr) Variable Function
12: 7(fvec4) Load 11(BaseColor)
Store 9(color) 12
Branch 16
Branch 13
13: Label
29: 7(fvec4) Load 28(bigColor)
30: 7(fvec4) Load 9(color)
31: 7(fvec4) FAdd 30 29
Store 9(color) 31
Branch 15
14: Label
34: 7(fvec4) Load 9(color)
Store 33(gl_FragColor) 34
Return
15: Label
Branch 16
16: Label
20: 19(ptr) AccessChain 9(color) 18
21: 6(float) Load 20
24: 6(float) Load 23(d)
26: 25(bool) FOrdLessThan 21 24
LoopMerge 14 15 None
BranchConditional 26 13 14
FunctionEnd
LoopMerge 15 16 None
BranchConditional 26 14 15
14: Label
29: 7(fvec4) Load 28(bigColor)
30: 7(fvec4) Load 9(color)
31: 7(fvec4) FAdd 30 29
Store 9(color) 31
Branch 16
15: Label
34: 7(fvec4) Load 9(color)
Store 33(gl_FragColor) 34
Return
16: Label
Branch 13
FunctionEnd