| 1 | // Copyright 2015 Dolphin Emulator Project |
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later |
| 3 | |
| 4 | #include "VideoBackends/Null/NullGfx.h" |
| 5 | |
| 6 | #include "VideoBackends/Null/NullTexture.h" |
| 7 | |
| 8 | #include "VideoCommon/AbstractPipeline.h" |
| 9 | #include "VideoCommon/AbstractShader.h" |
| 10 | #include "VideoCommon/NativeVertexFormat.h" |
| 11 | #include "VideoCommon/VideoConfig.h" |
| 12 | |
| 13 | namespace Null |
| 14 | { |
| 15 | // Init functions |
| 16 | NullGfx::NullGfx() |
| 17 | { |
| 18 | UpdateActiveConfig(); |
| 19 | } |
| 20 | |
| 21 | NullGfx::~NullGfx() |
| 22 | { |
| 23 | UpdateActiveConfig(); |
| 24 | } |
| 25 | |
| 26 | bool NullGfx::IsHeadless() const |
| 27 | { |
| 28 | return true; |
| 29 | } |
| 30 | |
| 31 | bool NullGfx::SupportsUtilityDrawing() const |
| 32 | { |
| 33 | return false; |
| 34 | } |
| 35 | |
| 36 | std::unique_ptr<AbstractTexture> NullGfx::CreateTexture(const TextureConfig& config, |
| 37 | std::string_view /* name */) |
| 38 | { |
| 39 | return std::make_unique<NullTexture>(config); |
| 40 | } |
| 41 | |
| 42 | std::unique_ptr<AbstractStagingTexture> NullGfx::CreateStagingTexture(StagingTextureType type, |
| 43 | const TextureConfig& config) |
| 44 | { |
| 45 | return std::make_unique<NullStagingTexture>(type, config); |
| 46 | } |
| 47 | |
| 48 | class NullShader final : public AbstractShader |
| 49 | { |
| 50 | public: |
| 51 | explicit NullShader(ShaderStage stage) : AbstractShader(stage) {} |
| 52 | }; |
| 53 | |
| 54 | std::unique_ptr<AbstractShader> |
| 55 | NullGfx::CreateShaderFromSource(ShaderStage stage, std::string_view /* source */, |
| 56 | VideoCommon::ShaderIncluder* /* shader_includer */, |
| 57 | std::string_view /* name */) |
| 58 | { |
| 59 | return std::make_unique<NullShader>(stage); |
| 60 | } |
| 61 | |
| 62 | std::unique_ptr<AbstractShader> NullGfx::CreateShaderFromBinary(ShaderStage stage, |
| 63 | const void* /* data */, |
| 64 | size_t /* length */, |
| 65 | std::string_view /* name */) |
| 66 | { |
| 67 | return std::make_unique<NullShader>(stage); |
| 68 | } |
| 69 | |
| 70 | class NullPipeline final : public AbstractPipeline |
| 71 | { |
| 72 | }; |
| 73 | |
| 74 | std::unique_ptr<AbstractPipeline> NullGfx::CreatePipeline(const AbstractPipelineConfig& config, |
| 75 | const void* cache_data, |
| 76 | size_t cache_data_length) |
| 77 | { |
| 78 | return std::make_unique<NullPipeline>(); |
| 79 | } |
| 80 | |
| 81 | std::unique_ptr<AbstractFramebuffer> |
| 82 | NullGfx::CreateFramebuffer(AbstractTexture* color_attachment, AbstractTexture* depth_attachment, |
| 83 | std::vector<AbstractTexture*> additional_color_attachments) |
| 84 | { |
| 85 | return NullFramebuffer::Create(static_cast<NullTexture*>(color_attachment), |
| 86 | static_cast<NullTexture*>(depth_attachment), |
| 87 | std::move(additional_color_attachments)); |
| 88 | } |
| 89 | |
| 90 | std::unique_ptr<NativeVertexFormat> |
| 91 | NullGfx::CreateNativeVertexFormat(const PortableVertexDeclaration& vtx_decl) |
| 92 | { |
| 93 | return std::make_unique<NativeVertexFormat>(vtx_decl); |
| 94 | } |
| 95 | |
| 96 | void NullEFBInterface::ReinterpretPixelData(EFBReinterpretType convtype) |
| 97 | { |
| 98 | } |
| 99 | |
| 100 | void NullEFBInterface::PokeColor(u16 x, u16 y, u32 color) |
| 101 | { |
| 102 | } |
| 103 | |
| 104 | void NullEFBInterface::PokeDepth(u16 x, u16 y, u32 depth) |
| 105 | { |
| 106 | } |
| 107 | |
| 108 | u32 NullEFBInterface::PeekColorInternal(u16 x, u16 y) |
| 109 | { |
| 110 | return 0; |
| 111 | } |
| 112 | |
| 113 | u32 NullEFBInterface::PeekDepthInternal(u16 x, u16 y) |
| 114 | { |
| 115 | return 0; |
| 116 | } |
| 117 | |
| 118 | } // namespace Null |