ObjectivelyGPU
Object oriented graphics framework for SDL3 and C
Loading...
Searching...
No Matches
RenderPass.h
Go to the documentation of this file.
1/*
2 * ObjectivelyGPU: Object oriented graphics framework for SDL3 and C.
3 * Copyright (C) 2026 Jay Dolan <jay@jaydolan.com>
4 *
5 * This software is provided 'as-is', without any express or implied
6 * warranty. In no event will the authors be held liable for any damages
7 * arising from the use of this software.
8 *
9 * Permission is granted to anyone to use this software for any purpose,
10 * including commercial applications, and to alter it and redistribute it
11 * freely, subject to the following restrictions:
12 *
13 * 1. The origin of this software must not be misrepresented; you must not
14 * claim that you wrote the original software. If you use this software
15 * in a product, an acknowledgment in the product documentation would be
16 * appreciated but is not required.
17 *
18 * 2. Altered source versions must be plainly marked as such, and must not be
19 * misrepresented as being the original software.
20 *
21 * 3. This notice may not be removed or altered from any source distribution.
22 */
23
24#pragma once
25
26#include <Objectively/Object.h>
27
29
37typedef struct QueryPool QueryPool;
38typedef struct RenderPass RenderPass;
39typedef struct RenderPassInterface RenderPassInterface;
40
57struct RenderPass {
58
62 Object object;
63
68 RenderPassInterface *interface;
69
73 SDL_FColor blendConstants;
74
79 CommandBuffer *commands;
80
86 SDL_GPURenderPass *pass;
87
92
96 SDL_Rect scissor;
97
102
106 SDL_GPUViewport viewport;
107
111 ident data;
112};
113
117struct RenderPassInterface {
118
122 ObjectInterface objectInterface;
123
129 void (*bindFragmentSamplers)(const RenderPass *self, Uint32 firstSlot, const SDL_GPUTextureSamplerBinding *bindings, Uint32 num);
130
136 void (*bindFragmentStorageBuffers)(const RenderPass *self, Uint32 firstSlot, SDL_GPUBuffer *const *buffers, Uint32 num);
137
143 void (*bindFragmentStorageTextures)(const RenderPass *self, Uint32 firstSlot, SDL_GPUTexture *const *textures, Uint32 num);
144
150 void (*bindPipeline)(RenderPass *self, GraphicsPipeline *pipeline);
151
157 void (*bindIndexBuffer)(const RenderPass *self, const SDL_GPUBufferBinding *binding, SDL_GPUIndexElementSize indexElementSize);
158
164 void (*bindVertexBuffers)(const RenderPass *self, Uint32 firstSlot, const SDL_GPUBufferBinding *bindings, Uint32 num);
165
171 void (*bindVertexSamplers)(const RenderPass *self, Uint32 firstSlot, const SDL_GPUTextureSamplerBinding *bindings, Uint32 num);
172
178 void (*bindVertexStorageBuffers)(const RenderPass *self, Uint32 firstSlot, SDL_GPUBuffer *const *buffers, Uint32 num);
179
185 void (*bindVertexStorageTextures)(const RenderPass *self, Uint32 firstSlot, SDL_GPUTexture *const *textures, Uint32 num);
186
193 void (*beginQuery)(const RenderPass *self, QueryPool *pool, Uint32 index);
194
201 void (*endQuery)(const RenderPass *self, QueryPool *pool, Uint32 index);
202
208 void (*drawIndexedPrimitives)(const RenderPass *self, Uint32 numIndices, Uint32 numInstances, Uint32 firstIndex, Sint32 vertexOffset, Uint32 firstInstance);
209
215 void (*drawIndexedPrimitivesIndirect)(const RenderPass *self, SDL_GPUBuffer *buffer, Uint32 offset, Uint32 drawCount);
216
222 void (*drawPrimitives)(const RenderPass *self, Uint32 numVertices, Uint32 numInstances, Uint32 firstVertex, Uint32 firstInstance);
223
229 void (*drawPrimitivesIndirect)(const RenderPass *self, SDL_GPUBuffer *buffer, Uint32 offset, Uint32 drawCount);
230
240 RenderPass *(*init)(RenderPass *self, CommandBuffer *commands, SDL_GPURenderPass *pass);
241
247 void (*setBlendConstants)(RenderPass *self, SDL_FColor blendConstants);
248
254 void (*setScissor)(RenderPass *self, const SDL_Rect *scissor);
255
261 void (*setStencilReference)(RenderPass *self, Uint8 reference);
262
268 void (*setViewport)(RenderPass *self, const SDL_GPUViewport *viewport);
269};
270
OBJECTIVELYGPU_EXPORT Class * _RenderPass(void)
Definition RenderPass.c:322
#define OBJECTIVELYGPU_EXPORT
Definition Types.h:35
A recorded sequence of GPU commands for a single frame.
Definition CommandBuffer.h:80
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:96
A scoped render pass for recording draw commands into a CommandBuffer.
Definition RenderPass.h:57
GraphicsPipeline * pipeline
The currently bound pipeline, or NULL.
Definition RenderPass.h:91
SDL_Rect scissor
The current scissor.
Definition RenderPass.h:96
Object object
The superclass.
Definition RenderPass.h:62
SDL_FColor blendConstants
The current blend constants.
Definition RenderPass.h:73
ident data
User data.
Definition RenderPass.h:111
RenderPassInterface * interface
The interface.
Definition RenderPass.h:68
SDL_GPUViewport viewport
The current viewport.
Definition RenderPass.h:106
Uint8 stencilReference
The current stencil reference.
Definition RenderPass.h:101