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