mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-21 12:05:23 +00:00
minor cleanup
This commit is contained in:
parent
c74b2cb085
commit
066e53da55
13 changed files with 164 additions and 178 deletions
|
@ -8,14 +8,14 @@
|
|||
|
||||
namespace gl
|
||||
{
|
||||
struct compute_task
|
||||
{
|
||||
std::string m_src;
|
||||
gl::glsl::shader m_shader;
|
||||
gl::glsl::program m_program;
|
||||
bool compiled = false;
|
||||
struct compute_task
|
||||
{
|
||||
std::string m_src;
|
||||
gl::glsl::shader m_shader;
|
||||
gl::glsl::program m_program;
|
||||
bool compiled = false;
|
||||
|
||||
// Device-specific options
|
||||
// Device-specific options
|
||||
bool unroll_loops = true;
|
||||
u32 optimal_group_size = 1;
|
||||
u32 optimal_kernel_size = 1;
|
||||
|
@ -42,49 +42,49 @@ namespace gl
|
|||
glGetIntegeri_v(GL_MAX_COMPUTE_WORK_GROUP_COUNT, 0, reinterpret_cast<GLint*>(&max_invocations_x));
|
||||
}
|
||||
|
||||
void create()
|
||||
{
|
||||
if (!compiled)
|
||||
{
|
||||
m_shader.create(::glsl::program_domain::glsl_compute_program, m_src);
|
||||
m_shader.compile();
|
||||
void create()
|
||||
{
|
||||
if (!compiled)
|
||||
{
|
||||
m_shader.create(::glsl::program_domain::glsl_compute_program, m_src);
|
||||
m_shader.compile();
|
||||
|
||||
m_program.create();
|
||||
m_program.attach(m_shader);
|
||||
m_program.link();
|
||||
m_program.create();
|
||||
m_program.attach(m_shader);
|
||||
m_program.link();
|
||||
|
||||
compiled = true;
|
||||
}
|
||||
}
|
||||
compiled = true;
|
||||
}
|
||||
}
|
||||
|
||||
void destroy()
|
||||
{
|
||||
if (compiled)
|
||||
{
|
||||
m_program.remove();
|
||||
m_shader.remove();
|
||||
void destroy()
|
||||
{
|
||||
if (compiled)
|
||||
{
|
||||
m_program.remove();
|
||||
m_shader.remove();
|
||||
|
||||
compiled = false;
|
||||
}
|
||||
}
|
||||
compiled = false;
|
||||
}
|
||||
}
|
||||
|
||||
virtual void bind_resources()
|
||||
{}
|
||||
virtual void bind_resources()
|
||||
{}
|
||||
|
||||
void run(u32 invocations_x, u32 invocations_y)
|
||||
{
|
||||
GLint old_program;
|
||||
glGetIntegerv(GL_CURRENT_PROGRAM, &old_program);
|
||||
void run(u32 invocations_x, u32 invocations_y)
|
||||
{
|
||||
GLint old_program;
|
||||
glGetIntegerv(GL_CURRENT_PROGRAM, &old_program);
|
||||
|
||||
bind_resources();
|
||||
m_program.use();
|
||||
glDispatchCompute(invocations_x, invocations_y, 1);
|
||||
m_program.use();
|
||||
glDispatchCompute(invocations_x, invocations_y, 1);
|
||||
|
||||
glUseProgram(old_program);
|
||||
}
|
||||
glUseProgram(old_program);
|
||||
}
|
||||
|
||||
void run(u32 num_invocations)
|
||||
{
|
||||
void run(u32 num_invocations)
|
||||
{
|
||||
u32 invocations_x, invocations_y;
|
||||
if (num_invocations <= max_invocations_x) [[likely]]
|
||||
{
|
||||
|
@ -101,9 +101,9 @@ namespace gl
|
|||
if (num_invocations % invocations_x) invocations_y++;
|
||||
}
|
||||
|
||||
run(invocations_x, invocations_y);
|
||||
}
|
||||
};
|
||||
run(invocations_x, invocations_y);
|
||||
}
|
||||
};
|
||||
|
||||
struct cs_shuffle_base : compute_task
|
||||
{
|
||||
|
@ -168,7 +168,7 @@ namespace gl
|
|||
|
||||
const std::pair<std::string, std::string> syntax_replace[] =
|
||||
{
|
||||
{ "%loc", std::to_string(GL_COMPUTE_BUFFER_SLOT(0)) },
|
||||
{ "%loc", std::to_string(GL_COMPUTE_BUFFER_SLOT(0)) },
|
||||
{ "%ws", std::to_string(optimal_group_size) },
|
||||
{ "%ks", std::to_string(kernel_size) },
|
||||
{ "%vars", variables },
|
||||
|
@ -216,7 +216,7 @@ namespace gl
|
|||
|
||||
void bind_resources() override
|
||||
{
|
||||
m_data->bind_range(gl::buffer::target::ssbo, GL_COMPUTE_BUFFER_SLOT(0), m_data_offset, m_data_length);
|
||||
m_data->bind_range(gl::buffer::target::ssbo, GL_COMPUTE_BUFFER_SLOT(0), m_data_offset, m_data_length);
|
||||
}
|
||||
|
||||
void run(const gl::buffer* data, u32 data_length, u32 data_offset = 0)
|
||||
|
|
|
@ -140,11 +140,11 @@ struct GLProgramBuffer : public program_state_cache<GLTraits>
|
|||
get_graphics_pipeline(vp, fp, props, false, false, std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
void preload_programs(RSXVertexProgram &vp, RSXFragmentProgram &fp)
|
||||
{
|
||||
void preload_programs(RSXVertexProgram &vp, RSXFragmentProgram &fp)
|
||||
{
|
||||
search_vertex_program(vp);
|
||||
search_fragment_program(fp);
|
||||
}
|
||||
}
|
||||
|
||||
bool check_cache_missed() const
|
||||
{
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#include "Emu/RSX/RSXThread.h"
|
||||
#include "GLTexture.h"
|
||||
#include "GLTextureCache.h"
|
||||
#include "../Common/BufferUtils.h"
|
||||
|
||||
#include "util/asm.hpp"
|
||||
|
||||
|
|
|
@ -2,21 +2,8 @@
|
|||
|
||||
#include "stdafx.h"
|
||||
|
||||
#include <string>
|
||||
#include <functional>
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
#include <thread>
|
||||
#include <condition_variable>
|
||||
#include <chrono>
|
||||
|
||||
#include "Utilities/mutex.h"
|
||||
#include "GLRenderTargets.h"
|
||||
#include "GLOverlays.h"
|
||||
#include "GLTexture.h"
|
||||
#include "../Common/TextureUtils.h"
|
||||
#include "../Common/texture_cache.h"
|
||||
#include "../Common/BufferUtils.h"
|
||||
|
||||
class GLGSRender;
|
||||
|
||||
|
|
|
@ -59,10 +59,10 @@ namespace
|
|||
struct draw_command_visitor
|
||||
{
|
||||
using attribute_storage = std::vector<
|
||||
std::variant<rsx::vertex_array_buffer, rsx::vertex_array_register, rsx::empty_vertex_array>>;
|
||||
std::variant<rsx::vertex_array_buffer, rsx::vertex_array_register, rsx::empty_vertex_array>>;
|
||||
|
||||
draw_command_visitor(gl::ring_buffer& index_ring_buffer, rsx::vertex_input_layout& vertex_layout)
|
||||
: m_index_ring_buffer(index_ring_buffer)
|
||||
: m_index_ring_buffer(index_ring_buffer)
|
||||
, m_vertex_layout(vertex_layout)
|
||||
{}
|
||||
|
||||
|
@ -77,7 +77,7 @@ namespace
|
|||
u32 index_count;
|
||||
u32 offset_in_index_buffer;
|
||||
std::tie(index_count, offset_in_index_buffer) = get_index_array_for_emulated_non_indexed_draw(
|
||||
rsx::method_registers.current_draw_clause.primitive, m_index_ring_buffer,
|
||||
rsx::method_registers.current_draw_clause.primitive, m_index_ring_buffer,
|
||||
rsx::method_registers.current_draw_clause.get_elements_count());
|
||||
|
||||
return{ false, min_index, max_index, index_count, 0, std::make_tuple(static_cast<GLenum>(GL_UNSIGNED_SHORT), offset_in_index_buffer) };
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include "../Overlays/Shaders/shader_loading_dialog_native.h"
|
||||
#include "VKGSRender.h"
|
||||
#include "VKCommonDecompiler.h"
|
||||
#include "VKCompute.h"
|
||||
#include "VKRenderPass.h"
|
||||
#include "VKResourceManager.h"
|
||||
#include "VKCommandStream.h"
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include "stdafx.h"
|
||||
#include "VKGSRender.h"
|
||||
#include "VKTextureCache.h"
|
||||
#include "VKCompute.h"
|
||||
|
||||
#include "util/asm.hpp"
|
||||
|
||||
|
|
|
@ -1,13 +1,8 @@
|
|||
#pragma once
|
||||
#include "stdafx.h"
|
||||
#include "VKRenderTargets.h"
|
||||
#include "VKGSRender.h"
|
||||
#include "VKCompute.h"
|
||||
#include "VKResourceManager.h"
|
||||
#include "VKDMA.h"
|
||||
#include "VKRenderPass.h"
|
||||
#include "../Common/TextureUtils.h"
|
||||
#include "Utilities/mutex.h"
|
||||
#include "../Common/texture_cache.h"
|
||||
|
||||
extern u64 get_system_time();
|
||||
|
|
|
@ -48,7 +48,7 @@ auto_pause_settings_dialog::auto_pause_settings_dialog(QWidget *parent) : QDialo
|
|||
setWindowTitle(tr("Auto Pause Manager"));
|
||||
setObjectName("auto_pause_manager");
|
||||
|
||||
//Events
|
||||
// Events
|
||||
connect(pauseList, &QTableWidget::customContextMenuRequested, this, &auto_pause_settings_dialog::ShowContextMenu);
|
||||
connect(clearButton, &QAbstractButton::clicked, [this](){ m_entries.clear(); UpdateList(); });
|
||||
connect(reloadButton, &QAbstractButton::clicked, [this](){ LoadEntries(); UpdateList(); });
|
||||
|
@ -67,7 +67,7 @@ auto_pause_settings_dialog::auto_pause_settings_dialog(QWidget *parent) : QDialo
|
|||
setFixedSize(sizeHint());
|
||||
}
|
||||
|
||||
//Copied some from AutoPause.
|
||||
// Copied some from AutoPause.
|
||||
void auto_pause_settings_dialog::LoadEntries(void)
|
||||
{
|
||||
m_entries.clear();
|
||||
|
@ -77,9 +77,9 @@ void auto_pause_settings_dialog::LoadEntries(void)
|
|||
|
||||
if (list)
|
||||
{
|
||||
//System calls ID and Function calls ID are all u32 iirc.
|
||||
// System calls ID and Function calls ID are all u32 iirc.
|
||||
u32 num;
|
||||
usz fmax = list.size();
|
||||
const usz fmax = list.size();
|
||||
usz fcur = 0;
|
||||
list.seek(0);
|
||||
while (fcur <= fmax - sizeof(u32))
|
||||
|
@ -93,9 +93,9 @@ void auto_pause_settings_dialog::LoadEntries(void)
|
|||
}
|
||||
}
|
||||
|
||||
//Copied some from AutoPause.
|
||||
//Tip: This one doesn't check for the file is being read or not.
|
||||
//This would always use a 0xFFFFFFFF as end of the pause.bin
|
||||
// Copied some from AutoPause.
|
||||
// Tip: This one doesn't check for the file is being read or not.
|
||||
// This would always use a 0xFFFFFFFF as end of the pause.bin
|
||||
void auto_pause_settings_dialog::SaveEntries(void)
|
||||
{
|
||||
fs::file list(fs::get_config_dir() + "pause.bin", fs::rewrite);
|
||||
|
@ -148,7 +148,7 @@ void auto_pause_settings_dialog::UpdateList(void)
|
|||
|
||||
void auto_pause_settings_dialog::ShowContextMenu(const QPoint &pos)
|
||||
{
|
||||
int row = pauseList->indexAt(pos).row();
|
||||
const int row = pauseList->indexAt(pos).row();
|
||||
|
||||
QMenu myMenu;
|
||||
|
||||
|
@ -273,7 +273,7 @@ void AutoPauseConfigDialog::OnCancel()
|
|||
void AutoPauseConfigDialog::OnUpdateValue()
|
||||
{
|
||||
bool ok;
|
||||
ullong value = m_id->text().toULongLong(&ok, 16);
|
||||
const ullong value = m_id->text().toULongLong(&ok, 16);
|
||||
const bool is_ok = ok && value <= UINT32_MAX;
|
||||
|
||||
m_current_converted->setText(tr("Current value: %1 (%2)").arg(value, 8, 16).arg(is_ok ? tr("OK") : tr("Conversion failed")));
|
||||
|
|
|
@ -26,7 +26,6 @@ memory_viewer_panel::memory_viewer_panel(QWidget* parent, u32 addr)
|
|||
setWindowTitle(tr("Memory Viewer"));
|
||||
setObjectName("memory_viewer");
|
||||
setAttribute(Qt::WA_DeleteOnClose);
|
||||
exit = false;
|
||||
m_colcount = 4;
|
||||
m_rowcount = 16;
|
||||
m_addr -= m_addr % (m_colcount * 4); // Align by amount of bytes in a row
|
||||
|
@ -243,7 +242,6 @@ memory_viewer_panel::memory_viewer_panel(QWidget* parent, u32 addr)
|
|||
|
||||
memory_viewer_panel::~memory_viewer_panel()
|
||||
{
|
||||
exit = true;
|
||||
}
|
||||
|
||||
void memory_viewer_panel::wheelEvent(QWheelEvent *event)
|
||||
|
|
|
@ -25,8 +25,6 @@ public:
|
|||
};
|
||||
Q_ENUM(color_format)
|
||||
|
||||
bool exit;
|
||||
|
||||
protected:
|
||||
void wheelEvent(QWheelEvent* event) override;
|
||||
void resizeEvent(QResizeEvent* event) override;
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#include "rsx_debugger.h"
|
||||
#include "gui_settings.h"
|
||||
#include "qt_utils.h"
|
||||
#include "memory_viewer_panel.h"
|
||||
#include "table_item_delegate.h"
|
||||
#include "Emu/RSX/RSXThread.h"
|
||||
#include "Emu/RSX/gcm_printing.h"
|
||||
|
@ -9,6 +8,7 @@
|
|||
#include <QHBoxLayout>
|
||||
#include <QHeaderView>
|
||||
#include <QFont>
|
||||
#include <QFontDatabase>
|
||||
#include <QPixmap>
|
||||
#include <QPushButton>
|
||||
#include <QKeyEvent>
|
||||
|
@ -38,7 +38,7 @@ rsx_debugger::rsx_debugger(std::shared_ptr<gui_settings> gui_settings, QWidget*
|
|||
setObjectName("rsx_debugger");
|
||||
setWindowFlags(Qt::Window);
|
||||
|
||||
//Fonts and Colors
|
||||
// Fonts and Colors
|
||||
QFont mono = QFontDatabase::systemFont(QFontDatabase::FixedFont);
|
||||
mono.setPointSize(8);
|
||||
QLabel l("000000000"); // hacky way to get the lineedit to resize properly
|
||||
|
@ -109,7 +109,7 @@ rsx_debugger::rsx_debugger(std::shared_ptr<gui_settings> gui_settings, QWidget*
|
|||
m_tw_rsx = new QTabWidget();
|
||||
|
||||
// adds a tab containing a list to the tabwidget
|
||||
auto l_addRSXTab = [=, this](QTableWidget* table, const QString& tabname, int columns)
|
||||
const auto add_rsx_tab = [this, &mono](QTableWidget* table, const QString& tabname, int columns)
|
||||
{
|
||||
table = new QTableWidget();
|
||||
table->setItemDelegate(new table_item_delegate);
|
||||
|
@ -134,9 +134,9 @@ rsx_debugger::rsx_debugger(std::shared_ptr<gui_settings> gui_settings, QWidget*
|
|||
m_addr = render->ctrl->get;
|
||||
}
|
||||
|
||||
m_list_commands = l_addRSXTab(m_list_commands, tr("RSX Commands"), 4);
|
||||
m_list_captured_frame = l_addRSXTab(m_list_captured_frame, tr("Captured Frame"), 1);
|
||||
m_list_captured_draw_calls = l_addRSXTab(m_list_captured_draw_calls, tr("Captured Draw Calls"), 1);
|
||||
m_list_commands = add_rsx_tab(m_list_commands, tr("RSX Commands"), 4);
|
||||
m_list_captured_frame = add_rsx_tab(m_list_captured_frame, tr("Captured Frame"), 1);
|
||||
m_list_captured_draw_calls = add_rsx_tab(m_list_captured_draw_calls, tr("Captured Draw Calls"), 1);
|
||||
|
||||
// Tabs: List Columns
|
||||
m_list_commands->viewport()->installEventFilter(this);
|
||||
|
@ -171,7 +171,7 @@ rsx_debugger::rsx_debugger(std::shared_ptr<gui_settings> gui_settings, QWidget*
|
|||
m_list_index_buffer = new QListWidget();
|
||||
m_list_index_buffer->setFont(mono);
|
||||
|
||||
//Panels for displaying the buffers
|
||||
// Panels for displaying the buffers
|
||||
m_buffer_colorA = new Buffer(false, 0, tr("Color Buffer A"), this);
|
||||
m_buffer_colorB = new Buffer(false, 1, tr("Color Buffer B"), this);
|
||||
m_buffer_colorC = new Buffer(false, 2, tr("Color Buffer C"), this);
|
||||
|
@ -180,7 +180,7 @@ rsx_debugger::rsx_debugger(std::shared_ptr<gui_settings> gui_settings, QWidget*
|
|||
m_buffer_stencil = new Buffer(false, 4, tr("Stencil Buffer"), this);
|
||||
m_buffer_tex = new Buffer(true, 4, tr("Texture"), this);
|
||||
|
||||
//Merge and display everything
|
||||
// Merge and display everything
|
||||
QVBoxLayout* vbox_buffers1 = new QVBoxLayout();
|
||||
vbox_buffers1->addWidget(m_buffer_colorA);
|
||||
vbox_buffers1->addWidget(m_buffer_colorC);
|
||||
|
@ -213,7 +213,7 @@ rsx_debugger::rsx_debugger(std::shared_ptr<gui_settings> gui_settings, QWidget*
|
|||
main_layout->addWidget(state_rsx, 1);
|
||||
setLayout(main_layout);
|
||||
|
||||
//Events
|
||||
// Events
|
||||
connect(b_goto_get, &QAbstractButton::clicked, [this]()
|
||||
{
|
||||
if (const auto render = rsx::get_current_renderer(); render && render->ctrl &&
|
||||
|
@ -255,7 +255,6 @@ rsx_debugger::rsx_debugger(std::shared_ptr<gui_settings> gui_settings, QWidget*
|
|||
|
||||
rsx_debugger::~rsx_debugger()
|
||||
{
|
||||
exit = true;
|
||||
}
|
||||
|
||||
void rsx_debugger::closeEvent(QCloseEvent* event)
|
||||
|
@ -273,11 +272,12 @@ void rsx_debugger::closeEvent(QCloseEvent* event)
|
|||
|
||||
void rsx_debugger::keyPressEvent(QKeyEvent* event)
|
||||
{
|
||||
if(isActiveWindow())
|
||||
if (isActiveWindow())
|
||||
{
|
||||
switch(event->key())
|
||||
switch (event->key())
|
||||
{
|
||||
case Qt::Key_F5: UpdateInformation(); break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -304,12 +304,13 @@ bool rsx_debugger::eventFilter(QObject* object, QEvent* event)
|
|||
case QEvent::Wheel:
|
||||
{
|
||||
QWheelEvent* wheelEvent = static_cast<QWheelEvent*>(event);
|
||||
QPoint numSteps = wheelEvent->angleDelta() / 8 / 15; // http://doc.qt.io/qt-5/qwheelevent.html#pixelDelta
|
||||
int steps = numSteps.y();
|
||||
int item_count = m_list_commands->rowCount();
|
||||
int step_size = wheelEvent->modifiers() & Qt::ControlModifier ? item_count : 1;
|
||||
const QPoint numSteps = wheelEvent->angleDelta() / 8 / 15; // http://doc.qt.io/qt-5/qwheelevent.html#pixelDelta
|
||||
const int steps = numSteps.y();
|
||||
const int item_count = m_list_commands->rowCount();
|
||||
const int step_size = wheelEvent->modifiers() & Qt::ControlModifier ? item_count : 1;
|
||||
m_addr -= step_size * 4 * steps;
|
||||
UpdateInformation();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
|
@ -357,7 +358,7 @@ void Buffer::showImage(const QImage& image)
|
|||
return;
|
||||
|
||||
m_image = image;
|
||||
QImage scaled = m_image.scaled(m_image_size, Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||
const QImage scaled = m_image.scaled(m_image_size, Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||
m_canvas->setPixmap(QPixmap::fromImage(scaled));
|
||||
|
||||
QHBoxLayout* new_layout = new QHBoxLayout();
|
||||
|
@ -385,16 +386,16 @@ void Buffer::ShowWindowed()
|
|||
|
||||
gui::utils::show_windowed_image(m_image, title());
|
||||
|
||||
if (m_isTex)
|
||||
{
|
||||
/* u8 location = render->textures[m_cur_texture].location();
|
||||
if(location <= 1 && vm::check_addr(rsx::get_address(render->textures[m_cur_texture].offset(), location))
|
||||
&& render->textures[m_cur_texture].width() && render->textures[m_cur_texture].height())
|
||||
memory_viewer_panel::ShowImage(this,
|
||||
rsx::get_address(render->textures[m_cur_texture].offset(), location), 1,
|
||||
render->textures[m_cur_texture].width(),
|
||||
render->textures[m_cur_texture].height(), false);*/
|
||||
}
|
||||
//if (m_isTex)
|
||||
//{
|
||||
// u8 location = render->textures[m_cur_texture].location();
|
||||
// if (location <= 1 && vm::check_addr(rsx::get_address(render->textures[m_cur_texture].offset(), location))
|
||||
// && render->textures[m_cur_texture].width() && render->textures[m_cur_texture].height())
|
||||
// memory_viewer_panel::ShowImage(this,
|
||||
// rsx::get_address(render->textures[m_cur_texture].offset(), location), 1,
|
||||
// render->textures[m_cur_texture].width(),
|
||||
// render->textures[m_cur_texture].height(), false);
|
||||
//}
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -406,44 +407,44 @@ namespace
|
|||
{
|
||||
case rsx::surface_color_format::b8:
|
||||
{
|
||||
u8 value = as_const_span<const u8>(orig_buffer)[idx];
|
||||
const u8 value = as_const_span<const u8>(orig_buffer)[idx];
|
||||
return{ value, value, value };
|
||||
}
|
||||
case rsx::surface_color_format::x32:
|
||||
{
|
||||
be_t<u32> stored_val = as_const_span<const be_t<u32>>(orig_buffer)[idx];
|
||||
u32 swapped_val = stored_val;
|
||||
f32 float_val = std::bit_cast<f32>(swapped_val);
|
||||
u8 val = float_val * 255.f;
|
||||
const be_t<u32> stored_val = as_const_span<const be_t<u32>>(orig_buffer)[idx];
|
||||
const u32 swapped_val = stored_val;
|
||||
const f32 float_val = std::bit_cast<f32>(swapped_val);
|
||||
const u8 val = float_val * 255.f;
|
||||
return{ val, val, val };
|
||||
}
|
||||
case rsx::surface_color_format::a8b8g8r8:
|
||||
case rsx::surface_color_format::x8b8g8r8_o8b8g8r8:
|
||||
case rsx::surface_color_format::x8b8g8r8_z8b8g8r8:
|
||||
{
|
||||
auto ptr = as_const_span<const u8>(orig_buffer);
|
||||
const auto ptr = as_const_span<const u8>(orig_buffer);
|
||||
return{ ptr[1 + idx * 4], ptr[2 + idx * 4], ptr[3 + idx * 4] };
|
||||
}
|
||||
case rsx::surface_color_format::a8r8g8b8:
|
||||
case rsx::surface_color_format::x8r8g8b8_o8r8g8b8:
|
||||
case rsx::surface_color_format::x8r8g8b8_z8r8g8b8:
|
||||
{
|
||||
auto ptr = as_const_span<const u8>(orig_buffer);
|
||||
const auto ptr = as_const_span<const u8>(orig_buffer);
|
||||
return{ ptr[3 + idx * 4], ptr[2 + idx * 4], ptr[1 + idx * 4] };
|
||||
}
|
||||
case rsx::surface_color_format::w16z16y16x16:
|
||||
{
|
||||
auto ptr = as_const_span<const u16>(orig_buffer);
|
||||
f16 h0 = f16(ptr[4 * idx]);
|
||||
f16 h1 = f16(ptr[4 * idx + 1]);
|
||||
f16 h2 = f16(ptr[4 * idx + 2]);
|
||||
f32 f0 = float(h0);
|
||||
f32 f1 = float(h1);
|
||||
f32 f2 = float(h2);
|
||||
const auto ptr = as_const_span<const u16>(orig_buffer);
|
||||
const f16 h0 = f16(ptr[4 * idx]);
|
||||
const f16 h1 = f16(ptr[4 * idx + 1]);
|
||||
const f16 h2 = f16(ptr[4 * idx + 2]);
|
||||
const f32 f0 = float(h0);
|
||||
const f32 f1 = float(h1);
|
||||
const f32 f2 = float(h2);
|
||||
|
||||
u8 val0 = f0 * 255.;
|
||||
u8 val1 = f1 * 255.;
|
||||
u8 val2 = f2 * 255.;
|
||||
const u8 val0 = f0 * 255.;
|
||||
const u8 val1 = f1 * 255.;
|
||||
const u8 val2 = f2 * 255.;
|
||||
return{ val0, val1, val2 };
|
||||
}
|
||||
case rsx::surface_color_format::g8b8:
|
||||
|
@ -477,7 +478,7 @@ namespace
|
|||
|
||||
void rsx_debugger::OnClickDrawCalls()
|
||||
{
|
||||
usz draw_id = m_list_captured_draw_calls->currentRow();
|
||||
const usz draw_id = m_list_captured_draw_calls->currentRow();
|
||||
|
||||
const auto& draw_call = frame_debug.draw_calls[draw_id];
|
||||
|
||||
|
@ -489,8 +490,8 @@ void rsx_debugger::OnClickDrawCalls()
|
|||
m_buffer_colorD,
|
||||
};
|
||||
|
||||
u32 width = draw_call.state.surface_clip_width();
|
||||
u32 height = draw_call.state.surface_clip_height();
|
||||
const u32 width = draw_call.state.surface_clip_width();
|
||||
const u32 height = draw_call.state.surface_clip_height();
|
||||
|
||||
for (usz i = 0; i < 4; i++)
|
||||
{
|
||||
|
@ -506,7 +507,7 @@ void rsx_debugger::OnClickDrawCalls()
|
|||
if (width && height && !draw_call.depth_stencil[0].empty())
|
||||
{
|
||||
gsl::span<const std::byte> orig_buffer = draw_call.depth_stencil[0];
|
||||
u8* buffer = static_cast<u8*>(std::malloc(width * height * 4));
|
||||
u8* buffer = static_cast<u8*>(std::malloc(4ULL * width * height));
|
||||
|
||||
if (draw_call.state.surface_depth_fmt() == rsx::surface_depth_format::z24s8)
|
||||
{
|
||||
|
@ -514,8 +515,8 @@ void rsx_debugger::OnClickDrawCalls()
|
|||
{
|
||||
for (u32 col = 0; col < width; col++)
|
||||
{
|
||||
u32 depth_val = as_const_span<const u32>(orig_buffer)[row * width + col];
|
||||
u8 displayed_depth_val = 255 * depth_val / 0xFFFFFF;
|
||||
const u32 depth_val = as_const_span<const u32>(orig_buffer)[row * width + col];
|
||||
const u8 displayed_depth_val = 255 * depth_val / 0xFFFFFF;
|
||||
buffer[4 * col + 0 + width * row * 4] = displayed_depth_val;
|
||||
buffer[4 * col + 1 + width * row * 4] = displayed_depth_val;
|
||||
buffer[4 * col + 2 + width * row * 4] = displayed_depth_val;
|
||||
|
@ -529,8 +530,8 @@ void rsx_debugger::OnClickDrawCalls()
|
|||
{
|
||||
for (u32 col = 0; col < width; col++)
|
||||
{
|
||||
u16 depth_val = as_const_span<const u16>(orig_buffer)[row * width + col];
|
||||
u8 displayed_depth_val = 255 * depth_val / 0xFFFF;
|
||||
const u16 depth_val = as_const_span<const u16>(orig_buffer)[row * width + col];
|
||||
const u8 displayed_depth_val = 255 * depth_val / 0xFFFF;
|
||||
buffer[4 * col + 0 + width * row * 4] = displayed_depth_val;
|
||||
buffer[4 * col + 1 + width * row * 4] = displayed_depth_val;
|
||||
buffer[4 * col + 2 + width * row * 4] = displayed_depth_val;
|
||||
|
@ -547,13 +548,13 @@ void rsx_debugger::OnClickDrawCalls()
|
|||
if (width && height && !draw_call.depth_stencil[1].empty())
|
||||
{
|
||||
gsl::span<const std::byte> orig_buffer = draw_call.depth_stencil[1];
|
||||
u8* buffer = static_cast<u8*>(std::malloc(width * height * 4));
|
||||
u8* buffer = static_cast<u8*>(std::malloc(4ULL * width * height));
|
||||
|
||||
for (u32 row = 0; row < height; row++)
|
||||
{
|
||||
for (u32 col = 0; col < width; col++)
|
||||
{
|
||||
u8 stencil_val = as_const_span<const u8>(orig_buffer)[row * width + col];
|
||||
const u8 stencil_val = as_const_span<const u8>(orig_buffer)[row * width + col];
|
||||
buffer[4 * col + 0 + width * row * 4] = stencil_val;
|
||||
buffer[4 * col + 1 + width * row * 4] = stencil_val;
|
||||
buffer[4 * col + 2 + width * row * 4] = stencil_val;
|
||||
|
@ -657,27 +658,27 @@ void rsx_debugger::GetBuffers()
|
|||
for (u32 bufferId=0; bufferId < render->display_buffers_count; bufferId++)
|
||||
{
|
||||
auto buffers = render->display_buffers;
|
||||
u32 RSXbuffer_addr = rsx::constants::local_mem_base + buffers[bufferId].offset;
|
||||
const u32 rsx_buffer_addr = rsx::constants::local_mem_base + buffers[bufferId].offset;
|
||||
|
||||
const u32 width = buffers[bufferId].width;
|
||||
const u32 height = buffers[bufferId].height;
|
||||
|
||||
if (!vm::check_addr(RSXbuffer_addr, vm::page_readable, width * height * 4))
|
||||
if (!vm::check_addr(rsx_buffer_addr, vm::page_readable, width * height * 4))
|
||||
continue;
|
||||
|
||||
const auto RSXbuffer = vm::get_super_ptr<const u8>(RSXbuffer_addr);
|
||||
const auto rsx_buffer = vm::get_super_ptr<const u8>(rsx_buffer_addr);
|
||||
|
||||
u8* buffer = static_cast<u8*>(std::malloc(width * height * 4));
|
||||
u8* buffer = static_cast<u8*>(std::malloc(4ULL * width * height));
|
||||
|
||||
// ABGR to ARGB and flip vertically
|
||||
for (u32 y=0; y<height; y++)
|
||||
for (u32 y = 0; y < height; y++)
|
||||
{
|
||||
for (u32 i=0, j=0; j<width*4; i+=4, j+=4)
|
||||
for (u32 i = 0, j = 0; j < width * 4; i += 4, j += 4)
|
||||
{
|
||||
buffer[i+0 + y*width*4] = RSXbuffer[j+1 + (height-y-1)*width*4]; //B
|
||||
buffer[i+1 + y*width*4] = RSXbuffer[j+2 + (height-y-1)*width*4]; //G
|
||||
buffer[i+2 + y*width*4] = RSXbuffer[j+3 + (height-y-1)*width*4]; //R
|
||||
buffer[i+3 + y*width*4] = RSXbuffer[j+0 + (height-y-1)*width*4]; //A
|
||||
buffer[i + 0 + y * width * 4] = rsx_buffer[j + 1 + (height - y - 1) * width * 4]; // B
|
||||
buffer[i + 1 + y * width * 4] = rsx_buffer[j + 2 + (height - y - 1) * width * 4]; // G
|
||||
buffer[i + 2 + y * width * 4] = rsx_buffer[j + 3 + (height - y - 1) * width * 4]; // R
|
||||
buffer[i + 3 + y * width * 4] = rsx_buffer[j + 0 + (height - y - 1) * width * 4]; // A
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -694,32 +695,32 @@ void rsx_debugger::GetBuffers()
|
|||
}
|
||||
|
||||
// Draw Texture
|
||||
/* if(!render->textures[m_cur_texture].enabled())
|
||||
return;
|
||||
//if (!render->textures[m_cur_texture].enabled())
|
||||
// return;
|
||||
|
||||
u32 offset = render->textures[m_cur_texture].offset();
|
||||
//u32 offset = render->textures[m_cur_texture].offset();
|
||||
|
||||
if(!offset)
|
||||
return;
|
||||
//if(!offset)
|
||||
// return;
|
||||
|
||||
u8 location = render->textures[m_cur_texture].location();
|
||||
//u8 location = render->textures[m_cur_texture].location();
|
||||
|
||||
if(location > 1)
|
||||
return;
|
||||
//if(location > 1)
|
||||
// return;
|
||||
|
||||
u32 TexBuffer_addr = rsx::get_address(offset, location);
|
||||
//u32 TexBuffer_addr = rsx::get_address(offset, location);
|
||||
|
||||
if(!vm::check_addr(TexBuffer_addr))
|
||||
return;
|
||||
//if(!vm::check_addr(TexBuffer_addr))
|
||||
// return;
|
||||
|
||||
unsigned char* TexBuffer = vm::get_super_ptr<u8>(TexBuffer_addr);
|
||||
//unsigned char* TexBuffer = vm::get_super_ptr<u8>(TexBuffer_addr);
|
||||
|
||||
u32 width = render->textures[m_cur_texture].width();
|
||||
u32 height = render->textures[m_cur_texture].height();
|
||||
unsigned char* buffer = (unsigned char*)malloc(width * height * 3);
|
||||
std::memcpy(buffer, vm::base(TexBuffer_addr), width * height * 3);
|
||||
//const u32 width = render->textures[m_cur_texture].width();
|
||||
//const u32 height = render->textures[m_cur_texture].height();
|
||||
//unsigned char* buffer = (unsigned char*)malloc(width * height * 3);
|
||||
//std::memcpy(buffer, vm::base(TexBuffer_addr), width * height * 3);
|
||||
|
||||
m_buffer_tex->showImage(QImage(buffer, m_text_width, m_text_height, QImage::Format_RGB32));*/
|
||||
//m_buffer_tex->showImage(QImage(buffer, m_text_width, m_text_height, QImage::Format_RGB32));
|
||||
}
|
||||
|
||||
const char* rsx_debugger::ParseGCMEnum(u32 value, u32 type)
|
||||
|
@ -817,22 +818,22 @@ QString rsx_debugger::DisAsmCommand(u32 cmd, u32 count, u32 ioAddr)
|
|||
|
||||
if (cmd & RSX_METHOD_NON_METHOD_CMD_MASK)
|
||||
{
|
||||
if((cmd & RSX_METHOD_OLD_JUMP_CMD_MASK) == RSX_METHOD_OLD_JUMP_CMD)
|
||||
if ((cmd & RSX_METHOD_OLD_JUMP_CMD_MASK) == RSX_METHOD_OLD_JUMP_CMD)
|
||||
{
|
||||
u32 jumpAddr = cmd & RSX_METHOD_OLD_JUMP_OFFSET_MASK;
|
||||
DISASM("JUMP to 0x%07x", jumpAddr);
|
||||
}
|
||||
else if((cmd & RSX_METHOD_NEW_JUMP_CMD_MASK) == RSX_METHOD_NEW_JUMP_CMD)
|
||||
else if ((cmd & RSX_METHOD_NEW_JUMP_CMD_MASK) == RSX_METHOD_NEW_JUMP_CMD)
|
||||
{
|
||||
u32 jumpAddr = cmd & RSX_METHOD_NEW_JUMP_OFFSET_MASK;
|
||||
DISASM("JUMP to 0x%07x", jumpAddr);
|
||||
}
|
||||
else if((cmd & RSX_METHOD_CALL_CMD_MASK) == RSX_METHOD_CALL_CMD)
|
||||
else if ((cmd & RSX_METHOD_CALL_CMD_MASK) == RSX_METHOD_CALL_CMD)
|
||||
{
|
||||
u32 callAddr = cmd & RSX_METHOD_CALL_OFFSET_MASK;
|
||||
DISASM("CALL to 0x%07x", callAddr);
|
||||
}
|
||||
else if((cmd & RSX_METHOD_RETURN_MASK) == RSX_METHOD_RETURN_CMD)
|
||||
else if ((cmd & RSX_METHOD_RETURN_MASK) == RSX_METHOD_RETURN_CMD)
|
||||
{
|
||||
DISASM("RETURN");
|
||||
}
|
||||
|
@ -853,10 +854,12 @@ QString rsx_debugger::DisAsmCommand(u32 cmd, u32 count, u32 ioAddr)
|
|||
switch((cmd & 0x3ffff) >> 2)
|
||||
{
|
||||
case 0x3fead:
|
||||
{
|
||||
DISASM("Flip and change current buffer: %d", args[0]);
|
||||
break;
|
||||
|
||||
break;
|
||||
}
|
||||
case_16(NV4097_SET_TEXTURE_OFFSET, 0x20):
|
||||
{
|
||||
DISASM("Texture Offset[%d]: %07x", index, args[0]);
|
||||
switch ((args[1] & 0x3) - 1)
|
||||
{
|
||||
|
@ -869,28 +872,31 @@ QString rsx_debugger::DisAsmCommand(u32 cmd, u32 count, u32 ioAddr)
|
|||
((args[1] >> 4) & 0xf),
|
||||
((args[1] >> 8) & 0xff),
|
||||
((args[1] >> 16) & 0xffff));
|
||||
break;
|
||||
|
||||
break;
|
||||
}
|
||||
case NV4097_SET_DEPTH_BOUNDS_TEST_ENABLE:
|
||||
{
|
||||
DISASM("Depth bounds test: %s", args[0] ? "Enable" : "Disable");
|
||||
break;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
std::string str = rsx::get_pretty_printing_function((cmd & 0x3ffff) >> 2)(args[0]);
|
||||
DISASM("%s", str.c_str());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if((cmd & RSX_METHOD_NON_INCREMENT_CMD_MASK) == RSX_METHOD_NON_INCREMENT_CMD && count > 1)
|
||||
if ((cmd & RSX_METHOD_NON_INCREMENT_CMD_MASK) == RSX_METHOD_NON_INCREMENT_CMD && count > 1)
|
||||
{
|
||||
DISASM("Non Increment cmd");
|
||||
}
|
||||
|
||||
DISASM("(");
|
||||
|
||||
for(uint i=0; i<count; ++i)
|
||||
for (uint i=0; i<count; ++i)
|
||||
{
|
||||
if(i != 0) disasm += ", ";
|
||||
if (i != 0) disasm += ", ";
|
||||
disasm += fmt::format("0x%x", args[i]);
|
||||
}
|
||||
|
||||
|
@ -911,8 +917,8 @@ void rsx_debugger::PerformJump(u32 address)
|
|||
if (!vm::check_addr(address))
|
||||
return;
|
||||
|
||||
u32 cmd = *vm::get_super_ptr<u32>(address);
|
||||
u32 count = cmd & RSX_METHOD_NON_METHOD_CMD_MASK ? 0 : (cmd >> 18) & 0x7ff;
|
||||
const u32 cmd = *vm::get_super_ptr<u32>(address);
|
||||
const u32 count = cmd & RSX_METHOD_NON_METHOD_CMD_MASK ? 0 : (cmd >> 18) & 0x7ff;
|
||||
|
||||
if (count == 0)
|
||||
return;
|
||||
|
|
|
@ -63,7 +63,6 @@ class rsx_debugger : public QDialog
|
|||
std::shared_ptr<gui_settings> m_gui_settings;
|
||||
|
||||
public:
|
||||
bool exit = false;
|
||||
rsx_debugger(std::shared_ptr<gui_settings> gui_settings, QWidget* parent = 0);
|
||||
~rsx_debugger();
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue