mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-01-28 13:05:02 -08:00
vkd3d-shader/fx: Zero-pad strings when aligning them for fx_2_0.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
This commit is contained in:
parent
228d54efff
commit
501aed43f3
Notes:
Alexandre Julliard
2024-03-27 23:07:48 +01:00
Approved-by: Giovanni Mascellani (@giomasce) Approved-by: Zebediah Figura (@zfigura) Approved-by: Henri Verbeet (@hverbeet) Approved-by: Alexandre Julliard (@julliard) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/729
@ -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;
|
struct vkd3d_bytecode_buffer *buffer = &fx->unstructured;
|
||||||
const char *s = string ? string : "";
|
const char *s = string ? string : "";
|
||||||
|
static const char tail[3];
|
||||||
uint32_t size, offset;
|
uint32_t size, offset;
|
||||||
|
|
||||||
size = strlen(s) + 1;
|
size = strlen(s) + 1;
|
||||||
offset = put_u32(buffer, size);
|
offset = put_u32(buffer, size);
|
||||||
bytecode_put_bytes(buffer, s, size);
|
bytecode_put_bytes(buffer, s, size);
|
||||||
|
size %= 4;
|
||||||
|
if (size)
|
||||||
|
bytecode_put_bytes_unaligned(buffer, tail, 4 - size);
|
||||||
return offset;
|
return offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user