|
|
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.
|
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 |
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).
| 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.
| vertexCount | Number of vertices. |
| instanceCount | Number of instances. |
| firstVertex | First vertex index. |
| firstInstance | First instance index. |
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.
| index | Bind group index; must be below kMaxBindGroups. |
| bindGroup | Bind group to bind; must be a live handle of the encoder's device. |
| Status donner::gpu::RenderPassEncoder::setPipeline | ( | const RenderPipeline & | pipeline | ) |
Sets the active render pipeline.
| pipeline | Pipeline to bind; must be a live handle of the encoder's device. |
| 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.
| x | Left edge in pixels. |
| y | Top edge in pixels. |
| width | Width in pixels. |
| height | Height in pixels. |
| Status donner::gpu::RenderPassEncoder::setVertexBuffer | ( | uint32_t | slot, |
| const Buffer & | buffer, | ||
| uint64_t | offsetBytes = 0 ) |
Binds buffer as the vertex buffer for slot.
| slot | Vertex buffer slot; must be below kMaxVertexBuffers. |
| buffer | Buffer to bind; needs BufferUsage::Vertex. |
| offsetBytes | Byte offset of the first element; must be within the buffer. |
| 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.
| x | Left edge in pixels. |
| y | Top edge in pixels. |
| width | Width in pixels. |
| height | Height in pixels. |
| minDepth | Minimum depth of the viewport range. |
| maxDepth | Maximum depth of the viewport range. |