Replace assert of buffer block SPIRType with exception

This commit is contained in:
chyyran 2024-09-02 10:12:52 -04:00
parent aad675ff41
commit 28d8914022

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