vkd3d-shader/ir: Store the thread group size in struct vsir_program.

This commit is contained in:
Henri Verbeet 2024-10-05 23:27:56 +02:00
parent fc8384462f
commit cf92d9f398
Notes: Henri Verbeet 2024-10-08 22:11:26 +02:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1156
5 changed files with 13 additions and 9 deletions

View File

@ -9637,6 +9637,7 @@ static enum vkd3d_result sm6_parser_emit_thread_group(struct sm6_parser *sm6, co
ins->declaration.thread_group_size.x = group_sizes[0];
ins->declaration.thread_group_size.y = group_sizes[1];
ins->declaration.thread_group_size.z = group_sizes[2];
sm6->p.program->thread_group_size = ins->declaration.thread_group_size;
return VKD3D_OK;
}

View File

@ -681,6 +681,7 @@ static enum vkd3d_result vsir_program_lower_instructions(struct vsir_program *pr
case VKD3DSIH_DCL_CONSTANT_BUFFER:
case VKD3DSIH_DCL_SAMPLER:
case VKD3DSIH_DCL_TEMPS:
case VKD3DSIH_DCL_THREAD_GROUP:
vkd3d_shader_instruction_make_nop(ins);
break;

View File

@ -6890,10 +6890,9 @@ static void spirv_compiler_emit_tessellator_partitioning(struct spirv_compiler *
spirv_compiler_emit_execution_mode(compiler, mode, NULL, 0);
}
static void spirv_compiler_emit_dcl_thread_group(struct spirv_compiler *compiler,
const struct vkd3d_shader_instruction *instruction)
static void spirv_compiler_emit_thread_group_size(struct spirv_compiler *compiler,
const struct vsir_thread_group_size *group_size)
{
const struct vkd3d_shader_thread_group_size *group_size = &instruction->declaration.thread_group_size;
const uint32_t local_size[] = {group_size->x, group_size->y, group_size->z};
spirv_compiler_emit_execution_mode(compiler,
@ -10227,9 +10226,6 @@ static int spirv_compiler_handle_instruction(struct spirv_compiler *compiler,
spirv_compiler_emit_tessellator_partitioning(compiler,
instruction->declaration.tessellator_partitioning);
break;
case VKD3DSIH_DCL_THREAD_GROUP:
spirv_compiler_emit_dcl_thread_group(compiler, instruction);
break;
case VKD3DSIH_HS_CONTROL_POINT_PHASE:
case VKD3DSIH_HS_FORK_PHASE:
case VKD3DSIH_HS_JOIN_PHASE:
@ -10649,6 +10645,8 @@ static int spirv_compiler_generate_spirv(struct spirv_compiler *compiler, struct
spirv_compiler_emit_temps(compiler, program->temp_count);
if (program->ssa_count)
spirv_compiler_allocate_ssa_register_ids(compiler, program->ssa_count);
if (compiler->shader_type == VKD3D_SHADER_TYPE_COMPUTE)
spirv_compiler_emit_thread_group_size(compiler, &program->thread_group_size);
spirv_compiler_emit_descriptor_declarations(compiler);

View File

@ -1289,11 +1289,14 @@ static void shader_sm5_read_dcl_hs_max_tessfactor(struct vkd3d_shader_instructio
}
static void shader_sm5_read_dcl_thread_group(struct vkd3d_shader_instruction *ins, uint32_t opcode,
uint32_t opcode_token, const uint32_t *tokens, unsigned int token_count, struct vkd3d_shader_sm4_parser *priv)
uint32_t opcode_token, const uint32_t *tokens, unsigned int token_count, struct vkd3d_shader_sm4_parser *sm4)
{
struct vsir_program *program = sm4->p.program;
ins->declaration.thread_group_size.x = *tokens++;
ins->declaration.thread_group_size.y = *tokens++;
ins->declaration.thread_group_size.z = *tokens++;
program->thread_group_size = ins->declaration.thread_group_size;
}
static void shader_sm5_read_dcl_uav_raw(struct vkd3d_shader_instruction *ins, uint32_t opcode, uint32_t opcode_token,

View File

@ -1164,7 +1164,7 @@ struct vkd3d_shader_tgsm_structured
bool zero_init;
};
struct vkd3d_shader_thread_group_size
struct vsir_thread_group_size
{
unsigned int x, y, z;
};
@ -1243,7 +1243,7 @@ struct vkd3d_shader_instruction
struct vkd3d_shader_structured_resource structured_resource;
struct vkd3d_shader_tgsm_raw tgsm_raw;
struct vkd3d_shader_tgsm_structured tgsm_structured;
struct vkd3d_shader_thread_group_size thread_group_size;
struct vsir_thread_group_size thread_group_size;
enum vkd3d_tessellator_domain tessellator_domain;
enum vkd3d_shader_tessellator_output_primitive tessellator_output_primitive;
enum vkd3d_shader_tessellator_partitioning tessellator_partitioning;
@ -1390,6 +1390,7 @@ struct vsir_program
bool free_parameters;
unsigned int input_control_point_count, output_control_point_count;
struct vsir_thread_group_size thread_group_size;
unsigned int flat_constant_count[3];
unsigned int block_count;
unsigned int temp_count;