mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-01-30 03:32:55 +00:00
Merge pull request #1518 from vlj/rsx-debug
rsx-debug: Record and display index buffer content.
This commit is contained in:
commit
bcf4a6209e
@ -299,6 +299,29 @@ namespace rsx
|
||||
draw_state.color_buffer = std::move(copy_render_targets_to_memory());
|
||||
draw_state.depth_format = surface.depth_format;
|
||||
draw_state.depth_stencil = std::move(copy_depth_stencil_buffer_to_memory());
|
||||
|
||||
if (draw_command == rsx::draw_command::indexed)
|
||||
{
|
||||
draw_state.vertex_count = 0;
|
||||
for (const auto &range : first_count_commands)
|
||||
{
|
||||
draw_state.vertex_count += range.second;
|
||||
}
|
||||
draw_state.index_type = rsx::to_index_array_type(rsx::method_registers[NV4097_SET_INDEX_ARRAY_DMA] >> 4);
|
||||
if (draw_state.index_type == rsx::index_array_type::u16)
|
||||
{
|
||||
draw_state.index.resize(2 * draw_state.vertex_count);
|
||||
gsl::span<u16> dst = { (u16*)draw_state.index.data(), gsl::narrow<int>(draw_state.vertex_count) };
|
||||
write_index_array_data_to_buffer(dst, draw_mode, first_count_commands);
|
||||
}
|
||||
if (draw_state.index_type == rsx::index_array_type::u32)
|
||||
{
|
||||
draw_state.index.resize(4 * draw_state.vertex_count);
|
||||
gsl::span<u16> dst = { (u16*)draw_state.index.data(), gsl::narrow<int>(draw_state.vertex_count) };
|
||||
write_index_array_data_to_buffer(dst, draw_mode, first_count_commands);
|
||||
}
|
||||
}
|
||||
|
||||
draw_state.programs = get_programs();
|
||||
draw_state.name = name;
|
||||
frame_debug.draw_calls.push_back(draw_state);
|
||||
|
@ -24,6 +24,9 @@ struct frame_capture_data
|
||||
std::array<std::vector<gsl::byte>, 4> color_buffer;
|
||||
rsx::surface_depth_format depth_format;
|
||||
std::array<std::vector<gsl::byte>, 2> depth_stencil;
|
||||
rsx::index_array_type index_type;
|
||||
std::vector<gsl::byte> index;
|
||||
u32 vertex_count;
|
||||
};
|
||||
std::vector<std::pair<u32, u32> > command_queue;
|
||||
std::vector<draw_state> draw_calls;
|
||||
|
@ -163,10 +163,12 @@ RSXDebugger::RSXDebugger(wxWindow* parent)
|
||||
wxPanel* p_buffers = new wxPanel(state_rsx, wxID_ANY);
|
||||
wxPanel* p_transform_program = new wxPanel(state_rsx, wxID_ANY);
|
||||
wxPanel* p_shader_program = new wxPanel(state_rsx, wxID_ANY);
|
||||
wxPanel* p_index_buffer = new wxPanel(state_rsx, wxID_ANY);
|
||||
|
||||
state_rsx->AddPage(p_buffers, wxT("RTTs and DS"));
|
||||
state_rsx->AddPage(p_transform_program, wxT("Transform program"));
|
||||
state_rsx->AddPage(p_shader_program, wxT("Shader program"));
|
||||
state_rsx->AddPage(p_index_buffer, (wxT("Index buffer")));
|
||||
|
||||
m_text_transform_program = new wxTextCtrl(p_transform_program, wxID_ANY, "", wxPoint(1, 3), wxSize(720, 720), wxTE_MULTILINE | wxTE_READONLY);
|
||||
m_text_transform_program->SetFont(wxFont(8, wxFONTFAMILY_MODERN, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL));
|
||||
@ -174,6 +176,9 @@ RSXDebugger::RSXDebugger(wxWindow* parent)
|
||||
m_text_shader_program = new wxTextCtrl(p_shader_program, wxID_ANY, "", wxPoint(1, 3), wxSize(720, 720), wxTE_MULTILINE | wxTE_READONLY);
|
||||
m_text_shader_program->SetFont(wxFont(8, wxFONTFAMILY_MODERN, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL));
|
||||
|
||||
m_list_index_buffer = new wxListView(p_index_buffer, wxID_ANY, wxPoint(1, 3), wxSize(720, 720));
|
||||
m_list_index_buffer->SetFont(wxFont(8, wxFONTFAMILY_MODERN, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL));
|
||||
|
||||
//Buffers
|
||||
wxBoxSizer* s_buffers1 = new wxBoxSizer(wxVERTICAL);
|
||||
wxBoxSizer* s_buffers2 = new wxBoxSizer(wxVERTICAL);
|
||||
@ -559,6 +564,25 @@ void RSXDebugger::OnClickDrawCalls(wxMouseEvent& event)
|
||||
m_text_transform_program->AppendText(frame_debug.draw_calls[draw_id].programs.first);
|
||||
m_text_shader_program->Clear();
|
||||
m_text_shader_program->AppendText(frame_debug.draw_calls[draw_id].programs.second);
|
||||
|
||||
m_list_index_buffer->ClearAll();
|
||||
m_list_index_buffer->InsertColumn(0, "Index", 0, 700);
|
||||
if (frame_debug.draw_calls[draw_id].index_type == rsx::index_array_type::u16)
|
||||
{
|
||||
u16 *index_buffer = (u16*)frame_debug.draw_calls[draw_id].index.data();
|
||||
for (u32 i = 0; i < frame_debug.draw_calls[draw_id].vertex_count; ++i)
|
||||
{
|
||||
m_list_index_buffer->InsertItem(i, std::to_string(index_buffer[i]));
|
||||
}
|
||||
}
|
||||
if (frame_debug.draw_calls[draw_id].index_type == rsx::index_array_type::u32)
|
||||
{
|
||||
u32 *index_buffer = (u32*)frame_debug.draw_calls[draw_id].index.data();
|
||||
for (u32 i = 0; i < frame_debug.draw_calls[draw_id].vertex_count; ++i)
|
||||
{
|
||||
m_list_index_buffer->InsertItem(i, std::to_string(index_buffer[i]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void RSXDebugger::GoToGet(wxCommandEvent& event)
|
||||
|
@ -19,6 +19,7 @@ class RSXDebugger : public wxDialog
|
||||
wxListView* m_list_lightning;
|
||||
wxListView* m_list_texture;
|
||||
wxListView* m_list_settings;
|
||||
wxListView* m_list_index_buffer;
|
||||
|
||||
wxPanel* p_buffer_colorA;
|
||||
wxPanel* p_buffer_colorB;
|
||||
|
Loading…
x
Reference in New Issue
Block a user