used VBO instead of VAB
This commit is contained in:
parent
4281839e4d
commit
af72c68ebe
@ -1 +1 @@
|
||||
Subproject commit dbc1852e400fda52b358d72e5e7d4464f0e01ae0
|
||||
Subproject commit b5b673f8a65a0c1a8b4972f81e45122bad5155a5
|
@ -101,7 +101,7 @@ private:
|
||||
Renderable *render_obj=db->CreateRenderable(VERTEX_COUNT);
|
||||
if(!render_obj)return(false);
|
||||
|
||||
if(!render_obj->Set(VAN::Position, db->CreateVAB(VF_VEC2,VERTEX_COUNT,vertex_data)))return(false);
|
||||
if(!render_obj->Set(VAN::Position, db->CreateVBO(VF_VEC2,VERTEX_COUNT,vertex_data)))return(false);
|
||||
|
||||
render_instance=db->CreateRenderableInstance(render_obj,material_instance,pipeline);
|
||||
return(true);
|
||||
|
@ -215,8 +215,8 @@ private:
|
||||
render_obj=db->CreateRenderable(tile_count);
|
||||
if(!render_obj)return(false);
|
||||
|
||||
render_obj->Set(VAN::Position,db->CreateVAB(VF_VEC4,tile_count,vertex_data));
|
||||
render_obj->Set(VAN::TexCoord,db->CreateVAB(VF_VEC4,tile_count,tex_coord_data));
|
||||
render_obj->Set(VAN::Position,db->CreateVBO(VF_VEC4,tile_count,vertex_data));
|
||||
render_obj->Set(VAN::TexCoord,db->CreateVBO(VF_VEC4,tile_count,tex_coord_data));
|
||||
|
||||
render_instance=db->CreateRenderableInstance(render_obj,material_instance,pipeline);
|
||||
|
||||
|
@ -78,7 +78,7 @@ private:
|
||||
auto render_obj=db->CreateRenderable(VERTEX_COUNT);
|
||||
if(!render_obj)return(false);
|
||||
|
||||
if(!render_obj->Set(VAN::Position,db->CreateVAB(VF_VEC2,VERTEX_COUNT,vertex_data)))return(false);
|
||||
if(!render_obj->Set(VAN::Position,db->CreateVBO(VF_VEC2,VERTEX_COUNT,vertex_data)))return(false);
|
||||
|
||||
renderable_instance=db->CreateRenderableInstance(render_obj,material_instance,pipeline);
|
||||
return(true);
|
||||
|
@ -109,8 +109,8 @@ private:
|
||||
|
||||
if(!render_obj)return(false);
|
||||
|
||||
render_obj->Set(VAN::Position,db->CreateVAB(VF_VEC4,VERTEX_COUNT,vertex_data));
|
||||
render_obj->Set(VAN::TexCoord,db->CreateVAB(VF_VEC4,VERTEX_COUNT,tex_coord_data));
|
||||
render_obj->Set(VAN::Position,db->CreateVBO(VF_VEC4,VERTEX_COUNT,vertex_data));
|
||||
render_obj->Set(VAN::TexCoord,db->CreateVBO(VF_VEC4,VERTEX_COUNT,tex_coord_data));
|
||||
|
||||
render_instance=db->CreateRenderableInstance(render_obj,material_instance,pipeline);
|
||||
|
||||
|
@ -87,8 +87,8 @@ private:
|
||||
Renderable *render_obj=db->CreateRenderable(VERTEX_COUNT);
|
||||
if(!render_obj)return(false);
|
||||
|
||||
if(!render_obj->Set(VAN::Position, db->CreateVAB(VF_VEC2,VERTEX_COUNT,vertex_data)))return(false);
|
||||
if(!render_obj->Set(VAN::Color, db->CreateVAB(VF_VEC4,VERTEX_COUNT,color_data)))return(false);
|
||||
if(!render_obj->Set(VAN::Position, db->CreateVBO(VF_VEC2,VERTEX_COUNT,vertex_data)))return(false);
|
||||
if(!render_obj->Set(VAN::Color, db->CreateVBO(VF_VEC4,VERTEX_COUNT,color_data)))return(false);
|
||||
|
||||
render_instance=db->CreateRenderableInstance(render_obj,material_instance,pipeline);
|
||||
return(true);
|
||||
|
@ -87,7 +87,7 @@ private:
|
||||
auto render_obj=db->CreateRenderable(VERTEX_COUNT);
|
||||
if(!render_obj)return(false);
|
||||
|
||||
if(!render_obj->Set(VAN::Position,db->CreateVAB(VF_VEC2,VERTEX_COUNT,vertex_data)))return(false);
|
||||
if(!render_obj->Set(VAN::Position,db->CreateVBO(VF_VEC2,VERTEX_COUNT,vertex_data)))return(false);
|
||||
if(!render_obj->Set(db->CreateIBO16(INDEX_COUNT,index_data)))return(false);
|
||||
|
||||
renderable_instance=db->CreateRenderableInstance(render_obj,material_instance,pipeline);
|
||||
|
@ -121,8 +121,8 @@ private:
|
||||
auto render_obj=db->CreateRenderable(VERTEX_COUNT);
|
||||
if(!render_obj)return(false);
|
||||
|
||||
if(!render_obj->Set(VAN::Position,db->CreateVAB(VF_VEC2,VERTEX_COUNT,vertex_data)))return(false);
|
||||
if(!render_obj->Set(VAN::TexCoord,db->CreateVAB(VF_VEC2,VERTEX_COUNT,tex_coord_data)))return(false);
|
||||
if(!render_obj->Set(VAN::Position,db->CreateVBO(VF_VEC2,VERTEX_COUNT,vertex_data)))return(false);
|
||||
if(!render_obj->Set(VAN::TexCoord,db->CreateVBO(VF_VEC2,VERTEX_COUNT,tex_coord_data)))return(false);
|
||||
if(!render_obj->Set(db->CreateIBO16(INDEX_COUNT,index_data)))return(false);
|
||||
|
||||
renderable_instance=db->CreateRenderableInstance(render_obj,material_instance,pipeline);
|
||||
|
@ -87,8 +87,8 @@ private:
|
||||
Renderable *render_obj=db->CreateRenderable(VERTEX_COUNT);
|
||||
if(!render_obj)return(false);
|
||||
|
||||
if(!render_obj->Set(VAN::Position, db->CreateVAB(VF_VEC2,VERTEX_COUNT,vertex_data)))return(false);
|
||||
if(!render_obj->Set(VAN::Color, db->CreateVAB(VF_VEC4,VERTEX_COUNT,color_data)))return(false);
|
||||
if(!render_obj->Set(VAN::Position, db->CreateVBO(VF_VEC2,VERTEX_COUNT,vertex_data)))return(false);
|
||||
if(!render_obj->Set(VAN::Color, db->CreateVBO(VF_VEC4,VERTEX_COUNT,color_data)))return(false);
|
||||
|
||||
render_instance=db->CreateRenderableInstance(render_obj,material_instance,pipeline);
|
||||
|
||||
|
@ -106,7 +106,7 @@ public:
|
||||
|
||||
cili.lunarg.standard_validation = true;
|
||||
cili.khronos.validation = true;
|
||||
//cili.RenderDoc.Capture = true;
|
||||
cili.RenderDoc.Capture = true;
|
||||
|
||||
inst=CreateInstance("VulkanTest",nullptr,&cili);
|
||||
|
||||
|
@ -13,7 +13,7 @@ namespace hgl
|
||||
AnsiString name;
|
||||
uint binding;
|
||||
VAD * data =nullptr;
|
||||
VAB * vab =nullptr;
|
||||
VBO * vbo =nullptr;
|
||||
|
||||
public:
|
||||
|
||||
|
@ -55,7 +55,7 @@ class GPUBuffer;
|
||||
struct GPUBufferData;
|
||||
|
||||
class VertexAttribBuffer;
|
||||
using VAB=VertexAttribBuffer;
|
||||
using VBO=VertexAttribBuffer;
|
||||
|
||||
class IndexBuffer;
|
||||
|
||||
|
@ -113,9 +113,9 @@ public: //Buffer相关
|
||||
GPUBuffer * CreateBuffer(VkBufferUsageFlags buf_usage, VkDeviceSize size,const void *data, SharingMode sm=SharingMode::Exclusive){return CreateBuffer(buf_usage,size,size,data,sm);}
|
||||
GPUBuffer * CreateBuffer(VkBufferUsageFlags buf_usage, VkDeviceSize size, SharingMode sm=SharingMode::Exclusive){return CreateBuffer(buf_usage,size,size,nullptr,sm);}
|
||||
|
||||
VAB * CreateVAB (VkFormat format, uint32_t count,const void *data, SharingMode sm=SharingMode::Exclusive);
|
||||
VAB * CreateVAB (VkFormat format, uint32_t count, SharingMode sm=SharingMode::Exclusive){return CreateVAB(format,count,nullptr,sm);}
|
||||
VAB * CreateVAB (const VAD *vad, SharingMode sm=SharingMode::Exclusive){return CreateVAB(vad->GetVulkanFormat(),vad->GetCount(),vad->GetData(),sm);}
|
||||
VBO * CreateVBO (VkFormat format, uint32_t count,const void *data, SharingMode sm=SharingMode::Exclusive);
|
||||
VBO * CreateVBO (VkFormat format, uint32_t count, SharingMode sm=SharingMode::Exclusive){return CreateVBO(format,count,nullptr,sm);}
|
||||
VBO * CreateVBO (const VAD *vad, SharingMode sm=SharingMode::Exclusive){return CreateVBO(vad->GetVulkanFormat(),vad->GetCount(),vad->GetData(),sm);}
|
||||
|
||||
IndexBuffer * CreateIBO (IndexType type, uint32_t count,const void * data, SharingMode sm=SharingMode::Exclusive);
|
||||
IndexBuffer * CreateIBO16 ( uint32_t count,const uint16 *data, SharingMode sm=SharingMode::Exclusive){return CreateIBO(IndexType::U16, count,(void *)data,sm);}
|
||||
|
@ -15,7 +15,7 @@ struct MaterialData
|
||||
MaterialDescriptorSets *mds;
|
||||
|
||||
VertexShaderModule *vertex_sm;
|
||||
VertexAttributeBinding *vab;
|
||||
VertexAttributeBinding *vbo;
|
||||
|
||||
List<VkPipelineShaderStageCreateInfo> shader_stage_list;
|
||||
|
||||
@ -63,7 +63,7 @@ public:
|
||||
const VkPipelineLayout GetPipelineLayout ()const;
|
||||
const PipelineLayoutData * GetPipelineLayoutData ()const{return data->pipeline_layout_data;}
|
||||
|
||||
const VertexAttributeBinding * GetVAB ()const{return data->vab;}
|
||||
const VertexAttributeBinding * GetVBO ()const{return data->vbo;}
|
||||
|
||||
public:
|
||||
|
||||
|
@ -64,9 +64,9 @@ public: //Add
|
||||
|
||||
public: // VBO/VAO
|
||||
|
||||
VAB *CreateVAB(VkFormat format,uint32_t count,const void *data,SharingMode sm=SharingMode::Exclusive);
|
||||
VAB *CreateVAB(VkFormat format,uint32_t count,SharingMode sm=SharingMode::Exclusive){return CreateVAB(format,count,nullptr,sm);}
|
||||
VAB *CreateVAB(const VAD *vad,SharingMode sm=SharingMode::Exclusive){return CreateVAB(vad->GetVulkanFormat(),vad->GetCount(),vad->GetData(),sm);}
|
||||
VBO *CreateVBO(VkFormat format,uint32_t count,const void *data,SharingMode sm=SharingMode::Exclusive);
|
||||
VBO *CreateVBO(VkFormat format,uint32_t count,SharingMode sm=SharingMode::Exclusive){return CreateVBO(format,count,nullptr,sm);}
|
||||
VBO *CreateVBO(const VAD *vad,SharingMode sm=SharingMode::Exclusive){return CreateVBO(vad->GetVulkanFormat(),vad->GetCount(),vad->GetData(),sm);}
|
||||
|
||||
#define SCENE_DB_CREATE_FUNC(name) GPUBuffer *Create##name(VkDeviceSize size,void *data,SharingMode sm=SharingMode::Exclusive); \
|
||||
GPUBuffer *Create##name(VkDeviceSize size,SharingMode sm=SharingMode::Exclusive);
|
||||
|
@ -16,7 +16,7 @@ class Renderable
|
||||
{
|
||||
struct VABData
|
||||
{
|
||||
VAB *buf;
|
||||
VBO *buf;
|
||||
VkDeviceSize offset;
|
||||
|
||||
public:
|
||||
@ -56,7 +56,7 @@ public:
|
||||
void SetBoundingBox(const AABB &aabb){BoundingBox=aabb;}
|
||||
const AABB &GetBoundingBox()const {return BoundingBox;}
|
||||
|
||||
bool Set(const UTF8String &name,VAB *vb,VkDeviceSize offset=0);
|
||||
bool Set(const UTF8String &name,VBO *vb,VkDeviceSize offset=0);
|
||||
|
||||
bool Set(IndexBuffer *ib,VkDeviceSize offset=0)
|
||||
{
|
||||
@ -78,7 +78,7 @@ public:
|
||||
return draw_count;
|
||||
}
|
||||
|
||||
VAB * GetVAB (const UTF8String &,VkDeviceSize *);
|
||||
VBO * GetVBO (const UTF8String &,VkDeviceSize *);
|
||||
VkBuffer GetBuffer (const UTF8String &,VkDeviceSize *);
|
||||
const int GetBufferCount ()const {return buffer_list.GetCount();}
|
||||
|
||||
|
@ -38,7 +38,7 @@ namespace hgl
|
||||
}
|
||||
};//class VertexAttribBuffer:public GPUBuffer
|
||||
|
||||
using VAB=VertexAttribBuffer;
|
||||
using VBO=VertexAttribBuffer;
|
||||
}//namespace graph
|
||||
}//namespace hgl
|
||||
#endif//HGL_GRAPH_VULKAN_VERTEX_ATTRIB_BUFFER_INCLUDE
|
||||
|
@ -141,7 +141,7 @@ namespace hgl
|
||||
protected:
|
||||
|
||||
TextRenderable *text_render_obj;
|
||||
MemBlock<float> vertex;
|
||||
MemBlock<int16> vertex;
|
||||
MemBlock<float> tex_coord;
|
||||
|
||||
public:
|
||||
|
@ -11,13 +11,13 @@ namespace hgl
|
||||
*/
|
||||
class TextRenderable:public Renderable
|
||||
{
|
||||
GPUDevice * device;
|
||||
GPUDevice * device;
|
||||
Material * mtl;
|
||||
|
||||
uint max_count; ///<缓冲区最大容量
|
||||
|
||||
VAB * vab_position;
|
||||
VAB * vab_tex_coord;
|
||||
VBO * vbo_position;
|
||||
VBO * vbo_tex_coord;
|
||||
|
||||
public:
|
||||
|
||||
@ -28,7 +28,7 @@ namespace hgl
|
||||
|
||||
void SetCharCount (const uint);
|
||||
|
||||
bool WriteVertex (const float *fp);
|
||||
bool WriteVertex (const int16 *fp);
|
||||
bool WriteTexCoord (const float *fp);
|
||||
};//class TextRenderable:public Renderable
|
||||
}//namespace graph
|
||||
|
2
res
2
res
@ -1 +1 @@
|
||||
Subproject commit c279762326b8ca91368cb4a607230de5d9d3ff79
|
||||
Subproject commit 10431c5bb52464f73911c503e236baa3d0663037
|
@ -39,7 +39,7 @@ namespace hgl
|
||||
ssb->name =name;
|
||||
ssb->binding=ss->binding;
|
||||
|
||||
ssb->vab =nullptr;
|
||||
ssb->vbo =nullptr;
|
||||
|
||||
vab_maps.Add(name,ssb);
|
||||
|
||||
@ -85,7 +85,7 @@ namespace hgl
|
||||
ssb->name =name;
|
||||
ssb->binding=ss->binding;
|
||||
|
||||
ssb->vab =db->CreateVAB(ss->format,vertices_number,data);
|
||||
ssb->vbo =db->CreateVBO(ss->format,vertices_number,data);
|
||||
|
||||
vab_maps.Add(name,ssb);
|
||||
|
||||
@ -120,10 +120,10 @@ namespace hgl
|
||||
const auto *sp=vab_maps.GetDataList();
|
||||
for(uint i=0;i<si_count;i++)
|
||||
{
|
||||
if((*sp)->right->vab)
|
||||
render_obj->Set((*sp)->left,(*sp)->right->vab);
|
||||
if((*sp)->right->vbo)
|
||||
render_obj->Set((*sp)->left,(*sp)->right->vbo);
|
||||
else
|
||||
render_obj->Set((*sp)->left,db->CreateVAB((*sp)->right->data));
|
||||
render_obj->Set((*sp)->left,db->CreateVBO((*sp)->right->data));
|
||||
|
||||
++sp;
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ bool GPUDevice::CreateBuffer(GPUBufferData *buf,VkBufferUsageFlags buf_usage,VkD
|
||||
return(false);
|
||||
}
|
||||
|
||||
VAB *GPUDevice::CreateVAB(VkFormat format,uint32_t count,const void *data,SharingMode sharing_mode)
|
||||
VBO *GPUDevice::CreateVBO(VkFormat format,uint32_t count,const void *data,SharingMode sharing_mode)
|
||||
{
|
||||
const uint32_t stride=GetStrideByFormat(format);
|
||||
|
||||
|
@ -378,9 +378,16 @@ namespace
|
||||
std::cout<<" deviceType: "<<DeviceTypeString[pdp.deviceType]<<std::endl;
|
||||
std::cout<<" deviceName: "<<pdp.deviceName<<std::endl;
|
||||
|
||||
AnsiString uuid=VkUUID2String<char>(pdp.pipelineCacheUUID);
|
||||
if(memcmp(pdp.pipelineCacheUUID,"rdoc",4)==0)
|
||||
{
|
||||
std::cout<<"pipelineCahceUUID: "<<(char *)pdp.pipelineCacheUUID<<std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
AnsiString uuid=VkUUID2String<char>(pdp.pipelineCacheUUID);
|
||||
|
||||
std::cout<<"pipelineCahceUUID: "<<uuid.c_str()<<std::endl;
|
||||
std::cout<<"pipelineCahceUUID: "<<uuid.c_str()<<std::endl;
|
||||
}
|
||||
|
||||
DebugOut(pdp.limits);
|
||||
}
|
||||
|
@ -104,7 +104,7 @@ Material *GPUDevice::CreateMaterial(const UTF8String &mtl_name,ShaderModuleMap *
|
||||
data->shader_maps =shader_maps;
|
||||
data->mds =mds;
|
||||
data->vertex_sm =(VertexShaderModule *)vsm;
|
||||
data->vab =data->vertex_sm->CreateVertexAttributeBinding();
|
||||
data->vbo =data->vertex_sm->CreateVertexAttributeBinding();
|
||||
|
||||
CreateShaderStageList(data->shader_stage_list,shader_maps);
|
||||
|
||||
|
@ -9,10 +9,10 @@ MaterialData::~MaterialData()
|
||||
SAFE_CLEAR(mp.r);
|
||||
SAFE_CLEAR(mp.g);
|
||||
|
||||
if(vab)
|
||||
if(vbo)
|
||||
{
|
||||
vertex_sm->Release(vab);
|
||||
delete vab;
|
||||
vertex_sm->Release(vbo);
|
||||
delete vbo;
|
||||
}
|
||||
|
||||
delete shader_maps;
|
||||
|
@ -27,13 +27,13 @@ Pipeline *RenderPass::CreatePipeline(const Material *material,PipelineData *data
|
||||
{
|
||||
VkPipeline graphicsPipeline;
|
||||
|
||||
const VertexAttributeBinding *vab=material->GetVAB();
|
||||
const VertexAttributeBinding *vbo=material->GetVBO();
|
||||
|
||||
data->InitVertexInputState( material->GetStageCount(),
|
||||
material->GetStages(),
|
||||
vab->GetVertexAttrCount(),
|
||||
vab->GetVertexBindingList(),
|
||||
vab->GetVertexAttributeList());
|
||||
vbo->GetVertexAttrCount(),
|
||||
vbo->GetVertexBindingList(),
|
||||
vbo->GetVertexAttributeList());
|
||||
|
||||
data->SetColorAttachments(color_formats.GetCount());
|
||||
|
||||
|
@ -5,9 +5,9 @@
|
||||
#include<hgl/graph/VKVertexAttribBuffer.h>
|
||||
|
||||
VK_NAMESPACE_BEGIN
|
||||
VAB *RenderResource::CreateVAB(VkFormat format,uint32_t count,const void *data,SharingMode sharing_mode)
|
||||
VBO *RenderResource::CreateVBO(VkFormat format,uint32_t count,const void *data,SharingMode sharing_mode)
|
||||
{
|
||||
VAB *vb=device->CreateVAB(format,count,data,sharing_mode);
|
||||
VBO *vb=device->CreateVBO(format,count,data,sharing_mode);
|
||||
|
||||
if(!vb)
|
||||
return(nullptr);
|
||||
|
@ -22,21 +22,21 @@ VK_NAMESPACE_BEGIN
|
||||
// return(true);
|
||||
//}
|
||||
|
||||
bool Renderable::Set(const UTF8String &name,VAB *vab,VkDeviceSize offset)
|
||||
bool Renderable::Set(const UTF8String &name,VBO *vbo,VkDeviceSize offset)
|
||||
{
|
||||
if(!vab)return(false);
|
||||
if(!vbo)return(false);
|
||||
if(buffer_list.KeyExist(name))return(false);
|
||||
|
||||
VABData bd;
|
||||
|
||||
bd.buf=vab;
|
||||
bd.buf=vbo;
|
||||
bd.offset=offset;
|
||||
|
||||
buffer_list.Add(name,bd);
|
||||
return(true);
|
||||
}
|
||||
|
||||
VAB *Renderable::GetVAB(const UTF8String &name,VkDeviceSize *offset)
|
||||
VBO *Renderable::GetVBO(const UTF8String &name,VkDeviceSize *offset)
|
||||
{
|
||||
if(!offset)return(nullptr);
|
||||
if(name.IsEmpty())return(nullptr);
|
||||
@ -54,9 +54,9 @@ VAB *Renderable::GetVAB(const UTF8String &name,VkDeviceSize *offset)
|
||||
|
||||
VkBuffer Renderable::GetBuffer(const UTF8String &name,VkDeviceSize *offset)
|
||||
{
|
||||
VAB *vab=GetVAB(name,offset);
|
||||
VBO *vbo=GetVBO(name,offset);
|
||||
|
||||
if(vab)return vab->GetBuffer();
|
||||
if(vbo)return vbo->GetBuffer();
|
||||
|
||||
return(VK_NULL_HANDLE);
|
||||
}
|
||||
|
@ -6,7 +6,6 @@
|
||||
#include<hgl/util/hash/Hash.h>
|
||||
|
||||
VK_NAMESPACE_BEGIN
|
||||
|
||||
using namespace util;
|
||||
|
||||
RenderableInstance::RenderableInstance(Renderable *r,MaterialInstance *mi,Pipeline *p,const uint32_t count,VkBuffer *bl,VkDeviceSize *bs)
|
||||
@ -57,7 +56,7 @@ RenderableInstance *CreateRenderableInstance(Renderable *r,MaterialInstance *mi,
|
||||
|
||||
ShaderStage **ss=ssl.GetData();
|
||||
|
||||
VAB *vab;
|
||||
VBO *vbo;
|
||||
const VkVertexInputBindingDescription *desc;
|
||||
const VkVertexInputAttributeDescription *attr;
|
||||
|
||||
@ -66,35 +65,35 @@ RenderableInstance *CreateRenderableInstance(Renderable *r,MaterialInstance *mi,
|
||||
desc=vsm->GetDesc(i);
|
||||
attr=vsm->GetAttr(i);
|
||||
|
||||
vab=r->GetVAB((*ss)->name,buffer_size+i);
|
||||
vbo=r->GetVBO((*ss)->name,buffer_size+i);
|
||||
|
||||
if(!vab)
|
||||
if(!vbo)
|
||||
{
|
||||
LOG_ERROR("[FATAL ERROR] can't find VAB \""+(*ss)->name+"\" in Material: "+mtl->GetName());
|
||||
LOG_ERROR("[FATAL ERROR] can't find VBO \""+(*ss)->name+"\" in Material: "+mtl->GetName());
|
||||
return(nullptr);
|
||||
}
|
||||
|
||||
if(vab->GetFormat()!=attr->format)
|
||||
if(vbo->GetFormat()!=attr->format)
|
||||
{
|
||||
LOG_ERROR( "[FATAL ERROR] VAB \""+(*ss)->name+
|
||||
LOG_ERROR( "[FATAL ERROR] VBO \""+(*ss)->name+
|
||||
UTF8String("\" format can't match Renderable, Material(")+mtl->GetName()+
|
||||
UTF8String(") Format(")+GetVulkanFormatName(attr->format)+
|
||||
UTF8String("), VAB Format(")+GetVulkanFormatName(vab->GetFormat())+
|
||||
UTF8String("), VBO Format(")+GetVulkanFormatName(vbo->GetFormat())+
|
||||
")");
|
||||
return(nullptr);
|
||||
}
|
||||
|
||||
if(vab->GetStride()!=desc->stride)
|
||||
if(vbo->GetStride()!=desc->stride)
|
||||
{
|
||||
LOG_ERROR( "[FATAL ERROR] VAB \""+(*ss)->name+
|
||||
LOG_ERROR( "[FATAL ERROR] VBO \""+(*ss)->name+
|
||||
UTF8String("\" stride can't match Renderable, Material(")+mtl->GetName()+
|
||||
UTF8String(") stride(")+UTF8String::valueOf(desc->stride)+
|
||||
UTF8String("), VAB stride(")+UTF8String::valueOf(vab->GetStride())+
|
||||
UTF8String("), VBO stride(")+UTF8String::valueOf(vbo->GetStride())+
|
||||
")");
|
||||
return(nullptr);
|
||||
}
|
||||
|
||||
buffer_list[i]=vab->GetBuffer();
|
||||
buffer_list[i]=vbo->GetBuffer();
|
||||
|
||||
++ss;
|
||||
}
|
||||
|
@ -173,7 +173,7 @@ namespace hgl
|
||||
int cur_size=0;
|
||||
int left=0,top=0;
|
||||
|
||||
float *tp=vertex;
|
||||
int16 *tp=vertex;
|
||||
float *tcp=tex_coord;
|
||||
|
||||
for(int i=0;i<count;i++)
|
||||
|
@ -14,14 +14,14 @@ namespace hgl
|
||||
|
||||
max_count=0;
|
||||
|
||||
vab_position=nullptr;
|
||||
vab_tex_coord=nullptr;
|
||||
vbo_position=nullptr;
|
||||
vbo_tex_coord=nullptr;
|
||||
}
|
||||
|
||||
TextRenderable::~TextRenderable()
|
||||
{
|
||||
SAFE_CLEAR(vab_tex_coord);
|
||||
SAFE_CLEAR(vab_position);
|
||||
SAFE_CLEAR(vbo_tex_coord);
|
||||
SAFE_CLEAR(vbo_position);
|
||||
}
|
||||
|
||||
void TextRenderable::SetCharCount(const uint cc)
|
||||
@ -32,23 +32,23 @@ namespace hgl
|
||||
max_count=power_to_2(cc);
|
||||
|
||||
{
|
||||
if(vab_position)
|
||||
delete vab_position;
|
||||
if(vbo_position)
|
||||
delete vbo_position;
|
||||
|
||||
vab_position =device->CreateVAB(VF_VEC4,max_count);
|
||||
Set(VAN::Position,vab_position);
|
||||
vbo_position =device->CreateVBO(PF_RGBA16I,max_count);
|
||||
Set(VAN::Position,vbo_position);
|
||||
}
|
||||
|
||||
{
|
||||
if(vab_tex_coord)
|
||||
delete vab_tex_coord;
|
||||
if(vbo_tex_coord)
|
||||
delete vbo_tex_coord;
|
||||
|
||||
vab_tex_coord =device->CreateVAB(VF_VEC4,max_count);
|
||||
Set(VAN::TexCoord,vab_tex_coord);
|
||||
vbo_tex_coord =device->CreateVBO(VF_VEC4,max_count);
|
||||
Set(VAN::TexCoord,vbo_tex_coord);
|
||||
}
|
||||
}
|
||||
|
||||
bool TextRenderable::WriteVertex (const float *fp){if(!fp)return(false);if(!vab_position )return(false);return vab_position ->Write(fp,draw_count*4*sizeof(float));}
|
||||
bool TextRenderable::WriteTexCoord (const float *fp){if(!fp)return(false);if(!vab_tex_coord)return(false);return vab_tex_coord ->Write(fp,draw_count*4*sizeof(float));}
|
||||
bool TextRenderable::WriteVertex (const int16 *fp){if(!fp)return(false);if(!vbo_position )return(false);return vbo_position ->Write(fp,draw_count*4*sizeof(int16));}
|
||||
bool TextRenderable::WriteTexCoord (const float *fp){if(!fp)return(false);if(!vbo_tex_coord)return(false);return vbo_tex_coord ->Write(fp,draw_count*4*sizeof(float));}
|
||||
}//namespace graph
|
||||
}//namespace hgl
|
||||
|
Loading…
x
Reference in New Issue
Block a user