Give error when overloaded functions differ only on a parameter's precision qualifier.
authorJohn Kessenich <cepheus@frii.com>
Tue, 3 Dec 2013 21:04:03 +0000 (21:04 +0000)
committerJohn Kessenich <cepheus@frii.com>
Tue, 3 Dec 2013 21:04:03 +0000 (21:04 +0000)
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@24302 e7fa87d3-cd2b-0410-9028-fcbf551c1848

Install/Windows/glslangValidator.exe
Test/100.frag
Test/300.vert
Test/420.vert
Test/baseResults/100.frag.out
Test/baseResults/120.frag.out
Test/baseResults/120.vert.out
Test/baseResults/300.vert.out
glslang/MachineIndependent/ParseHelper.cpp

index cf9fc6a..8138d0e 100644 (file)
Binary files a/Install/Windows/glslangValidator.exe and b/Install/Windows/glslangValidator.exe differ
index abe3ed1..51e2c5f 100644 (file)
@@ -163,4 +163,7 @@ void foo323433()
     textureCubeGradEXT(sCube, vec3(f13), vec3(f13), vec3(f13));\r
 }\r
 \r
+int fgfg(float f, mediump int i);\r
+int fgfg(float f, highp int i);   // ERROR, precision qualifier difference\r
+\r
 uniform samplerExternalOES badExt;  // syntax ERROR\r
index 800ffbe..982becf 100644 (file)
@@ -127,3 +127,9 @@ void foo23()
     textureProjOffset(s3D, vec4(0.2), ivec3(1), .03);  // ERROR, bias
     float x6 = textureProjGradOffset(s2DS, invIn, vec2(4.2), vec2(5.3), ivec2(1));
 }
+
+int fgfg(float f, mediump int i);
+int fgfg(float f, highp int i);   // ERROR, precision qualifier difference
+
+int fgfgh(float f, const in mediump int i);
+int fgfgh(float f, in mediump int i);   // ERROR, precision qualifier difference
index 3a26852..2846552 100644 (file)
@@ -74,3 +74,6 @@ layout(binding = 5) uniform sampler2D sampb2[10];
 layout(binding = 32) uniform sampler2D sampb3; // ERROR, binding too big
 layout(binding = 31) uniform sampler2D sampb4;
 layout(binding = 31) uniform sampler2D sampb5[2]; // ERROR, binding too big
+
+int fgfg(float f, mediump int i);
+int fgfg(float f, highp int i);
index d36e51d..7311dc5 100644 (file)
@@ -62,8 +62,9 @@ ERROR: 0:145: 'a' : redefinition
 ERROR: 0:147: 'texture2DProjGradEXT' : required extension not requested: GL_EXT_shader_texture_lod\r
 ERROR: 0:151: 'floating-point suffix' : not supported for this version or the enabled extensions \r
 ERROR: 0:152: 'floating-point suffix' : not supported for this version or the enabled extensions \r
-ERROR: 0:166: '' :  syntax error\r
-ERROR: 57 compilation errors.  No code generated.\r
+ERROR: 0:167: 'highp' : overloaded functions must have the same parameter precision qualifiers \r
+ERROR: 0:169: '' :  syntax error\r
+ERROR: 58 compilation errors.  No code generated.\r
 \r
 \r
 ERROR: node is still EOpNull!\r
index 6d55029..10a7723 100644 (file)
@@ -26,7 +26,7 @@ ERROR: 0:91: 'main' : function already has a body
 ERROR: 0:91: 'int' :  main function cannot return a value\r
 ERROR: 0:92: 'main' : function cannot take any parameter(s) \r
 ERROR: 0:94: 'a' : variables with qualifier 'const' must be initialized \r
-ERROR: 0:97: 'out' : overloaded functions must have the same parameter qualifiers \r
+ERROR: 0:97: 'out' : overloaded functions must have the same parameter storage qualifiers \r
 ERROR: 0:99: 'return' : function return is not matching type: \r
 ERROR: 0:115: 'return' : void function cannot return a value \r
 ERROR: 0:125: 'gl_TexCoord' : redeclaration of array with size \r
index 790bb6d..7e50aa7 100644 (file)
@@ -33,7 +33,7 @@ ERROR: 0:50: 'arrays of arrays' : not supported with this profile: none
 ERROR: 0:51: 'arrays of arrays' : not supported with this profile: none\r
 ERROR: 0:52: 'arrays of arrays' : not supported with this profile: none\r
 ERROR: 0:53: 'arrays of arrays' : not supported with this profile: none\r
-ERROR: 0:56: 'out' : overloaded functions must have the same parameter qualifiers \r
+ERROR: 0:56: 'out' : overloaded functions must have the same parameter storage qualifiers \r
 ERROR: 0:57: 'float' : overloaded functions must have the same return type \r
 ERROR: 0:87: 'overloadC' : no matching overloaded function found \r
 ERROR: 0:90: 'overloadC' : no matching overloaded function found \r
index 9cb9ee7..60c120e 100644 (file)
@@ -29,7 +29,9 @@ ERROR: 0:121: 'textureSize' : no matching overloaded function found
 ERROR: 0:123: 'textureSize' : no matching overloaded function found \r
 ERROR: 0:125: 'texture' : no matching overloaded function found \r
 ERROR: 0:127: 'textureProjOffset' : no matching overloaded function found \r
-ERROR: 30 compilation errors.  No code generated.\r
+ERROR: 0:132: 'highp' : overloaded functions must have the same parameter precision qualifiers \r
+ERROR: 0:135: 'in' : overloaded functions must have the same parameter storage qualifiers \r
+ERROR: 32 compilation errors.  No code generated.\r
 \r
 \r
 ERROR: node is still EOpNull!\r
index 34c1b44..d999291 100644 (file)
@@ -699,7 +699,10 @@ TFunction* TParseContext::handleFunctionDeclarator(TSourceLoc loc, TFunction& fu
         }
         for (int i = 0; i < prevDec->getParamCount(); ++i) {
             if ((*prevDec)[i].type->getQualifier().storage != function[i].type->getQualifier().storage)
-                error(loc, "overloaded functions must have the same parameter qualifiers", function[i].type->getStorageQualifierString(), "");
+                error(loc, "overloaded functions must have the same parameter storage qualifiers for argument", function[i].type->getStorageQualifierString(), "%d", i+1);
+
+            if ((*prevDec)[i].type->getQualifier().precision != function[i].type->getQualifier().precision)
+                error(loc, "overloaded functions must have the same parameter precision qualifiers for argument", function[i].type->getPrecisionQualifierString(), "%d", i+1);
         }
     }