candlewick 0.1.0
A renderer
Loading...
Searching...
No Matches
candlewick::Renderer Struct Reference

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

#include <candlewick/core/Renderer.h>

Public Member Functions

 Renderer (NoInitT)
 
 Renderer (Device &&device, Window &&window)
 Constructor without a depth format.
 
 Renderer (Device &&device, Window &&window, SDL_GPUTextureFormat suggested_depth_format)
 Constructor with a depth format. This will create a depth texture.
 
void createDepthTexture (SDL_GPUTextureFormat suggested_depth_format)
 Add a depth texture to the rendering context.
 
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 ()
 
SDL_GPUTextureFormat getSwapchainTextureFormat () const
 
bool hasDepthTexture () const
 Check if a depth texture was created.
 
SDL_GPUTextureFormat depthFormat () const
 
void destroy () noexcept
 
 ~Renderer () noexcept
 

Public Attributes

Device device
 
Window window
 
SDL_GPUTexture * swapchain
 
Texture depth_texture {NoInit}
 

Detailed Description

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

See also
Scene
Device
Mesh

Constructor & Destructor Documentation

◆ Renderer() [1/3]

candlewick::Renderer::Renderer ( NoInitT )
inline

◆ Renderer() [2/3]

candlewick::Renderer::Renderer ( Device && device,
Window && window )

Constructor without a depth format.

◆ Renderer() [3/3]

candlewick::Renderer::Renderer ( Device && device,
Window && window,
SDL_GPUTextureFormat suggested_depth_format )

Constructor with a depth format. This will create a depth texture.

◆ ~Renderer()

candlewick::Renderer::~Renderer ( )
inlinenoexcept

Member Function Documentation

◆ acquireCommandBuffer()

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

Acquire the command buffer, starting a frame.

◆ acquireSwapchain()

bool candlewick::Renderer::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").

◆ createDepthTexture()

void candlewick::Renderer::createDepthTexture ( SDL_GPUTextureFormat suggested_depth_format)

Add a depth texture to the rendering context.

See also
hasDepthTexture()

◆ depthFormat()

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

◆ destroy()

void candlewick::Renderer::destroy ( )
noexcept

◆ getSwapchainTextureFormat()

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

◆ hasDepthTexture()

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

Check if a depth texture was created.

◆ initialized()

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

◆ waitAndAcquireSwapchain()

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

Wait until swapchain is available, then acquire it.

See also
acquireSwapchain()

◆ waitForSwapchain()

bool candlewick::Renderer::waitForSwapchain ( )
inline

Member Data Documentation

◆ depth_texture

Texture candlewick::Renderer::depth_texture {NoInit}

◆ device

Device candlewick::Renderer::device

◆ swapchain

SDL_GPUTexture* candlewick::Renderer::swapchain

◆ window

Window candlewick::Renderer::window

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