GPU: Add GPU::GetFullDisplayResolution()

This commit is contained in:
Connor McLaughlin 2021-08-24 11:57:09 +10:00
parent a44e9d16fb
commit 628dc36e77
4 changed files with 25 additions and 9 deletions

View file

@ -76,11 +76,16 @@ void GPU::CPUClockChanged()
void GPU::UpdateResolutionScale() {} void GPU::UpdateResolutionScale() {}
std::tuple<u32, u32> GPU::GetEffectiveDisplayResolution() std::tuple<u32, u32> GPU::GetEffectiveDisplayResolution(bool scaled /* = true */)
{ {
return std::tie(m_crtc_state.display_vram_width, m_crtc_state.display_vram_height); return std::tie(m_crtc_state.display_vram_width, m_crtc_state.display_vram_height);
} }
std::tuple<u32, u32> GPU::GetFullDisplayResolution(bool scaled /* = true */)
{
return std::tie(m_crtc_state.display_width, m_crtc_state.display_height);
}
void GPU::Reset(bool clear_vram) void GPU::Reset(bool clear_vram)
{ {
SoftReset(); SoftReset();

View file

@ -141,7 +141,14 @@ public:
virtual void UpdateResolutionScale(); virtual void UpdateResolutionScale();
/// Returns the effective display resolution of the GPU. /// Returns the effective display resolution of the GPU.
virtual std::tuple<u32, u32> GetEffectiveDisplayResolution(); virtual std::tuple<u32, u32> GetEffectiveDisplayResolution(bool scaled = true);
/// Returns the full display resolution of the GPU, including padding.
virtual std::tuple<u32, u32> GetFullDisplayResolution(bool scaled = true);
float ComputeHorizontalFrequency() const;
float ComputeVerticalFrequency() const;
float GetDisplayAspectRatio() const;
// gpu_hw_d3d11.cpp // gpu_hw_d3d11.cpp
static std::unique_ptr<GPU> CreateHardwareD3D11Renderer(); static std::unique_ptr<GPU> CreateHardwareD3D11Renderer();
@ -195,9 +202,6 @@ protected:
void SoftReset(); void SoftReset();
// Sets dots per scanline // Sets dots per scanline
float ComputeHorizontalFrequency() const;
float ComputeVerticalFrequency() const;
float GetDisplayAspectRatio() const;
void UpdateCRTCConfig(); void UpdateCRTCConfig();
void UpdateCRTCDisplayParameters(); void UpdateCRTCDisplayParameters();

View file

@ -261,10 +261,16 @@ GPUDownsampleMode GPU_HW::GetDownsampleMode(u32 resolution_scale) const
return g_settings.gpu_downsample_mode; return g_settings.gpu_downsample_mode;
} }
std::tuple<u32, u32> GPU_HW::GetEffectiveDisplayResolution() std::tuple<u32, u32> GPU_HW::GetEffectiveDisplayResolution(bool scaled /* = true */)
{ {
return std::make_tuple(m_crtc_state.display_vram_width * m_resolution_scale, const u32 scale = scaled ? m_resolution_scale : 1u;
m_resolution_scale * m_crtc_state.display_vram_height); return std::make_tuple(m_crtc_state.display_vram_width * scale, m_crtc_state.display_vram_height * scale);
}
std::tuple<u32, u32> GPU_HW::GetFullDisplayResolution(bool scaled /* = true */)
{
const u32 scale = scaled ? m_resolution_scale : 1u;
return std::make_tuple(m_crtc_state.display_width * scale, m_crtc_state.display_height * scale);
} }
void GPU_HW::PrintSettingsToLog() void GPU_HW::PrintSettingsToLog()

View file

@ -38,7 +38,8 @@ public:
virtual bool DoState(StateWrapper& sw, HostDisplayTexture** host_texture, bool update_display) override; virtual bool DoState(StateWrapper& sw, HostDisplayTexture** host_texture, bool update_display) override;
void UpdateResolutionScale() override final; void UpdateResolutionScale() override final;
std::tuple<u32, u32> GetEffectiveDisplayResolution() override final; std::tuple<u32, u32> GetEffectiveDisplayResolution(bool scaled = true) override final;
std::tuple<u32, u32> GetFullDisplayResolution(bool scaled = true) override final;
protected: protected:
enum : u32 enum : u32