diff options
| author | Scott Mansell <phiren@gmail.com> | 2023-02-09 19:59:16 +1300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-02-09 19:59:16 +1300 |
| commit | ccf92a3e56764d6378c436a8040519a5bffc3372 (patch) | |
| tree | e2b330b225044e1901e77a6ed147cf21b9d7ac0e /Source/Core/VideoBackends/Software/SWRenderer.cpp | |
| parent | 72b22ef0a54f841b1c52d49cf0e00d3b12c29ac7 (diff) | |
| parent | 5c1b3ac61d7e660a9d1c206dbd0e615d637d3272 (diff) | |
Merge pull request #11522 from phire/KillRendererWithFire
Kill Renderer (with phire)
Diffstat (limited to 'Source/Core/VideoBackends/Software/SWRenderer.cpp')
| -rw-r--r-- | Source/Core/VideoBackends/Software/SWRenderer.cpp | 127 |
1 files changed, 1 insertions, 126 deletions
diff --git a/Source/Core/VideoBackends/Software/SWRenderer.cpp b/Source/Core/VideoBackends/Software/SWRenderer.cpp index 5e75b57701..d537820c95 100644 --- a/Source/Core/VideoBackends/Software/SWRenderer.cpp +++ b/Source/Core/VideoBackends/Software/SWRenderer.cpp @@ -6,118 +6,18 @@ #include <string> #include "Common/CommonTypes.h" -#include "Common/GL/GLContext.h" +#include "Common/MsgHandler.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/VideoBackendBase.h" -#include "VideoCommon/VideoCommon.h" namespace SW { -SWRenderer::SWRenderer(std::unique_ptr<SWOGLWindow> window) - : ::Renderer(static_cast<int>(std::max(window->GetContext()->GetBackBufferWidth(), 1u)), - static_cast<int>(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<AbstractTexture> SWRenderer::CreateTexture(const TextureConfig& config, - [[maybe_unused]] std::string_view name) -{ - return std::make_unique<SWTexture>(config); -} - -std::unique_ptr<AbstractStagingTexture> -SWRenderer::CreateStagingTexture(StagingTextureType type, const TextureConfig& config) -{ - return std::make_unique<SWStagingTexture>(type, config); -} - -std::unique_ptr<AbstractFramebuffer> -SWRenderer::CreateFramebuffer(AbstractTexture* color_attachment, AbstractTexture* depth_attachment) -{ - return SWFramebuffer::Create(static_cast<SWTexture*>(color_attachment), - static_cast<SWTexture*>(depth_attachment)); -} - -void SWRenderer::BindBackbuffer(const ClearColor& clear_color) -{ - // Look for framebuffer resizes - if (!m_surface_resized.TestAndClear()) - return; - - GLContext* context = m_window->GetContext(); - context->Update(); - m_backbuffer_width = context->GetBackBufferWidth(); - m_backbuffer_height = context->GetBackBufferHeight(); -} - -class SWShader final : public AbstractShader -{ -public: - explicit SWShader(ShaderStage stage) : AbstractShader(stage) {} - ~SWShader() = default; - - BinaryData GetBinary() const override { return {}; } -}; - -std::unique_ptr<AbstractShader> -SWRenderer::CreateShaderFromSource(ShaderStage stage, [[maybe_unused]] std::string_view source, - [[maybe_unused]] std::string_view name) -{ - return std::make_unique<SWShader>(stage); -} - -std::unique_ptr<AbstractShader> -SWRenderer::CreateShaderFromBinary(ShaderStage stage, const void* data, size_t length, - [[maybe_unused]] std::string_view name) -{ - return std::make_unique<SWShader>(stage); -} - -class SWPipeline final : public AbstractPipeline -{ -public: - SWPipeline() = default; - ~SWPipeline() override = default; -}; - -std::unique_ptr<AbstractPipeline> SWRenderer::CreatePipeline(const AbstractPipelineConfig& config, - const void* cache_data, - size_t cache_data_length) -{ - return std::make_unique<SWPipeline>(); -} - -// Called on the GPU thread -void SWRenderer::RenderXFBToScreen(const MathUtil::Rectangle<int>& target_rc, - const AbstractTexture* source_texture, - const MathUtil::Rectangle<int>& 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; @@ -166,29 +66,4 @@ u32 SWRenderer::AccessEFB(EFBAccessType type, u32 x, u32 y, u32 InputData) return value; } -std::unique_ptr<BoundingBox> SWRenderer::CreateBoundingBox() const -{ - return std::make_unique<SWBoundingBox>(); -} - -void SWRenderer::ClearScreen(const MathUtil::Rectangle<int>& rc, bool colorEnable, bool alphaEnable, - bool zEnable, u32 color, u32 z) -{ - EfbCopy::ClearEfb(); -} - -std::unique_ptr<NativeVertexFormat> -SWRenderer::CreateNativeVertexFormat(const PortableVertexDeclaration& vtx_decl) -{ - return std::make_unique<NativeVertexFormat>(vtx_decl); -} - -void SWRenderer::SetScissorRect(const MathUtil::Rectangle<int>& 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 |
