fixed draw_triangle_in_NDC sample and other about codes.

This commit is contained in:
2024-05-31 22:04:02 +08:00
parent 90152ca74e
commit 611a9fe61d
7 changed files with 19 additions and 13 deletions

View File

@@ -140,7 +140,7 @@ void RenderCmdBuffer::BindIBO(IndexBuffer *ibo,const VkDeviceSize byte_offset)
VkIndexType(ibo->GetType()));
}
bool RenderCmdBuffer::BindRenderBuffer(const PrimitiveDataBuffer *pdb)
bool RenderCmdBuffer::BindDataBuffer(const PrimitiveDataBuffer *pdb)
{
if(!pdb)
return(false);
@@ -152,7 +152,7 @@ bool RenderCmdBuffer::BindRenderBuffer(const PrimitiveDataBuffer *pdb)
0, //first binding
pdb->vab_count,
pdb->vab_list,
nullptr); //vab byte offsets
pdb->vab_offset); //vab byte offsets
if(pdb->ibo)
BindIBO(pdb->ibo);

View File

@@ -12,6 +12,7 @@ PrimitiveDataBuffer::PrimitiveDataBuffer(const uint32_t c,IndexBuffer *ib,Vertex
vab_count=c;
vab_list=hgl_zero_new<VkBuffer>(vab_count);
vab_offset=hgl_zero_new<VkDeviceSize>(vab_count);
ibo=ib;
vdm=_vdm;
@@ -19,6 +20,7 @@ PrimitiveDataBuffer::PrimitiveDataBuffer(const uint32_t c,IndexBuffer *ib,Vertex
PrimitiveDataBuffer::~PrimitiveDataBuffer()
{
delete[] vab_offset;
delete[] vab_list;
}
@@ -34,6 +36,7 @@ const bool PrimitiveDataBuffer::Comp(const PrimitiveDataBuffer *pdb)const
for(uint32_t i=0;i<vab_count;i++)
{
if(vab_list[i]!=pdb->vab_list[i])return(false);
if(vab_offset[i]!=pdb->vab_offset[i])return(false);
}
if(ibo!=pdb->ibo)
@@ -108,6 +111,7 @@ Renderable *CreateRenderable(Primitive *prim,MaterialInstance *mi,Pipeline *p)
}
pdb->vab_list[i]=vab->GetBuffer();
pdb->vab_offset[i]=0;
++vif;
}