Semantics: Catch nested types containing 'int' with non-'flat' interpolation.

This commit is contained in:
John Kessenich 2015-12-22 16:39:07 -07:00
parent 50e57560a1
commit 69d01eadd6
4 changed files with 12 additions and 6 deletions

View File

@ -37,7 +37,7 @@ struct s {
};
in s badout; // ERROR, can't contain a sampler
// ERROR, can't have int in struct without flat
struct S2 {
vec3 c;
float f;

View File

@ -4,6 +4,7 @@ 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
ERROR: 0:32: 'uint' : cannot apply precision statement to this type; use 'float', 'int' or a sampler type
ERROR: 0:39: 'structure' : must be qualified as flat in
ERROR: 0:39: 'structure' : non-uniform struct contains a sampler or image: badout
ERROR: 0:60: 'texel offset' : argument must be compile-time constant
ERROR: 0:62: 'texel offset' : argument must be compile-time constant
@ -43,7 +44,7 @@ ERROR: 0:157: 'invariant' : can only apply to an output
ERROR: 0:158: 'invariant' : can only apply to an output
ERROR: 0:160: 'imageBuffer' : Reserved word.
ERROR: 0:160: '' : syntax error
ERROR: 44 compilation errors. No code generated.
ERROR: 45 compilation errors. No code generated.
Shader version: 300

View File

@ -2,5 +2,5 @@
// For the version, it uses the latest git tag followed by the number of commits.
// For the date, it uses the current date (when then script is run).
#define GLSLANG_REVISION "SPIRV99.864"
#define GLSLANG_DATE "21-Dec-2015"
#define GLSLANG_REVISION "SPIRV99.865"
#define GLSLANG_DATE "22-Dec-2015"

View File

@ -2415,9 +2415,14 @@ void TParseContext::globalQualifierTypeCheck(const TSourceLoc& loc, const TQuali
return;
}
if (publicType.basicType == EbtInt || publicType.basicType == EbtUint || publicType.basicType == EbtDouble) {
if (publicType.basicType == EbtInt || publicType.basicType == EbtUint || publicType.basicType == EbtDouble)
profileRequires(loc, EEsProfile, 300, nullptr, "shader input/output");
if (! qualifier.flat) {
if (! qualifier.flat) {
if (publicType.basicType == EbtInt || publicType.basicType == EbtUint || publicType.basicType == EbtDouble ||
(publicType.userDef && (publicType.userDef->containsBasicType(EbtInt) ||
publicType.userDef->containsBasicType(EbtUint) ||
publicType.userDef->containsBasicType(EbtDouble)))) {
if (qualifier.storage == EvqVaryingIn && language == EShLangFragment)
error(loc, "must be qualified as flat", TType::getBasicString(publicType.basicType), GetStorageQualifierString(qualifier.storage));
else if (qualifier.storage == EvqVaryingOut && language == EShLangVertex && version == 300)