SPV: Address #989: Don't add Location to built-ins when automapping.

This commit is contained in:
John Kessenich 2017-07-14 05:52:31 -06:00
parent 56d2b9904e
commit 91e69c03bd
4 changed files with 80 additions and 1 deletions

View file

@ -413,9 +413,22 @@ struct TDefaultIoResolverBase : public glslang::TIoMapResolver
}
int resolveInOutLocation(EShLanguage /*stage*/, const char* /*name*/, const TType& type, bool /*is_live*/) override
{
if (!doAutoLocationMapping || type.getQualifier().hasLocation())
// kick out of not doing this
if (!doAutoLocationMapping)
return -1;
// no locations added if already present, or a built-in variable
if (type.getQualifier().hasLocation() || type.getQualifier().builtIn != EbvNone)
return -1;
// no locations on blocks of built-in variables
if (type.isStruct()) {
if (type.getStruct()->size() < 1)
return -1;
if ((*type.getStruct())[0].type->getQualifier().builtIn != EbvNone)
return -1;
}
// Placeholder.
// TODO: It would be nice to flesh this out using
// intermediate->computeTypeLocationSize(type), or functions that call it like