Skip to content

Commit

Permalink
igl | vulkan | Fix false positive SPIR-V reflection assert
Browse files Browse the repository at this point in the history
Summary: Fixed one false positive SPIR-V reflection assert.

Reviewed By: ChristianK275

Differential Revision: D50669698

fbshipit-source-id: 93553e1136bdd159adeef3c2e8e3ff1ff4f0a5d5
  • Loading branch information
corporateshark authored and facebook-github-bot committed Oct 26, 2023
1 parent 42fe984 commit dd83136
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/igl/vulkan/util/SpvReflection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ constexpr uint32_t kSpvOpCodeMask = 0xFFFF;
constexpr size_t kOpDecorateTargetId = 1;
constexpr size_t kOpDecorateDecoration = 2;
constexpr size_t kOpDecorateOperandIds = 3;
IGL_MAYBE_UNUSED constexpr size_t kOpDecorateMaxUsedIdx = kOpDecorateOperandIds;

constexpr size_t kOpVariableTypeId = 1;
constexpr size_t kOpVariableId = 2;
Expand Down Expand Up @@ -131,7 +130,7 @@ SpvModuleInfo getReflectionData(const void* spirv, size_t numBytes) {

switch (opCode) {
case OpCode::OpDecorate: {
IGL_ASSERT_MSG((pos + kOpDecorateMaxUsedIdx) < size, "OpDecorate out of bounds");
IGL_ASSERT_MSG((pos + kOpDecorateDecoration) < size, "OpDecorate out of bounds");

uint32_t decoration = words[pos + kOpDecorateDecoration];
uint32_t targetId = words[pos + kOpDecorateTargetId];
Expand All @@ -141,6 +140,8 @@ SpvModuleInfo getReflectionData(const void* spirv, size_t numBytes) {
break;
}
case Decoration::Binding: {
IGL_ASSERT_MSG((pos + kOpDecorateOperandIds) < size, "OpDecorate out of bounds");

uint32_t bindingLocation = words[pos + kOpDecorateOperandIds];
bindingLocations.insert({targetId, bindingLocation});
break;
Expand Down

0 comments on commit dd83136

Please sign in to comment.