Add semantic check for precision qualifier on wrong kind of type. Added a few more tests.
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@22170 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
@@ -78,7 +78,23 @@ void main()
|
|||||||
bool b;
|
bool b;
|
||||||
gl_FragColor += b ? v : m; // ERROR, types don't match around ":"
|
gl_FragColor += b ? v : m; // ERROR, types don't match around ":"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gl_FragColor.xr; // ERROR, swizzlers not from same field space
|
||||||
|
centTexCoord.z; // ERROR, swizzler out of range
|
||||||
|
(a,b) = true; // ERROR, not an l-value
|
||||||
}
|
}
|
||||||
|
|
||||||
float imageBuffer;
|
float imageBuffer;
|
||||||
float uimage2DRect;
|
float uimage2DRect;
|
||||||
|
|
||||||
|
int main() {} // ERROR
|
||||||
|
void main(int a) {} // ERROR
|
||||||
|
|
||||||
|
const int a; // ERROR
|
||||||
|
|
||||||
|
int foo(in float a);
|
||||||
|
int foo(out float a) // ERROR
|
||||||
|
{
|
||||||
|
return 3.2; // ERROR
|
||||||
|
foo(a); // ERROR
|
||||||
|
}
|
||||||
|
|||||||
@@ -54,4 +54,6 @@ void main()
|
|||||||
const int ca3[3] = int[](3, 2); // ERROR
|
const int ca3[3] = int[](3, 2); // ERROR
|
||||||
int ica[] = int[](3, 2);
|
int ica[] = int[](3, 2);
|
||||||
int ica3[3] = int[](3, 2); // ERROR
|
int ica3[3] = int[](3, 2); // ERROR
|
||||||
|
ica[3.1] = 3; // ERROR
|
||||||
|
ica[u[1]] = 4; // ERROR
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,3 +68,9 @@ void main()
|
|||||||
texture2D(samplerMed, vec2(0.1, 0.2));
|
texture2D(samplerMed, vec2(0.1, 0.2));
|
||||||
texture2D(samplerHigh, vec2(0.1, 0.2));
|
texture2D(samplerHigh, vec2(0.1, 0.2));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
precision mediump bool; // ERROR
|
||||||
|
//precision mediump struct { int a; } s; // ERROR
|
||||||
|
struct s {int a;};
|
||||||
|
precision mediump s; // ERROR
|
||||||
|
mediump bvec2 b2; // ERROR
|
||||||
|
|||||||
@@ -891,7 +891,8 @@ void TParseContext::precisionQualifierCheck(int line, TPublicType& publicType)
|
|||||||
if (publicType.basicType == EbtFloat || publicType.basicType == EbtUint || publicType.basicType == EbtInt || publicType.basicType == EbtSampler) {
|
if (publicType.basicType == EbtFloat || publicType.basicType == EbtUint || publicType.basicType == EbtInt || publicType.basicType == EbtSampler) {
|
||||||
if (publicType.qualifier.precision == EpqNone)
|
if (publicType.qualifier.precision == EpqNone)
|
||||||
error(line, "type requires declaration of default precision qualifier", TType::getBasicString(publicType.basicType), "");
|
error(line, "type requires declaration of default precision qualifier", TType::getBasicString(publicType.basicType), "");
|
||||||
}
|
} else if (publicType.qualifier.precision != EpqNone)
|
||||||
|
error(line, "type cannot have precision qualifier", TType::getBasicString(publicType.basicType), "");
|
||||||
}
|
}
|
||||||
|
|
||||||
void TParseContext::parameterSamplerCheck(int line, TStorageQualifier qualifier, const TType& type)
|
void TParseContext::parameterSamplerCheck(int line, TStorageQualifier qualifier, const TType& type)
|
||||||
|
|||||||
Reference in New Issue
Block a user