Add missing precision qualifier checks to function formal parameter declarations.
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@28442 e7fa87d3-cd2b-0410-9028-fcbf551c1848
diff --git a/Test/300.frag b/Test/300.frag
index 9be2818..84db696 100644
--- a/Test/300.frag
+++ b/Test/300.frag
@@ -1,5 +1,5 @@
#version 300 es
-
+void nodef1(float f); // ERROR, no default precision
uniform sampler2D s2D;
uniform lowp sampler3D s3D;
uniform samplerCube sCube;
diff --git a/Test/310.frag b/Test/310.frag
index 1db4ca6..25d8d4a 100644
--- a/Test/310.frag
+++ b/Test/310.frag
@@ -1,5 +1,5 @@
#version 310 es
-
+highp float nodef3(float); // ERROR, no default precision
precision mediump float;
precision highp usampler2D;
precision highp sampler2D;
diff --git a/Test/baseResults/300.frag.out b/Test/baseResults/300.frag.out
index be58e28..6835902 100644
--- a/Test/baseResults/300.frag.out
+++ b/Test/baseResults/300.frag.out
@@ -1,4 +1,5 @@
300.frag
+ERROR: 0:2: 'float' : type requires declaration of default precision qualifier
ERROR: 0:30: 'noperspective' : Reserved word.
ERROR: 0:30: 'noperspective' : not supported with this profile: es
ERROR: 0:31: 'sampler2D' : sampler/image types can only be used in uniform variables or function parameters: bads
@@ -37,7 +38,7 @@
ERROR: 0:150: 'early_fragment_tests' : not supported for this version or the enabled extensions
ERROR: 0:152: 'imageBuffer' : Reserved word.
ERROR: 0:152: '' : syntax error
-ERROR: 38 compilation errors. No code generated.
+ERROR: 39 compilation errors. No code generated.
Shader version: 300
diff --git a/Test/baseResults/310.frag.out b/Test/baseResults/310.frag.out
index 5d4c895..c582327 100644
--- a/Test/baseResults/310.frag.out
+++ b/Test/baseResults/310.frag.out
@@ -1,5 +1,6 @@
310.frag
Warning, version 310 is not yet complete; most version-specific features are present, but some are missing.
+ERROR: 0:2: 'float' : type requires declaration of default precision qualifier
ERROR: 0:8: 'origin_upper_left' : not supported with this profile: es
ERROR: 0:8: 'pixel_center_integer' : not supported with this profile: es
ERROR: 0:8: 'gl_FragCoord' : identifiers starting with "gl_" are reserved
@@ -28,7 +29,7 @@
ERROR: 0:103: 'image2D' : sampler/image types can only be used in uniform variables or function parameters: imageOut
ERROR: 0:103: '' : image variables not declared 'writeonly' must have a format layout qualifier
ERROR: 0:104: 'out' : cannot be a matrix
-ERROR: 28 compilation errors. No code generated.
+ERROR: 29 compilation errors. No code generated.
Shader version: 310
diff --git a/glslang/MachineIndependent/glslang.y b/glslang/MachineIndependent/glslang.y
index 5966940..c336564 100644
--- a/glslang/MachineIndependent/glslang.y
+++ b/glslang/MachineIndependent/glslang.y
@@ -811,6 +811,7 @@
parseContext.error($2.loc, "illegal use of type 'void'", $2.string->c_str(), "");
}
parseContext.reservedErrorCheck($2.loc, *$2.string);
+ parseContext.precisionQualifierCheck($1.loc, $1);
TParameter param = {$2.string, new TType($1)};
$$.loc = $2.loc;
@@ -825,7 +826,8 @@
parseContext.arrayDimCheck($2.loc, $1.arraySizes, $3.arraySizes);
parseContext.arraySizeRequiredCheck($3.loc, $3.arraySizes->getSize());
- parseContext.reservedErrorCheck($2.loc, *$2.string);
+ parseContext.reservedErrorCheck($2.loc, *$2.string);
+ parseContext.precisionQualifierCheck($1.loc, $1);
$1.arraySizes = $3.arraySizes;
@@ -880,6 +882,7 @@
$$.param = param;
if ($1.arraySizes)
parseContext.arraySizeRequiredCheck($1.loc, $1.arraySizes->getSize());
+ parseContext.precisionQualifierCheck($1.loc, $1);
}
;