Qt: Add renderer/resolution to status bar
This commit is contained in:
parent
dec2d48bfe
commit
ddea2818d9
|
@ -63,6 +63,12 @@ void GPU::UpdateSettings()
|
|||
UpdateCRTCDisplayParameters();
|
||||
}
|
||||
|
||||
bool GPU::IsHardwareRenderer()
|
||||
{
|
||||
const GPURenderer renderer = GetRendererType();
|
||||
return (renderer != GPURenderer::Software);
|
||||
}
|
||||
|
||||
void GPU::CPUClockChanged()
|
||||
{
|
||||
UpdateCRTCConfig();
|
||||
|
|
|
@ -73,7 +73,7 @@ public:
|
|||
GPU();
|
||||
virtual ~GPU();
|
||||
|
||||
virtual bool IsHardwareRenderer() const = 0;
|
||||
virtual GPURenderer GetRendererType() const = 0;
|
||||
|
||||
virtual bool Initialize(HostDisplay* host_display);
|
||||
virtual void Reset(bool clear_vram);
|
||||
|
@ -86,6 +86,7 @@ public:
|
|||
// Render statistics debug window.
|
||||
void DrawDebugStateWindow();
|
||||
|
||||
bool IsHardwareRenderer();
|
||||
void CPUClockChanged();
|
||||
|
||||
// MMIO access
|
||||
|
|
|
@ -36,11 +36,6 @@ GPU_HW::GPU_HW() : GPU()
|
|||
|
||||
GPU_HW::~GPU_HW() = default;
|
||||
|
||||
bool GPU_HW::IsHardwareRenderer() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GPU_HW::Initialize(HostDisplay* host_display)
|
||||
{
|
||||
if (!GPU::Initialize(host_display))
|
||||
|
|
|
@ -29,8 +29,6 @@ public:
|
|||
GPU_HW();
|
||||
virtual ~GPU_HW();
|
||||
|
||||
virtual bool IsHardwareRenderer() const override;
|
||||
|
||||
virtual bool Initialize(HostDisplay* host_display) override;
|
||||
virtual void Reset(bool clear_vram) override;
|
||||
virtual bool DoState(StateWrapper& sw, HostDisplayTexture** host_texture, bool update_display) override;
|
||||
|
|
|
@ -25,6 +25,11 @@ GPU_HW_D3D11::~GPU_HW_D3D11()
|
|||
DestroyStateObjects();
|
||||
}
|
||||
|
||||
GPURenderer GPU_HW_D3D11::GetRendererType() const
|
||||
{
|
||||
return GPURenderer::HardwareD3D11;
|
||||
}
|
||||
|
||||
bool GPU_HW_D3D11::Initialize(HostDisplay* host_display)
|
||||
{
|
||||
if (host_display->GetRenderAPI() != HostDisplay::RenderAPI::D3D11)
|
||||
|
|
|
@ -20,6 +20,8 @@ public:
|
|||
GPU_HW_D3D11();
|
||||
~GPU_HW_D3D11() override;
|
||||
|
||||
GPURenderer GetRendererType() const override;
|
||||
|
||||
bool Initialize(HostDisplay* host_display) override;
|
||||
void Reset(bool clear_vram) override;
|
||||
bool DoState(StateWrapper& sw, HostDisplayTexture** host_texture, bool update_display) override;
|
||||
|
|
|
@ -35,6 +35,11 @@ GPU_HW_OpenGL::~GPU_HW_OpenGL()
|
|||
glUseProgram(0);
|
||||
}
|
||||
|
||||
GPURenderer GPU_HW_OpenGL::GetRendererType() const
|
||||
{
|
||||
return GPURenderer::HardwareOpenGL;
|
||||
}
|
||||
|
||||
bool GPU_HW_OpenGL::Initialize(HostDisplay* host_display)
|
||||
{
|
||||
if (host_display->GetRenderAPI() != HostDisplay::RenderAPI::OpenGL &&
|
||||
|
|
|
@ -16,6 +16,8 @@ public:
|
|||
GPU_HW_OpenGL();
|
||||
~GPU_HW_OpenGL() override;
|
||||
|
||||
GPURenderer GetRendererType() const override;
|
||||
|
||||
bool Initialize(HostDisplay* host_display) override;
|
||||
void Reset(bool clear_vram) override;
|
||||
bool DoState(StateWrapper& sw, HostDisplayTexture** host_texture, bool update_display) override;
|
||||
|
|
|
@ -27,6 +27,11 @@ GPU_HW_Vulkan::~GPU_HW_Vulkan()
|
|||
DestroyResources();
|
||||
}
|
||||
|
||||
GPURenderer GPU_HW_Vulkan::GetRendererType() const
|
||||
{
|
||||
return GPURenderer::HardwareVulkan;
|
||||
}
|
||||
|
||||
bool GPU_HW_Vulkan::Initialize(HostDisplay* host_display)
|
||||
{
|
||||
if (host_display->GetRenderAPI() != HostDisplay::RenderAPI::Vulkan)
|
||||
|
|
|
@ -15,6 +15,8 @@ public:
|
|||
GPU_HW_Vulkan();
|
||||
~GPU_HW_Vulkan() override;
|
||||
|
||||
GPURenderer GetRendererType() const override;
|
||||
|
||||
bool Initialize(HostDisplay* host_display) override;
|
||||
void Reset(bool clear_vram) override;
|
||||
bool DoState(StateWrapper& sw, HostDisplayTexture** host_texture, bool update_display) override;
|
||||
|
|
|
@ -40,9 +40,9 @@ GPU_SW::~GPU_SW()
|
|||
m_host_display->ClearDisplayTexture();
|
||||
}
|
||||
|
||||
bool GPU_SW::IsHardwareRenderer() const
|
||||
GPURenderer GPU_SW::GetRendererType() const
|
||||
{
|
||||
return false;
|
||||
return GPURenderer::Software;
|
||||
}
|
||||
|
||||
bool GPU_SW::Initialize(HostDisplay* host_display)
|
||||
|
|
|
@ -15,7 +15,7 @@ public:
|
|||
GPU_SW();
|
||||
~GPU_SW() override;
|
||||
|
||||
bool IsHardwareRenderer() const override;
|
||||
GPURenderer GetRendererType() const override;
|
||||
|
||||
bool Initialize(HostDisplay* host_display) override;
|
||||
bool DoState(StateWrapper& sw, HostDisplayTexture** host_texture, bool update_display) override;
|
||||
|
|
|
@ -403,13 +403,19 @@ void MainWindow::onStateSaved(const QString& game_code, bool global, qint32 slot
|
|||
}
|
||||
|
||||
void MainWindow::onSystemPerformanceCountersUpdated(float speed, float fps, float vps, float average_frame_time,
|
||||
float worst_frame_time)
|
||||
float worst_frame_time, GPURenderer renderer, quint32 render_width,
|
||||
quint32 render_height, bool render_interlaced)
|
||||
{
|
||||
m_status_speed_widget->setText(QStringLiteral("%1%").arg(speed, 0, 'f', 0));
|
||||
m_status_fps_widget->setText(
|
||||
QStringLiteral("FPS: %1/%2").arg(std::round(fps), 0, 'f', 0).arg(std::round(vps), 0, 'f', 0));
|
||||
m_status_frame_time_widget->setText(
|
||||
QStringLiteral("%1ms average, %2ms worst").arg(average_frame_time, 0, 'f', 2).arg(worst_frame_time, 0, 'f', 2));
|
||||
m_status_renderer_widget->setText(QString::fromUtf8(Settings::GetRendererName(renderer)));
|
||||
m_status_resolution_widget->setText(
|
||||
(render_interlaced ? QStringLiteral("%1x%2 (Interlaced)") : QStringLiteral("%1x%2 (Progressive)"))
|
||||
.arg(render_width)
|
||||
.arg(render_height));
|
||||
}
|
||||
|
||||
void MainWindow::onRunningGameChanged(const QString& filename, const QString& game_code, const QString& game_title)
|
||||
|
@ -746,7 +752,7 @@ void MainWindow::setupAdditionalUi()
|
|||
|
||||
m_status_speed_widget = new QLabel(m_ui.statusBar);
|
||||
m_status_speed_widget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
|
||||
m_status_speed_widget->setFixedSize(40, 16);
|
||||
m_status_speed_widget->setFixedSize(50, 16);
|
||||
m_status_speed_widget->hide();
|
||||
|
||||
m_status_fps_widget = new QLabel(m_ui.statusBar);
|
||||
|
@ -759,6 +765,16 @@ void MainWindow::setupAdditionalUi()
|
|||
m_status_frame_time_widget->setFixedSize(190, 16);
|
||||
m_status_frame_time_widget->hide();
|
||||
|
||||
m_status_renderer_widget = new QLabel(m_ui.statusBar);
|
||||
m_status_renderer_widget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
|
||||
m_status_renderer_widget->setFixedSize(50, 16);
|
||||
m_status_renderer_widget->hide();
|
||||
|
||||
m_status_resolution_widget = new QLabel(m_ui.statusBar);
|
||||
m_status_resolution_widget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
|
||||
m_status_resolution_widget->setFixedSize(140, 16);
|
||||
m_status_resolution_widget->hide();
|
||||
|
||||
m_ui.actionGridViewShowTitles->setChecked(m_game_list_widget->getShowGridCoverTitles());
|
||||
|
||||
updateDebugMenuVisibility();
|
||||
|
@ -867,18 +883,26 @@ void MainWindow::updateEmulationActions(bool starting, bool running, bool cheevo
|
|||
m_status_speed_widget->show();
|
||||
m_status_fps_widget->show();
|
||||
m_status_frame_time_widget->show();
|
||||
m_status_renderer_widget->show();
|
||||
m_status_resolution_widget->show();
|
||||
m_ui.statusBar->addPermanentWidget(m_status_speed_widget);
|
||||
m_ui.statusBar->addPermanentWidget(m_status_fps_widget);
|
||||
m_ui.statusBar->addPermanentWidget(m_status_resolution_widget);
|
||||
m_ui.statusBar->addPermanentWidget(m_status_renderer_widget);
|
||||
m_ui.statusBar->addPermanentWidget(m_status_frame_time_widget);
|
||||
}
|
||||
else if (!running && m_status_speed_widget->isVisible())
|
||||
{
|
||||
m_ui.statusBar->removeWidget(m_status_renderer_widget);
|
||||
m_ui.statusBar->removeWidget(m_status_resolution_widget);
|
||||
m_ui.statusBar->removeWidget(m_status_speed_widget);
|
||||
m_ui.statusBar->removeWidget(m_status_fps_widget);
|
||||
m_ui.statusBar->removeWidget(m_status_frame_time_widget);
|
||||
m_status_speed_widget->hide();
|
||||
m_status_fps_widget->hide();
|
||||
m_status_frame_time_widget->hide();
|
||||
m_status_renderer_widget->hide();
|
||||
m_status_resolution_widget->hide();
|
||||
}
|
||||
|
||||
if (starting || running)
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include <QtWidgets/QMainWindow>
|
||||
#include <memory>
|
||||
|
||||
#include "core/types.h"
|
||||
#include "settingsdialog.h"
|
||||
#include "ui_mainwindow.h"
|
||||
|
||||
|
@ -70,7 +71,8 @@ private Q_SLOTS:
|
|||
void onEmulationPaused(bool paused);
|
||||
void onStateSaved(const QString& game_code, bool global, qint32 slot);
|
||||
void onSystemPerformanceCountersUpdated(float speed, float fps, float vps, float average_frame_time,
|
||||
float worst_frame_time);
|
||||
float worst_frame_time, GPURenderer renderer, quint32 render_width,
|
||||
quint32 render_height, bool render_interlaced);
|
||||
void onRunningGameChanged(const QString& filename, const QString& game_code, const QString& game_title);
|
||||
void onApplicationStateChanged(Qt::ApplicationState state);
|
||||
|
||||
|
@ -150,6 +152,8 @@ private:
|
|||
QLabel* m_status_speed_widget = nullptr;
|
||||
QLabel* m_status_fps_widget = nullptr;
|
||||
QLabel* m_status_frame_time_widget = nullptr;
|
||||
QLabel* m_status_renderer_widget = nullptr;
|
||||
QLabel* m_status_resolution_widget = nullptr;
|
||||
|
||||
SettingsDialog* m_settings_dialog = nullptr;
|
||||
AutoUpdaterDialog* m_auto_updater_dialog = nullptr;
|
||||
|
|
|
@ -52,6 +52,7 @@ Log_SetChannel(QtHostInterface);
|
|||
QtHostInterface::QtHostInterface(QObject* parent) : QObject(parent), CommonHostInterface()
|
||||
{
|
||||
qRegisterMetaType<std::shared_ptr<const SystemBootParameters>>();
|
||||
qRegisterMetaType<GPURenderer>();
|
||||
}
|
||||
|
||||
QtHostInterface::~QtHostInterface()
|
||||
|
@ -724,8 +725,21 @@ void QtHostInterface::OnSystemPerformanceCountersUpdated()
|
|||
{
|
||||
HostInterface::OnSystemPerformanceCountersUpdated();
|
||||
|
||||
GPURenderer renderer = GPURenderer::Count;
|
||||
u32 render_width = 0;
|
||||
u32 render_height = 0;
|
||||
bool render_interlaced = false;
|
||||
|
||||
if (g_gpu)
|
||||
{
|
||||
renderer = g_gpu->GetRendererType();
|
||||
std::tie(render_width, render_height) = g_gpu->GetEffectiveDisplayResolution();
|
||||
render_interlaced = g_gpu->IsInterlacedDisplayEnabled();
|
||||
}
|
||||
|
||||
emit systemPerformanceCountersUpdated(System::GetEmulationSpeed(), System::GetFPS(), System::GetVPS(),
|
||||
System::GetAverageFrameTime(), System::GetWorstFrameTime());
|
||||
System::GetAverageFrameTime(), System::GetWorstFrameTime(), renderer,
|
||||
render_width, render_height, render_interlaced);
|
||||
}
|
||||
|
||||
void QtHostInterface::OnRunningGameChanged(const std::string& path, CDImage* image, const std::string& game_code,
|
||||
|
|
|
@ -34,6 +34,7 @@ class MainWindow;
|
|||
class QtDisplayWidget;
|
||||
|
||||
Q_DECLARE_METATYPE(std::shared_ptr<const SystemBootParameters>);
|
||||
Q_DECLARE_METATYPE(GPURenderer);
|
||||
|
||||
class QtHostInterface final : public QObject, public CommonHostInterface
|
||||
{
|
||||
|
@ -134,8 +135,9 @@ Q_SIGNALS:
|
|||
void displaySizeRequested(qint32 width, qint32 height);
|
||||
void focusDisplayWidgetRequested();
|
||||
void destroyDisplayRequested();
|
||||
void systemPerformanceCountersUpdated(float speed, float fps, float vps, float avg_frame_time,
|
||||
float worst_frame_time);
|
||||
void systemPerformanceCountersUpdated(float speed, float fps, float vps, float avg_frame_time, float worst_frame_time,
|
||||
GPURenderer renderer, quint32 render_width, quint32 render_height,
|
||||
bool render_interlaced);
|
||||
void runningGameChanged(const QString& filename, const QString& game_code, const QString& game_title);
|
||||
void exitRequested();
|
||||
void inputProfileLoaded();
|
||||
|
|
Loading…
Reference in New Issue