move the VBOAccessData to VKVertexAttribBuffer.h from VK.h
This commit is contained in:
parent
fff7fd3af0
commit
af8f62ddb4
@ -59,18 +59,6 @@ struct DeviceBufferData;
|
||||
class VertexAttribBuffer;
|
||||
using VBO=VertexAttribBuffer;
|
||||
|
||||
struct VBOAccessData
|
||||
{
|
||||
VBO *buf;
|
||||
VkDeviceSize offset;
|
||||
|
||||
public:
|
||||
|
||||
CompOperatorMemcmp(const VBOAccessData &);
|
||||
};//struct VBOAccessData
|
||||
|
||||
using VBOAccessMap=Map<AnsiString,VBOAccessData>;
|
||||
|
||||
class IndexBuffer;
|
||||
|
||||
struct IndexBufferData
|
||||
|
@ -31,9 +31,24 @@ namespace hgl
|
||||
const VkFormat GetFormat()const { return format; }
|
||||
const uint32_t GetStride()const { return stride; }
|
||||
const uint32_t GetCount ()const { return count; }
|
||||
|
||||
const VkDeviceSize GetBytes()const { return stride*count; }
|
||||
};//class VertexAttribBuffer:public DeviceBuffer
|
||||
|
||||
using VBO=VertexAttribBuffer;
|
||||
|
||||
struct VBOAccessData
|
||||
{
|
||||
VBO *vbo;
|
||||
VkDeviceSize offset;
|
||||
VkDeviceSize size;
|
||||
|
||||
public:
|
||||
|
||||
CompOperatorMemcmp(const VBOAccessData &);
|
||||
};//class VBOAccessData
|
||||
|
||||
using VBOAccessMap=Map<AnsiString,VBOAccessData>;
|
||||
}//namespace graph
|
||||
}//namespace hgl
|
||||
#endif//HGL_GRAPH_VULKAN_VERTEX_ATTRIB_BUFFER_INCLUDE
|
||||
|
@ -60,17 +60,18 @@ Renderable *CreateRenderable(Primitive *prim,MaterialInstance *mi,Pipeline *p)
|
||||
VertexInputData *vid=new VertexInputData(input_count,prim->GetVertexCount(),prim->GetIndexBufferData());
|
||||
|
||||
const VertexInputFormat *vif=vil->GetFormatList(VertexInputGroup::Basic);
|
||||
VBOAccessData vad;
|
||||
|
||||
for(uint i=0;i<input_count;i++)
|
||||
{
|
||||
vbo=prim->GetVBO(vif->name,vid->buffer_offset+i);
|
||||
|
||||
if(!vbo)
|
||||
if(!prim->GetVBOAccessData(vif->name,&vad))
|
||||
{
|
||||
LOG_ERROR("[FATAL ERROR] not found VBO \""+AnsiString(vif->name)+"\" in Material: "+mtl_name);
|
||||
return(nullptr);
|
||||
}
|
||||
|
||||
vbo=vad.vbo;
|
||||
|
||||
if(vbo->GetFormat()!=vif->format)
|
||||
{
|
||||
LOG_ERROR( "[FATAL ERROR] VBO \""+UTF8String(vif->name)+
|
||||
@ -91,6 +92,7 @@ Renderable *CreateRenderable(Primitive *prim,MaterialInstance *mi,Pipeline *p)
|
||||
return(nullptr);
|
||||
}
|
||||
|
||||
vid->buffer_offset[i]=vad.offset;
|
||||
vid->buffer_list[i]=vbo->GetBuffer();
|
||||
++vif;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user