diff --git a/rpcs3/Emu/RSX/GCM.cpp b/rpcs3/Emu/RSX/GCM.cpp
index d05edeb034..86794a7d58 100644
--- a/rpcs3/Emu/RSX/GCM.cpp
+++ b/rpcs3/Emu/RSX/GCM.cpp
@@ -720,648 +720,6 @@ namespace
};
}
-rsx::vertex_base_type rsx::to_vertex_base_type(u8 in)
-{
- switch (in)
- {
- case 1: return rsx::vertex_base_type::s1;
- case 2: return rsx::vertex_base_type::f;
- case 3: return rsx::vertex_base_type::sf;
- case 4: return rsx::vertex_base_type::ub;
- case 5: return rsx::vertex_base_type::s32k;
- case 6: return rsx::vertex_base_type::cmp;
- case 7: return rsx::vertex_base_type::ub256;
- }
- throw EXCEPTION("Unknown vertex base type %d", in);
-}
-
-rsx::index_array_type rsx::to_index_array_type(u8 in)
-{
- switch (in)
- {
- case 0: return rsx::index_array_type::u32;
- case 1: return rsx::index_array_type::u16;
- }
- throw EXCEPTION("Unknown index array type %d", in);
-}
-
-rsx::primitive_type rsx::to_primitive_type(u8 in)
-{
- switch (in)
- {
- case 0: return rsx::primitive_type::invalid;
- case 1: return rsx::primitive_type::points;
- case 2: return rsx::primitive_type::lines;
- case 3: return rsx::primitive_type::line_loop;
- case 4: return rsx::primitive_type::line_strip;
- case 5: return rsx::primitive_type::triangles;
- case 6: return rsx::primitive_type::triangle_strip;
- case 7: return rsx::primitive_type::triangle_fan;
- case 8: return rsx::primitive_type::quads;
- case 9: return rsx::primitive_type::quad_strip;
- case 10: return rsx::primitive_type::polygon;
- }
- throw EXCEPTION("Unknown primitive type %d", in);
-}
-
-enum
-{
- CELL_GCM_WINDOW_ORIGIN_TOP = 0,
- CELL_GCM_WINDOW_ORIGIN_BOTTOM = 1,
- CELL_GCM_WINDOW_PIXEL_CENTER_HALF = 0,
- CELL_GCM_WINDOW_PIXEL_CENTER_INTEGER = 1,
-};
-
-rsx::window_origin rsx::to_window_origin(u8 in)
-{
- switch (in)
- {
- case CELL_GCM_WINDOW_ORIGIN_TOP: return rsx::window_origin::top;
- case CELL_GCM_WINDOW_ORIGIN_BOTTOM: return rsx::window_origin::bottom;
- }
- throw EXCEPTION("Unknown window origin modifier 0x%x", in);
-}
-
-rsx::window_pixel_center rsx::to_window_pixel_center(u8 in)
-{
- switch (in)
- {
- case CELL_GCM_WINDOW_PIXEL_CENTER_HALF: return rsx::window_pixel_center::half;
- case CELL_GCM_WINDOW_PIXEL_CENTER_INTEGER: return rsx::window_pixel_center::integer;
- }
- throw EXCEPTION("Unknown window pixel center 0x%x", in);
-}
-
-rsx::comparison_function rsx::to_comparison_function(u16 in)
-{
- switch (in)
- {
- case CELL_GCM_NEVER: return rsx::comparison_function::never;
- case CELL_GCM_LESS: return rsx::comparison_function::less;
- case CELL_GCM_EQUAL: return rsx::comparison_function::equal;
- case CELL_GCM_LEQUAL: return rsx::comparison_function::less_or_equal;
- case CELL_GCM_GREATER: return rsx::comparison_function::greater;
- case CELL_GCM_NOTEQUAL: return rsx::comparison_function::not_equal;
- case CELL_GCM_GEQUAL: return rsx::comparison_function::greater_or_equal;
- case CELL_GCM_ALWAYS: return rsx::comparison_function::always;
- }
- throw EXCEPTION("Unknown comparison function 0x%x", in);
-}
-
-enum
-{
- CELL_GCM_FOG_MODE_LINEAR = 0x2601,
- CELL_GCM_FOG_MODE_EXP = 0x0800,
- CELL_GCM_FOG_MODE_EXP2 = 0x0801,
- CELL_GCM_FOG_MODE_EXP_ABS = 0x0802,
- CELL_GCM_FOG_MODE_EXP2_ABS = 0x0803,
- CELL_GCM_FOG_MODE_LINEAR_ABS = 0x0804,
-};
-
-rsx::fog_mode rsx::to_fog_mode(u32 in)
-{
- switch (in)
- {
- case CELL_GCM_FOG_MODE_LINEAR: return rsx::fog_mode::linear;
- case CELL_GCM_FOG_MODE_EXP: return rsx::fog_mode::exponential;
- case CELL_GCM_FOG_MODE_EXP2: return rsx::fog_mode::exponential2;
- case CELL_GCM_FOG_MODE_EXP_ABS: return rsx::fog_mode::exponential_abs;
- case CELL_GCM_FOG_MODE_EXP2_ABS: return rsx::fog_mode::exponential2_abs;
- case CELL_GCM_FOG_MODE_LINEAR_ABS: return rsx::fog_mode::linear_abs;
- }
- throw EXCEPTION("Unknown fog mode 0x%x", in);
-}
-
-rsx::texture_dimension rsx::to_texture_dimension(u8 in)
-{
- switch (in)
- {
- case 1: return rsx::texture_dimension::dimension1d;
- case 2: return rsx::texture_dimension::dimension2d;
- case 3: return rsx::texture_dimension::dimension3d;
- }
- throw EXCEPTION("Unknown texture dimension %d", in);
-}
-
-namespace rsx
-{
-std::string print_boolean(bool b)
-{
- switch (b)
- {
- case false: return "disabled";
- default: return "enabled";
- }
-}
-
-std::string to_string(comparison_function f)
-{
- switch (f)
- {
- case comparison_function::never: return "Never";
- case comparison_function::less: return "Less";
- case comparison_function::equal: return "Equal";
- case comparison_function::less_or_equal: return "Less_equal";
- case comparison_function::greater: return "Greater";
- case comparison_function::not_equal: return "Not_equal";
- case comparison_function::greater_or_equal: return "Greater_equal";
- case comparison_function::always: return "Always";
- }
- throw;
-}
-
-std::string to_string(stencil_op op)
-{
- switch (op)
- {
- case stencil_op::keep: return "Keep";
- case stencil_op::zero: return "Zero";
- case stencil_op::replace: return "Replace";
- case stencil_op::incr: return "Incr";
- case stencil_op::decr: return "Decr";
- case stencil_op::incr_wrap: return "Incr_wrap";
- case stencil_op::decr_wrap: return "Decr_wrap";
- }
- throw;
-}
-
-std::string to_string(fog_mode op)
-{
- switch (op)
- {
- case fog_mode::exponential: return "exponential";
- case fog_mode::exponential2: return "exponential2";
- case fog_mode::exponential2_abs: return "exponential2(abs)";
- case fog_mode::exponential_abs: return "exponential(abs)";
- case fog_mode::linear: return "linear";
- case fog_mode::linear_abs: return "linear(abs)";
- }
- throw;
-}
-
-std::string to_string(logic_op op)
-{
- switch (op)
- {
- case logic_op::logic_clear: return "Clear";
- case logic_op::logic_and: return "And";
- case logic_op::logic_and_reverse: return "And_reverse";
- case logic_op::logic_copy: return "Copy";
- case logic_op::logic_and_inverted: return "And_inverted";
- case logic_op::logic_noop: return "Noop";
- case logic_op::logic_xor: return "Xor";
- case logic_op::logic_or: return "Or";
- case logic_op::logic_nor: return "Nor";
- case logic_op::logic_equiv: return "Equiv";
- case logic_op::logic_invert: return "Invert";
- case logic_op::logic_or_reverse: return "Or_reverse";
- case logic_op::logic_copy_inverted: return "Copy_inverted";
- case logic_op::logic_or_inverted: return "Or_inverted";
- case logic_op::logic_nand: return "Nand";
- }
- throw;
-}
-
-std::string to_string(front_face op)
-{
- switch (op)
- {
- case front_face::ccw: return "counter clock wise";
- case front_face::cw: return "clock wise";
- }
- throw;
-}
-
-std::string to_string(cull_face op)
-{
- switch (op)
- {
- case cull_face::back: return "back";
- case cull_face::front: return "front";
- case cull_face::front_and_back: return "front and back";
- }
- throw;
-}
-
-std::string to_string(surface_target target)
-{
- switch (target)
- {
- case surface_target::none: return "none";
- case surface_target::surface_a: return "surface A";
- case surface_target::surface_b: return "surface B";
- case surface_target::surfaces_a_b: return "surfaces A and B";
- case surface_target::surfaces_a_b_c: return "surfaces A, B and C";
- case surface_target::surfaces_a_b_c_d: return "surfaces A,B, C and D";
- }
- throw;
-}
-
-std::string to_string(primitive_type draw_mode)
-{
- switch (draw_mode)
- {
- case primitive_type::invalid: return "";
- case primitive_type::points: return "Points";
- case primitive_type::lines: return "Lines";
- case primitive_type::line_loop: return "Line_loop";
- case primitive_type::line_strip: return "Line_strip";
- case primitive_type::triangles: return "Triangles";
- case primitive_type::triangle_strip: return "Triangle_strip";
- case primitive_type::triangle_fan: return "Triangle_fan";
- case primitive_type::quads: return "Quads";
- case primitive_type::quad_strip: return "Quad_strip";
- case primitive_type::polygon: return "Polygon";
- }
- throw;
-}
-
-std::string to_string(blit_engine::transfer_operation op)
-{
- switch (op)
- {
- case blit_engine::transfer_operation::blend_and: return "blend and";
- case blit_engine::transfer_operation::blend_premult: return "blend premult";
- case blit_engine::transfer_operation::rop_and: return "rop and";
- case blit_engine::transfer_operation::srccopy: return "srccopy";
- case blit_engine::transfer_operation::srccopy_and: return "srccopy_and";
- case blit_engine::transfer_operation::srccopy_premult: return "srccopy_premult";
- }
- throw;
-}
-
-std::string to_string(blit_engine::transfer_source_format op)
-{
- switch (op)
- {
- case blit_engine::transfer_source_format::a1r5g5b5: return "a1r5g5b5";
- case blit_engine::transfer_source_format::a8b8g8r8: return "a8b8g8r8";
- case blit_engine::transfer_source_format::a8r8g8b8: return "a8r8g8b8";
- case blit_engine::transfer_source_format::ay8: return "ay8";
- case blit_engine::transfer_source_format::cr8yb8cb8ya8: return "cr8yb8cb8ya8";
- case blit_engine::transfer_source_format::ecr8eyb8ecb8eya8: return "ecr8eyb8ecb8eya8";
- case blit_engine::transfer_source_format::eyb8ecr8eya8ecb8: return "eyb8ecr8eya8ecb8";
- case blit_engine::transfer_source_format::r5g6b5: return "r5g6b5";
- case blit_engine::transfer_source_format::x1r5g5b5: return "x1r5g5b5";
- case blit_engine::transfer_source_format::x8b8g8r8: return "x8b8g8r8";
- case blit_engine::transfer_source_format::x8r8g8b8: return "x8r8g8b8";
- case blit_engine::transfer_source_format::y8: return "y8";
- case blit_engine::transfer_source_format::yb8cr8ya8cb8: return "yb8cr8ya8cb8";
- }
- throw;
-}
-
-std::string to_string(blit_engine::context_surface op)
-{
- switch (op)
- {
- case blit_engine::context_surface::surface2d: return "surface 2d";
- case blit_engine::context_surface::swizzle2d: return "swizzle 2d";
- }
- throw;
-}
-
-std::string to_string(blit_engine::transfer_destination_format op)
-{
- switch (op)
- {
- case blit_engine::transfer_destination_format::a8r8g8b8: return "a8r8g8b8";
- case blit_engine::transfer_destination_format::r5g6b5: return "r5g6b5";
- case blit_engine::transfer_destination_format::y32: return "y32";
- }
- throw;
-}
-
-
-std::string to_string(blend_equation op)
-{
- switch (op)
- {
- case blend_equation::add: return "Add";
- case blend_equation::substract: return "Substract";
- case blend_equation::reverse_substract: return "Reverse_substract";
- case blend_equation::min: return "Min";
- case blend_equation::max: return "Max";
- case blend_equation::add_signed: return "Add_signed";
- case blend_equation::reverse_add_signed: return "Reverse_add_signed";
- case blend_equation::reverse_substract_signed: return "Reverse_substract_signed";
- }
- throw;
-}
-
-std::string to_string(blend_factor factor)
-{
- switch (factor)
- {
- case blend_factor::zero: return "0";
- case blend_factor::one: return "1";
- case blend_factor::src_color: return "src.rgb";
- case blend_factor::one_minus_src_color: return "(1 - src.rgb)";
- case blend_factor::src_alpha: return "src.a";
- case blend_factor::one_minus_src_alpha: return "(1 - src.a)";
- case blend_factor::dst_alpha: return "dst.a";
- case blend_factor::one_minus_dst_alpha: return "(1 - dst.a)";
- case blend_factor::dst_color: return "dst.rgb";
- case blend_factor::one_minus_dst_color: return "(1 - dst.rgb)";
- case blend_factor::src_alpha_saturate: return "sat(src.a)";
- case blend_factor::constant_color: return "const.rgb";
- case blend_factor::one_minus_constant_color: return "(1 - const.rgb)";
- case blend_factor::constant_alpha: return "const.a";
- case blend_factor::one_minus_constant_alpha: return "(1 - const.a)";
- }
- throw;
-}
-
-std::string to_string(window_origin origin)
-{
- switch (origin)
- {
- case window_origin::bottom: return "bottom";
- case window_origin::top: return "top";
- }
- throw;
-}
-
-std::string to_string(window_pixel_center in)
-{
- switch (in)
- {
- case window_pixel_center::half: return "half";
- case window_pixel_center::integer: return "integer";
- }
- throw;
-}
-
-std::string to_string(user_clip_plane_op op)
-{
- switch (op)
- {
- case user_clip_plane_op::disable: return "disabled";
- case user_clip_plane_op::greather_or_equal: return "greater or equal";
- case user_clip_plane_op::less_than: return "less than";
- }
- throw;
-}
-
-
-
-std::string to_string(surface_depth_format format)
-{
- switch (format)
- {
- case surface_depth_format::z16: return "CELL_GCM_SURFACE_Z16";
- case surface_depth_format::z24s8: return "CELL_GCM_SURFACE_Z24S8";
- }
- throw;
-}
-
-std::string to_string(surface_antialiasing format)
-{
- switch (format)
- {
- case surface_antialiasing::center_1_sample: return "1 sample centered";
- case surface_antialiasing::diagonal_centered_2_samples: return "2 samples diagonal centered";
- case surface_antialiasing::square_centered_4_samples: return "4 samples square centered";
- case surface_antialiasing::square_rotated_4_samples: return "4 samples diagonal rotated";
- }
- throw;
-}
-
-std::string to_string(surface_color_format format)
-{
- switch (format)
- {
- case surface_color_format::x1r5g5b5_z1r5g5b5: return "CELL_GCM_SURFACE_X1R5G5B5_Z1R5G5B5";
- case surface_color_format::x1r5g5b5_o1r5g5b5: return "CELL_GCM_SURFACE_X1R5G5B5_O1R5G5B5";
- case surface_color_format::r5g6b5: return "CELL_GCM_SURFACE_R5G6B5";
- case surface_color_format::x8r8g8b8_z8r8g8b8: return "CELL_GCM_SURFACE_X8R8G8B8_Z8R8G8B8";
- case surface_color_format::x8r8g8b8_o8r8g8b8: return "CELL_GCM_SURFACE_X8R8G8B8_O8R8G8B8";
- case surface_color_format::a8r8g8b8: return "CELL_GCM_SURFACE_A8R8G8B8";
- case surface_color_format::b8: return "CELL_GCM_SURFACE_B8";
- case surface_color_format::g8b8: return "CELL_GCM_SURFACE_G8B8";
- case surface_color_format::w16z16y16x16: return "CELL_GCM_SURFACE_F_W16Z16Y16X16";
- case surface_color_format::w32z32y32x32: return "CELL_GCM_SURFACE_F_W32Z32Y32X32";
- case surface_color_format::x32: return "CELL_GCM_SURFACE_F_X32";
- case surface_color_format::x8b8g8r8_z8b8g8r8: return "CELL_GCM_SURFACE_X8B8G8R8_Z8B8G8R8";
- case surface_color_format::x8b8g8r8_o8b8g8r8: return "CELL_GCM_SURFACE_X8B8G8R8_O8B8G8R8";
- case surface_color_format::a8b8g8r8: return "CELL_GCM_SURFACE_A8B8G8R8";
- }
- throw;
-}
-
-std::string to_string(index_array_type arg)
-{
- switch (arg)
- {
- case index_array_type::u16: return "unsigned short";
- case index_array_type::u32: return "unsigned int";
- }
- throw;
-}
-
-std::string to_string(blit_engine::context_dma op)
-{
- switch (op)
- {
- case blit_engine::context_dma::report_location_main: return "report location main";
- case blit_engine::context_dma::to_memory_get_report: return "to memory get report";
- }
- throw;
-}
-
-std::string to_string(blit_engine::transfer_origin op)
-{
- switch (op)
- {
- case blit_engine::transfer_origin::center: return "center";
- case blit_engine::transfer_origin::corner: return "corner";
- }
- throw;
-}
-
-std::string to_string(blit_engine::transfer_interpolator op)
-{
- switch (op)
- {
- case blit_engine::transfer_interpolator::foh: return "foh";
- case blit_engine::transfer_interpolator::zoh: return "zoh";
- }
- throw;
-}
-
-std::string to_string(shading_mode op)
-{
- switch (op)
- {
- case shading_mode::flat: return "flat";
- case shading_mode::smooth: return "smooth";
- }
- throw;
-}
-
-std::string to_string(polygon_mode op)
-{
- switch (op)
- {
- case polygon_mode::fill: return "fill";
- case polygon_mode::line: return "line";
- case polygon_mode::point: return "point";
- }
- throw;
-}
-
-} // end namespace rsx
-
-enum
-{
- // Surface Target
- CELL_GCM_SURFACE_TARGET_NONE = 0,
- CELL_GCM_SURFACE_TARGET_0 = 1,
- CELL_GCM_SURFACE_TARGET_1 = 2,
- CELL_GCM_SURFACE_TARGET_MRT1 = 0x13,
- CELL_GCM_SURFACE_TARGET_MRT2 = 0x17,
- CELL_GCM_SURFACE_TARGET_MRT3 = 0x1f,
-
- // Surface Depth
- CELL_GCM_SURFACE_Z16 = 1,
- CELL_GCM_SURFACE_Z24S8 = 2,
-
- // Surface Antialias
- CELL_GCM_SURFACE_CENTER_1 = 0,
- CELL_GCM_SURFACE_DIAGONAL_CENTERED_2 = 3,
- CELL_GCM_SURFACE_SQUARE_CENTERED_4 = 4,
- CELL_GCM_SURFACE_SQUARE_ROTATED_4 = 5,
-
- // Surface format
- CELL_GCM_SURFACE_X1R5G5B5_Z1R5G5B5 = 1,
- CELL_GCM_SURFACE_X1R5G5B5_O1R5G5B5 = 2,
- CELL_GCM_SURFACE_R5G6B5 = 3,
- CELL_GCM_SURFACE_X8R8G8B8_Z8R8G8B8 = 4,
- CELL_GCM_SURFACE_X8R8G8B8_O8R8G8B8 = 5,
- CELL_GCM_SURFACE_A8R8G8B8 = 8,
- CELL_GCM_SURFACE_B8 = 9,
- CELL_GCM_SURFACE_G8B8 = 10,
- CELL_GCM_SURFACE_F_W16Z16Y16X16 = 11,
- CELL_GCM_SURFACE_F_W32Z32Y32X32 = 12,
- CELL_GCM_SURFACE_F_X32 = 13,
- CELL_GCM_SURFACE_X8B8G8R8_Z8B8G8R8 = 14,
- CELL_GCM_SURFACE_X8B8G8R8_O8B8G8R8 = 15,
- CELL_GCM_SURFACE_A8B8G8R8 = 16,
-
- // Wrap
- CELL_GCM_TEXTURE_WRAP = 1,
- CELL_GCM_TEXTURE_MIRROR = 2,
- CELL_GCM_TEXTURE_CLAMP_TO_EDGE = 3,
- CELL_GCM_TEXTURE_BORDER = 4,
- CELL_GCM_TEXTURE_CLAMP = 5,
- CELL_GCM_TEXTURE_MIRROR_ONCE_CLAMP_TO_EDGE = 6,
- CELL_GCM_TEXTURE_MIRROR_ONCE_BORDER = 7,
- CELL_GCM_TEXTURE_MIRROR_ONCE_CLAMP = 8,
-
- // Max Anisotropy
- CELL_GCM_TEXTURE_MAX_ANISO_1 = 0,
- CELL_GCM_TEXTURE_MAX_ANISO_2 = 1,
- CELL_GCM_TEXTURE_MAX_ANISO_4 = 2,
- CELL_GCM_TEXTURE_MAX_ANISO_6 = 3,
- CELL_GCM_TEXTURE_MAX_ANISO_8 = 4,
- CELL_GCM_TEXTURE_MAX_ANISO_10 = 5,
- CELL_GCM_TEXTURE_MAX_ANISO_12 = 6,
- CELL_GCM_TEXTURE_MAX_ANISO_16 = 7,
-
- // Texture Filter
- CELL_GCM_TEXTURE_NEAREST = 1,
- CELL_GCM_TEXTURE_LINEAR = 2,
- CELL_GCM_TEXTURE_NEAREST_NEAREST = 3,
- CELL_GCM_TEXTURE_LINEAR_NEAREST = 4,
- CELL_GCM_TEXTURE_NEAREST_LINEAR = 5,
- CELL_GCM_TEXTURE_LINEAR_LINEAR = 6,
- CELL_GCM_TEXTURE_CONVOLUTION_MIN = 7,
- CELL_GCM_TEXTURE_CONVOLUTION_MAG = 4,
-};
-
-rsx::texture_wrap_mode rsx::to_texture_wrap_mode(u8 in)
-{
- switch (in)
- {
- case CELL_GCM_TEXTURE_WRAP: return rsx::texture_wrap_mode::wrap;
- case CELL_GCM_TEXTURE_MIRROR: return rsx::texture_wrap_mode::mirror;
- case CELL_GCM_TEXTURE_CLAMP_TO_EDGE: return rsx::texture_wrap_mode::clamp_to_edge;
- case CELL_GCM_TEXTURE_BORDER: return rsx::texture_wrap_mode::border;
- case CELL_GCM_TEXTURE_CLAMP: return rsx::texture_wrap_mode::clamp;
- case CELL_GCM_TEXTURE_MIRROR_ONCE_CLAMP_TO_EDGE: return rsx::texture_wrap_mode::mirror_once_clamp_to_edge;
- case CELL_GCM_TEXTURE_MIRROR_ONCE_BORDER: return rsx::texture_wrap_mode::mirror_once_border;
- case CELL_GCM_TEXTURE_MIRROR_ONCE_CLAMP: return rsx::texture_wrap_mode::mirror_once_clamp;
- }
- throw EXCEPTION("Unknown wrap mode 0x%x", in);
-}
-
-rsx::texture_max_anisotropy rsx::to_texture_max_anisotropy(u8 in)
-{
- switch (in)
- {
- case CELL_GCM_TEXTURE_MAX_ANISO_1: return rsx::texture_max_anisotropy::x1;
- case CELL_GCM_TEXTURE_MAX_ANISO_2: return rsx::texture_max_anisotropy::x2;
- case CELL_GCM_TEXTURE_MAX_ANISO_4: return rsx::texture_max_anisotropy::x4;
- case CELL_GCM_TEXTURE_MAX_ANISO_6: return rsx::texture_max_anisotropy::x6;
- case CELL_GCM_TEXTURE_MAX_ANISO_8: return rsx::texture_max_anisotropy::x8;
- case CELL_GCM_TEXTURE_MAX_ANISO_10: return rsx::texture_max_anisotropy::x10;
- case CELL_GCM_TEXTURE_MAX_ANISO_12: return rsx::texture_max_anisotropy::x12;
- case CELL_GCM_TEXTURE_MAX_ANISO_16: return rsx::texture_max_anisotropy::x16;
- }
- throw EXCEPTION("Unknown anisotropy max mode 0x%x", in);
-}
-
-rsx::texture_minify_filter rsx::to_texture_minify_filter(u8 in)
-{
- switch (in)
- {
- case CELL_GCM_TEXTURE_NEAREST: return rsx::texture_minify_filter::nearest;
- case CELL_GCM_TEXTURE_LINEAR: return rsx::texture_minify_filter::linear;
- case CELL_GCM_TEXTURE_NEAREST_NEAREST: return rsx::texture_minify_filter::nearest_nearest;
- case CELL_GCM_TEXTURE_LINEAR_NEAREST: return rsx::texture_minify_filter::linear_nearest;
- case CELL_GCM_TEXTURE_NEAREST_LINEAR: return rsx::texture_minify_filter::nearest_linear;
- case CELL_GCM_TEXTURE_LINEAR_LINEAR: return rsx::texture_minify_filter::linear_linear;
- case CELL_GCM_TEXTURE_CONVOLUTION_MIN: return rsx::texture_minify_filter::linear_linear;
- }
- throw EXCEPTION("Unknown minify filter 0x%x", in);
-}
-
-
-rsx::texture_magnify_filter rsx::to_texture_magnify_filter(u8 in)
-{
- switch (in)
- {
- case CELL_GCM_TEXTURE_NEAREST: return rsx::texture_magnify_filter::nearest;
- case CELL_GCM_TEXTURE_LINEAR: return rsx::texture_magnify_filter::linear;
- case CELL_GCM_TEXTURE_CONVOLUTION_MAG: return rsx::texture_magnify_filter::convolution_mag;
- }
- throw EXCEPTION("Unknown magnify filter 0x%x", in);
-}
-
-rsx::surface_target rsx::to_surface_target(u8 in)
-{
- switch (in)
- {
- case CELL_GCM_SURFACE_TARGET_NONE: return rsx::surface_target::none;
- case CELL_GCM_SURFACE_TARGET_0: return rsx::surface_target::surface_a;
- case CELL_GCM_SURFACE_TARGET_1: return rsx::surface_target::surface_b;
- case CELL_GCM_SURFACE_TARGET_MRT1: return rsx::surface_target::surfaces_a_b;
- case CELL_GCM_SURFACE_TARGET_MRT2: return rsx::surface_target::surfaces_a_b_c;
- case CELL_GCM_SURFACE_TARGET_MRT3: return rsx::surface_target::surfaces_a_b_c_d;
- }
- throw EXCEPTION("Unknown surface target 0x%x", in);
-}
-
-rsx::surface_depth_format rsx::to_surface_depth_format(u8 in)
-{
- switch (in)
- {
- case CELL_GCM_SURFACE_Z16: return rsx::surface_depth_format::z16;
- case CELL_GCM_SURFACE_Z24S8: return rsx::surface_depth_format::z24s8;
- }
- throw EXCEPTION("Unknown surface depth format 0x%x", in);
-}
-
std::string rsx::get_method_name(const u32 id)
{
auto found = methods_name.find(id);
@@ -1373,388 +731,6 @@ std::string rsx::get_method_name(const u32 id)
return fmt::format("Unknown/illegal method [0x%08x]", id);
}
-rsx::surface_antialiasing rsx::to_surface_antialiasing(u8 in)
-{
- switch (in)
- {
- case CELL_GCM_SURFACE_CENTER_1: return rsx::surface_antialiasing::center_1_sample;
- case CELL_GCM_SURFACE_DIAGONAL_CENTERED_2: return rsx::surface_antialiasing::diagonal_centered_2_samples;
- case CELL_GCM_SURFACE_SQUARE_CENTERED_4: return rsx::surface_antialiasing::square_centered_4_samples;
- case CELL_GCM_SURFACE_SQUARE_ROTATED_4: return rsx::surface_antialiasing::square_rotated_4_samples;
- }
- throw EXCEPTION("Unknown surface antialiasing format 0x%x", in);
-}
-
-rsx::surface_color_format rsx::to_surface_color_format(u8 in)
-{
- switch (in)
- {
- case CELL_GCM_SURFACE_X1R5G5B5_Z1R5G5B5: return rsx::surface_color_format::x1r5g5b5_z1r5g5b5;
- case CELL_GCM_SURFACE_X1R5G5B5_O1R5G5B5: return rsx::surface_color_format::x1r5g5b5_o1r5g5b5;
- case CELL_GCM_SURFACE_R5G6B5: return rsx::surface_color_format::r5g6b5;
- case CELL_GCM_SURFACE_X8R8G8B8_Z8R8G8B8: return rsx::surface_color_format::x8r8g8b8_z8r8g8b8;
- case CELL_GCM_SURFACE_X8R8G8B8_O8R8G8B8: return rsx::surface_color_format::x8r8g8b8_o8r8g8b8;
- case CELL_GCM_SURFACE_A8R8G8B8: return rsx::surface_color_format::a8r8g8b8;
- case CELL_GCM_SURFACE_B8: return rsx::surface_color_format::b8;
- case CELL_GCM_SURFACE_G8B8: return rsx::surface_color_format::g8b8;
- case CELL_GCM_SURFACE_F_W16Z16Y16X16: return rsx::surface_color_format::w16z16y16x16;
- case CELL_GCM_SURFACE_F_W32Z32Y32X32: return rsx::surface_color_format::w32z32y32x32;
- case CELL_GCM_SURFACE_F_X32: return rsx::surface_color_format::x32;
- case CELL_GCM_SURFACE_X8B8G8R8_Z8B8G8R8: return rsx::surface_color_format::x8b8g8r8_z8b8g8r8;
- case CELL_GCM_SURFACE_X8B8G8R8_O8B8G8R8: return rsx::surface_color_format::x8b8g8r8_o8b8g8r8;
- case CELL_GCM_SURFACE_A8B8G8R8: return rsx::surface_color_format::a8b8g8r8;
- }
- throw EXCEPTION("Unknown surface color format 0x%x", in);
-}
-
-enum
-{
- CELL_GCM_KEEP = 0x1E00,
- CELL_GCM_REPLACE = 0x1E01,
- CELL_GCM_INCR = 0x1E02,
- CELL_GCM_DECR = 0x1E03,
- CELL_GCM_INCR_WRAP = 0x8507,
- CELL_GCM_DECR_WRAP = 0x8508,
-};
-
-rsx::stencil_op rsx::to_stencil_op(u16 in)
-{
- switch (in)
- {
- case CELL_GCM_KEEP: return rsx::stencil_op::keep;
- case CELL_GCM_REPLACE: return rsx::stencil_op::replace;
- case CELL_GCM_INCR: return rsx::stencil_op::incr;
- case CELL_GCM_DECR: return rsx::stencil_op::decr;
- case CELL_GCM_INCR_WRAP: return rsx::stencil_op::incr_wrap;
- case CELL_GCM_DECR_WRAP: return rsx::stencil_op::decr_wrap;
- case CELL_GCM_ZERO: return rsx::stencil_op::zero;
- }
- throw EXCEPTION("Unknown stencil op 0x%x", in);
-}
-
-enum
-{
- CELL_GCM_FUNC_ADD = 0x8006,
- CELL_GCM_MIN = 0x8007,
- CELL_GCM_MAX = 0x8008,
- CELL_GCM_FUNC_SUBTRACT = 0x800A,
- CELL_GCM_FUNC_REVERSE_SUBTRACT = 0x800B,
- CELL_GCM_FUNC_REVERSE_SUBTRACT_SIGNED = 0x0000F005,
- CELL_GCM_FUNC_ADD_SIGNED = 0x0000F006,
- CELL_GCM_FUNC_REVERSE_ADD_SIGNED = 0x0000F007,
-};
-
-rsx::blend_equation rsx::to_blend_equation(u16 in)
-{
- switch (in)
- {
- case CELL_GCM_FUNC_ADD: return rsx::blend_equation::add;
- case CELL_GCM_MIN: return rsx::blend_equation::min;
- case CELL_GCM_MAX: return rsx::blend_equation::max;
- case CELL_GCM_FUNC_SUBTRACT: return rsx::blend_equation::substract;
- case CELL_GCM_FUNC_REVERSE_SUBTRACT: return rsx::blend_equation::reverse_substract;
- case CELL_GCM_FUNC_REVERSE_SUBTRACT_SIGNED: return rsx::blend_equation::reverse_substract_signed;
- case CELL_GCM_FUNC_ADD_SIGNED: return rsx::blend_equation::add_signed;
- case CELL_GCM_FUNC_REVERSE_ADD_SIGNED: return rsx::blend_equation::reverse_add_signed;
- }
- throw EXCEPTION("Unknown blend eq 0x%x", in);
-}
-
-enum
-{
- CELL_GCM_SRC_COLOR = 0x0300,
- CELL_GCM_ONE_MINUS_SRC_COLOR = 0x0301,
- CELL_GCM_SRC_ALPHA = 0x0302,
- CELL_GCM_ONE_MINUS_SRC_ALPHA = 0x0303,
- CELL_GCM_DST_ALPHA = 0x0304,
- CELL_GCM_ONE_MINUS_DST_ALPHA = 0x0305,
- CELL_GCM_DST_COLOR = 0x0306,
- CELL_GCM_ONE_MINUS_DST_COLOR = 0x0307,
- CELL_GCM_SRC_ALPHA_SATURATE = 0x0308,
- CELL_GCM_CONSTANT_COLOR = 0x8001,
- CELL_GCM_ONE_MINUS_CONSTANT_COLOR = 0x8002,
- CELL_GCM_CONSTANT_ALPHA = 0x8003,
- CELL_GCM_ONE_MINUS_CONSTANT_ALPHA = 0x8004,
-};
-
-rsx::blend_factor rsx::to_blend_factor(u16 in)
-{
- switch (in)
- {
- case CELL_GCM_ZERO: return rsx::blend_factor::zero;
- case CELL_GCM_ONE: return rsx::blend_factor::one;
- case CELL_GCM_SRC_COLOR: return rsx::blend_factor::src_color;
- case CELL_GCM_ONE_MINUS_SRC_COLOR: return rsx::blend_factor::one_minus_src_color;
- case CELL_GCM_SRC_ALPHA: return rsx::blend_factor::src_alpha;
- case CELL_GCM_ONE_MINUS_SRC_ALPHA: return rsx::blend_factor::one_minus_src_alpha;
- case CELL_GCM_DST_ALPHA: return rsx::blend_factor::dst_alpha;
- case CELL_GCM_ONE_MINUS_DST_ALPHA: return rsx::blend_factor::one_minus_dst_alpha;
- case CELL_GCM_DST_COLOR: return rsx::blend_factor::dst_color;
- case CELL_GCM_ONE_MINUS_DST_COLOR: return rsx::blend_factor::one_minus_dst_color;
- case CELL_GCM_SRC_ALPHA_SATURATE: return rsx::blend_factor::src_alpha_saturate;
- case CELL_GCM_CONSTANT_COLOR: return rsx::blend_factor::constant_color;
- case CELL_GCM_ONE_MINUS_CONSTANT_COLOR: return rsx::blend_factor::one_minus_constant_color;
- case CELL_GCM_CONSTANT_ALPHA: return rsx::blend_factor::constant_alpha;
- case CELL_GCM_ONE_MINUS_CONSTANT_ALPHA: return rsx::blend_factor::one_minus_constant_alpha;
- }
- throw EXCEPTION("Unknown blend factor 0x%x", in);
-}
-
-enum
-{
- CELL_GCM_CLEAR = 0x1500,
- CELL_GCM_AND = 0x1501,
- CELL_GCM_AND_REVERSE = 0x1502,
- CELL_GCM_COPY = 0x1503,
- CELL_GCM_AND_INVERTED = 0x1504,
- CELL_GCM_NOOP = 0x1505,
- CELL_GCM_XOR = 0x1506,
- CELL_GCM_OR = 0x1507,
- CELL_GCM_NOR = 0x1508,
- CELL_GCM_EQUIV = 0x1509,
- CELL_GCM_INVERT = 0x150A,
- CELL_GCM_OR_REVERSE = 0x150B,
- CELL_GCM_COPY_INVERTED = 0x150C,
- CELL_GCM_OR_INVERTED = 0x150D,
- CELL_GCM_NAND = 0x150E,
- CELL_GCM_SET = 0x150F,
-};
-
-rsx::logic_op rsx::to_logic_op(u16 in)
-{
- switch (in)
- {
- case CELL_GCM_CLEAR: return rsx::logic_op::logic_clear;
- case CELL_GCM_AND: return rsx::logic_op::logic_and;
- case CELL_GCM_AND_REVERSE: return rsx::logic_op::logic_and_reverse;
- case CELL_GCM_COPY: return rsx::logic_op::logic_copy;
- case CELL_GCM_AND_INVERTED: return rsx::logic_op::logic_and_inverted;
- case CELL_GCM_NOOP: return rsx::logic_op::logic_noop;
- case CELL_GCM_XOR: return rsx::logic_op::logic_xor;
- case CELL_GCM_OR: return rsx::logic_op::logic_or;
- case CELL_GCM_NOR: return rsx::logic_op::logic_nor;
- case CELL_GCM_EQUIV: return rsx::logic_op::logic_equiv;
- case CELL_GCM_INVERT: return rsx::logic_op::logic_invert;
- case CELL_GCM_OR_REVERSE: return rsx::logic_op::logic_or_reverse;
- case CELL_GCM_COPY_INVERTED: return rsx::logic_op::logic_copy_inverted;
- case CELL_GCM_OR_INVERTED: return rsx::logic_op::logic_or_inverted;
- case CELL_GCM_NAND: return rsx::logic_op::logic_nand;
- case CELL_GCM_SET: return rsx::logic_op::logic_set;
- }
- throw EXCEPTION("Unknown logic op 0x%x", in);
-}
-
-rsx::front_face rsx::to_front_face(u16 in)
-{
- switch (in)
- {
- default: // Disgaea 3 pass some garbage value at startup, this is needed to survive.
- case CELL_GCM_CW: return rsx::front_face::cw;
- case CELL_GCM_CCW: return rsx::front_face::ccw;
- }
- throw EXCEPTION("Unknown front face 0x%x", in);
-}
-
-rsx::cull_face rsx::to_cull_face(u16 in)
-{
- switch (in)
- {
- case CELL_GCM_FRONT_AND_BACK: return rsx::cull_face::front_and_back;
- case CELL_GCM_FRONT: return rsx::cull_face::front;
- case CELL_GCM_BACK: return rsx::cull_face::back;
- }
- throw EXCEPTION("Unknown cull face 0x%x", in);
-}
-
-enum
-{
- CELL_GCM_TRANSFER_ORIGIN_CENTER = 1,
- CELL_GCM_TRANSFER_ORIGIN_CORNER = 2,
-
- CELL_GCM_TRANSFER_INTERPOLATOR_ZOH = 0,
- CELL_GCM_TRANSFER_INTERPOLATOR_FOH = 1,
-};
-
-rsx::blit_engine::transfer_origin rsx::blit_engine::to_transfer_origin(u8 in)
-{
- switch (in)
- {
- case CELL_GCM_TRANSFER_ORIGIN_CENTER: return rsx::blit_engine::transfer_origin::center;
- case CELL_GCM_TRANSFER_ORIGIN_CORNER: return rsx::blit_engine::transfer_origin::corner;
- }
- throw EXCEPTION("Unknown tranfer origin 0x%x", in);
-}
-
-rsx::blit_engine::transfer_interpolator rsx::blit_engine::to_transfer_interpolator(u8 in)
-{
- switch (in)
- {
- case CELL_GCM_TRANSFER_INTERPOLATOR_ZOH: return rsx::blit_engine::transfer_interpolator::zoh;
- case CELL_GCM_TRANSFER_INTERPOLATOR_FOH: return rsx::blit_engine::transfer_interpolator::foh;
- }
- throw EXCEPTION("Unknown tranfer interpolator 0x%x", in);
-}
-
-enum
-{
- CELL_GCM_TRANSFER_OPERATION_SRCCOPY_AND = 0,
- CELL_GCM_TRANSFER_OPERATION_ROP_AND = 1,
- CELL_GCM_TRANSFER_OPERATION_BLEND_AND = 2,
- CELL_GCM_TRANSFER_OPERATION_SRCCOPY = 3,
- CELL_GCM_TRANSFER_OPERATION_SRCCOPY_PREMULT = 4,
- CELL_GCM_TRANSFER_OPERATION_BLEND_PREMULT = 5,
-};
-
-rsx::blit_engine::transfer_operation rsx::blit_engine::to_transfer_operation(u8 in)
-{
- switch (in)
- {
- case CELL_GCM_TRANSFER_OPERATION_SRCCOPY_AND: return rsx::blit_engine::transfer_operation::srccopy_and;
- case CELL_GCM_TRANSFER_OPERATION_ROP_AND: return rsx::blit_engine::transfer_operation::rop_and;
- case CELL_GCM_TRANSFER_OPERATION_BLEND_AND: return rsx::blit_engine::transfer_operation::blend_and;
- case CELL_GCM_TRANSFER_OPERATION_SRCCOPY: return rsx::blit_engine::transfer_operation::srccopy;
- case CELL_GCM_TRANSFER_OPERATION_SRCCOPY_PREMULT: return rsx::blit_engine::transfer_operation::srccopy_premult;
- case CELL_GCM_TRANSFER_OPERATION_BLEND_PREMULT: return rsx::blit_engine::transfer_operation::blend_premult;
- }
- throw EXCEPTION("Unknown tranfer operation 0x%x", in);
-}
-
-enum
-{
- CELL_GCM_TRANSFER_SCALE_FORMAT_A1R5G5B5 = 1,
- CELL_GCM_TRANSFER_SCALE_FORMAT_X1R5G5B5 = 2,
- CELL_GCM_TRANSFER_SCALE_FORMAT_A8R8G8B8 = 3,
- CELL_GCM_TRANSFER_SCALE_FORMAT_X8R8G8B8 = 4,
- CELL_GCM_TRANSFER_SCALE_FORMAT_CR8YB8CB8YA8 = 5,
- CELL_GCM_TRANSFER_SCALE_FORMAT_YB8CR8YA8CB8 = 6,
- CELL_GCM_TRANSFER_SCALE_FORMAT_R5G6B5 = 7,
- CELL_GCM_TRANSFER_SCALE_FORMAT_Y8 = 8,
- CELL_GCM_TRANSFER_SCALE_FORMAT_AY8 = 9,
- CELL_GCM_TRANSFER_SCALE_FORMAT_EYB8ECR8EYA8ECB8 = 10,
- CELL_GCM_TRANSFER_SCALE_FORMAT_ECR8EYB8ECB8EYA8 = 11,
- CELL_GCM_TRANSFER_SCALE_FORMAT_A8B8G8R8 = 12,
- CELL_GCM_TRANSFER_SCALE_FORMAT_X8B8G8R8 = 13,
-};
-
-rsx::blit_engine::transfer_source_format rsx::blit_engine::to_transfer_source_format(u8 in)
-{
- switch (in)
- {
- case CELL_GCM_TRANSFER_SCALE_FORMAT_A1R5G5B5: return rsx::blit_engine::transfer_source_format::a1r5g5b5;
- case CELL_GCM_TRANSFER_SCALE_FORMAT_X1R5G5B5: return rsx::blit_engine::transfer_source_format::x1r5g5b5;
- case CELL_GCM_TRANSFER_SCALE_FORMAT_A8R8G8B8: return rsx::blit_engine::transfer_source_format::a8r8g8b8;
- case CELL_GCM_TRANSFER_SCALE_FORMAT_X8R8G8B8: return rsx::blit_engine::transfer_source_format::x8r8g8b8;
- case CELL_GCM_TRANSFER_SCALE_FORMAT_CR8YB8CB8YA8: return rsx::blit_engine::transfer_source_format::cr8yb8cb8ya8;
- case CELL_GCM_TRANSFER_SCALE_FORMAT_YB8CR8YA8CB8: return rsx::blit_engine::transfer_source_format::yb8cr8ya8cb8;
- case CELL_GCM_TRANSFER_SCALE_FORMAT_R5G6B5: return rsx::blit_engine::transfer_source_format::r5g6b5;
- case CELL_GCM_TRANSFER_SCALE_FORMAT_Y8: return rsx::blit_engine::transfer_source_format::y8;
- case CELL_GCM_TRANSFER_SCALE_FORMAT_AY8: return rsx::blit_engine::transfer_source_format::ay8;
- case CELL_GCM_TRANSFER_SCALE_FORMAT_EYB8ECR8EYA8ECB8: return rsx::blit_engine::transfer_source_format::eyb8ecr8eya8ecb8;
- case CELL_GCM_TRANSFER_SCALE_FORMAT_ECR8EYB8ECB8EYA8: return rsx::blit_engine::transfer_source_format::ecr8eyb8ecb8eya8;
- case CELL_GCM_TRANSFER_SCALE_FORMAT_A8B8G8R8: return rsx::blit_engine::transfer_source_format::a8b8g8r8;
- case CELL_GCM_TRANSFER_SCALE_FORMAT_X8B8G8R8: return rsx::blit_engine::transfer_source_format::x8b8g8r8;
- }
- throw EXCEPTION("Unknown transfer source format 0x%x", in);
-}
-
-enum
-{
- // Destination Format conversions
- CELL_GCM_TRANSFER_SURFACE_FORMAT_R5G6B5 = 4,
- CELL_GCM_TRANSFER_SURFACE_FORMAT_A8R8G8B8 = 10,
- CELL_GCM_TRANSFER_SURFACE_FORMAT_Y32 = 11,
-};
-
-rsx::blit_engine::transfer_destination_format rsx::blit_engine::to_transfer_destination_format(u8 in)
-{
- switch (in)
- {
- case CELL_GCM_TRANSFER_SURFACE_FORMAT_R5G6B5: return rsx::blit_engine::transfer_destination_format::r5g6b5;
- case CELL_GCM_TRANSFER_SURFACE_FORMAT_A8R8G8B8: return rsx::blit_engine::transfer_destination_format::a8r8g8b8;
- case CELL_GCM_TRANSFER_SURFACE_FORMAT_Y32: return rsx::blit_engine::transfer_destination_format::y32;
- }
- throw EXCEPTION("Unknown transfer destination format 0x%x", in);
-}
-
-enum
-{
- CELL_GCM_CONTEXT_SURFACE2D = 0x313371C3,
- CELL_GCM_CONTEXT_SWIZZLE2D = 0x31337A73,
-};
-
-rsx::blit_engine::context_surface rsx::blit_engine::to_context_surface(u32 in)
-{
- switch (in)
- {
- case CELL_GCM_CONTEXT_SURFACE2D: return rsx::blit_engine::context_surface::surface2d;
- case CELL_GCM_CONTEXT_SWIZZLE2D: return rsx::blit_engine::context_surface::swizzle2d;
- }
- throw EXCEPTION("Unknown context surface 0x%x", in);
-}
-
-rsx::blit_engine::context_dma rsx::blit_engine::to_context_dma(u32 in)
-{
- switch (in)
- {
- case CELL_GCM_CONTEXT_DMA_TO_MEMORY_GET_REPORT: return rsx::blit_engine::context_dma::to_memory_get_report;
- case CELL_GCM_CONTEXT_DMA_REPORT_LOCATION_MAIN: return rsx::blit_engine::context_dma::report_location_main;
- }
- throw EXCEPTION("Unknown context dma 0x%x", in);
-}
-
-enum
-{
- CELL_GCM_USER_CLIP_PLANE_DISABLE = 0,
- CELL_GCM_USER_CLIP_PLANE_ENABLE_LT = 1,
- CELL_GCM_USER_CLIP_PLANE_ENABLE_GE = 2,
-};
-
-rsx::user_clip_plane_op rsx::to_user_clip_plane_op(u8 in)
-{
- switch (in)
- {
- case CELL_GCM_USER_CLIP_PLANE_DISABLE: return rsx::user_clip_plane_op::disable;
- case CELL_GCM_USER_CLIP_PLANE_ENABLE_LT: return rsx::user_clip_plane_op::less_than;
- case CELL_GCM_USER_CLIP_PLANE_ENABLE_GE: return rsx::user_clip_plane_op::greather_or_equal;
- }
- throw EXCEPTION("Unknown user clip plane 0x%x", in);
-}
-
-enum
-{
- CELL_GCM_FLAT = 0x1D00,
- CELL_GCM_SMOOTH = 0x1D01,
-};
-
-rsx::shading_mode rsx::to_shading_mode(u32 in)
-{
- switch (in)
- {
- case CELL_GCM_FLAT: return rsx::shading_mode::flat;
- case CELL_GCM_SMOOTH: return rsx::shading_mode::smooth;
- }
- throw EXCEPTION("Unknown shading mode 0x%x", in);
-}
-
-enum
-{
- CELL_GCM_POLYGON_MODE_POINT = 0x1B00,
- CELL_GCM_POLYGON_MODE_LINE = 0x1B01,
- CELL_GCM_POLYGON_MODE_FILL = 0x1B02,
-};
-
-rsx::polygon_mode rsx::to_polygon_mode(u32 in)
-{
- switch (in)
- {
- case CELL_GCM_POLYGON_MODE_POINT: return rsx::polygon_mode::point;
- case CELL_GCM_POLYGON_MODE_LINE: return rsx::polygon_mode::line;
- case CELL_GCM_POLYGON_MODE_FILL: return rsx::polygon_mode::fill;
- }
- throw EXCEPTION("Unknown polygon mode 0x%x", in);
-}
-
-
// Various parameter pretty printing function
namespace
{
diff --git a/rpcs3/Emu/RSX/GCM.h b/rpcs3/Emu/RSX/GCM.h
index dcc5bae7b7..1321e8cf4a 100644
--- a/rpcs3/Emu/RSX/GCM.h
+++ b/rpcs3/Emu/RSX/GCM.h
@@ -1,6 +1,7 @@
#pragma once
#include "Emu/Memory/vm.h"
+#include "gcm_enums.h"
enum
{
@@ -23,387 +24,6 @@ enum
CELL_GCM_DISPLAY_FREQUENCY_DISABLE = 3,
};
-namespace rsx
-{
- enum class vertex_base_type : u8
- {
- s1, ///< signed byte
- f, ///< float
- sf, ///< half float
- ub, ///< unsigned byte interpreted as 0.f and 1.f
- s32k, ///< signed 32bits int
- cmp, ///< compressed aka X11G11Z10 and always 1. W.
- ub256, ///< unsigned byte interpreted as between 0 and 255.
- };
-
- vertex_base_type to_vertex_base_type(u8 in);
-
- enum class index_array_type : u8
- {
- u32,
- u16,
- };
-
- index_array_type to_index_array_type(u8 in);
-
- enum class primitive_type : u8
- {
- invalid,
- points,
- lines,
- line_loop, // line strip with last end being joined with first end.
- line_strip,
- triangles,
- triangle_strip,
- triangle_fan, // like strip except that every triangle share the first vertex and one instead of 2 from previous triangle.
- quads,
- quad_strip,
- polygon, // convex polygon
- };
-
- primitive_type to_primitive_type(u8 in);
-
- enum class surface_target : u8
- {
- none,
- surface_a,
- surface_b,
- surfaces_a_b,
- surfaces_a_b_c,
- surfaces_a_b_c_d,
- };
-
- surface_target to_surface_target(u8 in);
-
- enum class surface_depth_format : u8
- {
- z16, // unsigned 16 bits depth
- z24s8, // unsigned 24 bits depth + 8 bits stencil
- };
-
- surface_depth_format to_surface_depth_format(u8 in);
-
- enum class surface_antialiasing : u8
- {
- center_1_sample,
- diagonal_centered_2_samples,
- square_centered_4_samples,
- square_rotated_4_samples,
- };
-
- surface_antialiasing to_surface_antialiasing(u8 in);
-
- enum class surface_color_format : u8
- {
- x1r5g5b5_z1r5g5b5,
- x1r5g5b5_o1r5g5b5,
- r5g6b5,
- x8r8g8b8_z8r8g8b8,
- x8r8g8b8_o8r8g8b8,
- a8r8g8b8,
- b8,
- g8b8,
- w16z16y16x16,
- w32z32y32x32,
- x32,
- x8b8g8r8_z8b8g8r8,
- x8b8g8r8_o8b8g8r8,
- a8b8g8r8,
- };
-
- surface_color_format to_surface_color_format(u8 in);
-
- enum class window_origin : u8
- {
- top,
- bottom
- };
-
- window_origin to_window_origin(u8 in);
-
- enum class window_pixel_center : u8
- {
- half,
- integer
- };
-
- window_pixel_center to_window_pixel_center(u8 in);
-
- enum class comparison_function : u8
- {
- never,
- less,
- equal,
- less_or_equal,
- greater,
- not_equal,
- greater_or_equal,
- always
- };
-
- comparison_function to_comparison_function(u16 in);
-
- enum class fog_mode : u8
- {
- linear,
- exponential,
- exponential2,
- exponential_abs,
- exponential2_abs,
- linear_abs
- };
-
- fog_mode to_fog_mode(u32 in);
-
- enum class texture_dimension : u8
- {
- dimension1d,
- dimension2d,
- dimension3d,
- };
-
- texture_dimension to_texture_dimension(u8 in);
-
- enum class texture_wrap_mode : u8
- {
- wrap,
- mirror,
- clamp_to_edge,
- border,
- clamp,
- mirror_once_clamp_to_edge,
- mirror_once_border,
- mirror_once_clamp,
- };
-
- texture_wrap_mode to_texture_wrap_mode(u8 in);
-
- enum class texture_max_anisotropy : u8
- {
- x1,
- x2,
- x4,
- x6,
- x8,
- x10,
- x12,
- x16,
- };
-
- texture_max_anisotropy to_texture_max_anisotropy(u8 in);
-
- enum class texture_minify_filter : u8
- {
- nearest, ///< no filtering, mipmap base level
- linear, ///< linear filtering, mipmap base level
- nearest_nearest, ///< no filtering, closest mipmap level
- linear_nearest, ///< linear filtering, closest mipmap level
- nearest_linear, ///< no filtering, linear mix between closest mipmap levels
- linear_linear, ///< linear filtering, linear mix between closest mipmap levels
- convolution_min, ///< Unknown mode but looks close to linear_linear
- };
-
- texture_minify_filter to_texture_minify_filter(u8 in);
-
- enum class texture_magnify_filter : u8
- {
- nearest, ///< no filtering
- linear, ///< linear filtering
- convolution_mag, ///< Unknown mode but looks close to linear
- };
-
- texture_magnify_filter to_texture_magnify_filter(u8 in);
-
- enum class stencil_op : u8
- {
- keep,
- zero,
- replace,
- incr,
- decr,
- invert,
- incr_wrap,
- decr_wrap,
- };
-
- stencil_op to_stencil_op(u16 in);
-
- enum class blend_equation : u8
- {
- add,
- min,
- max,
- substract,
- reverse_substract,
- reverse_substract_signed,
- add_signed,
- reverse_add_signed,
- };
-
- blend_equation to_blend_equation(u16 in);
-
- enum class blend_factor : u8
- {
- zero,
- one,
- src_color,
- one_minus_src_color,
- dst_color,
- one_minus_dst_color,
- src_alpha,
- one_minus_src_alpha,
- dst_alpha,
- one_minus_dst_alpha,
- src_alpha_saturate,
- constant_color,
- one_minus_constant_color,
- constant_alpha,
- one_minus_constant_alpha,
- };
-
- blend_factor to_blend_factor(u16 in);
-
- enum class logic_op : u8
- {
- logic_clear,
- logic_and,
- logic_and_reverse,
- logic_copy,
- logic_and_inverted,
- logic_noop,
- logic_xor,
- logic_or,
- logic_nor,
- logic_equiv,
- logic_invert,
- logic_or_reverse,
- logic_copy_inverted,
- logic_or_inverted,
- logic_nand,
- logic_set,
- };
-
- logic_op to_logic_op(u16 in);
-
- enum class front_face : u8
- {
- cw, /// clockwise
- ccw /// counter clockwise
- };
-
- front_face to_front_face(u16 in);
-
- enum class cull_face : u8
- {
- front,
- back,
- front_and_back,
- };
-
- cull_face to_cull_face(u16 in);
-
- enum class user_clip_plane_op : u8
- {
- disable,
- less_than,
- greather_or_equal,
- };
-
- user_clip_plane_op to_user_clip_plane_op(u8 in);
-
- enum class shading_mode : u8
- {
- smooth,
- flat,
- };
-
- shading_mode to_shading_mode(u32 in);
-
- enum class polygon_mode : u8
- {
- point,
- line,
- fill,
- };
-
- polygon_mode to_polygon_mode(u32 in);
-
- namespace blit_engine
- {
- enum class transfer_origin : u8
- {
- center,
- corner,
- };
-
- transfer_origin to_transfer_origin(u8 in);
-
- enum class transfer_interpolator : u8
- {
- zoh,
- foh,
- };
-
- transfer_interpolator to_transfer_interpolator(u8 in);
-
- enum class transfer_operation : u8
- {
- srccopy_and,
- rop_and,
- blend_and,
- srccopy,
- srccopy_premult,
- blend_premult,
- };
-
- transfer_operation to_transfer_operation(u8 in);
-
- enum class transfer_source_format : u8
- {
- a1r5g5b5,
- x1r5g5b5,
- a8r8g8b8,
- x8r8g8b8,
- cr8yb8cb8ya8,
- yb8cr8ya8cb8,
- r5g6b5,
- y8,
- ay8,
- eyb8ecr8eya8ecb8,
- ecr8eyb8ecb8eya8,
- a8b8g8r8,
- x8b8g8r8,
- };
-
- transfer_source_format to_transfer_source_format(u8 in);
-
- enum class transfer_destination_format : u8
- {
- r5g6b5,
- a8r8g8b8,
- y32,
- };
-
- transfer_destination_format to_transfer_destination_format(u8 in);
-
- enum class context_surface : u8
- {
- surface2d,
- swizzle2d,
- };
-
- context_surface to_context_surface(u32 in);
-
- enum class context_dma : u8
- {
- to_memory_get_report,
- report_location_main,
- };
-
- context_dma to_context_dma(u32 in);
- }
-}
-
enum
{
CELL_GCM_DISPLAY_FLIP_STATUS_ = 0,
diff --git a/rpcs3/Emu/RSX/gcm_enums.cpp b/rpcs3/Emu/RSX/gcm_enums.cpp
new file mode 100644
index 0000000000..e1fe86e992
--- /dev/null
+++ b/rpcs3/Emu/RSX/gcm_enums.cpp
@@ -0,0 +1,1063 @@
+#include "gcm_enums.h"
+#include "Utilities/StrFmt.h"
+
+#undef EXCEPTION
+#define EXCEPTION(format_str, ...) fmt::exception(format_str, ##__VA_ARGS__)
+
+rsx::vertex_base_type rsx::to_vertex_base_type(u8 in)
+{
+ switch (in)
+ {
+ case 1: return rsx::vertex_base_type::s1;
+ case 2: return rsx::vertex_base_type::f;
+ case 3: return rsx::vertex_base_type::sf;
+ case 4: return rsx::vertex_base_type::ub;
+ case 5: return rsx::vertex_base_type::s32k;
+ case 6: return rsx::vertex_base_type::cmp;
+ case 7: return rsx::vertex_base_type::ub256;
+ }
+ throw EXCEPTION("Unknown vertex base type %d", in);
+}
+
+rsx::index_array_type rsx::to_index_array_type(u8 in)
+{
+ switch (in)
+ {
+ case 0: return rsx::index_array_type::u32;
+ case 1: return rsx::index_array_type::u16;
+ }
+ throw EXCEPTION("Unknown index array type %d", in);
+}
+
+rsx::primitive_type rsx::to_primitive_type(u8 in)
+{
+ switch (in)
+ {
+ case 0: return rsx::primitive_type::invalid;
+ case 1: return rsx::primitive_type::points;
+ case 2: return rsx::primitive_type::lines;
+ case 3: return rsx::primitive_type::line_loop;
+ case 4: return rsx::primitive_type::line_strip;
+ case 5: return rsx::primitive_type::triangles;
+ case 6: return rsx::primitive_type::triangle_strip;
+ case 7: return rsx::primitive_type::triangle_fan;
+ case 8: return rsx::primitive_type::quads;
+ case 9: return rsx::primitive_type::quad_strip;
+ case 10: return rsx::primitive_type::polygon;
+ }
+ throw EXCEPTION("Unknown primitive type %d", in);
+}
+
+enum
+{
+ CELL_GCM_WINDOW_ORIGIN_TOP = 0,
+ CELL_GCM_WINDOW_ORIGIN_BOTTOM = 1,
+ CELL_GCM_WINDOW_PIXEL_CENTER_HALF = 0,
+ CELL_GCM_WINDOW_PIXEL_CENTER_INTEGER = 1,
+};
+
+rsx::window_origin rsx::to_window_origin(u8 in)
+{
+ switch (in)
+ {
+ case CELL_GCM_WINDOW_ORIGIN_TOP: return rsx::window_origin::top;
+ case CELL_GCM_WINDOW_ORIGIN_BOTTOM: return rsx::window_origin::bottom;
+ }
+ throw EXCEPTION("Unknown window origin modifier 0x%x", in);
+}
+
+rsx::window_pixel_center rsx::to_window_pixel_center(u8 in)
+{
+ switch (in)
+ {
+ case CELL_GCM_WINDOW_PIXEL_CENTER_HALF: return rsx::window_pixel_center::half;
+ case CELL_GCM_WINDOW_PIXEL_CENTER_INTEGER: return rsx::window_pixel_center::integer;
+ }
+ throw EXCEPTION("Unknown window pixel center 0x%x", in);
+}
+
+enum
+{
+ CELL_GCM_NEVER = 0x0200,
+ CELL_GCM_LESS = 0x0201,
+ CELL_GCM_EQUAL = 0x0202,
+ CELL_GCM_LEQUAL = 0x0203,
+ CELL_GCM_GREATER = 0x0204,
+ CELL_GCM_NOTEQUAL = 0x0205,
+ CELL_GCM_GEQUAL = 0x0206,
+ CELL_GCM_ALWAYS = 0x0207,
+
+ CELL_GCM_ZERO = 0,
+ CELL_GCM_ONE = 1,
+};
+
+rsx::comparison_function rsx::to_comparison_function(u16 in)
+{
+ switch (in)
+ {
+ case CELL_GCM_NEVER: return rsx::comparison_function::never;
+ case CELL_GCM_LESS: return rsx::comparison_function::less;
+ case CELL_GCM_EQUAL: return rsx::comparison_function::equal;
+ case CELL_GCM_LEQUAL: return rsx::comparison_function::less_or_equal;
+ case CELL_GCM_GREATER: return rsx::comparison_function::greater;
+ case CELL_GCM_NOTEQUAL: return rsx::comparison_function::not_equal;
+ case CELL_GCM_GEQUAL: return rsx::comparison_function::greater_or_equal;
+ case CELL_GCM_ALWAYS: return rsx::comparison_function::always;
+ }
+ throw EXCEPTION("Unknown comparison function 0x%x", in);
+}
+
+enum
+{
+ CELL_GCM_FOG_MODE_LINEAR = 0x2601,
+ CELL_GCM_FOG_MODE_EXP = 0x0800,
+ CELL_GCM_FOG_MODE_EXP2 = 0x0801,
+ CELL_GCM_FOG_MODE_EXP_ABS = 0x0802,
+ CELL_GCM_FOG_MODE_EXP2_ABS = 0x0803,
+ CELL_GCM_FOG_MODE_LINEAR_ABS = 0x0804,
+};
+
+rsx::fog_mode rsx::to_fog_mode(u32 in)
+{
+ switch (in)
+ {
+ case CELL_GCM_FOG_MODE_LINEAR: return rsx::fog_mode::linear;
+ case CELL_GCM_FOG_MODE_EXP: return rsx::fog_mode::exponential;
+ case CELL_GCM_FOG_MODE_EXP2: return rsx::fog_mode::exponential2;
+ case CELL_GCM_FOG_MODE_EXP_ABS: return rsx::fog_mode::exponential_abs;
+ case CELL_GCM_FOG_MODE_EXP2_ABS: return rsx::fog_mode::exponential2_abs;
+ case CELL_GCM_FOG_MODE_LINEAR_ABS: return rsx::fog_mode::linear_abs;
+ }
+ throw EXCEPTION("Unknown fog mode 0x%x", in);
+}
+
+rsx::texture_dimension rsx::to_texture_dimension(u8 in)
+{
+ switch (in)
+ {
+ case 1: return rsx::texture_dimension::dimension1d;
+ case 2: return rsx::texture_dimension::dimension2d;
+ case 3: return rsx::texture_dimension::dimension3d;
+ }
+ throw EXCEPTION("Unknown texture dimension %d", in);
+}
+
+namespace rsx
+{
+ std::string print_boolean(bool b)
+ {
+ return b ? "enabled" : "disabled";
+ }
+
+ std::string to_string(comparison_function f)
+ {
+ switch (f)
+ {
+ case comparison_function::never: return "Never";
+ case comparison_function::less: return "Less";
+ case comparison_function::equal: return "Equal";
+ case comparison_function::less_or_equal: return "Less_equal";
+ case comparison_function::greater: return "Greater";
+ case comparison_function::not_equal: return "Not_equal";
+ case comparison_function::greater_or_equal: return "Greater_equal";
+ case comparison_function::always: return "Always";
+ }
+ throw;
+ }
+
+ std::string to_string(stencil_op op)
+ {
+ switch (op)
+ {
+ case stencil_op::keep: return "Keep";
+ case stencil_op::zero: return "Zero";
+ case stencil_op::replace: return "Replace";
+ case stencil_op::incr: return "Incr";
+ case stencil_op::decr: return "Decr";
+ case stencil_op::incr_wrap: return "Incr_wrap";
+ case stencil_op::decr_wrap: return "Decr_wrap";
+ case stencil_op::invert: return "Invert";
+ }
+ throw;
+ }
+
+ std::string to_string(fog_mode op)
+ {
+ switch (op)
+ {
+ case fog_mode::exponential: return "exponential";
+ case fog_mode::exponential2: return "exponential2";
+ case fog_mode::exponential2_abs: return "exponential2(abs)";
+ case fog_mode::exponential_abs: return "exponential(abs)";
+ case fog_mode::linear: return "linear";
+ case fog_mode::linear_abs: return "linear(abs)";
+ }
+ throw;
+ }
+
+ std::string to_string(logic_op op)
+ {
+ switch (op)
+ {
+ case logic_op::logic_clear: return "Clear";
+ case logic_op::logic_and: return "And";
+ case logic_op::logic_set: return "Set";
+ case logic_op::logic_and_reverse: return "And_reverse";
+ case logic_op::logic_copy: return "Copy";
+ case logic_op::logic_and_inverted: return "And_inverted";
+ case logic_op::logic_noop: return "Noop";
+ case logic_op::logic_xor: return "Xor";
+ case logic_op::logic_or: return "Or";
+ case logic_op::logic_nor: return "Nor";
+ case logic_op::logic_equiv: return "Equiv";
+ case logic_op::logic_invert: return "Invert";
+ case logic_op::logic_or_reverse: return "Or_reverse";
+ case logic_op::logic_copy_inverted: return "Copy_inverted";
+ case logic_op::logic_or_inverted: return "Or_inverted";
+ case logic_op::logic_nand: return "Nand";
+ }
+ throw;
+ }
+
+ std::string to_string(front_face op)
+ {
+ switch (op)
+ {
+ case front_face::ccw: return "counter clock wise";
+ case front_face::cw: return "clock wise";
+ }
+ throw;
+ }
+
+ std::string to_string(cull_face op)
+ {
+ switch (op)
+ {
+ case cull_face::back: return "back";
+ case cull_face::front: return "front";
+ case cull_face::front_and_back: return "front and back";
+ }
+ throw;
+ }
+
+ std::string to_string(surface_target target)
+ {
+ switch (target)
+ {
+ case surface_target::none: return "none";
+ case surface_target::surface_a: return "surface A";
+ case surface_target::surface_b: return "surface B";
+ case surface_target::surfaces_a_b: return "surfaces A and B";
+ case surface_target::surfaces_a_b_c: return "surfaces A, B and C";
+ case surface_target::surfaces_a_b_c_d: return "surfaces A,B, C and D";
+ }
+ throw;
+ }
+
+ std::string to_string(primitive_type draw_mode)
+ {
+ switch (draw_mode)
+ {
+ case primitive_type::invalid: return "";
+ case primitive_type::points: return "Points";
+ case primitive_type::lines: return "Lines";
+ case primitive_type::line_loop: return "Line_loop";
+ case primitive_type::line_strip: return "Line_strip";
+ case primitive_type::triangles: return "Triangles";
+ case primitive_type::triangle_strip: return "Triangle_strip";
+ case primitive_type::triangle_fan: return "Triangle_fan";
+ case primitive_type::quads: return "Quads";
+ case primitive_type::quad_strip: return "Quad_strip";
+ case primitive_type::polygon: return "Polygon";
+ }
+ throw;
+ }
+
+ std::string to_string(blit_engine::transfer_operation op)
+ {
+ switch (op)
+ {
+ case blit_engine::transfer_operation::blend_and: return "blend and";
+ case blit_engine::transfer_operation::blend_premult: return "blend premult";
+ case blit_engine::transfer_operation::rop_and: return "rop and";
+ case blit_engine::transfer_operation::srccopy: return "srccopy";
+ case blit_engine::transfer_operation::srccopy_and: return "srccopy_and";
+ case blit_engine::transfer_operation::srccopy_premult: return "srccopy_premult";
+ }
+ throw;
+ }
+
+ std::string to_string(blit_engine::transfer_source_format op)
+ {
+ switch (op)
+ {
+ case blit_engine::transfer_source_format::a1r5g5b5: return "a1r5g5b5";
+ case blit_engine::transfer_source_format::a8b8g8r8: return "a8b8g8r8";
+ case blit_engine::transfer_source_format::a8r8g8b8: return "a8r8g8b8";
+ case blit_engine::transfer_source_format::ay8: return "ay8";
+ case blit_engine::transfer_source_format::cr8yb8cb8ya8: return "cr8yb8cb8ya8";
+ case blit_engine::transfer_source_format::ecr8eyb8ecb8eya8: return "ecr8eyb8ecb8eya8";
+ case blit_engine::transfer_source_format::eyb8ecr8eya8ecb8: return "eyb8ecr8eya8ecb8";
+ case blit_engine::transfer_source_format::r5g6b5: return "r5g6b5";
+ case blit_engine::transfer_source_format::x1r5g5b5: return "x1r5g5b5";
+ case blit_engine::transfer_source_format::x8b8g8r8: return "x8b8g8r8";
+ case blit_engine::transfer_source_format::x8r8g8b8: return "x8r8g8b8";
+ case blit_engine::transfer_source_format::y8: return "y8";
+ case blit_engine::transfer_source_format::yb8cr8ya8cb8: return "yb8cr8ya8cb8";
+ }
+ throw;
+ }
+
+ std::string to_string(blit_engine::context_surface op)
+ {
+ switch (op)
+ {
+ case blit_engine::context_surface::surface2d: return "surface 2d";
+ case blit_engine::context_surface::swizzle2d: return "swizzle 2d";
+ }
+ throw;
+ }
+
+ std::string to_string(blit_engine::transfer_destination_format op)
+ {
+ switch (op)
+ {
+ case blit_engine::transfer_destination_format::a8r8g8b8: return "a8r8g8b8";
+ case blit_engine::transfer_destination_format::r5g6b5: return "r5g6b5";
+ case blit_engine::transfer_destination_format::y32: return "y32";
+ }
+ throw;
+ }
+
+
+ std::string to_string(blend_equation op)
+ {
+ switch (op)
+ {
+ case blend_equation::add: return "Add";
+ case blend_equation::substract: return "Substract";
+ case blend_equation::reverse_substract: return "Reverse_substract";
+ case blend_equation::min: return "Min";
+ case blend_equation::max: return "Max";
+ case blend_equation::add_signed: return "Add_signed";
+ case blend_equation::reverse_add_signed: return "Reverse_add_signed";
+ case blend_equation::reverse_substract_signed: return "Reverse_substract_signed";
+ }
+ throw;
+ }
+
+ std::string to_string(blend_factor factor)
+ {
+ switch (factor)
+ {
+ case blend_factor::zero: return "0";
+ case blend_factor::one: return "1";
+ case blend_factor::src_color: return "src.rgb";
+ case blend_factor::one_minus_src_color: return "(1 - src.rgb)";
+ case blend_factor::src_alpha: return "src.a";
+ case blend_factor::one_minus_src_alpha: return "(1 - src.a)";
+ case blend_factor::dst_alpha: return "dst.a";
+ case blend_factor::one_minus_dst_alpha: return "(1 - dst.a)";
+ case blend_factor::dst_color: return "dst.rgb";
+ case blend_factor::one_minus_dst_color: return "(1 - dst.rgb)";
+ case blend_factor::src_alpha_saturate: return "sat(src.a)";
+ case blend_factor::constant_color: return "const.rgb";
+ case blend_factor::one_minus_constant_color: return "(1 - const.rgb)";
+ case blend_factor::constant_alpha: return "const.a";
+ case blend_factor::one_minus_constant_alpha: return "(1 - const.a)";
+ }
+ throw;
+ }
+
+ std::string to_string(window_origin origin)
+ {
+ switch (origin)
+ {
+ case window_origin::bottom: return "bottom";
+ case window_origin::top: return "top";
+ }
+ throw;
+ }
+
+ std::string to_string(window_pixel_center in)
+ {
+ switch (in)
+ {
+ case window_pixel_center::half: return "half";
+ case window_pixel_center::integer: return "integer";
+ }
+ throw;
+ }
+
+ std::string to_string(user_clip_plane_op op)
+ {
+ switch (op)
+ {
+ case user_clip_plane_op::disable: return "disabled";
+ case user_clip_plane_op::greather_or_equal: return "greater or equal";
+ case user_clip_plane_op::less_than: return "less than";
+ }
+ throw;
+ }
+
+
+
+ std::string to_string(surface_depth_format format)
+ {
+ switch (format)
+ {
+ case surface_depth_format::z16: return "CELL_GCM_SURFACE_Z16";
+ case surface_depth_format::z24s8: return "CELL_GCM_SURFACE_Z24S8";
+ }
+ throw;
+ }
+
+ std::string to_string(surface_antialiasing format)
+ {
+ switch (format)
+ {
+ case surface_antialiasing::center_1_sample: return "1 sample centered";
+ case surface_antialiasing::diagonal_centered_2_samples: return "2 samples diagonal centered";
+ case surface_antialiasing::square_centered_4_samples: return "4 samples square centered";
+ case surface_antialiasing::square_rotated_4_samples: return "4 samples diagonal rotated";
+ }
+ throw;
+ }
+
+ std::string to_string(surface_color_format format)
+ {
+ switch (format)
+ {
+ case surface_color_format::x1r5g5b5_z1r5g5b5: return "CELL_GCM_SURFACE_X1R5G5B5_Z1R5G5B5";
+ case surface_color_format::x1r5g5b5_o1r5g5b5: return "CELL_GCM_SURFACE_X1R5G5B5_O1R5G5B5";
+ case surface_color_format::r5g6b5: return "CELL_GCM_SURFACE_R5G6B5";
+ case surface_color_format::x8r8g8b8_z8r8g8b8: return "CELL_GCM_SURFACE_X8R8G8B8_Z8R8G8B8";
+ case surface_color_format::x8r8g8b8_o8r8g8b8: return "CELL_GCM_SURFACE_X8R8G8B8_O8R8G8B8";
+ case surface_color_format::a8r8g8b8: return "CELL_GCM_SURFACE_A8R8G8B8";
+ case surface_color_format::b8: return "CELL_GCM_SURFACE_B8";
+ case surface_color_format::g8b8: return "CELL_GCM_SURFACE_G8B8";
+ case surface_color_format::w16z16y16x16: return "CELL_GCM_SURFACE_F_W16Z16Y16X16";
+ case surface_color_format::w32z32y32x32: return "CELL_GCM_SURFACE_F_W32Z32Y32X32";
+ case surface_color_format::x32: return "CELL_GCM_SURFACE_F_X32";
+ case surface_color_format::x8b8g8r8_z8b8g8r8: return "CELL_GCM_SURFACE_X8B8G8R8_Z8B8G8R8";
+ case surface_color_format::x8b8g8r8_o8b8g8r8: return "CELL_GCM_SURFACE_X8B8G8R8_O8B8G8R8";
+ case surface_color_format::a8b8g8r8: return "CELL_GCM_SURFACE_A8B8G8R8";
+ }
+ throw;
+ }
+
+ std::string to_string(index_array_type arg)
+ {
+ switch (arg)
+ {
+ case index_array_type::u16: return "unsigned short";
+ case index_array_type::u32: return "unsigned int";
+ }
+ throw;
+ }
+
+ std::string to_string(blit_engine::context_dma op)
+ {
+ switch (op)
+ {
+ case blit_engine::context_dma::report_location_main: return "report location main";
+ case blit_engine::context_dma::to_memory_get_report: return "to memory get report";
+ }
+ throw;
+ }
+
+ std::string to_string(blit_engine::transfer_origin op)
+ {
+ switch (op)
+ {
+ case blit_engine::transfer_origin::center: return "center";
+ case blit_engine::transfer_origin::corner: return "corner";
+ }
+ throw;
+ }
+
+ std::string to_string(blit_engine::transfer_interpolator op)
+ {
+ switch (op)
+ {
+ case blit_engine::transfer_interpolator::foh: return "foh";
+ case blit_engine::transfer_interpolator::zoh: return "zoh";
+ }
+ throw;
+ }
+
+ std::string to_string(shading_mode op)
+ {
+ switch (op)
+ {
+ case shading_mode::flat: return "flat";
+ case shading_mode::smooth: return "smooth";
+ }
+ throw;
+ }
+
+ std::string to_string(polygon_mode op)
+ {
+ switch (op)
+ {
+ case polygon_mode::fill: return "fill";
+ case polygon_mode::line: return "line";
+ case polygon_mode::point: return "point";
+ }
+ throw;
+ }
+
+} // end namespace rsx
+
+enum
+{
+ // Surface Target
+ CELL_GCM_SURFACE_TARGET_NONE = 0,
+ CELL_GCM_SURFACE_TARGET_0 = 1,
+ CELL_GCM_SURFACE_TARGET_1 = 2,
+ CELL_GCM_SURFACE_TARGET_MRT1 = 0x13,
+ CELL_GCM_SURFACE_TARGET_MRT2 = 0x17,
+ CELL_GCM_SURFACE_TARGET_MRT3 = 0x1f,
+
+ // Surface Depth
+ CELL_GCM_SURFACE_Z16 = 1,
+ CELL_GCM_SURFACE_Z24S8 = 2,
+
+ // Surface Antialias
+ CELL_GCM_SURFACE_CENTER_1 = 0,
+ CELL_GCM_SURFACE_DIAGONAL_CENTERED_2 = 3,
+ CELL_GCM_SURFACE_SQUARE_CENTERED_4 = 4,
+ CELL_GCM_SURFACE_SQUARE_ROTATED_4 = 5,
+
+ // Surface format
+ CELL_GCM_SURFACE_X1R5G5B5_Z1R5G5B5 = 1,
+ CELL_GCM_SURFACE_X1R5G5B5_O1R5G5B5 = 2,
+ CELL_GCM_SURFACE_R5G6B5 = 3,
+ CELL_GCM_SURFACE_X8R8G8B8_Z8R8G8B8 = 4,
+ CELL_GCM_SURFACE_X8R8G8B8_O8R8G8B8 = 5,
+ CELL_GCM_SURFACE_A8R8G8B8 = 8,
+ CELL_GCM_SURFACE_B8 = 9,
+ CELL_GCM_SURFACE_G8B8 = 10,
+ CELL_GCM_SURFACE_F_W16Z16Y16X16 = 11,
+ CELL_GCM_SURFACE_F_W32Z32Y32X32 = 12,
+ CELL_GCM_SURFACE_F_X32 = 13,
+ CELL_GCM_SURFACE_X8B8G8R8_Z8B8G8R8 = 14,
+ CELL_GCM_SURFACE_X8B8G8R8_O8B8G8R8 = 15,
+ CELL_GCM_SURFACE_A8B8G8R8 = 16,
+
+ // Wrap
+ CELL_GCM_TEXTURE_WRAP = 1,
+ CELL_GCM_TEXTURE_MIRROR = 2,
+ CELL_GCM_TEXTURE_CLAMP_TO_EDGE = 3,
+ CELL_GCM_TEXTURE_BORDER = 4,
+ CELL_GCM_TEXTURE_CLAMP = 5,
+ CELL_GCM_TEXTURE_MIRROR_ONCE_CLAMP_TO_EDGE = 6,
+ CELL_GCM_TEXTURE_MIRROR_ONCE_BORDER = 7,
+ CELL_GCM_TEXTURE_MIRROR_ONCE_CLAMP = 8,
+
+ // Max Anisotropy
+ CELL_GCM_TEXTURE_MAX_ANISO_1 = 0,
+ CELL_GCM_TEXTURE_MAX_ANISO_2 = 1,
+ CELL_GCM_TEXTURE_MAX_ANISO_4 = 2,
+ CELL_GCM_TEXTURE_MAX_ANISO_6 = 3,
+ CELL_GCM_TEXTURE_MAX_ANISO_8 = 4,
+ CELL_GCM_TEXTURE_MAX_ANISO_10 = 5,
+ CELL_GCM_TEXTURE_MAX_ANISO_12 = 6,
+ CELL_GCM_TEXTURE_MAX_ANISO_16 = 7,
+
+ // Texture Filter
+ CELL_GCM_TEXTURE_NEAREST = 1,
+ CELL_GCM_TEXTURE_LINEAR = 2,
+ CELL_GCM_TEXTURE_NEAREST_NEAREST = 3,
+ CELL_GCM_TEXTURE_LINEAR_NEAREST = 4,
+ CELL_GCM_TEXTURE_NEAREST_LINEAR = 5,
+ CELL_GCM_TEXTURE_LINEAR_LINEAR = 6,
+ CELL_GCM_TEXTURE_CONVOLUTION_MIN = 7,
+ CELL_GCM_TEXTURE_CONVOLUTION_MAG = 4,
+};
+
+rsx::texture_wrap_mode rsx::to_texture_wrap_mode(u8 in)
+{
+ switch (in)
+ {
+ case CELL_GCM_TEXTURE_WRAP: return rsx::texture_wrap_mode::wrap;
+ case CELL_GCM_TEXTURE_MIRROR: return rsx::texture_wrap_mode::mirror;
+ case CELL_GCM_TEXTURE_CLAMP_TO_EDGE: return rsx::texture_wrap_mode::clamp_to_edge;
+ case CELL_GCM_TEXTURE_BORDER: return rsx::texture_wrap_mode::border;
+ case CELL_GCM_TEXTURE_CLAMP: return rsx::texture_wrap_mode::clamp;
+ case CELL_GCM_TEXTURE_MIRROR_ONCE_CLAMP_TO_EDGE: return rsx::texture_wrap_mode::mirror_once_clamp_to_edge;
+ case CELL_GCM_TEXTURE_MIRROR_ONCE_BORDER: return rsx::texture_wrap_mode::mirror_once_border;
+ case CELL_GCM_TEXTURE_MIRROR_ONCE_CLAMP: return rsx::texture_wrap_mode::mirror_once_clamp;
+ }
+ throw EXCEPTION("Unknown wrap mode 0x%x", in);
+}
+
+rsx::texture_max_anisotropy rsx::to_texture_max_anisotropy(u8 in)
+{
+ switch (in)
+ {
+ case CELL_GCM_TEXTURE_MAX_ANISO_1: return rsx::texture_max_anisotropy::x1;
+ case CELL_GCM_TEXTURE_MAX_ANISO_2: return rsx::texture_max_anisotropy::x2;
+ case CELL_GCM_TEXTURE_MAX_ANISO_4: return rsx::texture_max_anisotropy::x4;
+ case CELL_GCM_TEXTURE_MAX_ANISO_6: return rsx::texture_max_anisotropy::x6;
+ case CELL_GCM_TEXTURE_MAX_ANISO_8: return rsx::texture_max_anisotropy::x8;
+ case CELL_GCM_TEXTURE_MAX_ANISO_10: return rsx::texture_max_anisotropy::x10;
+ case CELL_GCM_TEXTURE_MAX_ANISO_12: return rsx::texture_max_anisotropy::x12;
+ case CELL_GCM_TEXTURE_MAX_ANISO_16: return rsx::texture_max_anisotropy::x16;
+ }
+ throw EXCEPTION("Unknown anisotropy max mode 0x%x", in);
+}
+
+rsx::texture_minify_filter rsx::to_texture_minify_filter(u8 in)
+{
+ switch (in)
+ {
+ case CELL_GCM_TEXTURE_NEAREST: return rsx::texture_minify_filter::nearest;
+ case CELL_GCM_TEXTURE_LINEAR: return rsx::texture_minify_filter::linear;
+ case CELL_GCM_TEXTURE_NEAREST_NEAREST: return rsx::texture_minify_filter::nearest_nearest;
+ case CELL_GCM_TEXTURE_LINEAR_NEAREST: return rsx::texture_minify_filter::linear_nearest;
+ case CELL_GCM_TEXTURE_NEAREST_LINEAR: return rsx::texture_minify_filter::nearest_linear;
+ case CELL_GCM_TEXTURE_LINEAR_LINEAR: return rsx::texture_minify_filter::linear_linear;
+ case CELL_GCM_TEXTURE_CONVOLUTION_MIN: return rsx::texture_minify_filter::linear_linear;
+ }
+ throw EXCEPTION("Unknown minify filter 0x%x", in);
+}
+
+
+rsx::texture_magnify_filter rsx::to_texture_magnify_filter(u8 in)
+{
+ switch (in)
+ {
+ case CELL_GCM_TEXTURE_NEAREST: return rsx::texture_magnify_filter::nearest;
+ case CELL_GCM_TEXTURE_LINEAR: return rsx::texture_magnify_filter::linear;
+ case CELL_GCM_TEXTURE_CONVOLUTION_MAG: return rsx::texture_magnify_filter::convolution_mag;
+ }
+ throw EXCEPTION("Unknown magnify filter 0x%x", in);
+}
+
+rsx::surface_target rsx::to_surface_target(u8 in)
+{
+ switch (in)
+ {
+ case CELL_GCM_SURFACE_TARGET_NONE: return rsx::surface_target::none;
+ case CELL_GCM_SURFACE_TARGET_0: return rsx::surface_target::surface_a;
+ case CELL_GCM_SURFACE_TARGET_1: return rsx::surface_target::surface_b;
+ case CELL_GCM_SURFACE_TARGET_MRT1: return rsx::surface_target::surfaces_a_b;
+ case CELL_GCM_SURFACE_TARGET_MRT2: return rsx::surface_target::surfaces_a_b_c;
+ case CELL_GCM_SURFACE_TARGET_MRT3: return rsx::surface_target::surfaces_a_b_c_d;
+ }
+ throw EXCEPTION("Unknown surface target 0x%x", in);
+}
+
+rsx::surface_depth_format rsx::to_surface_depth_format(u8 in)
+{
+ switch (in)
+ {
+ case CELL_GCM_SURFACE_Z16: return rsx::surface_depth_format::z16;
+ case CELL_GCM_SURFACE_Z24S8: return rsx::surface_depth_format::z24s8;
+ }
+ throw EXCEPTION("Unknown surface depth format 0x%x", in);
+}
+
+
+
+rsx::surface_antialiasing rsx::to_surface_antialiasing(u8 in)
+{
+ switch (in)
+ {
+ case CELL_GCM_SURFACE_CENTER_1: return rsx::surface_antialiasing::center_1_sample;
+ case CELL_GCM_SURFACE_DIAGONAL_CENTERED_2: return rsx::surface_antialiasing::diagonal_centered_2_samples;
+ case CELL_GCM_SURFACE_SQUARE_CENTERED_4: return rsx::surface_antialiasing::square_centered_4_samples;
+ case CELL_GCM_SURFACE_SQUARE_ROTATED_4: return rsx::surface_antialiasing::square_rotated_4_samples;
+ }
+ throw EXCEPTION("Unknown surface antialiasing format 0x%x", in);
+}
+
+rsx::surface_color_format rsx::to_surface_color_format(u8 in)
+{
+ switch (in)
+ {
+ case CELL_GCM_SURFACE_X1R5G5B5_Z1R5G5B5: return rsx::surface_color_format::x1r5g5b5_z1r5g5b5;
+ case CELL_GCM_SURFACE_X1R5G5B5_O1R5G5B5: return rsx::surface_color_format::x1r5g5b5_o1r5g5b5;
+ case CELL_GCM_SURFACE_R5G6B5: return rsx::surface_color_format::r5g6b5;
+ case CELL_GCM_SURFACE_X8R8G8B8_Z8R8G8B8: return rsx::surface_color_format::x8r8g8b8_z8r8g8b8;
+ case CELL_GCM_SURFACE_X8R8G8B8_O8R8G8B8: return rsx::surface_color_format::x8r8g8b8_o8r8g8b8;
+ case CELL_GCM_SURFACE_A8R8G8B8: return rsx::surface_color_format::a8r8g8b8;
+ case CELL_GCM_SURFACE_B8: return rsx::surface_color_format::b8;
+ case CELL_GCM_SURFACE_G8B8: return rsx::surface_color_format::g8b8;
+ case CELL_GCM_SURFACE_F_W16Z16Y16X16: return rsx::surface_color_format::w16z16y16x16;
+ case CELL_GCM_SURFACE_F_W32Z32Y32X32: return rsx::surface_color_format::w32z32y32x32;
+ case CELL_GCM_SURFACE_F_X32: return rsx::surface_color_format::x32;
+ case CELL_GCM_SURFACE_X8B8G8R8_Z8B8G8R8: return rsx::surface_color_format::x8b8g8r8_z8b8g8r8;
+ case CELL_GCM_SURFACE_X8B8G8R8_O8B8G8R8: return rsx::surface_color_format::x8b8g8r8_o8b8g8r8;
+ case CELL_GCM_SURFACE_A8B8G8R8: return rsx::surface_color_format::a8b8g8r8;
+ }
+ throw EXCEPTION("Unknown surface color format 0x%x", in);
+}
+
+enum
+{
+ CELL_GCM_KEEP = 0x1E00,
+ CELL_GCM_REPLACE = 0x1E01,
+ CELL_GCM_INCR = 0x1E02,
+ CELL_GCM_DECR = 0x1E03,
+ CELL_GCM_INCR_WRAP = 0x8507,
+ CELL_GCM_DECR_WRAP = 0x8508,
+};
+
+rsx::stencil_op rsx::to_stencil_op(u16 in)
+{
+ switch (in)
+ {
+ case CELL_GCM_KEEP: return rsx::stencil_op::keep;
+ case CELL_GCM_REPLACE: return rsx::stencil_op::replace;
+ case CELL_GCM_INCR: return rsx::stencil_op::incr;
+ case CELL_GCM_DECR: return rsx::stencil_op::decr;
+ case CELL_GCM_INCR_WRAP: return rsx::stencil_op::incr_wrap;
+ case CELL_GCM_DECR_WRAP: return rsx::stencil_op::decr_wrap;
+ case CELL_GCM_ZERO: return rsx::stencil_op::zero;
+ }
+ throw EXCEPTION("Unknown stencil op 0x%x", in);
+}
+
+enum
+{
+ CELL_GCM_FUNC_ADD = 0x8006,
+ CELL_GCM_MIN = 0x8007,
+ CELL_GCM_MAX = 0x8008,
+ CELL_GCM_FUNC_SUBTRACT = 0x800A,
+ CELL_GCM_FUNC_REVERSE_SUBTRACT = 0x800B,
+ CELL_GCM_FUNC_REVERSE_SUBTRACT_SIGNED = 0x0000F005,
+ CELL_GCM_FUNC_ADD_SIGNED = 0x0000F006,
+ CELL_GCM_FUNC_REVERSE_ADD_SIGNED = 0x0000F007,
+};
+
+rsx::blend_equation rsx::to_blend_equation(u16 in)
+{
+ switch (in)
+ {
+ case CELL_GCM_FUNC_ADD: return rsx::blend_equation::add;
+ case CELL_GCM_MIN: return rsx::blend_equation::min;
+ case CELL_GCM_MAX: return rsx::blend_equation::max;
+ case CELL_GCM_FUNC_SUBTRACT: return rsx::blend_equation::substract;
+ case CELL_GCM_FUNC_REVERSE_SUBTRACT: return rsx::blend_equation::reverse_substract;
+ case CELL_GCM_FUNC_REVERSE_SUBTRACT_SIGNED: return rsx::blend_equation::reverse_substract_signed;
+ case CELL_GCM_FUNC_ADD_SIGNED: return rsx::blend_equation::add_signed;
+ case CELL_GCM_FUNC_REVERSE_ADD_SIGNED: return rsx::blend_equation::reverse_add_signed;
+ }
+ throw EXCEPTION("Unknown blend eq 0x%x", in);
+}
+
+enum
+{
+ CELL_GCM_SRC_COLOR = 0x0300,
+ CELL_GCM_ONE_MINUS_SRC_COLOR = 0x0301,
+ CELL_GCM_SRC_ALPHA = 0x0302,
+ CELL_GCM_ONE_MINUS_SRC_ALPHA = 0x0303,
+ CELL_GCM_DST_ALPHA = 0x0304,
+ CELL_GCM_ONE_MINUS_DST_ALPHA = 0x0305,
+ CELL_GCM_DST_COLOR = 0x0306,
+ CELL_GCM_ONE_MINUS_DST_COLOR = 0x0307,
+ CELL_GCM_SRC_ALPHA_SATURATE = 0x0308,
+ CELL_GCM_CONSTANT_COLOR = 0x8001,
+ CELL_GCM_ONE_MINUS_CONSTANT_COLOR = 0x8002,
+ CELL_GCM_CONSTANT_ALPHA = 0x8003,
+ CELL_GCM_ONE_MINUS_CONSTANT_ALPHA = 0x8004,
+};
+
+rsx::blend_factor rsx::to_blend_factor(u16 in)
+{
+ switch (in)
+ {
+ case CELL_GCM_ZERO: return rsx::blend_factor::zero;
+ case CELL_GCM_ONE: return rsx::blend_factor::one;
+ case CELL_GCM_SRC_COLOR: return rsx::blend_factor::src_color;
+ case CELL_GCM_ONE_MINUS_SRC_COLOR: return rsx::blend_factor::one_minus_src_color;
+ case CELL_GCM_SRC_ALPHA: return rsx::blend_factor::src_alpha;
+ case CELL_GCM_ONE_MINUS_SRC_ALPHA: return rsx::blend_factor::one_minus_src_alpha;
+ case CELL_GCM_DST_ALPHA: return rsx::blend_factor::dst_alpha;
+ case CELL_GCM_ONE_MINUS_DST_ALPHA: return rsx::blend_factor::one_minus_dst_alpha;
+ case CELL_GCM_DST_COLOR: return rsx::blend_factor::dst_color;
+ case CELL_GCM_ONE_MINUS_DST_COLOR: return rsx::blend_factor::one_minus_dst_color;
+ case CELL_GCM_SRC_ALPHA_SATURATE: return rsx::blend_factor::src_alpha_saturate;
+ case CELL_GCM_CONSTANT_COLOR: return rsx::blend_factor::constant_color;
+ case CELL_GCM_ONE_MINUS_CONSTANT_COLOR: return rsx::blend_factor::one_minus_constant_color;
+ case CELL_GCM_CONSTANT_ALPHA: return rsx::blend_factor::constant_alpha;
+ case CELL_GCM_ONE_MINUS_CONSTANT_ALPHA: return rsx::blend_factor::one_minus_constant_alpha;
+ }
+ throw EXCEPTION("Unknown blend factor 0x%x", in);
+}
+
+enum
+{
+ CELL_GCM_CLEAR = 0x1500,
+ CELL_GCM_AND = 0x1501,
+ CELL_GCM_AND_REVERSE = 0x1502,
+ CELL_GCM_COPY = 0x1503,
+ CELL_GCM_AND_INVERTED = 0x1504,
+ CELL_GCM_NOOP = 0x1505,
+ CELL_GCM_XOR = 0x1506,
+ CELL_GCM_OR = 0x1507,
+ CELL_GCM_NOR = 0x1508,
+ CELL_GCM_EQUIV = 0x1509,
+ CELL_GCM_INVERT = 0x150A,
+ CELL_GCM_OR_REVERSE = 0x150B,
+ CELL_GCM_COPY_INVERTED = 0x150C,
+ CELL_GCM_OR_INVERTED = 0x150D,
+ CELL_GCM_NAND = 0x150E,
+ CELL_GCM_SET = 0x150F,
+};
+
+rsx::logic_op rsx::to_logic_op(u16 in)
+{
+ switch (in)
+ {
+ case CELL_GCM_CLEAR: return rsx::logic_op::logic_clear;
+ case CELL_GCM_AND: return rsx::logic_op::logic_and;
+ case CELL_GCM_AND_REVERSE: return rsx::logic_op::logic_and_reverse;
+ case CELL_GCM_COPY: return rsx::logic_op::logic_copy;
+ case CELL_GCM_AND_INVERTED: return rsx::logic_op::logic_and_inverted;
+ case CELL_GCM_NOOP: return rsx::logic_op::logic_noop;
+ case CELL_GCM_XOR: return rsx::logic_op::logic_xor;
+ case CELL_GCM_OR: return rsx::logic_op::logic_or;
+ case CELL_GCM_NOR: return rsx::logic_op::logic_nor;
+ case CELL_GCM_EQUIV: return rsx::logic_op::logic_equiv;
+ case CELL_GCM_INVERT: return rsx::logic_op::logic_invert;
+ case CELL_GCM_OR_REVERSE: return rsx::logic_op::logic_or_reverse;
+ case CELL_GCM_COPY_INVERTED: return rsx::logic_op::logic_copy_inverted;
+ case CELL_GCM_OR_INVERTED: return rsx::logic_op::logic_or_inverted;
+ case CELL_GCM_NAND: return rsx::logic_op::logic_nand;
+ case CELL_GCM_SET: return rsx::logic_op::logic_set;
+ }
+ throw EXCEPTION("Unknown logic op 0x%x", in);
+}
+
+enum
+{
+ CELL_GCM_CW = 0x0900,
+ CELL_GCM_CCW = 0x0901,
+};
+
+rsx::front_face rsx::to_front_face(u16 in)
+{
+ switch (in)
+ {
+ default: // Disgaea 3 pass some garbage value at startup, this is needed to survive.
+ case CELL_GCM_CW: return rsx::front_face::cw;
+ case CELL_GCM_CCW: return rsx::front_face::ccw;
+ }
+ throw EXCEPTION("Unknown front face 0x%x", in);
+}
+
+enum
+{
+ CELL_GCM_FRONT = 0x0404,
+ CELL_GCM_BACK = 0x0405,
+ CELL_GCM_FRONT_AND_BACK = 0x0408,
+};
+
+rsx::cull_face rsx::to_cull_face(u16 in)
+{
+ switch (in)
+ {
+ case CELL_GCM_FRONT_AND_BACK: return rsx::cull_face::front_and_back;
+ case CELL_GCM_FRONT: return rsx::cull_face::front;
+ case CELL_GCM_BACK: return rsx::cull_face::back;
+ }
+ throw EXCEPTION("Unknown cull face 0x%x", in);
+}
+
+enum
+{
+ CELL_GCM_TRANSFER_ORIGIN_CENTER = 1,
+ CELL_GCM_TRANSFER_ORIGIN_CORNER = 2,
+
+ CELL_GCM_TRANSFER_INTERPOLATOR_ZOH = 0,
+ CELL_GCM_TRANSFER_INTERPOLATOR_FOH = 1,
+};
+
+rsx::blit_engine::transfer_origin rsx::blit_engine::to_transfer_origin(u8 in)
+{
+ switch (in)
+ {
+ case CELL_GCM_TRANSFER_ORIGIN_CENTER: return rsx::blit_engine::transfer_origin::center;
+ case CELL_GCM_TRANSFER_ORIGIN_CORNER: return rsx::blit_engine::transfer_origin::corner;
+ }
+ throw EXCEPTION("Unknown tranfer origin 0x%x", in);
+}
+
+rsx::blit_engine::transfer_interpolator rsx::blit_engine::to_transfer_interpolator(u8 in)
+{
+ switch (in)
+ {
+ case CELL_GCM_TRANSFER_INTERPOLATOR_ZOH: return rsx::blit_engine::transfer_interpolator::zoh;
+ case CELL_GCM_TRANSFER_INTERPOLATOR_FOH: return rsx::blit_engine::transfer_interpolator::foh;
+ }
+ throw EXCEPTION("Unknown tranfer interpolator 0x%x", in);
+}
+
+enum
+{
+ CELL_GCM_TRANSFER_OPERATION_SRCCOPY_AND = 0,
+ CELL_GCM_TRANSFER_OPERATION_ROP_AND = 1,
+ CELL_GCM_TRANSFER_OPERATION_BLEND_AND = 2,
+ CELL_GCM_TRANSFER_OPERATION_SRCCOPY = 3,
+ CELL_GCM_TRANSFER_OPERATION_SRCCOPY_PREMULT = 4,
+ CELL_GCM_TRANSFER_OPERATION_BLEND_PREMULT = 5,
+};
+
+rsx::blit_engine::transfer_operation rsx::blit_engine::to_transfer_operation(u8 in)
+{
+ switch (in)
+ {
+ case CELL_GCM_TRANSFER_OPERATION_SRCCOPY_AND: return rsx::blit_engine::transfer_operation::srccopy_and;
+ case CELL_GCM_TRANSFER_OPERATION_ROP_AND: return rsx::blit_engine::transfer_operation::rop_and;
+ case CELL_GCM_TRANSFER_OPERATION_BLEND_AND: return rsx::blit_engine::transfer_operation::blend_and;
+ case CELL_GCM_TRANSFER_OPERATION_SRCCOPY: return rsx::blit_engine::transfer_operation::srccopy;
+ case CELL_GCM_TRANSFER_OPERATION_SRCCOPY_PREMULT: return rsx::blit_engine::transfer_operation::srccopy_premult;
+ case CELL_GCM_TRANSFER_OPERATION_BLEND_PREMULT: return rsx::blit_engine::transfer_operation::blend_premult;
+ }
+ throw EXCEPTION("Unknown tranfer operation 0x%x", in);
+}
+
+enum
+{
+ CELL_GCM_TRANSFER_SCALE_FORMAT_A1R5G5B5 = 1,
+ CELL_GCM_TRANSFER_SCALE_FORMAT_X1R5G5B5 = 2,
+ CELL_GCM_TRANSFER_SCALE_FORMAT_A8R8G8B8 = 3,
+ CELL_GCM_TRANSFER_SCALE_FORMAT_X8R8G8B8 = 4,
+ CELL_GCM_TRANSFER_SCALE_FORMAT_CR8YB8CB8YA8 = 5,
+ CELL_GCM_TRANSFER_SCALE_FORMAT_YB8CR8YA8CB8 = 6,
+ CELL_GCM_TRANSFER_SCALE_FORMAT_R5G6B5 = 7,
+ CELL_GCM_TRANSFER_SCALE_FORMAT_Y8 = 8,
+ CELL_GCM_TRANSFER_SCALE_FORMAT_AY8 = 9,
+ CELL_GCM_TRANSFER_SCALE_FORMAT_EYB8ECR8EYA8ECB8 = 10,
+ CELL_GCM_TRANSFER_SCALE_FORMAT_ECR8EYB8ECB8EYA8 = 11,
+ CELL_GCM_TRANSFER_SCALE_FORMAT_A8B8G8R8 = 12,
+ CELL_GCM_TRANSFER_SCALE_FORMAT_X8B8G8R8 = 13,
+};
+
+rsx::blit_engine::transfer_source_format rsx::blit_engine::to_transfer_source_format(u8 in)
+{
+ switch (in)
+ {
+ case CELL_GCM_TRANSFER_SCALE_FORMAT_A1R5G5B5: return rsx::blit_engine::transfer_source_format::a1r5g5b5;
+ case CELL_GCM_TRANSFER_SCALE_FORMAT_X1R5G5B5: return rsx::blit_engine::transfer_source_format::x1r5g5b5;
+ case CELL_GCM_TRANSFER_SCALE_FORMAT_A8R8G8B8: return rsx::blit_engine::transfer_source_format::a8r8g8b8;
+ case CELL_GCM_TRANSFER_SCALE_FORMAT_X8R8G8B8: return rsx::blit_engine::transfer_source_format::x8r8g8b8;
+ case CELL_GCM_TRANSFER_SCALE_FORMAT_CR8YB8CB8YA8: return rsx::blit_engine::transfer_source_format::cr8yb8cb8ya8;
+ case CELL_GCM_TRANSFER_SCALE_FORMAT_YB8CR8YA8CB8: return rsx::blit_engine::transfer_source_format::yb8cr8ya8cb8;
+ case CELL_GCM_TRANSFER_SCALE_FORMAT_R5G6B5: return rsx::blit_engine::transfer_source_format::r5g6b5;
+ case CELL_GCM_TRANSFER_SCALE_FORMAT_Y8: return rsx::blit_engine::transfer_source_format::y8;
+ case CELL_GCM_TRANSFER_SCALE_FORMAT_AY8: return rsx::blit_engine::transfer_source_format::ay8;
+ case CELL_GCM_TRANSFER_SCALE_FORMAT_EYB8ECR8EYA8ECB8: return rsx::blit_engine::transfer_source_format::eyb8ecr8eya8ecb8;
+ case CELL_GCM_TRANSFER_SCALE_FORMAT_ECR8EYB8ECB8EYA8: return rsx::blit_engine::transfer_source_format::ecr8eyb8ecb8eya8;
+ case CELL_GCM_TRANSFER_SCALE_FORMAT_A8B8G8R8: return rsx::blit_engine::transfer_source_format::a8b8g8r8;
+ case CELL_GCM_TRANSFER_SCALE_FORMAT_X8B8G8R8: return rsx::blit_engine::transfer_source_format::x8b8g8r8;
+ }
+ throw EXCEPTION("Unknown transfer source format 0x%x", in);
+}
+
+enum
+{
+ // Destination Format conversions
+ CELL_GCM_TRANSFER_SURFACE_FORMAT_R5G6B5 = 4,
+ CELL_GCM_TRANSFER_SURFACE_FORMAT_A8R8G8B8 = 10,
+ CELL_GCM_TRANSFER_SURFACE_FORMAT_Y32 = 11,
+};
+
+rsx::blit_engine::transfer_destination_format rsx::blit_engine::to_transfer_destination_format(u8 in)
+{
+ switch (in)
+ {
+ case CELL_GCM_TRANSFER_SURFACE_FORMAT_R5G6B5: return rsx::blit_engine::transfer_destination_format::r5g6b5;
+ case CELL_GCM_TRANSFER_SURFACE_FORMAT_A8R8G8B8: return rsx::blit_engine::transfer_destination_format::a8r8g8b8;
+ case CELL_GCM_TRANSFER_SURFACE_FORMAT_Y32: return rsx::blit_engine::transfer_destination_format::y32;
+ }
+ throw EXCEPTION("Unknown transfer destination format 0x%x", in);
+}
+
+enum
+{
+ CELL_GCM_CONTEXT_SURFACE2D = 0x313371C3,
+ CELL_GCM_CONTEXT_SWIZZLE2D = 0x31337A73,
+};
+
+rsx::blit_engine::context_surface rsx::blit_engine::to_context_surface(u32 in)
+{
+ switch (in)
+ {
+ case CELL_GCM_CONTEXT_SURFACE2D: return rsx::blit_engine::context_surface::surface2d;
+ case CELL_GCM_CONTEXT_SWIZZLE2D: return rsx::blit_engine::context_surface::swizzle2d;
+ }
+ throw EXCEPTION("Unknown context surface 0x%x", in);
+}
+
+enum
+{
+ CELL_GCM_CONTEXT_DMA_TO_MEMORY_GET_REPORT = 0x66626660,
+ CELL_GCM_CONTEXT_DMA_REPORT_LOCATION_MAIN = 0xBAD68000,
+};
+
+rsx::blit_engine::context_dma rsx::blit_engine::to_context_dma(u32 in)
+{
+ switch (in)
+ {
+ case CELL_GCM_CONTEXT_DMA_TO_MEMORY_GET_REPORT: return rsx::blit_engine::context_dma::to_memory_get_report;
+ case CELL_GCM_CONTEXT_DMA_REPORT_LOCATION_MAIN: return rsx::blit_engine::context_dma::report_location_main;
+ }
+ throw EXCEPTION("Unknown context dma 0x%x", in);
+}
+
+enum
+{
+ CELL_GCM_USER_CLIP_PLANE_DISABLE = 0,
+ CELL_GCM_USER_CLIP_PLANE_ENABLE_LT = 1,
+ CELL_GCM_USER_CLIP_PLANE_ENABLE_GE = 2,
+};
+
+rsx::user_clip_plane_op rsx::to_user_clip_plane_op(u8 in)
+{
+ switch (in)
+ {
+ case CELL_GCM_USER_CLIP_PLANE_DISABLE: return rsx::user_clip_plane_op::disable;
+ case CELL_GCM_USER_CLIP_PLANE_ENABLE_LT: return rsx::user_clip_plane_op::less_than;
+ case CELL_GCM_USER_CLIP_PLANE_ENABLE_GE: return rsx::user_clip_plane_op::greather_or_equal;
+ }
+ throw EXCEPTION("Unknown user clip plane 0x%x", in);
+}
+
+enum
+{
+ CELL_GCM_FLAT = 0x1D00,
+ CELL_GCM_SMOOTH = 0x1D01,
+};
+
+rsx::shading_mode rsx::to_shading_mode(u32 in)
+{
+ switch (in)
+ {
+ case CELL_GCM_FLAT: return rsx::shading_mode::flat;
+ case CELL_GCM_SMOOTH: return rsx::shading_mode::smooth;
+ }
+ throw EXCEPTION("Unknown shading mode 0x%x", in);
+}
+
+enum
+{
+ CELL_GCM_POLYGON_MODE_POINT = 0x1B00,
+ CELL_GCM_POLYGON_MODE_LINE = 0x1B01,
+ CELL_GCM_POLYGON_MODE_FILL = 0x1B02,
+};
+
+rsx::polygon_mode rsx::to_polygon_mode(u32 in)
+{
+ switch (in)
+ {
+ case CELL_GCM_POLYGON_MODE_POINT: return rsx::polygon_mode::point;
+ case CELL_GCM_POLYGON_MODE_LINE: return rsx::polygon_mode::line;
+ case CELL_GCM_POLYGON_MODE_FILL: return rsx::polygon_mode::fill;
+ }
+ throw EXCEPTION("Unknown polygon mode 0x%x", in);
+}
+
diff --git a/rpcs3/Emu/RSX/gcm_enums.h b/rpcs3/Emu/RSX/gcm_enums.h
new file mode 100644
index 0000000000..b3a4ea7d39
--- /dev/null
+++ b/rpcs3/Emu/RSX/gcm_enums.h
@@ -0,0 +1,383 @@
+#pragma once
+#include "Utilities/types.h"
+
+namespace rsx
+{
+ enum class vertex_base_type : u8
+ {
+ s1, ///< signed byte
+ f, ///< float
+ sf, ///< half float
+ ub, ///< unsigned byte interpreted as 0.f and 1.f
+ s32k, ///< signed 32bits int
+ cmp, ///< compressed aka X11G11Z10 and always 1. W.
+ ub256, ///< unsigned byte interpreted as between 0 and 255.
+ };
+
+ vertex_base_type to_vertex_base_type(u8 in);
+
+ enum class index_array_type : u8
+ {
+ u32,
+ u16,
+ };
+
+ index_array_type to_index_array_type(u8 in);
+
+ enum class primitive_type : u8
+ {
+ invalid,
+ points,
+ lines,
+ line_loop, // line strip with last end being joined with first end.
+ line_strip,
+ triangles,
+ triangle_strip,
+ triangle_fan, // like strip except that every triangle share the first vertex and one instead of 2 from previous triangle.
+ quads,
+ quad_strip,
+ polygon, // convex polygon
+ };
+
+ primitive_type to_primitive_type(u8 in);
+
+ enum class surface_target : u8
+ {
+ none,
+ surface_a,
+ surface_b,
+ surfaces_a_b,
+ surfaces_a_b_c,
+ surfaces_a_b_c_d,
+ };
+
+ surface_target to_surface_target(u8 in);
+
+ enum class surface_depth_format : u8
+ {
+ z16, // unsigned 16 bits depth
+ z24s8, // unsigned 24 bits depth + 8 bits stencil
+ };
+
+ surface_depth_format to_surface_depth_format(u8 in);
+
+ enum class surface_antialiasing : u8
+ {
+ center_1_sample,
+ diagonal_centered_2_samples,
+ square_centered_4_samples,
+ square_rotated_4_samples,
+ };
+
+ surface_antialiasing to_surface_antialiasing(u8 in);
+
+ enum class surface_color_format : u8
+ {
+ x1r5g5b5_z1r5g5b5,
+ x1r5g5b5_o1r5g5b5,
+ r5g6b5,
+ x8r8g8b8_z8r8g8b8,
+ x8r8g8b8_o8r8g8b8,
+ a8r8g8b8,
+ b8,
+ g8b8,
+ w16z16y16x16,
+ w32z32y32x32,
+ x32,
+ x8b8g8r8_z8b8g8r8,
+ x8b8g8r8_o8b8g8r8,
+ a8b8g8r8,
+ };
+
+ surface_color_format to_surface_color_format(u8 in);
+
+ enum class window_origin : u8
+ {
+ top,
+ bottom
+ };
+
+ window_origin to_window_origin(u8 in);
+
+ enum class window_pixel_center : u8
+ {
+ half,
+ integer
+ };
+
+ window_pixel_center to_window_pixel_center(u8 in);
+
+ enum class comparison_function : u8
+ {
+ never,
+ less,
+ equal,
+ less_or_equal,
+ greater,
+ not_equal,
+ greater_or_equal,
+ always
+ };
+
+ comparison_function to_comparison_function(u16 in);
+
+ enum class fog_mode : u8
+ {
+ linear,
+ exponential,
+ exponential2,
+ exponential_abs,
+ exponential2_abs,
+ linear_abs
+ };
+
+ fog_mode to_fog_mode(u32 in);
+
+ enum class texture_dimension : u8
+ {
+ dimension1d,
+ dimension2d,
+ dimension3d,
+ };
+
+ texture_dimension to_texture_dimension(u8 in);
+
+ enum class texture_wrap_mode : u8
+ {
+ wrap,
+ mirror,
+ clamp_to_edge,
+ border,
+ clamp,
+ mirror_once_clamp_to_edge,
+ mirror_once_border,
+ mirror_once_clamp,
+ };
+
+ texture_wrap_mode to_texture_wrap_mode(u8 in);
+
+ enum class texture_max_anisotropy : u8
+ {
+ x1,
+ x2,
+ x4,
+ x6,
+ x8,
+ x10,
+ x12,
+ x16,
+ };
+
+ texture_max_anisotropy to_texture_max_anisotropy(u8 in);
+
+ enum class texture_minify_filter : u8
+ {
+ nearest, ///< no filtering, mipmap base level
+ linear, ///< linear filtering, mipmap base level
+ nearest_nearest, ///< no filtering, closest mipmap level
+ linear_nearest, ///< linear filtering, closest mipmap level
+ nearest_linear, ///< no filtering, linear mix between closest mipmap levels
+ linear_linear, ///< linear filtering, linear mix between closest mipmap levels
+ convolution_min, ///< Unknown mode but looks close to linear_linear
+ };
+
+ texture_minify_filter to_texture_minify_filter(u8 in);
+
+ enum class texture_magnify_filter : u8
+ {
+ nearest, ///< no filtering
+ linear, ///< linear filtering
+ convolution_mag, ///< Unknown mode but looks close to linear
+ };
+
+ texture_magnify_filter to_texture_magnify_filter(u8 in);
+
+ enum class stencil_op : u8
+ {
+ keep,
+ zero,
+ replace,
+ incr,
+ decr,
+ invert,
+ incr_wrap,
+ decr_wrap,
+ };
+
+ stencil_op to_stencil_op(u16 in);
+
+ enum class blend_equation : u8
+ {
+ add,
+ min,
+ max,
+ substract,
+ reverse_substract,
+ reverse_substract_signed,
+ add_signed,
+ reverse_add_signed,
+ };
+
+ blend_equation to_blend_equation(u16 in);
+
+ enum class blend_factor : u8
+ {
+ zero,
+ one,
+ src_color,
+ one_minus_src_color,
+ dst_color,
+ one_minus_dst_color,
+ src_alpha,
+ one_minus_src_alpha,
+ dst_alpha,
+ one_minus_dst_alpha,
+ src_alpha_saturate,
+ constant_color,
+ one_minus_constant_color,
+ constant_alpha,
+ one_minus_constant_alpha,
+ };
+
+ blend_factor to_blend_factor(u16 in);
+
+ enum class logic_op : u8
+ {
+ logic_clear,
+ logic_and,
+ logic_and_reverse,
+ logic_copy,
+ logic_and_inverted,
+ logic_noop,
+ logic_xor,
+ logic_or,
+ logic_nor,
+ logic_equiv,
+ logic_invert,
+ logic_or_reverse,
+ logic_copy_inverted,
+ logic_or_inverted,
+ logic_nand,
+ logic_set,
+ };
+
+ logic_op to_logic_op(u16 in);
+
+ enum class front_face : u8
+ {
+ cw, /// clockwise
+ ccw /// counter clockwise
+ };
+
+ front_face to_front_face(u16 in);
+
+ enum class cull_face : u8
+ {
+ front,
+ back,
+ front_and_back,
+ };
+
+ cull_face to_cull_face(u16 in);
+
+ enum class user_clip_plane_op : u8
+ {
+ disable,
+ less_than,
+ greather_or_equal,
+ };
+
+ user_clip_plane_op to_user_clip_plane_op(u8 in);
+
+ enum class shading_mode : u8
+ {
+ smooth,
+ flat,
+ };
+
+ shading_mode to_shading_mode(u32 in);
+
+ enum class polygon_mode : u8
+ {
+ point,
+ line,
+ fill,
+ };
+
+ polygon_mode to_polygon_mode(u32 in);
+
+ namespace blit_engine
+ {
+ enum class transfer_origin : u8
+ {
+ center,
+ corner,
+ };
+
+ transfer_origin to_transfer_origin(u8 in);
+
+ enum class transfer_interpolator : u8
+ {
+ zoh,
+ foh,
+ };
+
+ transfer_interpolator to_transfer_interpolator(u8 in);
+
+ enum class transfer_operation : u8
+ {
+ srccopy_and,
+ rop_and,
+ blend_and,
+ srccopy,
+ srccopy_premult,
+ blend_premult,
+ };
+
+ transfer_operation to_transfer_operation(u8 in);
+
+ enum class transfer_source_format : u8
+ {
+ a1r5g5b5,
+ x1r5g5b5,
+ a8r8g8b8,
+ x8r8g8b8,
+ cr8yb8cb8ya8,
+ yb8cr8ya8cb8,
+ r5g6b5,
+ y8,
+ ay8,
+ eyb8ecr8eya8ecb8,
+ ecr8eyb8ecb8eya8,
+ a8b8g8r8,
+ x8b8g8r8,
+ };
+
+ transfer_source_format to_transfer_source_format(u8 in);
+
+ enum class transfer_destination_format : u8
+ {
+ r5g6b5,
+ a8r8g8b8,
+ y32,
+ };
+
+ transfer_destination_format to_transfer_destination_format(u8 in);
+
+ enum class context_surface : u8
+ {
+ surface2d,
+ swizzle2d,
+ };
+
+ context_surface to_context_surface(u32 in);
+
+ enum class context_dma : u8
+ {
+ to_memory_get_report,
+ report_location_main,
+ };
+
+ context_dma to_context_dma(u32 in);
+ }
+}
diff --git a/rpcs3/emucore.vcxproj b/rpcs3/emucore.vcxproj
index 0afd13d522..e2a83f111a 100644
--- a/rpcs3/emucore.vcxproj
+++ b/rpcs3/emucore.vcxproj
@@ -259,6 +259,9 @@
+
+ NotUsing
+
@@ -599,6 +602,7 @@
+
diff --git a/rpcs3/emucore.vcxproj.filters b/rpcs3/emucore.vcxproj.filters
index 3d9f73ceb2..d37e5f47cf 100644
--- a/rpcs3/emucore.vcxproj.filters
+++ b/rpcs3/emucore.vcxproj.filters
@@ -881,6 +881,9 @@
Emu\Cell
+
+ Emu\GPU\RSX
+
@@ -1696,5 +1699,8 @@
Utilities
+
+ Emu\GPU\RSX
+
\ No newline at end of file