vkd3d-shader/d3dbc: Remove ctx and entry_func args in d3dbc_compile().

This commit is contained in:
Francisco Casas 2024-06-04 20:45:37 -04:00 committed by Henri Verbeet
parent b72ef6038d
commit 4b85e6b1f8
Notes: Henri Verbeet 2024-09-14 16:54:03 +02:00
Approved-by: Elizabeth Figura (@zfigura)
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1072
3 changed files with 4 additions and 15 deletions

View File

@ -1474,10 +1474,6 @@ struct d3dbc_compiler
struct vkd3d_bytecode_buffer buffer;
struct vkd3d_shader_message_context *message_context;
bool failed;
/* OBJECTIVE: Store all the required information in the other fields so
* that this hlsl_ctx is no longer necessary. */
struct hlsl_ctx *ctx;
};
static uint32_t sm1_version(enum vkd3d_shader_type type, unsigned int major, unsigned int minor)
@ -2312,21 +2308,15 @@ static void d3dbc_write_program_instructions(struct d3dbc_compiler *d3dbc)
d3dbc_write_vsir_instruction(d3dbc, &program->instructions.elements[i]);
}
/* OBJECTIVE: Stop relying on ctx and entry_func on this function, receiving
* data from the other parameters instead, so it can be removed as an argument
* and be declared in vkd3d_shader_private.h and used without relying on HLSL
* IR structs. */
int d3dbc_compile(struct vsir_program *program, uint64_t config_flags,
const struct vkd3d_shader_compile_info *compile_info, const struct vkd3d_shader_code *ctab,
struct vkd3d_shader_code *out, struct vkd3d_shader_message_context *message_context,
struct hlsl_ctx *ctx, struct hlsl_ir_function_decl *entry_func)
struct vkd3d_shader_code *out, struct vkd3d_shader_message_context *message_context)
{
const struct vkd3d_shader_version *version = &program->shader_version;
struct d3dbc_compiler d3dbc = {0};
struct vkd3d_bytecode_buffer *buffer = &d3dbc.buffer;
int result;
d3dbc.ctx = ctx;
d3dbc.program = program;
d3dbc.message_context = message_context;
switch (version->type)
@ -2354,7 +2344,7 @@ int d3dbc_compile(struct vsir_program *program, uint64_t config_flags,
put_u32(buffer, VKD3D_SM1_OP_END);
result = ctx->result;
result = VKD3D_OK;
if (buffer->status)
result = buffer->status;
if (d3dbc.failed)

View File

@ -1590,8 +1590,7 @@ bool hlsl_sm1_usage_from_semantic(const char *semantic_name,
void write_sm1_uniforms(struct hlsl_ctx *ctx, struct vkd3d_bytecode_buffer *buffer);
int d3dbc_compile(struct vsir_program *program, uint64_t config_flags,
const struct vkd3d_shader_compile_info *compile_info, const struct vkd3d_shader_code *ctab,
struct vkd3d_shader_code *out, struct vkd3d_shader_message_context *message_context,
struct hlsl_ctx *ctx, struct hlsl_ir_function_decl *entry_func);
struct vkd3d_shader_code *out, struct vkd3d_shader_message_context *message_context);
bool sysval_semantic_from_hlsl(enum vkd3d_shader_sysval_semantic *semantic,
struct hlsl_ctx *ctx, const struct hlsl_semantic *hlsl_semantic, bool output);

View File

@ -7732,7 +7732,7 @@ int hlsl_emit_bytecode(struct hlsl_ctx *ctx, struct hlsl_ir_function_decl *entry
return ctx->result;
}
result = d3dbc_compile(&program, config_flags, NULL, &ctab, out, ctx->message_context, ctx, entry_func);
result = d3dbc_compile(&program, config_flags, NULL, &ctab, out, ctx->message_context);
vsir_program_cleanup(&program);
vkd3d_shader_free_shader_code(&ctab);
return result;