glslang/Test/baseResults/hlsl.doLoop.frag.out
steve-lunarg 85244d7486 HLSL: Enable component-wise vector comparisons from operators
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.
2016-10-26 08:50:10 -06:00

134 lines
5.4 KiB
Plaintext
Executable File

hlsl.doLoop.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 not tested first
0:3 Loop Condition
0:3 Constant:
0:3 false (const bool)
0:3 No loop body
0:4 Loop with condition not tested first
0:4 Loop Condition
0:4 Constant:
0:4 false (const bool)
0:4 No loop body
0:5 Loop with condition not tested first
0:5 Loop Condition
0:5 all (global bool)
0:5 Equal (temp 4-component vector of bool)
0:5 'input' (layout(location=0 ) in 4-component vector of float)
0:5 'input' (layout(location=0 ) in 4-component vector of float)
0:5 Loop Body
0:5 Sequence
0:5 move second child to first child (temp 4-component vector of float)
0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of float)
0:5 'input' (layout(location=0 ) in 4-component vector of float)
0:5 Branch: Return
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 not tested first
0:3 Loop Condition
0:3 Constant:
0:3 false (const bool)
0:3 No loop body
0:4 Loop with condition not tested first
0:4 Loop Condition
0:4 Constant:
0:4 false (const bool)
0:4 No loop body
0:5 Loop with condition not tested first
0:5 Loop Condition
0:5 all (global bool)
0:5 Equal (temp 4-component vector of bool)
0:5 'input' (layout(location=0 ) in 4-component vector of float)
0:5 'input' (layout(location=0 ) in 4-component vector of float)
0:5 Loop Body
0:5 Sequence
0:5 move second child to first child (temp 4-component vector of float)
0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of float)
0:5 'input' (layout(location=0 ) in 4-component vector of float)
0:5 Branch: Return
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 33
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "PixelShaderFunction" 23 25
ExecutionMode 4 OriginUpperLeft
Name 4 "PixelShaderFunction"
Name 23 "@entryPointOutput"
Name 25 "input"
Decorate 23(@entryPointOutput) Location 0
Decorate 25(input) Location 0
2: TypeVoid
3: TypeFunction 2
10: TypeBool
11: 10(bool) ConstantFalse
20: TypeFloat 32
21: TypeVector 20(float) 4
22: TypePointer Output 21(fvec4)
23(@entryPointOutput): 22(ptr) Variable Output
24: TypePointer Input 21(fvec4)
25(input): 24(ptr) Variable Input
30: TypeVector 10(bool) 4
4(PixelShaderFunction): 2 Function None 3
5: Label
Branch 6
6: Label
LoopMerge 8 9 None
Branch 7
7: Label
Branch 9
9: Label
BranchConditional 11 6 8
8: Label
Branch 12
12: Label
LoopMerge 14 15 None
Branch 13
13: Label
Branch 15
15: Label
BranchConditional 11 12 14
14: Label
Branch 16
16: Label
LoopMerge 18 19 None
Branch 17
17: Label
26: 21(fvec4) Load 25(input)
Store 23(@entryPointOutput) 26
Return
19: Label
28: 21(fvec4) Load 25(input)
29: 21(fvec4) Load 25(input)
31: 30(bvec4) FOrdEqual 28 29
32: 10(bool) All 31
BranchConditional 32 16 18
18: Label
Return
FunctionEnd