renamed to VAB from VBO
This commit is contained in:
parent
8d3cd8d561
commit
0dcf004f4c
@ -224,7 +224,7 @@ public:
|
||||
cb->BeginRenderPass();
|
||||
cb->BindPipeline(ri->GetPipeline());
|
||||
cb->BindDescriptorSets(ri->GetMaterial());
|
||||
cb->BindVBO(ri);
|
||||
cb->BindVAB(ri);
|
||||
cb->Draw(vid,ri->GetDrawData());
|
||||
cb->EndRenderPass();
|
||||
cb->End();
|
||||
|
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
#include<hgl/graph/RenderNode.h>
|
||||
#include<hgl/graph/VKVBOList.h>
|
||||
#include<hgl/graph/VKVABList.h>
|
||||
|
||||
VK_NAMESPACE_BEGIN
|
||||
class RenderAssignBuffer;
|
||||
@ -44,7 +44,7 @@ private:
|
||||
|
||||
protected:
|
||||
|
||||
VBOList * vbo_list;
|
||||
VABList * vbo_list;
|
||||
|
||||
Pipeline * last_pipeline;
|
||||
const VertexInputData * last_vid;
|
||||
|
@ -2,7 +2,7 @@
|
||||
#define HGL_GRAPH_VULKAN_COMMAND_BUFFER_INCLUDE
|
||||
|
||||
#include<hgl/graph/VK.h>
|
||||
#include<hgl/graph/VKVBOList.h>
|
||||
#include<hgl/graph/VKVABList.h>
|
||||
#include<hgl/graph/VKPipeline.h>
|
||||
#include<hgl/graph/VKDescriptorSet.h>
|
||||
#include<hgl/color/Color4f.h>
|
||||
@ -154,25 +154,25 @@ public:
|
||||
void PushConstants(const void *data,const uint32_t size) {vkCmdPushConstants(cmd_buf,pipeline_layout,VK_SHADER_STAGE_VERTEX_BIT,0, size,data);}
|
||||
void PushConstants(const void *data,const uint32_t offset,const uint32_t size) {vkCmdPushConstants(cmd_buf,pipeline_layout,VK_SHADER_STAGE_VERTEX_BIT,offset, size,data);}
|
||||
|
||||
void BindVBO(const uint32_t first,const uint32_t count,const VkBuffer *vab,const VkDeviceSize *offsets)
|
||||
void BindVAB(const uint32_t first,const uint32_t count,const VkBuffer *vab,const VkDeviceSize *offsets)
|
||||
{
|
||||
vkCmdBindVertexBuffers(cmd_buf,first,count,vab,offsets);
|
||||
}
|
||||
|
||||
bool BindVBO(VBOList *vbo_list)
|
||||
bool BindVAB(VABList *vab_list)
|
||||
{
|
||||
if(!vbo_list)return(false);
|
||||
if(!vab_list)return(false);
|
||||
|
||||
if(!vbo_list->IsFull())return(false);
|
||||
if(!vab_list->IsFull())return(false);
|
||||
|
||||
vkCmdBindVertexBuffers(cmd_buf,0,vbo_list->vab_count,vbo_list->vab_list,vbo_list->vab_offset);
|
||||
vkCmdBindVertexBuffers(cmd_buf,0,vab_list->vab_count,vab_list->vab_list,vab_list->vab_offset);
|
||||
|
||||
return(true);
|
||||
}
|
||||
|
||||
void BindIBO(IndexBuffer *ibo,VkDeviceSize offset); ///<绑定IBO,注意offset意为索引偏移量,不是字节
|
||||
|
||||
bool BindVBO(Renderable *);
|
||||
bool BindVAB(Renderable *);
|
||||
|
||||
void SetViewport (uint32_t first,uint32_t count,const VkViewport *vp) {vkCmdSetViewport(cmd_buf,first,count,vp);}
|
||||
void SetScissor (uint32_t first,uint32_t count,const VkRect2D *sci) {vkCmdSetScissor(cmd_buf,first,count,sci);}
|
||||
|
@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
VK_NAMESPACE_BEGIN
|
||||
class VBOList
|
||||
class VABList
|
||||
{
|
||||
uint32_t vab_count;
|
||||
VkBuffer *vab_list;
|
||||
@ -13,7 +13,7 @@ class VBOList
|
||||
|
||||
public:
|
||||
|
||||
VBOList(const uint32 bc)
|
||||
VABList(const uint32 bc)
|
||||
{
|
||||
vab_count=bc;
|
||||
vab_list=new VkBuffer[vab_count];
|
||||
@ -22,7 +22,7 @@ public:
|
||||
write_count=0;
|
||||
}
|
||||
|
||||
~VBOList()
|
||||
~VABList()
|
||||
{
|
||||
delete[] vab_offset;
|
||||
delete[] vab_list;
|
||||
@ -49,9 +49,13 @@ public:
|
||||
void Add(const VkBuffer *buf,const VkDeviceSize *offset,const uint32_t count)
|
||||
{
|
||||
hgl_cpy(vab_list +write_count,buf, count);
|
||||
|
||||
if(offset)
|
||||
hgl_cpy(vab_offset+write_count,offset,count);
|
||||
else
|
||||
hgl_set<VkDeviceSize>(vab_offset+write_count,VkDeviceSize(0),count);
|
||||
|
||||
write_count+=count;
|
||||
}
|
||||
};//class VBOList
|
||||
};//class VABList
|
||||
VK_NAMESPACE_END
|
@ -17,7 +17,6 @@ SET(SG_PRIMITIVE_SOURCE ${SG_INCLUDE_PATH}/VKPrimitive.h
|
||||
Vulkan/VKPrimitive.cpp
|
||||
Vulkan/VKPrimitiveData.cpp
|
||||
Vulkan/VKPrimitiveData.h
|
||||
${SG_INCLUDE_PATH}/VKRenderablePrimitiveCreater.h
|
||||
${SG_INCLUDE_PATH}/PrimitiveCreater.h
|
||||
PrimitiveCreater.cpp)
|
||||
|
||||
|
@ -55,7 +55,7 @@ MaterialRenderList::MaterialRenderList(GPUDevice *d,bool l2w,Material *m)
|
||||
|
||||
assign_buffer=new RenderAssignBuffer(device,material);
|
||||
|
||||
vbo_list=new VBOList(material->GetVertexInput()->GetCount());
|
||||
vbo_list=new VABList(material->GetVertexInput()->GetCount());
|
||||
}
|
||||
|
||||
MaterialRenderList::~MaterialRenderList()
|
||||
@ -158,7 +158,9 @@ bool MaterialRenderList::BindVAB(const VertexInputData *vid,const DrawData *dd,c
|
||||
|
||||
//Basic组,它所有的VAB信息均来自于Primitive,由vid参数传递进来
|
||||
{
|
||||
vbo_list->Add(vid->vab_list,dd->vab_offset,vid->vab_count);
|
||||
vbo_list->Add(vid->vab_list,
|
||||
nullptr,//dd->vab_offset, //暂时不用dd->vab_offset,全部写0,测试一下是否可以使用Draw时的firstVertex或vertexOffset
|
||||
vid->vab_count);
|
||||
}
|
||||
|
||||
if(assign_buffer) //L2W/MI分发组
|
||||
@ -199,7 +201,7 @@ bool MaterialRenderList::BindVAB(const VertexInputData *vid,const DrawData *dd,c
|
||||
// return(false);
|
||||
//}
|
||||
|
||||
cmd_buf->BindVBO(vbo_list);
|
||||
cmd_buf->BindVAB(vbo_list);
|
||||
|
||||
return(true);
|
||||
}
|
||||
|
@ -138,7 +138,7 @@ void RenderCmdBuffer::BindIBO(IndexBuffer *ibo,VkDeviceSize offset)
|
||||
VkIndexType(ibo->GetType()));
|
||||
}
|
||||
|
||||
bool RenderCmdBuffer::BindVBO(Renderable *ri)
|
||||
bool RenderCmdBuffer::BindVAB(Renderable *ri)
|
||||
{
|
||||
if(!ri)
|
||||
return(false);
|
||||
|
Loading…
x
Reference in New Issue
Block a user