Drawing Commands


typedef struct VkPipelineInputAssemblyStateCreateInfo { VkStructureType const void* VkPipelineInputAssemblyStateCreateFlags VkPrimitiveTopology VkBool32 } VkPipelineInputAssemblyStateCreateInfo;

void vkCmdSetPrimitiveRestartEnable( VkCommandBuffer commandBuffer, VkBool32 primitiveRestartEnable);

This command sets the primitive restart enable for subsequent drawing commands when the graphics pipeline is created with VK_DYNAMIC_STATE_PRIMITIVE_RESTART_ENABLE set in VkPipelineDynamicStateCreateInfo::pDynamicStates. Otherwise, this state is specified by the VkPipelineInputAssemblyStateCreateInfo::primitiveRestartEnable value used to create the currently active pipeline.

void vkCmdSetPrimitiveTopology( VkCommandBuffer commandBuffer, VkPrimitiveTopology primitiveTopology);

This command sets the primitive topology for subsequent drawing commands when the graphics pipeline is created with VK_DYNAMIC_STATE_PRIMITIVE_TOPOLOGY set in VkPipelineDynamicStateCreateInfo::pDynamicStates. Otherwise, this state is specified by the VkPipelineInputAssemblyStateCreateInfo::topology value used to create the currently active pipeline.

Primitive Order

Programmable Primitive Shading

Vertex shading receives two per-vertex inputs from the primitive assembly stage - the vertexIndex and the instanceIndex.

void vkCmdBindIndexBuffer( VkCommandBuffer VkBuffer VkDeviceSize VkIndexType commandBuffer, buffer, offset, indexType);

void FVulkanCommandListContext::RHIDrawIndexedPrimitive(FRHIIndexBuffer* IndexBufferRHI, int32 BaseVertexIndex, uint32 FirstInstance, uint32 NumVertices, uint32 StartIndex, uint32 NumPrimitives, uint32 NumInstances)

void FVulkanCommandListContext::RHIDrawIndexedIndirect(FRHIIndexBuffer* IndexBufferRHI, FRHIStructuredBuffer* ArgumentsBufferRHI, int32 DrawArgumentsIndex, uint32 NumInstances)

void FVulkanCommandListContext::RHIDrawIndexedPrimitiveIndirect(FRHIIndexBuffer* IndexBufferRHI, FRHIVertexBuffer* ArgumentBufferRHI,uint32 ArgumentOffset)

void vkCmdDraw( VkCommandBuffer uint32_t uint32_t uint32_t uint32_t commandBuffer, vertexCount, instanceCount, firstVertex, firstInstance);

void FVulkanCommandListContext::RHIDrawPrimitive(uint32 BaseVertexIndex, uint32 NumPrimitives, uint32 NumInstances)

void vkCmdDrawIndexed( VkCommandBuffer uint32_t uint32_t uint32_t int32_t uint32_t commandBuffer, indexCount, instanceCount, firstIndex, vertexOffset, firstInstance);

void FVulkanCommandListContext::RHIDrawIndexedPrimitive(FRHIIndexBuffer* IndexBufferRHI, int32 BaseVertexIndex, uint32 FirstInstance, uint32 NumVertices, uint32 StartIndex, uint32 NumPrimitives, uint32 NumInstances)

When the command is executed, primitives are assembled using the current primitive topology and indexCount vertices whose indices are retrieved from the index buffer. The index buffer is treated as an array of tightly packed unsigned integers of size defined by the vkCmdBindIndexBuffer ::indexType parameter with which the buffer was bound.

void vkCmdDrawIndirect( VkCommandBuffer VkBuffer VkDeviceSize uint32_t uint32_t commandBuffer, buffer, offset, drawCount, stride);

void FVulkanCommandListContext::RHIDrawPrimitiveIndirect(FRHIVertexBuffer* ArgumentBufferRHI, uint32 ArgumentOffset)

typedef struct VkDrawIndirectCommand { uint32_t uint32_t uint32_t uint32_t vertexCount; instanceCount; firstVertex; firstInstance; } VkDrawIndirectCommand;

void vkCmdDrawIndirectCount( VkCommandBuffer VkBuffer VkDeviceSize VkBuffer VkDeviceSize uint32_t uint32_t commandBuffer, buffer, offset, countBuffer, countBufferOffset, maxDrawCount, stride);

vkCmdDrawIndirectCount behaves similarly to vkCmdDrawIndirect except that the draw count is read by the device from a buffer during execution. The command will read an unsigned 32-bit integer from countBuffer located at countBufferOffset and use this as the draw count.

void vkCmdDrawIndexedIndirect( VkCommandBuffer VkBuffer VkDeviceSize uint32_t uint32_t commandBuffer, buffer, offset, drawCount, stride);

void FVulkanCommandListContext::RHIDrawIndexedIndirect(FRHIIndexBuffer* IndexBufferRHI, FRHIStructuredBuffer* ArgumentsBufferRHI, int32 DrawArgumentsIndex, uint32 NumInstances)

void FVulkanCommandListContext::RHIDrawIndexedPrimitiveIndirect(FRHIIndexBuffer* IndexBufferRHI, FRHIVertexBuffer* ArgumentBufferRHI,uint32 ArgumentOffset)

void vkCmdDrawIndexedIndirectCount( VkCommandBuffer VkBuffer VkDeviceSize VkBuffer VkDeviceSize uint32_t uint32_t commandBuffer, buffer, offset, countBuffer, countBufferOffset, maxDrawCount, stride);

vkCmdDrawIndexedIndirectCount behaves similarly to vkCmdDrawIndexedIndirect except that the draw count is read by the device from a buffer during execution. The command will read an unsigned 32-bit integer from countBuffer located at countBufferOffset and use this as the draw count.

本节教程就到此结束,希望大家继续阅读我之后的教程。

谢谢大家,再见!


原创技术文章,撰写不易,转载请注明出处:电子设备中的画家|王烁 于 2021 年 5 月 10 日发表,原文链接(http://geekfaner.com/shineengine/blog20_Vulkanv1.2_6.html)