2014-02-03 13:02:17 +00:00
|
|
|
// Copyright 2015 Dolphin Emulator Project
|
|
|
|
// Licensed under GPLv2+
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
|
|
#include "Common/Logging/Log.h"
|
|
|
|
|
2017-09-30 06:25:36 +00:00
|
|
|
#include "VideoBackends/Null/NullTexture.h"
|
2014-02-03 13:02:17 +00:00
|
|
|
#include "VideoBackends/Null/Render.h"
|
|
|
|
|
2017-09-08 09:42:56 +00:00
|
|
|
#include "VideoCommon/AbstractPipeline.h"
|
|
|
|
#include "VideoCommon/AbstractShader.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) {}
|
|
|
|
~NullShader() = default;
|
|
|
|
|
|
|
|
bool HasBinary() const override { return false; }
|
|
|
|
BinaryData GetBinary() const override { return {}; }
|
|
|
|
};
|
|
|
|
|
|
|
|
std::unique_ptr<AbstractShader> Renderer::CreateShaderFromSource(ShaderStage stage,
|
|
|
|
const char* source, size_t length)
|
|
|
|
{
|
|
|
|
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
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
NullPipeline() : AbstractPipeline() {}
|
|
|
|
~NullPipeline() override = default;
|
|
|
|
};
|
|
|
|
|
|
|
|
std::unique_ptr<AbstractPipeline> Renderer::CreatePipeline(const AbstractPipelineConfig& config)
|
|
|
|
{
|
|
|
|
return std::make_unique<NullPipeline>();
|
|
|
|
}
|
|
|
|
|
2018-01-21 10:22:45 +00:00
|
|
|
std::unique_ptr<AbstractFramebuffer>
|
|
|
|
Renderer::CreateFramebuffer(const AbstractTexture* color_attachment,
|
|
|
|
const AbstractTexture* depth_attachment)
|
|
|
|
{
|
|
|
|
return NullFramebuffer::Create(static_cast<const NullTexture*>(color_attachment),
|
|
|
|
static_cast<const NullTexture*>(depth_attachment));
|
|
|
|
}
|
|
|
|
|
2014-02-03 13:02:17 +00:00
|
|
|
TargetRectangle Renderer::ConvertEFBRectangle(const EFBRectangle& rc)
|
|
|
|
{
|
|
|
|
TargetRectangle result;
|
|
|
|
result.left = rc.left;
|
|
|
|
result.top = rc.top;
|
|
|
|
result.right = rc.right;
|
|
|
|
result.bottom = rc.bottom;
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace Null
|