Added RenderCmdBuffer::Draw(const VertexInputData *)

This commit is contained in:
hyzboy 2024-04-26 00:41:53 +08:00
parent 9c6c37c07a
commit a1bf9336a3
4 changed files with 13 additions and 6 deletions

View File

@ -225,12 +225,7 @@ public:
cb->BindPipeline(ri->GetPipeline());
cb->BindDescriptorSets(ri->GetMaterial());
cb->BindVBO(ri);
if (vid->ib_access->buffer)
cb->DrawIndexed(vid->ib_access->buffer->GetCount());
else
cb->Draw(vid->vertex_count);
cb->Draw(vid);
cb->EndRenderPass();
cb->End();

View File

@ -54,6 +54,8 @@ class DeviceMemory;
class DeviceBuffer;
struct DeviceBufferData;
struct VertexInputData;
class VertexAttribBuffer;
using VAB=VertexAttribBuffer;

View File

@ -200,6 +200,8 @@ public: //draw
void DrawIndirect (VkBuffer buf, uint32_t drawCount,uint32_t stride=sizeof(VkDrawIndirectCommand )){return DrawIndirect( buf,0,drawCount,stride);}
void DrawIndexedIndirect(VkBuffer buf, uint32_t drawCount,uint32_t stride=sizeof(VkDrawIndexedIndirectCommand )){return DrawIndexedIndirect( buf,0,drawCount,stride);}
void Draw (const VertexInputData *vid);
public: //dynamic state
};//class RenderCmdBuffer:public GPUCmdBuffer

View File

@ -183,4 +183,12 @@ void RenderCmdBuffer::DrawIndexedIndirect( VkBuffer buffer,
for(uint32_t i=0;i<drawCount;i++)
vkCmdDrawIndexedIndirect(cmd_buf,buffer,offset+i*stride,1,stride);
}
void RenderCmdBuffer::Draw(const VertexInputData *vid)
{
if (vid->ib_access->buffer)
DrawIndexed(vid->ib_access->buffer->GetCount());
else
Draw(vid->vertex_count);
}
VK_NAMESPACE_END