diff options
| author | Scott Mansell <phiren@gmail.com> | 2023-01-27 15:07:05 +1300 |
|---|---|---|
| committer | Scott Mansell <phiren@gmail.com> | 2023-01-31 19:41:23 +1300 |
| commit | d37f83ffeba218c6ef94b78532aed50b1ebbc4a4 (patch) | |
| tree | 0958778e5ee1693c70a9d66d02f6674e91202fb8 /Source/Core/VideoBackends/Null | |
| parent | f0336a3129ea431862e6e3bf1ccf51a384cf3f57 (diff) | |
Implement AbstractGfx for Software & Null
Diffstat (limited to 'Source/Core/VideoBackends/Null')
| -rw-r--r-- | Source/Core/VideoBackends/Null/CMakeLists.txt | 4 | ||||
| -rw-r--r-- | Source/Core/VideoBackends/Null/NullBackend.cpp | 24 | ||||
| -rw-r--r-- | Source/Core/VideoBackends/Null/NullGfx.cpp | 90 | ||||
| -rw-r--r-- | Source/Core/VideoBackends/Null/NullGfx.h (renamed from Source/Core/VideoBackends/Null/NullRender.h) | 25 | ||||
| -rw-r--r-- | Source/Core/VideoBackends/Null/NullRender.cpp | 92 |
5 files changed, 111 insertions, 124 deletions
diff --git a/Source/Core/VideoBackends/Null/CMakeLists.txt b/Source/Core/VideoBackends/Null/CMakeLists.txt index e95877323f..e8ad21bbe8 100644 --- a/Source/Core/VideoBackends/Null/CMakeLists.txt +++ b/Source/Core/VideoBackends/Null/CMakeLists.txt @@ -1,8 +1,8 @@ add_library(videonull NullBackend.cpp NullBoundingBox.h - NullRender.cpp - NullRender.h + NullGfx.cpp + NullGfx.h NullTexture.cpp NullTexture.h NullVertexManager.cpp diff --git a/Source/Core/VideoBackends/Null/NullBackend.cpp b/Source/Core/VideoBackends/Null/NullBackend.cpp index 80f8431ee7..b90363818e 100644 --- a/Source/Core/VideoBackends/Null/NullBackend.cpp +++ b/Source/Core/VideoBackends/Null/NullBackend.cpp @@ -11,12 +11,14 @@ #include "Common/Common.h" #include "Common/MsgHandler.h" -#include "VideoBackends/Null/NullRender.h" +#include "VideoBackends/Null/NullBoundingBox.h" +#include "VideoBackends/Null/NullGfx.h" #include "VideoBackends/Null/NullVertexManager.h" #include "VideoBackends/Null/PerfQuery.h" #include "VideoBackends/Null/TextureCache.h" #include "VideoCommon/FramebufferManager.h" +#include "VideoCommon/Present.h" #include "VideoCommon/VideoBackendBase.h" #include "VideoCommon/VideoCommon.h" #include "VideoCommon/VideoConfig.h" @@ -69,25 +71,13 @@ void VideoBackend::InitBackendInfo() bool VideoBackend::Initialize(const WindowSystemInfo& wsi) { - InitializeShared(); - - g_renderer = std::make_unique<Renderer>(); + g_gfx = std::make_unique<NullGfx>(); + g_renderer = std::make_unique<NullRenderer>(); + g_bounding_box = std::make_unique<NullBoundingBox>(); g_vertex_manager = std::make_unique<VertexManager>(); g_perf_query = std::make_unique<PerfQuery>(); - g_framebuffer_manager = std::make_unique<FramebufferManager>(); - g_texture_cache = std::make_unique<TextureCache>(); - g_shader_cache = std::make_unique<VideoCommon::ShaderCache>(); - if (!g_vertex_manager->Initialize() || !g_shader_cache->Initialize() || - !g_renderer->Initialize() || !g_framebuffer_manager->Initialize() || - !g_texture_cache->Initialize()) - { - PanicAlertFmt("Failed to initialize renderer classes"); - Shutdown(); - return false; - } - - g_shader_cache->InitializeShaderCache(); + InitializeShared(); return true; } diff --git a/Source/Core/VideoBackends/Null/NullGfx.cpp b/Source/Core/VideoBackends/Null/NullGfx.cpp new file mode 100644 index 0000000000..ce8da5ff06 --- /dev/null +++ b/Source/Core/VideoBackends/Null/NullGfx.cpp @@ -0,0 +1,90 @@ +// Copyright 2015 Dolphin Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "VideoBackends/Null/NullGfx.h" + +#include "VideoBackends/Null/NullBoundingBox.h" +#include "VideoBackends/Null/NullTexture.h" + +#include "VideoCommon/AbstractPipeline.h" +#include "VideoCommon/AbstractShader.h" +#include "VideoCommon/NativeVertexFormat.h" +#include "VideoCommon/VideoConfig.h" + +namespace Null +{ +// Init functions +NullGfx::NullGfx() +{ + UpdateActiveConfig(); +} + +NullGfx::~NullGfx() +{ + UpdateActiveConfig(); +} + +bool NullGfx::IsHeadless() const +{ + return true; +} + +std::unique_ptr<AbstractTexture> NullGfx::CreateTexture(const TextureConfig& config, + [[maybe_unused]] std::string_view name) +{ + return std::make_unique<NullTexture>(config); +} + +std::unique_ptr<AbstractStagingTexture> NullGfx::CreateStagingTexture(StagingTextureType type, + const TextureConfig& config) +{ + return std::make_unique<NullStagingTexture>(type, config); +} + +class NullShader final : public AbstractShader +{ +public: + explicit NullShader(ShaderStage stage) : AbstractShader(stage) {} +}; + +std::unique_ptr<AbstractShader> +NullGfx::CreateShaderFromSource(ShaderStage stage, [[maybe_unused]] std::string_view source, + [[maybe_unused]] std::string_view name) +{ + return std::make_unique<NullShader>(stage); +} + +std::unique_ptr<AbstractShader> +NullGfx::CreateShaderFromBinary(ShaderStage stage, const void* data, size_t length, + [[maybe_unused]] std::string_view name) +{ + return std::make_unique<NullShader>(stage); +} + +class NullPipeline final : public AbstractPipeline +{ +}; + +std::unique_ptr<AbstractPipeline> NullGfx::CreatePipeline(const AbstractPipelineConfig& config, + const void* cache_data, + size_t cache_data_length) +{ + return std::make_unique<NullPipeline>(); +} + +std::unique_ptr<AbstractFramebuffer> NullGfx::CreateFramebuffer(AbstractTexture* color_attachment, + AbstractTexture* depth_attachment) +{ + return NullFramebuffer::Create(static_cast<NullTexture*>(color_attachment), + static_cast<NullTexture*>(depth_attachment)); +} + +std::unique_ptr<NativeVertexFormat> +NullGfx::CreateNativeVertexFormat(const PortableVertexDeclaration& vtx_decl) +{ + return std::make_unique<NativeVertexFormat>(vtx_decl); +} + +NullRenderer::~NullRenderer() = default; + +} // namespace Null diff --git a/Source/Core/VideoBackends/Null/NullRender.h b/Source/Core/VideoBackends/Null/NullGfx.h index 061e78c61a..5afb3995b8 100644 --- a/Source/Core/VideoBackends/Null/NullRender.h +++ b/Source/Core/VideoBackends/Null/NullGfx.h @@ -3,17 +3,16 @@ #pragma once +#include "VideoCommon/AbstractGfx.h" #include "VideoCommon/RenderBase.h" -class BoundingBox; - namespace Null { -class Renderer final : public ::Renderer +class NullGfx final : public AbstractGfx { public: - Renderer(); - ~Renderer() override; + NullGfx(); + ~NullGfx() override; bool IsHeadless() const override; @@ -34,18 +33,18 @@ public: std::unique_ptr<AbstractPipeline> CreatePipeline(const AbstractPipelineConfig& config, const void* cache_data = nullptr, size_t cache_data_length = 0) override; +}; + +class NullRenderer final : public Renderer +{ +public: + NullRenderer() {} + ~NullRenderer() override; u32 AccessEFB(EFBAccessType type, u32 x, u32 y, u32 poke_data) override { return 0; } void PokeEFB(EFBAccessType type, const EfbPokeData* points, size_t num_points) override {} - void ClearScreen(const MathUtil::Rectangle<int>& rc, bool colorEnable, bool alphaEnable, - bool zEnable, u32 color, u32 z) override - { - } - void ReinterpretPixelData(EFBReinterpretType convtype) override {} - -protected: - std::unique_ptr<BoundingBox> CreateBoundingBox() const override; }; + } // namespace Null diff --git a/Source/Core/VideoBackends/Null/NullRender.cpp b/Source/Core/VideoBackends/Null/NullRender.cpp deleted file mode 100644 index e7b7a7907c..0000000000 --- a/Source/Core/VideoBackends/Null/NullRender.cpp +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright 2015 Dolphin Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#include "VideoBackends/Null/NullRender.h" - -#include "VideoBackends/Null/NullBoundingBox.h" -#include "VideoBackends/Null/NullTexture.h" - -#include "VideoCommon/AbstractPipeline.h" -#include "VideoCommon/AbstractShader.h" -#include "VideoCommon/NativeVertexFormat.h" -#include "VideoCommon/VideoConfig.h" - -namespace Null -{ -// Init functions -Renderer::Renderer() : ::Renderer(1, 1, 1.0f, AbstractTextureFormat::RGBA8) -{ - UpdateActiveConfig(); -} - -Renderer::~Renderer() -{ - UpdateActiveConfig(); -} - -bool Renderer::IsHeadless() const -{ - return true; -} - -std::unique_ptr<AbstractTexture> Renderer::CreateTexture(const TextureConfig& config, - [[maybe_unused]] std::string_view name) -{ - return std::make_unique<NullTexture>(config); -} - -std::unique_ptr<AbstractStagingTexture> Renderer::CreateStagingTexture(StagingTextureType type, - const TextureConfig& config) -{ - return std::make_unique<NullStagingTexture>(type, config); -} - -class NullShader final : public AbstractShader -{ -public: - explicit NullShader(ShaderStage stage) : AbstractShader(stage) {} -}; - -std::unique_ptr<AbstractShader> -Renderer::CreateShaderFromSource(ShaderStage stage, [[maybe_unused]] std::string_view source, - [[maybe_unused]] std::string_view name) -{ - return std::make_unique<NullShader>(stage); -} - -std::unique_ptr<AbstractShader> -Renderer::CreateShaderFromBinary(ShaderStage stage, const void* data, size_t length, - [[maybe_unused]] std::string_view name) -{ - return std::make_unique<NullShader>(stage); -} - -class NullPipeline final : public AbstractPipeline -{ -}; - -std::unique_ptr<AbstractPipeline> Renderer::CreatePipeline(const AbstractPipelineConfig& config, - const void* cache_data, - size_t cache_data_length) -{ - return std::make_unique<NullPipeline>(); -} - -std::unique_ptr<AbstractFramebuffer> Renderer::CreateFramebuffer(AbstractTexture* color_attachment, - AbstractTexture* depth_attachment) -{ - return NullFramebuffer::Create(static_cast<NullTexture*>(color_attachment), - static_cast<NullTexture*>(depth_attachment)); -} - -std::unique_ptr<NativeVertexFormat> -Renderer::CreateNativeVertexFormat(const PortableVertexDeclaration& vtx_decl) -{ - return std::make_unique<NativeVertexFormat>(vtx_decl); -} - -std::unique_ptr<BoundingBox> Renderer::CreateBoundingBox() const -{ - return std::make_unique<NullBoundingBox>(); -} -} // namespace Null |
