From fdc1edb64726ec9e3355b7fe759286240cd9d7e4 Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Mon, 1 Sep 2025 21:46:16 +0200 Subject: [PATCH] vkd3d-shader/d3d-asm: Check the actual index count in shader_print_register(). vsir_register_init() does initialise offsets to ~0u, but at this point that's not something that should be relied on. --- libs/vkd3d-shader/d3d_asm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libs/vkd3d-shader/d3d_asm.c b/libs/vkd3d-shader/d3d_asm.c index 58135e71f..897803ecb 100644 --- a/libs/vkd3d-shader/d3d_asm.c +++ b/libs/vkd3d-shader/d3d_asm.c @@ -834,7 +834,7 @@ static void shader_print_register(struct vkd3d_d3d_asm_compiler *compiler, const && reg->type != VKD3DSPR_NULL && reg->type != VKD3DSPR_DEPTHOUT) { - if (offset != ~0u) + if (reg->idx_count) { bool is_sm_5_1 = vkd3d_shader_ver_ge(&compiler->shader_version, 5, 1); @@ -862,10 +862,10 @@ static void shader_print_register(struct vkd3d_d3d_asm_compiler *compiler, const /* For descriptors in sm < 5.1 we move the reg->idx values up one slot * to normalise with 5.1. * Here we should ignore it if it's a descriptor in sm < 5.1. */ - if (reg->idx[1].offset != ~0u && (!is_descriptor || is_sm_5_1)) + if (reg->idx_count > 1 && (!is_descriptor || is_sm_5_1)) shader_print_subscript(compiler, reg->idx[1].offset, reg->idx[1].rel_addr); - if (reg->idx[2].offset != ~0u) + if (reg->idx_count > 2) shader_print_subscript(compiler, reg->idx[2].offset, reg->idx[2].rel_addr); } }