Issue #28: Correctly handle a single input argument conversion when the input argumen...
authorJohn Kessenich <cepheus@frii.com>
Tue, 21 Jul 2015 22:00:34 +0000 (16:00 -0600)
committerJohn Kessenich <cepheus@frii.com>
Tue, 21 Jul 2015 22:00:34 +0000 (16:00 -0600)
Test/baseResults/functionSemantics.frag.out
Test/functionSemantics.frag
glslang/MachineIndependent/ParseHelper.cpp

index 7117352..63cde49 100644 (file)
@@ -187,6 +187,14 @@ Shader version: 400
 0:62        Construct vec4 (temp 4-component vector of float)\r
 0:62          Convert int to float (temp float)\r
 0:62            'color' (temp int)\r
+0:66  Function Definition: aggCall( (global void)\r
+0:66    Function Parameters: \r
+0:?     Sequence\r
+0:69      Function Call: m(vf2; (global 3-component vector of float)\r
+0:69        Convert int to float (temp 2-component vector of float)\r
+0:69          Construct ivec2 (temp 2-component vector of int)\r
+0:69            Convert float to int (temp int)\r
+0:69              'F' (temp float)\r
 0:?   Linker Objects\r
 0:?     'u' (uniform float)\r
 \r
@@ -380,6 +388,14 @@ Shader version: 400
 0:62        Construct vec4 (temp 4-component vector of float)\r
 0:62          Convert int to float (temp float)\r
 0:62            'color' (temp int)\r
+0:66  Function Definition: aggCall( (global void)\r
+0:66    Function Parameters: \r
+0:?     Sequence\r
+0:69      Function Call: m(vf2; (global 3-component vector of float)\r
+0:69        Convert int to float (temp 2-component vector of float)\r
+0:69          Construct ivec2 (temp 2-component vector of int)\r
+0:69            Convert float to int (temp int)\r
+0:69              'F' (temp float)\r
 0:?   Linker Objects\r
 0:?     'u' (uniform float)\r
 \r
index 67ff5f5..15ebc60 100644 (file)
@@ -61,3 +61,10 @@ void main()
 \r
     gl_FragColor = vec4(color);\r
 }\r
+\r
+vec3 m(vec2);\r
+void aggCall()\r
+{\r
+    float F;\r
+    m(ivec2(F));  // test input conversion of single argument that's an aggregate; other function tests in 120.vert\r
+}\r
index b993ee0..afe2e4a 100644 (file)
@@ -1239,10 +1239,14 @@ void TParseContext::addInputArgumentConversions(const TFunction& function, TInte
                 // convert to the correct type.
                 arg = intermediate.addConversion(EOpFunctionCall, *function[i].type, arg);
                 if (arg) {
-                    if (aggregate)
-                        aggregate->getSequence()[i] = arg;
-                    else
+                    if (function.getParamCount() == 1)
                         arguments = arg;
+                    else {
+                        if (aggregate)
+                            aggregate->getSequence()[i] = arg;
+                        else
+                            arguments = arg;
+                    }
                 }
             }
         }