SDL3pp
A slim C++ wrapper for SDL3
Loading...
Searching...
No Matches
SDL::GPUDevice Struct Reference

An opaque handle representing the SDL_GPU context. More...

Inheritance diagram for SDL::GPUDevice:
[legend]

Public Member Functions

constexpr GPUDevice (GPUDeviceRaw resource) noexcept
 Constructs from raw GPUDevice.
constexpr GPUDevice (const GPUDevice &other)=delete
 Copy constructor.
constexpr GPUDevice (GPUDevice &&other) noexcept
 Move constructor.
constexpr GPUDevice (const GPUDeviceRef &other)=delete
constexpr GPUDevice (GPUDeviceRef &&other)=delete
 GPUDevice (GPUShaderFormat format_flags, bool debug_mode, StringParam name)
 Creates a GPU context.
 GPUDevice (PropertiesRef props)
 Creates a GPU context.
 ~GPUDevice ()
 Destructor.
constexpr GPUDeviceoperator= (GPUDevice &&other) noexcept
 Assignment operator.
GPUDeviceoperator= (const GPUDevice &other)=delete
 Assignment operator.
void Destroy ()
 Destroys a GPU context previously returned by CreateGPUDevice.
const char * GetDriver ()
 Returns the name of the backend used to create this GPU context.
GPUShaderFormat GetShaderFormats ()
 Returns the supported shader formats for this GPU context.
PropertiesRef GetProperties ()
 Get the properties associated with a GPU device.
GPUComputePipeline CreateComputePipeline (const GPUComputePipelineCreateInfo &createinfo)
 Creates a pipeline object to be used in a compute workflow.
GPUGraphicsPipeline CreateGraphicsPipeline (const GPUGraphicsPipelineCreateInfo &createinfo)
 Creates a pipeline object to be used in a graphics workflow.
GPUSampler CreateSampler (const GPUSamplerCreateInfo &createinfo)
 Creates a sampler object to be used when binding textures in a graphics workflow.
GPUShader CreateShader (const GPUShaderCreateInfo &createinfo)
 Creates a shader to be used when creating a graphics pipeline.
GPUTexture CreateTexture (const GPUTextureCreateInfo &createinfo)
 Creates a texture object to be used in graphics or compute workflows.
GPUBuffer CreateBuffer (const GPUBufferCreateInfo &createinfo)
 Creates a buffer object to be used in graphics or compute workflows.
GPUTransferBuffer CreateTransferBuffer (const GPUTransferBufferCreateInfo &createinfo)
 Creates a transfer buffer to be used when uploading to or downloading from graphics resources.
void SetBufferName (GPUBuffer buffer, StringParam text)
 Sets an arbitrary string constant to label a buffer.
void SetTextureName (GPUTexture texture, StringParam text)
 Sets an arbitrary string constant to label a texture.
void ReleaseTexture (GPUTexture texture)
 Frees the given texture as soon as it is safe to do so.
void ReleaseSampler (GPUSampler sampler)
 Frees the given sampler as soon as it is safe to do so.
void ReleaseBuffer (GPUBuffer buffer)
 Frees the given buffer as soon as it is safe to do so.
void ReleaseTransferBuffer (GPUTransferBuffer transfer_buffer)
 Frees the given transfer buffer as soon as it is safe to do so.
void ReleaseComputePipeline (GPUComputePipeline compute_pipeline)
 Frees the given compute pipeline as soon as it is safe to do so.
void ReleaseShader (GPUShader shader)
 Frees the given shader as soon as it is safe to do so.
void ReleaseGraphicsPipeline (GPUGraphicsPipeline graphics_pipeline)
 Frees the given graphics pipeline as soon as it is safe to do so.
GPUCommandBuffer AcquireCommandBuffer ()
 Acquire a command buffer.
void * MapTransferBuffer (GPUTransferBuffer transfer_buffer, bool cycle)
 Maps a transfer buffer into application address space.
void UnmapTransferBuffer (GPUTransferBuffer transfer_buffer)
 Unmaps a previously mapped transfer buffer.
bool WindowSupportsSwapchainComposition (WindowRef window, GPUSwapchainComposition swapchain_composition)
 Determines whether a swapchain composition is supported by the window.
bool WindowSupportsPresentMode (WindowRef window, GPUPresentMode present_mode)
 Determines whether a presentation mode is supported by the window.
void ClaimWindow (WindowRef window)
 Claims a window, creating a swapchain structure for it.
void ReleaseWindow (WindowRef window)
 Unclaims a window, destroying its swapchain structure.
bool SetSwapchainParameters (WindowRef window, GPUSwapchainComposition swapchain_composition, GPUPresentMode present_mode)
 Changes the swapchain parameters for the given claimed window.
bool SetAllowedFramesInFlight (Uint32 allowed_frames_in_flight)
 Configures the maximum allowed number of frames in flight.
GPUTextureFormat GetSwapchainTextureFormat (WindowRef window)
 Obtains the texture format of the swapchain for the given window.
void WaitForSwapchain (WindowRef window)
 Blocks the thread until a swapchain texture is available to be acquired.
void WaitForIdle ()
 Blocks the thread until the GPU is completely idle.
void WaitForFences (bool wait_all, std::span< GPUFence *const > fences)
 Blocks the thread until the given fences are signaled.
bool QueryFence (GPUFence *fence)
 Checks the status of a fence.
void ReleaseFence (GPUFence *fence)
 Releases a fence obtained from GPUCommandBuffer.SubmitAndAcquireFence.
bool TextureSupportsFormat (GPUTextureFormat format, GPUTextureType type, GPUTextureUsageFlags usage)
 Determines whether a texture format is supported for a given type and usage.
bool TextureSupportsSampleCount (GPUTextureFormat format, GPUSampleCount sample_count)
 Determines if a sample count for a texture format is supported.
void GDKSuspendGPU ()
 Call this to suspend GPU operation on Xbox when you receive the EVENT_DID_ENTER_BACKGROUND event.
void GDKResumeGPU ()
 Call this to resume GPU operation on Xbox when you receive the EVENT_WILL_ENTER_FOREGROUND event.
constexpr ResourceBase (RawPointer resource)
 Constructs from resource pointer.
constexpr ResourceBase (std::nullptr_t=nullptr)
 Constructs null/invalid.
Public Member Functions inherited from SDL::ResourceBase< GPUDeviceRaw >
constexpr ResourceBase (RawPointer resource)
 Constructs from resource pointer.
constexpr operator bool () const
 Converts to bool.
constexpr auto operator<=> (const ResourceBase &other) const=default
 Comparison.
constexpr RawConstPointer operator-> () const noexcept
 member access to underlying resource pointer.
constexpr RawPointer get () const noexcept
 Retrieves underlying resource pointer.
constexpr RawPointer release () noexcept
 Retrieves underlying resource pointer and clear this.

Additional Inherited Members

Public Types inherited from SDL::ResourceBase< GPUDeviceRaw >
using RawPointer
 The underlying raw pointer type.
using RawConstPointer
 The underlying const raw pointer type.

Detailed Description

An opaque handle representing the SDL_GPU context.

Since
This struct is available since SDL 3.2.0.
Category:
Resource

Constructor & Destructor Documentation

◆ GPUDevice()

SDL::GPUDevice::GPUDevice ( GPUDeviceRaw resource)
inlineexplicitconstexprnoexcept

Constructs from raw GPUDevice.

Parameters
resourcea GPUDeviceRaw to be wrapped.

This assumes the ownership, call release() if you need to take back.


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