2014-02-03 14:02:17 +01:00
|
|
|
// Copyright 2015 Dolphin Emulator Project
|
2021-07-05 03:22:19 +02:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2014-02-03 14:02:17 +01:00
|
|
|
|
2020-09-15 14:24:28 +02:00
|
|
|
#include "VideoBackends/Null/NullRender.h"
|
2014-02-03 14:02:17 +01:00
|
|
|
|
2021-06-09 13:42:21 +02:00
|
|
|
#include "VideoBackends/Null/NullBoundingBox.h"
|
2017-09-30 08:25:36 +02:00
|
|
|
#include "VideoBackends/Null/NullTexture.h"
|
2014-02-03 14:02:17 +01:00
|
|
|
|
2017-09-08 11:42:56 +02:00
|
|
|
#include "VideoCommon/AbstractPipeline.h"
|
|
|
|
#include "VideoCommon/AbstractShader.h"
|
2019-02-15 02:59:50 +01:00
|
|
|
#include "VideoCommon/NativeVertexFormat.h"
|
2014-02-03 14:02:17 +01:00
|
|
|
#include "VideoCommon/VideoConfig.h"
|
|
|
|
|
|
|
|
namespace Null
|
|
|
|
{
|
|
|
|
// Init functions
|
2019-01-18 15:35:00 +01:00
|
|
|
Renderer::Renderer() : ::Renderer(1, 1, 1.0f, AbstractTextureFormat::RGBA8)
|
2014-02-03 14:02:17 +01:00
|
|
|
{
|
|
|
|
UpdateActiveConfig();
|
|
|
|
}
|
|
|
|
|
|
|
|
Renderer::~Renderer()
|
|
|
|
{
|
|
|
|
UpdateActiveConfig();
|
|
|
|
}
|
|
|
|
|
2018-10-03 15:03:13 +02:00
|
|
|
bool Renderer::IsHeadless() const
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2021-08-28 07:30:05 +02:00
|
|
|
std::unique_ptr<AbstractTexture> Renderer::CreateTexture(const TextureConfig& config,
|
|
|
|
[[maybe_unused]] std::string_view name)
|
2017-09-30 08:25:36 +02:00
|
|
|
{
|
|
|
|
return std::make_unique<NullTexture>(config);
|
|
|
|
}
|
|
|
|
|
2017-10-21 16:49:40 +02:00
|
|
|
std::unique_ptr<AbstractStagingTexture> Renderer::CreateStagingTexture(StagingTextureType type,
|
|
|
|
const TextureConfig& config)
|
|
|
|
{
|
|
|
|
return std::make_unique<NullStagingTexture>(type, config);
|
|
|
|
}
|
|
|
|
|
2017-09-08 11:42:56 +02:00
|
|
|
class NullShader final : public AbstractShader
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
explicit NullShader(ShaderStage stage) : AbstractShader(stage) {}
|
|
|
|
};
|
|
|
|
|
2019-05-30 09:07:40 +02:00
|
|
|
std::unique_ptr<AbstractShader>
|
2021-08-28 07:30:05 +02:00
|
|
|
Renderer::CreateShaderFromSource(ShaderStage stage, [[maybe_unused]] std::string_view source,
|
|
|
|
[[maybe_unused]] std::string_view name)
|
2017-09-08 11:42:56 +02:00
|
|
|
{
|
|
|
|
return std::make_unique<NullShader>(stage);
|
|
|
|
}
|
|
|
|
|
2021-08-28 07:30:05 +02:00
|
|
|
std::unique_ptr<AbstractShader>
|
|
|
|
Renderer::CreateShaderFromBinary(ShaderStage stage, const void* data, size_t length,
|
|
|
|
[[maybe_unused]] std::string_view name)
|
2017-09-08 11:42:56 +02:00
|
|
|
{
|
|
|
|
return std::make_unique<NullShader>(stage);
|
|
|
|
}
|
|
|
|
|
|
|
|
class NullPipeline final : public AbstractPipeline
|
|
|
|
{
|
|
|
|
};
|
|
|
|
|
2019-04-15 13:55:26 +02:00
|
|
|
std::unique_ptr<AbstractPipeline> Renderer::CreatePipeline(const AbstractPipelineConfig& config,
|
|
|
|
const void* cache_data,
|
|
|
|
size_t cache_data_length)
|
2017-09-08 11:42:56 +02:00
|
|
|
{
|
|
|
|
return std::make_unique<NullPipeline>();
|
|
|
|
}
|
|
|
|
|
2019-02-15 02:59:50 +01:00
|
|
|
std::unique_ptr<AbstractFramebuffer> Renderer::CreateFramebuffer(AbstractTexture* color_attachment,
|
|
|
|
AbstractTexture* depth_attachment)
|
2018-01-21 11:22:45 +01:00
|
|
|
{
|
2019-02-15 02:59:50 +01:00
|
|
|
return NullFramebuffer::Create(static_cast<NullTexture*>(color_attachment),
|
|
|
|
static_cast<NullTexture*>(depth_attachment));
|
2018-01-21 11:22:45 +01:00
|
|
|
}
|
|
|
|
|
2019-02-15 02:59:50 +01:00
|
|
|
std::unique_ptr<NativeVertexFormat>
|
|
|
|
Renderer::CreateNativeVertexFormat(const PortableVertexDeclaration& vtx_decl)
|
2014-02-03 14:02:17 +01:00
|
|
|
{
|
2019-02-15 02:59:50 +01:00
|
|
|
return std::make_unique<NativeVertexFormat>(vtx_decl);
|
2014-02-03 14:02:17 +01:00
|
|
|
}
|
2021-06-09 13:42:21 +02:00
|
|
|
|
|
|
|
std::unique_ptr<BoundingBox> Renderer::CreateBoundingBox() const
|
|
|
|
{
|
|
|
|
return std::make_unique<NullBoundingBox>();
|
|
|
|
}
|
2014-02-03 14:02:17 +01:00
|
|
|
} // namespace Null
|