Merge pull request #2376 from chyyran/get_buffer_block_flags_no_assert

Replace assert of buffer block SPIRType with exception in `get_buffer_block_flags`
This commit is contained in:
Hans-Kristian Arntzen 2024-09-02 17:02:54 +02:00 committed by GitHub
commit 6a1fb66eef
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -564,7 +564,8 @@ Bitset ParsedIR::get_buffer_block_type_flags(const SPIRType &type) const
Bitset ParsedIR::get_buffer_block_flags(const SPIRVariable &var) const
{
auto &type = get<SPIRType>(var.basetype);
assert(type.basetype == SPIRType::Struct);
if (type.basetype != SPIRType::Struct)
SPIRV_CROSS_THROW("Cannot get buffer block flags for non-buffer variable.");
// Some flags like non-writable, non-readable are actually found
// as member decorations. If all members have a decoration set, propagate