mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-09-12 18:50:22 -07:00
vkd3d-shader: Align the start offset instead of the size in bytecode_put_bytes().
The practical effect this has is that we avoid potential trailing padding at the end of DXBC blobs. Unfortunately this also means we need to be more careful about using bytecode_get_size() to find the offset where subsequent data would get written, although in many cases this follows a put_u32() call.
This commit is contained in:
committed by
Alexandre Julliard
parent
a0a3fb0e5f
commit
d6d9aab31c
Notes:
Alexandre Julliard
2023-04-04 22:36:34 +02:00
Approved-by: Alexandre Julliard (@julliard) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/144
@@ -387,7 +387,7 @@ static void write_sm4_type(struct hlsl_ctx *ctx, struct vkd3d_bytecode_buffer *b
|
||||
write_sm4_type(ctx, buffer, field->type);
|
||||
}
|
||||
|
||||
fields_offset = bytecode_get_size(buffer);
|
||||
fields_offset = bytecode_get_next_offset(buffer);
|
||||
|
||||
for (i = 0; i < field_count; ++i)
|
||||
{
|
||||
@@ -583,7 +583,7 @@ static void write_sm4_rdef(struct hlsl_ctx *ctx, struct dxbc_writer *dxbc)
|
||||
|
||||
/* Bound resources. */
|
||||
|
||||
resources_offset = bytecode_get_size(&buffer);
|
||||
resources_offset = bytecode_get_next_offset(&buffer);
|
||||
set_u32(&buffer, resource_position, resources_offset);
|
||||
|
||||
for (i = 0; i < extern_resources_count; ++i)
|
||||
@@ -656,7 +656,7 @@ static void write_sm4_rdef(struct hlsl_ctx *ctx, struct dxbc_writer *dxbc)
|
||||
|
||||
/* Buffers. */
|
||||
|
||||
cbuffers_offset = bytecode_get_size(&buffer);
|
||||
cbuffers_offset = bytecode_get_next_offset(&buffer);
|
||||
set_u32(&buffer, cbuffer_position, cbuffers_offset);
|
||||
LIST_FOR_EACH_ENTRY(cbuffer, &ctx->buffers, struct hlsl_buffer, entry)
|
||||
{
|
||||
@@ -692,7 +692,7 @@ static void write_sm4_rdef(struct hlsl_ctx *ctx, struct dxbc_writer *dxbc)
|
||||
i = 0;
|
||||
LIST_FOR_EACH_ENTRY(cbuffer, &ctx->buffers, struct hlsl_buffer, entry)
|
||||
{
|
||||
size_t vars_start = bytecode_get_size(&buffer);
|
||||
size_t vars_start = bytecode_get_next_offset(&buffer);
|
||||
|
||||
if (!cbuffer->reg.allocated)
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user