Donner SVG Editor & Engine
SVG-native editor and embeddable SVG2 + CSS3 engine in C++20, with GPU (WebGPU) and compact CPU renderers, built for correctness, security, and performance.
Loading...
Searching...
No Matches
donner::gpu::RenderPassEncoder Class Reference

Encodes commands inside an active render pass. More...

#include "donner/gpu/CommandEncoder.h"

Public Member Functions

 RenderPassEncoder (const RenderPassEncoder &)=delete
RenderPassEncoder & operator= (const RenderPassEncoder &)=delete
 RenderPassEncoder (RenderPassEncoder &&)=delete
RenderPassEncoder & operator= (RenderPassEncoder &&)=delete
Status setPipeline (const RenderPipeline &pipeline)
 Sets the active render pipeline.
Status setBindGroup (uint32_t index, const BindGroup &bindGroup)
 Binds bindGroup at index.
Status setVertexBuffer (uint32_t slot, const Buffer &buffer, uint64_t offsetBytes=0)
 Binds buffer as the vertex buffer for slot.
Status setScissorRect (uint32_t x, uint32_t y, uint32_t width, uint32_t height)
 Sets the scissor rectangle.
Status setViewport (float x, float y, float width, float height, float minDepth, float maxDepth)
 Sets the viewport.
Status draw (uint32_t vertexCount, uint32_t instanceCount=1, uint32_t firstVertex=0, uint32_t firstInstance=0)
 Records a draw.
Status end ()
 Ends the render pass. Further pass operations fail with GpuErrorType::InvalidState until a new pass begins.

Friends

class CommandEncoder

Detailed Description

Encodes commands inside an active render pass.

Obtained from CommandEncoder::beginRenderPass; owned by the encoder and valid until the encoder is destroyed (operations after end fail with GpuErrorType::InvalidState).

Member Function Documentation

◆ draw()

Status donner::gpu::RenderPassEncoder::draw ( uint32_t vertexCount,
uint32_t instanceCount = 1,
uint32_t firstVertex = 0,
uint32_t firstInstance = 0 )

Records a draw.

Fails closed unless a pipeline is set, every vertex buffer slot the pipeline declares is bound with enough bytes for the drawn range (checked arithmetic), and every bind group index the pipeline layout declares holds a bind group created against the same layout.

Parameters
vertexCountNumber of vertices.
instanceCountNumber of instances.
firstVertexFirst vertex index.
firstInstanceFirst instance index.

◆ setBindGroup()

Status donner::gpu::RenderPassEncoder::setBindGroup ( uint32_t index,
const BindGroup & bindGroup )

Binds bindGroup at index.

Compatibility with the active pipeline's layout is checked at draw time, so bind groups may be set before the pipeline.

Parameters
indexBind group index; must be below kMaxBindGroups.
bindGroupBind group to bind; must be a live handle of the encoder's device.

◆ setPipeline()

Status donner::gpu::RenderPassEncoder::setPipeline ( const RenderPipeline & pipeline)

Sets the active render pipeline.

Parameters
pipelinePipeline to bind; must be a live handle of the encoder's device.

◆ setScissorRect()

Status donner::gpu::RenderPassEncoder::setScissorRect ( uint32_t x,
uint32_t y,
uint32_t width,
uint32_t height )

Sets the scissor rectangle.

The rectangle must fit inside the pass attachment extent.

Parameters
xLeft edge in pixels.
yTop edge in pixels.
widthWidth in pixels.
heightHeight in pixels.

◆ setVertexBuffer()

Status donner::gpu::RenderPassEncoder::setVertexBuffer ( uint32_t slot,
const Buffer & buffer,
uint64_t offsetBytes = 0 )

Binds buffer as the vertex buffer for slot.

Parameters
slotVertex buffer slot; must be below kMaxVertexBuffers.
bufferBuffer to bind; needs BufferUsage::Vertex.
offsetBytesByte offset of the first element; must be within the buffer.

◆ setViewport()

Status donner::gpu::RenderPassEncoder::setViewport ( float x,
float y,
float width,
float height,
float minDepth,
float maxDepth )

Sets the viewport.

All values must be finite, with positive extent and 0 <= minDepth <= maxDepth <= 1.

Parameters
xLeft edge in pixels.
yTop edge in pixels.
widthWidth in pixels.
heightHeight in pixels.
minDepthMinimum depth of the viewport range.
maxDepthMaximum depth of the viewport range.

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