From 46d5428422950702464ecf64a641d6925bb454ae Mon Sep 17 00:00:00 2001 From: steve-lunarg Date: Sat, 7 Jan 2017 09:07:14 -0700 Subject: [PATCH] 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) --- Test/baseResults/hlsl.entry-in.frag.out | 265 +++++++++++++----- .../hlsl.gather.basic.dx10.vert.out | 16 +- .../hlsl.getdimensions.dx10.vert.out | 16 +- .../baseResults/hlsl.load.basic.dx10.vert.out | 16 +- .../hlsl.samplegrad.basic.dx10.vert.out | 16 +- .../hlsl.samplelevel.basic.dx10.vert.out | 16 +- Test/baseResults/hlsl.struct.frag.out | 38 +-- Test/baseResults/hlsl.struct.split-1.vert.out | 16 +- .../hlsl.struct.split.array.geom.out | 20 +- .../hlsl.struct.split.call.vert.out | 16 +- .../hlsl.struct.split.nested.geom.out | 46 +-- .../hlsl.struct.split.trivial.geom.out | 53 ++-- .../hlsl.struct.split.trivial.vert.out | 16 +- .../hlsl.structarray.flatten.geom.out | 28 +- glslang/Include/Types.h | 41 +-- hlsl/hlslParseHelper.cpp | 96 ++++++- 16 files changed, 519 insertions(+), 196 deletions(-) diff --git a/Test/baseResults/hlsl.entry-in.frag.out b/Test/baseResults/hlsl.entry-in.frag.out index 686b355c..9dfbe419 100755 --- a/Test/baseResults/hlsl.entry-in.frag.out +++ b/Test/baseResults/hlsl.entry-in.frag.out @@ -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 diff --git a/Test/baseResults/hlsl.gather.basic.dx10.vert.out b/Test/baseResults/hlsl.gather.basic.dx10.vert.out index 3226769d..bea5142b 100644 --- a/Test/baseResults/hlsl.gather.basic.dx10.vert.out +++ b/Test/baseResults/hlsl.gather.basic.dx10.vert.out @@ -102,7 +102,7 @@ Shader version: 450 0:? 'g_tTexcdf4' (uniform textureCube) 0:? 'g_tTexcdi4' (uniform itextureCube) 0:? 'g_tTexcdu4' (uniform utextureCube) -0:? 'Pos' (out 4-component vector of float Position) +0:? 'PerVertex_out' (out block{out 4-component vector of float Position Pos}) Linked vertex stage: @@ -211,17 +211,17 @@ Shader version: 450 0:? 'g_tTexcdf4' (uniform textureCube) 0:? 'g_tTexcdi4' (uniform itextureCube) 0:? 'g_tTexcdu4' (uniform utextureCube) -0:? 'Pos' (out 4-component vector of float Position) +0:? 'PerVertex_out' (out block{out 4-component vector of float Position Pos}) // Module Version 10000 // Generated by (magic number): 80001 -// Id's are bound by 121 +// Id's are bound by 124 Capability Shader Capability Sampled1D 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint Vertex 4 "main" 97 + EntryPoint Vertex 4 "main" 97 123 Name 4 "main" Name 9 "txval20" Name 12 "g_tTex2df4" @@ -248,6 +248,9 @@ Shader version: 450 Name 114 "g_tTex3df4" Name 117 "g_tTex3di4" Name 120 "g_tTex3du4" + Name 121 "PerVertex_out" + MemberName 121(PerVertex_out) 0 "Pos" + Name 123 "PerVertex_out" Decorate 12(g_tTex2df4) DescriptorSet 0 Decorate 16(g_sSamp) DescriptorSet 0 Decorate 16(g_sSamp) Binding 0 @@ -267,6 +270,8 @@ Shader version: 450 Decorate 114(g_tTex3df4) DescriptorSet 0 Decorate 117(g_tTex3di4) DescriptorSet 0 Decorate 120(g_tTex3du4) DescriptorSet 0 + MemberDecorate 121(PerVertex_out) 0 BuiltIn Position + Decorate 121(PerVertex_out) Block 2: TypeVoid 3: TypeFunction 2 6: TypeFloat 32 @@ -349,6 +354,9 @@ Shader version: 450 118: TypeImage 41(int) 3D sampled format:Unknown 119: TypePointer UniformConstant 118 120(g_tTex3du4): 119(ptr) Variable UniformConstant +121(PerVertex_out): TypeStruct 7(fvec4) + 122: TypePointer Output 121(PerVertex_out) +123(PerVertex_out): 122(ptr) Variable Output 4(main): 2 Function None 3 5: Label 9(txval20): 8(ptr) Variable Function diff --git a/Test/baseResults/hlsl.getdimensions.dx10.vert.out b/Test/baseResults/hlsl.getdimensions.dx10.vert.out index 77316b12..85a25af4 100644 --- a/Test/baseResults/hlsl.getdimensions.dx10.vert.out +++ b/Test/baseResults/hlsl.getdimensions.dx10.vert.out @@ -48,7 +48,7 @@ Shader version: 450 0:? Linker Objects 0:? 'g_sSamp' (layout(binding=0 ) uniform sampler) 0:? 'g_tTex1df4' (layout(binding=0 ) uniform texture1D) -0:? 'Pos' (out 4-component vector of float Position) +0:? 'PerVertex_out' (out block{out 4-component vector of float Position Pos}) Linked vertex stage: @@ -103,18 +103,18 @@ Shader version: 450 0:? Linker Objects 0:? 'g_sSamp' (layout(binding=0 ) uniform sampler) 0:? 'g_tTex1df4' (layout(binding=0 ) uniform texture1D) -0:? 'Pos' (out 4-component vector of float Position) +0:? 'PerVertex_out' (out block{out 4-component vector of float Position Pos}) // Module Version 10000 // Generated by (magic number): 80001 -// Id's are bound by 43 +// Id's are bound by 46 Capability Shader Capability Sampled1D Capability ImageQuery 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint Vertex 4 "main" 36 + EntryPoint Vertex 4 "main" 36 45 Name 4 "main" Name 8 "sizeQueryTemp" Name 12 "g_tTex1df4" @@ -126,11 +126,16 @@ Shader version: 450 Name 29 "vsout" Name 36 "Pos" Name 42 "g_sSamp" + Name 43 "PerVertex_out" + MemberName 43(PerVertex_out) 0 "Pos" + Name 45 "PerVertex_out" Decorate 12(g_tTex1df4) DescriptorSet 0 Decorate 12(g_tTex1df4) Binding 0 Decorate 36(Pos) BuiltIn Position Decorate 42(g_sSamp) DescriptorSet 0 Decorate 42(g_sSamp) Binding 0 + MemberDecorate 43(PerVertex_out) 0 BuiltIn Position + Decorate 43(PerVertex_out) Block 2: TypeVoid 3: TypeFunction 2 6: TypeInt 32 0 @@ -153,6 +158,9 @@ Shader version: 450 40: TypeSampler 41: TypePointer UniformConstant 40 42(g_sSamp): 41(ptr) Variable UniformConstant +43(PerVertex_out): TypeStruct 26(fvec4) + 44: TypePointer Output 43(PerVertex_out) +45(PerVertex_out): 44(ptr) Variable Output 4(main): 2 Function None 3 5: Label 8(sizeQueryTemp): 7(ptr) Variable Function diff --git a/Test/baseResults/hlsl.load.basic.dx10.vert.out b/Test/baseResults/hlsl.load.basic.dx10.vert.out index 7441d49e..a3e45e4f 100644 --- a/Test/baseResults/hlsl.load.basic.dx10.vert.out +++ b/Test/baseResults/hlsl.load.basic.dx10.vert.out @@ -218,7 +218,7 @@ Shader version: 450 0:? 'g_tTexcdi4a' (uniform itextureCubeArray) 0:? 'g_tTexcdu4a' (uniform utextureCubeArray) 0:? 'anon@0' (layout(row_major std140 ) uniform block{layout(offset=0 ) uniform int c1, layout(offset=8 ) uniform 2-component vector of int c2, layout(offset=16 ) uniform 3-component vector of int c3, layout(offset=32 ) uniform 4-component vector of int c4, layout(offset=48 ) uniform int o1, layout(offset=56 ) uniform 2-component vector of int o2, layout(offset=64 ) uniform 3-component vector of int o3, layout(offset=80 ) uniform 4-component vector of int o4}) -0:? 'Pos' (out 4-component vector of float Position) +0:? 'PerVertex_out' (out block{out 4-component vector of float Position Pos}) Linked vertex stage: @@ -443,18 +443,18 @@ Shader version: 450 0:? 'g_tTexcdi4a' (uniform itextureCubeArray) 0:? 'g_tTexcdu4a' (uniform utextureCubeArray) 0:? 'anon@0' (layout(row_major std140 ) uniform block{layout(offset=0 ) uniform int c1, layout(offset=8 ) uniform 2-component vector of int c2, layout(offset=16 ) uniform 3-component vector of int c3, layout(offset=32 ) uniform 4-component vector of int c4, layout(offset=48 ) uniform int o1, layout(offset=56 ) uniform 2-component vector of int o2, layout(offset=64 ) uniform 3-component vector of int o3, layout(offset=80 ) uniform 4-component vector of int o4}) -0:? 'Pos' (out 4-component vector of float Position) +0:? 'PerVertex_out' (out block{out 4-component vector of float Position Pos}) // Module Version 10000 // Generated by (magic number): 80001 -// Id's are bound by 166 +// Id's are bound by 169 Capability Shader Capability Sampled1D Capability SampledCubeArray 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint Vertex 4 "main" 123 + EntryPoint Vertex 4 "main" 123 168 Name 4 "main" Name 9 "g_tTex1df4" Name 15 "$Global" @@ -492,6 +492,9 @@ Shader version: 450 Name 159 "g_tTexcdf4a" Name 162 "g_tTexcdi4a" Name 165 "g_tTexcdu4a" + Name 166 "PerVertex_out" + MemberName 166(PerVertex_out) 0 "Pos" + Name 168 "PerVertex_out" Decorate 9(g_tTex1df4) DescriptorSet 0 Decorate 9(g_tTex1df4) Binding 0 MemberDecorate 15($Global) 0 Offset 0 @@ -527,6 +530,8 @@ Shader version: 450 Decorate 159(g_tTexcdf4a) DescriptorSet 0 Decorate 162(g_tTexcdi4a) DescriptorSet 0 Decorate 165(g_tTexcdu4a) DescriptorSet 0 + MemberDecorate 166(PerVertex_out) 0 BuiltIn Position + Decorate 166(PerVertex_out) Block 2: TypeVoid 3: TypeFunction 2 6: TypeFloat 32 @@ -624,6 +629,9 @@ Shader version: 450 163: TypeImage 19(int) Cube array sampled format:Unknown 164: TypePointer UniformConstant 163 165(g_tTexcdu4a): 164(ptr) Variable UniformConstant +166(PerVertex_out): TypeStruct 27(fvec4) + 167: TypePointer Output 166(PerVertex_out) +168(PerVertex_out): 167(ptr) Variable Output 4(main): 2 Function None 3 5: Label 116(vsout): 115(ptr) Variable Function diff --git a/Test/baseResults/hlsl.samplegrad.basic.dx10.vert.out b/Test/baseResults/hlsl.samplegrad.basic.dx10.vert.out index d7ea3862..1f438cee 100644 --- a/Test/baseResults/hlsl.samplegrad.basic.dx10.vert.out +++ b/Test/baseResults/hlsl.samplegrad.basic.dx10.vert.out @@ -239,7 +239,7 @@ Shader version: 450 0:? 'g_tTexcdf4' (uniform textureCube) 0:? 'g_tTexcdi4' (uniform itextureCube) 0:? 'g_tTexcdu4' (uniform utextureCube) -0:? 'Pos' (out 4-component vector of float Position) +0:? 'PerVertex_out' (out block{out 4-component vector of float Position Pos}) Linked vertex stage: @@ -485,17 +485,17 @@ Shader version: 450 0:? 'g_tTexcdf4' (uniform textureCube) 0:? 'g_tTexcdi4' (uniform itextureCube) 0:? 'g_tTexcdu4' (uniform utextureCube) -0:? 'Pos' (out 4-component vector of float Position) +0:? 'PerVertex_out' (out block{out 4-component vector of float Position Pos}) // Module Version 10000 // Generated by (magic number): 80001 -// Id's are bound by 161 +// Id's are bound by 164 Capability Shader Capability Sampled1D 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint Vertex 4 "main" 156 + EntryPoint Vertex 4 "main" 156 163 Name 4 "main" Name 9 "txval10" Name 12 "g_tTex1df4" @@ -527,6 +527,9 @@ Shader version: 450 Name 150 "vsout" Name 156 "Pos" Name 160 "g_tTex1df4a" + Name 161 "PerVertex_out" + MemberName 161(PerVertex_out) 0 "Pos" + Name 163 "PerVertex_out" Decorate 12(g_tTex1df4) DescriptorSet 0 Decorate 12(g_tTex1df4) Binding 0 Decorate 16(g_sSamp) DescriptorSet 0 @@ -545,6 +548,8 @@ Shader version: 450 Decorate 156(Pos) BuiltIn Position Decorate 160(g_tTex1df4a) DescriptorSet 0 Decorate 160(g_tTex1df4a) Binding 1 + MemberDecorate 161(PerVertex_out) 0 BuiltIn Position + Decorate 161(PerVertex_out) Block 2: TypeVoid 3: TypeFunction 2 6: TypeFloat 32 @@ -637,6 +642,9 @@ Shader version: 450 155: TypePointer Output 7(fvec4) 156(Pos): 155(ptr) Variable Output 160(g_tTex1df4a): 11(ptr) Variable UniformConstant +161(PerVertex_out): TypeStruct 7(fvec4) + 162: TypePointer Output 161(PerVertex_out) +163(PerVertex_out): 162(ptr) Variable Output 4(main): 2 Function None 3 5: Label 9(txval10): 8(ptr) Variable Function diff --git a/Test/baseResults/hlsl.samplelevel.basic.dx10.vert.out b/Test/baseResults/hlsl.samplelevel.basic.dx10.vert.out index 35a9ede2..a811ed25 100644 --- a/Test/baseResults/hlsl.samplelevel.basic.dx10.vert.out +++ b/Test/baseResults/hlsl.samplelevel.basic.dx10.vert.out @@ -185,7 +185,7 @@ Shader version: 450 0:? 'g_tTexcdf4' (uniform textureCube) 0:? 'g_tTexcdi4' (uniform itextureCube) 0:? 'g_tTexcdu4' (uniform utextureCube) -0:? 'Pos' (out 4-component vector of float Position) +0:? 'PerVertex_out' (out block{out 4-component vector of float Position Pos}) Linked vertex stage: @@ -377,17 +377,17 @@ Shader version: 450 0:? 'g_tTexcdf4' (uniform textureCube) 0:? 'g_tTexcdi4' (uniform itextureCube) 0:? 'g_tTexcdu4' (uniform utextureCube) -0:? 'Pos' (out 4-component vector of float Position) +0:? 'PerVertex_out' (out block{out 4-component vector of float Position Pos}) // Module Version 10000 // Generated by (magic number): 80001 -// Id's are bound by 157 +// Id's are bound by 160 Capability Shader Capability Sampled1D 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint Vertex 4 "main" 152 + EntryPoint Vertex 4 "main" 152 159 Name 4 "main" Name 9 "txval10" Name 12 "g_tTex1df4" @@ -419,6 +419,9 @@ Shader version: 450 Name 146 "vsout" Name 152 "Pos" Name 156 "g_tTex1df4a" + Name 157 "PerVertex_out" + MemberName 157(PerVertex_out) 0 "Pos" + Name 159 "PerVertex_out" Decorate 12(g_tTex1df4) DescriptorSet 0 Decorate 12(g_tTex1df4) Binding 0 Decorate 16(g_sSamp) DescriptorSet 0 @@ -437,6 +440,8 @@ Shader version: 450 Decorate 152(Pos) BuiltIn Position Decorate 156(g_tTex1df4a) DescriptorSet 0 Decorate 156(g_tTex1df4a) Binding 1 + MemberDecorate 157(PerVertex_out) 0 BuiltIn Position + Decorate 157(PerVertex_out) Block 2: TypeVoid 3: TypeFunction 2 6: TypeFloat 32 @@ -525,6 +530,9 @@ Shader version: 450 151: TypePointer Output 7(fvec4) 152(Pos): 151(ptr) Variable Output 156(g_tTex1df4a): 11(ptr) Variable UniformConstant +157(PerVertex_out): TypeStruct 7(fvec4) + 158: TypePointer Output 157(PerVertex_out) +159(PerVertex_out): 158(ptr) Variable Output 4(main): 2 Function None 3 5: Label 9(txval10): 8(ptr) Variable Function diff --git a/Test/baseResults/hlsl.struct.frag.out b/Test/baseResults/hlsl.struct.frag.out index e2b2f728..3c94ffae 100755 --- a/Test/baseResults/hlsl.struct.frag.out +++ b/Test/baseResults/hlsl.struct.frag.out @@ -9,7 +9,7 @@ gl_FragCoord origin is upper left 0:34 Function Definition: PixelShaderFunction(vf4;struct-IN_S-vf4-b1-vf1-vf2-b1-b1-b1-vf41; (temp 4-component vector of float) 0:34 Function Parameters: 0:34 'input' (layout(location=0 ) in 4-component vector of float) -0:34 's' (layout(location=1 ) in structure{smooth temp 4-component vector of float a, flat temp bool b, centroid noperspective temp 1-component vector of float c, centroid sample temp 2-component vector of float d, temp bool Face ff1, layout(offset=4 ) temp bool ff2, layout(binding=0 offset=4 ) temp bool ff3, layout(binding=0 offset=4 ) temp 4-component vector of float ff4}) +0:34 's' (in structure{smooth temp 4-component vector of float a, flat temp bool b, centroid noperspective temp 1-component vector of float c, centroid sample temp 2-component vector of float d, temp bool Face ff1, layout(offset=4 ) temp bool ff2, layout(binding=0 offset=4 ) temp bool ff3, layout(binding=0 offset=4 ) temp 4-component vector of float ff4}) 0:? Sequence 0:39 Compare Equal (temp bool) 0:39 's3' (temp structure{temp 3-component vector of bool b3}) @@ -20,9 +20,9 @@ gl_FragCoord origin is upper left 0:40 Constant: 0:40 0 (const int) 0:40 ff4: direct index for structure (layout(binding=0 offset=4 ) temp 4-component vector of float) -0:40 's' (layout(location=1 ) in structure{smooth temp 4-component vector of float a, flat temp bool b, centroid noperspective temp 1-component vector of float c, centroid sample temp 2-component vector of float d, temp bool Face ff1, layout(offset=4 ) temp bool ff2, layout(binding=0 offset=4 ) temp bool ff3, layout(binding=0 offset=4 ) temp 4-component vector of float ff4}) +0:40 's' (layout(location=1 ) in structure{smooth temp 4-component vector of float a, flat temp bool b, centroid noperspective temp 1-component vector of float c, centroid sample temp 2-component vector of float d, layout(offset=4 ) temp bool ff2, layout(binding=0 offset=4 ) temp bool ff3, layout(binding=0 offset=4 ) temp 4-component vector of float ff4}) 0:40 Constant: -0:40 7 (const int) +0:40 6 (const int) 0:42 Sequence 0:42 move second child to first child (temp 4-component vector of float) 0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of float) @@ -31,9 +31,10 @@ gl_FragCoord origin is upper left 0:? Linker Objects 0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of float) 0:? 'input' (layout(location=0 ) in 4-component vector of float) -0:? 's' (layout(location=1 ) in structure{smooth temp 4-component vector of float a, flat temp bool b, centroid noperspective temp 1-component vector of float c, centroid sample temp 2-component vector of float d, temp bool Face ff1, layout(offset=4 ) temp bool ff2, layout(binding=0 offset=4 ) temp bool ff3, layout(binding=0 offset=4 ) temp 4-component vector of float ff4}) +0:? 's' (layout(location=1 ) in structure{smooth temp 4-component vector of float a, flat temp bool b, centroid noperspective temp 1-component vector of float c, centroid sample temp 2-component vector of float d, layout(offset=4 ) temp bool ff2, layout(binding=0 offset=4 ) temp bool ff3, layout(binding=0 offset=4 ) temp 4-component vector of float ff4}) 0:? 's2' (global structure{temp 4-component vector of float i}) 0:? 'anon@0' (layout(row_major std140 ) uniform block{layout(offset=0 ) uniform structure{temp bool b, temp bool c, temp 4-component vector of float a, temp 4-component vector of float d} s1, layout(binding=5 offset=1620 ) uniform float ff5, layout(binding=8 offset=1636 ) uniform float ff6}) +0:? 's_ff1' (in bool Face) Linked fragment stage: @@ -45,7 +46,7 @@ gl_FragCoord origin is upper left 0:34 Function Definition: PixelShaderFunction(vf4;struct-IN_S-vf4-b1-vf1-vf2-b1-b1-b1-vf41; (temp 4-component vector of float) 0:34 Function Parameters: 0:34 'input' (layout(location=0 ) in 4-component vector of float) -0:34 's' (layout(location=1 ) in structure{smooth temp 4-component vector of float a, flat temp bool b, centroid noperspective temp 1-component vector of float c, centroid sample temp 2-component vector of float d, temp bool Face ff1, layout(offset=4 ) temp bool ff2, layout(binding=0 offset=4 ) temp bool ff3, layout(binding=0 offset=4 ) temp 4-component vector of float ff4}) +0:34 's' (in structure{smooth temp 4-component vector of float a, flat temp bool b, centroid noperspective temp 1-component vector of float c, centroid sample temp 2-component vector of float d, temp bool Face ff1, layout(offset=4 ) temp bool ff2, layout(binding=0 offset=4 ) temp bool ff3, layout(binding=0 offset=4 ) temp 4-component vector of float ff4}) 0:? Sequence 0:39 Compare Equal (temp bool) 0:39 's3' (temp structure{temp 3-component vector of bool b3}) @@ -56,9 +57,9 @@ gl_FragCoord origin is upper left 0:40 Constant: 0:40 0 (const int) 0:40 ff4: direct index for structure (layout(binding=0 offset=4 ) temp 4-component vector of float) -0:40 's' (layout(location=1 ) in structure{smooth temp 4-component vector of float a, flat temp bool b, centroid noperspective temp 1-component vector of float c, centroid sample temp 2-component vector of float d, temp bool Face ff1, layout(offset=4 ) temp bool ff2, layout(binding=0 offset=4 ) temp bool ff3, layout(binding=0 offset=4 ) temp 4-component vector of float ff4}) +0:40 's' (layout(location=1 ) in structure{smooth temp 4-component vector of float a, flat temp bool b, centroid noperspective temp 1-component vector of float c, centroid sample temp 2-component vector of float d, layout(offset=4 ) temp bool ff2, layout(binding=0 offset=4 ) temp bool ff3, layout(binding=0 offset=4 ) temp 4-component vector of float ff4}) 0:40 Constant: -0:40 7 (const int) +0:40 6 (const int) 0:42 Sequence 0:42 move second child to first child (temp 4-component vector of float) 0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of float) @@ -67,18 +68,19 @@ gl_FragCoord origin is upper left 0:? Linker Objects 0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of float) 0:? 'input' (layout(location=0 ) in 4-component vector of float) -0:? 's' (layout(location=1 ) in structure{smooth temp 4-component vector of float a, flat temp bool b, centroid noperspective temp 1-component vector of float c, centroid sample temp 2-component vector of float d, temp bool Face ff1, layout(offset=4 ) temp bool ff2, layout(binding=0 offset=4 ) temp bool ff3, layout(binding=0 offset=4 ) temp 4-component vector of float ff4}) +0:? 's' (layout(location=1 ) in structure{smooth temp 4-component vector of float a, flat temp bool b, centroid noperspective temp 1-component vector of float c, centroid sample temp 2-component vector of float d, layout(offset=4 ) temp bool ff2, layout(binding=0 offset=4 ) temp bool ff3, layout(binding=0 offset=4 ) temp 4-component vector of float ff4}) 0:? 's2' (global structure{temp 4-component vector of float i}) 0:? 'anon@0' (layout(row_major std140 ) uniform block{layout(offset=0 ) uniform structure{temp bool b, temp bool c, temp 4-component vector of float a, temp 4-component vector of float d} s1, layout(binding=5 offset=1620 ) uniform float ff5, layout(binding=8 offset=1636 ) uniform float ff6}) +0:? 's_ff1' (in bool Face) // Module Version 10000 // Generated by (magic number): 80001 -// Id's are bound by 44 +// Id's are bound by 46 Capability Shader 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint Fragment 4 "PixelShaderFunction" 27 35 36 + EntryPoint Fragment 4 "PixelShaderFunction" 27 35 36 45 ExecutionMode 4 OriginUpperLeft Name 4 "PixelShaderFunction" Name 8 "FS" @@ -92,10 +94,9 @@ gl_FragCoord origin is upper left MemberName 25(IN_S) 1 "b" MemberName 25(IN_S) 2 "c" MemberName 25(IN_S) 3 "d" - MemberName 25(IN_S) 4 "ff1" - MemberName 25(IN_S) 5 "ff2" - MemberName 25(IN_S) 6 "ff3" - MemberName 25(IN_S) 7 "ff4" + MemberName 25(IN_S) 4 "ff2" + MemberName 25(IN_S) 5 "ff3" + MemberName 25(IN_S) 6 "ff4" Name 27 "s" Name 35 "@entryPointOutput" Name 36 "input" @@ -109,7 +110,7 @@ gl_FragCoord origin is upper left MemberName 41($Global) 1 "ff5" MemberName 41($Global) 2 "ff6" Name 43 "" - MemberDecorate 25(IN_S) 4 BuiltIn FrontFacing + Name 45 "s_ff1" Decorate 27(s) Location 1 Decorate 35(@entryPointOutput) Location 0 Decorate 36(input) Location 0 @@ -122,6 +123,7 @@ gl_FragCoord origin is upper left MemberDecorate 41($Global) 2 Offset 1636 Decorate 41($Global) Block Decorate 43 DescriptorSet 0 + Decorate 45(s_ff1) BuiltIn FrontFacing 2: TypeVoid 3: TypeFunction 2 6: TypeBool @@ -136,10 +138,10 @@ gl_FragCoord origin is upper left 22: TypeInt 32 1 23: 22(int) Constant 0 24: TypeVector 17(float) 2 - 25(IN_S): TypeStruct 18(fvec4) 6(bool) 17(float) 24(fvec2) 6(bool) 6(bool) 6(bool) 18(fvec4) + 25(IN_S): TypeStruct 18(fvec4) 6(bool) 17(float) 24(fvec2) 6(bool) 6(bool) 18(fvec4) 26: TypePointer Input 25(IN_S) 27(s): 26(ptr) Variable Input - 28: 22(int) Constant 7 + 28: 22(int) Constant 6 29: TypePointer Input 18(fvec4) 32: TypePointer Private 18(fvec4) 34: TypePointer Output 18(fvec4) @@ -150,6 +152,8 @@ gl_FragCoord origin is upper left 41($Global): TypeStruct 40(myS) 17(float) 17(float) 42: TypePointer Uniform 41($Global) 43: 42(ptr) Variable Uniform + 44: TypePointer Input 6(bool) + 45(s_ff1): 44(ptr) Variable Input 4(PixelShaderFunction): 2 Function None 3 5: Label 10(s3): 9(ptr) Variable Function diff --git a/Test/baseResults/hlsl.struct.split-1.vert.out b/Test/baseResults/hlsl.struct.split-1.vert.out index 62431ac3..a1c0c0c8 100644 --- a/Test/baseResults/hlsl.struct.split-1.vert.out +++ b/Test/baseResults/hlsl.struct.split-1.vert.out @@ -59,7 +59,7 @@ Shader version: 450 0:? 'Pos_in' (in 4-component vector of float Position) 0:? 'x1_in' (layout(location=1 ) in int) 0:? 'Pos_loose' (in 4-component vector of float Position) -0:? 'Pos_out' (out 4-component vector of float Position) +0:? 'PerVertex_out' (out block{out 4-component vector of float Position Pos_out}) Linked vertex stage: @@ -125,16 +125,16 @@ Shader version: 450 0:? 'Pos_in' (in 4-component vector of float Position) 0:? 'x1_in' (layout(location=1 ) in int) 0:? 'Pos_loose' (in 4-component vector of float Position) -0:? 'Pos_out' (out 4-component vector of float Position) +0:? 'PerVertex_out' (out block{out 4-component vector of float Position Pos_out}) // Module Version 10000 // Generated by (magic number): 80001 -// Id's are bound by 46 +// Id's are bound by 49 Capability Shader 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint Vertex 4 "main" 14 20 22 28 33 39 + EntryPoint Vertex 4 "main" 14 20 22 28 33 39 48 Name 4 "main" Name 9 "VS_OUTPUT" MemberName 9(VS_OUTPUT) 0 "x0_out" @@ -150,12 +150,17 @@ Shader version: 450 MemberName 31(VS_OUTPUT) 1 "x1_out" Name 33 "@entryPointOutput" Name 39 "Pos_out" + Name 46 "PerVertex_out" + MemberName 46(PerVertex_out) 0 "Pos_out" + Name 48 "PerVertex_out" Decorate 14(x0_in) Location 0 Decorate 20(Pos_in) BuiltIn Position Decorate 22(Pos_loose) BuiltIn Position Decorate 28(x1_in) Location 1 Decorate 33(@entryPointOutput) Location 0 Decorate 39(Pos_out) BuiltIn Position + MemberDecorate 46(PerVertex_out) 0 BuiltIn Position + Decorate 46(PerVertex_out) Block 2: TypeVoid 3: TypeFunction 2 6: TypeInt 32 1 @@ -180,6 +185,9 @@ Shader version: 450 36: TypePointer Output 6(int) 38: TypePointer Output 8(fvec4) 39(Pos_out): 38(ptr) Variable Output +46(PerVertex_out): TypeStruct 8(fvec4) + 47: TypePointer Output 46(PerVertex_out) +48(PerVertex_out): 47(ptr) Variable Output 4(main): 2 Function None 3 5: Label 11(vsout): 10(ptr) Variable Function diff --git a/Test/baseResults/hlsl.struct.split.array.geom.out b/Test/baseResults/hlsl.struct.split.array.geom.out index e8921b68..bc5b00d1 100644 --- a/Test/baseResults/hlsl.struct.split.array.geom.out +++ b/Test/baseResults/hlsl.struct.split.array.geom.out @@ -64,7 +64,7 @@ output primitive = triangle_strip 0:? Linker Objects 0:? 'v' (layout(location=0 ) in 1-element array of uint) 0:? 'OutputStream' (layout(location=0 ) out structure{temp 2-component vector of float TexCoord, temp 3-component vector of float TerrainPos, temp uint VertexID}) -0:? 'OutputStream.Pos' (out 4-component vector of float Position) +0:? 'PerVertex_out' (out block{out 4-component vector of float Position OutputStream_Pos}) Linked geometry stage: @@ -135,16 +135,16 @@ output primitive = triangle_strip 0:? Linker Objects 0:? 'v' (layout(location=0 ) in 1-element array of uint) 0:? 'OutputStream' (layout(location=0 ) out structure{temp 2-component vector of float TexCoord, temp 3-component vector of float TerrainPos, temp uint VertexID}) -0:? 'OutputStream.Pos' (out 4-component vector of float Position) +0:? 'PerVertex_out' (out block{out 4-component vector of float Position OutputStream_Pos}) // Module Version 10000 // Generated by (magic number): 80001 -// Id's are bound by 89 +// Id's are bound by 90 Capability Geometry 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint Geometry 4 "main" 83 86 88 + EntryPoint Geometry 4 "main" 83 86 89 ExecutionMode 4 InputPoints ExecutionMode 4 Invocations 1 ExecutionMode 4 OutputTriangleStrip @@ -175,11 +175,14 @@ output primitive = triangle_strip MemberName 84(PSInput) 1 "TerrainPos" MemberName 84(PSInput) 2 "VertexID" Name 86 "OutputStream" - Name 88 "OutputStream.Pos" + Name 87 "PerVertex_out" + MemberName 87(PerVertex_out) 0 "OutputStream_Pos" + Name 89 "PerVertex_out" MemberDecorate 14(PSInput) 0 BuiltIn Position Decorate 83(v) Location 0 Decorate 86(OutputStream) Location 0 - Decorate 88(OutputStream.Pos) BuiltIn Position + MemberDecorate 87(PerVertex_out) 0 BuiltIn Position + Decorate 87(PerVertex_out) Block 2: TypeVoid 3: TypeFunction 2 6: TypeFloat 32 @@ -221,8 +224,9 @@ output primitive = triangle_strip 84(PSInput): TypeStruct 8(fvec2) 9(fvec3) 10(int) 85: TypePointer Output 84(PSInput) 86(OutputStream): 85(ptr) Variable Output - 87: TypePointer Output 7(fvec4) -88(OutputStream.Pos): 87(ptr) Variable Output +87(PerVertex_out): TypeStruct 7(fvec4) + 88: TypePointer Output 87(PerVertex_out) +89(PerVertex_out): 88(ptr) Variable Output 4(main): 2 Function None 3 5: Label 13(Out): 12(ptr) Variable Function diff --git a/Test/baseResults/hlsl.struct.split.call.vert.out b/Test/baseResults/hlsl.struct.split.call.vert.out index d7a19e44..40245f44 100644 --- a/Test/baseResults/hlsl.struct.split.call.vert.out +++ b/Test/baseResults/hlsl.struct.split.call.vert.out @@ -92,7 +92,7 @@ Shader version: 450 0:? 'x0_in' (layout(location=0 ) in int) 0:? 'Pos_in' (in 4-component vector of float Position) 0:? 'x1_in' (layout(location=1 ) in int) -0:? 'Pos_out' (out 4-component vector of float Position) +0:? 'PerVertex_out' (out block{out 4-component vector of float Position Pos_out}) Linked vertex stage: @@ -191,16 +191,16 @@ Shader version: 450 0:? 'x0_in' (layout(location=0 ) in int) 0:? 'Pos_in' (in 4-component vector of float Position) 0:? 'x1_in' (layout(location=1 ) in int) -0:? 'Pos_out' (out 4-component vector of float Position) +0:? 'PerVertex_out' (out block{out 4-component vector of float Position Pos_out}) // Module Version 10000 // Generated by (magic number): 80001 -// Id's are bound by 69 +// Id's are bound by 72 Capability Shader 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint Vertex 4 "main" 28 33 37 56 62 + EntryPoint Vertex 4 "main" 28 33 37 56 62 71 Name 4 "main" Name 9 "VS_INPUT" MemberName 9(VS_INPUT) 0 "x0_in" @@ -229,11 +229,16 @@ Shader version: 450 MemberName 54(VS_OUTPUT) 1 "x1_out" Name 56 "@entryPointOutput" Name 62 "Pos_out" + Name 69 "PerVertex_out" + MemberName 69(PerVertex_out) 0 "Pos_out" + Name 71 "PerVertex_out" Decorate 28(x0_in) Location 0 Decorate 33(Pos_in) BuiltIn Position Decorate 37(x1_in) Location 1 Decorate 56(@entryPointOutput) Location 0 Decorate 62(Pos_out) BuiltIn Position + MemberDecorate 69(PerVertex_out) 0 BuiltIn Position + Decorate 69(PerVertex_out) Block 2: TypeVoid 3: TypeFunction 2 6: TypeInt 32 1 @@ -262,6 +267,9 @@ Shader version: 450 59: TypePointer Output 6(int) 61: TypePointer Output 8(fvec4) 62(Pos_out): 61(ptr) Variable Output +69(PerVertex_out): TypeStruct 8(fvec4) + 70: TypePointer Output 69(PerVertex_out) +71(PerVertex_out): 70(ptr) Variable Output 4(main): 2 Function None 3 5: Label 25(vsout): 12(ptr) Variable Function diff --git a/Test/baseResults/hlsl.struct.split.nested.geom.out b/Test/baseResults/hlsl.struct.split.nested.geom.out index 3dd8d9f8..a1db67d9 100644 --- a/Test/baseResults/hlsl.struct.split.nested.geom.out +++ b/Test/baseResults/hlsl.struct.split.nested.geom.out @@ -37,7 +37,7 @@ output primitive = triangle_strip 0:30 Sequence 0:30 Sequence 0:30 move second child to first child (temp 4-component vector of float) -0:? 'ts.psIn.pos' (out 4-component vector of float Position) +0:? 'ts_psIn_pos' (out 4-component vector of float Position) 0:30 pos: direct index for structure (temp 4-component vector of float) 0:30 psIn: direct index for structure (temp structure{temp 4-component vector of float pos, temp 2-component vector of float tc}) 0:30 'o' (temp structure{temp structure{temp 4-component vector of float pos, temp 2-component vector of float tc} psIn, temp structure{temp 2-element array of float m0_array, temp int m1} contains_no_builtin_io}) @@ -73,8 +73,8 @@ output primitive = triangle_strip 0:? Linker Objects 0:? 'tin' (layout(location=0 ) in 3-element array of structure{temp 2-component vector of float tc}) 0:? 'ts' (layout(location=0 ) out structure{temp structure{temp 2-component vector of float tc} psIn, temp structure{temp 2-element array of float m0_array, temp int m1} contains_no_builtin_io}) -0:? 'tin.pos' (in 3-element array of 4-component vector of float Position) -0:? 'ts.psIn.pos' (out 4-component vector of float Position) +0:? 'PerVertex_in' (in 3-element array of block{in 4-component vector of float Position tin_pos}) +0:? 'PerVertex_out' (out block{out 4-component vector of float Position ts_psIn_pos}) Linked geometry stage: @@ -118,7 +118,7 @@ output primitive = triangle_strip 0:30 Sequence 0:30 Sequence 0:30 move second child to first child (temp 4-component vector of float) -0:? 'ts.psIn.pos' (out 4-component vector of float Position) +0:? 'ts_psIn_pos' (out 4-component vector of float Position) 0:30 pos: direct index for structure (temp 4-component vector of float) 0:30 psIn: direct index for structure (temp structure{temp 4-component vector of float pos, temp 2-component vector of float tc}) 0:30 'o' (temp structure{temp structure{temp 4-component vector of float pos, temp 2-component vector of float tc} psIn, temp structure{temp 2-element array of float m0_array, temp int m1} contains_no_builtin_io}) @@ -154,17 +154,17 @@ output primitive = triangle_strip 0:? Linker Objects 0:? 'tin' (layout(location=0 ) in 3-element array of structure{temp 2-component vector of float tc}) 0:? 'ts' (layout(location=0 ) out structure{temp structure{temp 2-component vector of float tc} psIn, temp structure{temp 2-element array of float m0_array, temp int m1} contains_no_builtin_io}) -0:? 'tin.pos' (in 3-element array of 4-component vector of float Position) -0:? 'ts.psIn.pos' (out 4-component vector of float Position) +0:? 'PerVertex_in' (in 3-element array of block{in 4-component vector of float Position tin_pos}) +0:? 'PerVertex_out' (out block{out 4-component vector of float Position ts_psIn_pos}) // Module Version 10000 // Generated by (magic number): 80001 -// Id's are bound by 64 +// Id's are bound by 68 Capability Geometry 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint Geometry 4 "main" 33 40 60 63 + EntryPoint Geometry 4 "main" 33 40 60 64 67 ExecutionMode 4 Triangles ExecutionMode 4 Invocations 1 ExecutionMode 4 OutputTriangleStrip @@ -180,7 +180,7 @@ output primitive = triangle_strip MemberName 15(GS_OUT) 0 "psIn" MemberName 15(GS_OUT) 1 "contains_no_builtin_io" Name 17 "o" - Name 33 "ts.psIn.pos" + Name 33 "ts_psIn_pos" Name 36 "PS_IN" MemberName 36(PS_IN) 0 "tc" Name 37 "STRUCT_WITH_NO_BUILTIN_INTERSTAGE_IO" @@ -193,11 +193,19 @@ output primitive = triangle_strip Name 56 "PS_IN" MemberName 56(PS_IN) 0 "tc" Name 60 "tin" - Name 63 "tin.pos" - Decorate 33(ts.psIn.pos) BuiltIn Position + Name 61 "PerVertex_in" + MemberName 61(PerVertex_in) 0 "tin_pos" + Name 64 "PerVertex_in" + Name 65 "PerVertex_out" + MemberName 65(PerVertex_out) 0 "ts_psIn_pos" + Name 67 "PerVertex_out" + Decorate 33(ts_psIn_pos) BuiltIn Position Decorate 40(ts) Location 0 Decorate 60(tin) Location 0 - Decorate 63(tin.pos) BuiltIn Position + MemberDecorate 61(PerVertex_in) 0 BuiltIn Position + Decorate 61(PerVertex_in) Block + MemberDecorate 65(PerVertex_out) 0 BuiltIn Position + Decorate 65(PerVertex_out) Block 2: TypeVoid 3: TypeFunction 2 6: TypeFloat 32 @@ -224,7 +232,7 @@ output primitive = triangle_strip 29: 8(fvec2) ConstantComposite 27 28 30: TypePointer Function 8(fvec2) 32: TypePointer Output 7(fvec4) - 33(ts.psIn.pos): 32(ptr) Variable Output + 33(ts_psIn_pos): 32(ptr) Variable Output 36(PS_IN): TypeStruct 8(fvec2) 37(STRUCT_WITH_NO_BUILTIN_INTERSTAGE_IO): TypeStruct 12 13(int) 38(GS_OUT): TypeStruct 36(PS_IN) 37(STRUCT_WITH_NO_BUILTIN_INTERSTAGE_IO) @@ -240,9 +248,13 @@ output primitive = triangle_strip 58: TypeArray 56(PS_IN) 57 59: TypePointer Input 58 60(tin): 59(ptr) Variable Input - 61: TypeArray 7(fvec4) 57 - 62: TypePointer Input 61 - 63(tin.pos): 62(ptr) Variable Input +61(PerVertex_in): TypeStruct 7(fvec4) + 62: TypeArray 61(PerVertex_in) 57 + 63: TypePointer Input 62 +64(PerVertex_in): 63(ptr) Variable Input +65(PerVertex_out): TypeStruct 7(fvec4) + 66: TypePointer Output 65(PerVertex_out) +67(PerVertex_out): 66(ptr) Variable Output 4(main): 2 Function None 3 5: Label 17(o): 16(ptr) Variable Function @@ -252,7 +264,7 @@ output primitive = triangle_strip Store 31 29 34: 24(ptr) AccessChain 17(o) 18 18 35: 7(fvec4) Load 34 - Store 33(ts.psIn.pos) 35 + Store 33(ts_psIn_pos) 35 41: 30(ptr) AccessChain 17(o) 18 26 42: 8(fvec2) Load 41 44: 43(ptr) AccessChain 40(ts) 18 18 diff --git a/Test/baseResults/hlsl.struct.split.trivial.geom.out b/Test/baseResults/hlsl.struct.split.trivial.geom.out index 8448ac4a..2ab8fdf7 100644 --- a/Test/baseResults/hlsl.struct.split.trivial.geom.out +++ b/Test/baseResults/hlsl.struct.split.trivial.geom.out @@ -29,12 +29,12 @@ output primitive = triangle_strip 0:18 Constant: 0:18 0 (const int) 0:18 indirect index (temp 4-component vector of float Position) -0:18 'i.pos' (in 3-element array of 4-component vector of float Position) +0:18 'i_pos' (in 3-element array of 4-component vector of float Position) 0:18 'x' (temp int) 0:19 Sequence 0:19 Sequence 0:19 move second child to first child (temp 4-component vector of float) -0:? 'ts.pos' (out 4-component vector of float Position) +0:? 'ts_pos' (out 4-component vector of float Position) 0:19 pos: direct index for structure (temp 4-component vector of float) 0:19 'o' (temp structure{temp 4-component vector of float pos}) 0:19 Constant: @@ -44,8 +44,8 @@ output primitive = triangle_strip 0:17 Pre-Increment (temp int) 0:17 'x' (temp int) 0:? Linker Objects -0:? 'i.pos' (in 3-element array of 4-component vector of float Position) -0:? 'ts.pos' (out 4-component vector of float Position) +0:? 'PerVertex_in' (in 3-element array of block{in 4-component vector of float Position i_pos}) +0:? 'PerVertex_out' (out block{out 4-component vector of float Position ts_pos}) Linked geometry stage: @@ -81,12 +81,12 @@ output primitive = triangle_strip 0:18 Constant: 0:18 0 (const int) 0:18 indirect index (temp 4-component vector of float Position) -0:18 'i.pos' (in 3-element array of 4-component vector of float Position) +0:18 'i_pos' (in 3-element array of 4-component vector of float Position) 0:18 'x' (temp int) 0:19 Sequence 0:19 Sequence 0:19 move second child to first child (temp 4-component vector of float) -0:? 'ts.pos' (out 4-component vector of float Position) +0:? 'ts_pos' (out 4-component vector of float Position) 0:19 pos: direct index for structure (temp 4-component vector of float) 0:19 'o' (temp structure{temp 4-component vector of float pos}) 0:19 Constant: @@ -96,17 +96,17 @@ output primitive = triangle_strip 0:17 Pre-Increment (temp int) 0:17 'x' (temp int) 0:? Linker Objects -0:? 'i.pos' (in 3-element array of 4-component vector of float Position) -0:? 'ts.pos' (out 4-component vector of float Position) +0:? 'PerVertex_in' (in 3-element array of block{in 4-component vector of float Position i_pos}) +0:? 'PerVertex_out' (out block{out 4-component vector of float Position ts_pos}) // Module Version 10000 // Generated by (magic number): 80001 -// Id's are bound by 42 +// Id's are bound by 49 Capability Geometry 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint Geometry 4 "main" 28 36 + EntryPoint Geometry 4 "main" 28 36 45 48 ExecutionMode 4 Triangles ExecutionMode 4 Invocations 1 ExecutionMode 4 OutputTriangleStrip @@ -116,10 +116,20 @@ output primitive = triangle_strip Name 21 "GS_OUT" MemberName 21(GS_OUT) 0 "pos" Name 23 "o" - Name 28 "i.pos" - Name 36 "ts.pos" - Decorate 28(i.pos) BuiltIn Position - Decorate 36(ts.pos) BuiltIn Position + Name 28 "i_pos" + Name 36 "ts_pos" + Name 42 "PerVertex_in" + MemberName 42(PerVertex_in) 0 "i_pos" + Name 45 "PerVertex_in" + Name 46 "PerVertex_out" + MemberName 46(PerVertex_out) 0 "ts_pos" + Name 48 "PerVertex_out" + Decorate 28(i_pos) BuiltIn Position + Decorate 36(ts_pos) BuiltIn Position + MemberDecorate 42(PerVertex_in) 0 BuiltIn Position + Decorate 42(PerVertex_in) Block + MemberDecorate 46(PerVertex_out) 0 BuiltIn Position + Decorate 46(PerVertex_out) Block 2: TypeVoid 3: TypeFunction 2 6: TypeInt 32 1 @@ -135,12 +145,19 @@ output primitive = triangle_strip 25: 24(int) Constant 3 26: TypeArray 20(fvec4) 25 27: TypePointer Input 26 - 28(i.pos): 27(ptr) Variable Input + 28(i_pos): 27(ptr) Variable Input 30: TypePointer Input 20(fvec4) 33: TypePointer Function 20(fvec4) 35: TypePointer Output 20(fvec4) - 36(ts.pos): 35(ptr) Variable Output + 36(ts_pos): 35(ptr) Variable Output 40: 6(int) Constant 1 +42(PerVertex_in): TypeStruct 20(fvec4) + 43: TypeArray 42(PerVertex_in) 25 + 44: TypePointer Input 43 +45(PerVertex_in): 44(ptr) Variable Input +46(PerVertex_out): TypeStruct 20(fvec4) + 47: TypePointer Output 46(PerVertex_out) +48(PerVertex_out): 47(ptr) Variable Output 4(main): 2 Function None 3 5: Label 8(x): 7(ptr) Variable Function @@ -156,13 +173,13 @@ output primitive = triangle_strip BranchConditional 18 11 12 11: Label 29: 6(int) Load 8(x) - 31: 30(ptr) AccessChain 28(i.pos) 29 + 31: 30(ptr) AccessChain 28(i_pos) 29 32: 20(fvec4) Load 31 34: 33(ptr) AccessChain 23(o) 9 Store 34 32 37: 33(ptr) AccessChain 23(o) 9 38: 20(fvec4) Load 37 - Store 36(ts.pos) 38 + Store 36(ts_pos) 38 EmitVertex Branch 13 13: Label diff --git a/Test/baseResults/hlsl.struct.split.trivial.vert.out b/Test/baseResults/hlsl.struct.split.trivial.vert.out index bdf156c4..29fb9f50 100644 --- a/Test/baseResults/hlsl.struct.split.trivial.vert.out +++ b/Test/baseResults/hlsl.struct.split.trivial.vert.out @@ -26,7 +26,7 @@ Shader version: 450 0:? Linker Objects 0:? 'Pos_in' (in 4-component vector of float Position) 0:? 'Pos_loose' (in 4-component vector of float Position) -0:? 'Pos' (out 4-component vector of float Position) +0:? 'PerVertex_out' (out block{out 4-component vector of float Position Pos}) Linked vertex stage: @@ -59,16 +59,16 @@ Shader version: 450 0:? Linker Objects 0:? 'Pos_in' (in 4-component vector of float Position) 0:? 'Pos_loose' (in 4-component vector of float Position) -0:? 'Pos' (out 4-component vector of float Position) +0:? 'PerVertex_out' (out block{out 4-component vector of float Position Pos}) // Module Version 10000 // Generated by (magic number): 80001 -// Id's are bound by 26 +// Id's are bound by 29 Capability Shader 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint Vertex 4 "main" 14 16 22 + EntryPoint Vertex 4 "main" 14 16 22 28 Name 4 "main" Name 8 "VS_OUTPUT" MemberName 8(VS_OUTPUT) 0 "Pos" @@ -76,9 +76,14 @@ Shader version: 450 Name 14 "Pos_in" Name 16 "Pos_loose" Name 22 "Pos" + Name 26 "PerVertex_out" + MemberName 26(PerVertex_out) 0 "Pos" + Name 28 "PerVertex_out" Decorate 14(Pos_in) BuiltIn Position Decorate 16(Pos_loose) BuiltIn Position Decorate 22(Pos) BuiltIn Position + MemberDecorate 26(PerVertex_out) 0 BuiltIn Position + Decorate 26(PerVertex_out) Block 2: TypeVoid 3: TypeFunction 2 6: TypeFloat 32 @@ -93,6 +98,9 @@ Shader version: 450 19: TypePointer Function 7(fvec4) 21: TypePointer Output 7(fvec4) 22(Pos): 21(ptr) Variable Output +26(PerVertex_out): TypeStruct 7(fvec4) + 27: TypePointer Output 26(PerVertex_out) +28(PerVertex_out): 27(ptr) Variable Output 4(main): 2 Function None 3 5: Label 10(vsout): 9(ptr) Variable Function diff --git a/Test/baseResults/hlsl.structarray.flatten.geom.out b/Test/baseResults/hlsl.structarray.flatten.geom.out index 0922bae8..626ab8dd 100644 --- a/Test/baseResults/hlsl.structarray.flatten.geom.out +++ b/Test/baseResults/hlsl.structarray.flatten.geom.out @@ -49,7 +49,7 @@ output primitive = triangle_strip 0:22 Sequence 0:22 Sequence 0:22 move second child to first child (temp 4-component vector of float) -0:? 'outStream.position' (out 4-component vector of float Position) +0:? 'outStream_position' (out 4-component vector of float Position) 0:22 position: direct index for structure (temp 4-component vector of float) 0:22 'vout' (temp structure{temp 4-component vector of float position, temp 4-component vector of float color, temp 2-component vector of float uv}) 0:22 Constant: @@ -76,7 +76,7 @@ output primitive = triangle_strip 0:? Linker Objects 0:? 'vin' (layout(location=0 ) in 2-element array of structure{temp 4-component vector of float position, temp 4-component vector of float color, temp 2-component vector of float uv}) 0:? 'outStream' (layout(location=0 ) out structure{temp 4-component vector of float color, temp 2-component vector of float uv}) -0:? 'outStream.position' (out 4-component vector of float Position) +0:? 'PerVertex_out' (out block{out 4-component vector of float Position outStream_position}) Linked geometry stage: @@ -132,7 +132,7 @@ output primitive = triangle_strip 0:22 Sequence 0:22 Sequence 0:22 move second child to first child (temp 4-component vector of float) -0:? 'outStream.position' (out 4-component vector of float Position) +0:? 'outStream_position' (out 4-component vector of float Position) 0:22 position: direct index for structure (temp 4-component vector of float) 0:22 'vout' (temp structure{temp 4-component vector of float position, temp 4-component vector of float color, temp 2-component vector of float uv}) 0:22 Constant: @@ -159,16 +159,16 @@ output primitive = triangle_strip 0:? Linker Objects 0:? 'vin' (layout(location=0 ) in 2-element array of structure{temp 4-component vector of float position, temp 4-component vector of float color, temp 2-component vector of float uv}) 0:? 'outStream' (layout(location=0 ) out structure{temp 4-component vector of float color, temp 2-component vector of float uv}) -0:? 'outStream.position' (out 4-component vector of float Position) +0:? 'PerVertex_out' (out block{out 4-component vector of float Position outStream_position}) // Module Version 10000 // Generated by (magic number): 80001 -// Id's are bound by 49 +// Id's are bound by 52 Capability Geometry 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint Geometry 4 "main" 19 36 41 + EntryPoint Geometry 4 "main" 19 36 41 51 ExecutionMode 4 InputLines ExecutionMode 4 Invocations 1 ExecutionMode 4 OutputTriangleStrip @@ -184,14 +184,19 @@ output primitive = triangle_strip MemberName 14(VertexData) 1 "color" MemberName 14(VertexData) 2 "uv" Name 19 "vin" - Name 36 "outStream.position" + Name 36 "outStream_position" Name 39 "PS_IN" MemberName 39(PS_IN) 0 "color" MemberName 39(PS_IN) 1 "uv" Name 41 "outStream" + Name 49 "PerVertex_out" + MemberName 49(PerVertex_out) 0 "outStream_position" + Name 51 "PerVertex_out" Decorate 19(vin) Location 0 - Decorate 36(outStream.position) BuiltIn Position + Decorate 36(outStream_position) BuiltIn Position Decorate 41(outStream) Location 0 + MemberDecorate 49(PerVertex_out) 0 BuiltIn Position + Decorate 49(PerVertex_out) Block 2: TypeVoid 3: TypeFunction 2 6: TypeFloat 32 @@ -214,11 +219,14 @@ output primitive = triangle_strip 29: TypePointer Function 8(fvec2) 31: 12(int) Constant 0 35: TypePointer Output 7(fvec4) -36(outStream.position): 35(ptr) Variable Output +36(outStream_position): 35(ptr) Variable Output 39(PS_IN): TypeStruct 7(fvec4) 8(fvec2) 40: TypePointer Output 39(PS_IN) 41(outStream): 40(ptr) Variable Output 47: TypePointer Output 8(fvec2) +49(PerVertex_out): TypeStruct 7(fvec4) + 50: TypePointer Output 49(PerVertex_out) +51(PerVertex_out): 50(ptr) Variable Output 4(main): 2 Function None 3 5: Label 11(vout): 10(ptr) Variable Function @@ -236,7 +244,7 @@ output primitive = triangle_strip Store 34 33 37: 23(ptr) AccessChain 11(vout) 31 38: 7(fvec4) Load 37 - Store 36(outStream.position) 38 + Store 36(outStream_position) 38 42: 23(ptr) AccessChain 11(vout) 13 43: 7(fvec4) Load 42 44: 35(ptr) AccessChain 41(outStream) 31 diff --git a/glslang/Include/Types.h b/glslang/Include/Types.h index 684408a8..f5a6e8f7 100644 --- a/glslang/Include/Types.h +++ b/glslang/Include/Types.h @@ -1319,9 +1319,18 @@ public: virtual bool isImage() const { return basicType == EbtSampler && getSampler().isImage(); } virtual bool isSubpass() const { return basicType == EbtSampler && getSampler().isSubpass(); } - // Return true if this is interstage IO - virtual bool isBuiltInInterstageIO() const + virtual bool isBuiltInInterstageIO(EShLanguage language) const { + return isPerVertexAndBuiltIn(language) || isLooseAndBuiltIn(language); + } + + // Return true if this is an interstage IO builtin + virtual bool isPerVertexAndBuiltIn(EShLanguage language) const + { + if (language == EShLangFragment) + return false; + + // Any non-fragment stage switch (getQualifier().builtIn) { case EbvPosition: case EbvPointSize: @@ -1333,6 +1342,15 @@ public: } } + // Return true if this is a loose builtin + virtual bool isLooseAndBuiltIn(EShLanguage language) const + { + if (getQualifier().builtIn == EbvNone) + return false; + + return !isPerVertexAndBuiltIn(language); + } + // Recursively checks if the type contains the given basic type virtual bool containsBasicType(TBasicType checkType) const { @@ -1401,33 +1419,20 @@ public: } // Recursively checks if the type contains an interstage IO builtin - virtual bool containsBuiltInInterstageIO() const + virtual bool containsBuiltInInterstageIO(EShLanguage language) const { - if (isBuiltInInterstageIO()) + if (isBuiltInInterstageIO(language)) return true; if (! structure) return false; for (unsigned int i = 0; i < structure->size(); ++i) { - if ((*structure)[i].type->containsBuiltInInterstageIO()) + if ((*structure)[i].type->containsBuiltInInterstageIO(language)) return true; } return false; } - // Recursively checks whether a struct contains only interstage IO - virtual bool containsOnlyBuiltInInterstageIO() const - { - if (! structure) - return isBuiltInInterstageIO(); - - for (unsigned int i = 0; i < structure->size(); ++i) { - if (!(*structure)[i].type->containsOnlyBuiltInInterstageIO()) - return false; - } - return true; - } - virtual bool containsNonOpaque() const { // list all non-opaque types diff --git a/hlsl/hlslParseHelper.cpp b/hlsl/hlslParseHelper.cpp index fbb91cfc..8300140c 100755 --- a/hlsl/hlslParseHelper.cpp +++ b/hlsl/hlslParseHelper.cpp @@ -933,7 +933,7 @@ bool HlslParseContext::shouldSplit(const TType& type) const TStorageQualifier qualifier = type.getQualifier().storage; // If it contains interstage IO, but not ONLY interstage IO, split the struct. - return type.isStruct() && type.containsBuiltInInterstageIO() && + return type.isStruct() && type.containsBuiltInInterstageIO(language) && (qualifier == EvqVaryingIn || qualifier == EvqVaryingOut); } @@ -990,13 +990,13 @@ TType& HlslParseContext::split(TType& type, TString name, const TType* outerStru // Get iterator to (now at end) set of builtin iterstage IO members const auto firstIo = std::stable_partition(userStructure->begin(), userStructure->end(), - [](const TTypeLoc& t) {return !t.type->isBuiltInInterstageIO();}); + [this](const TTypeLoc& t) {return !t.type->isBuiltInInterstageIO(language);}); // Move those to the builtin IO. However, we also propagate arrayness (just one level is handled // now) to this variable. for (auto ioType = firstIo; ioType != userStructure->end(); ++ioType) { const TType& memberType = *ioType->type; - TVariable* ioVar = makeInternalVariable(name + (name.empty() ? "" : ".") + memberType.getFieldName(), memberType); + TVariable* ioVar = makeInternalVariable(name + (name.empty() ? "" : "_") + memberType.getFieldName(), memberType); if (arraySizes) ioVar->getWritableType().newArraySizes(*arraySizes); @@ -1013,7 +1013,7 @@ TType& HlslParseContext::split(TType& type, TString name, const TType* outerStru // Recurse further into the members. for (unsigned int i = 0; i < userStructure->size(); ++i) split(*(*userStructure)[i].type, - name + (name.empty() ? "" : ".") + (*userStructure)[i].type->getFieldName(), + name + (name.empty() ? "" : "_") + (*userStructure)[i].type->getFieldName(), outerStructType); } @@ -1320,7 +1320,7 @@ TIntermTyped* HlslParseContext::splitAccessStruct(const TSourceLoc& loc, TInterm const TType& memberType = *members[member].type; - if (memberType.isBuiltInInterstageIO()) { + if (memberType.isBuiltInInterstageIO(language)) { // It's one of the interstage IO variables we split off. TIntermTyped* builtIn = intermediate.addSymbol(*interstageBuiltInIo[tInterstageIoData(memberType, base->getType())], loc); @@ -1344,7 +1344,7 @@ TIntermTyped* HlslParseContext::splitAccessStruct(const TSourceLoc& loc, TInterm int newMember = 0; for (int m=0; misBuiltInInterstageIO()) + if (!members[m].type->isBuiltInInterstageIO(language)) ++newMember; member = newMember; @@ -1437,6 +1437,9 @@ TFunction& HlslParseContext::handleFunctionDeclarator(const TSourceLoc& loc, TFu // Add interstage IO variables to the linkage in canonical order. void HlslParseContext::addInterstageIoToLinkage() { + TSourceLoc loc; + loc.init(); + std::vector io; io.reserve(interstageBuiltInIo.size()); @@ -1446,8 +1449,75 @@ void HlslParseContext::addInterstageIoToLinkage() // Our canonical order is the TBuiltInVariable numeric order. std::sort(io.begin(), io.end()); - for (int idx = 0; idx < int(io.size()); ++idx) - trackLinkageDeferred(*interstageBuiltInIo[io[idx]]); + // We have to (potentially) track two IO blocks, one in, one out. E.g, a GS may have a + // PerVertex block in both directions, possibly with different members. + static const TStorageQualifier ioType[2] = { EvqVaryingIn, EvqVaryingOut }; + static const char* blockName[2] = { "PerVertex_in", "PerVertex_out" }; + + TTypeList* ioBlockTypes[2] = { nullptr, nullptr }; + TArraySizes* ioBlockArray[2] = { nullptr, nullptr }; + + for (int idx = 0; idx < int(io.size()); ++idx) { + TVariable* var = interstageBuiltInIo[io[idx]]; + + // Add the loose interstage IO to the linkage + if (var->getType().isLooseAndBuiltIn(language)) + trackLinkageDeferred(*var); + + // Add the PerVertex interstage IO to the IO block + if (var->getType().isPerVertexAndBuiltIn(language)) { + int blockId = 0; + switch (var->getType().getQualifier().storage) { + case EvqVaryingIn: blockId = 0; break; + case EvqVaryingOut: blockId = 1; break; + default: assert(0 && "Invalid storage qualifier"); + } + + // Lazy creation of type list only if we end up needing it. + if (ioBlockTypes[blockId] == nullptr) + ioBlockTypes[blockId] = new TTypeList(); + + TTypeLoc member = { new TType(EbtVoid), loc }; + member.type->shallowCopy(var->getType()); + member.type->setFieldName(var->getName()); + + // We may have collected these from different parts of different structures. If their + // array dimensions are not the same, we don't know what to do, so issue an error. + if (member.type->isArray()) { + if (ioBlockArray[blockId] == nullptr) { + ioBlockArray[blockId] = &member.type->getArraySizes(); + } else { + if (*ioBlockArray[blockId] != member.type->getArraySizes()) + error(loc, "PerVertex block array dimension mismatch", "", ""); + } + member.type->clearArraySizes(); + } + + ioBlockTypes[blockId]->push_back(member); + } + } + + // If there were PerVertex items, add the block to the linkage. Handle in and out separately. + for (int blockId = 0; blockId <= 1; ++blockId) { + if (ioBlockTypes[blockId] != nullptr) { + const TString* instanceName = NewPoolTString(blockName[blockId]); + TQualifier blockQualifier; + + blockQualifier.clear(); + blockQualifier.storage = ioType[blockId]; + + TType blockType(ioBlockTypes[blockId], *instanceName, blockQualifier); + + if (ioBlockArray[blockId] != nullptr) + blockType.newArraySizes(*ioBlockArray[blockId]); + + TVariable* ioBlock = new TVariable(instanceName, blockType); + if (!symbolTable.insert(*ioBlock)) + error(loc, "block instance name redefinition", ioBlock->getName().c_str(), ""); + else + trackLinkageDeferred(*ioBlock); + } + } } // @@ -1786,7 +1856,7 @@ TIntermTyped* HlslParseContext::handleAssign(const TSourceLoc& loc, TOperator op const TOperator op = node->getType().isArray() ? EOpIndexDirect : EOpIndexDirectStruct; const TType derefType(node->getType(), member); - if (split && derefType.isBuiltInInterstageIO()) { + if (split && derefType.isBuiltInInterstageIO(language)) { // copy from interstage IO builtin if needed subTree = intermediate.addSymbol(*interstageBuiltInIo.find(tInterstageIoData(derefType, outer->getType()))->second); } else if (flattened && isFinalFlattening(derefType)) { @@ -1855,14 +1925,14 @@ TIntermTyped* HlslParseContext::handleAssign(const TSourceLoc& loc, TOperator op // recurse into it if there's something for splitting to do. That can save a lot of AST verbosity for // a bunch of memberwise copies. if (isFinalFlattening(typeL) || (!isFlattenLeft && !isFlattenRight && - !typeL.containsBuiltInInterstageIO() && !typeR.containsBuiltInInterstageIO())) { + !typeL.containsBuiltInInterstageIO(language) && !typeR.containsBuiltInInterstageIO(language))) { assignList = intermediate.growAggregate(assignList, intermediate.addAssign(op, subSplitLeft, subSplitRight, loc), loc); } else { traverse(subLeft, subRight, subSplitLeft, subSplitRight); } - memberL += (typeL.isBuiltInInterstageIO() ? 0 : 1); - memberR += (typeR.isBuiltInInterstageIO() ? 0 : 1); + memberL += (typeL.isBuiltInInterstageIO(language) ? 0 : 1); + memberR += (typeR.isBuiltInInterstageIO(language) ? 0 : 1); } } else { assert(0); // we should never be called on a non-flattenable thing, because @@ -5163,7 +5233,7 @@ TType* HlslParseContext::sanitizeType(TType* type) sanitizedType->clearArraySizes(); return sanitizedType; } else { - if (type->containsBuiltInInterstageIO()) { + if (type->containsBuiltInInterstageIO(language)) { // This means the type contains interstage IO, but we've never encountered it before. // Copy it, sanitize it, and remember it in the sanitizedTypeMap TType* sanitizedType = type->clone();