From b1d97537e8b9c43e3212ec818a309808927d5db9 Mon Sep 17 00:00:00 2001 From: xavier Date: Tue, 20 Jun 2017 07:49:22 +0200 Subject: [PATCH] hlsl: "in out" is also an inout qualifier. --- Test/baseResults/hlsl.inoutquals.frag.out | 483 ++++++++++++---------- Test/hlsl.inoutquals.frag | 5 +- hlsl/hlslGrammar.cpp | 4 +- 3 files changed, 262 insertions(+), 230 deletions(-) diff --git a/Test/baseResults/hlsl.inoutquals.frag.out b/Test/baseResults/hlsl.inoutquals.frag.out index d5cce21bc..3f7f139ae 100644 --- a/Test/baseResults/hlsl.inoutquals.frag.out +++ b/Test/baseResults/hlsl.inoutquals.frag.out @@ -2,11 +2,12 @@ hlsl.inoutquals.frag Shader version: 500 gl_FragCoord origin is upper left 0:? Sequence -0:8 Function Definition: MyFunc(f1;f1;f1; ( temp void) +0:8 Function Definition: MyFunc(f1;f1;f1;f1; ( temp void) 0:8 Function Parameters: 0:8 'x' ( in float) 0:8 'y' ( out float) 0:8 'z' ( inout float) +0:8 'w' ( inout float) 0:? Sequence 0:9 move second child to first child ( temp float) 0:9 'y' ( out float) @@ -18,71 +19,79 @@ gl_FragCoord origin is upper left 0:11 'x' ( in float) 0:11 Constant: 0:11 -1.000000 -0:15 Function Definition: @main(vf4;i1; ( temp structure{ temp 4-component vector of float Color, temp float Depth}) -0:15 Function Parameters: -0:15 'inpos' ( in 4-component vector of float) -0:15 'sampleMask' ( out int) +0:12 multiply second child into first child ( temp float) +0:12 'w' ( inout float) +0:12 Constant: +0:12 1.000000 +0:16 Function Definition: @main(vf4;i1; ( temp structure{ temp 4-component vector of float Color, temp float Depth}) +0:16 Function Parameters: +0:16 'inpos' ( in 4-component vector of float) +0:16 'sampleMask' ( out int) 0:? Sequence -0:18 Sequence -0:18 move second child to first child ( temp float) -0:18 'x' ( temp float) -0:18 Constant: -0:18 7.000000 -0:18 move second child to first child ( temp float) -0:18 'z' ( temp float) -0:18 Constant: -0:18 3.000000 -0:19 Function Call: MyFunc(f1;f1;f1; ( temp void) -0:19 'x' ( temp float) -0:19 'y' ( temp float) -0:19 'z' ( temp float) -0:21 move second child to first child ( temp 4-component vector of float) -0:21 Color: direct index for structure ( temp 4-component vector of float) -0:21 'psout' ( temp structure{ temp 4-component vector of float Color, temp float Depth}) -0:21 Constant: -0:21 0 (const int) -0:? Construct vec4 ( temp 4-component vector of float) -0:21 'x' ( temp float) -0:21 'y' ( temp float) -0:21 'z' ( temp float) -0:21 Constant: -0:21 1.000000 -0:22 move second child to first child ( temp float) -0:22 Depth: direct index for structure ( temp float) +0:19 Sequence +0:19 move second child to first child ( temp float) +0:19 'x' ( temp float) +0:19 Constant: +0:19 7.000000 +0:19 move second child to first child ( temp float) +0:19 'z' ( temp float) +0:19 Constant: +0:19 3.000000 +0:20 Function Call: MyFunc(f1;f1;f1;f1; ( temp void) +0:20 'x' ( temp float) +0:20 'y' ( temp float) +0:20 'z' ( temp float) +0:20 direct index ( temp float) +0:20 'inpos' ( in 4-component vector of float) +0:20 Constant: +0:20 3 (const int) +0:22 move second child to first child ( temp 4-component vector of float) +0:22 Color: direct index for structure ( temp 4-component vector of float) 0:22 'psout' ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:22 Constant: -0:22 1 (const int) -0:22 direct index ( temp float) -0:22 'inpos' ( in 4-component vector of float) +0:22 0 (const int) +0:? Construct vec4 ( temp 4-component vector of float) +0:22 'x' ( temp float) +0:22 'y' ( temp float) +0:22 'z' ( temp float) 0:22 Constant: -0:22 3 (const int) -0:24 Branch: Return with expression -0:24 'psout' ( temp structure{ temp 4-component vector of float Color, temp float Depth}) -0:15 Function Definition: main( ( temp void) -0:15 Function Parameters: +0:22 1.000000 +0:23 move second child to first child ( temp float) +0:23 Depth: direct index for structure ( temp float) +0:23 'psout' ( temp structure{ temp 4-component vector of float Color, temp float Depth}) +0:23 Constant: +0:23 1 (const int) +0:23 direct index ( temp float) +0:23 'inpos' ( in 4-component vector of float) +0:23 Constant: +0:23 3 (const int) +0:25 Branch: Return with expression +0:25 'psout' ( temp structure{ temp 4-component vector of float Color, temp float Depth}) +0:16 Function Definition: main( ( temp void) +0:16 Function Parameters: 0:? Sequence -0:15 move second child to first child ( temp 4-component vector of float) +0:16 move second child to first child ( temp 4-component vector of float) 0:? 'inpos' ( temp 4-component vector of float) 0:? 'inpos' ( noperspective in 4-component vector of float FragCoord) -0:15 Sequence -0:15 move second child to first child ( temp structure{ temp 4-component vector of float Color, temp float Depth}) -0:15 'flattenTemp' ( temp structure{ temp 4-component vector of float Color, temp float Depth}) -0:15 Function Call: @main(vf4;i1; ( temp structure{ temp 4-component vector of float Color, temp float Depth}) +0:16 Sequence +0:16 move second child to first child ( temp structure{ temp 4-component vector of float Color, temp float Depth}) +0:16 'flattenTemp' ( temp structure{ temp 4-component vector of float Color, temp float Depth}) +0:16 Function Call: @main(vf4;i1; ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:? 'inpos' ( temp 4-component vector of float) 0:? 'sampleMask' ( temp int) -0:15 move second child to first child ( temp 4-component vector of float) +0:16 move second child to first child ( temp 4-component vector of float) 0:? 'Color' (layout( location=0) out 4-component vector of float) -0:15 Color: direct index for structure ( temp 4-component vector of float) -0:15 'flattenTemp' ( temp structure{ temp 4-component vector of float Color, temp float Depth}) -0:15 Constant: -0:15 0 (const int) -0:15 move second child to first child ( temp float) +0:16 Color: direct index for structure ( temp 4-component vector of float) +0:16 'flattenTemp' ( temp structure{ temp 4-component vector of float Color, temp float Depth}) +0:16 Constant: +0:16 0 (const int) +0:16 move second child to first child ( temp float) 0:? 'Depth' ( out float FragDepth) -0:15 Depth: direct index for structure ( temp float) -0:15 'flattenTemp' ( temp structure{ temp 4-component vector of float Color, temp float Depth}) -0:15 Constant: -0:15 1 (const int) -0:15 move second child to first child ( temp int) +0:16 Depth: direct index for structure ( temp float) +0:16 'flattenTemp' ( temp structure{ temp 4-component vector of float Color, temp float Depth}) +0:16 Constant: +0:16 1 (const int) +0:16 move second child to first child ( temp int) 0:? 'sampleMask' ( out int SampleMaskIn) 0:? 'sampleMask' ( temp int) 0:? Linker Objects @@ -98,11 +107,12 @@ Linked fragment stage: Shader version: 500 gl_FragCoord origin is upper left 0:? Sequence -0:8 Function Definition: MyFunc(f1;f1;f1; ( temp void) +0:8 Function Definition: MyFunc(f1;f1;f1;f1; ( temp void) 0:8 Function Parameters: 0:8 'x' ( in float) 0:8 'y' ( out float) 0:8 'z' ( inout float) +0:8 'w' ( inout float) 0:? Sequence 0:9 move second child to first child ( temp float) 0:9 'y' ( out float) @@ -114,71 +124,79 @@ gl_FragCoord origin is upper left 0:11 'x' ( in float) 0:11 Constant: 0:11 -1.000000 -0:15 Function Definition: @main(vf4;i1; ( temp structure{ temp 4-component vector of float Color, temp float Depth}) -0:15 Function Parameters: -0:15 'inpos' ( in 4-component vector of float) -0:15 'sampleMask' ( out int) +0:12 multiply second child into first child ( temp float) +0:12 'w' ( inout float) +0:12 Constant: +0:12 1.000000 +0:16 Function Definition: @main(vf4;i1; ( temp structure{ temp 4-component vector of float Color, temp float Depth}) +0:16 Function Parameters: +0:16 'inpos' ( in 4-component vector of float) +0:16 'sampleMask' ( out int) 0:? Sequence -0:18 Sequence -0:18 move second child to first child ( temp float) -0:18 'x' ( temp float) -0:18 Constant: -0:18 7.000000 -0:18 move second child to first child ( temp float) -0:18 'z' ( temp float) -0:18 Constant: -0:18 3.000000 -0:19 Function Call: MyFunc(f1;f1;f1; ( temp void) -0:19 'x' ( temp float) -0:19 'y' ( temp float) -0:19 'z' ( temp float) -0:21 move second child to first child ( temp 4-component vector of float) -0:21 Color: direct index for structure ( temp 4-component vector of float) -0:21 'psout' ( temp structure{ temp 4-component vector of float Color, temp float Depth}) -0:21 Constant: -0:21 0 (const int) -0:? Construct vec4 ( temp 4-component vector of float) -0:21 'x' ( temp float) -0:21 'y' ( temp float) -0:21 'z' ( temp float) -0:21 Constant: -0:21 1.000000 -0:22 move second child to first child ( temp float) -0:22 Depth: direct index for structure ( temp float) +0:19 Sequence +0:19 move second child to first child ( temp float) +0:19 'x' ( temp float) +0:19 Constant: +0:19 7.000000 +0:19 move second child to first child ( temp float) +0:19 'z' ( temp float) +0:19 Constant: +0:19 3.000000 +0:20 Function Call: MyFunc(f1;f1;f1;f1; ( temp void) +0:20 'x' ( temp float) +0:20 'y' ( temp float) +0:20 'z' ( temp float) +0:20 direct index ( temp float) +0:20 'inpos' ( in 4-component vector of float) +0:20 Constant: +0:20 3 (const int) +0:22 move second child to first child ( temp 4-component vector of float) +0:22 Color: direct index for structure ( temp 4-component vector of float) 0:22 'psout' ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:22 Constant: -0:22 1 (const int) -0:22 direct index ( temp float) -0:22 'inpos' ( in 4-component vector of float) +0:22 0 (const int) +0:? Construct vec4 ( temp 4-component vector of float) +0:22 'x' ( temp float) +0:22 'y' ( temp float) +0:22 'z' ( temp float) 0:22 Constant: -0:22 3 (const int) -0:24 Branch: Return with expression -0:24 'psout' ( temp structure{ temp 4-component vector of float Color, temp float Depth}) -0:15 Function Definition: main( ( temp void) -0:15 Function Parameters: +0:22 1.000000 +0:23 move second child to first child ( temp float) +0:23 Depth: direct index for structure ( temp float) +0:23 'psout' ( temp structure{ temp 4-component vector of float Color, temp float Depth}) +0:23 Constant: +0:23 1 (const int) +0:23 direct index ( temp float) +0:23 'inpos' ( in 4-component vector of float) +0:23 Constant: +0:23 3 (const int) +0:25 Branch: Return with expression +0:25 'psout' ( temp structure{ temp 4-component vector of float Color, temp float Depth}) +0:16 Function Definition: main( ( temp void) +0:16 Function Parameters: 0:? Sequence -0:15 move second child to first child ( temp 4-component vector of float) +0:16 move second child to first child ( temp 4-component vector of float) 0:? 'inpos' ( temp 4-component vector of float) 0:? 'inpos' ( noperspective in 4-component vector of float FragCoord) -0:15 Sequence -0:15 move second child to first child ( temp structure{ temp 4-component vector of float Color, temp float Depth}) -0:15 'flattenTemp' ( temp structure{ temp 4-component vector of float Color, temp float Depth}) -0:15 Function Call: @main(vf4;i1; ( temp structure{ temp 4-component vector of float Color, temp float Depth}) +0:16 Sequence +0:16 move second child to first child ( temp structure{ temp 4-component vector of float Color, temp float Depth}) +0:16 'flattenTemp' ( temp structure{ temp 4-component vector of float Color, temp float Depth}) +0:16 Function Call: @main(vf4;i1; ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:? 'inpos' ( temp 4-component vector of float) 0:? 'sampleMask' ( temp int) -0:15 move second child to first child ( temp 4-component vector of float) +0:16 move second child to first child ( temp 4-component vector of float) 0:? 'Color' (layout( location=0) out 4-component vector of float) -0:15 Color: direct index for structure ( temp 4-component vector of float) -0:15 'flattenTemp' ( temp structure{ temp 4-component vector of float Color, temp float Depth}) -0:15 Constant: -0:15 0 (const int) -0:15 move second child to first child ( temp float) +0:16 Color: direct index for structure ( temp 4-component vector of float) +0:16 'flattenTemp' ( temp structure{ temp 4-component vector of float Color, temp float Depth}) +0:16 Constant: +0:16 0 (const int) +0:16 move second child to first child ( temp float) 0:? 'Depth' ( out float FragDepth) -0:15 Depth: direct index for structure ( temp float) -0:15 'flattenTemp' ( temp structure{ temp 4-component vector of float Color, temp float Depth}) -0:15 Constant: -0:15 1 (const int) -0:15 move second child to first child ( temp int) +0:16 Depth: direct index for structure ( temp float) +0:16 'flattenTemp' ( temp structure{ temp 4-component vector of float Color, temp float Depth}) +0:16 Constant: +0:16 1 (const int) +0:16 move second child to first child ( temp int) 0:? 'sampleMask' ( out int SampleMaskIn) 0:? 'sampleMask' ( temp int) 0:? Linker Objects @@ -189,144 +207,157 @@ gl_FragCoord origin is upper left // Module Version 10000 // Generated by (magic number): 80001 -// Id's are bound by 80 +// Id's are bound by 88 Capability Shader Capability SampleRateShading 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint Fragment 4 "main" 60 70 74 78 + EntryPoint Fragment 4 "main" 68 78 82 86 ExecutionMode 4 OriginUpperLeft Source HLSL 500 Name 4 "main" - Name 12 "MyFunc(f1;f1;f1;" + Name 13 "MyFunc(f1;f1;f1;f1;" Name 9 "x" Name 10 "y" Name 11 "z" - Name 18 "PS_OUTPUT" - MemberName 18(PS_OUTPUT) 0 "Color" - MemberName 18(PS_OUTPUT) 1 "Depth" - Name 22 "@main(vf4;i1;" - Name 20 "inpos" - Name 21 "sampleMask" - Name 27 "x" - Name 29 "z" - Name 31 "y" - Name 32 "param" - Name 34 "param" - Name 35 "param" - Name 41 "psout" - Name 58 "inpos" - Name 60 "inpos" - Name 62 "flattenTemp" - Name 63 "sampleMask" - Name 64 "param" - Name 66 "param" - Name 70 "Color" - Name 74 "Depth" - Name 78 "sampleMask" - Decorate 60(inpos) NoPerspective - Decorate 60(inpos) BuiltIn FragCoord - Decorate 70(Color) Location 0 - Decorate 74(Depth) BuiltIn FragDepth - Decorate 78(sampleMask) BuiltIn SampleMask + Name 12 "w" + Name 19 "PS_OUTPUT" + MemberName 19(PS_OUTPUT) 0 "Color" + MemberName 19(PS_OUTPUT) 1 "Depth" + Name 23 "@main(vf4;i1;" + Name 21 "inpos" + Name 22 "sampleMask" + Name 31 "x" + Name 33 "z" + Name 35 "y" + Name 36 "param" + Name 38 "param" + Name 39 "param" + Name 41 "param" + Name 52 "psout" + Name 66 "inpos" + Name 68 "inpos" + Name 70 "flattenTemp" + Name 71 "sampleMask" + Name 72 "param" + Name 74 "param" + Name 78 "Color" + Name 82 "Depth" + Name 86 "sampleMask" + Decorate 68(inpos) NoPerspective + Decorate 68(inpos) BuiltIn FragCoord + Decorate 78(Color) Location 0 + Decorate 82(Depth) BuiltIn FragDepth + Decorate 86(sampleMask) BuiltIn SampleMask 2: TypeVoid 3: TypeFunction 2 6: TypeFloat 32 7: TypePointer Function 6(float) - 8: TypeFunction 2 7(ptr) 7(ptr) 7(ptr) - 14: TypeVector 6(float) 4 - 15: TypePointer Function 14(fvec4) - 16: TypeInt 32 1 - 17: TypePointer Function 16(int) - 18(PS_OUTPUT): TypeStruct 14(fvec4) 6(float) - 19: TypeFunction 18(PS_OUTPUT) 15(ptr) 17(ptr) - 26: 6(float) Constant 3212836864 - 28: 6(float) Constant 1088421888 - 30: 6(float) Constant 1077936128 - 40: TypePointer Function 18(PS_OUTPUT) - 42: 16(int) Constant 0 - 46: 6(float) Constant 1065353216 - 49: 16(int) Constant 1 - 50: TypeInt 32 0 - 51: 50(int) Constant 3 - 59: TypePointer Input 14(fvec4) - 60(inpos): 59(ptr) Variable Input - 69: TypePointer Output 14(fvec4) - 70(Color): 69(ptr) Variable Output - 73: TypePointer Output 6(float) - 74(Depth): 73(ptr) Variable Output - 77: TypePointer Output 16(int) - 78(sampleMask): 77(ptr) Variable Output + 8: TypeFunction 2 7(ptr) 7(ptr) 7(ptr) 7(ptr) + 15: TypeVector 6(float) 4 + 16: TypePointer Function 15(fvec4) + 17: TypeInt 32 1 + 18: TypePointer Function 17(int) + 19(PS_OUTPUT): TypeStruct 15(fvec4) 6(float) + 20: TypeFunction 19(PS_OUTPUT) 16(ptr) 18(ptr) + 27: 6(float) Constant 3212836864 + 28: 6(float) Constant 1065353216 + 32: 6(float) Constant 1088421888 + 34: 6(float) Constant 1077936128 + 42: TypeInt 32 0 + 43: 42(int) Constant 3 + 51: TypePointer Function 19(PS_OUTPUT) + 53: 17(int) Constant 0 + 59: 17(int) Constant 1 + 67: TypePointer Input 15(fvec4) + 68(inpos): 67(ptr) Variable Input + 77: TypePointer Output 15(fvec4) + 78(Color): 77(ptr) Variable Output + 81: TypePointer Output 6(float) + 82(Depth): 81(ptr) Variable Output + 85: TypePointer Output 17(int) + 86(sampleMask): 85(ptr) Variable Output 4(main): 2 Function None 3 5: Label - 58(inpos): 15(ptr) Variable Function - 62(flattenTemp): 40(ptr) Variable Function - 63(sampleMask): 17(ptr) Variable Function - 64(param): 15(ptr) Variable Function - 66(param): 17(ptr) Variable Function - 61: 14(fvec4) Load 60(inpos) - Store 58(inpos) 61 - 65: 14(fvec4) Load 58(inpos) - Store 64(param) 65 - 67:18(PS_OUTPUT) FunctionCall 22(@main(vf4;i1;) 64(param) 66(param) - 68: 16(int) Load 66(param) - Store 63(sampleMask) 68 - Store 62(flattenTemp) 67 - 71: 15(ptr) AccessChain 62(flattenTemp) 42 - 72: 14(fvec4) Load 71 - Store 70(Color) 72 - 75: 7(ptr) AccessChain 62(flattenTemp) 49 - 76: 6(float) Load 75 - Store 74(Depth) 76 - 79: 16(int) Load 63(sampleMask) - Store 78(sampleMask) 79 + 66(inpos): 16(ptr) Variable Function + 70(flattenTemp): 51(ptr) Variable Function + 71(sampleMask): 18(ptr) Variable Function + 72(param): 16(ptr) Variable Function + 74(param): 18(ptr) Variable Function + 69: 15(fvec4) Load 68(inpos) + Store 66(inpos) 69 + 73: 15(fvec4) Load 66(inpos) + Store 72(param) 73 + 75:19(PS_OUTPUT) FunctionCall 23(@main(vf4;i1;) 72(param) 74(param) + 76: 17(int) Load 74(param) + Store 71(sampleMask) 76 + Store 70(flattenTemp) 75 + 79: 16(ptr) AccessChain 70(flattenTemp) 53 + 80: 15(fvec4) Load 79 + Store 78(Color) 80 + 83: 7(ptr) AccessChain 70(flattenTemp) 59 + 84: 6(float) Load 83 + Store 82(Depth) 84 + 87: 17(int) Load 71(sampleMask) + Store 86(sampleMask) 87 Return FunctionEnd -12(MyFunc(f1;f1;f1;): 2 Function None 8 +13(MyFunc(f1;f1;f1;f1;): 2 Function None 8 9(x): 7(ptr) FunctionParameter 10(y): 7(ptr) FunctionParameter 11(z): 7(ptr) FunctionParameter - 13: Label - 24: 6(float) Load 9(x) - Store 10(y) 24 - 25: 6(float) Load 10(y) - Store 11(z) 25 - Store 9(x) 26 + 12(w): 7(ptr) FunctionParameter + 14: Label + 25: 6(float) Load 9(x) + Store 10(y) 25 + 26: 6(float) Load 10(y) + Store 11(z) 26 + Store 9(x) 27 + 29: 6(float) Load 12(w) + 30: 6(float) FMul 29 28 + Store 12(w) 30 Return FunctionEnd -22(@main(vf4;i1;):18(PS_OUTPUT) Function None 19 - 20(inpos): 15(ptr) FunctionParameter - 21(sampleMask): 17(ptr) FunctionParameter - 23: Label - 27(x): 7(ptr) Variable Function - 29(z): 7(ptr) Variable Function - 31(y): 7(ptr) Variable Function - 32(param): 7(ptr) Variable Function - 34(param): 7(ptr) Variable Function - 35(param): 7(ptr) Variable Function - 41(psout): 40(ptr) Variable Function - Store 27(x) 28 - Store 29(z) 30 - 33: 6(float) Load 27(x) - Store 32(param) 33 - 36: 6(float) Load 29(z) - Store 35(param) 36 - 37: 2 FunctionCall 12(MyFunc(f1;f1;f1;) 32(param) 34(param) 35(param) - 38: 6(float) Load 34(param) - Store 31(y) 38 - 39: 6(float) Load 35(param) - Store 29(z) 39 - 43: 6(float) Load 27(x) - 44: 6(float) Load 31(y) - 45: 6(float) Load 29(z) - 47: 14(fvec4) CompositeConstruct 43 44 45 46 - 48: 15(ptr) AccessChain 41(psout) 42 - Store 48 47 - 52: 7(ptr) AccessChain 20(inpos) 51 - 53: 6(float) Load 52 - 54: 7(ptr) AccessChain 41(psout) 49 - Store 54 53 - 55:18(PS_OUTPUT) Load 41(psout) - ReturnValue 55 +23(@main(vf4;i1;):19(PS_OUTPUT) Function None 20 + 21(inpos): 16(ptr) FunctionParameter + 22(sampleMask): 18(ptr) FunctionParameter + 24: Label + 31(x): 7(ptr) Variable Function + 33(z): 7(ptr) Variable Function + 35(y): 7(ptr) Variable Function + 36(param): 7(ptr) Variable Function + 38(param): 7(ptr) Variable Function + 39(param): 7(ptr) Variable Function + 41(param): 7(ptr) Variable Function + 52(psout): 51(ptr) Variable Function + Store 31(x) 32 + Store 33(z) 34 + 37: 6(float) Load 31(x) + Store 36(param) 37 + 40: 6(float) Load 33(z) + Store 39(param) 40 + 44: 7(ptr) AccessChain 21(inpos) 43 + 45: 6(float) Load 44 + Store 41(param) 45 + 46: 2 FunctionCall 13(MyFunc(f1;f1;f1;f1;) 36(param) 38(param) 39(param) 41(param) + 47: 6(float) Load 38(param) + Store 35(y) 47 + 48: 6(float) Load 39(param) + Store 33(z) 48 + 49: 6(float) Load 41(param) + 50: 7(ptr) AccessChain 21(inpos) 43 + Store 50 49 + 54: 6(float) Load 31(x) + 55: 6(float) Load 35(y) + 56: 6(float) Load 33(z) + 57: 15(fvec4) CompositeConstruct 54 55 56 28 + 58: 16(ptr) AccessChain 52(psout) 53 + Store 58 57 + 60: 7(ptr) AccessChain 21(inpos) 43 + 61: 6(float) Load 60 + 62: 7(ptr) AccessChain 52(psout) 59 + Store 62 61 + 63:19(PS_OUTPUT) Load 52(psout) + ReturnValue 63 FunctionEnd diff --git a/Test/hlsl.inoutquals.frag b/Test/hlsl.inoutquals.frag index 9328dfbe7..6a124f8dd 100644 --- a/Test/hlsl.inoutquals.frag +++ b/Test/hlsl.inoutquals.frag @@ -4,11 +4,12 @@ struct PS_OUTPUT float Depth : SV_Depth; }; -inline void MyFunc(in float x, out float y, inout float z) +inline void MyFunc(in float x, out float y, inout float z, in out float w) { y = x; z = y; x = -1; // no effect since x = in param + w *= 1; } PS_OUTPUT main(noperspective in float4 inpos : SV_Position, out int sampleMask : SV_Coverage) @@ -16,7 +17,7 @@ PS_OUTPUT main(noperspective in float4 inpos : SV_Position, out int sampleMask : PS_OUTPUT psout; float x = 7, y, z = 3; - MyFunc(x, y, z); + MyFunc(x, y, z, inpos.w); psout.Color = float4(x, y, z, 1); psout.Depth = inpos.w; diff --git a/hlsl/hlslGrammar.cpp b/hlsl/hlslGrammar.cpp index d8675f258..7cc1845e6 100755 --- a/hlsl/hlslGrammar.cpp +++ b/hlsl/hlslGrammar.cpp @@ -680,10 +680,10 @@ bool HlslGrammar::acceptQualifier(TQualifier& qualifier) qualifier.noContraction = true; break; case EHTokIn: - qualifier.storage = EvqIn; + qualifier.storage = (qualifier.storage == EvqOut) ? EvqInOut : EvqIn; break; case EHTokOut: - qualifier.storage = EvqOut; + qualifier.storage = (qualifier.storage == EvqIn) ? EvqInOut : EvqOut; break; case EHTokInOut: qualifier.storage = EvqInOut;