added BindVBO and BindIBO functions at VKCommandBuffer.h/.cpp
This commit is contained in:
parent
34b7937ee2
commit
12e64d7ce0
@ -155,6 +155,13 @@ public:
|
||||
void PushConstants(const void *data,const uint32_t size) {vkCmdPushConstants(cmd_buf,pipeline_layout,VK_SHADER_STAGE_VERTEX_BIT,0, size,data);}
|
||||
void PushConstants(const void *data,const uint32_t offset,const uint32_t size) {vkCmdPushConstants(cmd_buf,pipeline_layout,VK_SHADER_STAGE_VERTEX_BIT,offset, size,data);}
|
||||
|
||||
void BindVBO(const uint32_t first,const uint32_t count,const VkBuffer *vbo,const VkDeviceSize *offsets)
|
||||
{
|
||||
vkCmdBindVertexBuffers(cmd_buf,first,count,vbo,offsets);
|
||||
}
|
||||
|
||||
void BindIBO(const IndexBufferData *);
|
||||
|
||||
bool BindVBO(Renderable *);
|
||||
|
||||
void SetViewport (uint32_t first,uint32_t count,const VkViewport *vp) {vkCmdSetViewport(cmd_buf,first,count,vp);}
|
||||
|
@ -133,32 +133,30 @@ bool RenderCmdBuffer::BindDescriptorSets(Renderable *ri)
|
||||
return(true);
|
||||
}
|
||||
|
||||
void RenderCmdBuffer::BindIBO(const IndexBufferData *ibd)
|
||||
{
|
||||
vkCmdBindIndexBuffer( cmd_buf,
|
||||
ibd->buffer->GetBuffer(),
|
||||
ibd->offset,
|
||||
VkIndexType(ibd->buffer->GetType()));
|
||||
}
|
||||
|
||||
bool RenderCmdBuffer::BindVBO(Renderable *ri)
|
||||
{
|
||||
if(!ri)
|
||||
return(false);
|
||||
|
||||
uint count=0;
|
||||
|
||||
ENUM_CLASS_FOR(VertexInputGroup,uint,i)
|
||||
{
|
||||
const VertexInputData *vid=ri->GetVertexInputData(VertexInputGroup(i));
|
||||
const VertexInputData *vid=ri->GetVertexInputData();
|
||||
|
||||
if(vid->binding_count<=0)
|
||||
continue;
|
||||
|
||||
vkCmdBindVertexBuffers(cmd_buf,vid->first_binding,vid->binding_count,vid->buffer_list,vid->buffer_offset);
|
||||
|
||||
count+=vid->binding_count;
|
||||
}
|
||||
|
||||
if(count==0)
|
||||
return(false);
|
||||
|
||||
IndexBuffer *indices_buffer=ri->GetIndexBuffer();
|
||||
vkCmdBindVertexBuffers(cmd_buf,0,vid->binding_count,vid->buffer_list,vid->buffer_offset);
|
||||
|
||||
IndexBuffer *indices_buffer=vid->index_buffer->buffer;
|
||||
|
||||
if(indices_buffer)
|
||||
vkCmdBindIndexBuffer(cmd_buf,indices_buffer->GetBuffer(),ri->GetIndexBufferOffset(),VkIndexType(indices_buffer->GetType()));
|
||||
vkCmdBindIndexBuffer(cmd_buf,indices_buffer->GetBuffer(),vid->index_buffer->offset,VkIndexType(indices_buffer->GetType()));
|
||||
|
||||
return(true);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user