
This PR only changes a few lines of code, but is subtle. In HLSL, comparison operators (<,>,<=,>=,==,!=) operate component-wise when given a vector operand. If a whole vector equality or inequality is desired, then all() or any() can be used on the resulting bool vector. This PR enables this change. Existing shape conversion is used when one of the two arguments is a vector and one is a scalar. Some existing HLSL tests had assumed == and != meant vector-wise instead of component-wise comparisons. These tests have been changed to add an explicit any() or all() to the test source. This verifably does not change the final SPIR-V binary relative to the old behavior for == and !=. The AST does change for the (now explicit, formerly implicit) any() and all(). Also, a few tests changes where they previously had the return type wrong, e.g, from a vec < vec comparison in hlsl.shapeConv.frag. Promotion of comparison opcodes to vector forms (EOpEqual->EOpVectorEqual) is handled in promoteBinary(), as is setting the proper vector type of the result. EOpVectorEqual and EOpVectorNotEqual are now accepted as either aggregate or binary nodes, similar to how the other operators are handled. Partial support already existed for this: it has been fleshed out in the printing functions in intermOut.cpp. There is an existing defect around shape conversion with 1-vectors, but that is orthogonal to this PR and not addressed by it.
163 lines
6.4 KiB
Plaintext
Executable File
163 lines
6.4 KiB
Plaintext
Executable File
hlsl.whileLoop.frag
|
|
Shader version: 450
|
|
gl_FragCoord origin is upper left
|
|
0:? Sequence
|
|
0:2 Function Definition: PixelShaderFunction(vf4; (temp 4-component vector of float)
|
|
0:2 Function Parameters:
|
|
0:2 'input' (layout(location=0 ) in 4-component vector of float)
|
|
0:? Sequence
|
|
0:3 Loop with condition tested first
|
|
0:3 Loop Condition
|
|
0:3 any (global bool)
|
|
0:3 NotEqual (temp 4-component vector of bool)
|
|
0:3 'input' (layout(location=0 ) in 4-component vector of float)
|
|
0:3 'input' (layout(location=0 ) in 4-component vector of float)
|
|
0:3 Loop Body
|
|
0:? Sequence
|
|
0:3 Sequence
|
|
0:3 move second child to first child (temp 4-component vector of float)
|
|
0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of float)
|
|
0:3 'input' (layout(location=0 ) in 4-component vector of float)
|
|
0:3 Branch: Return
|
|
0:4 Loop with condition tested first
|
|
0:4 Loop Condition
|
|
0:4 Constant:
|
|
0:4 false (const bool)
|
|
0:4 No loop body
|
|
0:5 Loop with condition tested first
|
|
0:5 Loop Condition
|
|
0:5 Constant:
|
|
0:5 false (const bool)
|
|
0:5 No loop body
|
|
0:6 Loop with condition tested first
|
|
0:6 Loop Condition
|
|
0:6 Constant:
|
|
0:6 false (const bool)
|
|
0:6 No loop body
|
|
0:? Linker Objects
|
|
0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of float)
|
|
0:? 'input' (layout(location=0 ) in 4-component vector of float)
|
|
|
|
|
|
Linked fragment stage:
|
|
|
|
|
|
Shader version: 450
|
|
gl_FragCoord origin is upper left
|
|
0:? Sequence
|
|
0:2 Function Definition: PixelShaderFunction(vf4; (temp 4-component vector of float)
|
|
0:2 Function Parameters:
|
|
0:2 'input' (layout(location=0 ) in 4-component vector of float)
|
|
0:? Sequence
|
|
0:3 Loop with condition tested first
|
|
0:3 Loop Condition
|
|
0:3 any (global bool)
|
|
0:3 NotEqual (temp 4-component vector of bool)
|
|
0:3 'input' (layout(location=0 ) in 4-component vector of float)
|
|
0:3 'input' (layout(location=0 ) in 4-component vector of float)
|
|
0:3 Loop Body
|
|
0:? Sequence
|
|
0:3 Sequence
|
|
0:3 move second child to first child (temp 4-component vector of float)
|
|
0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of float)
|
|
0:3 'input' (layout(location=0 ) in 4-component vector of float)
|
|
0:3 Branch: Return
|
|
0:4 Loop with condition tested first
|
|
0:4 Loop Condition
|
|
0:4 Constant:
|
|
0:4 false (const bool)
|
|
0:4 No loop body
|
|
0:5 Loop with condition tested first
|
|
0:5 Loop Condition
|
|
0:5 Constant:
|
|
0:5 false (const bool)
|
|
0:5 No loop body
|
|
0:6 Loop with condition tested first
|
|
0:6 Loop Condition
|
|
0:6 Constant:
|
|
0:6 false (const bool)
|
|
0:6 No loop body
|
|
0:? Linker Objects
|
|
0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of float)
|
|
0:? 'input' (layout(location=0 ) in 4-component vector of float)
|
|
|
|
// Module Version 10000
|
|
// Generated by (magic number): 80001
|
|
// Id's are bound by 41
|
|
|
|
Capability Shader
|
|
1: ExtInstImport "GLSL.std.450"
|
|
MemoryModel Logical GLSL450
|
|
EntryPoint Fragment 4 "PixelShaderFunction" 14 22
|
|
ExecutionMode 4 OriginUpperLeft
|
|
Name 4 "PixelShaderFunction"
|
|
Name 14 "input"
|
|
Name 22 "@entryPointOutput"
|
|
Decorate 14(input) Location 0
|
|
Decorate 22(@entryPointOutput) Location 0
|
|
2: TypeVoid
|
|
3: TypeFunction 2
|
|
11: TypeFloat 32
|
|
12: TypeVector 11(float) 4
|
|
13: TypePointer Input 12(fvec4)
|
|
14(input): 13(ptr) Variable Input
|
|
17: TypeBool
|
|
18: TypeVector 17(bool) 4
|
|
21: TypePointer Output 12(fvec4)
|
|
22(@entryPointOutput): 21(ptr) Variable Output
|
|
30: 17(bool) ConstantFalse
|
|
4(PixelShaderFunction): 2 Function None 3
|
|
5: Label
|
|
Branch 6
|
|
6: Label
|
|
LoopMerge 8 9 None
|
|
Branch 10
|
|
10: Label
|
|
15: 12(fvec4) Load 14(input)
|
|
16: 12(fvec4) Load 14(input)
|
|
19: 18(bvec4) FOrdNotEqual 15 16
|
|
20: 17(bool) Any 19
|
|
BranchConditional 20 7 8
|
|
7: Label
|
|
23: 12(fvec4) Load 14(input)
|
|
Store 22(@entryPointOutput) 23
|
|
Return
|
|
9: Label
|
|
Branch 6
|
|
8: Label
|
|
Branch 25
|
|
25: Label
|
|
LoopMerge 27 28 None
|
|
Branch 29
|
|
29: Label
|
|
BranchConditional 30 26 27
|
|
26: Label
|
|
Branch 28
|
|
28: Label
|
|
Branch 25
|
|
27: Label
|
|
Branch 31
|
|
31: Label
|
|
LoopMerge 33 34 None
|
|
Branch 35
|
|
35: Label
|
|
BranchConditional 30 32 33
|
|
32: Label
|
|
Branch 34
|
|
34: Label
|
|
Branch 31
|
|
33: Label
|
|
Branch 36
|
|
36: Label
|
|
LoopMerge 38 39 None
|
|
Branch 40
|
|
40: Label
|
|
BranchConditional 30 37 38
|
|
37: Label
|
|
Branch 39
|
|
39: Label
|
|
Branch 36
|
|
38: Label
|
|
Return
|
|
FunctionEnd
|