|
ObjectivelyGPU
Object oriented graphics framework for SDL3 and C
|
The RenderDevice encapsulates an SDL_GPUDevice and provides methods for allocating GPU resources, managing compute, copy and render passes, and .
More...
#include <RenderDevice.h>
Public Member Functions | |
| CommandBuffer * | acquireCommandBuffer (const RenderDevice *self) |
| Acquires a new CommandBuffer for recording GPU commands this frame. | |
| CommandBuffer * | beginFrame (RenderDevice *self) |
| Begins a frame: acquires a command buffer and the swapchain, and prepares the framebuffer. | |
| Fence * | endFrameAndFence (RenderDevice *self) |
Ends the frame begun by beginFrame, as endFrame, but returns a Fence. | |
| void | endFrame (RenderDevice *self) |
Ends the frame begun by beginFrame: presents the framebuffer and submits. | |
| Buffer * | createBuffer (RenderDevice *self, const SDL_GPUBufferCreateInfo *info) |
| Creates a Buffer (vertex, index, indirect, storage, etc.). | |
| Buffer * | createBufferWithConstMem (RenderDevice *self, SDL_GPUBufferUsageFlags usage, const void *mem, Uint32 size) |
Creates a Buffer and uploads mem in a single call. | |
| Buffer * | createBufferWithData (RenderDevice *self, SDL_GPUBufferUsageFlags usage, const Data *data) |
Creates a Buffer and uploads the contents of an Objectively Data object. | |
| ComputePipeline * | createComputePipeline (RenderDevice *self, const SDL_GPUComputePipelineCreateInfo *info) |
| Creates a ComputePipeline from a compiled compute shader. | |
| Framebuffer * | createFramebuffer (RenderDevice *self, const GPU_FramebufferCreateInfo *info) |
| Creates a Framebuffer aggregating color/depth attachments (and an MSAA resolve target). | |
| GraphicsPipeline * | createGraphicsPipeline (RenderDevice *self, const SDL_GPUGraphicsPipelineCreateInfo *info) |
| Creates a GraphicsPipeline from vertex and fragment shaders plus render state. | |
| QueryPool * | createQueryPool (RenderDevice *self, const SDL_GPUQueryPoolCreateInfo *info) |
| Creates a QueryPool for occlusion or timestamp queries. | |
| Sampler * | createSampler (RenderDevice *self, const SDL_GPUSamplerCreateInfo *info) |
| Creates a Sampler describing filter and address modes. | |
| Sampler * | createSamplerLinearRepeat (RenderDevice *self) |
| Creates a trilinear, wrapping Sampler – the common preset for tiled surface textures. | |
| Sampler * | createSamplerLinearClamp (RenderDevice *self) |
| Creates a trilinear, edge-clamped Sampler – the common preset for continuously-sampled volumes and non-tiling images (ambient/voxel volumes, cubemaps, post-process targets, UI images). | |
| Sampler * | createSamplerNearestClamp (RenderDevice *self) |
| Creates a point-filtered, edge-clamped Sampler – the common preset for data textures fetched by integer coordinate (voxel light data, depth-attachment copies) rather than sampled for appearance. | |
| Sampler * | createSamplerShadowCompare (RenderDevice *self) |
| Creates a hardware-PCF comparison Sampler for shadow map sampling. | |
| Shader * | createShader (RenderDevice *self, const SDL_GPUShaderCreateInfo *info) |
Creates a Shader from a fully-filled SDL_GPUShaderCreateInfo. | |
| Texture * | createTexture (RenderDevice *self, const SDL_GPUTextureCreateInfo *info, const void *pixels) |
| Creates a Texture, optionally uploading initial pixel data. | |
| TransferBuffer * | createTransferBuffer (RenderDevice *self, const SDL_GPUTransferBufferCreateInfo *info) |
| Creates a CPU-accessible transfer buffer for staging data to or from the GPU. | |
| Texture * | createTextureFromSurface (RenderDevice *self, SDL_Surface *surface, SDL_GPUTextureUsageFlags usage, bool generateMipmaps) |
Creates a Texture from an SDL_Surface, uploading pixel data immediately. | |
| Texture * | createSolidColorTexture (RenderDevice *self, SDL_GPUTextureType type, Uint32 layerCount, Uint32 rgba) |
| Creates a small, solid-color Texture – the common "placeholder" pattern for a sampler slot a shader declares but a given draw never actually reads. | |
| SDL_GPUTextureFormat | getSwapchainTextureFormat (const RenderDevice *self) |
| Returns the pixel format of this device's swapchain. | |
| RenderDevice * | init (RenderDevice *self) |
Initialises a RenderDevice, creating an SDL_GPUDevice with no window claimed. | |
| RenderDevice * | initWithWindow (RenderDevice *self, SDL_Window *window) |
Initialises a RenderDevice and immediately claims window for rendering. | |
| Shader * | loadShader (RenderDevice *self, const char *name, const SDL_GPUShaderCreateInfo *info) |
| Loads a shader blob via the Resource system and creates a Shader. | |
| ComputePipeline * | loadComputePipeline (RenderDevice *self, const char *name, const SDL_GPUComputePipelineCreateInfo *info) |
| Loads a compiled compute shader blob via the Resource system and creates a ComputePipeline. | |
| GraphicsPipeline * | loadGraphicsPipeline (RenderDevice *self, const char *vertexShaderName, const SDL_GPUShaderCreateInfo *vertexShaderInfo, const char *fragmentShaderName, const SDL_GPUShaderCreateInfo *fragmentShaderInfo, SDL_GPUGraphicsPipelineCreateInfo *info) |
| Loads a vertex/fragment shader pair and creates a GraphicsPipeline from them. | |
| bool | setAllowedFramesInFlight (const RenderDevice *self, Uint32 allowed) |
| Sets the maximum number of GPU frames that may be in flight concurrently. | |
| void | setFramebuffer (RenderDevice *self, Framebuffer *framebuffer) |
Sets the present-target Framebuffer driven by beginFrame/endFrame. | |
| bool | setSwapchainParameters (const RenderDevice *self, SDL_Window *window, SDL_GPUSwapchainComposition composition, SDL_GPUPresentMode mode) |
| void | setWindow (RenderDevice *self, SDL_Window *window) |
Claims window for this device, releasing any previously claimed window. | |
| bool | supportsPresentMode (const RenderDevice *self, SDL_GPUPresentMode mode) |
| Queries whether this device's swapchain supports the given present mode. | |
| bool | supportsSwapchainComposition (const RenderDevice *self, SDL_GPUSwapchainComposition composition) |
| Queries whether this device's swapchain supports the given composition (colour space / HDR mode). | |
| bool | textureSupportsFormat (const RenderDevice *self, SDL_GPUTextureFormat format, SDL_GPUTextureType type, SDL_GPUTextureUsageFlags usage) |
| Queries whether a texture format is supported for a given type and usage. | |
| bool | textureSupportsSampleCount (const RenderDevice *self, SDL_GPUTextureFormat format, SDL_GPUSampleCount sample_count) |
| Queries whether a texture format supports a given MSAA sample count. | |
| bool | waitForIdle (const RenderDevice *self) |
| Blocks until the GPU has finished all submitted work. | |
| bool | waitForSwapchain (const RenderDevice *self) |
| Blocks until this device's swapchain is available for the next frame. | |
| Class * | _RenderDevice (void) |
| The RenderDevice archetype. | |
| bool | setSwapchainParameters (const RenderDevice *self, SDL_GPUSwapchainComposition composition, SDL_GPUPresentMode mode) |
| Configures swapchain composition and present mode for this device's window. | |
Data Fields | |
| Object | object |
| The superclass. | |
| SDL_GPUDevice * | device |
The SDL_GPUDevice. | |
| SDL_Window * | window |
The SDL_Window associated with device. | |
| SDL_GPUShaderFormat | shaderFormats |
| float | maxAnisotropy |
The anisotropic filtering level applied by createSamplerLinearRepeat and createSamplerLinearClamp. Defaults to 0 (anisotropic filtering disabled). Assign directly; only affects Samplers created afterward, since SDL_gpu Samplers are immutable once created. | |
| Framebuffer * | framebuffer |
The present-target Framebuffer driven by beginFrame/endFrame, or NULL. | |
| ident | data |
| User data. | |
Protected Attributes | |
| RenderDeviceInterface * | interface |
| The interface. | |
The RenderDevice encapsulates an SDL_GPUDevice and provides methods for allocating GPU resources, managing compute, copy and render passes, and .
| Class * _RenderDevice | ( | void | ) |
The RenderDevice archetype.
| CommandBuffer * acquireCommandBuffer | ( | const RenderDevice * | self | ) |
Acquires a new CommandBuffer for recording GPU commands this frame.
Wraps SDL_AcquireGPUCommandBuffer. The returned CommandBuffer is owned by the caller and must be submitted via submit or submitAndFence and then released with release.
| self | The RenderDevice. |
| CommandBuffer * beginFrame | ( | RenderDevice * | self | ) |
Begins a frame: acquires a command buffer and the swapchain, and prepares the framebuffer.
Convenience over the manual acquire→wait-swapchain→resize boilerplate. Acquires a CommandBuffer, blocks for the swapchain texture, resizes the framebuffer set via setFramebuffer to the swapchain dimensions, and returns the command buffer so the caller can record passes into framebuffer. Returns NULL when the swapchain is unavailable (e.g. the window is minimised); the command buffer is cancelled and the frame should be skipped. Pair every non-NULL return with endFrame. The returned CommandBuffer is owned by the device; do not release it. Applications that render directly to the swapchain can ignore beginFrame/endFrame and drive the command buffer themselves.
| self | The RenderDevice. |
NULL to skip the frame. | Buffer * createBuffer | ( | RenderDevice * | self, |
| const SDL_GPUBufferCreateInfo * | info | ||
| ) |
Creates a Buffer (vertex, index, indirect, storage, etc.).
Convenience factory for Buffer::initWithDevice. The buffer's contents are uninitialised; use Buffer::upload to populate it.
| self | The RenderDevice. |
| info | Buffer creation parameters (usage flags, size). |
release. | Buffer * createBufferWithConstMem | ( | RenderDevice * | self, |
| SDL_GPUBufferUsageFlags | usage, | ||
| const void * | mem, | ||
| Uint32 | size | ||
| ) |
Creates a Buffer and uploads mem in a single call.
Convenience factory for Buffer::initWithConstMem. The returned buffer is immediately GPU-resident.
| self | The RenderDevice. |
| usage | Buffer usage flags (e.g. SDL_GPU_BUFFERUSAGE_VERTEX). |
| mem | CPU pointer to the source data. Must not be NULL. |
| size | Number of bytes to allocate and upload. |
mem. GPU_Asserts on failure. Free with release. | Buffer * createBufferWithData | ( | RenderDevice * | self, |
| SDL_GPUBufferUsageFlags | usage, | ||
| const Data * | data | ||
| ) |
Creates a Buffer and uploads the contents of an Objectively Data object.
Convenience factory for Buffer::initWithData, for data loaded via the Objectively Resource system.
| self | The RenderDevice. |
| usage | Buffer usage flags (e.g. SDL_GPU_BUFFERUSAGE_VERTEX). |
| data | Source data object. Must not be NULL. |
data. GPU_Asserts on failure. Free with release. | ComputePipeline * createComputePipeline | ( | RenderDevice * | self, |
| const SDL_GPUComputePipelineCreateInfo * | info | ||
| ) |
Creates a ComputePipeline from a compiled compute shader.
Convenience factory for ComputePipeline::initWithDevice. Prefer loadComputePipeline to load a compiled blob from the Resource system.
| self | The RenderDevice. |
| info | Compute pipeline creation parameters, including the shader. |
release. | Framebuffer * createFramebuffer | ( | RenderDevice * | self, |
| const GPU_FramebufferCreateInfo * | info | ||
| ) |
Creates a Framebuffer aggregating color/depth attachments (and an MSAA resolve target).
Convenience factory for Framebuffer::initWithDevice. Pair with setFramebuffer to drive it via beginFrame/endFrame.
| self | The RenderDevice. |
| info | Framebuffer creation parameters (size, formats, sample count). |
release. | GraphicsPipeline * createGraphicsPipeline | ( | RenderDevice * | self, |
| const SDL_GPUGraphicsPipelineCreateInfo * | info | ||
| ) |
Creates a GraphicsPipeline from vertex and fragment shaders plus render state.
Convenience factory for GraphicsPipeline::initWithDevice.
| self | The RenderDevice. |
| info | Graphics pipeline creation parameters (shaders, vertex layout, blend state, rasteriser state, depth/stencil state, colour target formats). |
release. | QueryPool * createQueryPool | ( | RenderDevice * | self, |
| const SDL_GPUQueryPoolCreateInfo * | info | ||
| ) |
Creates a QueryPool for occlusion or timestamp queries.
Convenience factory for QueryPool::initWithDevice. Always succeeds, even when occlusion queries are unsupported by the linked SDL3 – see QueryPool.
| self | The RenderDevice. |
| info | Query pool creation parameters (query type, query count). |
release. | Sampler * createSampler | ( | RenderDevice * | self, |
| const SDL_GPUSamplerCreateInfo * | info | ||
| ) |
Creates a Sampler describing filter and address modes.
Convenience factory for Sampler::initWithDevice. For the common filtering presets below, prefer createSamplerLinearRepeat et al.
| self | The RenderDevice. |
| info | Sampler creation parameters (min/mag filter, mip mode, address modes, anisotropy, etc.). |
release. | Sampler * createSamplerLinearClamp | ( | RenderDevice * | self | ) |
Creates a trilinear, edge-clamped Sampler – the common preset for continuously-sampled volumes and non-tiling images (ambient/voxel volumes, cubemaps, post-process targets, UI images).
Linear min/mag filter, linear mipmap mode, CLAMP_TO_EDGE addressing on all three axes. Anisotropic filtering is enabled when self->maxAnisotropy is greater than 0.
| self | The RenderDevice. |
release. | Sampler * createSamplerLinearRepeat | ( | RenderDevice * | self | ) |
Creates a trilinear, wrapping Sampler – the common preset for tiled surface textures.
Linear min/mag filter, linear mipmap mode, REPEAT addressing on all three axes. Anisotropic filtering is enabled when self->maxAnisotropy is greater than 0.
| self | The RenderDevice. |
release. | Sampler * createSamplerNearestClamp | ( | RenderDevice * | self | ) |
Creates a point-filtered, edge-clamped Sampler – the common preset for data textures fetched by integer coordinate (voxel light data, depth-attachment copies) rather than sampled for appearance.
Nearest min/mag filter, nearest mipmap mode, CLAMP_TO_EDGE addressing on all three axes.
| self | The RenderDevice. |
release. | Sampler * createSamplerShadowCompare | ( | RenderDevice * | self | ) |
Creates a hardware-PCF comparison Sampler for shadow map sampling.
Linear min/mag filter, nearest mipmap mode, CLAMP_TO_EDGE addressing, depth comparison enabled with SDL_GPU_COMPAREOP_LESS_OR_EQUAL.
| self | The RenderDevice. |
release. | Shader * createShader | ( | RenderDevice * | self, |
| const SDL_GPUShaderCreateInfo * | info | ||
| ) |
Creates a Shader from a fully-filled SDL_GPUShaderCreateInfo.
Convenience factory for Shader::initWithDevice. All fields of info, including code, code_size, and format, must be set by the caller. Prefer loadShader to load compiled blobs from the Resource system with automatic format selection.
| self | The RenderDevice. |
| info | Shader creation parameters with all fields populated. |
release. | Texture * createSolidColorTexture | ( | RenderDevice * | self, |
| SDL_GPUTextureType | type, | ||
| Uint32 | layerCount, | ||
| Uint32 | rgba | ||
| ) |
Creates a small, solid-color Texture – the common "placeholder" pattern for a sampler slot a shader declares but a given draw never actually reads.
type may be SDL_GPU_TEXTURETYPE_2D (layerCount ignored, treated as 1) or SDL_GPU_TEXTURETYPE_CUBE (layerCount must be 6); every texel of every layer is filled with rgba. Always 1x1 per layer/face, SDL_GPU_TEXTUREFORMAT_R8G8B8A8_UNORM, one mip level, SAMPLER usage only.
| self | The RenderDevice. |
| type | SDL_GPU_TEXTURETYPE_2D or SDL_GPU_TEXTURETYPE_CUBE. |
| layerCount | The layer/face count (6 for _CUBE, otherwise ignored). |
| rgba | The fill color, packed as 0xAABBGGRR (i.e. red in the lowest byte). |
release. | Texture * createTexture | ( | RenderDevice * | self, |
| const SDL_GPUTextureCreateInfo * | info, | ||
| const void * | pixels | ||
| ) |
Creates a Texture, optionally uploading initial pixel data.
Convenience factory for Texture::initWithDevice. When pixels is non-NULL, the pixel data is uploaded immediately so the texture is GPU-resident before returning.
| self | The RenderDevice. |
| info | Texture creation parameters (format, type, dimensions, usage, etc.). |
| pixels | Initial pixel data to upload, or NULL to leave the texture uninitialised. |
release. | Texture * createTextureFromSurface | ( | RenderDevice * | self, |
| SDL_Surface * | surface, | ||
| SDL_GPUTextureUsageFlags | usage, | ||
| bool | generateMipmaps | ||
| ) |
Creates a Texture from an SDL_Surface, uploading pixel data immediately.
Convenience factory for Texture::initWithSurface. Converts surface to SDL_PIXELFORMAT_RGBA32 if needed and uploads it as SDL_GPU_TEXTUREFORMAT_R8G8B8A8_UNORM. The surface is not modified or freed.
| self | The RenderDevice. |
| surface | The source surface. Must not be NULL. |
| usage | Texture usage flags (e.g. SDL_GPU_TEXTUREUSAGE_SAMPLER). |
| mipmaps | If true, a full mip chain is allocated and generated; see Texture::initWithSurface. |
release. | TransferBuffer * createTransferBuffer | ( | RenderDevice * | self, |
| const SDL_GPUTransferBufferCreateInfo * | info | ||
| ) |
Creates a CPU-accessible transfer buffer for staging data to or from the GPU.
| self | The RenderDevice. |
| info | Transfer buffer creation parameters (usage: upload or download, size). |
release. | void endFrame | ( | RenderDevice * | self | ) |
Ends the frame begun by beginFrame: presents the framebuffer and submits.
Blits the framebuffer's resolved color (Framebuffer::resolveColorTexture, the resolve target when multisampled) into the acquired swapchain texture, submits the frame's command buffer, and releases it. Must be paired with a non-NULL beginFrame return.
| self | The RenderDevice. |
| Fence * endFrameAndFence | ( | RenderDevice * | self | ) |
Ends the frame begun by beginFrame, as endFrame, but returns a Fence.
Identical to endFrame, except the frame's command buffer is submitted via CommandBuffer::submitAndFence, so callers may track when the frame's GPU work has completed, e.g. to safely read back data written during the frame. The returned Fence is retained; release it when no longer needed.
| self | The RenderDevice. |
NULL on error. | SDL_GPUTextureFormat getSwapchainTextureFormat | ( | const RenderDevice * | self | ) |
Returns the pixel format of this device's swapchain.
Useful for configuring render-pass colour target formats or creating pipelines that write to the swapchain. The device must have a window claimed.
| self | The RenderDevice. |
SDL_GPUTextureFormat of the window's swapchain. | RenderDevice * init | ( | RenderDevice * | self | ) |
Initialises a RenderDevice, creating an SDL_GPUDevice with no window claimed.
Creates the device supporting MSL, SPIR-V, and DXIL shader formats. Use setWindow or initWithWindow to associate a window after init.
| self | The RenderDevice. |
NULL on failure. | RenderDevice * initWithWindow | ( | RenderDevice * | self, |
| SDL_Window * | window | ||
| ) |
Initialises a RenderDevice and immediately claims window for rendering.
| self | The RenderDevice. |
| window | The SDL_Window to claim for this device. |
NULL on failure. | ComputePipeline * loadComputePipeline | ( | RenderDevice * | self, |
| const char * | name, | ||
| const SDL_GPUComputePipelineCreateInfo * | info | ||
| ) |
Loads a compiled compute shader blob via the Resource system and creates a ComputePipeline.
Parallel to loadShader for compute stages. Appends each supported format's extension to name and resolves it via Objectively's ResourceProvider chain:
.metallib, then .metal.spv.dxil The caller fills in entrypoint, thread counts, and binding counts in info. code, code_size, format, and a default entrypoint are filled in for you, then the completed info is passed to ComputePipeline::initWithDevice. Shader blobs are produced offline by sdl-shadercross. | self | The RenderDevice. |
| name | Shader base name without extension, e.g. "HelloCompute.comp". |
| info | Compute pipeline creation parameters. code, code_size, and format are ignored; all other fields must be set by the caller. |
release. | GraphicsPipeline * loadGraphicsPipeline | ( | RenderDevice * | self, |
| const char * | vertexShaderName, | ||
| const SDL_GPUShaderCreateInfo * | vertexShaderInfo, | ||
| const char * | fragmentShaderName, | ||
| const SDL_GPUShaderCreateInfo * | fragmentShaderInfo, | ||
| SDL_GPUGraphicsPipelineCreateInfo * | info | ||
| ) |
Loads a vertex/fragment shader pair and creates a GraphicsPipeline from them.
Convenience over the load-both/assign/create/release-both boilerplate every graphics pipeline needs: calls loadShader for vertexShaderName and fragmentShaderName, assigns the results to info's vertex_shader/ fragment_shader fields, calls createGraphicsPipeline, then releases both Shaders (they're retained by the pipeline internally; the caller never sees or owns them). info must otherwise be fully populated (vertex layout, blend/rasterizer/depth-stencil state, colour target formats) by the caller.
| self | The RenderDevice. |
| vertexShaderName | Vertex shader base name, e.g. "shaders/bsp_vs". |
| vertexShaderInfo | Vertex shader creation parameters (see loadShader). |
| fragmentShaderName | Fragment shader base name, e.g. "shaders/bsp_fs". |
| fragmentShaderInfo | Fragment shader creation parameters (see loadShader). |
| info | Graphics pipeline creation parameters; vertex_shader/fragment_shader are overwritten, all other fields must already be set. |
release. | Shader * loadShader | ( | RenderDevice * | self, |
| const char * | name, | ||
| const SDL_GPUShaderCreateInfo * | info | ||
| ) |
Loads a shader blob via the Resource system and creates a Shader.
Appends each supported format's extension to name and resolves it via Objectively's ResourceProvider chain:
.metallib, then .metal.spv.dxil The caller fills in stage, entrypoint, and binding counts in info. code, code_size, format, and a default entrypoint are filled in for you, then the completed info is passed to Shader::initWithDevice. Shader blobs are produced offline by sdl-shadercross. | self | The RenderDevice. |
| name | Shader base name without extension, e.g. "shaders/Renderer.vert". |
| info | Shader creation parameters. code, code_size, and format are ignored; all other fields must be set by the caller. |
release. | bool setAllowedFramesInFlight | ( | const RenderDevice * | self, |
| Uint32 | allowed | ||
| ) |
Sets the maximum number of GPU frames that may be in flight concurrently.
Lower values reduce latency; higher values improve throughput. The default is determined by SDL. Takes effect on the next frame.
| self | The RenderDevice. |
| allowed | Maximum concurrent in-flight frames (1–3 are typical values). |
true on success, false if the value is unsupported. | void setFramebuffer | ( | RenderDevice * | self, |
| Framebuffer * | framebuffer | ||
| ) |
Sets the present-target Framebuffer driven by beginFrame/endFrame.
The device retains framebuffer and releases any previously set one. Construct the Framebuffer with the desired color/depth formats and MSAA sample count; beginFrame resizes it to the swapchain each frame. Pass NULL to clear.
| self | The RenderDevice. |
| framebuffer | The Framebuffer to present each frame, or NULL. |
| bool setSwapchainParameters | ( | const RenderDevice * | self, |
| SDL_GPUSwapchainComposition | composition, | ||
| SDL_GPUPresentMode | mode | ||
| ) |
Configures swapchain composition and present mode for this device's window.
Use supportsSwapchainComposition and supportsPresentMode to guard against unsupported combinations before calling this.
| self | The RenderDevice. |
| composition | Colour space / HDR composition mode. |
| mode | Presentation mode (vsync, mailbox, immediate, etc.). |
true on success, false if the combination is unsupported. | bool setSwapchainParameters | ( | const RenderDevice * | self, |
| SDL_Window * | window, | ||
| SDL_GPUSwapchainComposition | composition, | ||
| SDL_GPUPresentMode | mode | ||
| ) |
| void setWindow | ( | RenderDevice * | self, |
| SDL_Window * | window | ||
| ) |
Claims window for this device, releasing any previously claimed window.
If a different window is already claimed it is released via SDL_ReleaseWindowFromGPUDevice first. Passing NULL releases the current window without claiming a new one.
| self | The RenderDevice. |
| window | The SDL_Window to claim, or NULL to release the current window. |
| bool supportsPresentMode | ( | const RenderDevice * | self, |
| SDL_GPUPresentMode | mode | ||
| ) |
Queries whether this device's swapchain supports the given present mode.
| self | The RenderDevice. |
| mode | The present mode to test. |
true if the present mode is supported. | bool supportsSwapchainComposition | ( | const RenderDevice * | self, |
| SDL_GPUSwapchainComposition | composition | ||
| ) |
Queries whether this device's swapchain supports the given composition (colour space / HDR mode).
| self | The RenderDevice. |
| composition | The swapchain composition to test. |
true if the composition is supported. | bool textureSupportsFormat | ( | const RenderDevice * | self, |
| SDL_GPUTextureFormat | format, | ||
| SDL_GPUTextureType | type, | ||
| SDL_GPUTextureUsageFlags | usage | ||
| ) |
Queries whether a texture format is supported for a given type and usage.
| self | The RenderDevice. |
| format | The texture format to query. |
| type | The texture dimensionality (2D, cube, 3D, etc.). |
| usage | Bitmask of intended usages (sampler, colour target, storage, etc.). |
true if the format/type/usage combination is supported. | bool textureSupportsSampleCount | ( | const RenderDevice * | self, |
| SDL_GPUTextureFormat | format, | ||
| SDL_GPUSampleCount | sample_count | ||
| ) |
Queries whether a texture format supports a given MSAA sample count.
| self | The RenderDevice. |
| format | The texture format to query. |
| sample_count | The MSAA sample count to test. |
true if the format supports the requested sample count. | bool waitForIdle | ( | const RenderDevice * | self | ) |
Blocks until the GPU has finished all submitted work.
Use sparingly — typically only at shutdown or before releasing GPU resources that may still be in use.
| self | The RenderDevice. |
true on success, false on error. | bool waitForSwapchain | ( | const RenderDevice * | self | ) |
Blocks until this device's swapchain is available for the next frame.
| self | The RenderDevice. |
true on success, false on error. | ident RenderDevice::data |
User data.
| SDL_GPUDevice* RenderDevice::device |
The SDL_GPUDevice.
| Framebuffer* RenderDevice::framebuffer |
The present-target Framebuffer driven by beginFrame/endFrame, or NULL.
Set via setFramebuffer (retained). beginFrame resizes it to the swapchain each frame and endFrame blits its resolved color to the swapchain.
|
protected |
The interface.
| float RenderDevice::maxAnisotropy |
The anisotropic filtering level applied by createSamplerLinearRepeat and createSamplerLinearClamp. Defaults to 0 (anisotropic filtering disabled). Assign directly; only affects Samplers created afterward, since SDL_gpu Samplers are immutable once created.
| Object RenderDevice::object |
The superclass.
| SDL_GPUShaderFormat RenderDevice::shaderFormats |
The bitmask of supported shader formats.
| SDL_Window* RenderDevice::window |
The SDL_Window associated with device.