From 4289ec60a1f79f68ea9bd3624141b5657b82d6c8 Mon Sep 17 00:00:00 2001 From: Giovanni Mascellani Date: Fri, 2 May 2025 14:15:54 +0200 Subject: [PATCH] vkd3d-shader/dxil: Do not encode the offset twice for structured TGSM loads. Currently structured TGSM loads are encoded to something like this: ld_structured sr12 , sr1 , l(0) , g0[sr1 + 0] Notice how the TGSM offset, expressed by sr1, is encoded twice in the instruction. In TPF there is no expectation of two indices in the resource source, so let's avoid producing it for DXIL as well. The same instruction will therefore become: ld_structured sr12 , sr1 , l(0) , g0 --- libs/vkd3d-shader/dxil.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libs/vkd3d-shader/dxil.c b/libs/vkd3d-shader/dxil.c index a0c1ab710..52bab40b5 100644 --- a/libs/vkd3d-shader/dxil.c +++ b/libs/vkd3d-shader/dxil.c @@ -7348,6 +7348,8 @@ static void sm6_parser_emit_load(struct sm6_parser *sm6, const struct dxil_recor src_param_make_constant_uint(&src_params[1], 0); src_param_init_from_value(&src_params[2], ptr); src_params[2].reg.alignment = alignment; + /* The offset is already in src_params[0]. */ + src_params[2].reg.idx_count = 1; } else {