KDGpuExample::KDGpu::RenderPassCommandRecorderBase¶
Module: Public API
Base class for render pass command recorders (NVI pattern). More...
Public Functions¶
| Name | |
|---|---|
| virtual | ~RenderPassCommandRecorderBase() =default |
| void | setPipeline(const RequiredHandle< GraphicsPipeline_t > & pipeline) Binds a graphics pipeline for subsequent draw commands. |
| void | setVertexBuffer(uint32_t index, const RequiredHandle< Buffer_t > & buffer, DeviceSize offset =0) Binds a vertex buffer to a binding index. |
| void | setIndexBuffer(const RequiredHandle< Buffer_t > & buffer, DeviceSize offset =0, IndexType indexType =IndexType::Uint32) Binds an index buffer for indexed draw commands. |
| void | setBindGroup(uint32_t group, const RequiredHandle< BindGroup_t > & bindGroup, const OptionalHandle< PipelineLayout_t > & pipelineLayout =Handle< PipelineLayout_t >(), std::span< const uint32_t > dynamicBufferOffsets ={}) Binds a descriptor set (bind group) for shader resource access. |
| void | setViewport(const Viewport & viewport) Sets the viewport transformation. |
| void | setScissor(const Rect2D & scissor) Sets the scissor rectangle for fragment clipping. |
| void | setStencilReference(StencilFaceFlags faceMask, int reference) Sets the stencil reference value for stencil testing. |
| void | draw(const DrawCommand & drawCommand) Draws non-indexed geometry. |
| void | draw(std::span< const DrawCommand > drawCommands) Draws multiple non-indexed primitives in a single call. |
| void | drawIndexed(const DrawIndexedCommand & drawCommand) Draws indexed geometry. |
| void | drawIndexed(std::span< const DrawIndexedCommand > drawCommands) Draws multiple indexed primitives in a single call. |
| void | drawIndirect(const DrawIndirectCommand & drawCommand) Draws geometry with parameters in a GPU buffer (indirect rendering) |
| void | drawIndirect(std::span< const DrawIndirectCommand > drawCommands) |
| void | drawIndexedIndirect(const DrawIndexedIndirectCommand & drawCommand) Draws indexed geometry with parameters in a GPU buffer. |
| void | drawIndexedIndirect(std::span< const DrawIndexedIndirectCommand > drawCommands) |
| void | drawMeshTasks(const DrawMeshCommand & drawCommand) Dispatches mesh shader work groups. |
| void | drawMeshTasks(std::span< const DrawMeshCommand > drawCommands) |
| void | drawMeshTasksIndirect(const DrawMeshIndirectCommand & drawCommand) Dispatches mesh shader work groups with GPU-driven parameters. |
| void | drawMeshTasksIndirect(std::span< const DrawMeshIndirectCommand > drawCommands) |
| void | pushConstant(const PushConstantRange & constantRange, const void * data, const OptionalHandle< PipelineLayout_t > & pipelineLayout ={}) Uploads small data directly to shaders without buffers. |
| void | pushBindGroup(uint32_t group, std::span< const BindGroupEntry > bindGroupEntries, const Handle< PipelineLayout_t > & pipelineLayout =Handle< PipelineLayout_t >()) Dynamically creates and binds a temporary descriptor set. |
| void | end() Ends the render pass and finalizes recorded commands. |
Protected Functions¶
| Name | |
|---|---|
| RenderPassCommandRecorderBase() =default | |
| RenderPassCommandRecorderBase(GraphicsApi * api, const Handle< Device_t > & device) | |
| virtual VulkanRenderPassCommandRecorderBase * | backend() const =0 |
Protected Attributes¶
| Name | |
|---|---|
| GraphicsApi * | m_api |
| Handle< Device_t > | m_device |
Detailed Description¶
1 | |
Base class for render pass command recorders (NVI pattern).
See:
- RenderPassCommandRecorder (legacy VkRenderPass path)
- DynamicRenderPassCommandRecorder (recommended modern path)
All drawing commands are non-virtual and implemented here; they delegate to a single protected pure-virtual backend() method overridden by each concrete class.
Public Functions Documentation¶
function ~RenderPassCommandRecorderBase¶
1 | |
function setPipeline¶
1 2 3 | |
Binds a graphics pipeline for subsequent draw commands.
Parameters:
- pipeline The graphics pipeline to bind
All subsequent draw commands will use this pipeline's shaders, blend state, depth/stencil state, etc. Must be called before drawing.
Vulkan: vkCmdBindPipeline(VK_PIPELINE_BIND_POINT_GRAPHICS)
function setVertexBuffer¶
1 2 3 4 5 | |
Binds a vertex buffer to a binding index.
Parameters:
- index Vertex buffer binding index (must match vertex input in pipeline)
- buffer The vertex buffer to bind
- offset Byte offset into the buffer (default 0)
Subsequent draw commands will read vertex data from this buffer.
Vulkan: vkCmdBindVertexBuffers()
function setIndexBuffer¶
1 2 3 4 5 | |
Binds an index buffer for indexed draw commands.
Parameters:
- buffer The index buffer to bind
- offset Byte offset into the buffer (default 0)
- indexType Index format: Uint16 or Uint32 (default Uint32)
Required for drawIndexed() and drawIndexedIndirect() commands.
Vulkan: vkCmdBindIndexBuffer()
function setBindGroup¶
1 2 3 4 5 6 | |
Binds a descriptor set (bind group) for shader resource access.
Parameters:
- group Binding index (must match layout in pipeline)
- bindGroup The bind group containing resources (textures, buffers, samplers)
- pipelineLayout Optional pipeline layout (can be inferred from pipeline if omitted)
- dynamicBufferOffsets Offsets for dynamic uniform/storage buffers
Shaders access resources through bind groups. Each bind group corresponds to a set in GLSL/HLSL shader code.
Vulkan: vkCmdBindDescriptorSets()
function setViewport¶
1 2 3 | |
Sets the viewport transformation.
Parameters:
- viewport Viewport rectangle and depth range
Transforms normalized device coordinates to framebuffer coordinates. Can be set dynamically if the pipeline was created with dynamic viewport state.
Vulkan: vkCmdSetViewport()
function setScissor¶
1 2 3 | |
Sets the scissor rectangle for fragment clipping.
Parameters:
- scissor Scissor rectangle in framebuffer coordinates
Fragments outside the scissor rectangle are discarded. Useful for UI clipping or rendering to sub-regions.
Vulkan: vkCmdSetScissor()
function setStencilReference¶
1 2 3 4 | |
Sets the stencil reference value for stencil testing.
Parameters:
- faceMask Which faces to update (Front, Back, or FrontAndBack)
- reference The stencil reference value (0-255)
Used with stencil operations for masking and stencil-based effects.
Vulkan: vkCmdSetStencilReference()
function draw¶
1 2 3 | |
Draws non-indexed geometry.
Parameters:
- drawCommand Draw parameters (vertex count, instance count, etc.)
Draws vertices directly from vertex buffers without an index buffer.
Vulkan: vkCmdDraw()
function draw¶
1 2 3 | |
Draws multiple non-indexed primitives in a single call.
Parameters:
- drawCommands Array of draw commands to execute
More efficient than issuing multiple draw() calls separately.
Vulkan: Multiple vkCmdDraw() calls
function drawIndexed¶
1 2 3 | |
Draws indexed geometry.
Parameters:
- drawCommand Draw parameters (index count, instance count, etc.)
Most commonly used draw command. Reads indices from the bound index buffer which reference vertices in vertex buffers.
Vulkan: vkCmdDrawIndexed()
function drawIndexed¶
1 2 3 | |
Draws multiple indexed primitives in a single call.
Parameters:
- drawCommands Array of indexed draw commands
Vulkan: Multiple vkCmdDrawIndexed() calls
function drawIndirect¶
1 2 3 | |
Draws geometry with parameters in a GPU buffer (indirect rendering)
Parameters:
- drawCommand Indirect draw parameters
Draw parameters are read from a GPU buffer, enabling GPU-driven rendering.
Vulkan: vkCmdDrawIndirect()
function drawIndirect¶
1 2 3 | |
function drawIndexedIndirect¶
1 2 3 | |
Draws indexed geometry with parameters in a GPU buffer.
Parameters:
- drawCommand Indirect indexed draw parameters
Vulkan: vkCmdDrawIndexedIndirect()
function drawIndexedIndirect¶
1 2 3 | |
function drawMeshTasks¶
1 2 3 | |
Dispatches mesh shader work groups.
Parameters:
- drawCommand Mesh shader dispatch parameters
Requires mesh shading pipeline and VK_EXT_mesh_shader support. Mesh shaders replace the traditional vertex/geometry shader stages.
Vulkan: vkCmdDrawMeshTasksEXT()
function drawMeshTasks¶
1 2 3 | |
function drawMeshTasksIndirect¶
1 2 3 | |
Dispatches mesh shader work groups with GPU-driven parameters.
Parameters:
- drawCommand Indirect mesh shader dispatch
Vulkan: vkCmdDrawMeshTasksIndirectEXT()
function drawMeshTasksIndirect¶
1 2 3 | |
function pushConstant¶
1 2 3 4 5 | |
Uploads small data directly to shaders without buffers.
Parameters:
- constantRange Push constant range (offset, size, shader stages)
- data Pointer to data to upload
- pipelineLayout Optional pipeline layout
Push constants provide fast access to small amounts of frequently-updated data (typically up to 128 bytes). Much faster than updating uniform buffers.
Vulkan: vkCmdPushConstants()
function pushBindGroup¶
1 2 3 4 5 | |
Dynamically creates and binds a temporary descriptor set.
Parameters:
- group Binding index
- bindGroupEntries Resources to bind
- pipelineLayout Pipeline layout
Convenience function for binding resources without pre-creating a BindGroup.
Vulkan: vkCmdPushDescriptorSetKHR() (requires VK_KHR_push_descriptor)
function end¶
1 | |
Ends the render pass and finalizes recorded commands.
Must be called to finish the render pass. After calling end(), this RenderPassCommandRecorder is no longer valid and should not be used.
Vulkan: vkCmdEndRendering() or vkCmdEndRenderPass()
Protected Functions Documentation¶
function RenderPassCommandRecorderBase¶
1 | |
function RenderPassCommandRecorderBase¶
1 2 3 4 | |
function backend¶
1 | |
Protected Attributes Documentation¶
variable m_api¶
1 | |
variable m_device¶
1 | |
Updated on 2026-11-07 at 00:01:27 +0000