ObjectivelyGPU
Object oriented graphics framework for SDL3 and C
Loading...
Searching...
No Matches
RenderPass Struct Reference

A scoped render pass for recording draw commands into a CommandBuffer. More...

#include <RenderPass.h>

Inheritance diagram for RenderPass:

Public Member Functions

void bindFragmentSamplers (const RenderPass *self, Uint32 firstSlot, const SDL_GPUTextureSamplerBinding *bindings, Uint32 num)
 Binds texture-sampler pairs for the fragment stage.
 
void bindFragmentStorageBuffers (const RenderPass *self, Uint32 firstSlot, SDL_GPUBuffer *const *buffers, Uint32 num)
 Binds read-only storage buffers for the fragment stage.
 
void bindFragmentStorageTextures (const RenderPass *self, Uint32 firstSlot, SDL_GPUTexture *const *textures, Uint32 num)
 Binds read-only storage textures for the fragment stage.
 
void bindIndexBuffer (const RenderPass *self, const SDL_GPUBufferBinding *binding, SDL_GPUIndexElementSize indexElementSize)
 Binds an index buffer for indexed draw calls.
 
void bindPipeline (RenderPass *self, GraphicsPipeline *pipeline)
 Binds a graphics pipeline for subsequent draw calls.
 
void bindVertexBuffers (const RenderPass *self, Uint32 firstSlot, const SDL_GPUBufferBinding *bindings, Uint32 num)
 Binds vertex buffers for subsequent draw calls.
 
void bindVertexSamplers (const RenderPass *self, Uint32 firstSlot, const SDL_GPUTextureSamplerBinding *bindings, Uint32 num)
 Binds texture-sampler pairs for the vertex stage.
 
void bindVertexStorageBuffers (const RenderPass *self, Uint32 firstSlot, SDL_GPUBuffer *const *buffers, Uint32 num)
 Binds read-only storage buffers for the vertex stage.
 
void bindVertexStorageTextures (const RenderPass *self, Uint32 firstSlot, SDL_GPUTexture *const *textures, Uint32 num)
 Binds read-only storage textures for the vertex stage.
 
void beginQuery (const RenderPass *self, QueryPool *pool, Uint32 index)
 Begins a query, accumulating results from subsequent draw calls until endQuery.
 
void endQuery (const RenderPass *self, QueryPool *pool, Uint32 index)
 Ends a query begun with beginQuery.
 
void drawIndexedPrimitives (const RenderPass *self, Uint32 numIndices, Uint32 numInstances, Uint32 firstIndex, Sint32 vertexOffset, Uint32 firstInstance)
 Draws indexed primitives.
 
void drawIndexedPrimitivesIndirect (const RenderPass *self, SDL_GPUBuffer *buffer, Uint32 offset, Uint32 drawCount)
 Draws indexed primitives with parameters sourced from a GPU buffer.
 
void drawPrimitives (const RenderPass *self, Uint32 numVertices, Uint32 numInstances, Uint32 firstVertex, Uint32 firstInstance)
 Draws non-indexed primitives.
 
void drawPrimitivesIndirect (const RenderPass *self, SDL_GPUBuffer *buffer, Uint32 offset, Uint32 drawCount)
 Draws non-indexed primitives with parameters sourced from a GPU buffer.
 
RenderPassinit (RenderPass *self, CommandBuffer *commands, SDL_GPURenderPass *pass)
 Initializes this RenderPass wrapping the given SDL render pass.
 
void setBlendConstants (RenderPass *self, SDL_FColor blendConstants)
 Sets the blend constants used by SDL_GPU_BLENDFACTOR_CONSTANT_* factors.
 
void setScissor (const RenderPass *self, const SDL_Rect *scissor)
 
void setStencilReference (RenderPass *self, Uint8 reference)
 Sets the stencil reference value used in stencil tests.
 
void setViewport (const RenderPass *self, const SDL_GPUViewport *viewport)
 
Class * _RenderPass (void)
 The RenderPass archetype.
 
void setScissor (RenderPass *self, const SDL_Rect *scissor)
 Sets the scissor rectangle. Pass NULL to reset to the full viewport.
 
void setViewport (RenderPass *self, const SDL_GPUViewport *viewport)
 Sets the viewport. Pass NULL to reset to the full render target.
 

Data Fields

Object object
 The superclass.
 
SDL_FColor blendConstants
 The current blend constants.
 
GraphicsPipelinepipeline
 The currently bound pipeline, or NULL.
 
SDL_Rect scissor
 The current scissor.
 
Uint8 stencilReference
 The current stencil reference.
 
SDL_GPUViewport viewport
 The current viewport.
 
ident data
 User data.
 

Protected Attributes

RenderPassInterface * interface
 The interface.
 

Detailed Description

A scoped render pass for recording draw commands into a CommandBuffer.

Obtain a RenderPass from CommandBuffer::beginRenderPass. When all draw commands have been recorded, release the pass — dealloc calls SDL_EndGPURenderPass automatically so no explicit end is required:

RenderPass *pass = $(commands, beginRenderPass, colorTargets, numTargets, NULL);
$(pass, drawPrimitives, vertexCount, 1, 0, 0);
release(pass); // ends the pass
static RenderPass * beginRenderPass(CommandBuffer *self, const SDL_GPUColorTargetInfo *colorTargets, Uint32 numColorTargets, const SDL_GPUDepthStencilTargetInfo *depthStencil)
Definition CommandBuffer.c:114
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
void drawPrimitives(const RenderPass *self, Uint32 numVertices, Uint32 numInstances, Uint32 firstVertex, Uint32 firstInstance)
Draws non-indexed primitives.
Definition RenderPass.c:179
void bindPipeline(RenderPass *self, GraphicsPipeline *pipeline)
Binds a graphics pipeline for subsequent draw calls.
Definition RenderPass.c:90

Member Function Documentation

◆ _RenderPass()

Class * _RenderPass ( void  )

The RenderPass archetype.

Returns
The RenderPass Class.

◆ beginQuery()

void beginQuery ( const RenderPass self,
QueryPool pool,
Uint32  index 
)

Begins a query, accumulating results from subsequent draw calls until endQuery.

A no-op when pool is backed by an unsupported SDL3 build; see QueryPool.

◆ bindFragmentSamplers()

void bindFragmentSamplers ( const RenderPass self,
Uint32  firstSlot,
const SDL_GPUTextureSamplerBinding *  bindings,
Uint32  num 
)

Binds texture-sampler pairs for the fragment stage.

◆ bindFragmentStorageBuffers()

void bindFragmentStorageBuffers ( const RenderPass self,
Uint32  firstSlot,
SDL_GPUBuffer *const *  buffers,
Uint32  num 
)

Binds read-only storage buffers for the fragment stage.

◆ bindFragmentStorageTextures()

void bindFragmentStorageTextures ( const RenderPass self,
Uint32  firstSlot,
SDL_GPUTexture *const *  textures,
Uint32  num 
)

Binds read-only storage textures for the fragment stage.

◆ bindIndexBuffer()

void bindIndexBuffer ( const RenderPass self,
const SDL_GPUBufferBinding *  binding,
SDL_GPUIndexElementSize  indexElementSize 
)

Binds an index buffer for indexed draw calls.

◆ bindPipeline()

void bindPipeline ( RenderPass self,
GraphicsPipeline pipeline 
)

Binds a graphics pipeline for subsequent draw calls.

◆ bindVertexBuffers()

void bindVertexBuffers ( const RenderPass self,
Uint32  firstSlot,
const SDL_GPUBufferBinding *  bindings,
Uint32  num 
)

Binds vertex buffers for subsequent draw calls.

◆ bindVertexSamplers()

void bindVertexSamplers ( const RenderPass self,
Uint32  firstSlot,
const SDL_GPUTextureSamplerBinding *  bindings,
Uint32  num 
)

Binds texture-sampler pairs for the vertex stage.

◆ bindVertexStorageBuffers()

void bindVertexStorageBuffers ( const RenderPass self,
Uint32  firstSlot,
SDL_GPUBuffer *const *  buffers,
Uint32  num 
)

Binds read-only storage buffers for the vertex stage.

◆ bindVertexStorageTextures()

void bindVertexStorageTextures ( const RenderPass self,
Uint32  firstSlot,
SDL_GPUTexture *const *  textures,
Uint32  num 
)

Binds read-only storage textures for the vertex stage.

◆ drawIndexedPrimitives()

void drawIndexedPrimitives ( const RenderPass self,
Uint32  numIndices,
Uint32  numInstances,
Uint32  firstIndex,
Sint32  vertexOffset,
Uint32  firstInstance 
)

Draws indexed primitives.

◆ drawIndexedPrimitivesIndirect()

void drawIndexedPrimitivesIndirect ( const RenderPass self,
SDL_GPUBuffer *  buffer,
Uint32  offset,
Uint32  drawCount 
)

Draws indexed primitives with parameters sourced from a GPU buffer.

◆ drawPrimitives()

void drawPrimitives ( const RenderPass self,
Uint32  numVertices,
Uint32  numInstances,
Uint32  firstVertex,
Uint32  firstInstance 
)

Draws non-indexed primitives.

◆ drawPrimitivesIndirect()

void drawPrimitivesIndirect ( const RenderPass self,
SDL_GPUBuffer *  buffer,
Uint32  offset,
Uint32  drawCount 
)

Draws non-indexed primitives with parameters sourced from a GPU buffer.

◆ endQuery()

void endQuery ( const RenderPass self,
QueryPool pool,
Uint32  index 
)

Ends a query begun with beginQuery.

A no-op when pool is backed by an unsupported SDL3 build; see QueryPool.

◆ init()

RenderPass * init ( RenderPass self,
CommandBuffer commands,
SDL_GPURenderPass *  pass 
)

Initializes this RenderPass wrapping the given SDL render pass.

Parameters
selfThe RenderPass.
commandsThe CommandBuffer that created this pass.
passThe SDL render pass to wrap. Must not be NULL.
Returns
The initialized RenderPass, or NULL on failure.

◆ setBlendConstants()

void setBlendConstants ( RenderPass self,
SDL_FColor  blendConstants 
)

Sets the blend constants used by SDL_GPU_BLENDFACTOR_CONSTANT_* factors.

◆ setScissor() [1/2]

void setScissor ( const RenderPass self,
const SDL_Rect *  scissor 
)

◆ setScissor() [2/2]

void setScissor ( RenderPass self,
const SDL_Rect *  scissor 
)

Sets the scissor rectangle. Pass NULL to reset to the full viewport.

◆ setStencilReference()

void setStencilReference ( RenderPass self,
Uint8  reference 
)

Sets the stencil reference value used in stencil tests.

◆ setViewport() [1/2]

void setViewport ( const RenderPass self,
const SDL_GPUViewport *  viewport 
)

◆ setViewport() [2/2]

void setViewport ( RenderPass self,
const SDL_GPUViewport *  viewport 
)

Sets the viewport. Pass NULL to reset to the full render target.

Field Documentation

◆ blendConstants

SDL_FColor RenderPass::blendConstants

The current blend constants.

◆ data

ident RenderPass::data

User data.

◆ interface

RenderPassInterface* RenderPass::interface
protected

The interface.

◆ object

Object RenderPass::object

The superclass.

◆ pipeline

GraphicsPipeline* RenderPass::pipeline

The currently bound pipeline, or NULL.

◆ scissor

SDL_Rect RenderPass::scissor

The current scissor.

◆ stencilReference

Uint8 RenderPass::stencilReference

The current stencil reference.

◆ viewport

SDL_GPUViewport RenderPass::viewport

The current viewport.


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