vkd3d-shader/ir: Store block names in struct vsir_program.

This commit is contained in:
Henri Verbeet 2024-01-18 20:41:27 +01:00 committed by Alexandre Julliard
parent f3c7d2d05c
commit bf628f0c74
Notes: Alexandre Julliard 2024-01-23 23:05:46 +01:00
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/594
4 changed files with 12 additions and 12 deletions

View File

@ -552,14 +552,9 @@ static int shdr_handler(const struct vkd3d_shader_dxbc_section_desc *section,
void free_shader_desc(struct vkd3d_shader_desc *desc)
{
size_t i;
shader_signature_cleanup(&desc->input_signature);
shader_signature_cleanup(&desc->output_signature);
shader_signature_cleanup(&desc->patch_constant_signature);
for (i = 0; i < desc->block_name_count; ++i)
vkd3d_free((void *)desc->block_names[i]);
vkd3d_free(desc->block_names);
}
int shader_extract_from_dxbc(const struct vkd3d_shader_code *dxbc,

View File

@ -26,6 +26,11 @@ bool vsir_program_init(struct vsir_program *program, const struct vkd3d_shader_v
void vsir_program_cleanup(struct vsir_program *program)
{
size_t i;
for (i = 0; i < program->block_name_count; ++i)
vkd3d_free((void *)program->block_names[i]);
vkd3d_free(program->block_names);
shader_instruction_array_destroy(&program->instructions);
}
@ -2235,8 +2240,8 @@ static enum vkd3d_result flatten_control_flow_constructs(struct vkd3d_shader_par
vkd3d_free(flattener.control_flow_info);
/* Simpler to always free these in free_shader_desc(). */
parser->shader_desc.block_names = flattener.block_names;
parser->shader_desc.block_name_count = flattener.block_name_count;
program->block_names = flattener.block_names;
program->block_name_count = flattener.block_name_count;
return result;
}

View File

@ -9803,8 +9803,8 @@ static int spirv_compiler_generate_spirv(struct spirv_compiler *compiler,
memset(&shader_desc->output_signature, 0, sizeof(shader_desc->output_signature));
memset(&shader_desc->patch_constant_signature, 0, sizeof(shader_desc->patch_constant_signature));
compiler->use_vocp = program->use_vocp;
compiler->block_names = parser->shader_desc.block_names;
compiler->block_name_count = parser->shader_desc.block_name_count;
compiler->block_names = program->block_names;
compiler->block_name_count = program->block_name_count;
compiler->input_control_point_count = program->input_control_point_count;
compiler->output_control_point_count = program->output_control_point_count;

View File

@ -1024,9 +1024,6 @@ struct vkd3d_shader_desc
{
uint32_t used, external;
} flat_constant_count[3];
const char **block_names;
size_t block_name_count;
};
struct vkd3d_shader_register_semantic
@ -1272,6 +1269,9 @@ struct vsir_program
unsigned int temp_count;
unsigned int ssa_count;
bool use_vocp;
const char **block_names;
size_t block_name_count;
};
bool vsir_program_init(struct vsir_program *program, const struct vkd3d_shader_version *version, unsigned int reserve);