HLSL: Flatten more I/O: non-arrayed user-only structures.

The goal is to flatten all I/O, but there are multiple categories and
steps to complete, likely including a final unification of splitting
and flattening.
This commit is contained in:
John Kessenich
2017-08-04 12:04:44 -06:00
parent cca42a8ea6
commit b6be80f44e
12 changed files with 693 additions and 374 deletions

View File

@@ -24,16 +24,27 @@ gl_FragCoord origin is upper left
0:7 Function Definition: main( ( temp void)
0:7 Function Parameters:
0:? Sequence
0:7 move second child to first child ( temp structure{ temp float interp, temp uint no_interp})
0:? 'input' ( temp structure{ temp float interp, temp uint no_interp})
0:? 'input' (layout( location=0) in structure{ temp float interp, flat temp uint no_interp})
0:7 Sequence
0:7 move second child to first child ( temp float)
0:7 interp: direct index for structure ( temp float)
0:? 'input' ( temp structure{ temp float interp, temp uint no_interp})
0:7 Constant:
0:7 0 (const int)
0:? 'interp' (layout( location=0) in float)
0:7 move second child to first child ( temp uint)
0:7 no_interp: direct index for structure ( temp uint)
0:? 'input' ( temp structure{ temp float interp, temp uint no_interp})
0:7 Constant:
0:7 1 (const int)
0:? 'no_interp' (layout( location=1) flat in uint)
0:7 move second child to first child ( temp 4-component vector of float)
0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float)
0:7 Function Call: @main(struct-PSInput-f1-u11; ( temp 4-component vector of float)
0:? 'input' ( temp structure{ temp float interp, temp uint no_interp})
0:? Linker Objects
0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float)
0:? 'input' (layout( location=0) in structure{ temp float interp, flat temp uint no_interp})
0:? 'interp' (layout( location=0) in float)
0:? 'no_interp' (layout( location=1) flat in uint)
Linked fragment stage:
@@ -64,16 +75,27 @@ gl_FragCoord origin is upper left
0:7 Function Definition: main( ( temp void)
0:7 Function Parameters:
0:? Sequence
0:7 move second child to first child ( temp structure{ temp float interp, temp uint no_interp})
0:? 'input' ( temp structure{ temp float interp, temp uint no_interp})
0:? 'input' (layout( location=0) in structure{ temp float interp, flat temp uint no_interp})
0:7 Sequence
0:7 move second child to first child ( temp float)
0:7 interp: direct index for structure ( temp float)
0:? 'input' ( temp structure{ temp float interp, temp uint no_interp})
0:7 Constant:
0:7 0 (const int)
0:? 'interp' (layout( location=0) in float)
0:7 move second child to first child ( temp uint)
0:7 no_interp: direct index for structure ( temp uint)
0:? 'input' ( temp structure{ temp float interp, temp uint no_interp})
0:7 Constant:
0:7 1 (const int)
0:? 'no_interp' (layout( location=1) flat in uint)
0:7 move second child to first child ( temp 4-component vector of float)
0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float)
0:7 Function Call: @main(struct-PSInput-f1-u11; ( temp 4-component vector of float)
0:? 'input' ( temp structure{ temp float interp, temp uint no_interp})
0:? Linker Objects
0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float)
0:? 'input' (layout( location=0) in structure{ temp float interp, flat temp uint no_interp})
0:? 'interp' (layout( location=0) in float)
0:? 'no_interp' (layout( location=1) flat in uint)
// Module Version 10000
// Generated by (magic number): 80001
@@ -82,7 +104,7 @@ gl_FragCoord origin is upper left
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 33 40
EntryPoint Fragment 4 "main" 32 36 40
ExecutionMode 4 OriginUpperLeft
Source HLSL 500
Name 4 "main"
@@ -92,14 +114,13 @@ gl_FragCoord origin is upper left
Name 13 "@main(struct-PSInput-f1-u11;"
Name 12 "input"
Name 30 "input"
Name 31 "PSInput"
MemberName 31(PSInput) 0 "interp"
MemberName 31(PSInput) 1 "no_interp"
Name 33 "input"
Name 32 "interp"
Name 36 "no_interp"
Name 40 "@entryPointOutput"
Name 41 "param"
MemberDecorate 31(PSInput) 1 Flat
Decorate 33(input) Location 0
Decorate 32(interp) Location 0
Decorate 36(no_interp) Flat
Decorate 36(no_interp) Location 1
Decorate 40(@entryPointOutput) Location 0
2: TypeVoid
3: TypeFunction 2
@@ -116,20 +137,20 @@ gl_FragCoord origin is upper left
22: TypePointer Function 6(float)
25: 6(float) Constant 0
26: 6(float) Constant 1065353216
31(PSInput): TypeStruct 6(float) 7(int)
32: TypePointer Input 31(PSInput)
33(input): 32(ptr) Variable Input
31: TypePointer Input 6(float)
32(interp): 31(ptr) Variable Input
35: TypePointer Input 7(int)
36(no_interp): 35(ptr) Variable Input
39: TypePointer Output 10(fvec4)
40(@entryPointOutput): 39(ptr) Variable Output
4(main): 2 Function None 3
5: Label
30(input): 9(ptr) Variable Function
41(param): 9(ptr) Variable Function
34: 31(PSInput) Load 33(input)
35: 6(float) CompositeExtract 34 0
36: 22(ptr) AccessChain 30(input) 21
Store 36 35
37: 7(int) CompositeExtract 34 1
33: 6(float) Load 32(interp)
34: 22(ptr) AccessChain 30(input) 21
Store 34 33
37: 7(int) Load 36(no_interp)
38: 17(ptr) AccessChain 30(input) 16
Store 38 37
42: 8(PSInput) Load 30(input)