added debug name.
This commit is contained in:
parent
317635877b
commit
8ba171efda
@ -106,7 +106,7 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
ro_line=db->CreatePrimitive(2);
|
ro_line=db->CreatePrimitive("Line",2);
|
||||||
if(!ro_line)return(false);
|
if(!ro_line)return(false);
|
||||||
|
|
||||||
if(!ro_line->Set(VAN::Position, vbo_pos= db->CreateVBO(VF_V3F,2,position_data )))return(false);
|
if(!ro_line->Set(VAN::Position, vbo_pos= db->CreateVBO(VF_V3F,2,position_data )))return(false);
|
||||||
|
@ -67,7 +67,8 @@ private:
|
|||||||
|
|
||||||
bool InitTexture()
|
bool InitTexture()
|
||||||
{
|
{
|
||||||
texture=db->CreateTexture2DArray( 512,512, ///<纹理尺寸
|
texture=db->CreateTexture2DArray( "freepik icons",
|
||||||
|
512,512, ///<纹理尺寸
|
||||||
TexCount, ///<纹理层数
|
TexCount, ///<纹理层数
|
||||||
PF_BC1_RGBAUN, ///<纹理格式
|
PF_BC1_RGBAUN, ///<纹理格式
|
||||||
false); ///<是否自动产生mipmaps
|
false); ///<是否自动产生mipmaps
|
||||||
@ -127,7 +128,7 @@ private:
|
|||||||
|
|
||||||
bool InitVBOAndRenderList()
|
bool InitVBOAndRenderList()
|
||||||
{
|
{
|
||||||
RenderablePrimitiveCreater rpc(db,1);
|
RenderablePrimitiveCreater rpc(db,"Rectangle",1);
|
||||||
|
|
||||||
position_data[2]=1.0f/float(TexCount);
|
position_data[2]=1.0f/float(TexCount);
|
||||||
|
|
||||||
|
@ -19,6 +19,9 @@
|
|||||||
#include<hgl/graph/VKMaterialInstance.h>
|
#include<hgl/graph/VKMaterialInstance.h>
|
||||||
#include<hgl/graph/VKRenderTarget.h>
|
#include<hgl/graph/VKRenderTarget.h>
|
||||||
#include<hgl/graph/VKRenderResource.h>
|
#include<hgl/graph/VKRenderResource.h>
|
||||||
|
#ifdef _DEBUG
|
||||||
|
#include<hgl/graph/VKDeviceAttribute.h>
|
||||||
|
#endif//_DEBUG
|
||||||
#include<hgl/graph/RenderList.h>
|
#include<hgl/graph/RenderList.h>
|
||||||
#include<hgl/graph/mtl/UBOCommon.h>
|
#include<hgl/graph/mtl/UBOCommon.h>
|
||||||
#include<hgl/color/Color.h>
|
#include<hgl/color/Color.h>
|
||||||
@ -287,7 +290,24 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<typename ...ARGS>
|
template<typename ...ARGS>
|
||||||
Pipeline *CreatePipeline(ARGS...args){return device_render_pass->CreatePipeline(args...);}
|
Pipeline *CreatePipeline(ARGS...args)
|
||||||
|
{
|
||||||
|
Pipeline *p=device_render_pass->CreatePipeline(args...);
|
||||||
|
|
||||||
|
if(!p)
|
||||||
|
return(nullptr);
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
|
GPUDeviceAttribute *da=device->GetDeviceAttribute();
|
||||||
|
|
||||||
|
if(da->debug_maker)
|
||||||
|
da->debug_maker->SetPipeline(*p,"[debug maker] Pipeline:"+p->GetName());
|
||||||
|
if(da->debug_utils)
|
||||||
|
da->debug_utils->SetPipeline(*p,"[debug utils] Pipeline:"+p->GetName());
|
||||||
|
#endif//_DEBUG
|
||||||
|
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ namespace hgl
|
|||||||
uint16 * CreateIBO16(uint count,const uint16 *data=nullptr); ///<创建16位的索引缓冲区
|
uint16 * CreateIBO16(uint count,const uint16 *data=nullptr); ///<创建16位的索引缓冲区
|
||||||
uint32 * CreateIBO32(uint count,const uint32 *data=nullptr); ///<创建32位的索引缓冲区
|
uint32 * CreateIBO32(uint count,const uint32 *data=nullptr); ///<创建32位的索引缓冲区
|
||||||
|
|
||||||
virtual Primitive * Finish(); ///<结束并创建可渲染对象
|
virtual Primitive * Finish(const AnsiString &); ///<结束并创建可渲染对象
|
||||||
};//class PrimitiveCreater
|
};//class PrimitiveCreater
|
||||||
}//namespace graph
|
}//namespace graph
|
||||||
}//namespace hgl
|
}//namespace hgl
|
||||||
|
@ -9,6 +9,9 @@ VK_NAMESPACE_BEGIN
|
|||||||
class Pipeline
|
class Pipeline
|
||||||
{
|
{
|
||||||
VkDevice device;
|
VkDevice device;
|
||||||
|
|
||||||
|
AnsiString name;
|
||||||
|
|
||||||
VkPipeline pipeline;
|
VkPipeline pipeline;
|
||||||
PipelineData *data;
|
PipelineData *data;
|
||||||
|
|
||||||
@ -19,8 +22,10 @@ private:
|
|||||||
|
|
||||||
friend class RenderPass;
|
friend class RenderPass;
|
||||||
|
|
||||||
Pipeline(VkDevice dev,VkPipeline p,PipelineData *pd)
|
Pipeline(const AnsiString &n,VkDevice dev,VkPipeline p,PipelineData *pd)
|
||||||
{
|
{
|
||||||
|
name=n;
|
||||||
|
|
||||||
device=dev;
|
device=dev;
|
||||||
pipeline=p;
|
pipeline=p;
|
||||||
data=pd;
|
data=pd;
|
||||||
@ -33,6 +38,8 @@ public:
|
|||||||
|
|
||||||
virtual ~Pipeline();
|
virtual ~Pipeline();
|
||||||
|
|
||||||
|
const AnsiString &GetName()const{return name;}
|
||||||
|
|
||||||
operator VkPipeline(){return pipeline;}
|
operator VkPipeline(){return pipeline;}
|
||||||
|
|
||||||
const PipelineData *GetData()const{return data;}
|
const PipelineData *GetData()const{return data;}
|
||||||
|
@ -12,6 +12,9 @@ VK_NAMESPACE_BEGIN
|
|||||||
*/
|
*/
|
||||||
class Primitive
|
class Primitive
|
||||||
{
|
{
|
||||||
|
GPUDevice *device;
|
||||||
|
AnsiString prim_name;
|
||||||
|
|
||||||
struct VBOData
|
struct VBOData
|
||||||
{
|
{
|
||||||
VBO *buf;
|
VBO *buf;
|
||||||
@ -45,7 +48,13 @@ protected:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
Primitive(const uint32_t vc=0):vertex_count(vc){}
|
Primitive(GPUDevice *dev,const AnsiString &n,const uint32_t vc=0)
|
||||||
|
{
|
||||||
|
device=dev;
|
||||||
|
prim_name=n;
|
||||||
|
vertex_count=vc;
|
||||||
|
}
|
||||||
|
|
||||||
virtual ~Primitive()=default;
|
virtual ~Primitive()=default;
|
||||||
|
|
||||||
const uint GetRefCount()const{return ref_count;}
|
const uint GetRefCount()const{return ref_count;}
|
||||||
@ -55,14 +64,7 @@ public:
|
|||||||
|
|
||||||
bool Set(const AnsiString &name,VBO *vb,VkDeviceSize offset=0);
|
bool Set(const AnsiString &name,VBO *vb,VkDeviceSize offset=0);
|
||||||
|
|
||||||
bool Set(IndexBuffer *ib,VkDeviceSize offset=0)
|
bool Set(IndexBuffer *ib,VkDeviceSize offset=0);
|
||||||
{
|
|
||||||
if(!ib)return(false);
|
|
||||||
|
|
||||||
index_buffer_data.buffer=ib;
|
|
||||||
index_buffer_data.offset=offset;
|
|
||||||
return(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ protected:
|
|||||||
|
|
||||||
ObjectList<Pipeline> pipeline_list;
|
ObjectList<Pipeline> pipeline_list;
|
||||||
|
|
||||||
Pipeline *CreatePipeline(PipelineData *,const ShaderStageCreateInfoList &,VkPipelineLayout,const VIL *);
|
Pipeline *CreatePipeline(const AnsiString &,PipelineData *,const ShaderStageCreateInfoList &,VkPipelineLayout,const VIL *);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
@ -123,7 +123,7 @@ public: //Material
|
|||||||
|
|
||||||
MaterialInstance * CreateMaterialInstance(const mtl::MaterialCreateInfo *,const VILConfig *vil_cfg=nullptr);
|
MaterialInstance * CreateMaterialInstance(const mtl::MaterialCreateInfo *,const VILConfig *vil_cfg=nullptr);
|
||||||
|
|
||||||
Primitive * CreatePrimitive(const uint32_t vertex_count=0);
|
Primitive * CreatePrimitive(const AnsiString &,const uint32_t vertex_count=0);
|
||||||
|
|
||||||
Renderable * CreateRenderable(Primitive *r,MaterialInstance *mi,Pipeline *p);
|
Renderable * CreateRenderable(Primitive *r,MaterialInstance *mi,Pipeline *p);
|
||||||
|
|
||||||
@ -135,7 +135,7 @@ public: //texture
|
|||||||
Texture2D * LoadTexture2D(const OSString &,bool auto_mipmaps=false);
|
Texture2D * LoadTexture2D(const OSString &,bool auto_mipmaps=false);
|
||||||
TextureCube * LoadTextureCube(const OSString &,bool auto_mipmaps=false);
|
TextureCube * LoadTextureCube(const OSString &,bool auto_mipmaps=false);
|
||||||
|
|
||||||
Texture2DArray * CreateTexture2DArray(const uint32_t width,const uint32_t height,const uint32_t layer,const VkFormat &fmt,bool auto_mipmaps=false);
|
Texture2DArray * CreateTexture2DArray(const AnsiString &name,const uint32_t width,const uint32_t height,const uint32_t layer,const VkFormat &fmt,bool auto_mipmaps=false);
|
||||||
bool LoadTexture2DToArray(Texture2DArray *,const uint32_t layer,const OSString &);
|
bool LoadTexture2DToArray(Texture2DArray *,const uint32_t layer,const OSString &);
|
||||||
|
|
||||||
public: //Get
|
public: //Get
|
||||||
|
@ -14,12 +14,12 @@ class RenderablePrimitiveCreater
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
RenderablePrimitiveCreater(RenderResource *_rr,uint32_t vc)
|
RenderablePrimitiveCreater(RenderResource *_rr,const AnsiString &name,uint32_t vc)
|
||||||
{
|
{
|
||||||
rr=_rr;
|
rr=_rr;
|
||||||
vertex_count=vc;
|
vertex_count=vc;
|
||||||
|
|
||||||
prim=rr->CreatePrimitive(vertex_count);
|
prim=rr->CreatePrimitive(name,vertex_count);
|
||||||
}
|
}
|
||||||
|
|
||||||
VBO *SetVBO(const AnsiString &name,const VkFormat &fmt,const void *buf)
|
VBO *SetVBO(const AnsiString &name,const VkFormat &fmt,const void *buf)
|
||||||
|
@ -28,7 +28,7 @@ namespace hgl
|
|||||||
|
|
||||||
vertex->WriteRectFan(rci->scope);
|
vertex->WriteRectFan(rci->scope);
|
||||||
|
|
||||||
return rc.Finish();
|
return rc.Finish("Rectangle");
|
||||||
}
|
}
|
||||||
|
|
||||||
Primitive *CreateGBufferCompositionRectangle(RenderResource *db,const VIL *vil)
|
Primitive *CreateGBufferCompositionRectangle(RenderResource *db,const VIL *vil)
|
||||||
@ -111,7 +111,7 @@ namespace hgl
|
|||||||
delete[] coord;
|
delete[] coord;
|
||||||
}
|
}
|
||||||
|
|
||||||
return rc.Finish();
|
return rc.Finish("RoundRectangle");
|
||||||
}
|
}
|
||||||
|
|
||||||
Primitive *CreateCircle(RenderResource *db,const VIL *vil,const CircleCreateInfo *cci)
|
Primitive *CreateCircle(RenderResource *db,const VIL *vil,const CircleCreateInfo *cci)
|
||||||
@ -159,7 +159,7 @@ namespace hgl
|
|||||||
color->Write(cci->border_color);
|
color->Write(cci->border_color);
|
||||||
}
|
}
|
||||||
|
|
||||||
return rc.Finish();
|
return rc.Finish("Circle");
|
||||||
}
|
}
|
||||||
|
|
||||||
Primitive *CreatePlaneGrid(RenderResource *db,const VIL *vil,const PlaneGridCreateInfo *pgci)
|
Primitive *CreatePlaneGrid(RenderResource *db,const VIL *vil,const PlaneGridCreateInfo *pgci)
|
||||||
@ -209,7 +209,7 @@ namespace hgl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return rc.Finish();
|
return rc.Finish("PlaneGrid");
|
||||||
}
|
}
|
||||||
|
|
||||||
Primitive *CreatePlane(RenderResource *db,const VIL *vil,const PlaneCreateInfo *pci)
|
Primitive *CreatePlane(RenderResource *db,const VIL *vil,const PlaneCreateInfo *pci)
|
||||||
@ -250,7 +250,7 @@ namespace hgl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return rc.Finish();
|
return rc.Finish("Plane");
|
||||||
}
|
}
|
||||||
|
|
||||||
Primitive *CreateCube(RenderResource *db,const VIL *vil,const CubeCreateInfo *cci)
|
Primitive *CreateCube(RenderResource *db,const VIL *vil,const CubeCreateInfo *cci)
|
||||||
@ -347,7 +347,7 @@ namespace hgl
|
|||||||
}
|
}
|
||||||
|
|
||||||
rc.CreateIBO16(6*2*3,indices);
|
rc.CreateIBO16(6*2*3,indices);
|
||||||
return rc.Finish();
|
return rc.Finish("Cube");
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T> void CreateSphereIndices(T *tp,uint numberParallels,const uint numberSlices)
|
template<typename T> void CreateSphereIndices(T *tp,uint numberParallels,const uint numberSlices)
|
||||||
@ -518,7 +518,7 @@ namespace hgl
|
|||||||
else
|
else
|
||||||
CreateSphereIndices<uint32>(rc.CreateIBO32(numberIndices),numberParallels,numberSlices);
|
CreateSphereIndices<uint32>(rc.CreateIBO32(numberIndices),numberParallels,numberSlices);
|
||||||
|
|
||||||
return rc.Finish();
|
return rc.Finish("Sphere");
|
||||||
}
|
}
|
||||||
|
|
||||||
Primitive *CreateDome(RenderResource *db,const VIL *vil,const uint numberSlices)
|
Primitive *CreateDome(RenderResource *db,const VIL *vil,const uint numberSlices)
|
||||||
@ -604,7 +604,7 @@ namespace hgl
|
|||||||
else
|
else
|
||||||
CreateSphereIndices<uint32>(rc.CreateIBO32(numberIndices),numberParallels,numberSlices);
|
CreateSphereIndices<uint32>(rc.CreateIBO32(numberIndices),numberParallels,numberSlices);
|
||||||
|
|
||||||
return rc.Finish();
|
return rc.Finish("Dome");
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
@ -745,7 +745,7 @@ namespace hgl
|
|||||||
else
|
else
|
||||||
CreateTorusIndices<uint32>(rc.CreateIBO32(numberIndices),tci->numberSlices,tci->numberStacks);
|
CreateTorusIndices<uint32>(rc.CreateIBO32(numberIndices),tci->numberSlices,tci->numberStacks);
|
||||||
|
|
||||||
return rc.Finish();
|
return rc.Finish("Torus");
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
@ -974,7 +974,7 @@ namespace hgl
|
|||||||
else
|
else
|
||||||
CreateCylinderIndices<uint32>(rc.CreateIBO32(numberIndices),cci->numberSlices);
|
CreateCylinderIndices<uint32>(rc.CreateIBO32(numberIndices),cci->numberSlices);
|
||||||
|
|
||||||
return rc.Finish();
|
return rc.Finish("Cylinder");
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
@ -1141,7 +1141,7 @@ namespace hgl
|
|||||||
else
|
else
|
||||||
CreateConeIndices<uint32>(rc.CreateIBO32(numberIndices),cci->numberSlices,cci->numberStacks);
|
CreateConeIndices<uint32>(rc.CreateIBO32(numberIndices),cci->numberSlices,cci->numberStacks);
|
||||||
|
|
||||||
return rc.Finish();
|
return rc.Finish("Cone");
|
||||||
}
|
}
|
||||||
|
|
||||||
Primitive *CreateAxis(RenderResource *db,const VIL *vil,const AxisCreateInfo *aci)
|
Primitive *CreateAxis(RenderResource *db,const VIL *vil,const AxisCreateInfo *aci)
|
||||||
@ -1168,7 +1168,7 @@ namespace hgl
|
|||||||
vertex->Write(0,0,0);color->Write(aci->color[2]);
|
vertex->Write(0,0,0);color->Write(aci->color[2]);
|
||||||
vertex->Write(0,0,s);color->Write(aci->color[2]);
|
vertex->Write(0,0,s);color->Write(aci->color[2]);
|
||||||
|
|
||||||
return rc.Finish();
|
return rc.Finish("Axis");
|
||||||
}
|
}
|
||||||
|
|
||||||
Primitive *CreateBoundingBox(RenderResource *db,const VIL *vil,const BoundingBoxCreateInfo *cci)
|
Primitive *CreateBoundingBox(RenderResource *db,const VIL *vil,const BoundingBoxCreateInfo *cci)
|
||||||
@ -1222,7 +1222,7 @@ namespace hgl
|
|||||||
|
|
||||||
rc.CreateIBO16(24,indices);
|
rc.CreateIBO16(24,indices);
|
||||||
|
|
||||||
return rc.Finish();
|
return rc.Finish("BoundingBox");
|
||||||
}
|
}
|
||||||
}//namespace inline_geometry
|
}//namespace inline_geometry
|
||||||
}//namespace graph
|
}//namespace graph
|
||||||
|
@ -105,14 +105,14 @@ namespace hgl
|
|||||||
return (uint32 *)ibo->Map();
|
return (uint32 *)ibo->Map();
|
||||||
}
|
}
|
||||||
|
|
||||||
Primitive *PrimitiveCreater::Finish()
|
Primitive *PrimitiveCreater::Finish(const AnsiString &prim_name)
|
||||||
{
|
{
|
||||||
const uint si_count=vil->GetCount(VertexInputGroup::Basic);
|
const uint si_count=vil->GetCount(VertexInputGroup::Basic);
|
||||||
|
|
||||||
if(vbo_map.GetCount()!=si_count)
|
if(vbo_map.GetCount()!=si_count)
|
||||||
return(nullptr);
|
return(nullptr);
|
||||||
|
|
||||||
Primitive *primitive=db->CreatePrimitive(vertices_number);
|
Primitive *primitive=db->CreatePrimitive(prim_name,vertices_number);
|
||||||
|
|
||||||
const auto *sp=vbo_map.GetDataList();
|
const auto *sp=vbo_map.GetDataList();
|
||||||
for(uint i=0;i<si_count;i++)
|
for(uint i=0;i<si_count;i++)
|
||||||
|
@ -64,6 +64,30 @@ void RenderAssignBuffer::Alloc(const uint nc,const uint mc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
vbo_assigns=device->CreateVBO(ASSIGN_VBO_FMT,node_count);
|
vbo_assigns=device->CreateVBO(ASSIGN_VBO_FMT,node_count);
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
|
GPUDeviceAttribute *da=device->GetDeviceAttribute();
|
||||||
|
|
||||||
|
if(da->debug_maker)
|
||||||
|
{
|
||||||
|
da->debug_maker->SetBuffer(ubo_l2w->GetBuffer(),"[debug maker] UBO:LocalToWorld");
|
||||||
|
|
||||||
|
if(ubo_mi)
|
||||||
|
da->debug_maker->SetBuffer(ubo_mi->GetBuffer(),"[debug maker] UBO:MaterialInstance");
|
||||||
|
|
||||||
|
da->debug_maker->SetBuffer(vbo_assigns->GetBuffer(),"[debug maker] VBO:Assign");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(da->debug_utils)
|
||||||
|
{
|
||||||
|
da->debug_utils->SetBuffer(ubo_l2w->GetBuffer(),"[debug utils] UBO:LocalToWorld");
|
||||||
|
|
||||||
|
if(ubo_mi)
|
||||||
|
da->debug_utils->SetBuffer(ubo_mi->GetBuffer(),"[debug utils] UBO:MaterialInstance");
|
||||||
|
|
||||||
|
da->debug_utils->SetBuffer(vbo_assigns->GetBuffer(),"[debug utils] VBO:Assign");
|
||||||
|
}
|
||||||
|
#endif//_DEBUG
|
||||||
}
|
}
|
||||||
|
|
||||||
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)
|
||||||
|
@ -3,6 +3,11 @@
|
|||||||
#include<hgl/graph/VKShaderModule.h>
|
#include<hgl/graph/VKShaderModule.h>
|
||||||
#include<hgl/graph/VKVertexAttribBuffer.h>
|
#include<hgl/graph/VKVertexAttribBuffer.h>
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
|
#include<hgl/graph/VKDevice.h>
|
||||||
|
#include<hgl/graph/VKDeviceAttribute.h>
|
||||||
|
#endif//_DEBUG
|
||||||
|
|
||||||
VK_NAMESPACE_BEGIN
|
VK_NAMESPACE_BEGIN
|
||||||
//bool Renderable::Set(const int stage_input_binding,VIL *vil,VkDeviceSize offset)
|
//bool Renderable::Set(const int stage_input_binding,VIL *vil,VkDeviceSize offset)
|
||||||
//{
|
//{
|
||||||
@ -33,6 +38,16 @@ bool Primitive::Set(const AnsiString &name,VBO *vbo,VkDeviceSize offset)
|
|||||||
bd.offset=offset;
|
bd.offset=offset;
|
||||||
|
|
||||||
buffer_list.Add(name,bd);
|
buffer_list.Add(name,bd);
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
|
auto *da=device->GetDeviceAttribute();
|
||||||
|
|
||||||
|
if(da->debug_maker)
|
||||||
|
da->debug_maker->SetBuffer(vbo->GetBuffer(),"[debug maker] "+prim_name+":VBO:"+name);
|
||||||
|
if(da->debug_utils)
|
||||||
|
da->debug_utils->SetBuffer(vbo->GetBuffer(),"[debug utils] "+prim_name+":VBO:"+name);
|
||||||
|
#endif//_DEBUG
|
||||||
|
|
||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -60,4 +75,22 @@ VkBuffer Primitive::GetBuffer(const AnsiString &name,VkDeviceSize *offset)
|
|||||||
|
|
||||||
return(VK_NULL_HANDLE);
|
return(VK_NULL_HANDLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Primitive::Set(IndexBuffer *ib,VkDeviceSize offset)
|
||||||
|
{
|
||||||
|
if(!ib)return(false);
|
||||||
|
|
||||||
|
index_buffer_data.buffer=ib;
|
||||||
|
index_buffer_data.offset=offset;
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
|
auto *da=device->GetDeviceAttribute();
|
||||||
|
|
||||||
|
if(da->debug_maker)
|
||||||
|
da->debug_maker->SetBuffer(ib->GetBuffer(),"[debug maker] "+prim_name+":IBO");
|
||||||
|
if(da->debug_utils)
|
||||||
|
da->debug_utils->SetBuffer(ib->GetBuffer(),"[debug utils] "+prim_name+":IBO");
|
||||||
|
#endif//_DEBUG
|
||||||
|
return(true);
|
||||||
|
}
|
||||||
VK_NAMESPACE_END
|
VK_NAMESPACE_END
|
||||||
|
@ -23,7 +23,7 @@ RenderPass::~RenderPass()
|
|||||||
vkDestroyRenderPass(device,render_pass,nullptr);
|
vkDestroyRenderPass(device,render_pass,nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
Pipeline *RenderPass::CreatePipeline(PipelineData *pd,const ShaderStageCreateInfoList &ssci_list,VkPipelineLayout pl,const VIL *vil)
|
Pipeline *RenderPass::CreatePipeline(const AnsiString &name,PipelineData *pd,const ShaderStageCreateInfoList &ssci_list,VkPipelineLayout pl,const VIL *vil)
|
||||||
{
|
{
|
||||||
//以后要做一个缓冲,以Material为基准创建一个pipeline,其它MaterialInstance的pipeline全部以它为基础,这样可以提升性能。
|
//以后要做一个缓冲,以Material为基准创建一个pipeline,其它MaterialInstance的pipeline全部以它为基础,这样可以提升性能。
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ Pipeline *RenderPass::CreatePipeline(PipelineData *pd,const ShaderStageCreateInf
|
|||||||
return(nullptr);
|
return(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
return(new Pipeline(device,graphicsPipeline,pd));
|
return(new Pipeline(name,device,graphicsPipeline,pd));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -63,7 +63,7 @@ Pipeline *RenderPass::CreatePipeline(Material *mtl,const VIL *vil,const Pipeline
|
|||||||
|
|
||||||
pd->SetPrim(prim,prim_restart);
|
pd->SetPrim(prim,prim_restart);
|
||||||
|
|
||||||
Pipeline *p=CreatePipeline(pd,mtl->GetStageList(),mtl->GetPipelineLayout(),vil);
|
Pipeline *p=CreatePipeline(mtl->GetName(),pd,mtl->GetStageList(),mtl->GetPipelineLayout(),vil);
|
||||||
|
|
||||||
if(p)
|
if(p)
|
||||||
pipeline_list.Add(p);
|
pipeline_list.Add(p);
|
||||||
|
@ -88,11 +88,11 @@ MaterialInstance *RenderResource::CreateMaterialInstance(const mtl::MaterialCrea
|
|||||||
return CreateMaterialInstance(mtl,vil_cfg);
|
return CreateMaterialInstance(mtl,vil_cfg);
|
||||||
}
|
}
|
||||||
|
|
||||||
Primitive *RenderResource::CreatePrimitive(const uint32_t vertex_count)
|
Primitive *RenderResource::CreatePrimitive(const AnsiString &name,const uint32_t vertex_count)
|
||||||
{
|
{
|
||||||
if(!vertex_count)return(nullptr);
|
if(!vertex_count)return(nullptr);
|
||||||
|
|
||||||
Primitive *ro=new Primitive(vertex_count);
|
Primitive *ro=new Primitive(device,name,vertex_count);
|
||||||
|
|
||||||
if(ro)
|
if(ro)
|
||||||
Add(ro);
|
Add(ro);
|
||||||
@ -154,22 +154,31 @@ Texture2D *RenderResource::LoadTexture2D(const OSString &filename,bool auto_mipm
|
|||||||
const UTF8String name=ToUTF8String(filename);
|
const UTF8String name=ToUTF8String(filename);
|
||||||
|
|
||||||
if(da->debug_maker)
|
if(da->debug_maker)
|
||||||
da->debug_maker->SetImage(tex->GetImage(),"[debug maker] "+name);
|
da->debug_maker->SetImage(tex->GetImage(),"[debug maker] Tex2D:"+name);
|
||||||
if(da->debug_utils)
|
if(da->debug_utils)
|
||||||
da->debug_utils->SetImage(tex->GetImage(),"[debug utils] "+name);
|
da->debug_utils->SetImage(tex->GetImage(),"[debug utils] Tex2D:"+name);
|
||||||
#endif//_DEBUG
|
#endif//_DEBUG
|
||||||
}
|
}
|
||||||
|
|
||||||
return tex;
|
return tex;
|
||||||
}
|
}
|
||||||
|
|
||||||
Texture2DArray *RenderResource::CreateTexture2DArray(const uint32_t width,const uint32_t height,const uint32_t layer,const VkFormat &fmt,bool auto_mipmaps)
|
Texture2DArray *RenderResource::CreateTexture2DArray(const AnsiString &name,const uint32_t width,const uint32_t height,const uint32_t layer,const VkFormat &fmt,bool auto_mipmaps)
|
||||||
{
|
{
|
||||||
Texture2DArray *ta=device->CreateTexture2DArray(width,height,layer,fmt,auto_mipmaps);
|
Texture2DArray *ta=device->CreateTexture2DArray(width,height,layer,fmt,auto_mipmaps);
|
||||||
|
|
||||||
if(ta)
|
if(ta)
|
||||||
Add(ta);
|
Add(ta);
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
|
GPUDeviceAttribute *da=device->GetDeviceAttribute();
|
||||||
|
|
||||||
|
if(da->debug_maker)
|
||||||
|
da->debug_maker->SetImage(ta->GetImage(),"[debug maker] Tex2DArray:"+name);
|
||||||
|
if(da->debug_utils)
|
||||||
|
da->debug_utils->SetImage(ta->GetImage(),"[debug utils] Tex2DArray:"+name);
|
||||||
|
#endif//_DEBUG
|
||||||
|
|
||||||
return ta;
|
return ta;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,8 +12,11 @@
|
|||||||
#include<hgl/shadergen/ShaderDescriptorInfo.h>
|
#include<hgl/shadergen/ShaderDescriptorInfo.h>
|
||||||
#include<hgl/type/ActiveMemoryBlockManager.h>
|
#include<hgl/type/ActiveMemoryBlockManager.h>
|
||||||
|
|
||||||
VK_NAMESPACE_BEGIN
|
#ifdef _DEBUG
|
||||||
|
#include"VKPipelineLayoutData.h"
|
||||||
|
#endif//_DEBUG
|
||||||
|
|
||||||
|
VK_NAMESPACE_BEGIN
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
void CreateShaderStageList(List<VkPipelineShaderStageCreateInfo> &shader_stage_list,ShaderModuleMap *shader_maps)
|
void CreateShaderStageList(List<VkPipelineShaderStageCreateInfo> &shader_stage_list,ShaderModuleMap *shader_maps)
|
||||||
@ -65,10 +68,10 @@ const ShaderModule *RenderResource::CreateShaderModule(const AnsiString &sm_name
|
|||||||
auto da=device->GetDeviceAttribute();
|
auto da=device->GetDeviceAttribute();
|
||||||
|
|
||||||
if(da->debug_maker)
|
if(da->debug_maker)
|
||||||
da->debug_maker->SetShaderModule(*sm,sm_name);
|
da->debug_maker->SetShaderModule(*sm,"[debug maker] Shader:"+sm_name+AnsiString(":")+GetShaderStageName(sci->GetShaderStage()));
|
||||||
|
|
||||||
if(da->debug_utils)
|
if(da->debug_utils)
|
||||||
da->debug_utils->SetShaderModule(*sm,sm_name);
|
da->debug_utils->SetShaderModule(*sm,"[debug utils] Shader:"+sm_name+AnsiString(":")+GetShaderStageName(sci->GetShaderStage()));
|
||||||
}
|
}
|
||||||
#endif//_DEBUG
|
#endif//_DEBUG
|
||||||
|
|
||||||
@ -136,12 +139,43 @@ Material *RenderResource::CreateMaterial(const mtl::MaterialCreateInfo *mci)
|
|||||||
|
|
||||||
mtl->pipeline_layout_data=device->CreatePipelineLayoutData(mtl->desc_manager);
|
mtl->pipeline_layout_data=device->CreatePipelineLayoutData(mtl->desc_manager);
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
|
GPUDeviceAttribute *da=device->GetDeviceAttribute();
|
||||||
|
|
||||||
|
if(da->debug_maker)
|
||||||
|
da->debug_maker->SetPipelineLayout(mtl->GetPipelineLayout(),"[debug maker] PipelineLayout:"+mtl->GetName());
|
||||||
|
if(da->debug_utils)
|
||||||
|
da->debug_utils->SetPipelineLayout(mtl->GetPipelineLayout(),"[debug utils] PipelineLayout:"+mtl->GetName());
|
||||||
|
#endif//_DEBUG
|
||||||
|
|
||||||
if(mtl->desc_manager)
|
if(mtl->desc_manager)
|
||||||
{
|
{
|
||||||
ENUM_CLASS_FOR(DescriptorSetType,int,dst)
|
ENUM_CLASS_FOR(DescriptorSetType,int,dst)
|
||||||
{
|
{
|
||||||
if(mtl->desc_manager->hasSet((DescriptorSetType)dst))
|
if(mtl->desc_manager->hasSet((DescriptorSetType)dst))
|
||||||
|
{
|
||||||
mtl->mp_array[dst]=device->CreateMP(mtl->desc_manager,mtl->pipeline_layout_data,(DescriptorSetType)dst);
|
mtl->mp_array[dst]=device->CreateMP(mtl->desc_manager,mtl->pipeline_layout_data,(DescriptorSetType)dst);
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
|
GPUDeviceAttribute *da=device->GetDeviceAttribute();
|
||||||
|
|
||||||
|
AnsiString debug_name=mtl->GetName()+AnsiString(":")+GetDescriptorSetTypeName((DescriptorSetType)dst);
|
||||||
|
|
||||||
|
if(da->debug_maker)
|
||||||
|
{
|
||||||
|
da->debug_maker->SetDescriptorSet(mtl->mp_array[dst]->GetVkDescriptorSet(),"[debug maker] DescSet:"+debug_name);
|
||||||
|
|
||||||
|
da->debug_maker->SetDescriptorSetLayout(mtl->pipeline_layout_data->layouts[dst],"[debug maker] DescSetLayout:"+debug_name);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(da->debug_utils)
|
||||||
|
{
|
||||||
|
da->debug_utils->SetDescriptorSet(mtl->mp_array[dst]->GetVkDescriptorSet(),"[debug utils] DescSet:"+debug_name);
|
||||||
|
|
||||||
|
da->debug_utils->SetDescriptorSetLayout(mtl->pipeline_layout_data->layouts[dst],"[debug utils] DescSetLayout:"+debug_name);
|
||||||
|
}
|
||||||
|
#endif//_DEBUG
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user