vkd3d-shader/ir: Assume that Hull Shaders have a control point phase in vsir_program_normalise_io_registers().

The control point phase is always introduced, when missing, by the
earlier instruction_array_normalise_hull_shader_control_point_io()
pass.
This commit is contained in:
Giovanni Mascellani 2024-09-05 12:40:45 +02:00 committed by Henri Verbeet
parent 7b9a1bf6df
commit bfd1fc9cd6
Notes: Henri Verbeet 2024-09-05 16:39:19 +02:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1044

View File

@ -1765,8 +1765,7 @@ static enum vkd3d_result vsir_program_normalise_io_registers(struct vsir_program
{ {
struct io_normaliser normaliser = {program->instructions}; struct io_normaliser normaliser = {program->instructions};
struct vkd3d_shader_instruction *ins; struct vkd3d_shader_instruction *ins;
bool has_control_point_phase; unsigned int i;
unsigned int i, j;
normaliser.phase = VKD3DSIH_INVALID; normaliser.phase = VKD3DSIH_INVALID;
normaliser.shader_type = program->shader_version.type; normaliser.shader_type = program->shader_version.type;
@ -1775,7 +1774,7 @@ static enum vkd3d_result vsir_program_normalise_io_registers(struct vsir_program
normaliser.output_signature = &program->output_signature; normaliser.output_signature = &program->output_signature;
normaliser.patch_constant_signature = &program->patch_constant_signature; normaliser.patch_constant_signature = &program->patch_constant_signature;
for (i = 0, has_control_point_phase = false; i < program->instructions.count; ++i) for (i = 0; i < program->instructions.count; ++i)
{ {
ins = &program->instructions.elements[i]; ins = &program->instructions.elements[i];
@ -1789,8 +1788,6 @@ static enum vkd3d_result vsir_program_normalise_io_registers(struct vsir_program
vkd3d_shader_instruction_make_nop(ins); vkd3d_shader_instruction_make_nop(ins);
break; break;
case VKD3DSIH_HS_CONTROL_POINT_PHASE: case VKD3DSIH_HS_CONTROL_POINT_PHASE:
has_control_point_phase = true;
/* fall through */
case VKD3DSIH_HS_FORK_PHASE: case VKD3DSIH_HS_FORK_PHASE:
case VKD3DSIH_HS_JOIN_PHASE: case VKD3DSIH_HS_JOIN_PHASE:
normaliser.phase = ins->opcode; normaliser.phase = ins->opcode;
@ -1800,22 +1797,6 @@ static enum vkd3d_result vsir_program_normalise_io_registers(struct vsir_program
} }
} }
if (normaliser.shader_type == VKD3D_SHADER_TYPE_HULL && !has_control_point_phase)
{
/* Inputs and outputs must match for the default phase, so merge ranges must match too. */
for (i = 0; i < MAX_REG_OUTPUT; ++i)
{
for (j = 0; j < VKD3D_VEC4_SIZE; ++j)
{
if (!normaliser.input_range_map[i][j] && normaliser.output_range_map[i][j])
normaliser.input_range_map[i][j] = normaliser.output_range_map[i][j];
else if (normaliser.input_range_map[i][j] && !normaliser.output_range_map[i][j])
normaliser.output_range_map[i][j] = normaliser.input_range_map[i][j];
else VKD3D_ASSERT(normaliser.input_range_map[i][j] == normaliser.output_range_map[i][j]);
}
}
}
if (!shader_signature_merge(&program->input_signature, normaliser.input_range_map, false) if (!shader_signature_merge(&program->input_signature, normaliser.input_range_map, false)
|| !shader_signature_merge(&program->output_signature, normaliser.output_range_map, false) || !shader_signature_merge(&program->output_signature, normaliser.output_range_map, false)
|| !shader_signature_merge(&program->patch_constant_signature, normaliser.pc_range_map, true)) || !shader_signature_merge(&program->patch_constant_signature, normaliser.pc_range_map, true))