vkd3d-shader/hlsl: Allocate temporary registers separately for each entry function.

This commit is contained in:
Shaun Ren
2024-10-04 21:18:53 -04:00
committed by Henri Verbeet
parent 5f8570b933
commit 0c5dc53fd2
Notes: Henri Verbeet 2024-10-15 17:03:41 +02:00
Approved-by: Elizabeth Figura (@zfigura)
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1154
3 changed files with 44 additions and 14 deletions

View File

@@ -6387,7 +6387,7 @@ static void write_sm4_block(const struct tpf_writer *tpf, const struct hlsl_bloc
}
}
static void write_sm4_shdr(struct hlsl_ctx *ctx, const struct hlsl_ir_function_decl *entry_func,
static void write_sm4_shdr(struct hlsl_ctx *ctx, struct hlsl_ir_function_decl *entry_func,
struct sm4_stat *stat, struct dxbc_writer *dxbc)
{
const struct hlsl_profile_info *profile = ctx->profile;
@@ -6399,6 +6399,7 @@ static void write_sm4_shdr(struct hlsl_ctx *ctx, const struct hlsl_ir_function_d
const struct hlsl_ir_var *var;
size_t token_count_position;
struct tpf_writer tpf;
uint32_t temp_count;
static const uint16_t shader_types[VKD3D_SHADER_TYPE_COUNT] =
{
@@ -6413,6 +6414,11 @@ static void write_sm4_shdr(struct hlsl_ctx *ctx, const struct hlsl_ir_function_d
VKD3D_SM4_LIB,
};
mark_indexable_vars(ctx, entry_func);
temp_count = allocate_temp_registers(ctx, entry_func);
if (ctx->result)
return;
tpf_writer_init(&tpf, ctx, stat, &buffer);
extern_resources = sm4_get_extern_resources(ctx, &extern_resources_count);
@@ -6450,8 +6456,8 @@ static void write_sm4_shdr(struct hlsl_ctx *ctx, const struct hlsl_ir_function_d
if (profile->type == VKD3D_SHADER_TYPE_COMPUTE)
write_sm4_dcl_thread_group(&tpf, ctx->thread_count);
if (ctx->temp_count)
write_sm4_dcl_temps(&tpf, ctx->temp_count);
if (temp_count)
write_sm4_dcl_temps(&tpf, temp_count);
LIST_FOR_EACH_ENTRY(scope, &ctx->scopes, struct hlsl_scope, entry)
{