summaryrefslogtreecommitdiff
path: root/Source/Core/VideoBackends
diff options
context:
space:
mode:
authorStenzek <stenzek@gmail.com>2019-04-16 00:47:46 +1000
committerStenzek <stenzek@gmail.com>2019-04-21 14:28:14 +1000
commitf8c1ba409cdfc41e60d27b0fc002a8fd79f9c73e (patch)
treec3814adea3fb269649fd18e1afd3c8764be5c491 /Source/Core/VideoBackends
parent6ea43235d54a18b70529cb6d0d740e0f8f9c34ea (diff)
Replace EFBRectangle/TargetRectangle with MathUtil::Rectangle
Diffstat (limited to 'Source/Core/VideoBackends')
-rw-r--r--Source/Core/VideoBackends/D3D/Render.cpp2
-rw-r--r--Source/Core/VideoBackends/D3D/Render.h3
-rw-r--r--Source/Core/VideoBackends/D3D12/Renderer.cpp2
-rw-r--r--Source/Core/VideoBackends/D3D12/Renderer.h4
-rw-r--r--Source/Core/VideoBackends/Null/Render.h4
-rw-r--r--Source/Core/VideoBackends/Null/TextureCache.h14
-rw-r--r--Source/Core/VideoBackends/OGL/Render.cpp6
-rw-r--r--Source/Core/VideoBackends/OGL/Render.h7
-rw-r--r--Source/Core/VideoBackends/Software/EfbInterface.cpp9
-rw-r--r--Source/Core/VideoBackends/Software/EfbInterface.h4
-rw-r--r--Source/Core/VideoBackends/Software/SWOGLWindow.cpp3
-rw-r--r--Source/Core/VideoBackends/Software/SWOGLWindow.h2
-rw-r--r--Source/Core/VideoBackends/Software/SWRenderer.cpp5
-rw-r--r--Source/Core/VideoBackends/Software/SWRenderer.h7
-rw-r--r--Source/Core/VideoBackends/Software/TextureCache.h14
-rw-r--r--Source/Core/VideoBackends/Software/TextureEncoder.cpp7
-rw-r--r--Source/Core/VideoBackends/Software/TextureEncoder.h5
-rw-r--r--Source/Core/VideoBackends/Vulkan/Renderer.cpp4
-rw-r--r--Source/Core/VideoBackends/Vulkan/Renderer.h4
19 files changed, 59 insertions, 47 deletions
diff --git a/Source/Core/VideoBackends/D3D/Render.cpp b/Source/Core/VideoBackends/D3D/Render.cpp
index 9e6c20e314..fc417962a0 100644
--- a/Source/Core/VideoBackends/D3D/Render.cpp
+++ b/Source/Core/VideoBackends/D3D/Render.cpp
@@ -327,7 +327,7 @@ void Renderer::WaitForGPUIdle()
D3D::context->Flush();
}
-void Renderer::RenderXFBToScreen(const AbstractTexture* texture, const EFBRectangle& rc)
+void Renderer::RenderXFBToScreen(const AbstractTexture* texture, const MathUtil::Rectangle<int>& rc)
{
if (g_ActiveConfig.stereo_mode != StereoMode::Nvidia3DVision)
return ::Renderer::RenderXFBToScreen(texture, rc);
diff --git a/Source/Core/VideoBackends/D3D/Render.h b/Source/Core/VideoBackends/D3D/Render.h
index e6b658ae9e..277cd4f19f 100644
--- a/Source/Core/VideoBackends/D3D/Render.h
+++ b/Source/Core/VideoBackends/D3D/Render.h
@@ -67,7 +67,8 @@ public:
void Flush() override;
void WaitForGPUIdle() override;
- void RenderXFBToScreen(const AbstractTexture* texture, const EFBRectangle& rc) override;
+ void RenderXFBToScreen(const AbstractTexture* texture,
+ const MathUtil::Rectangle<int>& rc) override;
void OnConfigChanged(u32 bits) override;
private:
diff --git a/Source/Core/VideoBackends/D3D12/Renderer.cpp b/Source/Core/VideoBackends/D3D12/Renderer.cpp
index b834ba33e1..a61a3f40a6 100644
--- a/Source/Core/VideoBackends/D3D12/Renderer.cpp
+++ b/Source/Core/VideoBackends/D3D12/Renderer.cpp
@@ -132,7 +132,7 @@ void Renderer::WaitForGPUIdle()
ExecuteCommandList(true);
}
-void Renderer::ClearScreen(const EFBRectangle& rc, bool color_enable, bool alpha_enable,
+void Renderer::ClearScreen(const MathUtil::Rectangle<int>& 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.
diff --git a/Source/Core/VideoBackends/D3D12/Renderer.h b/Source/Core/VideoBackends/D3D12/Renderer.h
index 992e12aa8a..f660f5f817 100644
--- a/Source/Core/VideoBackends/D3D12/Renderer.h
+++ b/Source/Core/VideoBackends/D3D12/Renderer.h
@@ -52,8 +52,8 @@ public:
void Flush() override;
void WaitForGPUIdle() override;
- void ClearScreen(const EFBRectangle& rc, bool color_enable, bool alpha_enable, bool z_enable,
- u32 color, u32 z) override;
+ void ClearScreen(const MathUtil::Rectangle<int>& rc, bool color_enable, bool alpha_enable,
+ bool z_enable, u32 color, u32 z) override;
void SetPipeline(const AbstractPipeline* pipeline) override;
void SetFramebuffer(AbstractFramebuffer* framebuffer) override;
diff --git a/Source/Core/VideoBackends/Null/Render.h b/Source/Core/VideoBackends/Null/Render.h
index 339e21d637..4070db20fe 100644
--- a/Source/Core/VideoBackends/Null/Render.h
+++ b/Source/Core/VideoBackends/Null/Render.h
@@ -37,8 +37,8 @@ public:
u16 BBoxRead(int index) override { return 0; }
void BBoxWrite(int index, u16 value) override {}
- void ClearScreen(const EFBRectangle& rc, bool colorEnable, bool alphaEnable, bool zEnable,
- u32 color, u32 z) override
+ void ClearScreen(const MathUtil::Rectangle<int>& rc, bool colorEnable, bool alphaEnable,
+ bool zEnable, u32 color, u32 z) override
{
}
diff --git a/Source/Core/VideoBackends/Null/TextureCache.h b/Source/Core/VideoBackends/Null/TextureCache.h
index 91375430c9..35c802ce4b 100644
--- a/Source/Core/VideoBackends/Null/TextureCache.h
+++ b/Source/Core/VideoBackends/Null/TextureCache.h
@@ -21,15 +21,17 @@ public:
protected:
void CopyEFB(AbstractStagingTexture* dst, const EFBCopyParams& params, u32 native_width,
- u32 bytes_per_row, u32 num_blocks_y, u32 memory_stride, const EFBRectangle& src_rect,
- bool scale_by_half, bool linear_filter, float y_scale, float gamma, bool clamp_top,
- bool clamp_bottom, const EFBCopyFilterCoefficients& filter_coefficients) override
+ u32 bytes_per_row, u32 num_blocks_y, u32 memory_stride,
+ const MathUtil::Rectangle<int>& src_rect, bool scale_by_half, bool linear_filter,
+ float y_scale, float gamma, bool clamp_top, bool clamp_bottom,
+ const EFBCopyFilterCoefficients& filter_coefficients) override
{
}
- void CopyEFBToCacheEntry(TCacheEntry* entry, bool is_depth_copy, const EFBRectangle& src_rect,
- bool scale_by_half, bool linear_filter, EFBCopyFormat dst_format,
- bool is_intensity, float gamma, bool clamp_top, bool clamp_bottom,
+ void CopyEFBToCacheEntry(TCacheEntry* entry, bool is_depth_copy,
+ const MathUtil::Rectangle<int>& src_rect, bool scale_by_half,
+ bool linear_filter, EFBCopyFormat dst_format, bool is_intensity,
+ float gamma, bool clamp_top, bool clamp_bottom,
const EFBCopyFilterCoefficients& filter_coefficients) override
{
}
diff --git a/Source/Core/VideoBackends/OGL/Render.cpp b/Source/Core/VideoBackends/OGL/Render.cpp
index 1e263b6422..a357a8d2dc 100644
--- a/Source/Core/VideoBackends/OGL/Render.cpp
+++ b/Source/Core/VideoBackends/OGL/Render.cpp
@@ -932,8 +932,8 @@ void Renderer::DispatchComputeShader(const AbstractShader* shader, u32 groups_x,
glMemoryBarrier(GL_TEXTURE_UPDATE_BARRIER_BIT);
}
-void Renderer::ClearScreen(const EFBRectangle& rc, bool colorEnable, bool alphaEnable, bool zEnable,
- u32 color, u32 z)
+void Renderer::ClearScreen(const MathUtil::Rectangle<int>& rc, bool colorEnable, bool alphaEnable,
+ bool zEnable, u32 color, u32 z)
{
g_framebuffer_manager->FlushEFBPokes();
g_framebuffer_manager->FlagPeekCacheAsOutOfDate();
@@ -974,7 +974,7 @@ void Renderer::ClearScreen(const EFBRectangle& rc, bool colorEnable, bool alphaE
BPFunctions::SetScissor();
}
-void Renderer::RenderXFBToScreen(const AbstractTexture* texture, const EFBRectangle& rc)
+void Renderer::RenderXFBToScreen(const AbstractTexture* texture, const MathUtil::Rectangle<int>& rc)
{
// Quad-buffered stereo is annoying on GL.
if (g_ActiveConfig.stereo_mode != StereoMode::QuadBuffer)
diff --git a/Source/Core/VideoBackends/OGL/Render.h b/Source/Core/VideoBackends/OGL/Render.h
index 842a6d9570..1cd2aa2e2d 100644
--- a/Source/Core/VideoBackends/OGL/Render.h
+++ b/Source/Core/VideoBackends/OGL/Render.h
@@ -134,11 +134,12 @@ public:
void Flush() override;
void WaitForGPUIdle() override;
- void RenderXFBToScreen(const AbstractTexture* texture, const EFBRectangle& rc) override;
+ void RenderXFBToScreen(const AbstractTexture* texture,
+ const MathUtil::Rectangle<int>& rc) override;
void OnConfigChanged(u32 bits) override;
- void ClearScreen(const EFBRectangle& rc, bool colorEnable, bool alphaEnable, bool zEnable,
- u32 color, u32 z) override;
+ void ClearScreen(const MathUtil::Rectangle<int>& rc, bool colorEnable, bool alphaEnable,
+ bool zEnable, u32 color, u32 z) override;
std::unique_ptr<VideoCommon::AsyncShaderCompiler> CreateAsyncShaderCompiler() override;
diff --git a/Source/Core/VideoBackends/Software/EfbInterface.cpp b/Source/Core/VideoBackends/Software/EfbInterface.cpp
index bb3cfeda90..8eebb375d3 100644
--- a/Source/Core/VideoBackends/Software/EfbInterface.cpp
+++ b/Source/Core/VideoBackends/Software/EfbInterface.cpp
@@ -549,8 +549,8 @@ u8* GetPixelPointer(u16 x, u16 y, bool depth)
return &efb[GetColorOffset(x, y)];
}
-void EncodeXFB(u8* xfb_in_ram, u32 memory_stride, const EFBRectangle& source_rect, float y_scale,
- float gamma)
+void EncodeXFB(u8* xfb_in_ram, u32 memory_stride, const MathUtil::Rectangle<int>& source_rect,
+ float y_scale, float gamma)
{
if (!xfb_in_ram)
{
@@ -628,8 +628,9 @@ void EncodeXFB(u8* xfb_in_ram, u32 memory_stride, const EFBRectangle& source_rec
src_ptr += memory_stride;
}
- auto dest_rect = EFBRectangle{source_rect.left, source_rect.top, source_rect.right,
- static_cast<int>(static_cast<float>(source_rect.bottom) * y_scale)};
+ auto dest_rect =
+ MathUtil::Rectangle<int>{source_rect.left, source_rect.top, source_rect.right,
+ static_cast<int>(static_cast<float>(source_rect.bottom) * y_scale)};
const std::size_t destination_size = dest_rect.GetWidth() * dest_rect.GetHeight() * 2;
static std::vector<yuv422_packed> destination;
diff --git a/Source/Core/VideoBackends/Software/EfbInterface.h b/Source/Core/VideoBackends/Software/EfbInterface.h
index 518395d7c9..ea3bfc4bf9 100644
--- a/Source/Core/VideoBackends/Software/EfbInterface.h
+++ b/Source/Core/VideoBackends/Software/EfbInterface.h
@@ -54,8 +54,8 @@ u32 GetDepth(u16 x, u16 y);
u8* GetPixelPointer(u16 x, u16 y, bool depth);
-void EncodeXFB(u8* xfb_in_ram, u32 memory_stride, const EFBRectangle& source_rect, float y_scale,
- float gamma);
+void EncodeXFB(u8* xfb_in_ram, u32 memory_stride, const MathUtil::Rectangle<int>& source_rect,
+ float y_scale, float gamma);
u32 GetPerfQueryResult(PerfQueryType type);
void ResetPerfQuery();
diff --git a/Source/Core/VideoBackends/Software/SWOGLWindow.cpp b/Source/Core/VideoBackends/Software/SWOGLWindow.cpp
index 91c8cf0806..e0e0e236c0 100644
--- a/Source/Core/VideoBackends/Software/SWOGLWindow.cpp
+++ b/Source/Core/VideoBackends/Software/SWOGLWindow.cpp
@@ -84,7 +84,8 @@ bool SWOGLWindow::Initialize(const WindowSystemInfo& wsi)
return true;
}
-void SWOGLWindow::ShowImage(const AbstractTexture* image, const EFBRectangle& xfb_region)
+void SWOGLWindow::ShowImage(const AbstractTexture* image,
+ const MathUtil::Rectangle<int>& xfb_region)
{
const SW::SWTexture* sw_image = static_cast<const SW::SWTexture*>(image);
m_gl_context->Update(); // just updates the render window position and the backbuffer size
diff --git a/Source/Core/VideoBackends/Software/SWOGLWindow.h b/Source/Core/VideoBackends/Software/SWOGLWindow.h
index f1eadc4dd5..ce95c87694 100644
--- a/Source/Core/VideoBackends/Software/SWOGLWindow.h
+++ b/Source/Core/VideoBackends/Software/SWOGLWindow.h
@@ -25,7 +25,7 @@ public:
bool IsHeadless() const;
// Image to show, will be swapped immediately
- void ShowImage(const AbstractTexture* image, const EFBRectangle& xfb_region);
+ void ShowImage(const AbstractTexture* image, const MathUtil::Rectangle<int>& xfb_region);
static std::unique_ptr<SWOGLWindow> Create(const WindowSystemInfo& wsi);
diff --git a/Source/Core/VideoBackends/Software/SWRenderer.cpp b/Source/Core/VideoBackends/Software/SWRenderer.cpp
index 3893320c26..b63e530a03 100644
--- a/Source/Core/VideoBackends/Software/SWRenderer.cpp
+++ b/Source/Core/VideoBackends/Software/SWRenderer.cpp
@@ -94,7 +94,8 @@ std::unique_ptr<AbstractPipeline> SWRenderer::CreatePipeline(const AbstractPipel
}
// Called on the GPU thread
-void SWRenderer::RenderXFBToScreen(const AbstractTexture* texture, const EFBRectangle& xfb_region)
+void SWRenderer::RenderXFBToScreen(const AbstractTexture* texture,
+ const MathUtil::Rectangle<int>& xfb_region)
{
if (!IsHeadless())
m_window->ShowImage(texture, xfb_region);
@@ -136,7 +137,7 @@ void SWRenderer::BBoxWrite(int index, u16 value)
BoundingBox::coords[index] = value;
}
-void SWRenderer::ClearScreen(const EFBRectangle& rc, bool colorEnable, bool alphaEnable,
+void SWRenderer::ClearScreen(const MathUtil::Rectangle<int>& rc, bool colorEnable, bool alphaEnable,
bool zEnable, u32 color, u32 z)
{
EfbCopy::ClearEfb();
diff --git a/Source/Core/VideoBackends/Software/SWRenderer.h b/Source/Core/VideoBackends/Software/SWRenderer.h
index 21ebf2dea7..9e478b0f50 100644
--- a/Source/Core/VideoBackends/Software/SWRenderer.h
+++ b/Source/Core/VideoBackends/Software/SWRenderer.h
@@ -42,10 +42,11 @@ public:
u16 BBoxRead(int index) override;
void BBoxWrite(int index, u16 value) override;
- void RenderXFBToScreen(const AbstractTexture* texture, const EFBRectangle& rc) override;
+ void RenderXFBToScreen(const AbstractTexture* texture,
+ const MathUtil::Rectangle<int>& rc) override;
- void ClearScreen(const EFBRectangle& rc, bool colorEnable, bool alphaEnable, bool zEnable,
- u32 color, u32 z) override;
+ void ClearScreen(const MathUtil::Rectangle<int>& rc, bool colorEnable, bool alphaEnable,
+ bool zEnable, u32 color, u32 z) override;
void ReinterpretPixelData(EFBReinterpretType convtype) override {}
diff --git a/Source/Core/VideoBackends/Software/TextureCache.h b/Source/Core/VideoBackends/Software/TextureCache.h
index 62f9198dcc..9ffa8fa4f4 100644
--- a/Source/Core/VideoBackends/Software/TextureCache.h
+++ b/Source/Core/VideoBackends/Software/TextureCache.h
@@ -11,16 +11,18 @@ class TextureCache : public TextureCacheBase
{
protected:
void CopyEFB(AbstractStagingTexture* dst, const EFBCopyParams& params, u32 native_width,
- u32 bytes_per_row, u32 num_blocks_y, u32 memory_stride, const EFBRectangle& src_rect,
- bool scale_by_half, bool linear_filter, float y_scale, float gamma, bool clamp_top,
- bool clamp_bottom, const EFBCopyFilterCoefficients& filter_coefficients) override
+ u32 bytes_per_row, u32 num_blocks_y, u32 memory_stride,
+ const MathUtil::Rectangle<int>& src_rect, bool scale_by_half, bool linear_filter,
+ float y_scale, float gamma, bool clamp_top, bool clamp_bottom,
+ const EFBCopyFilterCoefficients& filter_coefficients) override
{
TextureEncoder::Encode(dst, params, native_width, bytes_per_row, num_blocks_y, memory_stride,
src_rect, scale_by_half, y_scale, gamma);
}
- void CopyEFBToCacheEntry(TCacheEntry* entry, bool is_depth_copy, const EFBRectangle& src_rect,
- bool scale_by_half, bool linear_filter, EFBCopyFormat dst_format,
- bool is_intensity, float gamma, bool clamp_top, bool clamp_bottom,
+ void CopyEFBToCacheEntry(TCacheEntry* entry, bool is_depth_copy,
+ const MathUtil::Rectangle<int>& src_rect, bool scale_by_half,
+ bool linear_filter, EFBCopyFormat dst_format, bool is_intensity,
+ float gamma, bool clamp_top, bool clamp_bottom,
const EFBCopyFilterCoefficients& filter_coefficients) override
{
// TODO: If we ever want to "fake" vram textures, we would need to implement this
diff --git a/Source/Core/VideoBackends/Software/TextureEncoder.cpp b/Source/Core/VideoBackends/Software/TextureEncoder.cpp
index 07eba31530..d3e76aa997 100644
--- a/Source/Core/VideoBackends/Software/TextureEncoder.cpp
+++ b/Source/Core/VideoBackends/Software/TextureEncoder.cpp
@@ -1422,7 +1422,7 @@ static void EncodeZ24halfscale(u8* dst, const u8* src, EFBCopyFormat format)
namespace
{
void EncodeEfbCopy(u8* dst, const EFBCopyParams& params, u32 native_width, u32 bytes_per_row,
- u32 num_blocks_y, u32 memory_stride, const EFBRectangle& src_rect,
+ u32 num_blocks_y, u32 memory_stride, const MathUtil::Rectangle<int>& src_rect,
bool scale_by_half)
{
const u8* src = EfbInterface::GetPixelPointer(src_rect.left, src_rect.top, params.depth);
@@ -1471,8 +1471,9 @@ void EncodeEfbCopy(u8* dst, const EFBCopyParams& params, u32 native_width, u32 b
}
void Encode(AbstractStagingTexture* dst, const EFBCopyParams& params, u32 native_width,
- u32 bytes_per_row, u32 num_blocks_y, u32 memory_stride, const EFBRectangle& src_rect,
- bool scale_by_half, float y_scale, float gamma)
+ u32 bytes_per_row, u32 num_blocks_y, u32 memory_stride,
+ const MathUtil::Rectangle<int>& src_rect, bool scale_by_half, float y_scale,
+ float gamma)
{
// HACK: Override the memory stride for this staging texture with new copy stride.
// This is required because the texture encoder assumes that we're writing directly to memory,
diff --git a/Source/Core/VideoBackends/Software/TextureEncoder.h b/Source/Core/VideoBackends/Software/TextureEncoder.h
index 705fa2e81b..a1e1f09cef 100644
--- a/Source/Core/VideoBackends/Software/TextureEncoder.h
+++ b/Source/Core/VideoBackends/Software/TextureEncoder.h
@@ -11,6 +11,7 @@
namespace TextureEncoder
{
void Encode(AbstractStagingTexture* dst, const EFBCopyParams& params, u32 native_width,
- u32 bytes_per_row, u32 num_blocks_y, u32 memory_stride, const EFBRectangle& src_rect,
- bool scale_by_half, float y_scale, float gamma);
+ u32 bytes_per_row, u32 num_blocks_y, u32 memory_stride,
+ const MathUtil::Rectangle<int>& src_rect, bool scale_by_half, float y_scale,
+ float gamma);
}
diff --git a/Source/Core/VideoBackends/Vulkan/Renderer.cpp b/Source/Core/VideoBackends/Vulkan/Renderer.cpp
index 5d918eda96..8d702adb45 100644
--- a/Source/Core/VideoBackends/Vulkan/Renderer.cpp
+++ b/Source/Core/VideoBackends/Vulkan/Renderer.cpp
@@ -147,14 +147,14 @@ void Renderer::BBoxFlush()
m_bounding_box->Invalidate();
}
-void Renderer::ClearScreen(const EFBRectangle& rc, bool color_enable, bool alpha_enable,
+void Renderer::ClearScreen(const MathUtil::Rectangle<int>& rc, bool color_enable, bool alpha_enable,
bool z_enable, u32 color, u32 z)
{
g_framebuffer_manager->FlushEFBPokes();
g_framebuffer_manager->FlagPeekCacheAsOutOfDate();
// Native -> EFB coordinates
- TargetRectangle target_rc = Renderer::ConvertEFBRectangle(rc);
+ MathUtil::Rectangle<int> target_rc = Renderer::ConvertEFBRectangle(rc);
// Size we pass this size to vkBeginRenderPass, it has to be clamped to the framebuffer
// dimensions. The other backends just silently ignore this case.
diff --git a/Source/Core/VideoBackends/Vulkan/Renderer.h b/Source/Core/VideoBackends/Vulkan/Renderer.h
index f28b4f94c1..bcc416af88 100644
--- a/Source/Core/VideoBackends/Vulkan/Renderer.h
+++ b/Source/Core/VideoBackends/Vulkan/Renderer.h
@@ -62,8 +62,8 @@ public:
void WaitForGPUIdle() override;
void OnConfigChanged(u32 bits) override;
- void ClearScreen(const EFBRectangle& rc, bool color_enable, bool alpha_enable, bool z_enable,
- u32 color, u32 z) override;
+ void ClearScreen(const MathUtil::Rectangle<int>& rc, bool color_enable, bool alpha_enable,
+ bool z_enable, u32 color, u32 z) override;
void SetPipeline(const AbstractPipeline* pipeline) override;
void SetFramebuffer(AbstractFramebuffer* framebuffer) override;