1 /* Copyright (C) 2022 Wildfire Games.
2 * This file is part of 0 A.D.
4 * 0 A.D. is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 2 of the License, or
7 * (at your option) any later version.
9 * 0 A.D. is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
18 #ifndef INCLUDED_RENDERER_BACKEND_DUMMY_DEVICE
19 #define INCLUDED_RENDERER_BACKEND_DUMMY_DEVICE
21 #include "renderer/backend/dummy/DeviceForward.h"
22 #include "renderer/backend/IDevice.h"
35 class CDeviceCommandContext
;
37 class CDevice
: public IDevice
43 Backend
GetBackend() const override
{ return Backend::DUMMY
; }
45 const std::string
& GetName() const override
{ return m_Name
; }
46 const std::string
& GetVersion() const override
{ return m_Version
; }
47 const std::string
& GetDriverInformation() const override
{ return m_DriverInformation
; }
48 const std::vector
<std::string
>& GetExtensions() const override
{ return m_Extensions
; }
50 void Report(const ScriptRequest
& rq
, JS::HandleValue settings
) override
;
52 std::unique_ptr
<IDeviceCommandContext
> CreateCommandContext() override
;
54 std::unique_ptr
<ITexture
> CreateTexture(
55 const char* name
, const ITexture::Type type
, const uint32_t usage
,
56 const Format format
, const uint32_t width
, const uint32_t height
,
57 const Sampler::Desc
& defaultSamplerDesc
, const uint32_t MIPLevelCount
, const uint32_t sampleCount
) override
;
59 std::unique_ptr
<ITexture
> CreateTexture2D(
60 const char* name
, const uint32_t usage
,
61 const Format format
, const uint32_t width
, const uint32_t height
,
62 const Sampler::Desc
& defaultSamplerDesc
, const uint32_t MIPLevelCount
= 1, const uint32_t sampleCount
= 1) override
;
64 std::unique_ptr
<IFramebuffer
> CreateFramebuffer(
65 const char* name
, SColorAttachment
* colorAttachment
,
66 SDepthStencilAttachment
* depthStencilAttachment
) override
;
68 std::unique_ptr
<IBuffer
> CreateBuffer(
69 const char* name
, const IBuffer::Type type
, const uint32_t size
, const bool dynamic
) override
;
71 std::unique_ptr
<IShaderProgram
> CreateShaderProgram(
72 const CStr
& name
, const CShaderDefines
& defines
) override
;
74 bool AcquireNextBackbuffer() override
;
76 IFramebuffer
* GetCurrentBackbuffer(
77 const AttachmentLoadOp
, const AttachmentStoreOp
,
78 const AttachmentLoadOp
, const AttachmentStoreOp
) override
;
80 void Present() override
;
82 void OnWindowResize(const uint32_t width
, const uint32_t height
) override
;
84 bool IsTextureFormatSupported(const Format format
) const override
;
86 bool IsFramebufferFormatSupported(const Format format
) const override
;
88 const Capabilities
& GetCapabilities() const override
{ return m_Capabilities
; }
93 std::string m_Version
;
94 std::string m_DriverInformation
;
95 std::vector
<std::string
> m_Extensions
;
97 std::unique_ptr
<IFramebuffer
> m_Backbuffer
;
99 Capabilities m_Capabilities
{};
104 } // namespace Backend
106 } // namespace Renderer
108 #endif // INCLUDED_RENDERER_BACKEND_DUMMY_DEVICE