From 501aed43f3233eece618f5dce725a2dc631f1d88 Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Mon, 11 Mar 2024 18:56:50 +0100 Subject: [PATCH] vkd3d-shader/fx: Zero-pad strings when aligning them for fx_2_0. Signed-off-by: Nikolay Sivov --- libs/vkd3d-shader/fx.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libs/vkd3d-shader/fx.c b/libs/vkd3d-shader/fx.c index 1a083ab7..49eea92d 100644 --- a/libs/vkd3d-shader/fx.c +++ b/libs/vkd3d-shader/fx.c @@ -611,11 +611,15 @@ static uint32_t write_fx_2_string(const char *string, struct fx_write_context *f { struct vkd3d_bytecode_buffer *buffer = &fx->unstructured; const char *s = string ? string : ""; + static const char tail[3]; uint32_t size, offset; size = strlen(s) + 1; offset = put_u32(buffer, size); bytecode_put_bytes(buffer, s, size); + size %= 4; + if (size) + bytecode_put_bytes_unaligned(buffer, tail, 4 - size); return offset; }