HLSL: Type sanitization: create non-IO types for var decl and fn param/ret

This introduces parallel types for IO-type containing aggregates used as
non-entry point function parameters or return types, or declared as variables.
Further uses of the same original type will share the same sanitized deep
structure.

This is intended to be used with the wrap-entry-point branch.
This commit is contained in:
steve-lunarg
2017-01-25 10:03:17 -07:00
committed by John Kessenich
parent 0fe106afd2
commit 5d3023af03
5 changed files with 282 additions and 229 deletions

View File

@@ -4,20 +4,20 @@ 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' (in 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' (in 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' (in 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:
@@ -94,20 +94,20 @@ 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' (in 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' (in 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' (in 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:
@@ -191,12 +191,12 @@ gl_FragCoord origin is upper left
MemberName 11(InParam) 2 "i2"
Name 15 "fun(struct-InParam-vf2-vf4-vi21;"
Name 14 "p"
Name 19 "@PixelShaderFunction(struct-InParam-vf2-vf4-vi21;"
Name 18 "i"
Name 34 "InParam"
MemberName 34(InParam) 0 "v"
MemberName 34(InParam) 1 "fragCoord"
MemberName 34(InParam) 2 "i2"
Name 17 "InParam"
MemberName 17(InParam) 0 "v"
MemberName 17(InParam) 1 "fragCoord"
MemberName 17(InParam) 2 "i2"
Name 21 "@PixelShaderFunction(struct-InParam-vf2-vf4-vi21;"
Name 20 "i"
Name 36 "local"
Name 48 "ret1"
Name 49 "param"
@@ -210,7 +210,7 @@ gl_FragCoord origin is upper left
Name 73 "i_fragCoord"
Name 81 "@entryPointOutput"
Name 82 "param"
MemberDecorate 11(InParam) 1 BuiltIn FragCoord
MemberDecorate 17(InParam) 1 BuiltIn FragCoord
Decorate 67(i) Location 0
Decorate 73(i_fragCoord) BuiltIn FragCoord
Decorate 81(@entryPointOutput) Location 0
@@ -224,15 +224,15 @@ gl_FragCoord origin is upper left
11(InParam): TypeStruct 7(fvec2) 8(fvec4) 10(ivec2)
12: TypePointer Function 11(InParam)
13: TypeFunction 6(float) 12(ptr)
17: TypeFunction 8(fvec4) 12(ptr)
21: 9(int) Constant 0
22: TypeInt 32 0
23: 22(int) Constant 1
24: TypePointer Function 6(float)
27: 9(int) Constant 1
28: 22(int) Constant 0
34(InParam): TypeStruct 7(fvec2) 8(fvec4) 10(ivec2)
35: TypePointer Function 34(InParam)
17(InParam): TypeStruct 7(fvec2) 8(fvec4) 10(ivec2)
18: TypePointer Function 17(InParam)
19: TypeFunction 8(fvec4) 18(ptr)
23: 9(int) Constant 0
24: TypeInt 32 0
25: 24(int) Constant 1
26: TypePointer Function 6(float)
29: 9(int) Constant 1
30: 24(int) Constant 0
39: TypePointer Function 7(fvec2)
42: TypePointer Function 8(fvec4)
45: 9(int) Constant 2
@@ -248,62 +248,62 @@ gl_FragCoord origin is upper left
81(@entryPointOutput): 80(ptr) Variable Output
4(PixelShaderFunction): 2 Function None 3
5: Label
64(i): 12(ptr) Variable Function
82(param): 12(ptr) Variable Function
69: 68(ptr) AccessChain 67(i) 21
64(i): 18(ptr) Variable Function
82(param): 18(ptr) Variable Function
69: 68(ptr) AccessChain 67(i) 23
70: 7(fvec2) Load 69
71: 39(ptr) AccessChain 64(i) 21
71: 39(ptr) AccessChain 64(i) 23
Store 71 70
74: 8(fvec4) Load 73(i_fragCoord)
75: 42(ptr) AccessChain 64(i) 27
75: 42(ptr) AccessChain 64(i) 29
Store 75 74
77: 76(ptr) AccessChain 67(i) 27
77: 76(ptr) AccessChain 67(i) 29
78: 10(ivec2) Load 77
79: 46(ptr) AccessChain 64(i) 45
Store 79 78
83: 11(InParam) Load 64(i)
83: 17(InParam) Load 64(i)
Store 82(param) 83
84: 8(fvec4) FunctionCall 19(@PixelShaderFunction(struct-InParam-vf2-vf4-vi21;) 82(param)
84: 8(fvec4) FunctionCall 21(@PixelShaderFunction(struct-InParam-vf2-vf4-vi21;) 82(param)
Store 81(@entryPointOutput) 84
Return
FunctionEnd
15(fun(struct-InParam-vf2-vf4-vi21;): 6(float) Function None 13
14(p): 12(ptr) FunctionParameter
16: Label
25: 24(ptr) AccessChain 14(p) 21 23
26: 6(float) Load 25
29: 24(ptr) AccessChain 14(p) 27 28
30: 6(float) Load 29
31: 6(float) FAdd 26 30
ReturnValue 31
27: 26(ptr) AccessChain 14(p) 23 25
28: 6(float) Load 27
31: 26(ptr) AccessChain 14(p) 29 30
32: 6(float) Load 31
33: 6(float) FAdd 28 32
ReturnValue 33
FunctionEnd
19(@PixelShaderFunction(struct-InParam-vf2-vf4-vi21;): 8(fvec4) Function None 17
18(i): 12(ptr) FunctionParameter
20: Label
36(local): 35(ptr) Variable Function
48(ret1): 24(ptr) Variable Function
49(param): 35(ptr) Variable Function
52(ret2): 24(ptr) Variable Function
53(param): 12(ptr) Variable Function
37: 11(InParam) Load 18(i)
21(@PixelShaderFunction(struct-InParam-vf2-vf4-vi21;): 8(fvec4) Function None 19
20(i): 18(ptr) FunctionParameter
22: Label
36(local): 12(ptr) Variable Function
48(ret1): 26(ptr) Variable Function
49(param): 12(ptr) Variable Function
52(ret2): 26(ptr) Variable Function
53(param): 18(ptr) Variable Function
37: 17(InParam) Load 20(i)
38: 7(fvec2) CompositeExtract 37 0
40: 39(ptr) AccessChain 36(local) 21
40: 39(ptr) AccessChain 36(local) 23
Store 40 38
41: 8(fvec4) CompositeExtract 37 1
43: 42(ptr) AccessChain 36(local) 27
43: 42(ptr) AccessChain 36(local) 29
Store 43 41
44: 10(ivec2) CompositeExtract 37 2
47: 46(ptr) AccessChain 36(local) 45
Store 47 44
50: 34(InParam) Load 36(local)
50: 11(InParam) Load 36(local)
Store 49(param) 50
51: 6(float) FunctionCall 15(fun(struct-InParam-vf2-vf4-vi21;) 49(param)
Store 48(ret1) 51
54: 11(InParam) Load 18(i)
54: 17(InParam) Load 20(i)
Store 53(param) 54
55: 6(float) FunctionCall 15(fun(struct-InParam-vf2-vf4-vi21;) 53(param)
Store 52(ret2) 55
56: 42(ptr) AccessChain 36(local) 27
56: 42(ptr) AccessChain 36(local) 29
57: 8(fvec4) Load 56
58: 6(float) Load 48(ret1)
59: 8(fvec4) VectorTimesScalar 57 58