Ream v0.1.0-1
C++ graphics library for Linux
Loading...
Searching...
No Matches
Public Member Functions | List of all members
RRSSwapchainWL Class Reference

Raster (software) implementation of RWLSwapchain. More...

#include <RRSSwapchainWL.h>

+ Inheritance diagram for RRSSwapchainWL:

Public Member Functions

 ~RRSSwapchainWL () noexcept
 Destroys the swapchain and its shared-memory buffers.
 
std::optional< const RSwapchainImageacquire () noexcept override
 Acquires the next available buffer. Implements RSwapchain::acquire().
 
bool present (const RSwapchainImage &image, SkRegion *damage=nullptr) noexcept override
 Attaches, damages and commits the image to the Wayland surface. Implements RSwapchain::present().
 
bool resize (SkISize size) noexcept override
 Sets the size used for future acquired buffers. Implements RSwapchain::resize().
 
- Public Member Functions inherited from RWLSwapchain
wl_surface * surface () const noexcept
 Returns the Wayland surface this swapchain presents to.
 
- Public Member Functions inherited from RSwapchain
 RSwapchain (SkISize size) noexcept
 Construct a swapchain with the given image size.
 
SkISize size () const noexcept
 The size of swapchain images in pixels.
 
- Public Member Functions inherited from RObject
 RObject ()=default
 Constructs a default RObject.
 

Additional Inherited Members

- Static Public Member Functions inherited from RWLSwapchain
static std::shared_ptr< RWLSwapchainMake (wl_surface *surface, SkISize size) noexcept
 Creates a Wayland swapchain for the given surface.
 

Detailed Description

Raster (software) implementation of RWLSwapchain.

RRSSwapchainWL presents CPU-rendered frames to a Wayland wl_surface using shared-memory (wl_shm) buffers. Each swapchain image is an RRSImage whose backing memory is exported to the compositor as a wl_buffer through a wl_shm_pool.

Buffers are recycled based on compositor release events: acquire() reuses the least recently used released buffer (resizing it if needed) or allocates a new one, and surplus buffers are freed once enough frames have elapsed. Only one image may be acquired at a time.

Constructor & Destructor Documentation

◆ ~RRSSwapchainWL()

~RRSSwapchainWL ( )
noexcept

Destroys the swapchain and its shared-memory buffers.

Member Function Documentation

◆ acquire()

std::optional< const RSwapchainImage > acquire ( )
overridevirtualnoexcept

Acquires the next available buffer. Implements RSwapchain::acquire().

Returns
The acquired swapchain image, or nullopt if an image is already acquired or allocation fails.

Implements RSwapchain.

◆ present()

bool present ( const RSwapchainImage image,
SkRegion *  damage = nullptr 
)
overridevirtualnoexcept

Attaches, damages and commits the image to the Wayland surface. Implements RSwapchain::present().

If damage is null (or the surface is too old for buffer damage) the whole surface is marked damaged; otherwise only the given rects are damaged.

Implements RSwapchain.

◆ resize()

bool resize ( SkISize  size)
overridevirtualnoexcept

Sets the size used for future acquired buffers. Implements RSwapchain::resize().

Returns
false if size is empty, true otherwise.

Implements RSwapchain.