Merge pull request #1456 from vlj/rsx-debug

rsx-debug: Dump windows origin/pixel center.
This commit is contained in:
vlj 2016-01-27 23:11:40 +01:00
commit 791070c158
3 changed files with 72 additions and 8 deletions

View File

@ -762,6 +762,34 @@ rsx::primitive_type rsx::to_primitive_type(u8 in)
throw new EXCEPTION("Unknow primitive type %d", in); throw new EXCEPTION("Unknow 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("Unknow window origin modifier %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("Unknow window pixel center %x", in);
}
enum enum
{ {
@ -1378,6 +1406,31 @@ namespace
return result; return result;
} }
std::string origin_mode(u32 origin)
{
switch (rsx::to_window_origin(origin))
{
case rsx::window_origin::bottom: return "bottom";
case rsx::window_origin::top: return "top";
}
throw EXCEPTION("Wrong origin mode");
}
std::string pixel_center_mode(u32 in)
{
switch (rsx::to_window_pixel_center(in))
{
case rsx::window_pixel_center::half: return "half";
case rsx::window_pixel_center::integer: return "integer";
}
throw EXCEPTION("Wrong origin mode");
}
std::string shader_window(u32 arg)
{
return "Viewport: height = " + std::to_string(arg & 0xFFF) + " origin = " + origin_mode((arg >> 12) & 0xF) + " pixel center = " + pixel_center_mode((arg >> 16) & 0xF);
}
#define OPCODE_RANGE_1(opcode, increment, index, printing_function) \ #define OPCODE_RANGE_1(opcode, increment, index, printing_function) \
{ (opcode) + (index) * (increment), [](u32 arg) -> std::string { return (printing_function)((index), arg); } }, { (opcode) + (index) * (increment), [](u32 arg) -> std::string { return (printing_function)((index), arg); } },
@ -1476,6 +1529,7 @@ namespace
{ NV4097_SET_VERTEX_ATTRIB_OUTPUT_MASK, vertex_output_mask }, { NV4097_SET_VERTEX_ATTRIB_OUTPUT_MASK, vertex_output_mask },
{ NV4097_SET_SHADER_CONTROL, shader_control }, { NV4097_SET_SHADER_CONTROL, shader_control },
{ NV4097_SET_ANTI_ALIASING_CONTROL, anti_aliasing_control }, { NV4097_SET_ANTI_ALIASING_CONTROL, anti_aliasing_control },
{ NV4097_SET_SHADER_WINDOW, shader_window },
{ NV4097_SET_VERTEX_DATA_ARRAY_FORMAT, [](u32 arg) -> std::string { return "Vertex array 0: " + unpack_vertex_format(arg); } }, { NV4097_SET_VERTEX_DATA_ARRAY_FORMAT, [](u32 arg) -> std::string { return "Vertex array 0: " + unpack_vertex_format(arg); } },
{ NV4097_SET_VERTEX_DATA_ARRAY_FORMAT + 1, [](u32 arg) -> std::string { return "Vertex array 1: " + unpack_vertex_format(arg); } }, { NV4097_SET_VERTEX_DATA_ARRAY_FORMAT + 1, [](u32 arg) -> std::string { return "Vertex array 1: " + unpack_vertex_format(arg); } },
{ NV4097_SET_VERTEX_DATA_ARRAY_FORMAT + 2, [](u32 arg) -> std::string { return "Vertex array 2: " + unpack_vertex_format(arg); } }, { NV4097_SET_VERTEX_DATA_ARRAY_FORMAT + 2, [](u32 arg) -> std::string { return "Vertex array 2: " + unpack_vertex_format(arg); } },

View File

@ -111,6 +111,22 @@ namespace rsx
}; };
surface_color_format to_surface_color_format(u8 in); 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 enum
@ -481,12 +497,6 @@ enum
CELL_GCM_TRUE = 1, CELL_GCM_TRUE = 1,
CELL_GCM_FALSE = 0, CELL_GCM_FALSE = 0,
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,
CELL_GCM_USER_CLIP_PLANE_DISABLE = 0, CELL_GCM_USER_CLIP_PLANE_DISABLE = 0,
CELL_GCM_USER_CLIP_PLANE_ENABLE_LT = 1, CELL_GCM_USER_CLIP_PLANE_ENABLE_LT = 1,
CELL_GCM_USER_CLIP_PLANE_ENABLE_GE = 2, CELL_GCM_USER_CLIP_PLANE_ENABLE_GE = 2,

View File

@ -567,10 +567,10 @@ void GLGSRender::set_viewport()
u32 shader_window = rsx::method_registers[NV4097_SET_SHADER_WINDOW]; u32 shader_window = rsx::method_registers[NV4097_SET_SHADER_WINDOW];
u8 shader_window_origin = (shader_window >> 12) & 0xf; rsx::window_origin shader_window_origin = rsx::to_window_origin((shader_window >> 12) & 0xf);
//TODO //TODO
if (true || shader_window_origin == CELL_GCM_WINDOW_ORIGIN_BOTTOM) if (true || shader_window_origin == rsx::window_origin::bottom)
{ {
__glcheck glViewport(viewport_x, viewport_y, viewport_w, viewport_h); __glcheck glViewport(viewport_x, viewport_y, viewport_w, viewport_h);
__glcheck glScissor(scissor_x, scissor_y, scissor_w, scissor_h); __glcheck glScissor(scissor_x, scissor_y, scissor_w, scissor_h);