Implement implicit conversions on function return expressions to the function's type.

git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@26501 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
John Kessenich
2014-05-06 06:02:01 +00:00
parent 2ea882fdae
commit 8a1a4a7a8b
10 changed files with 66 additions and 30 deletions

View File

@@ -32,3 +32,8 @@ void foo()
vec4 v = gl_in[1].gl_Position; // ERROR, not included in the redeclaration
gl_Position = vec4(1.0); // ERROR, not included in the redeclaration
}
float foo5()
{
return 4; // implicit conversion of return type
}

View File

@@ -48,3 +48,8 @@ out gl_PerVertex {
float gl_PointSize[1]; // ERROR, adding array
float gl_ClipDistance; // ERROR, removing array
};
float foo5()
{
return i; // implicit conversion of return type
}

View File

@@ -27,7 +27,7 @@ ERROR: 0:91: 'int' : main function cannot return a value
ERROR: 0:92: 'main' : function cannot take any parameter(s)
ERROR: 0:94: 'a' : variables with qualifier 'const' must be initialized
ERROR: 0:97: 'out' : overloaded functions must have the same parameter storage qualifiers for argument 1
ERROR: 0:99: 'return' : function return is not matching type:
ERROR: 0:99: 'return' : type does not match, or is not convertible to, the function's return type
ERROR: 0:115: 'return' : void function cannot return a value
ERROR: 0:125: 'gl_TexCoord' : redeclaration of array with size
ERROR: 0:152: 'matrixCompMult' : no matching overloaded function found
@@ -291,8 +291,7 @@ ERROR: node is still EOpNull!
0:113 Function Definition: v2( (void)
0:113 Function Parameters:
0:115 Sequence
0:115 Branch: Return with expression
0:115 Function Call: v1( (void)
0:115 Branch: Return
0:118 Function Definition: atest( (void)
0:118 Function Parameters:
0:120 Sequence
@@ -650,8 +649,7 @@ ERROR: node is still EOpNull!
0:113 Function Definition: v2( (void)
0:113 Function Parameters:
0:115 Sequence
0:115 Branch: Return with expression
0:115 Function Call: v1( (void)
0:115 Branch: Return
0:118 Function Definition: atest( (void)
0:118 Function Parameters:
0:120 Sequence

View File

@@ -44,16 +44,12 @@ ERROR: node is still EOpNull!
0:25 Function Parameters:
0:25 'x' (in highp float)
0:27 Sequence
0:27 Branch: Return with expression
0:27 Constant:
0:27 1.000000
0:27 Branch: Return
0:29 Function Definition: radians(b1; (bool)
0:29 Function Parameters:
0:29 'x' (in bool)
0:31 Sequence
0:31 Branch: Return with expression
0:31 Constant:
0:31 true (const bool)
0:31 Branch: Return
0:36 Function Definition: main( (void)
0:36 Function Parameters:
0:? Sequence
@@ -157,16 +153,12 @@ ERROR: node is still EOpNull!
0:25 Function Parameters:
0:25 'x' (in highp float)
0:27 Sequence
0:27 Branch: Return with expression
0:27 Constant:
0:27 1.000000
0:27 Branch: Return
0:29 Function Definition: radians(b1; (bool)
0:29 Function Parameters:
0:29 'x' (in bool)
0:31 Sequence
0:31 Branch: Return with expression
0:31 Constant:
0:31 true (const bool)
0:31 Branch: Return
0:36 Function Definition: main( (void)
0:36 Function Parameters:
0:? Sequence

View File

@@ -7,6 +7,7 @@ ERROR: 0:32: 'gl_Position' : no such field in structure
ERROR: 0:32: '=' : cannot convert from 'block{in float gl_PointSize}' to '4-component vector of float'
ERROR: 0:33: 'gl_Position' : member of nameless block was not redeclared
ERROR: 0:33: 'assign' : cannot convert from 'const 4-component vector of float' to 'layout(stream=0 ) gl_Position void'
WARNING: 0:38: 'return' : type conversion on return values was not explicitly allowed until version 420
ERROR: 7 compilation errors. No code generated.
@@ -46,6 +47,12 @@ ERROR: node is still EOpNull!
0:33 'anon@0' (layout(stream=0 ) out block{layout(stream=0 ) gl_PointSize float gl_PointSize, })
0:33 Constant:
0:33 0 (const uint)
0:36 Function Definition: foo5( (float)
0:36 Function Parameters:
0:38 Sequence
0:38 Branch: Return with expression
0:38 Constant:
0:38 4.000000
0:? Linker Objects
0:? 'gl_in' (in implicitly-sized array of block{in float gl_PointSize})
0:? 'anon@0' (layout(stream=0 ) out block{layout(stream=0 ) gl_PointSize float gl_PointSize, })
@@ -93,6 +100,12 @@ ERROR: node is still EOpNull!
0:33 'anon@0' (layout(stream=0 ) out block{layout(stream=0 ) gl_PointSize float gl_PointSize, })
0:33 Constant:
0:33 0 (const uint)
0:36 Function Definition: foo5( (float)
0:36 Function Parameters:
0:38 Sequence
0:38 Branch: Return with expression
0:38 Constant:
0:38 4.000000
0:? Linker Objects
0:? 'gl_in' (in 2-element array of block{in float gl_PointSize})
0:? 'anon@0' (layout(stream=0 ) out block{layout(stream=0 ) gl_PointSize float gl_PointSize, })

View File

@@ -114,6 +114,12 @@ ERROR: node is still EOpNull!
0:44 0 (const int)
0:44 Constant:
0:44 1 (const int)
0:52 Function Definition: foo5( (float)
0:52 Function Parameters:
0:54 Sequence
0:54 Branch: Return with expression
0:54 Convert int to float (float)
0:54 'i' (int)
0:? Linker Objects
0:? 'i' (int)
0:? 'gl_in' (in 3-element array of block{in 4-component vector of float gl_Position, in float gl_PointSize, in implicitly-sized array of float gl_ClipDistance})
@@ -235,6 +241,12 @@ ERROR: node is still EOpNull!
0:44 0 (const int)
0:44 Constant:
0:44 1 (const int)
0:52 Function Definition: foo5( (float)
0:52 Function Parameters:
0:54 Sequence
0:54 Branch: Return with expression
0:54 Convert int to float (float)
0:54 'i' (int)
0:? Linker Objects
0:? 'i' (int)
0:? 'gl_in' (in 3-element array of block{in 4-component vector of float gl_Position, in float gl_PointSize, in 1-element array of float gl_ClipDistance})

View File

@@ -19,7 +19,7 @@ ERROR: 0:63: '' : array size required
ERROR: 0:66: '=' : cannot convert from '3-component vector of float' to 'float'
ERROR: 0:76: 'bar' : no matching overloaded function found
ERROR: 0:79: '' : array size required
ERROR: 0:84: 'return' : function return is not matching type:
ERROR: 0:84: 'return' : type does not match, or is not convertible to, the function's return type
ERROR: 0:93: 'length' : array must be declared with a size before using this method
ERROR: 0:101: '[' : array index out of range '5'
ERROR: 23 compilation errors. No code generated.