Skip to content

Commit

Permalink
Fix runtime array of BufferDeviceAddresses
Browse files Browse the repository at this point in the history
  • Loading branch information
spencer-lunarg committed Jul 7, 2024
1 parent fa71fe8 commit 24d5853
Show file tree
Hide file tree
Showing 4 changed files with 403 additions and 1 deletion.
2 changes: 1 addition & 1 deletion spirv_reflect.c
Original file line number Diff line number Diff line change
Expand Up @@ -2491,7 +2491,7 @@ static SpvReflectResult ParseDescriptorBlockVariable(SpvReflectPrvParser* p_pars
p_member_ptr_type = p_member_type;

// strip array
if (p_member_type->op == SpvOpTypeArray) {
if (p_member_type->op == SpvOpTypeArray || p_member_type->op == SpvOpTypeRuntimeArray) {
SpvReflectPrvNode* p_node = FindNode(p_parser, p_member_type->id);
if (p_node == NULL) {
return SPV_REFLECT_RESULT_ERROR_SPIRV_INVALID_ID_REFERENCE;
Expand Down
16 changes: 16 additions & 0 deletions tests/glsl/buffer_handle_9.glsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#version 460
#extension GL_EXT_buffer_reference2: require
#extension GL_EXT_scalar_block_layout : enable

layout(buffer_reference, scalar) readonly buffer VertexBufferPtr {
vec4 v[];
};

// Has a OpTypeRuntimeArray
layout(binding = 1, set = 0, scalar) readonly buffer Vertices {
VertexBufferPtr vertex_buffers[];
};

void main() {
gl_Position = vertex_buffers[gl_VertexIndex].v[gl_VertexIndex];
}
Binary file added tests/glsl/buffer_handle_9.spv
Binary file not shown.
Loading

0 comments on commit 24d5853

Please sign in to comment.