mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-04-13 05:43:18 -07:00
vkd3d-shader/spirv: Immediately store a reference to the program in the SPIR-V generator.
So it doesn't have to be passed around uselessly.
This commit is contained in:
committed by
Henri Verbeet
parent
549659dab6
commit
5ce03258b5
Notes:
Henri Verbeet
2025-03-18 16:04:30 +01:00
Approved-by: Henri Verbeet (@hverbeet) Approved-by: Elizabeth Figura (@zfigura) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1430
@@ -3058,7 +3058,7 @@ struct ssa_register_info
|
||||
struct spirv_compiler
|
||||
{
|
||||
struct vkd3d_spirv_builder spirv_builder;
|
||||
const struct vsir_program *program;
|
||||
struct vsir_program *program;
|
||||
|
||||
struct vkd3d_shader_message_context *message_context;
|
||||
struct vkd3d_shader_location location;
|
||||
@@ -3196,7 +3196,7 @@ static void spirv_compiler_destroy(struct spirv_compiler *compiler)
|
||||
vkd3d_free(compiler);
|
||||
}
|
||||
|
||||
static struct spirv_compiler *spirv_compiler_create(const struct vsir_program *program,
|
||||
static struct spirv_compiler *spirv_compiler_create(struct vsir_program *program,
|
||||
const struct vkd3d_shader_compile_info *compile_info,
|
||||
const struct vkd3d_shader_scan_descriptor_info1 *scan_descriptor_info,
|
||||
struct vkd3d_shader_message_context *message_context, uint64_t config_flags)
|
||||
@@ -3214,6 +3214,7 @@ static struct spirv_compiler *spirv_compiler_create(const struct vsir_program *p
|
||||
compiler->message_context = message_context;
|
||||
compiler->location.source_name = compile_info->source_name;
|
||||
compiler->config_flags = config_flags;
|
||||
compiler->program = program;
|
||||
|
||||
if ((target_info = vkd3d_find_struct(compile_info->next, SPIRV_TARGET_INFO)))
|
||||
{
|
||||
@@ -11198,13 +11199,14 @@ static void spirv_compiler_emit_descriptor_declarations(struct spirv_compiler *c
|
||||
}
|
||||
}
|
||||
|
||||
static int spirv_compiler_generate_spirv(struct spirv_compiler *compiler, struct vsir_program *program,
|
||||
static int spirv_compiler_generate_spirv(struct spirv_compiler *compiler,
|
||||
const struct vkd3d_shader_compile_info *compile_info, struct vkd3d_shader_code *spirv)
|
||||
{
|
||||
const struct vkd3d_shader_spirv_target_info *info = compiler->spirv_target_info;
|
||||
const struct vkd3d_shader_spirv_domain_shader_target_info *ds_info;
|
||||
struct vkd3d_spirv_builder *builder = &compiler->spirv_builder;
|
||||
struct vkd3d_shader_instruction_array instructions;
|
||||
struct vsir_program *program = compiler->program;
|
||||
enum vkd3d_shader_spirv_environment environment;
|
||||
enum vkd3d_result result = VKD3D_OK;
|
||||
unsigned int i, max_element_count;
|
||||
@@ -11255,8 +11257,6 @@ static int spirv_compiler_generate_spirv(struct spirv_compiler *compiler, struct
|
||||
if (program->block_count && !spirv_compiler_init_blocks(compiler, program->block_count))
|
||||
return VKD3D_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
compiler->program = program;
|
||||
|
||||
instructions = program->instructions;
|
||||
memset(&program->instructions, 0, sizeof(program->instructions));
|
||||
|
||||
@@ -11387,7 +11387,7 @@ int spirv_compile(struct vsir_program *program, uint64_t config_flags,
|
||||
return VKD3D_ERROR;
|
||||
}
|
||||
|
||||
ret = spirv_compiler_generate_spirv(spirv_compiler, program, compile_info, out);
|
||||
ret = spirv_compiler_generate_spirv(spirv_compiler, compile_info, out);
|
||||
|
||||
spirv_compiler_destroy(spirv_compiler);
|
||||
return ret;
|
||||
|
Reference in New Issue
Block a user