Spirv_intrinsics: Remove early return in layoutTypeCheck

Previously, when GL_EXT_spirv_intrinsics are enabled, we disable all
checks in layoutTypeCheck. This is too coarse because we can use nothing
in GL_EXT_spirv_intrinsics in a shader while the necessary processing is
skipped, such as addUsedLocation.

In this change, we apply fine check and more might be added if we
encounter new cases in the future.
This commit is contained in:
Rex Xu 2023-07-05 14:44:40 +08:00 committed by arcady-lunarg
parent 76b52ebf77
commit b70669a059
4 changed files with 19 additions and 4 deletions

View file

@ -6324,9 +6324,6 @@ void TParseContext::layoutMemberLocationArrayCheck(const TSourceLoc& loc, bool m
// Do layout error checking with respect to a type.
void TParseContext::layoutTypeCheck(const TSourceLoc& loc, const TType& type)
{
if (extensionTurnedOn(E_GL_EXT_spirv_intrinsics))
return; // Skip any check if GL_EXT_spirv_intrinsics is turned on
const TQualifier& qualifier = type.getQualifier();
// first, intra-layout qualifier-only error checking
@ -6380,6 +6377,7 @@ void TParseContext::layoutTypeCheck(const TSourceLoc& loc, const TType& type)
case EvqCallableData:
case EvqCallableDataIn:
case EvqHitObjectAttrNV:
case EvqSpirvStorageClass:
break;
case EvqTileImageEXT:
break;
@ -6436,7 +6434,7 @@ void TParseContext::layoutTypeCheck(const TSourceLoc& loc, const TType& type)
// an array of size N, all elements of the array from binding through binding + N - 1 must be within this
// range."
//
if (! type.isOpaque() && type.getBasicType() != EbtBlock)
if (!type.isOpaque() && type.getBasicType() != EbtBlock && type.getBasicType() != EbtSpirvType)
error(loc, "requires block, or sampler/image, or atomic-counter type", "binding", "");
if (type.getBasicType() == EbtSampler) {
int lastBinding = qualifier.layoutBinding;