#error GL_ES is not set
#endif
}
+
+float badsize[]; // ERROR
+float[] badsize2; // ERROR
+uniform ub {
+ int a[]; // ERROR
+} ubInst[]; // ERROR
+void foo(int a[]); // ERROR
+float okayA[] = float[](3.0, 4.0); // Okay
vec2 v16 = unpackUnorm2x16(uy);
uint u17 = packHalf2x16(v2b);
vec2 v18 = unpackHalf2x16(uy);
+
+ // not present
+ noise2(v18);
}
#version 100
-float gu[];
+float gu[]; // ERROR
float g4[4];
float g5[5];
gu[2] = 4.0; // ERROR, overflow
}
- gu[2] = 4.0; // okay
-
- gu[3] = 3.0;
- gu[a] = 5.0; // ERROR
-
g4 = foo(g5);
g5 = g4; // ERROR
gu = g4; // ERROR
if (float[4](1.0, 2.0, 3.0, 4.0) == g4) // ERROR
gu[0] = 2.0;
- float u[];
- u[2] = 3.0; // okay
float u[5];
u[5] = 5.0; // ERROR
foo(u); // okay
#if ((AA == BB || (AA == CC))))
#error bad6
#endif
+
+#define PASTE(a,b) a ## b
+float PASTE(tod, ay) = 17;
//
// Noise functions.
//
- s.append(TString("float noise1(float x);"));
- s.append(TString("float noise1(vec2 x);"));
- s.append(TString("float noise1(vec3 x);"));
- s.append(TString("float noise1(vec4 x);"));
-
- s.append(TString("vec2 noise2(float x);"));
- s.append(TString("vec2 noise2(vec2 x);"));
- s.append(TString("vec2 noise2(vec3 x);"));
- s.append(TString("vec2 noise2(vec4 x);"));
-
- s.append(TString("vec3 noise3(float x);"));
- s.append(TString("vec3 noise3(vec2 x);"));
- s.append(TString("vec3 noise3(vec3 x);"));
- s.append(TString("vec3 noise3(vec4 x);"));
-
- s.append(TString("vec4 noise4(float x);"));
- s.append(TString("vec4 noise4(vec2 x);"));
- s.append(TString("vec4 noise4(vec3 x);"));
- s.append(TString("vec4 noise4(vec4 x);"));
+ if (profile != EEsProfile) {
+ s.append(TString("float noise1(float x);"));
+ s.append(TString("float noise1(vec2 x);"));
+ s.append(TString("float noise1(vec3 x);"));
+ s.append(TString("float noise1(vec4 x);"));
+
+ s.append(TString("vec2 noise2(float x);"));
+ s.append(TString("vec2 noise2(vec2 x);"));
+ s.append(TString("vec2 noise2(vec3 x);"));
+ s.append(TString("vec2 noise2(vec4 x);"));
+
+ s.append(TString("vec3 noise3(float x);"));
+ s.append(TString("vec3 noise3(vec2 x);"));
+ s.append(TString("vec3 noise3(vec3 x);"));
+ s.append(TString("vec3 noise3(vec4 x);"));
+
+ s.append(TString("vec4 noise4(float x);"));
+ s.append(TString("vec4 noise4(vec2 x);"));
+ s.append(TString("vec4 noise4(vec3 x);"));
+ s.append(TString("vec4 noise4(vec4 x);"));
- s.append(TString("\n"));
+ s.append(TString("\n"));
+ }
}
{
//============================================================================
//
// Returns true if there was an error in construction.
//
-bool TParseContext::constructorError(int line, TIntermNode* node, TFunction& function, TOperator op, TType* type)
+bool TParseContext::constructorError(int line, TIntermNode* node, TFunction& function, TOperator op, TType& type)
{
- *type = function.getReturnType();
+ type = function.getReturnType();
bool constructingMatrix = false;
switch(op) {
matrixInMatrix = true;
if (full)
overFull = true;
- if (op != EOpConstructStruct && !type->isArray() && size >= type->getObjectSize())
+ if (op != EOpConstructStruct && ! type.isArray() && size >= type.getObjectSize())
full = true;
if (function[i].type->getQualifier().storage != EvqConst)
constType = false;
}
if (constType)
- type->getQualifier().storage = EvqConst;
+ type.getQualifier().storage = EvqConst;
- if (type->isArray()) {
- if (type->getArraySize() == 0) {
+ if (type.isArray()) {
+ if (type.getArraySize() == 0) {
// auto adapt the constructor type to the number of arguments
- type->changeArraySize(function.getParamCount());
- } else if (type->getArraySize() != function.getParamCount()) {
+ type.changeArraySize(function.getParamCount());
+ } else if (type.getArraySize() != function.getParamCount()) {
error(line, "array constructor needs one argument per array element", "constructor", "");
return true;
}
return true;
}
- if (matrixInMatrix && !type->isArray()) {
+ if (matrixInMatrix && ! type.isArray()) {
profileRequires(line, ENoProfile, 120, 0, "constructing matrix from matrix");
return false;
}
return true;
}
- if (op == EOpConstructStruct && !type->isArray() && type->getStruct()->size() != function.getParamCount()) {
+ if (op == EOpConstructStruct && ! type.isArray() && type.getStruct()->size() != function.getParamCount()) {
error(line, "Number of constructor parameters does not match the number of structure fields", "constructor", "");
return true;
}
- if ((op != EOpConstructStruct && size != 1 && size < type->getObjectSize()) ||
- (op == EOpConstructStruct && size < type->getObjectSize())) {
+ if ((op != EOpConstructStruct && size != 1 && size < type.getObjectSize()) ||
+ (op == EOpConstructStruct && size < type.getObjectSize())) {
error(line, "not enough data provided for construction", "constructor", "");
return true;
}
if (instanceName && reservedErrorCheck(line, *instanceName))
return;
+ if (profile == EEsProfile && arraySizes)
+ arraySizeRequiredCheck(line, arraySizes->front());
+
if (blockType.basicType != EbtVoid) {
error(line, "interface blocks cannot be declared with a type", blockName->c_str(), "");
void constCheck(TIntermTyped* node);
void integerCheck(TIntermTyped* node, const char* token);
void globalCheck(int line, bool global, const char* token);
- bool constructorError(int line, TIntermNode*, TFunction&, TOperator, TType*);
+ bool constructorError(int line, TIntermNode*, TFunction&, TOperator, TType&);
void arraySizeCheck(int line, TIntermTyped* expr, int& size);
bool arrayQualifierError(int line, const TPublicType&);
void arraySizeRequiredCheck(int line, int& size);
// Their parameters will be verified algorithmically.\r
//\r
TType type(EbtVoid); // use this to get the type back\r
- if (parseContext.constructorError($1.line, $1.intermNode, *fnCall, op, &type)) {\r
+ if (parseContext.constructorError($1.line, $1.intermNode, *fnCall, op, type)) {\r
$$ = 0;\r
} else {\r
//\r
$$ = 0;\r
}\r
| type_qualifier IDENTIFIER SEMICOLON {\r
+ // TODO: functionality: track what variables are declared with INVARIANT\r
// precise foo;\r
// invariant foo;\r
$$ = 0;\r
}\r
| type_qualifier IDENTIFIER identifier_list SEMICOLON {\r
+ // TODO: functionality: track what variables are declared with INVARIANT\r
// precise foo, bar;\r
// invariant foo, bar;\r
$$ = 0;\r
if ($1.arraySizes) {\r
parseContext.profileRequires($1.line, ENoProfile, 120, "GL_3DL_array_objects", "arrayed type");\r
parseContext.profileRequires($1.line, EEsProfile, 300, 0, "arrayed type");\r
+ parseContext.arraySizeRequiredCheck($1.line, $1.arraySizes->front());\r
}\r
if ($1.basicType == EbtVoid) {\r
parseContext.error($2.line, "illegal use of type 'void'", $2.string->c_str(), "");\r
if ($1.arraySizes) {\r
parseContext.profileRequires($1.line, ENoProfile, 120, "GL_3DL_array_objects", "arrayed type");\r
parseContext.profileRequires($1.line, EEsProfile, 300, 0, "arrayed type");\r
+ parseContext.arraySizeRequiredCheck($1.line, $1.arraySizes->front());\r
}\r
\r
parseContext.arraySizeRequiredCheck($3.line, $3.arraySizes->front());\r
}\r
| init_declarator_list COMMA IDENTIFIER array_specifier {\r
parseContext.nonInitConstCheck($3.line, *$3.string, $1.type);\r
-\r
+ if (parseContext.profile == EEsProfile)\r
+ parseContext.arraySizeRequiredCheck($4.line, $4.arraySizes->front());\r
+ \r
$$ = $1;\r
\r
if (! parseContext.arrayQualifierError($4.line, $1.type)) {\r
}\r
| fully_specified_type IDENTIFIER array_specifier {\r
$$.intermAggregate = 0;\r
- parseContext.nonInitConstCheck($2.line, *$2.string, $1);\r
+ parseContext.nonInitConstCheck($2.line, *$2.string, $1); \r
+ if (parseContext.profile == EEsProfile)\r
+ parseContext.arraySizeRequiredCheck($3.line, $3.arraySizes->front());\r
\r
$$.type = $1;\r
\r
if ($1.arraySizes) {\r
parseContext.profileRequires($1.line, ENoProfile, 120, "GL_3DL_array_objects", "arrayed type");\r
parseContext.profileRequires($1.line, EEsProfile, 300, 0, "arrayed type");\r
+ if (parseContext.profile == EEsProfile)\r
+ parseContext.arraySizeRequiredCheck($1.line, $1.arraySizes->front());\r
}\r
}\r
| type_qualifier type_specifier {\r
if ($2.arraySizes) {\r
parseContext.profileRequires($2.line, ENoProfile, 120, "GL_3DL_array_objects", "arrayed type");\r
parseContext.profileRequires($2.line, EEsProfile, 300, 0, "arrayed type");\r
+ if (parseContext.profile == EEsProfile)\r
+ parseContext.arraySizeRequiredCheck($2.line, $2.arraySizes->front());\r
}\r
\r
if ($2.arraySizes && parseContext.arrayQualifierError($2.line, $1))\r
$$ = $1;\r
$$.qualifier.precision = parseContext.defaultPrecision[$$.basicType];\r
}\r
- | type_specifier_nonarray array_specifier {\r
+ | type_specifier_nonarray array_specifier { \r
$$ = $1;\r
$$.qualifier.precision = parseContext.defaultPrecision[$$.basicType];\r
$$.arraySizes = $2.arraySizes;\r
if ($1.arraySizes) {\r
parseContext.profileRequires($1.line, ENoProfile, 120, "GL_3DL_array_objects", "arrayed type");\r
parseContext.profileRequires($1.line, EEsProfile, 300, 0, "arrayed type");\r
+ if (parseContext.profile == EEsProfile)\r
+ parseContext.arraySizeRequiredCheck($1.line, $1.arraySizes->front());\r
}\r
\r
$$ = $2;\r
if ($2.arraySizes) {\r
parseContext.profileRequires($2.line, ENoProfile, 120, "GL_3DL_array_objects", "arrayed type");\r
parseContext.profileRequires($2.line, EEsProfile, 300, 0, "arrayed type");\r
+ if (parseContext.profile == EEsProfile)\r
+ parseContext.arraySizeRequiredCheck($2.line, $2.arraySizes->front());\r
}\r
\r
$$ = $3;\r
$$.line = $1.line;\r
$$.type->setFieldName(*$1.string);\r
}\r
- | IDENTIFIER array_specifier {\r
+ | IDENTIFIER array_specifier { \r
+ if (parseContext.profile == EEsProfile)\r
+ parseContext.arraySizeRequiredCheck($2.line, $2.arraySizes->front());\r
$$.type = new TType(EbtVoid);\r
$$.line = $1.line;\r
$$.type->setFieldName(*$1.string);\r