HLSL: Implicit bool conversions for conditional expressions and related.
Covers if(cond), while(cond), do-while(cond), for(;cond;), and (cond ? :). Fixes #778.
This commit is contained in:
parent
8f9fdc986a
commit
7e997e2612
12 changed files with 887 additions and 263 deletions
|
|
@ -25,10 +25,11 @@ gl_FragCoord origin is upper left
|
|||
0:9 2 (const int)
|
||||
0:10 Test condition and select ( temp void)
|
||||
0:10 Condition
|
||||
0:10 direct index ( temp float)
|
||||
0:10 'input' ( in 4-component vector of float)
|
||||
0:10 Constant:
|
||||
0:10 0 (const int)
|
||||
0:10 Convert float to bool ( temp bool)
|
||||
0:10 direct index ( temp float)
|
||||
0:10 'input' ( in 4-component vector of float)
|
||||
0:10 Constant:
|
||||
0:10 0 (const int)
|
||||
0:10 true case
|
||||
0:11 Branch: Kill
|
||||
0:12 Sequence
|
||||
|
|
@ -80,10 +81,11 @@ gl_FragCoord origin is upper left
|
|||
0:9 2 (const int)
|
||||
0:10 Test condition and select ( temp void)
|
||||
0:10 Condition
|
||||
0:10 direct index ( temp float)
|
||||
0:10 'input' ( in 4-component vector of float)
|
||||
0:10 Constant:
|
||||
0:10 0 (const int)
|
||||
0:10 Convert float to bool ( temp bool)
|
||||
0:10 direct index ( temp float)
|
||||
0:10 'input' ( in 4-component vector of float)
|
||||
0:10 Constant:
|
||||
0:10 0 (const int)
|
||||
0:10 true case
|
||||
0:11 Branch: Kill
|
||||
0:12 Sequence
|
||||
|
|
@ -107,12 +109,12 @@ gl_FragCoord origin is upper left
|
|||
|
||||
// Module Version 10000
|
||||
// Generated by (magic number): 80001
|
||||
// Id's are bound by 48
|
||||
// Id's are bound by 50
|
||||
|
||||
Capability Shader
|
||||
1: ExtInstImport "GLSL.std.450"
|
||||
MemoryModel Logical GLSL450
|
||||
EntryPoint Fragment 4 "PixelShaderFunction" 43
|
||||
EntryPoint Fragment 4 "PixelShaderFunction" 45
|
||||
ExecutionMode 4 OriginUpperLeft
|
||||
Name 4 "PixelShaderFunction"
|
||||
Name 10 "foo(f1;"
|
||||
|
|
@ -120,11 +122,11 @@ gl_FragCoord origin is upper left
|
|||
Name 16 "@PixelShaderFunction(vf4;"
|
||||
Name 15 "input"
|
||||
Name 25 "param"
|
||||
Name 37 "f"
|
||||
Name 41 "input"
|
||||
Name 39 "f"
|
||||
Name 43 "input"
|
||||
Name 45 "param"
|
||||
Decorate 43(input) Location 0
|
||||
Name 45 "input"
|
||||
Name 47 "param"
|
||||
Decorate 45(input) Location 0
|
||||
2: TypeVoid
|
||||
3: TypeFunction 2
|
||||
6: TypeFloat 32
|
||||
|
|
@ -138,17 +140,18 @@ gl_FragCoord origin is upper left
|
|||
26: TypeInt 32 0
|
||||
27: 26(int) Constant 2
|
||||
31: 26(int) Constant 0
|
||||
42: TypePointer Input 12(fvec4)
|
||||
43(input): 42(ptr) Variable Input
|
||||
34: 6(float) Constant 0
|
||||
44: TypePointer Input 12(fvec4)
|
||||
45(input): 44(ptr) Variable Input
|
||||
4(PixelShaderFunction): 2 Function None 3
|
||||
5: Label
|
||||
41(input): 13(ptr) Variable Function
|
||||
45(param): 13(ptr) Variable Function
|
||||
44: 12(fvec4) Load 43(input)
|
||||
Store 41(input) 44
|
||||
46: 12(fvec4) Load 41(input)
|
||||
Store 45(param) 46
|
||||
47: 2 FunctionCall 16(@PixelShaderFunction(vf4;) 45(param)
|
||||
43(input): 13(ptr) Variable Function
|
||||
47(param): 13(ptr) Variable Function
|
||||
46: 12(fvec4) Load 45(input)
|
||||
Store 43(input) 46
|
||||
48: 12(fvec4) Load 43(input)
|
||||
Store 47(param) 48
|
||||
49: 2 FunctionCall 16(@PixelShaderFunction(vf4;) 47(param)
|
||||
Return
|
||||
FunctionEnd
|
||||
10(foo(f1;): 2 Function None 8
|
||||
|
|
@ -167,20 +170,21 @@ gl_FragCoord origin is upper left
|
|||
15(input): 13(ptr) FunctionParameter
|
||||
17: Label
|
||||
25(param): 7(ptr) Variable Function
|
||||
37(f): 7(ptr) Variable Function
|
||||
39(f): 7(ptr) Variable Function
|
||||
28: 7(ptr) AccessChain 15(input) 27
|
||||
29: 6(float) Load 28
|
||||
Store 25(param) 29
|
||||
30: 2 FunctionCall 10(foo(f1;) 25(param)
|
||||
32: 7(ptr) AccessChain 15(input) 31
|
||||
33: 6(float) Load 32
|
||||
SelectionMerge 35 None
|
||||
BranchConditional 33 34 35
|
||||
34: Label
|
||||
35: 20(bool) FOrdNotEqual 33 34
|
||||
SelectionMerge 37 None
|
||||
BranchConditional 35 36 37
|
||||
36: Label
|
||||
Kill
|
||||
35: Label
|
||||
38: 7(ptr) AccessChain 15(input) 31
|
||||
39: 6(float) Load 38
|
||||
Store 37(f) 39
|
||||
37: Label
|
||||
40: 7(ptr) AccessChain 15(input) 31
|
||||
41: 6(float) Load 40
|
||||
Store 39(f) 41
|
||||
Kill
|
||||
FunctionEnd
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue