mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d-shader/dxbc: Store DXBC section data as a vkd3d_shader_code structure.
This commit is contained in:
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
@ -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 = &dxbc->sections[dxbc->section_count++];
|
||||||
section->tag = tag;
|
section->tag = tag;
|
||||||
section->data = data;
|
section->data.code = data;
|
||||||
section->size = size;
|
section->data.size = size;
|
||||||
}
|
}
|
||||||
|
|
||||||
int dxbc_writer_write(struct dxbc_writer *dxbc, struct vkd3d_shader_code *out)
|
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));
|
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].tag);
|
||||||
put_u32(&buffer, dxbc->sections[i].size);
|
put_u32(&buffer, dxbc->sections[i].data.size);
|
||||||
bytecode_put_bytes(&buffer, dxbc->sections[i].data, dxbc->sections[i].size);
|
bytecode_put_bytes(&buffer, dxbc->sections[i].data.code, dxbc->sections[i].data.size);
|
||||||
}
|
}
|
||||||
set_u32(&buffer, size_position, bytecode_get_size(&buffer));
|
set_u32(&buffer, size_position, bytecode_get_size(&buffer));
|
||||||
|
|
||||||
|
@ -2519,6 +2519,6 @@ int hlsl_sm4_write(struct hlsl_ctx *ctx, struct hlsl_ir_function_decl *entry_fun
|
|||||||
if (!(ret = ctx->result))
|
if (!(ret = ctx->result))
|
||||||
ret = dxbc_writer_write(&dxbc, out);
|
ret = dxbc_writer_write(&dxbc, out);
|
||||||
for (i = 0; i < dxbc.section_count; ++i)
|
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;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -1311,8 +1311,7 @@ static inline void *vkd3d_find_struct_(const struct vkd3d_struct *chain,
|
|||||||
struct dxbc_writer_section
|
struct dxbc_writer_section
|
||||||
{
|
{
|
||||||
uint32_t tag;
|
uint32_t tag;
|
||||||
const uint8_t *data;
|
struct vkd3d_shader_code data;
|
||||||
size_t size;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#define DXBC_MAX_SECTION_COUNT 5
|
#define DXBC_MAX_SECTION_COUNT 5
|
||||||
|
Loading…
Reference in New Issue
Block a user