Flint Engine
Modular C++20 2D game engine powered by SDL3
Loading...
Searching...
No Matches
Flint::GPUWindowCast Class Reference

Helper that extracts SDL GPU objects from an IWindow via dynamic_cast. More...

#include <flint/graphics/gpu/gpu-cast.h>

+ Collaboration diagram for Flint::GPUWindowCast:

Static Public Member Functions

static IGPUContext * getGPUContext (Flint::IWindow *window)
 Cast window to IGPUContext.
 
static SDL_GPUDevice * getDevice (Flint::IWindow *window)
 Return the SDL_GPUDevice from window.
 
static void setGPUDevice (Flint::IWindow *window, SDL_GPUDevice *device)
 Store device inside the GPU context of window.
 
static SDL_GPUCommandBuffer * getCommandBuffer (Flint::IWindow *window)
 Return the current frame's command buffer from window.
 
static SDL_GPURenderPass * getRenderPass (Flint::IWindow *window)
 Return the current frame's render pass from window.
 

Detailed Description

Helper that extracts SDL GPU objects from an IWindow via dynamic_cast.

IWindow implementations that also implement IGPUContext (e.g. SdlWindow) can be queried through these static helpers without including the concrete window type.

Definition at line 18 of file gpu-cast.h.

Member Function Documentation

◆ getCommandBuffer()

static SDL_GPUCommandBuffer * Flint::GPUWindowCast::getCommandBuffer ( Flint::IWindow * window)
inlinestatic

Return the current frame's command buffer from window.

Parameters
windowSource window.
Returns
The command buffer, or nullptr if unavailable.

Definition at line 74 of file gpu-cast.h.

◆ getDevice()

static SDL_GPUDevice * Flint::GPUWindowCast::getDevice ( Flint::IWindow * window)
inlinestatic

Return the SDL_GPUDevice from window.

Parameters
windowSource window.
Returns
The GPU device, or nullptr if unavailable.

Definition at line 50 of file gpu-cast.h.

◆ getGPUContext()

static IGPUContext * Flint::GPUWindowCast::getGPUContext ( Flint::IWindow * window)
inlinestatic

Cast window to IGPUContext.

Logs an error and returns nullptr if window is null or does not implement IGPUContext.

Parameters
windowThe window to cast.
Returns
Pointer to the IGPUContext interface, or nullptr on failure.

Definition at line 29 of file gpu-cast.h.

◆ getRenderPass()

static SDL_GPURenderPass * Flint::GPUWindowCast::getRenderPass ( Flint::IWindow * window)
inlinestatic

Return the current frame's render pass from window.

Parameters
windowSource window.
Returns
The render pass, or nullptr if unavailable.

Definition at line 85 of file gpu-cast.h.

◆ setGPUDevice()

static void Flint::GPUWindowCast::setGPUDevice ( Flint::IWindow * window,
SDL_GPUDevice * device )
inlinestatic

Store device inside the GPU context of window.

Parameters
windowTarget window.
deviceSDL_GPUDevice to store.

Definition at line 61 of file gpu-cast.h.


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