Refactor to remove virtual from RenderXFBToScreen

Slightly simplifies the upcoming refactor
This commit is contained in:
Scott Mansell 2023-01-26 19:06:39 +13:00
parent a01d5283ec
commit c38c76abad
7 changed files with 38 additions and 20 deletions

View File

@ -115,6 +115,8 @@ void VideoBackend::InitBackendInfo()
g_Config.backend_info.bSupportsTextureQueryLevels = false;
g_Config.backend_info.bSupportsSettingObjectNames = false;
g_Config.backend_info.bUsesExplictQuadBuffering = true;
g_Config.backend_info.Adapters.clear();
// aamodes - 1 is to stay consistent with D3D (means no AA)

View File

@ -963,20 +963,18 @@ void Renderer::ClearScreen(const MathUtil::Rectangle<int>& rc, bool colorEnable,
BPFunctions::SetScissorAndViewport();
}
void Renderer::RenderXFBToScreen(const MathUtil::Rectangle<int>& target_rc,
const AbstractTexture* source_texture,
const MathUtil::Rectangle<int>& source_rc)
void Renderer::SelectLeftBuffer()
{
// Quad-buffered stereo is annoying on GL.
if (g_ActiveConfig.stereo_mode != StereoMode::QuadBuffer)
return ::Renderer::RenderXFBToScreen(target_rc, source_texture, source_rc);
glDrawBuffer(GL_BACK_LEFT);
m_post_processor->BlitFromTexture(target_rc, source_rc, source_texture, 0);
}
void Renderer::SelectRightBuffer()
{
glDrawBuffer(GL_BACK_RIGHT);
m_post_processor->BlitFromTexture(target_rc, source_rc, source_texture, 1);
}
void Renderer::SelectMainBuffer()
{
glDrawBuffer(GL_BACK);
}

View File

@ -135,9 +135,6 @@ public:
void Flush() override;
void WaitForGPUIdle() override;
void RenderXFBToScreen(const MathUtil::Rectangle<int>& target_rc,
const AbstractTexture* source_texture,
const MathUtil::Rectangle<int>& source_rc) override;
void OnConfigChanged(u32 bits) override;
void ClearScreen(const MathUtil::Rectangle<int>& rc, bool colorEnable, bool alphaEnable,
@ -165,6 +162,10 @@ public:
protected:
std::unique_ptr<BoundingBox> CreateBoundingBox() const override;
virtual void SelectLeftBuffer() override;
virtual void SelectRightBuffer() override;
virtual void SelectMainBuffer() override;
private:
void CheckForSurfaceChange();
void CheckForSurfaceResize();

View File

@ -110,9 +110,8 @@ std::unique_ptr<AbstractPipeline> SWRenderer::CreatePipeline(const AbstractPipel
}
// Called on the GPU thread
void SWRenderer::RenderXFBToScreen(const MathUtil::Rectangle<int>& target_rc,
const AbstractTexture* source_texture,
const MathUtil::Rectangle<int>& source_rc)
void SWRenderer::ShowImage(const AbstractTexture* source_texture,
const MathUtil::Rectangle<int>& source_rc)
{
if (!IsHeadless())
m_window->ShowImage(source_texture, source_rc);

View File

@ -45,9 +45,8 @@ public:
u32 AccessEFB(EFBAccessType type, u32 x, u32 y, u32 poke_data) override;
void PokeEFB(EFBAccessType type, const EfbPokeData* points, size_t num_points) override {}
void RenderXFBToScreen(const MathUtil::Rectangle<int>& target_rc,
const AbstractTexture* source_texture,
const MathUtil::Rectangle<int>& source_rc) override;
void ShowImage(const AbstractTexture* source_texture,
const MathUtil::Rectangle<int>& source_rc) override;
void ClearScreen(const MathUtil::Rectangle<int>& rc, bool colorEnable, bool alphaEnable,
bool zEnable, u32 color, u32 z) override;

View File

@ -1492,8 +1492,26 @@ void Renderer::RenderXFBToScreen(const MathUtil::Rectangle<int>& target_rc,
const AbstractTexture* source_texture,
const MathUtil::Rectangle<int>& source_rc)
{
if (g_ActiveConfig.stereo_mode == StereoMode::SBS ||
g_ActiveConfig.stereo_mode == StereoMode::TAB)
if (!g_ActiveConfig.backend_info.bSupportsPostProcessing)
{
ShowImage(source_texture, source_rc);
return
}
if (g_ActiveConfig.stereo_mode == StereoMode::QuadBuffer &&
g_ActiveConfig.backend_info.bUsesExplictQuadBuffering)
{
// Quad-buffered stereo is annoying on GL.
SelectLeftBuffer();
m_post_processor->BlitFromTexture(target_rc, source_rc, source_texture, 0);
SelectRightBuffer();
m_post_processor->BlitFromTexture(target_rc, source_rc, source_texture, 1);
SelectMainBuffer();
}
else if (g_ActiveConfig.stereo_mode == StereoMode::SBS ||
g_ActiveConfig.stereo_mode == StereoMode::TAB)
{
const auto [left_rc, right_rc] = ConvertStereoRectangle(target_rc);

View File

@ -214,6 +214,7 @@ struct VideoConfig final
u32 MaxTextureSize = 16384;
bool bUsesLowerLeftOrigin = false;
bool bUsesExplictQuadBuffering = false;
bool bSupportsExclusiveFullscreen = false;
bool bSupportsDualSourceBlend = false;