update RenderAssignBuffer,but can't run.
This commit is contained in:
parent
4208e47534
commit
00d2677066
@ -76,8 +76,9 @@ public:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
const uint32_t GetMIDataBytes ()const{return mi_data_bytes;}
|
const bool HasMI ()const{return !mi_data_bytes;}
|
||||||
const uint32_t GetMIMaxCount ()const{return mi_max_count;}
|
const uint32_t GetMIDataBytes ()const{return mi_data_bytes;}
|
||||||
|
const uint32_t GetMIMaxCount ()const{return mi_max_count;}
|
||||||
|
|
||||||
void ReleaseMI(int); ///<释放材质实例
|
void ReleaseMI(int); ///<释放材质实例
|
||||||
void *GetMIData(int); ///<取得指定ID号的材质实例数据访问指针
|
void *GetMIData(int); ///<取得指定ID号的材质实例数据访问指针
|
||||||
|
@ -91,7 +91,9 @@ void MaterialRenderList::End()
|
|||||||
|
|
||||||
if(node_count<=0)return;
|
if(node_count<=0)return;
|
||||||
|
|
||||||
StatMI();
|
if(mtl->HasMI())
|
||||||
|
StatMI();
|
||||||
|
|
||||||
Stat();
|
Stat();
|
||||||
|
|
||||||
//写入LocalToWorld数据
|
//写入LocalToWorld数据
|
||||||
@ -116,6 +118,8 @@ void MaterialRenderList::StatMI()
|
|||||||
{
|
{
|
||||||
//超出最大数量了怎么办???
|
//超出最大数量了怎么办???
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MaterialRenderList::Stat()
|
void MaterialRenderList::Stat()
|
||||||
|
@ -8,6 +8,18 @@
|
|||||||
|
|
||||||
VK_NAMESPACE_BEGIN
|
VK_NAMESPACE_BEGIN
|
||||||
|
|
||||||
|
RenderAssignBuffer::RenderAssignBuffer(GPUDevice *dev,const uint mi_total_bytes)
|
||||||
|
{
|
||||||
|
hgl_zero(*this);
|
||||||
|
|
||||||
|
device=dev;
|
||||||
|
|
||||||
|
if(mi_total_bytes>0)
|
||||||
|
ubo_mi=device->CreateUBO(mi_total_bytes);
|
||||||
|
else
|
||||||
|
ubo_mi=nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
VkBuffer RenderAssignBuffer::GetAssignVBO()const
|
VkBuffer RenderAssignBuffer::GetAssignVBO()const
|
||||||
{
|
{
|
||||||
return vbo_assigns->GetBuffer();
|
return vbo_assigns->GetBuffer();
|
||||||
@ -44,15 +56,16 @@ void RenderAssignBuffer::Alloc(const uint nc,const uint mc)
|
|||||||
ubo_l2w=device->CreateUBO(node_count*sizeof(Matrix4f));
|
ubo_l2w=device->CreateUBO(node_count*sizeof(Matrix4f));
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
|
||||||
mi_count=power_to_2(mc);
|
|
||||||
|
|
||||||
ubo_mi=device->CreateUBO(mi_count*mi_data_bytes);
|
|
||||||
}
|
|
||||||
|
|
||||||
vbo_assigns=device->CreateVBO(ASSIGN_VBO_FMT,node_count);
|
vbo_assigns=device->CreateVBO(ASSIGN_VBO_FMT,node_count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool RenderAssignBuffer::WriteMIData(void *mi_data,const uint bytes)
|
||||||
|
{
|
||||||
|
if(!mi_data||!bytes||!ubo_mi)return(false);
|
||||||
|
|
||||||
|
return ubo_mi->Write(mi_data,bytes);
|
||||||
|
}
|
||||||
|
|
||||||
void RenderAssignBuffer::WriteNode(RenderNode *render_node,const uint count,const MaterialInstanceSets &mi_set)
|
void RenderAssignBuffer::WriteNode(RenderNode *render_node,const uint count,const MaterialInstanceSets &mi_set)
|
||||||
{
|
{
|
||||||
RenderNode *rn;
|
RenderNode *rn;
|
||||||
|
@ -37,8 +37,6 @@ private:
|
|||||||
uint node_count; ///<渲染节点数量
|
uint node_count; ///<渲染节点数量
|
||||||
DeviceBuffer *ubo_l2w; ///<Local2World数据
|
DeviceBuffer *ubo_l2w; ///<Local2World数据
|
||||||
|
|
||||||
uint mi_count; ///<材质实例数量
|
|
||||||
uint mi_data_bytes; ///<单个材质实例数据字节数
|
|
||||||
DeviceBuffer *ubo_mi; ///<材质实例数据
|
DeviceBuffer *ubo_mi; ///<材质实例数据
|
||||||
|
|
||||||
//Assign VBO
|
//Assign VBO
|
||||||
@ -58,17 +56,10 @@ public:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
RenderAssignBuffer(GPUDevice *dev,const uint mi_bytes)
|
RenderAssignBuffer(GPUDevice *dev,const uint mi_total_bytes);
|
||||||
{
|
|
||||||
hgl_zero(*this);
|
|
||||||
|
|
||||||
device=dev;
|
|
||||||
|
|
||||||
mi_data_bytes=mi_bytes;
|
|
||||||
}
|
|
||||||
|
|
||||||
~RenderAssignBuffer(){Clear();}
|
~RenderAssignBuffer(){Clear();}
|
||||||
|
|
||||||
|
bool WriteMIData(void *,const uint);
|
||||||
void WriteNode(RenderNode *render_node,const uint count,const MaterialInstanceSets &mi_set);
|
void WriteNode(RenderNode *render_node,const uint count,const MaterialInstanceSets &mi_set);
|
||||||
|
|
||||||
};//struct RenderAssignBuffer
|
};//struct RenderAssignBuffer
|
||||||
|
Loading…
x
Reference in New Issue
Block a user