LCOV - code coverage report
Current view: top level - source/renderer/backend/dummy - Device.h (source / functions) Hit Total Coverage
Test: 0 A.D. test coverage report Lines: 3 7 42.9 %
Date: 2023-01-19 00:18:29 Functions: 4 8 50.0 %

          Line data    Source code
       1             : /* Copyright (C) 2023 Wildfire Games.
       2             :  * This file is part of 0 A.D.
       3             :  *
       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.
       8             :  *
       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.
      13             :  *
      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/>.
      16             :  */
      17             : 
      18             : #ifndef INCLUDED_RENDERER_BACKEND_DUMMY_DEVICE
      19             : #define INCLUDED_RENDERER_BACKEND_DUMMY_DEVICE
      20             : 
      21             : #include "renderer/backend/dummy/DeviceForward.h"
      22             : #include "renderer/backend/IDevice.h"
      23             : 
      24             : #include <memory>
      25             : #include <string>
      26             : #include <vector>
      27             : 
      28             : class CShaderDefines;
      29             : 
      30             : namespace Renderer
      31             : {
      32             : 
      33             : namespace Backend
      34             : {
      35             : 
      36             : namespace Dummy
      37             : {
      38             : 
      39             : class CDeviceCommandContext;
      40             : 
      41          16 : class CDevice : public IDevice
      42             : {
      43             : public:
      44             :     CDevice();
      45             :     ~CDevice() override;
      46             : 
      47          12 :     Backend GetBackend() const override { return Backend::DUMMY; }
      48             : 
      49           0 :     const std::string& GetName() const override { return m_Name; }
      50           0 :     const std::string& GetVersion() const override { return m_Version; }
      51           0 :     const std::string& GetDriverInformation() const override { return m_DriverInformation; }
      52           0 :     const std::vector<std::string>& GetExtensions() const override { return m_Extensions; }
      53             : 
      54             :     void Report(const ScriptRequest& rq, JS::HandleValue settings) override;
      55             : 
      56             :     std::unique_ptr<IDeviceCommandContext> CreateCommandContext() override;
      57             : 
      58             :     std::unique_ptr<IGraphicsPipelineState> CreateGraphicsPipelineState(
      59             :         const SGraphicsPipelineStateDesc& pipelineStateDesc) override;
      60             : 
      61             :     std::unique_ptr<IVertexInputLayout> CreateVertexInputLayout(
      62             :         const PS::span<const SVertexAttributeFormat> attributes) override;
      63             : 
      64             :     std::unique_ptr<ITexture> CreateTexture(
      65             :         const char* name, const ITexture::Type type, const uint32_t usage,
      66             :         const Format format, const uint32_t width, const uint32_t height,
      67             :         const Sampler::Desc& defaultSamplerDesc, const uint32_t MIPLevelCount, const uint32_t sampleCount) override;
      68             : 
      69             :     std::unique_ptr<ITexture> CreateTexture2D(
      70             :         const char* name, const uint32_t usage,
      71             :         const Format format, const uint32_t width, const uint32_t height,
      72             :         const Sampler::Desc& defaultSamplerDesc, const uint32_t MIPLevelCount = 1, const uint32_t sampleCount = 1) override;
      73             : 
      74             :     std::unique_ptr<IFramebuffer> CreateFramebuffer(
      75             :         const char* name, SColorAttachment* colorAttachment,
      76             :         SDepthStencilAttachment* depthStencilAttachment) override;
      77             : 
      78             :     std::unique_ptr<IBuffer> CreateBuffer(
      79             :         const char* name, const IBuffer::Type type, const uint32_t size, const bool dynamic) override;
      80             : 
      81             :     std::unique_ptr<IShaderProgram> CreateShaderProgram(
      82             :         const CStr& name, const CShaderDefines& defines) override;
      83             : 
      84             :     bool AcquireNextBackbuffer() override;
      85             : 
      86             :     IFramebuffer* GetCurrentBackbuffer(
      87             :         const AttachmentLoadOp, const AttachmentStoreOp,
      88             :         const AttachmentLoadOp, const AttachmentStoreOp) override;
      89             : 
      90             :     void Present() override;
      91             : 
      92             :     void OnWindowResize(const uint32_t width, const uint32_t height) override;
      93             : 
      94             :     bool IsTextureFormatSupported(const Format format) const override;
      95             : 
      96             :     bool IsFramebufferFormatSupported(const Format format) const override;
      97             : 
      98             :     Format GetPreferredDepthStencilFormat(
      99             :         const uint32_t usage, const bool depth, const bool stencil) const override;
     100             : 
     101           6 :     const Capabilities& GetCapabilities() const override { return m_Capabilities; }
     102             : 
     103             : protected:
     104             : 
     105             :     std::string m_Name;
     106             :     std::string m_Version;
     107             :     std::string m_DriverInformation;
     108             :     std::vector<std::string> m_Extensions;
     109             : 
     110             :     std::unique_ptr<IFramebuffer> m_Backbuffer;
     111             : 
     112             :     Capabilities m_Capabilities{};
     113             : };
     114             : 
     115             : } // namespace Dummy
     116             : 
     117             : } // namespace Backend
     118             : 
     119             : } // namespace Renderer
     120             : 
     121             : #endif // INCLUDED_RENDERER_BACKEND_DUMMY_DEVICE

Generated by: LCOV version 1.13