diff --git a/Test/baseResults/hlsl.entry-inout.vert.out b/Test/baseResults/hlsl.entry-inout.vert.out new file mode 100644 index 00000000..7b0ebd7a --- /dev/null +++ b/Test/baseResults/hlsl.entry-inout.vert.out @@ -0,0 +1,137 @@ +hlsl.entry-inout.vert +Shader version: 500 +0:? Sequence +0:1 Function Definition: @main(vf4;vf2; ( temp void) +0:1 Function Parameters: +0:1 'pos' ( inout 4-component vector of float) +0:1 'uv' ( inout 2-component vector of float) +0:1 Function Definition: main( ( temp void) +0:1 Function Parameters: +0:? Sequence +0:1 move second child to first child ( temp 4-component vector of float) +0:? 'pos' ( temp 4-component vector of float) +0:? 'pos' (layout( location=0) in 4-component vector of float) +0:1 move second child to first child ( temp 2-component vector of float) +0:? 'uv' ( temp 2-component vector of float) +0:? 'uv' (layout( location=1) in 2-component vector of float) +0:1 Function Call: @main(vf4;vf2; ( temp void) +0:? 'pos' ( temp 4-component vector of float) +0:? 'uv' ( temp 2-component vector of float) +0:1 move second child to first child ( temp 4-component vector of float) +0:? 'pos' ( out 4-component vector of float Position) +0:? 'pos' ( temp 4-component vector of float) +0:1 move second child to first child ( temp 2-component vector of float) +0:? 'uv' (layout( location=0) out 2-component vector of float) +0:? 'uv' ( temp 2-component vector of float) +0:? Linker Objects +0:? 'pos' (layout( location=0) in 4-component vector of float) +0:? 'uv' (layout( location=1) in 2-component vector of float) +0:? 'pos' ( out 4-component vector of float Position) +0:? 'uv' (layout( location=0) out 2-component vector of float) + + +Linked vertex stage: + + +Shader version: 500 +0:? Sequence +0:1 Function Definition: @main(vf4;vf2; ( temp void) +0:1 Function Parameters: +0:1 'pos' ( inout 4-component vector of float) +0:1 'uv' ( inout 2-component vector of float) +0:1 Function Definition: main( ( temp void) +0:1 Function Parameters: +0:? Sequence +0:1 move second child to first child ( temp 4-component vector of float) +0:? 'pos' ( temp 4-component vector of float) +0:? 'pos' (layout( location=0) in 4-component vector of float) +0:1 move second child to first child ( temp 2-component vector of float) +0:? 'uv' ( temp 2-component vector of float) +0:? 'uv' (layout( location=1) in 2-component vector of float) +0:1 Function Call: @main(vf4;vf2; ( temp void) +0:? 'pos' ( temp 4-component vector of float) +0:? 'uv' ( temp 2-component vector of float) +0:1 move second child to first child ( temp 4-component vector of float) +0:? 'pos' ( out 4-component vector of float Position) +0:? 'pos' ( temp 4-component vector of float) +0:1 move second child to first child ( temp 2-component vector of float) +0:? 'uv' (layout( location=0) out 2-component vector of float) +0:? 'uv' ( temp 2-component vector of float) +0:? Linker Objects +0:? 'pos' (layout( location=0) in 4-component vector of float) +0:? 'uv' (layout( location=1) in 2-component vector of float) +0:? 'pos' ( out 4-component vector of float Position) +0:? 'uv' (layout( location=0) out 2-component vector of float) + +// Module Version 10000 +// Generated by (magic number): 8000b +// Id's are bound by 37 + + Capability Shader + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Vertex 4 "main" 18 22 32 35 + Source HLSL 500 + Name 4 "main" + Name 14 "@main(vf4;vf2;" + Name 12 "pos" + Name 13 "uv" + Name 16 "pos" + Name 18 "pos" + Name 20 "uv" + Name 22 "uv" + Name 24 "param" + Name 26 "param" + Name 32 "pos" + Name 35 "uv" + Decorate 18(pos) Location 0 + Decorate 22(uv) Location 1 + Decorate 32(pos) BuiltIn Position + Decorate 35(uv) Location 0 + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7: TypeVector 6(float) 4 + 8: TypePointer Function 7(fvec4) + 9: TypeVector 6(float) 2 + 10: TypePointer Function 9(fvec2) + 11: TypeFunction 2 8(ptr) 10(ptr) + 17: TypePointer Input 7(fvec4) + 18(pos): 17(ptr) Variable Input + 21: TypePointer Input 9(fvec2) + 22(uv): 21(ptr) Variable Input + 31: TypePointer Output 7(fvec4) + 32(pos): 31(ptr) Variable Output + 34: TypePointer Output 9(fvec2) + 35(uv): 34(ptr) Variable Output + 4(main): 2 Function None 3 + 5: Label + 16(pos): 8(ptr) Variable Function + 20(uv): 10(ptr) Variable Function + 24(param): 8(ptr) Variable Function + 26(param): 10(ptr) Variable Function + 19: 7(fvec4) Load 18(pos) + Store 16(pos) 19 + 23: 9(fvec2) Load 22(uv) + Store 20(uv) 23 + 25: 7(fvec4) Load 16(pos) + Store 24(param) 25 + 27: 9(fvec2) Load 20(uv) + Store 26(param) 27 + 28: 2 FunctionCall 14(@main(vf4;vf2;) 24(param) 26(param) + 29: 7(fvec4) Load 24(param) + Store 16(pos) 29 + 30: 9(fvec2) Load 26(param) + Store 20(uv) 30 + 33: 7(fvec4) Load 16(pos) + Store 32(pos) 33 + 36: 9(fvec2) Load 20(uv) + Store 35(uv) 36 + Return + FunctionEnd +14(@main(vf4;vf2;): 2 Function None 11 + 12(pos): 8(ptr) FunctionParameter + 13(uv): 10(ptr) FunctionParameter + 15: Label + Return + FunctionEnd diff --git a/Test/hlsl.entry-inout.vert b/Test/hlsl.entry-inout.vert new file mode 100644 index 00000000..859b0307 --- /dev/null +++ b/Test/hlsl.entry-inout.vert @@ -0,0 +1 @@ +void main(inout float4 pos : SV_Position, inout float2 uv : TEXCOORD0) {} diff --git a/glslang/HLSL/hlslParseHelper.cpp b/glslang/HLSL/hlslParseHelper.cpp index 74c9c1d7..a1ae55c8 100644 --- a/glslang/HLSL/hlslParseHelper.cpp +++ b/glslang/HLSL/hlslParseHelper.cpp @@ -9658,6 +9658,10 @@ void HlslParseContext::correctOutput(TQualifier& qualifier) if (language != EShLangTessControl) qualifier.patch = false; + // Fixes Test/hlsl.entry-inout.vert (SV_Position will not become a varying). + if (qualifier.builtIn == EbvNone) + qualifier.builtIn = qualifier.declaredBuiltIn; + switch (qualifier.builtIn) { case EbvFragDepth: intermediate.setDepthReplacing(); diff --git a/gtests/Hlsl.FromFile.cpp b/gtests/Hlsl.FromFile.cpp index 5d0d2d6b..cc0c9eb3 100644 --- a/gtests/Hlsl.FromFile.cpp +++ b/gtests/Hlsl.FromFile.cpp @@ -216,6 +216,7 @@ INSTANTIATE_TEST_SUITE_P( {"hlsl.emptystructreturn.tesc", "main"}, {"hlsl.emptystruct.init.vert", "main"}, {"hlsl.entry-in.frag", "PixelShaderFunction"}, + {"hlsl.entry-inout.vert", "main"}, {"hlsl.entry-out.frag", "PixelShaderFunction"}, {"hlsl.fraggeom.frag", "main"}, {"hlsl.float1.frag", "PixelShaderFunction"},