Refactor ClearRegion

And fix bug where opengl was getting the wrong coordinates
This commit is contained in:
Scott Mansell
2023-01-31 15:44:38 +13:00
parent b753641dd4
commit e009002411
17 changed files with 77 additions and 82 deletions

View File

@ -103,7 +103,7 @@ void Gfx::WaitForGPUIdle()
ExecuteCommandList(true);
}
void Gfx::ClearRegion(const MathUtil::Rectangle<int>& rc, const MathUtil::Rectangle<int>& target_rc,
void Gfx::ClearRegion(const MathUtil::Rectangle<int>& target_rc,
bool color_enable, bool alpha_enable, bool z_enable, u32 color, u32 z)
{
// Use a fast path without the shader if both color/alpha are enabled.
@ -145,7 +145,7 @@ void Gfx::ClearRegion(const MathUtil::Rectangle<int>& rc, const MathUtil::Rectan
// Anything left over, fall back to clear triangle.
if (color_enable || alpha_enable || z_enable)
::AbstractGfx::ClearRegion(rc, target_rc, color_enable, alpha_enable, z_enable, color, z);
::AbstractGfx::ClearRegion(target_rc, color_enable, alpha_enable, z_enable, color, z);
}
void Gfx::SetPipeline(const AbstractPipeline* pipeline)

View File

@ -47,7 +47,7 @@ public:
void Flush() override;
void WaitForGPUIdle() override;
void ClearRegion(const MathUtil::Rectangle<int>& rc, const MathUtil::Rectangle<int>& target_rc,
void ClearRegion(const MathUtil::Rectangle<int>& target_rc,
bool color_enable, bool alpha_enable, bool z_enable, u32 color, u32 z) override;
void SetPipeline(const AbstractPipeline* pipeline) override;

View File

@ -47,7 +47,7 @@ public:
void WaitForGPUIdle() override;
void OnConfigChanged(u32 bits) override;
void ClearRegion(const MathUtil::Rectangle<int>& rc, const MathUtil::Rectangle<int>& target_rc,
void ClearRegion(const MathUtil::Rectangle<int>& target_rc,
bool color_enable, bool alpha_enable, bool z_enable, u32 color, u32 z) override;
void SetPipeline(const AbstractPipeline* pipeline) override;

View File

@ -285,8 +285,7 @@ void Metal::Gfx::OnConfigChanged(u32 bits)
}
}
void Metal::Gfx::ClearRegion(const MathUtil::Rectangle<int>& rc,
const MathUtil::Rectangle<int>& target_rc,
void Metal::Gfx::ClearRegion(const MathUtil::Rectangle<int>& target_rc,
bool color_enable, bool alpha_enable, bool z_enable, u32 color, u32 z)
{
u32 framebuffer_width = m_current_framebuffer->GetWidth();
@ -332,7 +331,7 @@ void Metal::Gfx::ClearRegion(const MathUtil::Rectangle<int>& rc,
}
g_state_tracker->EnableEncoderLabel(false);
g_framebuffer_manager->ClearEFB(rc, color_enable, alpha_enable, z_enable, color, z);
AbstractGfx::ClearRegion(target_rc, color_enable, alpha_enable, z_enable, color, z);
g_state_tracker->EnableEncoderLabel(true);
}

View File

@ -373,8 +373,7 @@ void OGLGfx::SetAndClearFramebuffer(AbstractFramebuffer* framebuffer, const Clea
glDepthMask(m_current_depth_state.updateenable);
}
void OGLGfx::ClearRegion(const MathUtil::Rectangle<int>& rc,
const MathUtil::Rectangle<int>& target_rc, bool colorEnable,
void OGLGfx::ClearRegion(const MathUtil::Rectangle<int>& target_rc, bool colorEnable,
bool alphaEnable, bool zEnable, u32 color, u32 z)
{
u32 clear_mask = 0;

View File

@ -42,7 +42,7 @@ public:
void SetAndDiscardFramebuffer(AbstractFramebuffer* framebuffer) override;
void SetAndClearFramebuffer(AbstractFramebuffer* framebuffer, const ClearColor& color_value = {},
float depth_value = 0.0f) override;
void ClearRegion(const MathUtil::Rectangle<int>& rc, const MathUtil::Rectangle<int>& target_rc,
void ClearRegion(const MathUtil::Rectangle<int>& target_rc,
bool colorEnable, bool alphaEnable, bool zEnable, u32 color, u32 z) override;
void SetScissorRect(const MathUtil::Rectangle<int>& rc) override;
void SetTexture(u32 index, const AbstractTexture* texture) override;

View File

@ -107,8 +107,7 @@ void SWGfx::ShowImage(const AbstractTexture* source_texture,
m_window->ShowImage(source_texture, source_rc);
}
void SWGfx::ClearRegion(const MathUtil::Rectangle<int>& rc,
const MathUtil::Rectangle<int>& target_rc, bool colorEnable,
void SWGfx::ClearRegion(const MathUtil::Rectangle<int>& target_rc, bool colorEnable,
bool alphaEnable, bool zEnable, u32 color, u32 z)
{
EfbCopy::ClearEfb();

View File

@ -46,7 +46,7 @@ public:
void SetScissorRect(const MathUtil::Rectangle<int>& rc) override;
void ClearRegion(const MathUtil::Rectangle<int>& rc, const MathUtil::Rectangle<int>& target_rc,
void ClearRegion(const MathUtil::Rectangle<int>& target_rc,
bool colorEnable, bool alphaEnable, bool zEnable, u32 color, u32 z) override;
private:

View File

@ -100,8 +100,7 @@ void VKGfx::SetPipeline(const AbstractPipeline* pipeline)
StateTracker::GetInstance()->SetPipeline(static_cast<const VKPipeline*>(pipeline));
}
void VKGfx::ClearRegion(const MathUtil::Rectangle<int>& rc,
const MathUtil::Rectangle<int>& target_rc, bool color_enable,
void VKGfx::ClearRegion(const MathUtil::Rectangle<int>& target_rc, bool color_enable,
bool alpha_enable, bool z_enable, u32 color, u32 z)
{
VkRect2D target_vk_rc = {
@ -191,7 +190,7 @@ void VKGfx::ClearRegion(const MathUtil::Rectangle<int>& rc,
if (!color_enable && !alpha_enable && !z_enable)
return;
g_framebuffer_manager->ClearEFB(rc, color_enable, alpha_enable, z_enable, color, z);
AbstractGfx::ClearRegion(target_rc, color_enable, alpha_enable, z_enable, color, z);
}
void VKGfx::Flush()

View File

@ -53,7 +53,7 @@ public:
void WaitForGPUIdle() override;
void OnConfigChanged(u32 bits) override;
void ClearRegion(const MathUtil::Rectangle<int>& rc, const MathUtil::Rectangle<int>& target_rc,
void ClearRegion(const MathUtil::Rectangle<int>& target_rc,
bool color_enable, bool alpha_enable, bool z_enable, u32 color, u32 z) override;
void SetPipeline(const AbstractPipeline* pipeline) override;