mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-01-28 13:05:02 -08:00
vkd3d-shader/ir: Refactor return code checking in vkd3d_shader_normalise().
We started with only one or two of these but it has become excessive. Patch originally written by Conor McCarthy and updated by Giovanni Mascellani.
This commit is contained in:
parent
b3903636f7
commit
6df725718a
Notes:
Alexandre Julliard
2024-01-23 23:04:04 +01:00
Approved-by: Giovanni Mascellani (@giomasce) Approved-by: Francisco Casas (@fcasas) Approved-by: Henri Verbeet (@hverbeet) Approved-by: Alexandre Julliard (@julliard) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/574
@ -2260,38 +2260,43 @@ enum vkd3d_result vkd3d_shader_normalise(struct vkd3d_shader_parser *parser,
|
|||||||
if (parser->shader_desc.is_dxil)
|
if (parser->shader_desc.is_dxil)
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
if (parser->program.shader_version.type != VKD3D_SHADER_TYPE_PIXEL
|
if (parser->program.shader_version.type != VKD3D_SHADER_TYPE_PIXEL)
|
||||||
&& (result = remap_output_signature(parser, compile_info)) < 0)
|
{
|
||||||
|
if ((result = remap_output_signature(parser, compile_info)) < 0)
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (parser->program.shader_version.type == VKD3D_SHADER_TYPE_HULL)
|
||||||
|
{
|
||||||
|
if ((result = instruction_array_flatten_hull_shader_phases(instructions)) < 0)
|
||||||
|
return result;
|
||||||
|
|
||||||
|
if ((result = instruction_array_normalise_hull_shader_control_point_io(instructions,
|
||||||
|
&parser->shader_desc.input_signature)) < 0)
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((result = shader_normalise_io_registers(parser)) < 0)
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
if (parser->program.shader_version.type == VKD3D_SHADER_TYPE_HULL
|
if ((result = instruction_array_normalise_flat_constants(&parser->program)) < 0)
|
||||||
&& (result = instruction_array_flatten_hull_shader_phases(instructions)) >= 0)
|
return result;
|
||||||
{
|
|
||||||
result = instruction_array_normalise_hull_shader_control_point_io(instructions,
|
|
||||||
&parser->shader_desc.input_signature);
|
|
||||||
}
|
|
||||||
if (result >= 0)
|
|
||||||
result = shader_normalise_io_registers(parser);
|
|
||||||
|
|
||||||
if (result >= 0)
|
remove_dead_code(&parser->program);
|
||||||
result = instruction_array_normalise_flat_constants(&parser->program);
|
|
||||||
|
|
||||||
if (result >= 0)
|
if ((result = flatten_control_flow_constructs(parser)) < 0)
|
||||||
remove_dead_code(&parser->program);
|
return result;
|
||||||
|
|
||||||
if (result >= 0)
|
if ((result = normalise_combined_samplers(parser)) < 0)
|
||||||
result = flatten_control_flow_constructs(parser);
|
return result;
|
||||||
|
|
||||||
if (result >= 0)
|
if (TRACE_ON())
|
||||||
result = normalise_combined_samplers(parser);
|
|
||||||
|
|
||||||
if (result >= 0 && TRACE_ON())
|
|
||||||
vkd3d_shader_trace(&parser->program);
|
vkd3d_shader_trace(&parser->program);
|
||||||
|
|
||||||
if (result >= 0 && !parser->failed)
|
if (!parser->failed && (result = vsir_validate(parser)) < 0)
|
||||||
result = vsir_validate(parser);
|
return result;
|
||||||
|
|
||||||
if (result >= 0 && parser->failed)
|
if (parser->failed)
|
||||||
result = VKD3D_ERROR_INVALID_SHADER;
|
result = VKD3D_ERROR_INVALID_SHADER;
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user