From 1559237780df1c9dbd87142192a3cf9681c97b83 Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Mon, 5 Aug 2024 19:27:32 +0200 Subject: [PATCH] vkd3d-shader/fx: Fix state block entry array shifting when decomposing. Signed-off-by: Nikolay Sivov --- libs/vkd3d-shader/fx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/vkd3d-shader/fx.c b/libs/vkd3d-shader/fx.c index 6539a845..4eaebc7d 100644 --- a/libs/vkd3d-shader/fx.c +++ b/libs/vkd3d-shader/fx.c @@ -1824,7 +1824,7 @@ static unsigned int decompose_fx_4_state_block(struct hlsl_ir_var *var, struct h if (entry_index != block->count - 1) { memmove(&block->entries[entry_index + entry->args_count], &block->entries[entry_index + 1], - (entry->args_count - 1) * sizeof(*block->entries)); + (block->count - entry_index - 1) * sizeof(*block->entries)); } block->count += entry->args_count - 1; @@ -1839,7 +1839,7 @@ static unsigned int decompose_fx_4_state_block(struct hlsl_ir_var *var, struct h } hlsl_free_state_block_entry(entry); - return entry->args_count - 1; + return entry->args_count; } static void write_fx_4_state_block(struct hlsl_ir_var *var, unsigned int block_index,