HLSL: add optional position.Y inversion
Adds command line options:
--invert-y
--iy
(synonyms) which invert position.Y on vertex shader output. Handles these cases:
* Direct single variable return
* Member of direct returned struct
* Single variable output parameter
* Member of struct output parameter
API:
// Enables position.Y output negation in vertex shader
void TShader::setInvertY(bool invert);
Fixes #1173
This commit is contained in:
113
Test/baseResults/hlsl.y-negate-1.vert.out
Normal file
113
Test/baseResults/hlsl.y-negate-1.vert.out
Normal file
@@ -0,0 +1,113 @@
|
||||
hlsl.y-negate-1.vert
|
||||
Shader version: 500
|
||||
0:? Sequence
|
||||
0:7 Function Definition: @main( ( temp 4-component vector of float)
|
||||
0:7 Function Parameters:
|
||||
0:? Sequence
|
||||
0:8 Branch: Return with expression
|
||||
0:8 pos: direct index for structure ( uniform 4-component vector of float)
|
||||
0:8 'anon@0' (layout( row_major std140) uniform block{ uniform 4-component vector of float pos})
|
||||
0:8 Constant:
|
||||
0:8 0 (const uint)
|
||||
0:7 Function Definition: main( ( temp void)
|
||||
0:7 Function Parameters:
|
||||
0:? Sequence
|
||||
0:7 Sequence
|
||||
0:7 move second child to first child ( temp 4-component vector of float)
|
||||
0:7 '@position' ( temp 4-component vector of float)
|
||||
0:7 Function Call: @main( ( temp 4-component vector of float)
|
||||
0:7 move second child to first child ( temp float)
|
||||
0:7 direct index ( temp float)
|
||||
0:7 '@position' ( temp 4-component vector of float)
|
||||
0:7 Constant:
|
||||
0:7 1 (const int)
|
||||
0:7 Negate value ( temp float)
|
||||
0:7 direct index ( temp float)
|
||||
0:7 '@position' ( temp 4-component vector of float)
|
||||
0:7 Constant:
|
||||
0:7 1 (const int)
|
||||
0:7 move second child to first child ( temp 4-component vector of float)
|
||||
0:? '@entryPointOutput' ( out 4-component vector of float Position)
|
||||
0:7 '@position' ( temp 4-component vector of float)
|
||||
0:? Linker Objects
|
||||
0:? 'anon@0' (layout( row_major std140) uniform block{ uniform 4-component vector of float pos})
|
||||
0:? '@entryPointOutput' ( out 4-component vector of float Position)
|
||||
|
||||
|
||||
Linked vertex stage:
|
||||
|
||||
|
||||
Shader version: 500
|
||||
0:? Sequence
|
||||
0:7 Function Definition: @main( ( temp 4-component vector of float)
|
||||
0:7 Function Parameters:
|
||||
0:? Sequence
|
||||
0:8 Branch: Return with expression
|
||||
0:8 pos: direct index for structure ( uniform 4-component vector of float)
|
||||
0:8 'anon@0' (layout( row_major std140) uniform block{ uniform 4-component vector of float pos})
|
||||
0:8 Constant:
|
||||
0:8 0 (const uint)
|
||||
0:7 Function Definition: main( ( temp void)
|
||||
0:7 Function Parameters:
|
||||
0:? Sequence
|
||||
0:7 Sequence
|
||||
0:7 move second child to first child ( temp 4-component vector of float)
|
||||
0:7 '@position' ( temp 4-component vector of float)
|
||||
0:7 Function Call: @main( ( temp 4-component vector of float)
|
||||
0:7 move second child to first child ( temp float)
|
||||
0:7 direct index ( temp float)
|
||||
0:7 '@position' ( temp 4-component vector of float)
|
||||
0:7 Constant:
|
||||
0:7 1 (const int)
|
||||
0:7 Negate value ( temp float)
|
||||
0:7 direct index ( temp float)
|
||||
0:7 '@position' ( temp 4-component vector of float)
|
||||
0:7 Constant:
|
||||
0:7 1 (const int)
|
||||
0:7 move second child to first child ( temp 4-component vector of float)
|
||||
0:? '@entryPointOutput' ( out 4-component vector of float Position)
|
||||
0:7 '@position' ( temp 4-component vector of float)
|
||||
0:? Linker Objects
|
||||
0:? 'anon@0' (layout( row_major std140) uniform block{ uniform 4-component vector of float pos})
|
||||
0:? '@entryPointOutput' ( out 4-component vector of float Position)
|
||||
|
||||
// Module Version 10000
|
||||
// Generated by (magic number): 80002
|
||||
// Id's are bound by 41
|
||||
|
||||
Capability Shader
|
||||
1: ExtInstImport "GLSL.std.450"
|
||||
MemoryModel Logical GLSL450
|
||||
EntryPoint Vertex 4 "main" 32
|
||||
Source HLSL 500
|
||||
Name 4 "main"
|
||||
Name 11 "$Global"
|
||||
MemberName 11($Global) 0 "pos"
|
||||
Name 13 ""
|
||||
Name 32 "@entryPointOutput"
|
||||
MemberDecorate 11($Global) 0 Offset 0
|
||||
Decorate 11($Global) Block
|
||||
Decorate 13 DescriptorSet 0
|
||||
Decorate 32(@entryPointOutput) BuiltIn Position
|
||||
2: TypeVoid
|
||||
3: TypeFunction 2
|
||||
6: TypeFloat 32
|
||||
7: TypeVector 6(float) 4
|
||||
11($Global): TypeStruct 7(fvec4)
|
||||
12: TypePointer Uniform 11($Global)
|
||||
13: 12(ptr) Variable Uniform
|
||||
14: TypeInt 32 1
|
||||
15: 14(int) Constant 0
|
||||
16: TypePointer Uniform 7(fvec4)
|
||||
31: TypePointer Output 7(fvec4)
|
||||
32(@entryPointOutput): 31(ptr) Variable Output
|
||||
4(main): 2 Function None 3
|
||||
5: Label
|
||||
35: 16(ptr) AccessChain 13 15
|
||||
36: 7(fvec4) Load 35
|
||||
38: 6(float) CompositeExtract 36 1
|
||||
29: 6(float) FNegate 38
|
||||
40: 7(fvec4) CompositeInsert 29 36 1
|
||||
Store 32(@entryPointOutput) 40
|
||||
Return
|
||||
FunctionEnd
|
||||
121
Test/baseResults/hlsl.y-negate-2.vert.out
Normal file
121
Test/baseResults/hlsl.y-negate-2.vert.out
Normal file
@@ -0,0 +1,121 @@
|
||||
hlsl.y-negate-2.vert
|
||||
Shader version: 500
|
||||
0:? Sequence
|
||||
0:6 Function Definition: @main(vf4; ( temp void)
|
||||
0:6 Function Parameters:
|
||||
0:6 'position' ( out 4-component vector of float)
|
||||
0:? Sequence
|
||||
0:7 move second child to first child ( temp 4-component vector of float)
|
||||
0:7 'position' ( out 4-component vector of float)
|
||||
0:7 pos: direct index for structure ( uniform 4-component vector of float)
|
||||
0:7 'anon@0' (layout( row_major std140) uniform block{ uniform 4-component vector of float pos})
|
||||
0:7 Constant:
|
||||
0:7 0 (const uint)
|
||||
0:6 Function Definition: main( ( temp void)
|
||||
0:6 Function Parameters:
|
||||
0:? Sequence
|
||||
0:6 Function Call: @main(vf4; ( temp void)
|
||||
0:? 'position' ( temp 4-component vector of float)
|
||||
0:6 Sequence
|
||||
0:6 move second child to first child ( temp 4-component vector of float)
|
||||
0:6 '@position' ( temp 4-component vector of float)
|
||||
0:? 'position' ( temp 4-component vector of float)
|
||||
0:6 move second child to first child ( temp float)
|
||||
0:6 direct index ( temp float)
|
||||
0:6 '@position' ( temp 4-component vector of float)
|
||||
0:6 Constant:
|
||||
0:6 1 (const int)
|
||||
0:6 Negate value ( temp float)
|
||||
0:6 direct index ( temp float)
|
||||
0:6 '@position' ( temp 4-component vector of float)
|
||||
0:6 Constant:
|
||||
0:6 1 (const int)
|
||||
0:6 move second child to first child ( temp 4-component vector of float)
|
||||
0:? 'position' ( out 4-component vector of float Position)
|
||||
0:6 '@position' ( temp 4-component vector of float)
|
||||
0:? Linker Objects
|
||||
0:? 'anon@0' (layout( row_major std140) uniform block{ uniform 4-component vector of float pos})
|
||||
0:? 'position' ( out 4-component vector of float Position)
|
||||
|
||||
|
||||
Linked vertex stage:
|
||||
|
||||
|
||||
Shader version: 500
|
||||
0:? Sequence
|
||||
0:6 Function Definition: @main(vf4; ( temp void)
|
||||
0:6 Function Parameters:
|
||||
0:6 'position' ( out 4-component vector of float)
|
||||
0:? Sequence
|
||||
0:7 move second child to first child ( temp 4-component vector of float)
|
||||
0:7 'position' ( out 4-component vector of float)
|
||||
0:7 pos: direct index for structure ( uniform 4-component vector of float)
|
||||
0:7 'anon@0' (layout( row_major std140) uniform block{ uniform 4-component vector of float pos})
|
||||
0:7 Constant:
|
||||
0:7 0 (const uint)
|
||||
0:6 Function Definition: main( ( temp void)
|
||||
0:6 Function Parameters:
|
||||
0:? Sequence
|
||||
0:6 Function Call: @main(vf4; ( temp void)
|
||||
0:? 'position' ( temp 4-component vector of float)
|
||||
0:6 Sequence
|
||||
0:6 move second child to first child ( temp 4-component vector of float)
|
||||
0:6 '@position' ( temp 4-component vector of float)
|
||||
0:? 'position' ( temp 4-component vector of float)
|
||||
0:6 move second child to first child ( temp float)
|
||||
0:6 direct index ( temp float)
|
||||
0:6 '@position' ( temp 4-component vector of float)
|
||||
0:6 Constant:
|
||||
0:6 1 (const int)
|
||||
0:6 Negate value ( temp float)
|
||||
0:6 direct index ( temp float)
|
||||
0:6 '@position' ( temp 4-component vector of float)
|
||||
0:6 Constant:
|
||||
0:6 1 (const int)
|
||||
0:6 move second child to first child ( temp 4-component vector of float)
|
||||
0:? 'position' ( out 4-component vector of float Position)
|
||||
0:6 '@position' ( temp 4-component vector of float)
|
||||
0:? Linker Objects
|
||||
0:? 'anon@0' (layout( row_major std140) uniform block{ uniform 4-component vector of float pos})
|
||||
0:? 'position' ( out 4-component vector of float Position)
|
||||
|
||||
// Module Version 10000
|
||||
// Generated by (magic number): 80002
|
||||
// Id's are bound by 43
|
||||
|
||||
Capability Shader
|
||||
1: ExtInstImport "GLSL.std.450"
|
||||
MemoryModel Logical GLSL450
|
||||
EntryPoint Vertex 4 "main" 35
|
||||
Source HLSL 500
|
||||
Name 4 "main"
|
||||
Name 13 "$Global"
|
||||
MemberName 13($Global) 0 "pos"
|
||||
Name 15 ""
|
||||
Name 35 "position"
|
||||
MemberDecorate 13($Global) 0 Offset 0
|
||||
Decorate 13($Global) Block
|
||||
Decorate 15 DescriptorSet 0
|
||||
Decorate 35(position) BuiltIn Position
|
||||
2: TypeVoid
|
||||
3: TypeFunction 2
|
||||
6: TypeFloat 32
|
||||
7: TypeVector 6(float) 4
|
||||
13($Global): TypeStruct 7(fvec4)
|
||||
14: TypePointer Uniform 13($Global)
|
||||
15: 14(ptr) Variable Uniform
|
||||
16: TypeInt 32 1
|
||||
17: 16(int) Constant 0
|
||||
18: TypePointer Uniform 7(fvec4)
|
||||
34: TypePointer Output 7(fvec4)
|
||||
35(position): 34(ptr) Variable Output
|
||||
4(main): 2 Function None 3
|
||||
5: Label
|
||||
37: 18(ptr) AccessChain 15 17
|
||||
38: 7(fvec4) Load 37
|
||||
40: 6(float) CompositeExtract 38 1
|
||||
32: 6(float) FNegate 40
|
||||
42: 7(fvec4) CompositeInsert 32 38 1
|
||||
Store 35(position) 42
|
||||
Return
|
||||
FunctionEnd
|
||||
177
Test/baseResults/hlsl.y-negate-3.vert.out
Normal file
177
Test/baseResults/hlsl.y-negate-3.vert.out
Normal file
@@ -0,0 +1,177 @@
|
||||
hlsl.y-negate-3.vert
|
||||
Shader version: 500
|
||||
0:? Sequence
|
||||
0:11 Function Definition: @main( ( temp structure{ temp 4-component vector of float pos, temp int somethingelse})
|
||||
0:11 Function Parameters:
|
||||
0:? Sequence
|
||||
0:14 move second child to first child ( temp 4-component vector of float)
|
||||
0:14 pos: direct index for structure ( temp 4-component vector of float)
|
||||
0:14 'vsout' ( temp structure{ temp 4-component vector of float pos, temp int somethingelse})
|
||||
0:14 Constant:
|
||||
0:14 0 (const int)
|
||||
0:14 position: direct index for structure ( uniform 4-component vector of float)
|
||||
0:14 'anon@0' (layout( row_major std140) uniform block{ uniform 4-component vector of float position})
|
||||
0:14 Constant:
|
||||
0:14 0 (const uint)
|
||||
0:15 move second child to first child ( temp int)
|
||||
0:15 somethingelse: direct index for structure ( temp int)
|
||||
0:15 'vsout' ( temp structure{ temp 4-component vector of float pos, temp int somethingelse})
|
||||
0:15 Constant:
|
||||
0:15 1 (const int)
|
||||
0:15 Constant:
|
||||
0:15 42 (const int)
|
||||
0:17 Branch: Return with expression
|
||||
0:17 'vsout' ( temp structure{ temp 4-component vector of float pos, temp int somethingelse})
|
||||
0:11 Function Definition: main( ( temp void)
|
||||
0:11 Function Parameters:
|
||||
0:? Sequence
|
||||
0:11 Sequence
|
||||
0:11 move second child to first child ( temp structure{ temp 4-component vector of float pos, temp int somethingelse})
|
||||
0:11 'flattenTemp' ( temp structure{ temp 4-component vector of float pos, temp int somethingelse})
|
||||
0:11 Function Call: @main( ( temp structure{ temp 4-component vector of float pos, temp int somethingelse})
|
||||
0:11 Sequence
|
||||
0:11 move second child to first child ( temp 4-component vector of float)
|
||||
0:11 '@position' ( temp 4-component vector of float)
|
||||
0:11 pos: direct index for structure ( temp 4-component vector of float)
|
||||
0:11 'flattenTemp' ( temp structure{ temp 4-component vector of float pos, temp int somethingelse})
|
||||
0:11 Constant:
|
||||
0:11 0 (const int)
|
||||
0:11 move second child to first child ( temp float)
|
||||
0:11 direct index ( temp float)
|
||||
0:11 '@position' ( temp 4-component vector of float)
|
||||
0:11 Constant:
|
||||
0:11 1 (const int)
|
||||
0:11 Negate value ( temp float)
|
||||
0:11 direct index ( temp float)
|
||||
0:11 '@position' ( temp 4-component vector of float)
|
||||
0:11 Constant:
|
||||
0:11 1 (const int)
|
||||
0:11 move second child to first child ( temp 4-component vector of float)
|
||||
0:? '@entryPointOutput.pos' ( out 4-component vector of float Position)
|
||||
0:11 '@position' ( temp 4-component vector of float)
|
||||
0:11 move second child to first child ( temp int)
|
||||
0:? '@entryPointOutput.somethingelse' (layout( location=0) out int)
|
||||
0:11 somethingelse: direct index for structure ( temp int)
|
||||
0:11 'flattenTemp' ( temp structure{ temp 4-component vector of float pos, temp int somethingelse})
|
||||
0:11 Constant:
|
||||
0:11 1 (const int)
|
||||
0:? Linker Objects
|
||||
0:? 'anon@0' (layout( row_major std140) uniform block{ uniform 4-component vector of float position})
|
||||
0:? '@entryPointOutput.pos' ( out 4-component vector of float Position)
|
||||
0:? '@entryPointOutput.somethingelse' (layout( location=0) out int)
|
||||
|
||||
|
||||
Linked vertex stage:
|
||||
|
||||
|
||||
Shader version: 500
|
||||
0:? Sequence
|
||||
0:11 Function Definition: @main( ( temp structure{ temp 4-component vector of float pos, temp int somethingelse})
|
||||
0:11 Function Parameters:
|
||||
0:? Sequence
|
||||
0:14 move second child to first child ( temp 4-component vector of float)
|
||||
0:14 pos: direct index for structure ( temp 4-component vector of float)
|
||||
0:14 'vsout' ( temp structure{ temp 4-component vector of float pos, temp int somethingelse})
|
||||
0:14 Constant:
|
||||
0:14 0 (const int)
|
||||
0:14 position: direct index for structure ( uniform 4-component vector of float)
|
||||
0:14 'anon@0' (layout( row_major std140) uniform block{ uniform 4-component vector of float position})
|
||||
0:14 Constant:
|
||||
0:14 0 (const uint)
|
||||
0:15 move second child to first child ( temp int)
|
||||
0:15 somethingelse: direct index for structure ( temp int)
|
||||
0:15 'vsout' ( temp structure{ temp 4-component vector of float pos, temp int somethingelse})
|
||||
0:15 Constant:
|
||||
0:15 1 (const int)
|
||||
0:15 Constant:
|
||||
0:15 42 (const int)
|
||||
0:17 Branch: Return with expression
|
||||
0:17 'vsout' ( temp structure{ temp 4-component vector of float pos, temp int somethingelse})
|
||||
0:11 Function Definition: main( ( temp void)
|
||||
0:11 Function Parameters:
|
||||
0:? Sequence
|
||||
0:11 Sequence
|
||||
0:11 move second child to first child ( temp structure{ temp 4-component vector of float pos, temp int somethingelse})
|
||||
0:11 'flattenTemp' ( temp structure{ temp 4-component vector of float pos, temp int somethingelse})
|
||||
0:11 Function Call: @main( ( temp structure{ temp 4-component vector of float pos, temp int somethingelse})
|
||||
0:11 Sequence
|
||||
0:11 move second child to first child ( temp 4-component vector of float)
|
||||
0:11 '@position' ( temp 4-component vector of float)
|
||||
0:11 pos: direct index for structure ( temp 4-component vector of float)
|
||||
0:11 'flattenTemp' ( temp structure{ temp 4-component vector of float pos, temp int somethingelse})
|
||||
0:11 Constant:
|
||||
0:11 0 (const int)
|
||||
0:11 move second child to first child ( temp float)
|
||||
0:11 direct index ( temp float)
|
||||
0:11 '@position' ( temp 4-component vector of float)
|
||||
0:11 Constant:
|
||||
0:11 1 (const int)
|
||||
0:11 Negate value ( temp float)
|
||||
0:11 direct index ( temp float)
|
||||
0:11 '@position' ( temp 4-component vector of float)
|
||||
0:11 Constant:
|
||||
0:11 1 (const int)
|
||||
0:11 move second child to first child ( temp 4-component vector of float)
|
||||
0:? '@entryPointOutput.pos' ( out 4-component vector of float Position)
|
||||
0:11 '@position' ( temp 4-component vector of float)
|
||||
0:11 move second child to first child ( temp int)
|
||||
0:? '@entryPointOutput.somethingelse' (layout( location=0) out int)
|
||||
0:11 somethingelse: direct index for structure ( temp int)
|
||||
0:11 'flattenTemp' ( temp structure{ temp 4-component vector of float pos, temp int somethingelse})
|
||||
0:11 Constant:
|
||||
0:11 1 (const int)
|
||||
0:? Linker Objects
|
||||
0:? 'anon@0' (layout( row_major std140) uniform block{ uniform 4-component vector of float position})
|
||||
0:? '@entryPointOutput.pos' ( out 4-component vector of float Position)
|
||||
0:? '@entryPointOutput.somethingelse' (layout( location=0) out int)
|
||||
|
||||
// Module Version 10000
|
||||
// Generated by (magic number): 80002
|
||||
// Id's are bound by 67
|
||||
|
||||
Capability Shader
|
||||
1: ExtInstImport "GLSL.std.450"
|
||||
MemoryModel Logical GLSL450
|
||||
EntryPoint Vertex 4 "main" 44 47
|
||||
Source HLSL 500
|
||||
Name 4 "main"
|
||||
Name 9 "VS_OUT"
|
||||
MemberName 9(VS_OUT) 0 "pos"
|
||||
MemberName 9(VS_OUT) 1 "somethingelse"
|
||||
Name 16 "$Global"
|
||||
MemberName 16($Global) 0 "position"
|
||||
Name 18 ""
|
||||
Name 44 "@entryPointOutput.pos"
|
||||
Name 47 "@entryPointOutput.somethingelse"
|
||||
MemberDecorate 16($Global) 0 Offset 0
|
||||
Decorate 16($Global) Block
|
||||
Decorate 18 DescriptorSet 0
|
||||
Decorate 44(@entryPointOutput.pos) BuiltIn Position
|
||||
Decorate 47(@entryPointOutput.somethingelse) Location 0
|
||||
2: TypeVoid
|
||||
3: TypeFunction 2
|
||||
6: TypeFloat 32
|
||||
7: TypeVector 6(float) 4
|
||||
8: TypeInt 32 1
|
||||
9(VS_OUT): TypeStruct 7(fvec4) 8(int)
|
||||
15: 8(int) Constant 0
|
||||
16($Global): TypeStruct 7(fvec4)
|
||||
17: TypePointer Uniform 16($Global)
|
||||
18: 17(ptr) Variable Uniform
|
||||
19: TypePointer Uniform 7(fvec4)
|
||||
25: 8(int) Constant 42
|
||||
43: TypePointer Output 7(fvec4)
|
||||
44(@entryPointOutput.pos): 43(ptr) Variable Output
|
||||
46: TypePointer Output 8(int)
|
||||
47(@entryPointOutput.somethingelse): 46(ptr) Variable Output
|
||||
4(main): 2 Function None 3
|
||||
5: Label
|
||||
52: 19(ptr) AccessChain 18 15
|
||||
53: 7(fvec4) Load 52
|
||||
64: 6(float) CompositeExtract 53 1
|
||||
41: 6(float) FNegate 64
|
||||
66: 7(fvec4) CompositeInsert 41 53 1
|
||||
Store 44(@entryPointOutput.pos) 66
|
||||
Store 47(@entryPointOutput.somethingelse) 25
|
||||
Return
|
||||
FunctionEnd
|
||||
Reference in New Issue
Block a user