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