HLSL: Flatten vertex input and fragment output structures.

Vulkan can't handle structures into the vertex stage or out
of the fragment stage.
This commit is contained in:
John Kessenich 2016-09-09 16:32:09 -06:00
parent 6295c27900
commit cd0a78a0d9
7 changed files with 255 additions and 67 deletions

View file

@ -5,32 +5,26 @@ gl_FragCoord origin is upper left
0:7 Function Definition: PixelShaderFunction(vf4;vf4;struct-OutParam-vf2-vi21; (global 4-component vector of float)
0:7 Function Parameters:
0:7 'input' (layout(location=0 ) in 4-component vector of float)
0:7 'out1' (out 4-component vector of float)
0:7 'out2' (out structure{temp 2-component vector of float v, temp 2-component vector of int i})
0:7 'out1' (layout(location=1 ) out 4-component vector of float)
0:7 'out2' (layout(location=2 ) out structure{temp 2-component vector of float v, temp 2-component vector of int i})
0:? Sequence
0:8 move second child to first child (temp 4-component vector of float)
0:8 'out1' (out 4-component vector of float)
0:8 'out1' (layout(location=1 ) out 4-component vector of float)
0:8 'input' (layout(location=0 ) in 4-component vector of float)
0:9 move second child to first child (temp 2-component vector of float)
0:9 v: direct index for structure (temp 2-component vector of float)
0:9 'out2' (out structure{temp 2-component vector of float v, temp 2-component vector of int i})
0:9 Constant:
0:9 0 (const int)
0:? 'v' (layout(location=2 ) out 2-component vector of float)
0:9 Constant:
0:9 2.000000
0:9 2.000000
0:10 move second child to first child (temp 2-component vector of int)
0:10 i: direct index for structure (temp 2-component vector of int)
0:10 'out2' (out structure{temp 2-component vector of float v, temp 2-component vector of int i})
0:10 Constant:
0:10 1 (const int)
0:? 'i' (layout(location=3 ) out 2-component vector of int)
0:10 Constant:
0:10 3 (const int)
0:10 3 (const int)
0:11 Sequence
0:11 move second child to first child (temp 4-component vector of float)
0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of float)
0:11 'out1' (out 4-component vector of float)
0:11 'out1' (layout(location=1 ) out 4-component vector of float)
0:11 Branch: Return
0:? Linker Objects
@ -44,54 +38,49 @@ gl_FragCoord origin is upper left
0:7 Function Definition: PixelShaderFunction(vf4;vf4;struct-OutParam-vf2-vi21; (global 4-component vector of float)
0:7 Function Parameters:
0:7 'input' (layout(location=0 ) in 4-component vector of float)
0:7 'out1' (out 4-component vector of float)
0:7 'out2' (out structure{temp 2-component vector of float v, temp 2-component vector of int i})
0:7 'out1' (layout(location=1 ) out 4-component vector of float)
0:7 'out2' (layout(location=2 ) out structure{temp 2-component vector of float v, temp 2-component vector of int i})
0:? Sequence
0:8 move second child to first child (temp 4-component vector of float)
0:8 'out1' (out 4-component vector of float)
0:8 'out1' (layout(location=1 ) out 4-component vector of float)
0:8 'input' (layout(location=0 ) in 4-component vector of float)
0:9 move second child to first child (temp 2-component vector of float)
0:9 v: direct index for structure (temp 2-component vector of float)
0:9 'out2' (out structure{temp 2-component vector of float v, temp 2-component vector of int i})
0:9 Constant:
0:9 0 (const int)
0:? 'v' (layout(location=2 ) out 2-component vector of float)
0:9 Constant:
0:9 2.000000
0:9 2.000000
0:10 move second child to first child (temp 2-component vector of int)
0:10 i: direct index for structure (temp 2-component vector of int)
0:10 'out2' (out structure{temp 2-component vector of float v, temp 2-component vector of int i})
0:10 Constant:
0:10 1 (const int)
0:? 'i' (layout(location=3 ) out 2-component vector of int)
0:10 Constant:
0:10 3 (const int)
0:10 3 (const int)
0:11 Sequence
0:11 move second child to first child (temp 4-component vector of float)
0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of float)
0:11 'out1' (out 4-component vector of float)
0:11 'out1' (layout(location=1 ) out 4-component vector of float)
0:11 Branch: Return
0:? Linker Objects
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 32
// Id's are bound by 27
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "PixelShaderFunction" 9 11 18 29
EntryPoint Fragment 4 "PixelShaderFunction" 9 11 15 21 24
ExecutionMode 4 OriginUpperLeft
Name 4 "PixelShaderFunction"
Name 9 "out1"
Name 11 "input"
Name 16 "OutParam"
MemberName 16(OutParam) 0 "v"
MemberName 16(OutParam) 1 "i"
Name 18 "out2"
Name 29 "@entryPointOutput"
Name 15 "v"
Name 21 "i"
Name 24 "@entryPointOutput"
Decorate 9(out1) Location 1
Decorate 11(input) Location 0
Decorate 29(@entryPointOutput) Location 0
Decorate 15(v) Location 2
Decorate 21(i) Location 3
Decorate 24(@entryPointOutput) Location 0
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
@ -101,29 +90,24 @@ gl_FragCoord origin is upper left
10: TypePointer Input 7(fvec4)
11(input): 10(ptr) Variable Input
13: TypeVector 6(float) 2
14: TypeInt 32 1
15: TypeVector 14(int) 2
16(OutParam): TypeStruct 13(fvec2) 15(ivec2)
17: TypePointer Output 16(OutParam)
18(out2): 17(ptr) Variable Output
19: 14(int) Constant 0
20: 6(float) Constant 1073741824
21: 13(fvec2) ConstantComposite 20 20
22: TypePointer Output 13(fvec2)
24: 14(int) Constant 1
25: 14(int) Constant 3
26: 15(ivec2) ConstantComposite 25 25
27: TypePointer Output 15(ivec2)
29(@entryPointOutput): 8(ptr) Variable Output
14: TypePointer Output 13(fvec2)
15(v): 14(ptr) Variable Output
16: 6(float) Constant 1073741824
17: 13(fvec2) ConstantComposite 16 16
18: TypeInt 32 1
19: TypeVector 18(int) 2
20: TypePointer Output 19(ivec2)
21(i): 20(ptr) Variable Output
22: 18(int) Constant 3
23: 19(ivec2) ConstantComposite 22 22
24(@entryPointOutput): 8(ptr) Variable Output
4(PixelShaderFunction): 2 Function None 3
5: Label
12: 7(fvec4) Load 11(input)
Store 9(out1) 12
23: 22(ptr) AccessChain 18(out2) 19
Store 23 21
28: 27(ptr) AccessChain 18(out2) 24
Store 28 26
30: 7(fvec4) Load 9(out1)
Store 29(@entryPointOutput) 30
Store 15(v) 17
Store 21(i) 23
25: 7(fvec4) Load 9(out1)
Store 24(@entryPointOutput) 25
Return
FunctionEnd