vkd3d-shader: Keep track of whether programs have normalised hull shader control point I/O.

This commit is contained in:
Giovanni Mascellani 2024-10-17 14:21:21 +02:00 committed by Henri Verbeet
parent eba8fd4720
commit d9508558a9
Notes: Henri Verbeet 2024-10-17 17:40:38 +02:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1196
5 changed files with 17 additions and 3 deletions

View File

@ -2214,6 +2214,7 @@ int glsl_compile(struct vsir_program *program, uint64_t config_flags,
return ret;
VKD3D_ASSERT(program->normalised_io);
VKD3D_ASSERT(program->normalised_hull_cp_io);
vkd3d_glsl_generator_init(&generator, program, compile_info,
descriptor_info, combined_sampler_info, message_context);

View File

@ -99,6 +99,7 @@ bool vsir_program_init(struct vsir_program *program, const struct vkd3d_shader_c
program->shader_version = *version;
program->cf_type = cf_type;
program->normalised_io = normalised_io;
program->normalised_hull_cp_io = normalised_io;
return shader_instruction_array_init(&program->instructions, reserve);
}
@ -1134,6 +1135,14 @@ static enum vkd3d_result instruction_array_normalise_hull_shader_control_point_i
enum vkd3d_result ret;
unsigned int i, j;
VKD3D_ASSERT(!program->normalised_hull_cp_io);
if (program->shader_version.type != VKD3D_SHADER_TYPE_HULL)
{
program->normalised_hull_cp_io = true;
return VKD3D_OK;
}
if (!(normaliser.outpointid_param = vsir_program_create_outpointid_param(program)))
{
ERR("Failed to allocate src param.\n");
@ -1177,6 +1186,7 @@ static enum vkd3d_result instruction_array_normalise_hull_shader_control_point_i
break;
case VKD3DSIH_HS_CONTROL_POINT_PHASE:
program->instructions = normaliser.instructions;
program->normalised_hull_cp_io = true;
return VKD3D_OK;
case VKD3DSIH_HS_FORK_PHASE:
case VKD3DSIH_HS_JOIN_PHASE:
@ -1185,6 +1195,7 @@ static enum vkd3d_result instruction_array_normalise_hull_shader_control_point_i
ret = control_point_normaliser_emit_hs_input(&normaliser, &program->input_signature,
input_control_point_count, i, &location);
program->instructions = normaliser.instructions;
program->normalised_hull_cp_io = true;
return ret;
default:
break;
@ -1192,6 +1203,7 @@ static enum vkd3d_result instruction_array_normalise_hull_shader_control_point_i
}
program->instructions = normaliser.instructions;
program->normalised_hull_cp_io = true;
return VKD3D_OK;
}
@ -7659,11 +7671,9 @@ enum vkd3d_result vsir_program_transform(struct vsir_program *program, uint64_t
vsir_transform(&ctx, vsir_program_remap_output_signature);
if (program->shader_version.type == VKD3D_SHADER_TYPE_HULL)
{
vsir_transform(&ctx, vsir_program_flatten_hull_shader_phases);
vsir_transform(&ctx, instruction_array_normalise_hull_shader_control_point_io);
}
vsir_transform(&ctx, instruction_array_normalise_hull_shader_control_point_io);
vsir_transform(&ctx, vsir_program_normalise_io_registers);
vsir_transform(&ctx, vsir_program_normalise_flat_constants);
vsir_transform(&ctx, vsir_program_remove_dead_code);

View File

@ -870,6 +870,7 @@ int msl_compile(struct vsir_program *program, uint64_t config_flags,
return ret;
VKD3D_ASSERT(program->normalised_io);
VKD3D_ASSERT(program->normalised_hull_cp_io);
if ((ret = msl_generator_init(&generator, program, compile_info, descriptor_info, message_context)) < 0)
return ret;

View File

@ -10651,6 +10651,7 @@ static int spirv_compiler_generate_spirv(struct spirv_compiler *compiler, struct
return result;
VKD3D_ASSERT(program->normalised_io);
VKD3D_ASSERT(program->normalised_hull_cp_io);
max_element_count = max(program->output_signature.element_count, program->patch_constant_signature.element_count);
if (!(compiler->output_info = vkd3d_calloc(max_element_count, sizeof(*compiler->output_info))))

View File

@ -1416,6 +1416,7 @@ struct vsir_program
bool has_point_size;
enum vsir_control_flow_type cf_type;
bool normalised_io;
bool normalised_hull_cp_io;
const char **block_names;
size_t block_name_count;