GLSL front-end: Check recursively for opaque types in a block; these are all illegal.

This commit is contained in:
John Kessenich
2015-09-30 18:57:47 -06:00
parent ee21fc9081
commit 3cd0024ea8
6 changed files with 23 additions and 10 deletions

View File

@@ -1161,6 +1161,19 @@ public:
return false;
}
virtual bool containsOpaque() const
{
if (basicType == EbtSampler || basicType == EbtAtomicUint)
return true;
if (! structure)
return false;
for (unsigned int i = 0; i < structure->size(); ++i) {
if ((*structure)[i].type->containsOpaque())
return true;
}
return false;
}
// Array editing methods. Array descriptors can be shared across
// type instances. This allows all uses of the same array
// to be updated at once. E.g., all nodes can be explicitly sized

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 "3.0.775"
#define GLSLANG_DATE "21-Sep-2015"
#define GLSLANG_REVISION "3.0.776"
#define GLSLANG_DATE "30-Sep-2015"

View File

@@ -4981,9 +4981,8 @@ void TParseContext::declareBlock(const TSourceLoc& loc, TTypeList& typeList, con
profileRequires(memberLoc, ~EEsProfile, 440, E_GL_ARB_enhanced_layouts, "offset on block member");
}
TBasicType basicType = memberType.getBasicType();
if (basicType == EbtSampler)
error(memberLoc, "member of block cannot be a sampler type", typeList[member].type->getFieldName().c_str(), "");
if (memberType.containsOpaque())
error(memberLoc, "member of block cannot be or contain a sampler, image, or atomic_uint type", typeList[member].type->getFieldName().c_str(), "");
}
// This might be a redeclaration of a built-in block. If so, redeclareBuiltinBlock() will