diff options
author | Hans-Kristian Arntzen <post@arntzen-software.no> | 2021-03-08 16:09:32 +0300 |
---|---|---|
committer | Hans-Kristian Arntzen <post@arntzen-software.no> | 2021-03-08 16:15:27 +0300 |
commit | 4ca06c727836839d3b46fd92a06298f28cfafc06 (patch) | |
tree | 3df827eb25fd949ca6cadea4bb108c3b2b81b3d0 /spirv_cross.hpp | |
parent | d57ab68a219831900fa2b8a3bd529413e01f3b9f (diff) |
Handle edge cases in OpCopyMemory.
Implement this by synthesizing an OpLoad/OpStore pair instead.
Diffstat (limited to 'spirv_cross.hpp')
-rw-r--r-- | spirv_cross.hpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/spirv_cross.hpp b/spirv_cross.hpp index 944e855b..84e23ca3 100644 --- a/spirv_cross.hpp +++ b/spirv_cross.hpp @@ -513,9 +513,18 @@ protected: if (!instr.length) return nullptr; - if (instr.offset + instr.length > ir.spirv.size()) - SPIRV_CROSS_THROW("Compiler::stream() out of range."); - return &ir.spirv[instr.offset]; + if (instr.is_embedded()) + { + auto &embedded = static_cast<const EmbeddedInstruction &>(instr); + assert(embedded.ops.size() == instr.length); + return embedded.ops.data(); + } + else + { + if (instr.offset + instr.length > ir.spirv.size()) + SPIRV_CROSS_THROW("Compiler::stream() out of range."); + return &ir.spirv[instr.offset]; + } } ParsedIR ir; |