rsx: Propagate decode failures up the chain.

- Dumping invalid data should not crash
This commit is contained in:
kd-11 2023-01-09 13:08:08 +03:00 committed by kd-11
parent bf1311b902
commit 2ccfee2e45
3 changed files with 55 additions and 47 deletions

View File

@ -1112,11 +1112,19 @@ namespace rsx
enum class surface_raster_type : u8
{
undefined = CELL_GCM_ZERO,
undefined = CELL_GCM_ZERO, // TODO: Drop this (used in surface cache for optional args)
linear = CELL_GCM_SURFACE_PITCH,
swizzle = CELL_GCM_SURFACE_SWIZZLE,
};
static inline auto to_surface_raster_type(u32 in)
{
return gcm_enum_cast<
surface_raster_type,
CELL_GCM_SURFACE_PITCH,
CELL_GCM_SURFACE_SWIZZLE>(in);
}
enum class surface_antialiasing : u8
{
center_1_sample = CELL_GCM_SURFACE_CENTER_1,

View File

@ -2222,7 +2222,7 @@ struct registers_decoder<NV4097_SET_DEPTH_FUNC>
public:
decoded_type(u32 value) : value(value) {}
rsx::comparison_function depth_func() const
auto depth_func() const
{
return to_comparison_function(value);
}
@ -2245,7 +2245,7 @@ struct registers_decoder<NV4097_SET_STENCIL_FUNC>
public:
decoded_type(u32 value) : value(value) {}
rsx::comparison_function stencil_func() const
auto stencil_func() const
{
return to_comparison_function(value);
}
@ -2268,7 +2268,7 @@ struct registers_decoder<NV4097_SET_BACK_STENCIL_FUNC>
public:
decoded_type(u32 value) : value(value) {}
rsx::comparison_function back_stencil_func() const
auto back_stencil_func() const
{
return to_comparison_function(value);
}
@ -2291,7 +2291,7 @@ struct registers_decoder<NV4097_SET_ALPHA_FUNC>
public:
decoded_type(u32 value) : value(value) {}
rsx::comparison_function alpha_func() const
auto alpha_func() const
{
return to_comparison_function(value);
}
@ -2314,7 +2314,7 @@ struct registers_decoder<NV4097_SET_STENCIL_OP_FAIL>
public:
decoded_type(u32 value) : value(value) {}
rsx::stencil_op fail() const
auto fail() const
{
return to_stencil_op(value);
}
@ -2337,7 +2337,7 @@ struct registers_decoder<NV4097_SET_STENCIL_OP_ZFAIL>
public:
decoded_type(u32 value) : value(value) {}
rsx::stencil_op zfail() const
auto zfail() const
{
return to_stencil_op(value);
}
@ -2360,7 +2360,7 @@ struct registers_decoder<NV4097_SET_STENCIL_OP_ZPASS>
public:
decoded_type(u32 value) : value(value) {}
rsx::stencil_op zpass() const
auto zpass() const
{
return to_stencil_op(value);
}
@ -2383,7 +2383,7 @@ struct registers_decoder<NV4097_SET_BACK_STENCIL_OP_FAIL>
public:
decoded_type(u32 value) : value(value) {}
rsx::stencil_op back_fail() const
auto back_fail() const
{
return to_stencil_op(value);
}
@ -2406,7 +2406,7 @@ struct registers_decoder<NV4097_SET_BACK_STENCIL_OP_ZFAIL>
public:
decoded_type(u32 value) : value(value) {}
rsx::stencil_op back_zfail() const
auto back_zfail() const
{
return to_stencil_op(value);
}
@ -2429,7 +2429,7 @@ struct registers_decoder<NV4097_SET_BACK_STENCIL_OP_ZPASS>
public:
decoded_type(u32 value) : value(value) {}
rsx::stencil_op back_zpass() const
auto back_zpass() const
{
return to_stencil_op(value);
}
@ -2650,7 +2650,7 @@ struct registers_decoder<NV4097_SET_LOGIC_OP>
public:
decoded_type(u32 value) : value(value) {}
logic_op logic_operation() const
auto logic_operation() const
{
return to_logic_op(value);
}
@ -2673,7 +2673,7 @@ struct registers_decoder<NV4097_SET_FRONT_FACE>
public:
decoded_type(u32 value) : value(value) {}
front_face front_face_mode() const
auto front_face_mode() const
{
return to_front_face(value);
}
@ -2720,7 +2720,7 @@ struct registers_decoder<NV4097_SET_SURFACE_COLOR_TARGET>
public:
decoded_type(u32 value) : value(value) {}
surface_target target() const
auto target() const
{
return to_surface_target(value);
}
@ -2743,7 +2743,7 @@ struct registers_decoder<NV4097_SET_FOG_MODE>
public:
decoded_type(u32 value) : value(value) {}
fog_mode fog_equation() const
auto fog_equation() const
{
return to_fog_mode(value);
}
@ -2766,7 +2766,7 @@ struct registers_decoder<NV4097_SET_BEGIN_END>
public:
decoded_type(u32 value) : value(value) {}
primitive_type primitive() const
auto primitive() const
{
return to_primitive_type(value);
}
@ -2789,7 +2789,7 @@ struct registers_decoder<NV3089_SET_OPERATION>
public:
decoded_type(u32 value) : value(value) {}
blit_engine::transfer_operation transfer_op() const
auto transfer_op() const
{
return blit_engine::to_transfer_operation(value);
}
@ -2812,7 +2812,7 @@ struct registers_decoder<NV3089_SET_COLOR_FORMAT>
public:
decoded_type(u32 value) : value(value) {}
expected<blit_engine::transfer_source_format> transfer_source_fmt() const
auto transfer_source_fmt() const
{
return blit_engine::to_transfer_source_format(value);
}
@ -2835,7 +2835,7 @@ struct registers_decoder<NV3089_SET_CONTEXT_SURFACE>
public:
decoded_type(u32 value) : value(value) {}
blit_engine::context_surface ctx_surface() const
auto ctx_surface() const
{
return blit_engine::to_context_surface(value);
}
@ -2858,7 +2858,7 @@ struct registers_decoder<NV3062_SET_COLOR_FORMAT>
public:
decoded_type(u32 value) : value(value) {}
expected<blit_engine::transfer_destination_format> transfer_dest_fmt() const
auto transfer_dest_fmt() const
{
return blit_engine::to_transfer_destination_format(value);
}
@ -2890,12 +2890,12 @@ struct registers_decoder<NV4097_SET_BLEND_EQUATION>
public:
decoded_type(u32 value) : value(value) {}
blend_equation blend_rgb() const
auto blend_rgb() const
{
return to_blend_equation(blend_rgb_raw());
}
blend_equation blend_a() const
auto blend_a() const
{
return to_blend_equation(blend_a_raw());
}
@ -2927,12 +2927,12 @@ struct registers_decoder<NV4097_SET_BLEND_FUNC_SFACTOR>
public:
decoded_type(u32 value) : value(value) {}
blend_factor src_blend_rgb() const
auto src_blend_rgb() const
{
return to_blend_factor(src_blend_rgb_raw());
}
blend_factor src_blend_a() const
auto src_blend_a() const
{
return to_blend_factor(src_blend_a_raw());
}
@ -2964,12 +2964,12 @@ struct registers_decoder<NV4097_SET_BLEND_FUNC_DFACTOR>
public:
decoded_type(u32 value) : value(value) {}
blend_factor dst_blend_rgb() const
auto dst_blend_rgb() const
{
return to_blend_factor(dst_blend_rgb_raw());
}
blend_factor dst_blend_a() const
auto dst_blend_a() const
{
return to_blend_factor(dst_blend_a_raw());
}
@ -3095,12 +3095,12 @@ struct registers_decoder<NV4097_SET_SHADER_WINDOW>
public:
decoded_type(u32 value) : value(value) {}
window_origin window_shader_origin() const
auto window_shader_origin() const
{
return to_window_origin(window_shader_origin_raw());
}
window_pixel_center window_shader_pixel_center() const
auto window_shader_pixel_center() const
{
return to_window_pixel_center(window_shader_pixel_center_raw());
}
@ -3172,32 +3172,32 @@ struct registers_decoder<NV4097_SET_USER_CLIP_PLANE_CONTROL>
public:
decoded_type(u32 value) : value(value) {}
user_clip_plane_op clip_plane0() const
auto clip_plane0() const
{
return to_user_clip_plane_op(clip_plane0_raw());
}
user_clip_plane_op clip_plane1() const
auto clip_plane1() const
{
return to_user_clip_plane_op(clip_plane1_raw());
}
user_clip_plane_op clip_plane2() const
auto clip_plane2() const
{
return to_user_clip_plane_op(clip_plane2_raw());
}
user_clip_plane_op clip_plane3() const
auto clip_plane3() const
{
return to_user_clip_plane_op(clip_plane3_raw());
}
user_clip_plane_op clip_plane4() const
auto clip_plane4() const
{
return to_user_clip_plane_op(clip_plane4_raw());
}
user_clip_plane_op clip_plane5() const
auto clip_plane5() const
{
return to_user_clip_plane_op(clip_plane5_raw());
}
@ -3306,22 +3306,22 @@ struct registers_decoder<NV4097_SET_SURFACE_FORMAT>
public:
decoded_type(u32 value) : value(value) {}
surface_color_format color_fmt() const
auto color_fmt() const
{
return to_surface_color_format(color_fmt_raw());
}
surface_depth_format depth_fmt() const
auto depth_fmt() const
{
return to_surface_depth_format(depth_fmt_raw());
}
surface_raster_type type() const
auto type() const
{
return static_cast<surface_raster_type>(type_raw());
return to_surface_raster_type(type_raw());
}
surface_antialiasing antialias() const
auto antialias() const
{
return to_surface_antialiasing(antialias_raw());
}
@ -3657,7 +3657,7 @@ struct registers_decoder<NV4097_SET_CONTEXT_DMA_REPORT>
public:
decoded_type(u32 value) : value(value) {}
blit_engine::context_dma context_dma_report() const
auto context_dma_report() const
{
return blit_engine::to_context_dma(value);
}
@ -3711,12 +3711,12 @@ struct registers_decoder<NV3089_IMAGE_IN_FORMAT>
return bf_decoder<0, 16>(value);
}
blit_engine::transfer_origin transfer_origin() const
auto transfer_origin() const
{
return blit_engine::to_transfer_origin(transfer_origin_raw());
}
blit_engine::transfer_interpolator transfer_interpolator() const
auto transfer_interpolator() const
{
return blit_engine::to_transfer_interpolator(transfer_interpolator_raw());
}
@ -3741,7 +3741,7 @@ struct registers_decoder<NV309E_SET_FORMAT>
public:
decoded_type(u32 value) : value(value) {}
expected<blit_engine::transfer_destination_format> format() const
auto format() const
{
return blit_engine::to_transfer_destination_format(transfer_destination_fmt());
}
@ -4011,7 +4011,7 @@ struct registers_decoder<NV4097_SET_SHADE_MODE>
public:
decoded_type(u32 value) : value(value) {}
shading_mode shading() const
auto shading() const
{
return to_shading_mode(value);
}
@ -4034,7 +4034,7 @@ struct registers_decoder<NV4097_SET_FRONT_POLYGON_MODE>
public:
decoded_type(u32 value) : value(value) {}
polygon_mode front_polygon_mode() const
auto front_polygon_mode() const
{
return to_polygon_mode(value);
}
@ -4057,7 +4057,7 @@ struct registers_decoder<NV4097_SET_BACK_POLYGON_MODE>
public:
decoded_type(u32 value) : value(value) {}
polygon_mode back_polygon_mode() const
auto back_polygon_mode() const
{
return to_polygon_mode(value);
}

View File

@ -1262,7 +1262,7 @@ namespace rsx
surface_depth_format2 surface_depth_fmt() const
{
const auto base_fmt = decode<NV4097_SET_SURFACE_FORMAT>().depth_fmt();
const auto base_fmt = *decode<NV4097_SET_SURFACE_FORMAT>().depth_fmt();
if (!depth_buffer_float_enabled()) [[likely]]
{
return static_cast<surface_depth_format2>(base_fmt);