mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d-shader: Remove the bytecode fields from vkd3d_shader_desc.
This commit is contained in:
parent
204c8afb9c
commit
1690b0b554
Notes:
Alexandre Julliard
2024-03-11 23:06:10 +01:00
Approved-by: Giovanni Mascellani (@giomasce) Approved-by: Francisco Casas (@fcasas) Approved-by: Henri Verbeet (@hverbeet) Approved-by: Alexandre Julliard (@julliard) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/680
@ -1236,7 +1236,6 @@ static enum vkd3d_result shader_sm1_init(struct vkd3d_shader_sm1_parser *sm1,
|
||||
const struct vkd3d_shader_location location = {.source_name = compile_info->source_name};
|
||||
const uint32_t *code = compile_info->source.code;
|
||||
size_t code_size = compile_info->source.size;
|
||||
struct vkd3d_shader_desc *shader_desc;
|
||||
struct vkd3d_shader_version version;
|
||||
uint16_t shader_type;
|
||||
size_t token_count;
|
||||
@ -1289,9 +1288,6 @@ static enum vkd3d_result shader_sm1_init(struct vkd3d_shader_sm1_parser *sm1,
|
||||
if (!vkd3d_shader_parser_init(&sm1->p, message_context, compile_info->source_name, &version, &shader_sm1_parser_ops,
|
||||
code_size != ~(size_t)0 ? token_count / 4u + 4 : 16))
|
||||
return VKD3D_ERROR_OUT_OF_MEMORY;
|
||||
shader_desc = &sm1->p.shader_desc;
|
||||
shader_desc->byte_code = code;
|
||||
shader_desc->byte_code_size = code_size;
|
||||
sm1->ptr = sm1->start;
|
||||
|
||||
return VKD3D_OK;
|
||||
|
@ -8431,7 +8431,6 @@ static enum vkd3d_result sm6_parser_init(struct sm6_parser *sm6, const char *sou
|
||||
int vkd3d_shader_sm6_parser_create(const struct vkd3d_shader_compile_info *compile_info,
|
||||
struct vkd3d_shader_message_context *message_context, struct vkd3d_shader_parser **parser)
|
||||
{
|
||||
struct vkd3d_shader_desc *shader_desc;
|
||||
struct dxbc_shader_desc dxbc_desc = {0};
|
||||
uint32_t *byte_code = NULL;
|
||||
struct sm6_parser *sm6;
|
||||
@ -8454,15 +8453,11 @@ int vkd3d_shader_sm6_parser_create(const struct vkd3d_shader_compile_info *compi
|
||||
return ret;
|
||||
}
|
||||
|
||||
shader_desc = &sm6->p.shader_desc;
|
||||
shader_desc->byte_code = dxbc_desc.byte_code;
|
||||
shader_desc->byte_code_size = dxbc_desc.byte_code_size;
|
||||
|
||||
if (((uintptr_t)shader_desc->byte_code & (VKD3D_DXBC_CHUNK_ALIGNMENT - 1)))
|
||||
if (((uintptr_t)dxbc_desc.byte_code & (VKD3D_DXBC_CHUNK_ALIGNMENT - 1)))
|
||||
{
|
||||
/* LLVM bitcode should be 32-bit aligned, but before dxc v1.7.2207 this was not always the case in the DXBC
|
||||
* container due to missing padding after signature names. Get an aligned copy to prevent unaligned access. */
|
||||
if (!(byte_code = vkd3d_malloc(align(shader_desc->byte_code_size, VKD3D_DXBC_CHUNK_ALIGNMENT))))
|
||||
if (!(byte_code = vkd3d_malloc(align(dxbc_desc.byte_code_size, VKD3D_DXBC_CHUNK_ALIGNMENT))))
|
||||
{
|
||||
ERR("Failed to allocate aligned chunk.\n");
|
||||
free_dxbc_shader_desc(&dxbc_desc);
|
||||
@ -8470,7 +8465,7 @@ int vkd3d_shader_sm6_parser_create(const struct vkd3d_shader_compile_info *compi
|
||||
return VKD3D_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
memcpy(byte_code, shader_desc->byte_code, shader_desc->byte_code_size);
|
||||
memcpy(byte_code, dxbc_desc.byte_code, dxbc_desc.byte_code_size);
|
||||
dxbc_desc.byte_code = byte_code;
|
||||
}
|
||||
|
||||
|
@ -2647,7 +2647,6 @@ int vkd3d_shader_sm4_parser_create(const struct vkd3d_shader_compile_info *compi
|
||||
struct vkd3d_shader_message_context *message_context, struct vkd3d_shader_parser **parser)
|
||||
{
|
||||
struct vkd3d_shader_instruction_array *instructions;
|
||||
struct vkd3d_shader_desc *shader_desc;
|
||||
struct vkd3d_shader_instruction *ins;
|
||||
struct vkd3d_shader_sm4_parser *sm4;
|
||||
struct dxbc_shader_desc dxbc_desc = {0};
|
||||
@ -2668,11 +2667,7 @@ int vkd3d_shader_sm4_parser_create(const struct vkd3d_shader_compile_info *compi
|
||||
return ret;
|
||||
}
|
||||
|
||||
shader_desc = &sm4->p.shader_desc;
|
||||
shader_desc->byte_code = dxbc_desc.byte_code;
|
||||
shader_desc->byte_code_size = dxbc_desc.byte_code_size;
|
||||
|
||||
if (!shader_sm4_init(sm4, shader_desc->byte_code, shader_desc->byte_code_size,
|
||||
if (!shader_sm4_init(sm4, dxbc_desc.byte_code, dxbc_desc.byte_code_size,
|
||||
compile_info->source_name, message_context))
|
||||
{
|
||||
WARN("Failed to initialise shader parser.\n");
|
||||
|
@ -1040,9 +1040,6 @@ struct dxbc_shader_desc
|
||||
|
||||
struct vkd3d_shader_desc
|
||||
{
|
||||
const uint32_t *byte_code;
|
||||
size_t byte_code_size;
|
||||
|
||||
struct
|
||||
{
|
||||
uint32_t used, external;
|
||||
|
Loading…
Reference in New Issue
Block a user