Fix ES unsized-array checking: it was one level too low, disallowing some unsized syntax that is legal.

git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@24330 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
John Kessenich 2013-12-04 16:43:00 +00:00
parent d4042f1827
commit 34bd4fbef7
7 changed files with 66 additions and 16 deletions

View File

@ -133,3 +133,17 @@ 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
void foo2349()
{
float[] x = float[] (1.0, 2.0, 3.0);
float[] y = x;
float[3] z = x;
float[3] w;
w = y;
}
int[] foo213234(); // ERROR
int foo234234(float[]); // ERROR
int foo234235(vec2[] v); // ERROR
precision highp float[2]; // ERROR

View File

@ -57,3 +57,7 @@ void main()
ica[3.1] = 3; // ERROR
ica[u[1]] = 4; // ERROR
}
int[] foo213234(); // ERROR
int foo234234(float[]); // ERROR
int foo234235(vec2[] v); // ERROR

View File

@ -31,7 +31,11 @@ ERROR: 0:125: 'texture' : no matching overloaded function found
ERROR: 0:127: 'textureProjOffset' : no matching overloaded function found
ERROR: 0:132: 'highp' : overloaded functions must have the same parameter precision qualifiers for argument 2
ERROR: 0:135: 'in' : overloaded functions must have the same parameter storage qualifiers for argument 2
ERROR: 32 compilation errors. No code generated.
ERROR: 0:146: '' : array size required
ERROR: 0:147: '' : array size required
ERROR: 0:148: '' : array size required
ERROR: 0:149: 'float' : cannot apply precision statement to this type; use 'float', 'int' or a sampler type
ERROR: 36 compilation errors. No code generated.
ERROR: node is still EOpNull!
@ -216,6 +220,27 @@ ERROR: node is still EOpNull!
0:128 Constant:
0:128 1 (const int)
0:128 1 (const int)
0:137 Function Definition: foo2349( (void)
0:137 Function Parameters:
0:139 Sequence
0:139 Sequence
0:139 move second child to first child (3-element array of highp float)
0:139 'x' (3-element array of highp float)
0:139 Constant:
0:139 1.000000
0:139 2.000000
0:139 3.000000
0:140 Sequence
0:140 move second child to first child (3-element array of highp float)
0:140 'y' (3-element array of highp float)
0:140 'x' (3-element array of highp float)
0:141 Sequence
0:141 move second child to first child (3-element array of highp float)
0:141 'z' (3-element array of highp float)
0:141 'x' (3-element array of highp float)
0:143 move second child to first child (3-element array of highp float)
0:143 'w' (3-element array of highp float)
0:143 'y' (3-element array of highp float)
0:? Linker Objects
0:? 'm43' (uniform highp 4X3 matrix of float)
0:? 'm33' (uniform highp 3X3 matrix of float)

View File

@ -14,7 +14,10 @@ ERROR: 0:56: '=' : cannot convert from 'const 2-element array of int' to '3-ele
ERROR: 0:57: '[]' : scalar integer expression required
ERROR: 0:57: '[' : index out of range '-858993459'
ERROR: 0:58: '[]' : scalar integer expression required
ERROR: 14 compilation errors. No code generated.
ERROR: 0:61: '' : array size required
ERROR: 0:62: '' : array size required
ERROR: 0:63: '' : array size required
ERROR: 17 compilation errors. No code generated.
ERROR: node is still EOpNull!

View File

@ -9,5 +9,5 @@
// source have to figure out how to create revision.h just to get a build
// going. However, if it is not updated, it can be a version behind.
#define GLSLANG_REVISION "24314"
#define GLSLANG_DATE "2013/12/03 21:43:40"
#define GLSLANG_REVISION "24315"
#define GLSLANG_DATE "2013/12/03 21:47:57"

View File

@ -2883,16 +2883,21 @@ TIntermNode* TParseContext::declareVariable(TSourceLoc loc, TString& identifier,
reservedErrorCheck(loc, identifier);
// Declare the variable
if (arraySizes) {
// for ES, since size isn't coming from an initializer, it has to be explicitly declared now
if (profile == EEsProfile && ! initializer)
arraySizeRequiredCheck(loc, arraySizes->getSize());
if (arraySizes || type.isArray()) {
// Arrayness is potentially coming both from the type and from the
// variable: "int[] a[];" or just one or the other.
// For now, arrays of arrays aren't supported, so it's just one or the
// other. Move it to the type, so all arrayness is part of the type.
arrayDimCheck(loc, &type, arraySizes);
if (! arrayQualifierError(loc, type.getQualifier())) {
if (arraySizes)
type.setArraySizes(arraySizes);
// for ES, if size isn't coming from an initializer, it has to be explicitly declared now
if (profile == EEsProfile && ! initializer)
arraySizeRequiredCheck(loc, type.getArraySize());
if (! arrayQualifierError(loc, type.getQualifier()))
declareArray(loc, identifier, type, symbol, newDeclaration);
}
if (initializer) {
profileRequires(loc, ENoProfile, 120, GL_3DL_array_objects, "initializer");

View File

@ -761,7 +761,6 @@ declaration
// lazy setting of the previous scope's defaults, has effect only the first time it is called in a particular scope
parseContext.symbolTable.setPreviousDefaultPrecisions(&parseContext.defaultPrecision[0]);
parseContext.setDefaultPrecision($1.loc, $3, $2.qualifier.precision);
$$ = 0;
}
@ -870,6 +869,8 @@ function_header
parseContext.error($2.loc, "no qualifiers allowed for function return",
GetStorageQualifierString($1.qualifier.storage), "");
}
if ($1.arraySizes)
parseContext.arraySizeRequiredCheck($1.loc, $1.arraySizes->getSize());
// Add the function as a prototype after parsing it (we do not support recursion)
TFunction *function;
@ -958,6 +959,8 @@ parameter_type_specifier
: type_specifier {
TParameter param = { 0, new TType($1) };
$$.param = param;
if ($1.arraySizes)
parseContext.arraySizeRequiredCheck($1.loc, $1.arraySizes->getSize());
}
;
@ -1024,8 +1027,6 @@ fully_specified_type
if ($1.arraySizes) {
parseContext.profileRequires($1.loc, ENoProfile, 120, GL_3DL_array_objects, "arrayed type");
parseContext.profileRequires($1.loc, EEsProfile, 300, 0, "arrayed type");
if (parseContext.profile == EEsProfile)
parseContext.arraySizeRequiredCheck($1.loc, $1.arraySizes->getSize());
}
parseContext.precisionQualifierCheck($$.loc, $$);
@ -1037,8 +1038,6 @@ fully_specified_type
if ($2.arraySizes) {
parseContext.profileRequires($2.loc, ENoProfile, 120, GL_3DL_array_objects, "arrayed type");
parseContext.profileRequires($2.loc, EEsProfile, 300, 0, "arrayed type");
if (parseContext.profile == EEsProfile)
parseContext.arraySizeRequiredCheck($2.loc, $2.arraySizes->getSize());
}
if ($2.arraySizes && parseContext.arrayQualifierError($2.loc, $1.qualifier))