HLSL: Flatten structs for all non-arrayed I/O interfaces.

This commit is contained in:
John Kessenich
2017-08-11 00:17:26 -06:00
parent 01109546d8
commit e29ff3cd65
15 changed files with 749 additions and 862 deletions

View File

@@ -30,13 +30,7 @@ gl_FragCoord origin is upper left
0:7 0 (const int)
0:7 Constant:
0:7 0 (const int)
0:7 f: direct index for structure ( temp float)
0:7 direct index (layout( location=1) in structure{ temp float f})
0:7 'input' (layout( location=1) in 3-element array of structure{ temp float f})
0:7 Constant:
0:7 0 (const int)
0:7 Constant:
0:7 0 (const int)
0:? 'input[0].f' (layout( location=1) in float)
0:7 move second child to first child ( temp 4-component vector of float)
0:7 pos: direct index for structure ( temp 4-component vector of float)
0:7 direct index ( temp structure{ temp float f, temp 4-component vector of float pos})
@@ -57,13 +51,7 @@ gl_FragCoord origin is upper left
0:7 1 (const int)
0:7 Constant:
0:7 0 (const int)
0:7 f: direct index for structure ( temp float)
0:7 direct index (layout( location=1) in structure{ temp float f})
0:7 'input' (layout( location=1) in 3-element array of structure{ temp float f})
0:7 Constant:
0:7 1 (const int)
0:7 Constant:
0:7 0 (const int)
0:? 'input[1].f' (layout( location=2) in float)
0:7 move second child to first child ( temp 4-component vector of float)
0:7 pos: direct index for structure ( temp 4-component vector of float)
0:7 direct index ( temp structure{ temp float f, temp 4-component vector of float pos})
@@ -84,13 +72,7 @@ gl_FragCoord origin is upper left
0:7 2 (const int)
0:7 Constant:
0:7 0 (const int)
0:7 f: direct index for structure ( temp float)
0:7 direct index (layout( location=1) in structure{ temp float f})
0:7 'input' (layout( location=1) in 3-element array of structure{ temp float f})
0:7 Constant:
0:7 2 (const int)
0:7 Constant:
0:7 0 (const int)
0:? 'input[2].f' (layout( location=3) in float)
0:7 move second child to first child ( temp 4-component vector of float)
0:7 pos: direct index for structure ( temp 4-component vector of float)
0:7 direct index ( temp structure{ temp float f, temp 4-component vector of float pos})
@@ -112,7 +94,9 @@ gl_FragCoord origin is upper left
0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float)
0:? 'i' (layout( location=0) flat in int)
0:? 'input.pos' ( in 3-element array of 4-component vector of float FragCoord)
0:? 'input' (layout( location=1) in 3-element array of structure{ temp float f})
0:? 'input[0].f' (layout( location=1) in float)
0:? 'input[1].f' (layout( location=2) in float)
0:? 'input[2].f' (layout( location=3) in float)
Linked fragment stage:
@@ -149,13 +133,7 @@ gl_FragCoord origin is upper left
0:7 0 (const int)
0:7 Constant:
0:7 0 (const int)
0:7 f: direct index for structure ( temp float)
0:7 direct index (layout( location=1) in structure{ temp float f})
0:7 'input' (layout( location=1) in 3-element array of structure{ temp float f})
0:7 Constant:
0:7 0 (const int)
0:7 Constant:
0:7 0 (const int)
0:? 'input[0].f' (layout( location=1) in float)
0:7 move second child to first child ( temp 4-component vector of float)
0:7 pos: direct index for structure ( temp 4-component vector of float)
0:7 direct index ( temp structure{ temp float f, temp 4-component vector of float pos})
@@ -176,13 +154,7 @@ gl_FragCoord origin is upper left
0:7 1 (const int)
0:7 Constant:
0:7 0 (const int)
0:7 f: direct index for structure ( temp float)
0:7 direct index (layout( location=1) in structure{ temp float f})
0:7 'input' (layout( location=1) in 3-element array of structure{ temp float f})
0:7 Constant:
0:7 1 (const int)
0:7 Constant:
0:7 0 (const int)
0:? 'input[1].f' (layout( location=2) in float)
0:7 move second child to first child ( temp 4-component vector of float)
0:7 pos: direct index for structure ( temp 4-component vector of float)
0:7 direct index ( temp structure{ temp float f, temp 4-component vector of float pos})
@@ -203,13 +175,7 @@ gl_FragCoord origin is upper left
0:7 2 (const int)
0:7 Constant:
0:7 0 (const int)
0:7 f: direct index for structure ( temp float)
0:7 direct index (layout( location=1) in structure{ temp float f})
0:7 'input' (layout( location=1) in 3-element array of structure{ temp float f})
0:7 Constant:
0:7 2 (const int)
0:7 Constant:
0:7 0 (const int)
0:? 'input[2].f' (layout( location=3) in float)
0:7 move second child to first child ( temp 4-component vector of float)
0:7 pos: direct index for structure ( temp 4-component vector of float)
0:7 direct index ( temp structure{ temp float f, temp 4-component vector of float pos})
@@ -231,16 +197,18 @@ gl_FragCoord origin is upper left
0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float)
0:? 'i' (layout( location=0) flat in int)
0:? 'input.pos' ( in 3-element array of 4-component vector of float FragCoord)
0:? 'input' (layout( location=1) in 3-element array of structure{ temp float f})
0:? 'input[0].f' (layout( location=1) in float)
0:? 'input[1].f' (layout( location=2) in float)
0:? 'input[2].f' (layout( location=3) in float)
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 73
// Id's are bound by 69
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 32 39 48 67
EntryPoint Fragment 4 "main" 32 37 44 49 56 63
ExecutionMode 4 OriginUpperLeft
Source HLSL 500
Name 4 "main"
@@ -254,18 +222,20 @@ gl_FragCoord origin is upper left
Name 30 "i"
Name 32 "i"
Name 34 "input"
Name 36 "S"
MemberName 36(S) 0 "f"
Name 39 "input"
Name 48 "input.pos"
Name 67 "@entryPointOutput"
Name 68 "param"
Name 70 "param"
Name 37 "input[0].f"
Name 44 "input.pos"
Name 49 "input[1].f"
Name 56 "input[2].f"
Name 63 "@entryPointOutput"
Name 64 "param"
Name 66 "param"
Decorate 32(i) Flat
Decorate 32(i) Location 0
Decorate 39(input) Location 1
Decorate 48(input.pos) BuiltIn FragCoord
Decorate 67(@entryPointOutput) Location 0
Decorate 37(input[0].f) Location 1
Decorate 44(input.pos) BuiltIn FragCoord
Decorate 49(input[1].f) Location 2
Decorate 56(input[2].f) Location 3
Decorate 63(@entryPointOutput) Location 0
2: TypeVoid
3: TypeFunction 2
6: TypeInt 32 1
@@ -285,58 +255,54 @@ gl_FragCoord origin is upper left
31: TypePointer Input 6(int)
32(i): 31(ptr) Variable Input
35: 6(int) Constant 0
36(S): TypeStruct 8(float)
37: TypeArray 36(S) 12
38: TypePointer Input 37
39(input): 38(ptr) Variable Input
40: TypePointer Input 8(float)
43: TypePointer Function 8(float)
45: 6(int) Constant 1
46: TypeArray 9(fvec4) 12
47: TypePointer Input 46
48(input.pos): 47(ptr) Variable Input
49: TypePointer Input 9(fvec4)
59: 6(int) Constant 2
66: TypePointer Output 9(fvec4)
67(@entryPointOutput): 66(ptr) Variable Output
36: TypePointer Input 8(float)
37(input[0].f): 36(ptr) Variable Input
39: TypePointer Function 8(float)
41: 6(int) Constant 1
42: TypeArray 9(fvec4) 12
43: TypePointer Input 42
44(input.pos): 43(ptr) Variable Input
45: TypePointer Input 9(fvec4)
49(input[1].f): 36(ptr) Variable Input
55: 6(int) Constant 2
56(input[2].f): 36(ptr) Variable Input
62: TypePointer Output 9(fvec4)
63(@entryPointOutput): 62(ptr) Variable Output
4(main): 2 Function None 3
5: Label
30(i): 7(ptr) Variable Function
34(input): 14(ptr) Variable Function
68(param): 7(ptr) Variable Function
70(param): 14(ptr) Variable Function
64(param): 7(ptr) Variable Function
66(param): 14(ptr) Variable Function
33: 6(int) Load 32(i)
Store 30(i) 33
41: 40(ptr) AccessChain 39(input) 35 35
42: 8(float) Load 41
44: 43(ptr) AccessChain 34(input) 35 35
Store 44 42
50: 49(ptr) AccessChain 48(input.pos) 35
51: 9(fvec4) Load 50
52: 25(ptr) AccessChain 34(input) 35 45
Store 52 51
53: 40(ptr) AccessChain 39(input) 45 35
54: 8(float) Load 53
55: 43(ptr) AccessChain 34(input) 45 35
Store 55 54
56: 49(ptr) AccessChain 48(input.pos) 45
57: 9(fvec4) Load 56
58: 25(ptr) AccessChain 34(input) 45 45
38: 8(float) Load 37(input[0].f)
40: 39(ptr) AccessChain 34(input) 35 35
Store 40 38
46: 45(ptr) AccessChain 44(input.pos) 35
47: 9(fvec4) Load 46
48: 25(ptr) AccessChain 34(input) 35 41
Store 48 47
50: 8(float) Load 49(input[1].f)
51: 39(ptr) AccessChain 34(input) 41 35
Store 51 50
52: 45(ptr) AccessChain 44(input.pos) 41
53: 9(fvec4) Load 52
54: 25(ptr) AccessChain 34(input) 41 41
Store 54 53
57: 8(float) Load 56(input[2].f)
58: 39(ptr) AccessChain 34(input) 55 35
Store 58 57
60: 40(ptr) AccessChain 39(input) 59 35
61: 8(float) Load 60
62: 43(ptr) AccessChain 34(input) 59 35
Store 62 61
63: 49(ptr) AccessChain 48(input.pos) 59
64: 9(fvec4) Load 63
65: 25(ptr) AccessChain 34(input) 59 45
Store 65 64
69: 6(int) Load 30(i)
Store 68(param) 69
71: 13 Load 34(input)
Store 70(param) 71
72: 9(fvec4) FunctionCall 18(@main(i1;struct-S-f1-vf41[3];) 68(param) 70(param)
Store 67(@entryPointOutput) 72
59: 45(ptr) AccessChain 44(input.pos) 55
60: 9(fvec4) Load 59
61: 25(ptr) AccessChain 34(input) 55 41
Store 61 60
65: 6(int) Load 30(i)
Store 64(param) 65
67: 13 Load 34(input)
Store 66(param) 67
68: 9(fvec4) FunctionCall 18(@main(i1;struct-S-f1-vf41[3];) 64(param) 66(param)
Store 63(@entryPointOutput) 68
Return
FunctionEnd
18(@main(i1;struct-S-f1-vf41[3];): 9(fvec4) Function None 15