Give error when overloaded functions differ only on a parameter's precision qualifier.

git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@24302 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
John Kessenich 2013-12-03 21:04:03 +00:00
parent 4e734dd68b
commit 143c8bf10f
9 changed files with 24 additions and 6 deletions

Binary file not shown.

View File

@ -163,4 +163,7 @@ void foo323433()
textureCubeGradEXT(sCube, vec3(f13), vec3(f13), vec3(f13));
}
int fgfg(float f, mediump int i);
int fgfg(float f, highp int i); // ERROR, precision qualifier difference
uniform samplerExternalOES badExt; // syntax ERROR

View 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

View 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);

View File

@ -62,8 +62,9 @@ ERROR: 0:145: 'a' : redefinition
ERROR: 0:147: 'texture2DProjGradEXT' : required extension not requested: GL_EXT_shader_texture_lod
ERROR: 0:151: 'floating-point suffix' : not supported for this version or the enabled extensions
ERROR: 0:152: 'floating-point suffix' : not supported for this version or the enabled extensions
ERROR: 0:166: '' : syntax error
ERROR: 57 compilation errors. No code generated.
ERROR: 0:167: 'highp' : overloaded functions must have the same parameter precision qualifiers
ERROR: 0:169: '' : syntax error
ERROR: 58 compilation errors. No code generated.
ERROR: node is still EOpNull!

View File

@ -26,7 +26,7 @@ ERROR: 0:91: 'main' : function already has a body
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 qualifiers
ERROR: 0:97: 'out' : overloaded functions must have the same parameter storage qualifiers
ERROR: 0:99: 'return' : function return is not matching type:
ERROR: 0:115: 'return' : void function cannot return a value
ERROR: 0:125: 'gl_TexCoord' : redeclaration of array with size

View 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
ERROR: 0:52: 'arrays of arrays' : not supported with this profile: none
ERROR: 0:53: 'arrays of arrays' : not supported with this profile: none
ERROR: 0:56: 'out' : overloaded functions must have the same parameter qualifiers
ERROR: 0:56: 'out' : overloaded functions must have the same parameter storage qualifiers
ERROR: 0:57: 'float' : overloaded functions must have the same return type
ERROR: 0:87: 'overloadC' : no matching overloaded function found
ERROR: 0:90: 'overloadC' : no matching overloaded function found

View File

@ -29,7 +29,9 @@ ERROR: 0:121: 'textureSize' : no matching overloaded function found
ERROR: 0:123: 'textureSize' : no matching overloaded function found
ERROR: 0:125: 'texture' : no matching overloaded function found
ERROR: 0:127: 'textureProjOffset' : no matching overloaded function found
ERROR: 30 compilation errors. No code generated.
ERROR: 0:132: 'highp' : overloaded functions must have the same parameter precision qualifiers
ERROR: 0:135: 'in' : overloaded functions must have the same parameter storage qualifiers
ERROR: 32 compilation errors. No code generated.
ERROR: node is still EOpNull!

View 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);
}
}