From c38c76abad039c3c0ccb3f7ebb891dc62560f8a3 Mon Sep 17 00:00:00 2001 From: Scott Mansell Date: Thu, 26 Jan 2023 19:06:39 +1300 Subject: Refactor to remove virtual from RenderXFBToScreen Slightly simplifies the upcoming refactor --- Source/Core/VideoBackends/Software/SWRenderer.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'Source/Core/VideoBackends/Software/SWRenderer.cpp') diff --git a/Source/Core/VideoBackends/Software/SWRenderer.cpp b/Source/Core/VideoBackends/Software/SWRenderer.cpp index 5e75b57701..5d233a9b87 100644 --- a/Source/Core/VideoBackends/Software/SWRenderer.cpp +++ b/Source/Core/VideoBackends/Software/SWRenderer.cpp @@ -110,9 +110,8 @@ std::unique_ptr SWRenderer::CreatePipeline(const AbstractPipel } // Called on the GPU thread -void SWRenderer::RenderXFBToScreen(const MathUtil::Rectangle& target_rc, - const AbstractTexture* source_texture, - const MathUtil::Rectangle& source_rc) +void SWRenderer::ShowImage(const AbstractTexture* source_texture, + const MathUtil::Rectangle& source_rc) { if (!IsHeadless()) m_window->ShowImage(source_texture, source_rc); -- cgit v1.2.3 From 0d4537d60f695e50379c1542d6c4b1e643e8a5a0 Mon Sep 17 00:00:00 2001 From: Scott Mansell Date: Fri, 27 Jan 2023 17:03:15 +1300 Subject: Move Presenting, Dumping and ImGui out of Renderer --- Source/Core/VideoBackends/Software/SWRenderer.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'Source/Core/VideoBackends/Software/SWRenderer.cpp') diff --git a/Source/Core/VideoBackends/Software/SWRenderer.cpp b/Source/Core/VideoBackends/Software/SWRenderer.cpp index 5d233a9b87..887bce177f 100644 --- a/Source/Core/VideoBackends/Software/SWRenderer.cpp +++ b/Source/Core/VideoBackends/Software/SWRenderer.cpp @@ -23,6 +23,7 @@ #include "VideoCommon/AbstractTexture.h" #include "VideoCommon/NativeVertexFormat.h" #include "VideoCommon/PixelEngine.h" +#include "VideoCommon/Present.h" #include "VideoCommon/VideoBackendBase.h" #include "VideoCommon/VideoCommon.h" @@ -63,13 +64,12 @@ SWRenderer::CreateFramebuffer(AbstractTexture* color_attachment, AbstractTexture void SWRenderer::BindBackbuffer(const ClearColor& clear_color) { // Look for framebuffer resizes - if (!m_surface_resized.TestAndClear()) + if (!g_presenter->SurfaceResizedTestAndClear()) return; GLContext* context = m_window->GetContext(); context->Update(); - m_backbuffer_width = context->GetBackBufferWidth(); - m_backbuffer_height = context->GetBackBufferHeight(); + g_presenter->SetBackbuffer(context->GetBackBufferWidth(), context->GetBackBufferHeight()); } class SWShader final : public AbstractShader -- cgit v1.2.3 From d37f83ffeba218c6ef94b78532aed50b1ebbc4a4 Mon Sep 17 00:00:00 2001 From: Scott Mansell Date: Fri, 27 Jan 2023 15:07:05 +1300 Subject: Implement AbstractGfx for Software & Null --- Source/Core/VideoBackends/Software/SWRenderer.cpp | 125 ---------------------- 1 file changed, 125 deletions(-) (limited to 'Source/Core/VideoBackends/Software/SWRenderer.cpp') diff --git a/Source/Core/VideoBackends/Software/SWRenderer.cpp b/Source/Core/VideoBackends/Software/SWRenderer.cpp index 887bce177f..7440fba1b3 100644 --- a/Source/Core/VideoBackends/Software/SWRenderer.cpp +++ b/Source/Core/VideoBackends/Software/SWRenderer.cpp @@ -6,117 +6,17 @@ #include #include "Common/CommonTypes.h" -#include "Common/GL/GLContext.h" #include "Core/HW/Memmap.h" #include "Core/System.h" -#include "VideoBackends/Software/EfbCopy.h" #include "VideoBackends/Software/EfbInterface.h" -#include "VideoBackends/Software/Rasterizer.h" -#include "VideoBackends/Software/SWBoundingBox.h" -#include "VideoBackends/Software/SWOGLWindow.h" -#include "VideoBackends/Software/SWTexture.h" -#include "VideoCommon/AbstractPipeline.h" -#include "VideoCommon/AbstractShader.h" -#include "VideoCommon/AbstractTexture.h" -#include "VideoCommon/NativeVertexFormat.h" #include "VideoCommon/PixelEngine.h" -#include "VideoCommon/Present.h" #include "VideoCommon/VideoBackendBase.h" -#include "VideoCommon/VideoCommon.h" namespace SW { -SWRenderer::SWRenderer(std::unique_ptr window) - : ::Renderer(static_cast(std::max(window->GetContext()->GetBackBufferWidth(), 1u)), - static_cast(std::max(window->GetContext()->GetBackBufferHeight(), 1u)), 1.0f, - AbstractTextureFormat::RGBA8), - m_window(std::move(window)) -{ -} - -bool SWRenderer::IsHeadless() const -{ - return m_window->IsHeadless(); -} - -std::unique_ptr SWRenderer::CreateTexture(const TextureConfig& config, - [[maybe_unused]] std::string_view name) -{ - return std::make_unique(config); -} - -std::unique_ptr -SWRenderer::CreateStagingTexture(StagingTextureType type, const TextureConfig& config) -{ - return std::make_unique(type, config); -} - -std::unique_ptr -SWRenderer::CreateFramebuffer(AbstractTexture* color_attachment, AbstractTexture* depth_attachment) -{ - return SWFramebuffer::Create(static_cast(color_attachment), - static_cast(depth_attachment)); -} - -void SWRenderer::BindBackbuffer(const ClearColor& clear_color) -{ - // Look for framebuffer resizes - if (!g_presenter->SurfaceResizedTestAndClear()) - return; - - GLContext* context = m_window->GetContext(); - context->Update(); - g_presenter->SetBackbuffer(context->GetBackBufferWidth(), context->GetBackBufferHeight()); -} - -class SWShader final : public AbstractShader -{ -public: - explicit SWShader(ShaderStage stage) : AbstractShader(stage) {} - ~SWShader() = default; - - BinaryData GetBinary() const override { return {}; } -}; - -std::unique_ptr -SWRenderer::CreateShaderFromSource(ShaderStage stage, [[maybe_unused]] std::string_view source, - [[maybe_unused]] std::string_view name) -{ - return std::make_unique(stage); -} - -std::unique_ptr -SWRenderer::CreateShaderFromBinary(ShaderStage stage, const void* data, size_t length, - [[maybe_unused]] std::string_view name) -{ - return std::make_unique(stage); -} - -class SWPipeline final : public AbstractPipeline -{ -public: - SWPipeline() = default; - ~SWPipeline() override = default; -}; - -std::unique_ptr SWRenderer::CreatePipeline(const AbstractPipelineConfig& config, - const void* cache_data, - size_t cache_data_length) -{ - return std::make_unique(); -} - -// Called on the GPU thread -void SWRenderer::ShowImage(const AbstractTexture* source_texture, - const MathUtil::Rectangle& source_rc) -{ - if (!IsHeadless()) - m_window->ShowImage(source_texture, source_rc); -} - u32 SWRenderer::AccessEFB(EFBAccessType type, u32 x, u32 y, u32 InputData) { u32 value = 0; @@ -165,29 +65,4 @@ u32 SWRenderer::AccessEFB(EFBAccessType type, u32 x, u32 y, u32 InputData) return value; } -std::unique_ptr SWRenderer::CreateBoundingBox() const -{ - return std::make_unique(); -} - -void SWRenderer::ClearScreen(const MathUtil::Rectangle& rc, bool colorEnable, bool alphaEnable, - bool zEnable, u32 color, u32 z) -{ - EfbCopy::ClearEfb(); -} - -std::unique_ptr -SWRenderer::CreateNativeVertexFormat(const PortableVertexDeclaration& vtx_decl) -{ - return std::make_unique(vtx_decl); -} - -void SWRenderer::SetScissorRect(const MathUtil::Rectangle& rc) -{ - // BPFunctions calls SetScissorRect with the "best" scissor rect whenever the viewport or scissor - // changes. However, the software renderer is actually able to use multiple scissor rects (which - // is necessary in a few renderering edge cases, such as with Major Minor's Majestic March). - // Thus, we use this as a signal to update the list of scissor rects, but ignore the parameter. - Rasterizer::ScissorChanged(); -} } // namespace SW -- cgit v1.2.3 From 9d125a6e432d3fe050097dd2a5b13b13ec26e180 Mon Sep 17 00:00:00 2001 From: Scott Mansell Date: Mon, 30 Jan 2023 05:06:25 +1300 Subject: Move ConfigChanged out of RenderBase There is this nice VideoConfig file that's perfect for it --- Source/Core/VideoBackends/Software/SWRenderer.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'Source/Core/VideoBackends/Software/SWRenderer.cpp') diff --git a/Source/Core/VideoBackends/Software/SWRenderer.cpp b/Source/Core/VideoBackends/Software/SWRenderer.cpp index 7440fba1b3..d537820c95 100644 --- a/Source/Core/VideoBackends/Software/SWRenderer.cpp +++ b/Source/Core/VideoBackends/Software/SWRenderer.cpp @@ -6,6 +6,7 @@ #include #include "Common/CommonTypes.h" +#include "Common/MsgHandler.h" #include "Core/HW/Memmap.h" #include "Core/System.h" -- cgit v1.2.3