renamed to IndexBufferAccess from IndexBufferData
This commit is contained in:
parent
3bbbe18c40
commit
9c6c37c07a
@ -226,8 +226,8 @@ public:
|
||||
cb->BindDescriptorSets(ri->GetMaterial());
|
||||
cb->BindVBO(ri);
|
||||
|
||||
if (vid->index_buffer->buffer)
|
||||
cb->DrawIndexed(vid->index_buffer->buffer->GetCount());
|
||||
if (vid->ib_access->buffer)
|
||||
cb->DrawIndexed(vid->ib_access->buffer->GetCount());
|
||||
else
|
||||
cb->Draw(vid->vertex_count);
|
||||
|
||||
|
@ -12,7 +12,7 @@ namespace hgl
|
||||
class MaterialInstance;
|
||||
class GPUDevice;
|
||||
struct VertexInputData;
|
||||
struct IndexBufferData;
|
||||
struct IndexBufferAccess;
|
||||
|
||||
struct RenderNode
|
||||
{
|
||||
|
@ -59,7 +59,7 @@ using VAB=VertexAttribBuffer;
|
||||
|
||||
class IndexBuffer;
|
||||
|
||||
struct IndexBufferData
|
||||
struct IndexBufferAccess
|
||||
{
|
||||
IndexBuffer *buffer=nullptr;
|
||||
VkDeviceSize offset=0;
|
||||
|
@ -170,7 +170,7 @@ public:
|
||||
return(true);
|
||||
}
|
||||
|
||||
void BindIBO(const IndexBufferData *);
|
||||
void BindIBO(const IndexBufferAccess *);
|
||||
|
||||
bool BindVBO(Renderable *);
|
||||
|
||||
|
@ -14,12 +14,10 @@ struct PrimitiveData
|
||||
uint32_t vertex_count;
|
||||
|
||||
uint32_t va_count;
|
||||
|
||||
|
||||
|
||||
VABAccess *vab_list;
|
||||
|
||||
IndexBufferData index_buffer_data;
|
||||
IndexBufferAccess ib_access;
|
||||
|
||||
AABB BoundingBox;
|
||||
};
|
||||
@ -38,7 +36,7 @@ protected:
|
||||
|
||||
VABAccessMap buffer_list;
|
||||
|
||||
IndexBufferData index_buffer_data;
|
||||
IndexBufferAccess ib_access;
|
||||
|
||||
AABB BoundingBox;
|
||||
|
||||
@ -78,7 +76,7 @@ public:
|
||||
bool GetVABAccess (const AnsiString &,VABAccess *);
|
||||
const int GetBufferCount ()const {return buffer_list.GetCount();}
|
||||
|
||||
const IndexBufferData * GetIndexBufferData ()const {return &index_buffer_data;}
|
||||
const IndexBufferAccess * GetIndexBufferAccess()const {return &ib_access;}
|
||||
};//class Primitive
|
||||
VK_NAMESPACE_END
|
||||
#endif//HGL_GRAPH_VULKAN_PRIMITIVE_INCLUDE
|
||||
|
@ -17,11 +17,11 @@ struct VertexInputData
|
||||
|
||||
uint32_t vertex_count;
|
||||
|
||||
const IndexBufferData *index_buffer;
|
||||
const IndexBufferAccess *ib_access;
|
||||
|
||||
public:
|
||||
|
||||
VertexInputData(const uint32_t,const uint32_t,const IndexBufferData *);
|
||||
VertexInputData(const uint32_t,const uint32_t,const IndexBufferAccess *);
|
||||
~VertexInputData();
|
||||
|
||||
const bool Comp(const VertexInputData *vid)const
|
||||
@ -38,7 +38,7 @@ public:
|
||||
|
||||
if(vertex_count!=vid->vertex_count)return(false);
|
||||
|
||||
if(index_buffer!=vid->index_buffer)return(false);
|
||||
if(ib_access!=vid->ib_access)return(false);
|
||||
|
||||
return(true);
|
||||
}
|
||||
|
@ -1,9 +1,12 @@
|
||||
#ifndef HGL_VK_RENDERABLE_PRIMITIVE_CREATER_INCLUDE
|
||||
#ifndef HGL_VK_RENDERABLE_PRIMITIVE_CREATER_INCLUDE
|
||||
#define HGL_VK_RENDERABLE_PRIMITIVE_CREATER_INCLUDE
|
||||
|
||||
#include<hgl/graph/VKRenderResource.h>
|
||||
|
||||
VK_NAMESPACE_BEGIN
|
||||
/**
|
||||
* 可绘制图元创建器
|
||||
*/
|
||||
class RenderablePrimitiveCreater
|
||||
{
|
||||
RenderResource *rr;
|
||||
@ -50,4 +53,4 @@ public:
|
||||
}
|
||||
};//class RenderablePrimitiveCreater
|
||||
VK_NAMESPACE_END
|
||||
#endif // HGL_VK_RENDERABLE_PRIMITIVE_CREATER_INCLUDE
|
||||
#endif // HGL_VK_RENDERABLE_PRIMITIVE_CREATER_INCLUDE
|
||||
|
@ -256,7 +256,7 @@ void MaterialRenderList::Render(RenderItem *ri)
|
||||
last_vid=ri->vid;
|
||||
}
|
||||
|
||||
const IndexBufferData *ibd=last_vid->index_buffer;
|
||||
const IndexBufferAccess *ibd=last_vid->ib_access;
|
||||
|
||||
if(ibd->buffer)
|
||||
{
|
||||
|
@ -129,7 +129,7 @@ bool RenderCmdBuffer::BindDescriptorSets(Material *mtl)
|
||||
return(true);
|
||||
}
|
||||
|
||||
void RenderCmdBuffer::BindIBO(const IndexBufferData *ibd)
|
||||
void RenderCmdBuffer::BindIBO(const IndexBufferAccess *ibd)
|
||||
{
|
||||
vkCmdBindIndexBuffer( cmd_buf,
|
||||
ibd->buffer->GetBuffer(),
|
||||
@ -149,10 +149,13 @@ bool RenderCmdBuffer::BindVBO(Renderable *ri)
|
||||
|
||||
vkCmdBindVertexBuffers(cmd_buf,0,vid->binding_count,vid->buffer_list,vid->buffer_offset);
|
||||
|
||||
IndexBuffer *indices_buffer=vid->index_buffer->buffer;
|
||||
IndexBuffer *indices_buffer=vid->ib_access->buffer;
|
||||
|
||||
if(indices_buffer)
|
||||
vkCmdBindIndexBuffer(cmd_buf,indices_buffer->GetBuffer(),vid->index_buffer->offset,VkIndexType(indices_buffer->GetType()));
|
||||
vkCmdBindIndexBuffer(cmd_buf,
|
||||
indices_buffer->GetBuffer(),
|
||||
vid->ib_access->offset,
|
||||
VkIndexType(indices_buffer->GetType()));
|
||||
|
||||
return(true);
|
||||
}
|
||||
|
@ -65,8 +65,8 @@ bool Primitive::Set(IndexBuffer *ib,VkDeviceSize offset)
|
||||
{
|
||||
if(!ib)return(false);
|
||||
|
||||
index_buffer_data.buffer=ib;
|
||||
index_buffer_data.offset=offset;
|
||||
ib_access.buffer=ib;
|
||||
ib_access.offset=offset;
|
||||
|
||||
#ifdef _DEBUG
|
||||
DebugUtils *du=device->GetDebugUtils();
|
||||
|
@ -6,7 +6,7 @@
|
||||
#include<hgl/log/LogInfo.h>
|
||||
|
||||
VK_NAMESPACE_BEGIN
|
||||
VertexInputData::VertexInputData(const uint32_t c,const uint32_t vc,const IndexBufferData *ibd)
|
||||
VertexInputData::VertexInputData(const uint32_t c,const uint32_t vc,const IndexBufferAccess *iba)
|
||||
{
|
||||
binding_count=c;
|
||||
|
||||
@ -15,7 +15,7 @@ VertexInputData::VertexInputData(const uint32_t c,const uint32_t vc,const IndexB
|
||||
|
||||
vertex_count=vc;
|
||||
|
||||
index_buffer=ibd;
|
||||
ib_access=iba;
|
||||
}
|
||||
|
||||
VertexInputData::~VertexInputData()
|
||||
@ -57,7 +57,7 @@ Renderable *CreateRenderable(Primitive *prim,MaterialInstance *mi,Pipeline *p)
|
||||
|
||||
VAB *vab;
|
||||
|
||||
VertexInputData *vid=new VertexInputData(input_count,prim->GetVertexCount(),prim->GetIndexBufferData());
|
||||
VertexInputData *vid=new VertexInputData(input_count,prim->GetVertexCount(),prim->GetIndexBufferAccess());
|
||||
|
||||
const VertexInputFormat *vif=vil->GetVIFList(VertexInputGroup::Basic);
|
||||
VABAccess vad;
|
||||
|
Loading…
x
Reference in New Issue
Block a user