LCOV - code coverage report
Current view: top level - source/renderer/backend - ISwapChain.h (source / functions) Hit Total Coverage
Test: 0 A.D. test coverage report Lines: 1 1 100.0 %
Date: 2026-12-03 01:19:39 Functions: 0 0 -

          Line data    Source code
       1             : /* Copyright (C) 2026 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_ISWAPCHAIN
      19             : #define INCLUDED_RENDERER_BACKEND_ISWAPCHAIN
      20             : 
      21             : #include "renderer/backend/IDeviceObject.h"
      22             : #include "renderer/backend/IFramebuffer.h"
      23             : 
      24             : #include <cstdint>
      25             : 
      26             : namespace Renderer
      27             : {
      28             : 
      29             : namespace Backend
      30             : {
      31             : 
      32          30 : class ISwapChain : public IDeviceObject<ISwapChain>
      33             : {
      34             : public:
      35             :     /**
      36             :      * @return True if we still can use the swapchain to present. A swapchain
      37             :      * can become invalid on window resize or some other system event.
      38             :      */
      39             :     virtual bool IsValid() const = 0;
      40             : 
      41             :     /**
      42             :      * Acquires a backbuffer for rendering a frame.
      43             :      *
      44             :      * @return True if it was successfully acquired and we can render to it.
      45             :      */
      46             :     virtual bool AcquireNextBackbuffer() = 0;
      47             : 
      48             :     /**
      49             :      * Returns a framebuffer for the current backbuffer with the required
      50             :      * attachment operations. It should not be called if the last
      51             :      * AcquireNextBackbuffer call returned false.
      52             :      *
      53             :      * It's guaranteed that for the same acquired backbuffer this function returns
      54             :      * a framebuffer with the same attachments and properties except load and
      55             :      * store operations.
      56             :      *
      57             :      * @return The last successfully acquired framebuffer that wasn't
      58             :      * presented.
      59             :      */
      60             :     virtual IFramebuffer* GetCurrentBackbuffer(
      61             :         const AttachmentLoadOp colorAttachmentLoadOp,
      62             :         const AttachmentStoreOp colorAttachmentStoreOp,
      63             :         const AttachmentLoadOp depthStencilAttachmentLoadOp,
      64             :         const AttachmentStoreOp depthStencilAttachmentStoreOp) = 0;
      65             : 
      66             :     /**
      67             :      * Presents the backbuffer to the swapchain queue to be flipped on a
      68             :      * screen. Should be called only if the last AcquireNextBackbuffer call
      69             :      * returned true.
      70             :      */
      71             :     virtual void Present() = 0;
      72             : };
      73             : 
      74             : } // namespace Backend
      75             : 
      76             : } // namespace Renderer
      77             : 
      78             : #endif // INCLUDED_RENDERER_BACKEND_ISWAPCHAIN

Generated by: LCOV version 1.16