vkd3d-shader/hlsl: Store the thread group size in the vsir program.

This commit is contained in:
Francisco Casas 2024-10-22 03:00:08 -03:00 committed by Henri Verbeet
parent 91701f8303
commit cf7fade580
Notes: Henri Verbeet 2024-10-24 21:02:04 +02:00
Approved-by: Elizabeth Figura (@zfigura)
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1210
2 changed files with 10 additions and 5 deletions

View File

@ -7557,6 +7557,13 @@ static void sm4_generate_vsir(struct hlsl_ctx *ctx, struct hlsl_ir_function_decl
generate_vsir_signature(ctx, program, entry_func);
if (version.type == VKD3D_SHADER_TYPE_HULL)
generate_vsir_signature(ctx, program, ctx->patch_constant_func);
if (version.type == VKD3D_SHADER_TYPE_COMPUTE)
{
program->thread_group_size.x = ctx->thread_count[0];
program->thread_group_size.y = ctx->thread_count[1];
program->thread_group_size.z = ctx->thread_count[2];
}
}
static struct hlsl_ir_jump *loop_unrolling_find_jump(struct hlsl_block *block, struct hlsl_ir_node *stop_point,

View File

@ -4962,15 +4962,13 @@ static void write_sm4_dcl_indexable_temp(const struct tpf_compiler *tpf, uint32_
write_sm4_instruction(tpf, &instr);
}
static void write_sm4_dcl_thread_group(const struct tpf_compiler *tpf, const uint32_t thread_count[3])
static void tpf_dcl_thread_group(const struct tpf_compiler *tpf, const struct vsir_thread_group_size *group_size)
{
struct sm4_instruction instr =
{
.opcode = VKD3D_SM5_OP_DCL_THREAD_GROUP,
.idx[0] = thread_count[0],
.idx[1] = thread_count[1],
.idx[2] = thread_count[2],
.idx = {group_size->x, group_size->y, group_size->z},
.idx_count = 3,
};
@ -6544,7 +6542,7 @@ static void tpf_write_shader_function(struct tpf_compiler *tpf, struct hlsl_ir_f
}
if (tpf->program->shader_version.type == VKD3D_SHADER_TYPE_COMPUTE)
write_sm4_dcl_thread_group(tpf, ctx->thread_count);
tpf_dcl_thread_group(tpf, &tpf->program->thread_group_size);
if (temp_count)
write_sm4_dcl_temps(tpf, temp_count);