mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-09-13 09:16:14 -07:00
vkd3d-shader/spirv: Allocate output_info after normalization.
Normalization may change the signatures.
This commit is contained in:
parent
49caeee1fd
commit
6b58b6f261
Notes:
Henri Verbeet
2024-07-23 21:18:25 +02:00
Approved-by: Henri Verbeet (@hverbeet) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/955
@ -2536,13 +2536,10 @@ static struct spirv_compiler *spirv_compiler_create(const struct vsir_program *p
|
||||
const struct vkd3d_shader_scan_descriptor_info1 *scan_descriptor_info,
|
||||
struct vkd3d_shader_message_context *message_context, uint64_t config_flags)
|
||||
{
|
||||
const struct shader_signature *patch_constant_signature = &program->patch_constant_signature;
|
||||
const struct shader_signature *output_signature = &program->output_signature;
|
||||
const struct vkd3d_shader_interface_info *shader_interface;
|
||||
const struct vkd3d_shader_descriptor_offset_info *offset_info;
|
||||
const struct vkd3d_shader_spirv_target_info *target_info;
|
||||
struct spirv_compiler *compiler;
|
||||
unsigned int max_element_count;
|
||||
unsigned int i;
|
||||
|
||||
if (!(compiler = vkd3d_malloc(sizeof(*compiler))))
|
||||
@ -2570,13 +2567,6 @@ static struct spirv_compiler *spirv_compiler_create(const struct vsir_program *p
|
||||
compiler->spirv_target_info = target_info;
|
||||
}
|
||||
|
||||
max_element_count = max(output_signature->element_count, patch_constant_signature->element_count);
|
||||
if (!(compiler->output_info = vkd3d_calloc(max_element_count, sizeof(*compiler->output_info))))
|
||||
{
|
||||
vkd3d_free(compiler);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
vkd3d_spirv_builder_init(&compiler->spirv_builder, spirv_compiler_get_entry_point_name(compiler));
|
||||
|
||||
compiler->formatting = VKD3D_SHADER_COMPILE_OPTION_FORMATTING_INDENT
|
||||
@ -10597,12 +10587,16 @@ static int spirv_compiler_generate_spirv(struct spirv_compiler *compiler, struct
|
||||
struct vkd3d_shader_instruction_array instructions;
|
||||
enum vkd3d_shader_spirv_environment environment;
|
||||
enum vkd3d_result result = VKD3D_OK;
|
||||
unsigned int i;
|
||||
unsigned int i, max_element_count;
|
||||
|
||||
if ((result = vsir_program_normalise(program, compiler->config_flags,
|
||||
compile_info, compiler->message_context)) < 0)
|
||||
return result;
|
||||
|
||||
max_element_count = max(program->output_signature.element_count, program->patch_constant_signature.element_count);
|
||||
if (!(compiler->output_info = vkd3d_calloc(max_element_count, sizeof(*compiler->output_info))))
|
||||
return VKD3D_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
if (program->temp_count)
|
||||
spirv_compiler_emit_temps(compiler, program->temp_count);
|
||||
if (program->ssa_count)
|
||||
|
Loading…
Reference in New Issue
Block a user