Skip to content

Commit ce878c6

Browse files
committed
Fixes #325 - add support for SpvOpInBoundsAccessChain
1 parent 43eed5d commit ce878c6

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

spirv_reflect.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -687,7 +687,7 @@ static SpvReflectResult ParseNodes(SpvReflectPrvParser* p_parser) {
687687
if (node_word_count == 0) {
688688
return SPV_REFLECT_RESULT_ERROR_SPIRV_INVALID_INSTRUCTION;
689689
}
690-
if (op == SpvOpAccessChain) {
690+
if (op == SpvOpAccessChain || op == SpvOpInBoundsAccessChain) {
691691
++(p_parser->access_chain_count);
692692
}
693693
spirv_word_index += node_word_count;
@@ -935,7 +935,8 @@ static SpvReflectResult ParseNodes(SpvReflectPrvParser* p_parser) {
935935
CHECKED_READU32(p_parser, p_node->word_offset + 2, p_node->result_id);
936936
} break;
937937

938-
case SpvOpAccessChain: {
938+
case SpvOpAccessChain:
939+
case SpvOpInBoundsAccessChain: {
939940
SpvReflectPrvAccessChain* p_access_chain = &(p_parser->access_chains[access_chain_index]);
940941
CHECKED_READU32(p_parser, p_node->word_offset + 1, p_access_chain->result_type_id);
941942
CHECKED_READU32(p_parser, p_node->word_offset + 2, p_access_chain->result_id);
@@ -3392,7 +3393,7 @@ static uint32_t GetUint32Constant(SpvReflectPrvParser* p_parser, uint32_t id) {
33923393
}
33933394

33943395
static bool HasByteAddressBufferOffset(SpvReflectPrvNode* p_node, SpvReflectDescriptorBinding* p_binding) {
3395-
return IsNotNull(p_node) && IsNotNull(p_binding) && p_node->op == SpvOpAccessChain && p_node->word_count == 6 &&
3396+
return IsNotNull(p_node) && IsNotNull(p_binding) && (p_node->op == SpvOpAccessChain || p_node->op == SpvOpInBoundsAccessChain) && p_node->word_count == 6 &&
33963397
(p_binding->user_type == SPV_REFLECT_USER_TYPE_BYTE_ADDRESS_BUFFER ||
33973398
p_binding->user_type == SPV_REFLECT_USER_TYPE_RW_BYTE_ADDRESS_BUFFER);
33983399
}

0 commit comments

Comments
 (0)