28#include <SDL3/SDL_gpu.h>
29#include <SDL3/SDL_surface.h>
31#include <Objectively/Data.h>
32#include <Objectively/Object.h>
51typedef struct RenderDeviceInterface RenderDeviceInterface;
131struct RenderDeviceInterface {
136 ObjectInterface objectInterface;
196 Buffer *(*createBufferWithConstMem)(
RenderDevice *self, SDL_GPUBufferUsageFlags usage,
const void *mem, Uint32 size);
209 Buffer *(*createBufferWithData)(
RenderDevice *self, SDL_GPUBufferUsageFlags usage,
const Data *data);
348 Texture *(*createTexture)(
RenderDevice *self,
const SDL_GPUTextureCreateInfo *info,
const void *pixels);
381 Texture *(*createSolidColorTexture)(
RenderDevice *self, SDL_GPUTextureType type, Uint32 layerCount, Uint32 rgba);
475 Shader *(*loadShader)(
RenderDevice *self,
const char *name,
const SDL_GPUShaderCreateInfo *info);
519 const char *vertexShaderName,
const SDL_GPUShaderCreateInfo *vertexShaderInfo,
520 const char *fragmentShaderName,
const SDL_GPUShaderCreateInfo *fragmentShaderInfo,
521 SDL_GPUGraphicsPipelineCreateInfo *info);
static void generateMipmaps(const CommandBuffer *self, SDL_GPUTexture *texture)
Definition CommandBuffer.c:183
CommandBuffer wraps an SDL_GPUCommandBuffer for a single frame.
QueryPool wraps an SDL_GPUQueryPool, owning its handle and metadata.
static void endFrame(RenderDevice *self)
Definition RenderDevice.c:210
static SDL_GPUTextureFormat getSwapchainTextureFormat(const RenderDevice *self)
Definition RenderDevice.c:429
OBJECTIVELYGPU_EXPORT Class * _RenderDevice(void)
Definition RenderDevice.c:719
struct Shader Shader
Definition RenderDevice.h:53
#define OBJECTIVELYGPU_EXPORT
Definition Types.h:35
An SDL_GPUBuffer (vertex, index, indirect, storage, etc.) and its metadata.
Definition Buffer.h:61
A recorded sequence of GPU commands for a single frame.
Definition CommandBuffer.h:81
An SDL_GPUComputePipeline: a compiled compute program and its binding layout.
Definition ComputePipeline.h:50
An SDL_GPUFence, signaled once a submitted CommandBuffer's GPU work completes.
Definition Fence.h:55
An off-screen render target grouping a color and/or depth texture.
Definition Framebuffer.h:194
Parameters for creating a Framebuffer.
Definition Framebuffer.h:124
An SDL_GPUGraphicsPipeline: the compiled vertex/fragment program plus all fixed-function render state...
Definition GraphicsPipeline.h:51
An SDL_GPUQueryPool and its metadata.
Definition QueryPool.h:86
The RenderDevice encapsulates an SDL_GPUDevice and provides methods for allocating GPU resources,...
Definition RenderDevice.h:63
void setFramebuffer(RenderDevice *self, Framebuffer *framebuffer)
Sets the present-target Framebuffer driven by beginFrame/endFrame.
Definition RenderDevice.c:574
bool supportsSwapchainComposition(const RenderDevice *self, SDL_GPUSwapchainComposition composition)
Queries whether this device's swapchain supports the given composition (colour space / HDR mode).
Definition RenderDevice.c:629
SDL_GPUShaderFormat shaderFormats
Definition RenderDevice.h:89
bool setAllowedFramesInFlight(const RenderDevice *self, Uint32 allowed)
Sets the maximum number of GPU frames that may be in flight concurrently.
Definition RenderDevice.c:566
float maxAnisotropy
The anisotropic filtering level applied by createSamplerLinearRepeat and createSamplerLinearClamp....
Definition RenderDevice.h:97
SDL_GPUDevice * device
The SDL_GPUDevice.
Definition RenderDevice.h:79
Object object
The superclass.
Definition RenderDevice.h:68
bool waitForIdle(const RenderDevice *self)
Blocks until the GPU has finished all submitted work.
Definition RenderDevice.c:654
Framebuffer * framebuffer
The present-target Framebuffer driven by beginFrame/endFrame, or NULL.
Definition RenderDevice.h:104
bool textureSupportsSampleCount(const RenderDevice *self, SDL_GPUTextureFormat format, SDL_GPUSampleCount sample_count)
Queries whether a texture format supports a given MSAA sample count.
Definition RenderDevice.c:646
SDL_Window * window
The SDL_Window associated with device.
Definition RenderDevice.h:84
RenderDeviceInterface * interface[0]
The interface type.
Definition RenderDevice.h:74
bool supportsPresentMode(const RenderDevice *self, SDL_GPUPresentMode mode)
Queries whether this device's swapchain supports the given present mode.
Definition RenderDevice.c:620
bool waitForSwapchain(const RenderDevice *self)
Blocks until this device's swapchain is available for the next frame.
Definition RenderDevice.c:662
bool setSwapchainParameters(const RenderDevice *self, SDL_Window *window, SDL_GPUSwapchainComposition composition, SDL_GPUPresentMode mode)
ident data
User data.
Definition RenderDevice.h:125
void setWindow(RenderDevice *self, SDL_Window *window)
Claims window for this device, releasing any previously claimed window.
Definition RenderDevice.c:598
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.
Definition RenderDevice.c:638
Definition QueryPool.h:52
An SDL_GPUSampler describing texture filter and address modes.
Definition Sampler.h:51
An SDL_GPUShader: one compiled programmable stage of a graphics pipeline.
Definition Shader.h:51
The swapchain texture acquired for a single frame.
Definition CommandBuffer.h:50
An SDL_GPUTexture and the metadata describing it.
Definition Texture.h:60
A CPU-accessible SDL_GPUTransferBuffer for staging data to or from the GPU.
Definition TransferBuffer.h:59