Prevent Push Constant blocks being an array (#2904)

* Prevent Push Constant blocks being an array

* Add push constant array error test

Co-authored-by: Greg Fischer <greg@lunarg.com>
This commit is contained in:
sfricke-samsung 2022-03-23 12:42:21 -05:00 committed by GitHub
parent c6f8e532dd
commit 610fd6edf3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 36 additions and 28 deletions

View file

@ -6368,8 +6368,12 @@ void TParseContext::layoutTypeCheck(const TSourceLoc& loc, const TType& type)
profileRequires(loc, ECoreProfile | ECompatibilityProfile, 0, E_GL_EXT_shader_image_load_formatted, explanation);
}
if (qualifier.isPushConstant() && type.getBasicType() != EbtBlock)
error(loc, "can only be used with a block", "push_constant", "");
if (qualifier.isPushConstant()) {
if (type.getBasicType() != EbtBlock)
error(loc, "can only be used with a block", "push_constant", "");
if (type.isArray())
error(loc, "Push constants blocks can't be an array", "push_constant", "");
}
if (qualifier.hasBufferReference() && type.getBasicType() != EbtBlock)
error(loc, "can only be used with a block", "buffer_reference", "");