Module: vkd3d Branch: master Commit: 501aed43f3233eece618f5dce725a2dc631f1d88 URL: https://gitlab.winehq.org/wine/vkd3d/-/commit/501aed43f3233eece618f5dce725a2...
Author: Nikolay Sivov nsivov@codeweavers.com Date: Mon Mar 11 18:56:50 2024 +0100
vkd3d-shader/fx: Zero-pad strings when aligning them for fx_2_0.
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com
---
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; }