candlewick 0.10.0
A tiny cross-platform renderer based on SDL3
Loading...
Searching...
No Matches
candlewick::RenderContext Struct Reference

The RenderContext class provides a rendering context for a graphical application. More...

#include <candlewick/core/RenderContext.h>

Public Member Functions

 RenderContext (NoInitT)
 
 RenderContext (Device &&device, Window &&window, SDL_GPUTextureFormat suggested_depth_format=SDL_GPU_TEXTUREFORMAT_INVALID)
 Constructor. The last argument (the depth texture format) is optional. By default, it is set to INVALID, and no depth texture is created.
 
 RenderContext (RenderContext &&) noexcept=default
 
RenderContextoperator= (RenderContext &&) noexcept=default
 
const TexturecolorTarget () const
 
const TexturedepthTarget () const
 
const TextureresolvedColorTarget () const
 
bool msaaEnabled () const
 
SDL_GPUSampleCount getMsaaSampleCount () const
 
void enableMSAA (SDL_GPUSampleCount samples)
 
void disableMSAA ()
 
bool initialized () const
 
CommandBuffer acquireCommandBuffer () const
 Acquire the command buffer, starting a frame.
 
bool waitAndAcquireSwapchain (CommandBuffer &command_buffer)
 Wait until swapchain is available, then acquire it.
 
bool acquireSwapchain (CommandBuffer &command_buffer)
 Acquire GPU swapchain.
 
bool waitForSwapchain ()
 Wait for the swapchain to be available.
 
void presentToSwapchain (CommandBuffer &command_buffer)
 Present the resolved texture to the swapchain. You must acquire the swapchain beforehand.
 
SDL_GPUTextureFormat getSwapchainTextureFormat () const
 
bool hasDepthTexture () const
 Check if a depth texture was created.
 
void setSwapchainParameters (SDL_GPUSwapchainComposition composition, SDL_GPUPresentMode present_mode)
 
SDL_GPUTextureFormat colorFormat () const
 
SDL_GPUTextureFormat depthFormat () const
 
void destroy () noexcept
 
 ~RenderContext () noexcept
 

Public Attributes

Device device
 
Window window
 

Detailed Description

The RenderContext class provides a rendering context for a graphical application.

See also
Scene
Device
Mesh

Constructor & Destructor Documentation

◆ RenderContext() [1/3]

candlewick::RenderContext::RenderContext ( NoInitT )
inline

◆ RenderContext() [2/3]

candlewick::RenderContext::RenderContext ( Device && device,
Window && window,
SDL_GPUTextureFormat suggested_depth_format = SDL_GPU_TEXTUREFORMAT_INVALID )

Constructor. The last argument (the depth texture format) is optional. By default, it is set to INVALID, and no depth texture is created.

◆ RenderContext() [3/3]

candlewick::RenderContext::RenderContext ( RenderContext && )
defaultnoexcept

◆ ~RenderContext()

candlewick::RenderContext::~RenderContext ( )
inlinenoexcept

Member Function Documentation

◆ acquireCommandBuffer()

CommandBuffer candlewick::RenderContext::acquireCommandBuffer ( ) const
inline

Acquire the command buffer, starting a frame.

◆ acquireSwapchain()

bool candlewick::RenderContext::acquireSwapchain ( CommandBuffer & command_buffer)

Acquire GPU swapchain.

Warning
This can only be called from the main thread (see SDL docs for the meaning of "main thread").

◆ colorFormat()

SDL_GPUTextureFormat candlewick::RenderContext::colorFormat ( ) const
inline

◆ colorTarget()

const Texture & candlewick::RenderContext::colorTarget ( ) const
inline

◆ depthFormat()

SDL_GPUTextureFormat candlewick::RenderContext::depthFormat ( ) const
inline

◆ depthTarget()

const Texture & candlewick::RenderContext::depthTarget ( ) const
inline

◆ destroy()

void candlewick::RenderContext::destroy ( )
noexcept

◆ disableMSAA()

void candlewick::RenderContext::disableMSAA ( )
inline

◆ enableMSAA()

void candlewick::RenderContext::enableMSAA ( SDL_GPUSampleCount samples)
inline

◆ getMsaaSampleCount()

SDL_GPUSampleCount candlewick::RenderContext::getMsaaSampleCount ( ) const
inline

◆ getSwapchainTextureFormat()

SDL_GPUTextureFormat candlewick::RenderContext::getSwapchainTextureFormat ( ) const
inline

◆ hasDepthTexture()

bool candlewick::RenderContext::hasDepthTexture ( ) const
inline

Check if a depth texture was created.

◆ initialized()

bool candlewick::RenderContext::initialized ( ) const
inline

◆ msaaEnabled()

bool candlewick::RenderContext::msaaEnabled ( ) const
inline

◆ operator=()

RenderContext & candlewick::RenderContext::operator= ( RenderContext && )
defaultnoexcept

◆ presentToSwapchain()

void candlewick::RenderContext::presentToSwapchain ( CommandBuffer & command_buffer)

Present the resolved texture to the swapchain. You must acquire the swapchain beforehand.

◆ resolvedColorTarget()

const Texture & candlewick::RenderContext::resolvedColorTarget ( ) const
inline

◆ setSwapchainParameters()

void candlewick::RenderContext::setSwapchainParameters ( SDL_GPUSwapchainComposition composition,
SDL_GPUPresentMode present_mode )
inline

◆ waitAndAcquireSwapchain()

bool candlewick::RenderContext::waitAndAcquireSwapchain ( CommandBuffer & command_buffer)

Wait until swapchain is available, then acquire it.

See also
acquireSwapchain()

◆ waitForSwapchain()

bool candlewick::RenderContext::waitForSwapchain ( )
inline

Wait for the swapchain to be available.

Member Data Documentation

◆ device

Device candlewick::RenderContext::device

◆ window

Window candlewick::RenderContext::window

The documentation for this struct was generated from the following file: