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