Fix, and add missing tests for, error catching for applying swizzles to arrays.
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@26858 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
parent
6e62d92cfb
commit
974258d88f
@ -178,4 +178,20 @@ int agggf(float f); // ERROR, second prototype
|
||||
|
||||
varying struct SSS { float f; } s; // ERROR
|
||||
|
||||
int vf(void);
|
||||
int vf2();
|
||||
int vf3(void v); // ERROR
|
||||
int vf4(int, void); // ERROR
|
||||
int vf5(int, void v); // ERROR
|
||||
|
||||
void badswizzle()
|
||||
{
|
||||
vec3 a[5];
|
||||
a.y; // ERROR, no array swizzle
|
||||
a.zy; // ERROR, no array swizzle
|
||||
a.nothing; // ERROR
|
||||
a.length(); // ERROR, not this version
|
||||
a.method(); // ERROR
|
||||
}
|
||||
|
||||
uniform samplerExternalOES badExt; // syntax ERROR
|
||||
|
@ -67,8 +67,18 @@ ERROR: 0:167: 'highp' : overloaded functions must have the same parameter precis
|
||||
ERROR: 0:170: 'multiple prototypes for same function' : not supported for this version or the enabled extensions
|
||||
ERROR: 0:177: 'multiple prototypes for same function' : not supported for this version or the enabled extensions
|
||||
ERROR: 0:179: 'fragment-shader struct input' : not supported for this version or the enabled extensions
|
||||
ERROR: 0:181: '' : syntax error
|
||||
ERROR: 62 compilation errors. No code generated.
|
||||
ERROR: 0:183: 'v' : illegal use of type 'void'
|
||||
ERROR: 0:184: 'void' : cannot be an argument type except for '(void)'
|
||||
ERROR: 0:185: 'v' : illegal use of type 'void'
|
||||
ERROR: 0:185: 'void' : cannot be an argument type except for '(void)'
|
||||
ERROR: 0:190: '.' : cannot apply to an array: y
|
||||
ERROR: 0:191: '.' : cannot apply to an array: zy
|
||||
ERROR: 0:192: '.' : cannot apply to an array: nothing
|
||||
ERROR: 0:193: '.length' : not supported for this version or the enabled extensions
|
||||
ERROR: 0:194: '.' : cannot apply to an array: method
|
||||
ERROR: 0:194: 'a' : can't use function syntax on variable
|
||||
ERROR: 0:197: '' : syntax error
|
||||
ERROR: 72 compilation errors. No code generated.
|
||||
|
||||
|
||||
Shader version: 100
|
||||
@ -326,6 +336,16 @@ ERROR: node is still EOpNull!
|
||||
0:175 Branch: Return with expression
|
||||
0:175 Constant:
|
||||
0:175 2 (const int)
|
||||
0:187 Function Definition: badswizzle( (void)
|
||||
0:187 Function Parameters:
|
||||
0:? Sequence
|
||||
0:190 'a' (5-element array of mediump 3-component vector of float)
|
||||
0:191 'a' (5-element array of mediump 3-component vector of float)
|
||||
0:192 'a' (5-element array of mediump 3-component vector of float)
|
||||
0:193 Constant:
|
||||
0:193 5 (const int)
|
||||
0:194 Constant:
|
||||
0:194 0.000000
|
||||
0:? Linker Objects
|
||||
0:? 'a' (3-element array of mediump int)
|
||||
0:? 'uint' (mediump int)
|
||||
@ -610,6 +630,16 @@ ERROR: node is still EOpNull!
|
||||
0:175 Branch: Return with expression
|
||||
0:175 Constant:
|
||||
0:175 2 (const int)
|
||||
0:187 Function Definition: badswizzle( (void)
|
||||
0:187 Function Parameters:
|
||||
0:? Sequence
|
||||
0:190 'a' (5-element array of mediump 3-component vector of float)
|
||||
0:191 'a' (5-element array of mediump 3-component vector of float)
|
||||
0:192 'a' (5-element array of mediump 3-component vector of float)
|
||||
0:193 Constant:
|
||||
0:193 5 (const int)
|
||||
0:194 Constant:
|
||||
0:194 0.000000
|
||||
0:? Linker Objects
|
||||
0:? 'a' (3-element array of mediump int)
|
||||
0:? 'uint' (mediump int)
|
||||
|
@ -11,9 +11,9 @@ ERROR: 0:21: 'assign' : l-value required (can't modify a const)
|
||||
ERROR: 0:28: 'length' : array must be declared with a size before using this method
|
||||
ERROR: 0:31: 'length' : incomplete method syntax
|
||||
ERROR: 0:32: 'length' : method does not accept any arguments
|
||||
ERROR: 0:33: 'flizbit' : does not apply to this type: 7-element array of float
|
||||
ERROR: 0:33: '.' : cannot apply to an array: flizbit
|
||||
ERROR: 0:33: '=' : cannot convert from '7-element array of float' to 'int'
|
||||
ERROR: 0:34: 'flizbit' : does not apply to this type: 7-element array of float
|
||||
ERROR: 0:34: '.' : cannot apply to an array: flizbit
|
||||
ERROR: 0:34: 'f' : can't use function syntax on variable
|
||||
ERROR: 0:34: 'a4' : redefinition
|
||||
ERROR: 0:35: 'arrays of arrays' : not supported with this profile: none
|
||||
|
@ -697,6 +697,17 @@ TIntermTyped* TParseContext::handleDotDereference(TSourceLoc loc, TIntermTyped*
|
||||
return intermediate.addMethod(base, TType(EbtInt), &field, loc);
|
||||
}
|
||||
|
||||
// It's not .length() if we get to here.
|
||||
|
||||
if (base->isArray()) {
|
||||
error(loc, "cannot apply to an array:", ".", field.c_str());
|
||||
|
||||
return base;
|
||||
}
|
||||
|
||||
// It's neither an array nor .length() if we get here,
|
||||
// leaving swizzles and struct/block dereferences.
|
||||
|
||||
TIntermTyped* result = base;
|
||||
if (base->isVector() || base->isScalar()) {
|
||||
if (base->isScalar()) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user