WIP: add other builtins to interstage IO

(Still adding tests: do not commit)

This fixes PR #632 so that:

(a) The 4 PerVertex builtins are added to an interface block for all stages except fragment.

(b) Other builtin qualified variables are added as "loose" linkage members.

(c) Arrayness from the PerVertex builtins is moved to the PerVertex block.

(d) Sometimes, two PerVertex blocks are created, one for in, one for out (e.g, for some GS that
    both reads and writes a Position)
This commit is contained in:
steve-lunarg 2017-01-07 09:07:14 -07:00
parent 5d89d4d483
commit 46d5428422
16 changed files with 519 additions and 196 deletions

View file

@ -4,48 +4,96 @@ gl_FragCoord origin is upper left
0:? Sequence
0:8 Function Definition: fun(struct-InParam-vf2-vf4-vi21; (temp float)
0:8 Function Parameters:
0:8 'p' (in structure{temp 2-component vector of float v, temp 4-component vector of float FragCoord fragCoord, temp 2-component vector of int i2})
0:8 'p' (temp structure{temp 2-component vector of float v, temp 4-component vector of float fragCoord, temp 2-component vector of int i2})
0:? Sequence
0:9 Branch: Return with expression
0:9 add (temp float)
0:9 direct index (temp float)
0:9 v: direct index for structure (temp 2-component vector of float)
0:9 'p' (in structure{temp 2-component vector of float v, temp 4-component vector of float FragCoord fragCoord, temp 2-component vector of int i2})
0:9 'p' (temp structure{temp 2-component vector of float v, temp 4-component vector of float fragCoord, temp 2-component vector of int i2})
0:9 Constant:
0:9 0 (const int)
0:9 Constant:
0:9 1 (const int)
0:9 direct index (temp float)
0:9 fragCoord: direct index for structure (temp 4-component vector of float FragCoord)
0:9 'p' (in structure{temp 2-component vector of float v, temp 4-component vector of float FragCoord fragCoord, temp 2-component vector of int i2})
0:9 fragCoord: direct index for structure (temp 4-component vector of float)
0:9 'p' (temp structure{temp 2-component vector of float v, temp 4-component vector of float fragCoord, temp 2-component vector of int i2})
0:9 Constant:
0:9 1 (const int)
0:9 Constant:
0:9 0 (const int)
0:13 Function Definition: PixelShaderFunction(struct-InParam-vf2-vf4-vi21; (temp 4-component vector of float)
0:13 Function Parameters:
0:13 'i' (layout(location=0 ) in structure{temp 2-component vector of float v, temp 4-component vector of float FragCoord fragCoord, temp 2-component vector of int i2})
0:13 'i' (in structure{temp 2-component vector of float v, temp 4-component vector of float FragCoord fragCoord, temp 2-component vector of int i2})
0:? Sequence
0:15 move second child to first child (temp structure{temp 2-component vector of float v, temp 4-component vector of float FragCoord fragCoord, temp 2-component vector of int i2})
0:15 'local' (temp structure{temp 2-component vector of float v, temp 4-component vector of float FragCoord fragCoord, temp 2-component vector of int i2})
0:15 'i' (layout(location=0 ) in structure{temp 2-component vector of float v, temp 4-component vector of float FragCoord fragCoord, temp 2-component vector of int i2})
0:15 Sequence
0:15 move second child to first child (temp 2-component vector of float)
0:15 v: direct index for structure (temp 2-component vector of float)
0:15 'local' (temp structure{temp 2-component vector of float v, temp 4-component vector of float fragCoord, temp 2-component vector of int i2})
0:15 Constant:
0:15 0 (const int)
0:15 v: direct index for structure (temp 2-component vector of float)
0:15 'i' (layout(location=0 ) in structure{temp 2-component vector of float v, temp 2-component vector of int i2})
0:15 Constant:
0:15 0 (const int)
0:15 move second child to first child (temp 4-component vector of float)
0:15 fragCoord: direct index for structure (temp 4-component vector of float)
0:15 'local' (temp structure{temp 2-component vector of float v, temp 4-component vector of float fragCoord, temp 2-component vector of int i2})
0:15 Constant:
0:15 1 (const int)
0:? 'i_fragCoord' (in 4-component vector of float FragCoord)
0:15 move second child to first child (temp 2-component vector of int)
0:15 i2: direct index for structure (temp 2-component vector of int)
0:15 'local' (temp structure{temp 2-component vector of float v, temp 4-component vector of float fragCoord, temp 2-component vector of int i2})
0:15 Constant:
0:15 2 (const int)
0:15 i2: direct index for structure (temp 2-component vector of int)
0:15 'i' (layout(location=0 ) in structure{temp 2-component vector of float v, temp 2-component vector of int i2})
0:15 Constant:
0:15 1 (const int)
0:16 Sequence
0:16 move second child to first child (temp float)
0:16 'ret1' (temp float)
0:16 Function Call: fun(struct-InParam-vf2-vf4-vi21; (temp float)
0:16 'local' (temp structure{temp 2-component vector of float v, temp 4-component vector of float FragCoord fragCoord, temp 2-component vector of int i2})
0:16 'local' (temp structure{temp 2-component vector of float v, temp 4-component vector of float fragCoord, temp 2-component vector of int i2})
0:17 Sequence
0:17 move second child to first child (temp float)
0:17 'ret2' (temp float)
0:17 Function Call: fun(struct-InParam-vf2-vf4-vi21; (temp float)
0:17 'i' (layout(location=0 ) in structure{temp 2-component vector of float v, temp 4-component vector of float FragCoord fragCoord, temp 2-component vector of int i2})
0:17 Comma (temp structure{temp 2-component vector of float v, temp 4-component vector of float FragCoord fragCoord, temp 2-component vector of int i2})
0:17 Sequence
0:17 move second child to first child (temp 2-component vector of float)
0:17 v: direct index for structure (temp 2-component vector of float)
0:17 'aggShadow' (temp structure{temp 2-component vector of float v, temp 4-component vector of float FragCoord fragCoord, temp 2-component vector of int i2})
0:17 Constant:
0:17 0 (const int)
0:17 v: direct index for structure (temp 2-component vector of float)
0:17 'i' (layout(location=0 ) in structure{temp 2-component vector of float v, temp 2-component vector of int i2})
0:17 Constant:
0:17 0 (const int)
0:17 move second child to first child (temp 4-component vector of float)
0:17 fragCoord: direct index for structure (temp 4-component vector of float FragCoord)
0:17 'aggShadow' (temp structure{temp 2-component vector of float v, temp 4-component vector of float FragCoord fragCoord, temp 2-component vector of int i2})
0:17 Constant:
0:17 1 (const int)
0:? 'i_fragCoord' (in 4-component vector of float FragCoord)
0:17 move second child to first child (temp 2-component vector of int)
0:17 i2: direct index for structure (temp 2-component vector of int)
0:17 'aggShadow' (temp structure{temp 2-component vector of float v, temp 4-component vector of float FragCoord fragCoord, temp 2-component vector of int i2})
0:17 Constant:
0:17 2 (const int)
0:17 i2: direct index for structure (temp 2-component vector of int)
0:17 'i' (layout(location=0 ) in structure{temp 2-component vector of float v, temp 2-component vector of int i2})
0:17 Constant:
0:17 1 (const int)
0:17 'aggShadow' (temp structure{temp 2-component vector of float v, temp 4-component vector of float FragCoord fragCoord, temp 2-component vector of int i2})
0:19 Sequence
0:19 move second child to first child (temp 4-component vector of float)
0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of float)
0:19 vector-scale (temp 4-component vector of float)
0:19 vector-scale (temp 4-component vector of float)
0:19 fragCoord: direct index for structure (temp 4-component vector of float FragCoord)
0:19 'local' (temp structure{temp 2-component vector of float v, temp 4-component vector of float FragCoord fragCoord, temp 2-component vector of int i2})
0:19 fragCoord: direct index for structure (temp 4-component vector of float)
0:19 'local' (temp structure{temp 2-component vector of float v, temp 4-component vector of float fragCoord, temp 2-component vector of int i2})
0:19 Constant:
0:19 1 (const int)
0:19 'ret1' (temp float)
@ -53,7 +101,8 @@ gl_FragCoord origin is upper left
0:19 Branch: Return
0:? Linker Objects
0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of float)
0:? 'i' (layout(location=0 ) in structure{temp 2-component vector of float v, temp 4-component vector of float FragCoord fragCoord, temp 2-component vector of int i2})
0:? 'i' (layout(location=0 ) in structure{temp 2-component vector of float v, temp 2-component vector of int i2})
0:? 'i_fragCoord' (in 4-component vector of float FragCoord)
Linked fragment stage:
@ -64,48 +113,96 @@ gl_FragCoord origin is upper left
0:? Sequence
0:8 Function Definition: fun(struct-InParam-vf2-vf4-vi21; (temp float)
0:8 Function Parameters:
0:8 'p' (in structure{temp 2-component vector of float v, temp 4-component vector of float FragCoord fragCoord, temp 2-component vector of int i2})
0:8 'p' (temp structure{temp 2-component vector of float v, temp 4-component vector of float fragCoord, temp 2-component vector of int i2})
0:? Sequence
0:9 Branch: Return with expression
0:9 add (temp float)
0:9 direct index (temp float)
0:9 v: direct index for structure (temp 2-component vector of float)
0:9 'p' (in structure{temp 2-component vector of float v, temp 4-component vector of float FragCoord fragCoord, temp 2-component vector of int i2})
0:9 'p' (temp structure{temp 2-component vector of float v, temp 4-component vector of float fragCoord, temp 2-component vector of int i2})
0:9 Constant:
0:9 0 (const int)
0:9 Constant:
0:9 1 (const int)
0:9 direct index (temp float)
0:9 fragCoord: direct index for structure (temp 4-component vector of float FragCoord)
0:9 'p' (in structure{temp 2-component vector of float v, temp 4-component vector of float FragCoord fragCoord, temp 2-component vector of int i2})
0:9 fragCoord: direct index for structure (temp 4-component vector of float)
0:9 'p' (temp structure{temp 2-component vector of float v, temp 4-component vector of float fragCoord, temp 2-component vector of int i2})
0:9 Constant:
0:9 1 (const int)
0:9 Constant:
0:9 0 (const int)
0:13 Function Definition: PixelShaderFunction(struct-InParam-vf2-vf4-vi21; (temp 4-component vector of float)
0:13 Function Parameters:
0:13 'i' (layout(location=0 ) in structure{temp 2-component vector of float v, temp 4-component vector of float FragCoord fragCoord, temp 2-component vector of int i2})
0:13 'i' (in structure{temp 2-component vector of float v, temp 4-component vector of float FragCoord fragCoord, temp 2-component vector of int i2})
0:? Sequence
0:15 move second child to first child (temp structure{temp 2-component vector of float v, temp 4-component vector of float FragCoord fragCoord, temp 2-component vector of int i2})
0:15 'local' (temp structure{temp 2-component vector of float v, temp 4-component vector of float FragCoord fragCoord, temp 2-component vector of int i2})
0:15 'i' (layout(location=0 ) in structure{temp 2-component vector of float v, temp 4-component vector of float FragCoord fragCoord, temp 2-component vector of int i2})
0:15 Sequence
0:15 move second child to first child (temp 2-component vector of float)
0:15 v: direct index for structure (temp 2-component vector of float)
0:15 'local' (temp structure{temp 2-component vector of float v, temp 4-component vector of float fragCoord, temp 2-component vector of int i2})
0:15 Constant:
0:15 0 (const int)
0:15 v: direct index for structure (temp 2-component vector of float)
0:15 'i' (layout(location=0 ) in structure{temp 2-component vector of float v, temp 2-component vector of int i2})
0:15 Constant:
0:15 0 (const int)
0:15 move second child to first child (temp 4-component vector of float)
0:15 fragCoord: direct index for structure (temp 4-component vector of float)
0:15 'local' (temp structure{temp 2-component vector of float v, temp 4-component vector of float fragCoord, temp 2-component vector of int i2})
0:15 Constant:
0:15 1 (const int)
0:? 'i_fragCoord' (in 4-component vector of float FragCoord)
0:15 move second child to first child (temp 2-component vector of int)
0:15 i2: direct index for structure (temp 2-component vector of int)
0:15 'local' (temp structure{temp 2-component vector of float v, temp 4-component vector of float fragCoord, temp 2-component vector of int i2})
0:15 Constant:
0:15 2 (const int)
0:15 i2: direct index for structure (temp 2-component vector of int)
0:15 'i' (layout(location=0 ) in structure{temp 2-component vector of float v, temp 2-component vector of int i2})
0:15 Constant:
0:15 1 (const int)
0:16 Sequence
0:16 move second child to first child (temp float)
0:16 'ret1' (temp float)
0:16 Function Call: fun(struct-InParam-vf2-vf4-vi21; (temp float)
0:16 'local' (temp structure{temp 2-component vector of float v, temp 4-component vector of float FragCoord fragCoord, temp 2-component vector of int i2})
0:16 'local' (temp structure{temp 2-component vector of float v, temp 4-component vector of float fragCoord, temp 2-component vector of int i2})
0:17 Sequence
0:17 move second child to first child (temp float)
0:17 'ret2' (temp float)
0:17 Function Call: fun(struct-InParam-vf2-vf4-vi21; (temp float)
0:17 'i' (layout(location=0 ) in structure{temp 2-component vector of float v, temp 4-component vector of float FragCoord fragCoord, temp 2-component vector of int i2})
0:17 Comma (temp structure{temp 2-component vector of float v, temp 4-component vector of float FragCoord fragCoord, temp 2-component vector of int i2})
0:17 Sequence
0:17 move second child to first child (temp 2-component vector of float)
0:17 v: direct index for structure (temp 2-component vector of float)
0:17 'aggShadow' (temp structure{temp 2-component vector of float v, temp 4-component vector of float FragCoord fragCoord, temp 2-component vector of int i2})
0:17 Constant:
0:17 0 (const int)
0:17 v: direct index for structure (temp 2-component vector of float)
0:17 'i' (layout(location=0 ) in structure{temp 2-component vector of float v, temp 2-component vector of int i2})
0:17 Constant:
0:17 0 (const int)
0:17 move second child to first child (temp 4-component vector of float)
0:17 fragCoord: direct index for structure (temp 4-component vector of float FragCoord)
0:17 'aggShadow' (temp structure{temp 2-component vector of float v, temp 4-component vector of float FragCoord fragCoord, temp 2-component vector of int i2})
0:17 Constant:
0:17 1 (const int)
0:? 'i_fragCoord' (in 4-component vector of float FragCoord)
0:17 move second child to first child (temp 2-component vector of int)
0:17 i2: direct index for structure (temp 2-component vector of int)
0:17 'aggShadow' (temp structure{temp 2-component vector of float v, temp 4-component vector of float FragCoord fragCoord, temp 2-component vector of int i2})
0:17 Constant:
0:17 2 (const int)
0:17 i2: direct index for structure (temp 2-component vector of int)
0:17 'i' (layout(location=0 ) in structure{temp 2-component vector of float v, temp 2-component vector of int i2})
0:17 Constant:
0:17 1 (const int)
0:17 'aggShadow' (temp structure{temp 2-component vector of float v, temp 4-component vector of float FragCoord fragCoord, temp 2-component vector of int i2})
0:19 Sequence
0:19 move second child to first child (temp 4-component vector of float)
0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of float)
0:19 vector-scale (temp 4-component vector of float)
0:19 vector-scale (temp 4-component vector of float)
0:19 fragCoord: direct index for structure (temp 4-component vector of float FragCoord)
0:19 'local' (temp structure{temp 2-component vector of float v, temp 4-component vector of float FragCoord fragCoord, temp 2-component vector of int i2})
0:19 fragCoord: direct index for structure (temp 4-component vector of float)
0:19 'local' (temp structure{temp 2-component vector of float v, temp 4-component vector of float fragCoord, temp 2-component vector of int i2})
0:19 Constant:
0:19 1 (const int)
0:19 'ret1' (temp float)
@ -113,16 +210,17 @@ gl_FragCoord origin is upper left
0:19 Branch: Return
0:? Linker Objects
0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of float)
0:? 'i' (layout(location=0 ) in structure{temp 2-component vector of float v, temp 4-component vector of float FragCoord fragCoord, temp 2-component vector of int i2})
0:? 'i' (layout(location=0 ) in structure{temp 2-component vector of float v, temp 2-component vector of int i2})
0:? 'i_fragCoord' (in 4-component vector of float FragCoord)
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 52
// Id's are bound by 78
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "PixelShaderFunction" 32 43
EntryPoint Fragment 4 "PixelShaderFunction" 33 40 70
ExecutionMode 4 OriginUpperLeft
Name 4 "PixelShaderFunction"
Name 11 "InParam"
@ -132,15 +230,25 @@ gl_FragCoord origin is upper left
Name 15 "fun(struct-InParam-vf2-vf4-vi21;"
Name 14 "p"
Name 30 "local"
Name 32 "i"
Name 34 "ret1"
Name 35 "param"
Name 38 "ret2"
Name 39 "param"
Name 43 "@entryPointOutput"
MemberDecorate 11(InParam) 1 BuiltIn FragCoord
Decorate 32(i) Location 0
Decorate 43(@entryPointOutput) Location 0
Name 31 "InParam"
MemberName 31(InParam) 0 "v"
MemberName 31(InParam) 1 "i2"
Name 33 "i"
Name 40 "i_fragCoord"
Name 50 "ret1"
Name 51 "param"
Name 54 "ret2"
Name 55 "InParam"
MemberName 55(InParam) 0 "v"
MemberName 55(InParam) 1 "fragCoord"
MemberName 55(InParam) 2 "i2"
Name 57 "aggShadow"
Name 66 "param"
Name 70 "@entryPointOutput"
Decorate 33(i) Location 0
Decorate 40(i_fragCoord) BuiltIn FragCoord
MemberDecorate 55(InParam) 1 BuiltIn FragCoord
Decorate 70(@entryPointOutput) Location 0
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
@ -157,35 +265,66 @@ gl_FragCoord origin is upper left
20: TypePointer Function 6(float)
23: 9(int) Constant 1
24: 18(int) Constant 0
31: TypePointer Input 11(InParam)
32(i): 31(ptr) Variable Input
42: TypePointer Output 8(fvec4)
43(@entryPointOutput): 42(ptr) Variable Output
44: TypePointer Function 8(fvec4)
31(InParam): TypeStruct 7(fvec2) 10(ivec2)
32: TypePointer Input 31(InParam)
33(i): 32(ptr) Variable Input
34: TypePointer Input 7(fvec2)
37: TypePointer Function 7(fvec2)
39: TypePointer Input 8(fvec4)
40(i_fragCoord): 39(ptr) Variable Input
42: TypePointer Function 8(fvec4)
44: 9(int) Constant 2
45: TypePointer Input 10(ivec2)
48: TypePointer Function 10(ivec2)
55(InParam): TypeStruct 7(fvec2) 8(fvec4) 10(ivec2)
56: TypePointer Function 55(InParam)
69: TypePointer Output 8(fvec4)
70(@entryPointOutput): 69(ptr) Variable Output
4(PixelShaderFunction): 2 Function None 3
5: Label
30(local): 12(ptr) Variable Function
34(ret1): 20(ptr) Variable Function
35(param): 12(ptr) Variable Function
38(ret2): 20(ptr) Variable Function
39(param): 12(ptr) Variable Function
33: 11(InParam) Load 32(i)
Store 30(local) 33
36: 11(InParam) Load 30(local)
Store 35(param) 36
37: 6(float) FunctionCall 15(fun(struct-InParam-vf2-vf4-vi21;) 35(param)
Store 34(ret1) 37
40: 11(InParam) Load 32(i)
Store 39(param) 40
41: 6(float) FunctionCall 15(fun(struct-InParam-vf2-vf4-vi21;) 39(param)
Store 38(ret2) 41
45: 44(ptr) AccessChain 30(local) 23
46: 8(fvec4) Load 45
47: 6(float) Load 34(ret1)
48: 8(fvec4) VectorTimesScalar 46 47
49: 6(float) Load 38(ret2)
50: 8(fvec4) VectorTimesScalar 48 49
Store 43(@entryPointOutput) 50
50(ret1): 20(ptr) Variable Function
51(param): 12(ptr) Variable Function
54(ret2): 20(ptr) Variable Function
57(aggShadow): 56(ptr) Variable Function
66(param): 56(ptr) Variable Function
35: 34(ptr) AccessChain 33(i) 17
36: 7(fvec2) Load 35
38: 37(ptr) AccessChain 30(local) 17
Store 38 36
41: 8(fvec4) Load 40(i_fragCoord)
43: 42(ptr) AccessChain 30(local) 23
Store 43 41
46: 45(ptr) AccessChain 33(i) 23
47: 10(ivec2) Load 46
49: 48(ptr) AccessChain 30(local) 44
Store 49 47
52: 11(InParam) Load 30(local)
Store 51(param) 52
53: 6(float) FunctionCall 15(fun(struct-InParam-vf2-vf4-vi21;) 51(param)
Store 50(ret1) 53
58: 34(ptr) AccessChain 33(i) 17
59: 7(fvec2) Load 58
60: 37(ptr) AccessChain 57(aggShadow) 17
Store 60 59
61: 8(fvec4) Load 40(i_fragCoord)
62: 42(ptr) AccessChain 57(aggShadow) 23
Store 62 61
63: 45(ptr) AccessChain 33(i) 23
64: 10(ivec2) Load 63
65: 48(ptr) AccessChain 57(aggShadow) 44
Store 65 64
67: 55(InParam) Load 57(aggShadow)
Store 66(param) 67
68: 6(float) FunctionCall 15(fun(struct-InParam-vf2-vf4-vi21;) 66(param)
Store 54(ret2) 68
71: 42(ptr) AccessChain 30(local) 23
72: 8(fvec4) Load 71
73: 6(float) Load 50(ret1)
74: 8(fvec4) VectorTimesScalar 72 73
75: 6(float) Load 54(ret2)
76: 8(fvec4) VectorTimesScalar 74 75
Store 70(@entryPointOutput) 76
Return
FunctionEnd
15(fun(struct-InParam-vf2-vf4-vi21;): 6(float) Function None 13