[PATCH vkd3d 2/4] vkd3d-shader/spirv: Check binding_base_idx when detecting descriptor arrays.

Conor McCarthy cmccarthy at codeweavers.com
Wed Nov 10 01:03:15 CST 2021


A descriptor declaration matching a range of size 1 at the end of an array
binding will be emitted as a scalar variable at offset 0 in the array,
which is incorrect.

Signed-off-by: Conor McCarthy <cmccarthy at codeweavers.com>
---
 libs/vkd3d-shader/spirv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libs/vkd3d-shader/spirv.c b/libs/vkd3d-shader/spirv.c
index dbe741ab..bd551f66 100644
--- a/libs/vkd3d-shader/spirv.c
+++ b/libs/vkd3d-shader/spirv.c
@@ -5562,7 +5562,7 @@ static uint32_t vkd3d_dxbc_compiler_build_descriptor_variable(struct vkd3d_dxbc_
     binding = vkd3d_dxbc_compiler_get_descriptor_binding(compiler, reg, range,
             resource_type, false, &array_symbol->binding_base_idx);
 
-    if (binding.count == 1 && range->last != ~0u)
+    if (binding.count == 1 && range->first == array_symbol->binding_base_idx && range->last != ~0u)
     {
         ptr_type_id = vkd3d_spirv_get_op_type_pointer(builder, storage_class, type_id);
         var_id = vkd3d_spirv_build_op_variable(builder, &builder->global_stream,
-- 
2.32.0




More information about the wine-devel mailing list