From c4c7f10d99daa5d3efc036d74d5e09b6f1342407 Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Fri, 23 May 2025 14:49:14 +0200 Subject: [PATCH] vkd3d-shader/fx: Fix the total buffer size calculation in write_fx_4_buffer(). The total size should take variable alignment/padding into account. Signed-off-by: Nikolay Sivov --- libs/vkd3d-shader/fx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/vkd3d-shader/fx.c b/libs/vkd3d-shader/fx.c index 636e8efcc..c475a46da 100644 --- a/libs/vkd3d-shader/fx.c +++ b/libs/vkd3d-shader/fx.c @@ -3234,7 +3234,7 @@ static void write_fx_4_buffer(struct hlsl_buffer *b, struct fx_write_context *fx continue; write_fx_4_numeric_variable(var, shared, fx); - size += get_fx_4_type_size(var->data_type); + size = max(size, get_fx_4_type_size(var->data_type) + var->buffer_offset * 4); ++count; }