HLSL: Support vector 'cond ? :' -> EOpMix -> OpSelect.
This commit is contained in:
parent
34718204e1
commit
636b62db8b
@ -5,11 +5,38 @@ gl_FragCoord origin is upper left
|
|||||||
0:8 Function Definition: vectorCond( ( temp 4-component vector of float)
|
0:8 Function Definition: vectorCond( ( temp 4-component vector of float)
|
||||||
0:8 Function Parameters:
|
0:8 Function Parameters:
|
||||||
0:? Sequence
|
0:? Sequence
|
||||||
0:9 Branch: Return with expression
|
0:10 Branch: Return with expression
|
||||||
0:9 f4: direct index for structure ( uniform 4-component vector of float)
|
0:9 add ( temp 4-component vector of float)
|
||||||
0:9 'anon@0' (layout( row_major std140) uniform block{ uniform 4-component vector of float c4, uniform 4-component vector of float t4, uniform 4-component vector of float f4, uniform float t, uniform float f})
|
0:9 mix ( temp 4-component vector of float)
|
||||||
0:9 Constant:
|
0:9 f4: direct index for structure ( uniform 4-component vector of float)
|
||||||
0:9 2 (const uint)
|
0:9 'anon@0' (layout( row_major std140) uniform block{ uniform 4-component vector of float c4, uniform 4-component vector of float t4, uniform 4-component vector of float f4, uniform float t, uniform float f})
|
||||||
|
0:9 Constant:
|
||||||
|
0:9 2 (const uint)
|
||||||
|
0:9 t4: direct index for structure ( uniform 4-component vector of float)
|
||||||
|
0:9 'anon@0' (layout( row_major std140) uniform block{ uniform 4-component vector of float c4, uniform 4-component vector of float t4, uniform 4-component vector of float f4, uniform float t, uniform float f})
|
||||||
|
0:9 Constant:
|
||||||
|
0:9 1 (const uint)
|
||||||
|
0:9 Convert float to bool ( temp 4-component vector of bool)
|
||||||
|
0:9 c4: direct index for structure ( uniform 4-component vector of float)
|
||||||
|
0:9 'anon@0' (layout( row_major std140) uniform block{ uniform 4-component vector of float c4, uniform 4-component vector of float t4, uniform 4-component vector of float f4, uniform float t, uniform float f})
|
||||||
|
0:9 Constant:
|
||||||
|
0:9 0 (const uint)
|
||||||
|
0:10 mix ( temp 4-component vector of float)
|
||||||
|
0:10 Construct vec4 ( temp 4-component vector of float)
|
||||||
|
0:10 f: direct index for structure ( uniform float)
|
||||||
|
0:10 'anon@0' (layout( row_major std140) uniform block{ uniform 4-component vector of float c4, uniform 4-component vector of float t4, uniform 4-component vector of float f4, uniform float t, uniform float f})
|
||||||
|
0:10 Constant:
|
||||||
|
0:10 4 (const uint)
|
||||||
|
0:10 Construct vec4 ( temp 4-component vector of float)
|
||||||
|
0:10 t: direct index for structure ( uniform float)
|
||||||
|
0:10 'anon@0' (layout( row_major std140) uniform block{ uniform 4-component vector of float c4, uniform 4-component vector of float t4, uniform 4-component vector of float f4, uniform float t, uniform float f})
|
||||||
|
0:10 Constant:
|
||||||
|
0:10 3 (const uint)
|
||||||
|
0:10 Convert float to bool ( temp 4-component vector of bool)
|
||||||
|
0:10 c4: direct index for structure ( uniform 4-component vector of float)
|
||||||
|
0:10 'anon@0' (layout( row_major std140) uniform block{ uniform 4-component vector of float c4, uniform 4-component vector of float t4, uniform 4-component vector of float f4, uniform float t, uniform float f})
|
||||||
|
0:10 Constant:
|
||||||
|
0:10 0 (const uint)
|
||||||
0:14 Function Definition: @PixelShaderFunction(vf4; ( temp 4-component vector of float)
|
0:14 Function Definition: @PixelShaderFunction(vf4; ( temp 4-component vector of float)
|
||||||
0:14 Function Parameters:
|
0:14 Function Parameters:
|
||||||
0:14 'input' ( in 4-component vector of float)
|
0:14 'input' ( in 4-component vector of float)
|
||||||
@ -142,11 +169,38 @@ gl_FragCoord origin is upper left
|
|||||||
0:8 Function Definition: vectorCond( ( temp 4-component vector of float)
|
0:8 Function Definition: vectorCond( ( temp 4-component vector of float)
|
||||||
0:8 Function Parameters:
|
0:8 Function Parameters:
|
||||||
0:? Sequence
|
0:? Sequence
|
||||||
0:9 Branch: Return with expression
|
0:10 Branch: Return with expression
|
||||||
0:9 f4: direct index for structure ( uniform 4-component vector of float)
|
0:9 add ( temp 4-component vector of float)
|
||||||
0:9 'anon@0' (layout( row_major std140) uniform block{ uniform 4-component vector of float c4, uniform 4-component vector of float t4, uniform 4-component vector of float f4, uniform float t, uniform float f})
|
0:9 mix ( temp 4-component vector of float)
|
||||||
0:9 Constant:
|
0:9 f4: direct index for structure ( uniform 4-component vector of float)
|
||||||
0:9 2 (const uint)
|
0:9 'anon@0' (layout( row_major std140) uniform block{ uniform 4-component vector of float c4, uniform 4-component vector of float t4, uniform 4-component vector of float f4, uniform float t, uniform float f})
|
||||||
|
0:9 Constant:
|
||||||
|
0:9 2 (const uint)
|
||||||
|
0:9 t4: direct index for structure ( uniform 4-component vector of float)
|
||||||
|
0:9 'anon@0' (layout( row_major std140) uniform block{ uniform 4-component vector of float c4, uniform 4-component vector of float t4, uniform 4-component vector of float f4, uniform float t, uniform float f})
|
||||||
|
0:9 Constant:
|
||||||
|
0:9 1 (const uint)
|
||||||
|
0:9 Convert float to bool ( temp 4-component vector of bool)
|
||||||
|
0:9 c4: direct index for structure ( uniform 4-component vector of float)
|
||||||
|
0:9 'anon@0' (layout( row_major std140) uniform block{ uniform 4-component vector of float c4, uniform 4-component vector of float t4, uniform 4-component vector of float f4, uniform float t, uniform float f})
|
||||||
|
0:9 Constant:
|
||||||
|
0:9 0 (const uint)
|
||||||
|
0:10 mix ( temp 4-component vector of float)
|
||||||
|
0:10 Construct vec4 ( temp 4-component vector of float)
|
||||||
|
0:10 f: direct index for structure ( uniform float)
|
||||||
|
0:10 'anon@0' (layout( row_major std140) uniform block{ uniform 4-component vector of float c4, uniform 4-component vector of float t4, uniform 4-component vector of float f4, uniform float t, uniform float f})
|
||||||
|
0:10 Constant:
|
||||||
|
0:10 4 (const uint)
|
||||||
|
0:10 Construct vec4 ( temp 4-component vector of float)
|
||||||
|
0:10 t: direct index for structure ( uniform float)
|
||||||
|
0:10 'anon@0' (layout( row_major std140) uniform block{ uniform 4-component vector of float c4, uniform 4-component vector of float t4, uniform 4-component vector of float f4, uniform float t, uniform float f})
|
||||||
|
0:10 Constant:
|
||||||
|
0:10 3 (const uint)
|
||||||
|
0:10 Convert float to bool ( temp 4-component vector of bool)
|
||||||
|
0:10 c4: direct index for structure ( uniform 4-component vector of float)
|
||||||
|
0:10 'anon@0' (layout( row_major std140) uniform block{ uniform 4-component vector of float c4, uniform 4-component vector of float t4, uniform 4-component vector of float f4, uniform float t, uniform float f})
|
||||||
|
0:10 Constant:
|
||||||
|
0:10 0 (const uint)
|
||||||
0:14 Function Definition: @PixelShaderFunction(vf4; ( temp 4-component vector of float)
|
0:14 Function Definition: @PixelShaderFunction(vf4; ( temp 4-component vector of float)
|
||||||
0:14 Function Parameters:
|
0:14 Function Parameters:
|
||||||
0:14 'input' ( in 4-component vector of float)
|
0:14 'input' ( in 4-component vector of float)
|
||||||
@ -271,12 +325,12 @@ gl_FragCoord origin is upper left
|
|||||||
|
|
||||||
// Module Version 10000
|
// Module Version 10000
|
||||||
// Generated by (magic number): 80001
|
// Generated by (magic number): 80001
|
||||||
// Id's are bound by 116
|
// Id's are bound by 141
|
||||||
|
|
||||||
Capability Shader
|
Capability Shader
|
||||||
1: ExtInstImport "GLSL.std.450"
|
1: ExtInstImport "GLSL.std.450"
|
||||||
MemoryModel Logical GLSL450
|
MemoryModel Logical GLSL450
|
||||||
EntryPoint Fragment 4 "PixelShaderFunction" 109 112
|
EntryPoint Fragment 4 "PixelShaderFunction" 134 137
|
||||||
ExecutionMode 4 OriginUpperLeft
|
ExecutionMode 4 OriginUpperLeft
|
||||||
Source HLSL 500
|
Source HLSL 500
|
||||||
Name 4 "PixelShaderFunction"
|
Name 4 "PixelShaderFunction"
|
||||||
@ -290,17 +344,17 @@ gl_FragCoord origin is upper left
|
|||||||
MemberName 16($Global) 3 "t"
|
MemberName 16($Global) 3 "t"
|
||||||
MemberName 16($Global) 4 "f"
|
MemberName 16($Global) 4 "f"
|
||||||
Name 18 ""
|
Name 18 ""
|
||||||
Name 27 "a"
|
Name 53 "a"
|
||||||
Name 29 "b"
|
Name 55 "b"
|
||||||
Name 31 "c"
|
Name 57 "c"
|
||||||
Name 33 "d"
|
Name 59 "d"
|
||||||
Name 34 "ret"
|
Name 60 "ret"
|
||||||
Name 54 "e"
|
Name 80 "e"
|
||||||
Name 76 "f"
|
Name 101 "f"
|
||||||
Name 107 "input"
|
Name 132 "input"
|
||||||
Name 109 "input"
|
Name 134 "input"
|
||||||
Name 112 "@entryPointOutput"
|
Name 137 "@entryPointOutput"
|
||||||
Name 113 "param"
|
Name 138 "param"
|
||||||
MemberDecorate 16($Global) 0 Offset 0
|
MemberDecorate 16($Global) 0 Offset 0
|
||||||
MemberDecorate 16($Global) 1 Offset 16
|
MemberDecorate 16($Global) 1 Offset 16
|
||||||
MemberDecorate 16($Global) 2 Offset 32
|
MemberDecorate 16($Global) 2 Offset 32
|
||||||
@ -308,8 +362,8 @@ gl_FragCoord origin is upper left
|
|||||||
MemberDecorate 16($Global) 4 Offset 52
|
MemberDecorate 16($Global) 4 Offset 52
|
||||||
Decorate 16($Global) Block
|
Decorate 16($Global) Block
|
||||||
Decorate 18 DescriptorSet 0
|
Decorate 18 DescriptorSet 0
|
||||||
Decorate 109(input) Location 0
|
Decorate 134(input) Location 0
|
||||||
Decorate 112(@entryPointOutput) Location 0
|
Decorate 137(@entryPointOutput) Location 0
|
||||||
2: TypeVoid
|
2: TypeVoid
|
||||||
3: TypeFunction 2
|
3: TypeFunction 2
|
||||||
6: TypeFloat 32
|
6: TypeFloat 32
|
||||||
@ -323,138 +377,163 @@ gl_FragCoord origin is upper left
|
|||||||
19: TypeInt 32 1
|
19: TypeInt 32 1
|
||||||
20: 19(int) Constant 2
|
20: 19(int) Constant 2
|
||||||
21: TypePointer Uniform 7(fvec4)
|
21: TypePointer Uniform 7(fvec4)
|
||||||
26: TypePointer Function 19(int)
|
24: 19(int) Constant 1
|
||||||
28: 19(int) Constant 5
|
27: 19(int) Constant 0
|
||||||
30: 19(int) Constant 6
|
30: TypeBool
|
||||||
32: 19(int) Constant 7
|
31: TypeVector 30(bool) 4
|
||||||
57: TypeBool
|
32: 6(float) Constant 0
|
||||||
58: TypeInt 32 0
|
33: 7(fvec4) ConstantComposite 32 32 32 32
|
||||||
59: 58(int) Constant 0
|
36: 19(int) Constant 4
|
||||||
65: 19(int) Constant 10
|
37: TypePointer Uniform 6(float)
|
||||||
74: 19(int) Constant 11
|
41: 19(int) Constant 3
|
||||||
78: TypePointer Function 6(float)
|
52: TypePointer Function 19(int)
|
||||||
81: 58(int) Constant 1
|
54: 19(int) Constant 5
|
||||||
108: TypePointer Input 7(fvec4)
|
56: 19(int) Constant 6
|
||||||
109(input): 108(ptr) Variable Input
|
58: 19(int) Constant 7
|
||||||
111: TypePointer Output 7(fvec4)
|
83: TypeInt 32 0
|
||||||
112(@entryPointOutput): 111(ptr) Variable Output
|
84: 83(int) Constant 0
|
||||||
|
90: 19(int) Constant 10
|
||||||
|
99: 19(int) Constant 11
|
||||||
|
103: TypePointer Function 6(float)
|
||||||
|
106: 83(int) Constant 1
|
||||||
|
133: TypePointer Input 7(fvec4)
|
||||||
|
134(input): 133(ptr) Variable Input
|
||||||
|
136: TypePointer Output 7(fvec4)
|
||||||
|
137(@entryPointOutput): 136(ptr) Variable Output
|
||||||
4(PixelShaderFunction): 2 Function None 3
|
4(PixelShaderFunction): 2 Function None 3
|
||||||
5: Label
|
5: Label
|
||||||
107(input): 11(ptr) Variable Function
|
132(input): 11(ptr) Variable Function
|
||||||
113(param): 11(ptr) Variable Function
|
138(param): 11(ptr) Variable Function
|
||||||
110: 7(fvec4) Load 109(input)
|
135: 7(fvec4) Load 134(input)
|
||||||
Store 107(input) 110
|
Store 132(input) 135
|
||||||
114: 7(fvec4) Load 107(input)
|
139: 7(fvec4) Load 132(input)
|
||||||
Store 113(param) 114
|
Store 138(param) 139
|
||||||
115: 7(fvec4) FunctionCall 14(@PixelShaderFunction(vf4;) 113(param)
|
140: 7(fvec4) FunctionCall 14(@PixelShaderFunction(vf4;) 138(param)
|
||||||
Store 112(@entryPointOutput) 115
|
Store 137(@entryPointOutput) 140
|
||||||
Return
|
Return
|
||||||
FunctionEnd
|
FunctionEnd
|
||||||
9(vectorCond(): 7(fvec4) Function None 8
|
9(vectorCond(): 7(fvec4) Function None 8
|
||||||
10: Label
|
10: Label
|
||||||
22: 21(ptr) AccessChain 18 20
|
22: 21(ptr) AccessChain 18 20
|
||||||
23: 7(fvec4) Load 22
|
23: 7(fvec4) Load 22
|
||||||
ReturnValue 23
|
25: 21(ptr) AccessChain 18 24
|
||||||
|
26: 7(fvec4) Load 25
|
||||||
|
28: 21(ptr) AccessChain 18 27
|
||||||
|
29: 7(fvec4) Load 28
|
||||||
|
34: 31(bvec4) FOrdNotEqual 29 33
|
||||||
|
35: 7(fvec4) Select 34 26 23
|
||||||
|
38: 37(ptr) AccessChain 18 36
|
||||||
|
39: 6(float) Load 38
|
||||||
|
40: 7(fvec4) CompositeConstruct 39 39 39 39
|
||||||
|
42: 37(ptr) AccessChain 18 41
|
||||||
|
43: 6(float) Load 42
|
||||||
|
44: 7(fvec4) CompositeConstruct 43 43 43 43
|
||||||
|
45: 21(ptr) AccessChain 18 27
|
||||||
|
46: 7(fvec4) Load 45
|
||||||
|
47: 31(bvec4) FOrdNotEqual 46 33
|
||||||
|
48: 7(fvec4) Select 47 44 40
|
||||||
|
49: 7(fvec4) FAdd 35 48
|
||||||
|
ReturnValue 49
|
||||||
FunctionEnd
|
FunctionEnd
|
||||||
14(@PixelShaderFunction(vf4;): 7(fvec4) Function None 12
|
14(@PixelShaderFunction(vf4;): 7(fvec4) Function None 12
|
||||||
13(input): 11(ptr) FunctionParameter
|
13(input): 11(ptr) FunctionParameter
|
||||||
15: Label
|
15: Label
|
||||||
27(a): 26(ptr) Variable Function
|
53(a): 52(ptr) Variable Function
|
||||||
29(b): 26(ptr) Variable Function
|
55(b): 52(ptr) Variable Function
|
||||||
31(c): 26(ptr) Variable Function
|
57(c): 52(ptr) Variable Function
|
||||||
33(d): 26(ptr) Variable Function
|
59(d): 52(ptr) Variable Function
|
||||||
34(ret): 11(ptr) Variable Function
|
60(ret): 11(ptr) Variable Function
|
||||||
54(e): 26(ptr) Variable Function
|
80(e): 52(ptr) Variable Function
|
||||||
55: 26(ptr) Variable Function
|
81: 52(ptr) Variable Function
|
||||||
67: 26(ptr) Variable Function
|
92: 52(ptr) Variable Function
|
||||||
76(f): 11(ptr) Variable Function
|
101(f): 11(ptr) Variable Function
|
||||||
77: 11(ptr) Variable Function
|
102: 11(ptr) Variable Function
|
||||||
Store 27(a) 28
|
Store 53(a) 54
|
||||||
Store 29(b) 30
|
Store 55(b) 56
|
||||||
Store 31(c) 32
|
Store 57(c) 58
|
||||||
Store 33(d) 32
|
Store 59(d) 58
|
||||||
35: 19(int) Load 27(a)
|
61: 19(int) Load 53(a)
|
||||||
36: 6(float) ConvertSToF 35
|
62: 6(float) ConvertSToF 61
|
||||||
37: 7(fvec4) Load 13(input)
|
63: 7(fvec4) Load 13(input)
|
||||||
38: 7(fvec4) VectorTimesScalar 37 36
|
64: 7(fvec4) VectorTimesScalar 63 62
|
||||||
39: 19(int) Load 29(b)
|
65: 19(int) Load 55(b)
|
||||||
40: 6(float) ConvertSToF 39
|
66: 6(float) ConvertSToF 65
|
||||||
41: 7(fvec4) Load 13(input)
|
67: 7(fvec4) Load 13(input)
|
||||||
42: 7(fvec4) VectorTimesScalar 41 40
|
68: 7(fvec4) VectorTimesScalar 67 66
|
||||||
43: 7(fvec4) FAdd 38 42
|
69: 7(fvec4) FAdd 64 68
|
||||||
44: 19(int) Load 31(c)
|
70: 19(int) Load 57(c)
|
||||||
45: 6(float) ConvertSToF 44
|
71: 6(float) ConvertSToF 70
|
||||||
46: 7(fvec4) Load 13(input)
|
72: 7(fvec4) Load 13(input)
|
||||||
47: 7(fvec4) VectorTimesScalar 46 45
|
73: 7(fvec4) VectorTimesScalar 72 71
|
||||||
48: 7(fvec4) FAdd 43 47
|
74: 7(fvec4) FAdd 69 73
|
||||||
49: 19(int) Load 33(d)
|
75: 19(int) Load 59(d)
|
||||||
50: 6(float) ConvertSToF 49
|
76: 6(float) ConvertSToF 75
|
||||||
51: 7(fvec4) Load 13(input)
|
77: 7(fvec4) Load 13(input)
|
||||||
52: 7(fvec4) VectorTimesScalar 51 50
|
78: 7(fvec4) VectorTimesScalar 77 76
|
||||||
53: 7(fvec4) FAdd 48 52
|
79: 7(fvec4) FAdd 74 78
|
||||||
Store 34(ret) 53
|
Store 60(ret) 79
|
||||||
56: 19(int) Load 29(b)
|
82: 19(int) Load 55(b)
|
||||||
60: 57(bool) INotEqual 56 59
|
85: 30(bool) INotEqual 82 84
|
||||||
SelectionMerge 62 None
|
SelectionMerge 87 None
|
||||||
BranchConditional 60 61 64
|
BranchConditional 85 86 89
|
||||||
61: Label
|
86: Label
|
||||||
63: 19(int) Load 33(d)
|
88: 19(int) Load 59(d)
|
||||||
Store 31(c) 63
|
Store 57(c) 88
|
||||||
Store 55 63
|
Store 81 88
|
||||||
Branch 62
|
Branch 87
|
||||||
64: Label
|
89: Label
|
||||||
Store 55 65
|
Store 81 90
|
||||||
Branch 62
|
Branch 87
|
||||||
62: Label
|
87: Label
|
||||||
66: 19(int) Load 55
|
91: 19(int) Load 81
|
||||||
Store 27(a) 66
|
Store 53(a) 91
|
||||||
Store 54(e) 66
|
Store 80(e) 91
|
||||||
68: 19(int) Load 27(a)
|
93: 19(int) Load 53(a)
|
||||||
69: 57(bool) INotEqual 68 59
|
94: 30(bool) INotEqual 93 84
|
||||||
SelectionMerge 71 None
|
SelectionMerge 96 None
|
||||||
BranchConditional 69 70 73
|
BranchConditional 94 95 98
|
||||||
70: Label
|
95: Label
|
||||||
72: 19(int) Load 31(c)
|
97: 19(int) Load 57(c)
|
||||||
Store 33(d) 72
|
Store 59(d) 97
|
||||||
Store 67 72
|
Store 92 97
|
||||||
Branch 71
|
Branch 96
|
||||||
73: Label
|
98: Label
|
||||||
Store 67 74
|
Store 92 99
|
||||||
Branch 71
|
Branch 96
|
||||||
71: Label
|
96: Label
|
||||||
75: 19(int) Load 67
|
100: 19(int) Load 92
|
||||||
Store 29(b) 75
|
Store 55(b) 100
|
||||||
79: 78(ptr) AccessChain 34(ret) 59
|
104: 103(ptr) AccessChain 60(ret) 84
|
||||||
80: 6(float) Load 79
|
105: 6(float) Load 104
|
||||||
82: 78(ptr) AccessChain 13(input) 81
|
107: 103(ptr) AccessChain 13(input) 106
|
||||||
83: 6(float) Load 82
|
108: 6(float) Load 107
|
||||||
84: 57(bool) FOrdLessThan 80 83
|
109: 30(bool) FOrdLessThan 105 108
|
||||||
SelectionMerge 86 None
|
SelectionMerge 111 None
|
||||||
BranchConditional 84 85 91
|
BranchConditional 109 110 116
|
||||||
85: Label
|
110: Label
|
||||||
87: 19(int) Load 31(c)
|
112: 19(int) Load 57(c)
|
||||||
88: 6(float) ConvertSToF 87
|
113: 6(float) ConvertSToF 112
|
||||||
89: 7(fvec4) Load 13(input)
|
114: 7(fvec4) Load 13(input)
|
||||||
90: 7(fvec4) VectorTimesScalar 89 88
|
115: 7(fvec4) VectorTimesScalar 114 113
|
||||||
Store 77 90
|
Store 102 115
|
||||||
Branch 86
|
Branch 111
|
||||||
91: Label
|
116: Label
|
||||||
92: 19(int) Load 33(d)
|
117: 19(int) Load 59(d)
|
||||||
93: 6(float) ConvertSToF 92
|
118: 6(float) ConvertSToF 117
|
||||||
94: 7(fvec4) Load 13(input)
|
119: 7(fvec4) Load 13(input)
|
||||||
95: 7(fvec4) VectorTimesScalar 94 93
|
120: 7(fvec4) VectorTimesScalar 119 118
|
||||||
Store 77 95
|
Store 102 120
|
||||||
Branch 86
|
Branch 111
|
||||||
86: Label
|
111: Label
|
||||||
96: 7(fvec4) Load 77
|
121: 7(fvec4) Load 102
|
||||||
Store 76(f) 96
|
Store 101(f) 121
|
||||||
97: 19(int) Load 54(e)
|
122: 19(int) Load 80(e)
|
||||||
98: 6(float) ConvertSToF 97
|
123: 6(float) ConvertSToF 122
|
||||||
99: 7(fvec4) Load 34(ret)
|
124: 7(fvec4) Load 60(ret)
|
||||||
100: 7(fvec4) VectorTimesScalar 99 98
|
125: 7(fvec4) VectorTimesScalar 124 123
|
||||||
101: 7(fvec4) Load 76(f)
|
126: 7(fvec4) Load 101(f)
|
||||||
102: 7(fvec4) FAdd 100 101
|
127: 7(fvec4) FAdd 125 126
|
||||||
103: 7(fvec4) FunctionCall 9(vectorCond()
|
128: 7(fvec4) FunctionCall 9(vectorCond()
|
||||||
104: 7(fvec4) FAdd 102 103
|
129: 7(fvec4) FAdd 127 128
|
||||||
ReturnValue 104
|
ReturnValue 129
|
||||||
FunctionEnd
|
FunctionEnd
|
||||||
|
@ -6,8 +6,8 @@ float f;
|
|||||||
|
|
||||||
float4 vectorCond()
|
float4 vectorCond()
|
||||||
{
|
{
|
||||||
return f4; // return (c4 ? t4 : f4) +
|
return (c4 ? t4 : f4) +
|
||||||
// (c4 ? t : f );
|
(c4 ? t : f );
|
||||||
}
|
}
|
||||||
|
|
||||||
float4 PixelShaderFunction(float4 input) : COLOR0
|
float4 PixelShaderFunction(float4 input) : COLOR0
|
||||||
|
@ -1271,7 +1271,8 @@ TIntermTyped* TIntermediate::addMethod(TIntermTyped* object, const TType& type,
|
|||||||
//
|
//
|
||||||
// For "?:" test nodes. There are three children; a condition,
|
// For "?:" test nodes. There are three children; a condition,
|
||||||
// a true path, and a false path. The two paths are specified
|
// a true path, and a false path. The two paths are specified
|
||||||
// as separate parameters.
|
// as separate parameters. For vector 'cond', the true and false
|
||||||
|
// are not paths, but vectors to mix.
|
||||||
//
|
//
|
||||||
// Specialization constant operations include
|
// Specialization constant operations include
|
||||||
// - The ternary operator ( ? : )
|
// - The ternary operator ( ? : )
|
||||||
@ -1304,10 +1305,30 @@ TIntermTyped* TIntermediate::addSelection(TIntermTyped* cond, TIntermTyped* true
|
|||||||
if (falseBlock->getType() != trueBlock->getType())
|
if (falseBlock->getType() != trueBlock->getType())
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
//
|
// Handle a vector condition as a mix
|
||||||
// See if all the operands are constant, then fold it otherwise not.
|
if (!cond->getType().isScalarOrVec1()) {
|
||||||
//
|
TType targetVectorType(trueBlock->getType().getBasicType(), EvqTemporary,
|
||||||
|
cond->getType().getVectorSize());
|
||||||
|
// smear true/false operations if needed
|
||||||
|
if (trueBlock->getType().isScalarOrVec1())
|
||||||
|
trueBlock = addShapeConversion(EOpAssign, targetVectorType, trueBlock);
|
||||||
|
if (falseBlock->getType().isScalarOrVec1())
|
||||||
|
falseBlock = addShapeConversion(EOpAssign, targetVectorType, falseBlock);
|
||||||
|
|
||||||
|
// make the mix operation
|
||||||
|
TIntermAggregate* mix = makeAggregate(loc);
|
||||||
|
mix = growAggregate(mix, falseBlock);
|
||||||
|
mix = growAggregate(mix, trueBlock);
|
||||||
|
mix = growAggregate(mix, cond);
|
||||||
|
mix->setType(targetVectorType);
|
||||||
|
mix->setOp(EOpMix);
|
||||||
|
|
||||||
|
return mix;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Now have a scalar condition...
|
||||||
|
|
||||||
|
// Eliminate the selection when the condition is a scalar and all operands are constant.
|
||||||
if (cond->getAsConstantUnion() && trueBlock->getAsConstantUnion() && falseBlock->getAsConstantUnion()) {
|
if (cond->getAsConstantUnion() && trueBlock->getAsConstantUnion() && falseBlock->getAsConstantUnion()) {
|
||||||
if (cond->getAsConstantUnion()->getConstArray()[0].getBConst())
|
if (cond->getAsConstantUnion()->getConstArray()[0].getBConst())
|
||||||
return trueBlock;
|
return trueBlock;
|
||||||
|
@ -2536,7 +2536,7 @@ bool HlslGrammar::acceptConditionalExpression(TIntermTyped*& node)
|
|||||||
if (! acceptTokenClass(EHTokQuestion))
|
if (! acceptTokenClass(EHTokQuestion))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
node = parseContext.convertConditionalExpression(token.loc, node);
|
node = parseContext.convertConditionalExpression(token.loc, node, false);
|
||||||
if (node == nullptr)
|
if (node == nullptr)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -4529,9 +4529,9 @@ void HlslParseContext::handleRegister(const TSourceLoc& loc, TQualifier& qualifi
|
|||||||
|
|
||||||
// Convert to a scalar boolean, or if not allowed by HLSL semantics,
|
// Convert to a scalar boolean, or if not allowed by HLSL semantics,
|
||||||
// report an error and return nullptr.
|
// report an error and return nullptr.
|
||||||
TIntermTyped* HlslParseContext::convertConditionalExpression(const TSourceLoc& loc, TIntermTyped* condition)
|
TIntermTyped* HlslParseContext::convertConditionalExpression(const TSourceLoc& loc, TIntermTyped* condition, bool mustBeScalar)
|
||||||
{
|
{
|
||||||
if (!condition->getType().isScalarOrVec1()) {
|
if (mustBeScalar && !condition->getType().isScalarOrVec1()) {
|
||||||
error(loc, "requires a scalar", "conditional expression", "");
|
error(loc, "requires a scalar", "conditional expression", "");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
@ -102,7 +102,7 @@ public:
|
|||||||
const glslang::TString* component);
|
const glslang::TString* component);
|
||||||
void handleRegister(const TSourceLoc&, TQualifier&, const glslang::TString* profile, const glslang::TString& desc,
|
void handleRegister(const TSourceLoc&, TQualifier&, const glslang::TString* profile, const glslang::TString& desc,
|
||||||
int subComponent, const glslang::TString*);
|
int subComponent, const glslang::TString*);
|
||||||
TIntermTyped* convertConditionalExpression(const TSourceLoc&, TIntermTyped*);
|
TIntermTyped* convertConditionalExpression(const TSourceLoc&, TIntermTyped*, bool mustBeScalar = true);
|
||||||
TIntermAggregate* handleSamplerTextureCombine(const TSourceLoc& loc, TIntermTyped* argTex, TIntermTyped* argSampler);
|
TIntermAggregate* handleSamplerTextureCombine(const TSourceLoc& loc, TIntermTyped* argTex, TIntermTyped* argSampler);
|
||||||
|
|
||||||
bool parseMatrixSwizzleSelector(const TSourceLoc&, const TString&, int cols, int rows, TSwizzleSelectors<TMatrixSelector>&);
|
bool parseMatrixSwizzleSelector(const TSourceLoc&, const TString&, int cols, int rows, TSwizzleSelectors<TMatrixSelector>&);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user