vkd3d-shader/dxbc: Store DXBC section data as a vkd3d_shader_code structure.

This commit is contained in:
Henri Verbeet 2023-02-20 13:47:03 +01:00 committed by Alexandre Julliard
parent dea212688a
commit b59de4de5c
Notes: Alexandre Julliard 2023-02-23 22:20:24 +01:00
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/103
3 changed files with 6 additions and 7 deletions

View File

@ -39,8 +39,8 @@ void dxbc_writer_add_section(struct dxbc_writer *dxbc, uint32_t tag, const void
section = &dxbc->sections[dxbc->section_count++];
section->tag = tag;
section->data = data;
section->size = size;
section->data.code = data;
section->data.size = size;
}
int dxbc_writer_write(struct dxbc_writer *dxbc, struct vkd3d_shader_code *out)
@ -67,8 +67,8 @@ int dxbc_writer_write(struct dxbc_writer *dxbc, struct vkd3d_shader_code *out)
{
set_u32(&buffer, offsets_position + i * sizeof(uint32_t), bytecode_get_size(&buffer));
put_u32(&buffer, dxbc->sections[i].tag);
put_u32(&buffer, dxbc->sections[i].size);
bytecode_put_bytes(&buffer, dxbc->sections[i].data, dxbc->sections[i].size);
put_u32(&buffer, dxbc->sections[i].data.size);
bytecode_put_bytes(&buffer, dxbc->sections[i].data.code, dxbc->sections[i].data.size);
}
set_u32(&buffer, size_position, bytecode_get_size(&buffer));

View File

@ -2519,6 +2519,6 @@ int hlsl_sm4_write(struct hlsl_ctx *ctx, struct hlsl_ir_function_decl *entry_fun
if (!(ret = ctx->result))
ret = dxbc_writer_write(&dxbc, out);
for (i = 0; i < dxbc.section_count; ++i)
vkd3d_free((void *)dxbc.sections[i].data);
vkd3d_shader_free_shader_code(&dxbc.sections[i].data);
return ret;
}

View File

@ -1311,8 +1311,7 @@ static inline void *vkd3d_find_struct_(const struct vkd3d_struct *chain,
struct dxbc_writer_section
{
uint32_t tag;
const uint8_t *data;
size_t size;
struct vkd3d_shader_code data;
};
#define DXBC_MAX_SECTION_COUNT 5