summaryrefslogtreecommitdiff
path: root/Source/Core/VideoBackends/Null/NullGfx.cpp
diff options
context:
space:
mode:
authorScott Mansell <phiren@gmail.com>2023-02-09 19:59:16 +1300
committerGitHub <noreply@github.com>2023-02-09 19:59:16 +1300
commitccf92a3e56764d6378c436a8040519a5bffc3372 (patch)
treee2b330b225044e1901e77a6ed147cf21b9d7ac0e /Source/Core/VideoBackends/Null/NullGfx.cpp
parent72b22ef0a54f841b1c52d49cf0e00d3b12c29ac7 (diff)
parent5c1b3ac61d7e660a9d1c206dbd0e615d637d3272 (diff)
Merge pull request #11522 from phire/KillRendererWithFire
Kill Renderer (with phire)
Diffstat (limited to 'Source/Core/VideoBackends/Null/NullGfx.cpp')
-rw-r--r--Source/Core/VideoBackends/Null/NullGfx.cpp95
1 files changed, 95 insertions, 0 deletions
diff --git a/Source/Core/VideoBackends/Null/NullGfx.cpp b/Source/Core/VideoBackends/Null/NullGfx.cpp
new file mode 100644
index 0000000000..7449aae09c
--- /dev/null
+++ b/Source/Core/VideoBackends/Null/NullGfx.cpp
@@ -0,0 +1,95 @@
+// 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;
+}
+
+bool NullGfx::SupportsUtilityDrawing() const
+{
+ return false;
+}
+
+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