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