new MaterialInstance
This commit is contained in:
parent
cbbc0641ef
commit
53c58a885e
2
CMCore
2
CMCore
@ -1 +1 @@
|
|||||||
Subproject commit 109e52db4da1c88a30ecb33e121f9ac06fcab397
|
Subproject commit f42fd8a5b8fb5e67df0a37ed95ed798e268fb9ca
|
@ -33,7 +33,7 @@ private:
|
|||||||
|
|
||||||
Camera cam;
|
Camera cam;
|
||||||
|
|
||||||
MaterialParameters * material_instance =nullptr;
|
MaterialInstance * material_instance =nullptr;
|
||||||
RenderableInstance *render_instance =nullptr;
|
RenderableInstance *render_instance =nullptr;
|
||||||
GPUBuffer * ubo_camera_info =nullptr;
|
GPUBuffer * ubo_camera_info =nullptr;
|
||||||
|
|
||||||
@ -69,9 +69,16 @@ private:
|
|||||||
|
|
||||||
if(!ubo_camera_info)
|
if(!ubo_camera_info)
|
||||||
return(false);
|
return(false);
|
||||||
|
|
||||||
material_instance->BindUBO("camera",ubo_camera_info);
|
{
|
||||||
material_instance->Update();
|
MaterialParameters *mp_global=material_instance->GetMP(DescriptorSetsType::Global);
|
||||||
|
|
||||||
|
if(!mp_global)
|
||||||
|
return(false);
|
||||||
|
|
||||||
|
mp_global->BindUBO("g_camera",ubo_camera_info);
|
||||||
|
mp_global->Update();
|
||||||
|
}
|
||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
#include<hgl/graph/VKFramebuffer.h>
|
#include<hgl/graph/VKFramebuffer.h>
|
||||||
#include<hgl/graph/VKMaterial.h>
|
#include<hgl/graph/VKMaterial.h>
|
||||||
#include<hgl/graph/VKMaterialParameters.h>
|
#include<hgl/graph/VKMaterialParameters.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>
|
||||||
#include<hgl/graph/RenderList.h>
|
#include<hgl/graph/RenderList.h>
|
||||||
@ -184,7 +185,7 @@ public:
|
|||||||
cb->SetClearColor(0,clear_color.r,clear_color.g,clear_color.b);
|
cb->SetClearColor(0,clear_color.r,clear_color.g,clear_color.b);
|
||||||
cb->BeginRenderPass();
|
cb->BeginRenderPass();
|
||||||
cb->BindPipeline(ri->GetPipeline());
|
cb->BindPipeline(ri->GetPipeline());
|
||||||
cb->BindDescriptorSets(ri->GetMIDescSets());
|
cb->BindDescriptorSets(ri);
|
||||||
cb->BindVAB(ri);
|
cb->BindVAB(ri);
|
||||||
|
|
||||||
if (ib)
|
if (ib)
|
||||||
|
@ -28,6 +28,7 @@ namespace hgl
|
|||||||
GPUBuffer *mvp_buffer;
|
GPUBuffer *mvp_buffer;
|
||||||
List<RenderableInstance *> *ri_list;
|
List<RenderableInstance *> *ri_list;
|
||||||
|
|
||||||
|
VkDescriptorSet ds_list[(size_t)DescriptorSetsType::RANGE_SIZE];
|
||||||
DescriptorSets *renderable_desc_sets;
|
DescriptorSets *renderable_desc_sets;
|
||||||
|
|
||||||
uint32_t ubo_offset;
|
uint32_t ubo_offset;
|
||||||
@ -36,7 +37,7 @@ namespace hgl
|
|||||||
private:
|
private:
|
||||||
|
|
||||||
Pipeline * last_pipeline;
|
Pipeline * last_pipeline;
|
||||||
MaterialParameters * last_mi;
|
MaterialParameters *last_mp[(size_t)DescriptorSetsType::RANGE_SIZE];
|
||||||
uint32_t last_vbo;
|
uint32_t last_vbo;
|
||||||
|
|
||||||
void Render(RenderableInstance *);
|
void Render(RenderableInstance *);
|
||||||
|
@ -57,14 +57,14 @@ class GPUSemaphore;
|
|||||||
enum class DescriptorSetsType
|
enum class DescriptorSetsType
|
||||||
{
|
{
|
||||||
//设计使其对应shader中的sets
|
//设计使其对应shader中的sets
|
||||||
|
|
||||||
Material=0, ///<材质中永远不变的参数
|
Global=0, ///<全局参数(如太阳光等)
|
||||||
|
Material, ///<材质中永远不变的参数
|
||||||
// Texture, ///<材质中的纹理参数
|
// Texture, ///<材质中的纹理参数
|
||||||
Values, ///<材质中的变量参数
|
Value, ///<材质中的变量参数
|
||||||
Renderable, ///<渲染实例参数(如Local2World matrix)
|
Renderable, ///<渲染实例参数(如Local2World matrix)
|
||||||
Global, ///<全局参数(如太阳光等)
|
|
||||||
|
|
||||||
ENUM_CLASS_RANGE(Material,Global)
|
ENUM_CLASS_RANGE(Global,Renderable)
|
||||||
};//
|
};//
|
||||||
|
|
||||||
class DescriptorSetLayoutCreater;
|
class DescriptorSetLayoutCreater;
|
||||||
@ -75,8 +75,11 @@ struct ShaderStage;
|
|||||||
class ShaderResource;
|
class ShaderResource;
|
||||||
class ShaderModule;
|
class ShaderModule;
|
||||||
class VertexShaderModule;
|
class VertexShaderModule;
|
||||||
|
class ShaderModuleMap;
|
||||||
|
|
||||||
class Material;
|
class Material;
|
||||||
class MaterialParameters;
|
class MaterialParameters;
|
||||||
|
class MaterialInstance;
|
||||||
class PipelineLayout;
|
class PipelineLayout;
|
||||||
struct PipelineData;
|
struct PipelineData;
|
||||||
enum class InlinePipeline;
|
enum class InlinePipeline;
|
||||||
|
@ -94,7 +94,9 @@ public:
|
|||||||
|
|
||||||
pipeline_layout=dsl->GetPipelineLayout();
|
pipeline_layout=dsl->GetPipelineLayout();
|
||||||
|
|
||||||
vkCmdBindDescriptorSets(cmd_buf,VK_PIPELINE_BIND_POINT_GRAPHICS,pipeline_layout,0,1,dsl->GetDescriptorSets(),0,nullptr);
|
const VkDescriptorSet ds=dsl->GetDescriptorSet();
|
||||||
|
|
||||||
|
vkCmdBindDescriptorSets(cmd_buf,VK_PIPELINE_BIND_POINT_GRAPHICS,pipeline_layout,0,1,&ds,0,nullptr);
|
||||||
|
|
||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
@ -105,11 +107,24 @@ public:
|
|||||||
|
|
||||||
pipeline_layout=dsl->GetPipelineLayout();
|
pipeline_layout=dsl->GetPipelineLayout();
|
||||||
|
|
||||||
vkCmdBindDescriptorSets(cmd_buf,VK_PIPELINE_BIND_POINT_GRAPHICS,pipeline_layout,0,1,dsl->GetDescriptorSets(),1,&offset);
|
const VkDescriptorSet ds=dsl->GetDescriptorSet();
|
||||||
|
|
||||||
|
vkCmdBindDescriptorSets(cmd_buf,VK_PIPELINE_BIND_POINT_GRAPHICS,pipeline_layout,0,1,&ds,1,&offset);
|
||||||
|
|
||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool BindDescriptorSets(VkPipelineLayout pipeline_layout,const VkDescriptorSet *ds_list,const uint32_t ds_count,const uint32_t *offset,const uint32_t offset_count)
|
||||||
|
{
|
||||||
|
if(!ds_list||ds_count<=0)return(false);
|
||||||
|
|
||||||
|
vkCmdBindDescriptorSets(cmd_buf,VK_PIPELINE_BIND_POINT_GRAPHICS,pipeline_layout,0,ds_count,ds_list,offset_count,offset);
|
||||||
|
|
||||||
|
return(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool BindDescriptorSets(RenderableInstance *ri);
|
||||||
|
|
||||||
bool PushDescriptorSet(VkPipelineLayout pipeline_layout,uint32_t set,uint32_t count,const VkWriteDescriptorSet *write_desc_set)
|
bool PushDescriptorSet(VkPipelineLayout pipeline_layout,uint32_t set,uint32_t count,const VkWriteDescriptorSet *write_desc_set)
|
||||||
{
|
{
|
||||||
vkCmdPushDescriptorSetKHR(cmd_buf,VK_PIPELINE_BIND_POINT_GRAPHICS,pipeline_layout,set,count,write_desc_set);
|
vkCmdPushDescriptorSetKHR(cmd_buf,VK_PIPELINE_BIND_POINT_GRAPHICS,pipeline_layout,set,count,write_desc_set);
|
||||||
|
@ -36,7 +36,7 @@ public:
|
|||||||
~DescriptorSets()=default;
|
~DescriptorSets()=default;
|
||||||
|
|
||||||
const uint32_t GetCount ()const{return layout_binding_count;}
|
const uint32_t GetCount ()const{return layout_binding_count;}
|
||||||
const VkDescriptorSet * GetDescriptorSets ()const{return &desc_set;}
|
const VkDescriptorSet GetDescriptorSet ()const{return desc_set;}
|
||||||
const VkPipelineLayout GetPipelineLayout ()const{return pipeline_layout;}
|
const VkPipelineLayout GetPipelineLayout ()const{return pipeline_layout;}
|
||||||
|
|
||||||
void Clear();
|
void Clear();
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
#include<hgl/graph/VKSampler.h>
|
#include<hgl/graph/VKSampler.h>
|
||||||
#include<hgl/graph/VKTexture.h>
|
#include<hgl/graph/VKTexture.h>
|
||||||
#include<hgl/graph/VKMaterialParameters.h>
|
#include<hgl/graph/VKMaterialParameters.h>
|
||||||
|
#include<hgl/graph/VKMaterialInstance.h>
|
||||||
#include<hgl/graph/VertexAttribData.h>
|
#include<hgl/graph/VertexAttribData.h>
|
||||||
#include<hgl/graph/VKRenderableInstance.h>
|
#include<hgl/graph/VKRenderableInstance.h>
|
||||||
#include<hgl/graph/font/TextRenderable.h>
|
#include<hgl/graph/font/TextRenderable.h>
|
||||||
@ -37,7 +38,7 @@ class RenderResource
|
|||||||
Map<OSString,Texture *> texture_by_name;
|
Map<OSString,Texture *> texture_by_name;
|
||||||
|
|
||||||
IDResManage<MaterialID, Material> rm_material; ///<材质合集
|
IDResManage<MaterialID, Material> rm_material; ///<材质合集
|
||||||
IDResManage<MaterialInstanceID, MaterialParameters> rm_material_instance; ///<材质实例合集
|
IDResManage<MaterialInstanceID, MaterialInstance> rm_material_instance; ///<材质实例合集
|
||||||
IDResManage<DescriptorSetsID, DescriptorSets> rm_desc_sets; ///<描述符合集
|
IDResManage<DescriptorSetsID, DescriptorSets> rm_desc_sets; ///<描述符合集
|
||||||
IDResManage<RenderableID, Renderable> rm_renderables; ///<可渲染对象合集
|
IDResManage<RenderableID, Renderable> rm_renderables; ///<可渲染对象合集
|
||||||
IDResManage<BufferID, GPUBuffer> rm_buffers; ///<顶点缓冲区合集
|
IDResManage<BufferID, GPUBuffer> rm_buffers; ///<顶点缓冲区合集
|
||||||
@ -53,7 +54,7 @@ public:
|
|||||||
public: //Add
|
public: //Add
|
||||||
|
|
||||||
MaterialID Add(Material * mtl ){return rm_material.Add(mtl);}
|
MaterialID Add(Material * mtl ){return rm_material.Add(mtl);}
|
||||||
MaterialInstanceID Add(MaterialParameters * mi ){return rm_material_instance.Add(mi);}
|
MaterialInstanceID Add(MaterialInstance * mi ){return rm_material_instance.Add(mi);}
|
||||||
DescriptorSetsID Add(DescriptorSets * ds ){return rm_desc_sets.Add(ds);}
|
DescriptorSetsID Add(DescriptorSets * ds ){return rm_desc_sets.Add(ds);}
|
||||||
RenderableID Add(Renderable * r ){return rm_renderables.Add(r);}
|
RenderableID Add(Renderable * r ){return rm_renderables.Add(r);}
|
||||||
BufferID Add(GPUBuffer * buf ){return rm_buffers.Add(buf);}
|
BufferID Add(GPUBuffer * buf ){return rm_buffers.Add(buf);}
|
||||||
@ -93,13 +94,13 @@ public: //Material
|
|||||||
Material * CreateMaterial(const UTF8String &mtl_name,const OSString &vertex_shader_filename,const OSString &geometry_shader_filename,const OSString &fragment_shader_filename);
|
Material * CreateMaterial(const UTF8String &mtl_name,const OSString &vertex_shader_filename,const OSString &geometry_shader_filename,const OSString &fragment_shader_filename);
|
||||||
|
|
||||||
Material * CreateMaterial(const OSString &);
|
Material * CreateMaterial(const OSString &);
|
||||||
MaterialParameters * CreateMaterialInstance(Material *);
|
MaterialInstance * CreateMaterialInstance(Material *);
|
||||||
MaterialParameters * CreateMaterialInstance(const OSString &);
|
MaterialInstance * CreateMaterialInstance(const OSString &);
|
||||||
|
|
||||||
Renderable * CreateRenderable(const uint32_t vertex_count=0);
|
Renderable * CreateRenderable(const uint32_t vertex_count=0);
|
||||||
TextRenderable * CreateTextRenderable(Material *);
|
TextRenderable * CreateTextRenderable(Material *);
|
||||||
|
|
||||||
RenderableInstance *CreateRenderableInstance(Renderable *r,MaterialParameters *mi,Pipeline *p);
|
RenderableInstance *CreateRenderableInstance(Renderable *r,MaterialInstance *mi,Pipeline *p);
|
||||||
|
|
||||||
Sampler * CreateSampler(VkSamplerCreateInfo *sci=nullptr);
|
Sampler * CreateSampler(VkSamplerCreateInfo *sci=nullptr);
|
||||||
|
|
||||||
@ -110,7 +111,7 @@ public: //texture
|
|||||||
public: //Get
|
public: //Get
|
||||||
|
|
||||||
Material * GetMaterial (const MaterialID &id){return rm_material.Get(id);}
|
Material * GetMaterial (const MaterialID &id){return rm_material.Get(id);}
|
||||||
MaterialParameters * GetMaterialInstance (const MaterialInstanceID &id){return rm_material_instance.Get(id);}
|
MaterialInstance * GetMaterialInstance (const MaterialInstanceID &id){return rm_material_instance.Get(id);}
|
||||||
DescriptorSets * GetDescSets (const DescriptorSetsID &id){return rm_desc_sets.Get(id);}
|
DescriptorSets * GetDescSets (const DescriptorSetsID &id){return rm_desc_sets.Get(id);}
|
||||||
Renderable * GetRenderable (const RenderableID &id){return rm_renderables.Get(id);}
|
Renderable * GetRenderable (const RenderableID &id){return rm_renderables.Get(id);}
|
||||||
GPUBuffer * GetBuffer (const BufferID &id){return rm_buffers.Get(id);}
|
GPUBuffer * GetBuffer (const BufferID &id){return rm_buffers.Get(id);}
|
||||||
|
@ -54,12 +54,12 @@ public:
|
|||||||
|
|
||||||
public: //pipeline
|
public: //pipeline
|
||||||
|
|
||||||
Pipeline *CreatePipeline(Material *, const InlinePipeline &, const Prim &prim=Prim::Triangles,const bool prim_restart=false);
|
Pipeline *CreatePipeline(const Material *, const InlinePipeline &, const Prim &prim=Prim::Triangles,const bool prim_restart=false);
|
||||||
Pipeline *CreatePipeline(MaterialParameters *, const InlinePipeline &, const Prim &prim=Prim::Triangles,const bool prim_restart=false);
|
Pipeline *CreatePipeline(const MaterialInstance *, const InlinePipeline &, const Prim &prim=Prim::Triangles,const bool prim_restart=false);
|
||||||
Pipeline *CreatePipeline(Material *, PipelineData *, const Prim &prim=Prim::Triangles,const bool prim_restart=false);
|
Pipeline *CreatePipeline(const Material *, PipelineData *, const Prim &prim=Prim::Triangles,const bool prim_restart=false);
|
||||||
Pipeline *CreatePipeline(MaterialParameters *, PipelineData *, const Prim &prim=Prim::Triangles,const bool prim_restart=false);
|
Pipeline *CreatePipeline(const MaterialInstance *, PipelineData *, const Prim &prim=Prim::Triangles,const bool prim_restart=false);
|
||||||
Pipeline *CreatePipeline(Material *, const OSString &, const Prim &prim=Prim::Triangles,const bool prim_restart=false);
|
Pipeline *CreatePipeline(const Material *, const OSString &, const Prim &prim=Prim::Triangles,const bool prim_restart=false);
|
||||||
Pipeline *CreatePipeline(MaterialParameters *, const OSString &, const Prim &prim=Prim::Triangles,const bool prim_restart=false);
|
Pipeline *CreatePipeline(const MaterialInstance *, const OSString &, const Prim &prim=Prim::Triangles,const bool prim_restart=false);
|
||||||
|
|
||||||
public: // command buffer
|
public: // command buffer
|
||||||
|
|
||||||
|
@ -4,7 +4,9 @@
|
|||||||
#include<hgl/graph/VKRenderable.h>
|
#include<hgl/graph/VKRenderable.h>
|
||||||
#include<hgl/graph/VKPipeline.h>
|
#include<hgl/graph/VKPipeline.h>
|
||||||
#include<hgl/graph/VKDescriptorSets.h>
|
#include<hgl/graph/VKDescriptorSets.h>
|
||||||
|
#include<hgl/graph/VKMaterial.h>
|
||||||
#include<hgl/graph/VKMaterialParameters.h>
|
#include<hgl/graph/VKMaterialParameters.h>
|
||||||
|
#include<hgl/graph/VKMaterialInstance.h>
|
||||||
VK_NAMESPACE_BEGIN
|
VK_NAMESPACE_BEGIN
|
||||||
/**
|
/**
|
||||||
* 可渲染对象实例<br>
|
* 可渲染对象实例<br>
|
||||||
@ -13,10 +15,10 @@ VK_NAMESPACE_BEGIN
|
|||||||
class RenderableInstance ///可渲染对象实例
|
class RenderableInstance ///可渲染对象实例
|
||||||
{
|
{
|
||||||
Pipeline * pipeline;
|
Pipeline * pipeline;
|
||||||
MaterialParameters * mat_inst;
|
MaterialInstance * mat_inst;
|
||||||
Renderable * render_obj;
|
Renderable * render_obj;
|
||||||
|
|
||||||
DescriptorSets * descriptor_sets; ///<渲染实例专用描述符合集,一般用于存LocalToWorld等等
|
MaterialParameters *mp_r;
|
||||||
|
|
||||||
uint32_t buffer_count;
|
uint32_t buffer_count;
|
||||||
VkBuffer * buffer_list;
|
VkBuffer * buffer_list;
|
||||||
@ -26,16 +28,17 @@ class RenderableInstance
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
friend RenderableInstance *CreateRenderableInstance(Renderable *,MaterialParameters *,Pipeline *);
|
friend RenderableInstance *CreateRenderableInstance(Renderable *,MaterialInstance *,Pipeline *);
|
||||||
|
|
||||||
RenderableInstance(Renderable *,MaterialParameters *,Pipeline *,const uint32_t,VkBuffer *,VkDeviceSize *);
|
RenderableInstance(Renderable *,MaterialInstance *,Pipeline *,const uint32_t,VkBuffer *,VkDeviceSize *);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
virtual ~RenderableInstance();
|
virtual ~RenderableInstance();
|
||||||
|
|
||||||
Pipeline * GetPipeline (){return pipeline;}
|
Pipeline * GetPipeline (){return pipeline;}
|
||||||
MaterialParameters * GetMaterialInstance (){return mat_inst;}
|
VkPipelineLayout GetPipelineLayout (){return mat_inst->GetMaterial()->GetPipelineLayout();}
|
||||||
|
MaterialInstance * GetMaterialInstance (){return mat_inst;}
|
||||||
Renderable * GetRenderable (){return render_obj;}
|
Renderable * GetRenderable (){return render_obj;}
|
||||||
const AABB & GetBoundingBox ()const{return render_obj->GetBoundingBox();}
|
const AABB & GetBoundingBox ()const{return render_obj->GetBoundingBox();}
|
||||||
|
|
||||||
@ -48,53 +51,9 @@ public:
|
|||||||
|
|
||||||
const uint32_t GetBufferHash ()const{return buffer_hash;}
|
const uint32_t GetBufferHash ()const{return buffer_hash;}
|
||||||
|
|
||||||
DescriptorSets * GetMIDescSets ()const{return mat_inst->GetDescriptorSets();}
|
MaterialParameters *GetMP (const DescriptorSetsType &type);
|
||||||
DescriptorSets * GetRIDescSets ()const{return descriptor_sets;}
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
const int Comp(const RenderableInstance *ri)const
|
|
||||||
{
|
|
||||||
//绘制顺序:
|
|
||||||
|
|
||||||
// ARM Mali GPU : 不透明、AlphaTest、半透明
|
|
||||||
// Adreno/NV/AMD: AlphaTest、不透明、半透明
|
|
||||||
// PowerVR: 同Adreno/NV/AMD,但不透明部分可以不排序
|
|
||||||
|
|
||||||
if(pipeline->IsAlphaBlend())
|
|
||||||
{
|
|
||||||
if(!ri->pipeline->IsAlphaBlend())
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if(ri->pipeline->IsAlphaBlend())
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(pipeline->IsAlphaTest())
|
|
||||||
{
|
|
||||||
if(!ri->pipeline->IsAlphaTest())
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if(ri->pipeline->IsAlphaTest())
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(pipeline!=ri->pipeline)
|
|
||||||
return pipeline-ri->pipeline;
|
|
||||||
|
|
||||||
if(mat_inst!=ri->mat_inst)
|
|
||||||
return int64(mat_inst)-int64(ri->mat_inst);
|
|
||||||
|
|
||||||
return render_obj-ri->render_obj;
|
|
||||||
}
|
|
||||||
|
|
||||||
CompOperator(const RenderableInstance *,Comp)
|
|
||||||
};//class RenderableInstance
|
};//class RenderableInstance
|
||||||
|
|
||||||
RenderableInstance *CreateRenderableInstance(Renderable *,MaterialParameters *,Pipeline *);
|
RenderableInstance *CreateRenderableInstance(Renderable *,MaterialInstance *,Pipeline *);
|
||||||
VK_NAMESPACE_END
|
VK_NAMESPACE_END
|
||||||
#endif//HGL_GRAPH_RENDERABLE_INSTANCE_INCLUDE
|
#endif//HGL_GRAPH_RENDERABLE_INSTANCE_INCLUDE
|
||||||
|
2
res
2
res
@ -1 +1 @@
|
|||||||
Subproject commit e4745bfcae2661e4eae3401855d055aa508a4768
|
Subproject commit 6ef48a1250b9b21bde3ca8011b74a19773c5229a
|
@ -161,8 +161,10 @@ SET(VK_TEXTURE_SOURCE ${SG_INCLUDE_PATH}/VKImageView.h
|
|||||||
|
|
||||||
SET(VK_MATERIAL_SOURCE ${SG_INCLUDE_PATH}/VKMaterial.h
|
SET(VK_MATERIAL_SOURCE ${SG_INCLUDE_PATH}/VKMaterial.h
|
||||||
${SG_INCLUDE_PATH}/VKMaterialParameters.h
|
${SG_INCLUDE_PATH}/VKMaterialParameters.h
|
||||||
|
${SG_INCLUDE_PATH}/VKMaterialInstance.h
|
||||||
Vulkan/VKMaterial.cpp
|
Vulkan/VKMaterial.cpp
|
||||||
Vulkan/VKMaterialParameters.cpp)
|
Vulkan/VKMaterialParameters.cpp
|
||||||
|
Vulkan/VKMaterialInstance.cpp)
|
||||||
|
|
||||||
SOURCE_GROUP("Vulkan\\Material" FILES ${VK_MATERIAL_SOURCE})
|
SOURCE_GROUP("Vulkan\\Material" FILES ${VK_MATERIAL_SOURCE})
|
||||||
SOURCE_GROUP("Vulkan\\Material\\Texture" FILES ${VK_TEXTURE_SOURCE})
|
SOURCE_GROUP("Vulkan\\Material\\Texture" FILES ${VK_TEXTURE_SOURCE})
|
||||||
|
@ -23,7 +23,7 @@ namespace hgl
|
|||||||
ubo_align =0;
|
ubo_align =0;
|
||||||
|
|
||||||
last_pipeline =nullptr;
|
last_pipeline =nullptr;
|
||||||
last_mi =nullptr;
|
hgl_zero(last_mp);
|
||||||
last_vbo =0;
|
last_vbo =0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -44,17 +44,38 @@ namespace hgl
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
MaterialParameters *mi=ri->GetMaterialInstance();
|
int ds_count=0;
|
||||||
|
MaterialParameters *mp;
|
||||||
|
|
||||||
if(mi!=last_mi)
|
for(int i=(int)DescriptorSetsType::BEGIN_RANGE;
|
||||||
|
i<(int)DescriptorSetsType::Renderable;
|
||||||
|
i++)
|
||||||
{
|
{
|
||||||
last_mi=mi;
|
mp=ri->GetMP((DescriptorSetsType)i);
|
||||||
cmd_buf->BindDescriptorSets(mi->GetDescriptorSets());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
if(last_mp[i]!=mp)
|
||||||
|
{
|
||||||
|
last_mp[i]=mp;
|
||||||
|
|
||||||
|
if(mp)
|
||||||
|
{
|
||||||
|
ds_list[ds_count]=mp->GetVkDescriptorSet();
|
||||||
|
++ds_count;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
mp=ri->GetMP(DescriptorSetsType::Renderable);
|
||||||
|
|
||||||
|
if(mp)
|
||||||
|
{
|
||||||
|
ds_list[ds_count]=mp->GetVkDescriptorSet();
|
||||||
|
++ds_count;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cmd_buf->BindDescriptorSets(ri->GetPipelineLayout(),ds_list,ds_count,&ubo_offset,1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(last_vbo!=ri->GetBufferHash())
|
if(last_vbo!=ri->GetBufferHash())
|
||||||
@ -90,8 +111,8 @@ namespace hgl
|
|||||||
|
|
||||||
cmd_buf=cb;
|
cmd_buf=cb;
|
||||||
|
|
||||||
last_pipeline=nullptr;
|
last_pipeline=nullptr;
|
||||||
last_mi=nullptr;
|
hgl_zero(last_mp);
|
||||||
last_vbo=0;
|
last_vbo=0;
|
||||||
ubo_offset=0;
|
ubo_offset=0;
|
||||||
|
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
/**
|
/**
|
||||||
* 理论上讲,我们需要按以下顺序排序
|
* 理论上讲,我们需要按以下顺序排序
|
||||||
*
|
*
|
||||||
* for(material)
|
|
||||||
* for(pipeline)
|
* for(pipeline)
|
||||||
* for(material_instance)
|
* for(material_instance)
|
||||||
* for(vbo)
|
* for(vbo)
|
||||||
@ -17,36 +16,40 @@ int Comparator<RenderNodePointer>::compare(const RenderNodePointer &obj_one,cons
|
|||||||
{
|
{
|
||||||
int off;
|
int off;
|
||||||
|
|
||||||
//比较材质
|
hgl::graph::RenderableInstance *ri_one=obj_one->ri;
|
||||||
hgl::graph::MaterialParameters *mi1=obj_one->ri->GetMaterialInstance();
|
hgl::graph::RenderableInstance *ri_two=obj_two->ri;
|
||||||
hgl::graph::MaterialParameters *mi2=obj_two->ri->GetMaterialInstance();
|
|
||||||
|
|
||||||
off=mi1->GetMaterial()-mi2->GetMaterial();
|
|
||||||
|
|
||||||
if(off)
|
|
||||||
return off;
|
|
||||||
|
|
||||||
//比较管线
|
//比较管线
|
||||||
hgl::graph::Pipeline *p1=obj_one->ri->GetPipeline();
|
{
|
||||||
hgl::graph::Pipeline *p2=obj_two->ri->GetPipeline();
|
off=ri_one->GetPipeline()
|
||||||
|
-ri_two->GetPipeline();
|
||||||
|
|
||||||
off=p1-p2;
|
if(off)
|
||||||
|
return off;
|
||||||
if(off)
|
}
|
||||||
return off;
|
|
||||||
|
|
||||||
//比较材质实例
|
//比较材质实例
|
||||||
off=mi1-mi2;
|
{
|
||||||
|
for(int i =(int)hgl::graph::DescriptorSetsType::BEGIN_RANGE;
|
||||||
|
i<=(int)hgl::graph::DescriptorSetsType::END_RANGE;
|
||||||
|
i++)
|
||||||
|
{
|
||||||
|
off=ri_one->GetMP((hgl::graph::DescriptorSetsType)i)
|
||||||
|
-ri_two->GetMP((hgl::graph::DescriptorSetsType)i);
|
||||||
|
|
||||||
|
if(off)
|
||||||
|
return off;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(off)
|
|
||||||
return off;
|
|
||||||
|
|
||||||
//比较vbo+ebo
|
//比较vbo+ebo
|
||||||
off=obj_one->ri->GetBufferHash()
|
{
|
||||||
-obj_two->ri->GetBufferHash();
|
off=ri_one->GetBufferHash()
|
||||||
|
-ri_two->GetBufferHash();
|
||||||
|
|
||||||
if(off)
|
if(off)
|
||||||
return off;
|
return off;
|
||||||
|
}
|
||||||
|
|
||||||
//比较距离
|
//比较距离
|
||||||
{
|
{
|
||||||
|
@ -101,6 +101,38 @@ bool RenderCmdBuffer::BeginRenderPass()
|
|||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool RenderCmdBuffer::BindDescriptorSets(RenderableInstance *ri)
|
||||||
|
{
|
||||||
|
if(!ri)return(false);
|
||||||
|
|
||||||
|
{
|
||||||
|
uint32_t count=0;
|
||||||
|
|
||||||
|
MaterialParameters *mp;
|
||||||
|
VkDescriptorSet ds[(size_t)DescriptorSetsType::RANGE_SIZE];
|
||||||
|
|
||||||
|
ENUM_CLASS_FOR(DescriptorSetsType,int,i)
|
||||||
|
{
|
||||||
|
mp=ri->GetMP((DescriptorSetsType)i);
|
||||||
|
|
||||||
|
if(mp)
|
||||||
|
{
|
||||||
|
ds[count]=mp->GetVkDescriptorSet();
|
||||||
|
++count;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(count>0)
|
||||||
|
{
|
||||||
|
pipeline_layout=ri->GetPipelineLayout();
|
||||||
|
|
||||||
|
vkCmdBindDescriptorSets(cmd_buf,VK_PIPELINE_BIND_POINT_GRAPHICS,pipeline_layout,0,count,ds,0,nullptr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return(false);
|
||||||
|
}
|
||||||
|
|
||||||
bool RenderCmdBuffer::BindVAB(RenderableInstance *ri)
|
bool RenderCmdBuffer::BindVAB(RenderableInstance *ri)
|
||||||
{
|
{
|
||||||
if(!ri)
|
if(!ri)
|
||||||
|
@ -51,7 +51,7 @@ void DescriptorSetLayoutCreater::Bind(const ShaderDescriptorList *sd_list,VkDesc
|
|||||||
&&sd.name[1]=='_')
|
&&sd.name[1]=='_')
|
||||||
index_by_binding[(size_t)DescriptorSetsType::Global].Add(sd.binding,fin_count+old_count);
|
index_by_binding[(size_t)DescriptorSetsType::Global].Add(sd.binding,fin_count+old_count);
|
||||||
else
|
else
|
||||||
index_by_binding[(size_t)DescriptorSetsType::Values].Add(sd.binding,fin_count+old_count);
|
index_by_binding[(size_t)DescriptorSetsType::Value].Add(sd.binding,fin_count+old_count);
|
||||||
|
|
||||||
all_index_by_binding.Add(sd.binding,fin_count+old_count);
|
all_index_by_binding.Add(sd.binding,fin_count+old_count);
|
||||||
|
|
||||||
@ -100,7 +100,7 @@ bool DescriptorSetLayoutCreater::CreatePipelineLayout()
|
|||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
DescriptorSets *DescriptorSetLayoutCreater::Create(const DescriptorSetsType &type)
|
DescriptorSets *DescriptorSetLayoutCreater::Create(const DescriptorSetsType &type)const
|
||||||
{
|
{
|
||||||
if(!pipeline_layout||!dsl)
|
if(!pipeline_layout||!dsl)
|
||||||
return(nullptr);
|
return(nullptr);
|
||||||
@ -110,12 +110,12 @@ DescriptorSets *DescriptorSetLayoutCreater::Create(const DescriptorSetsType &typ
|
|||||||
if(count<=0)
|
if(count<=0)
|
||||||
return(nullptr);
|
return(nullptr);
|
||||||
|
|
||||||
BindingMapping *bm=nullptr;
|
const BindingMapping *bm=nullptr;
|
||||||
|
|
||||||
if(type==DescriptorSetsType::Material
|
if(type==DescriptorSetsType::Material
|
||||||
// ||type==DescriptorSetsType::Texture
|
// ||type==DescriptorSetsType::Texture
|
||||||
||type==DescriptorSetsType::Values) //未来会区分开
|
||type==DescriptorSetsType::Value) //未来会区分开
|
||||||
bm=&index_by_binding[(size_t)DescriptorSetsType::Values];
|
bm=&index_by_binding[(size_t)DescriptorSetsType::Value];
|
||||||
else
|
else
|
||||||
if(type==DescriptorSetsType::Renderable)
|
if(type==DescriptorSetsType::Renderable)
|
||||||
bm=&index_by_binding[(size_t)DescriptorSetsType::Renderable];
|
bm=&index_by_binding[(size_t)DescriptorSetsType::Renderable];
|
||||||
|
@ -66,6 +66,6 @@ public:
|
|||||||
|
|
||||||
const VkPipelineLayout GetPipelineLayout()const{return pipeline_layout;}
|
const VkPipelineLayout GetPipelineLayout()const{return pipeline_layout;}
|
||||||
|
|
||||||
DescriptorSets *Create(const DescriptorSetsType &type);
|
DescriptorSets *Create(const DescriptorSetsType &type)const;
|
||||||
};//class DescriptorSetLayoutCreater
|
};//class DescriptorSetLayoutCreater
|
||||||
VK_NAMESPACE_END
|
VK_NAMESPACE_END
|
@ -4,9 +4,9 @@
|
|||||||
#include<hgl/graph/VKDescriptorSets.h>
|
#include<hgl/graph/VKDescriptorSets.h>
|
||||||
|
|
||||||
VK_NAMESPACE_BEGIN
|
VK_NAMESPACE_BEGIN
|
||||||
MaterialParameters::MaterialParameters(Material *m,const DescriptorSetsType &type,DescriptorSets *ds)
|
MaterialParameters::MaterialParameters(const ShaderModuleMap *smm,const DescriptorSetsType &type,DescriptorSets *ds)
|
||||||
{
|
{
|
||||||
material=m;
|
shader_map=smm;
|
||||||
ds_type=type;
|
ds_type=type;
|
||||||
descriptor_sets=ds;
|
descriptor_sets=ds;
|
||||||
}
|
}
|
||||||
@ -21,7 +21,7 @@ bool MaterialParameters::BindUBO(const AnsiString &name,GPUBuffer *ubo,bool dyna
|
|||||||
if(name.IsEmpty()||!ubo)
|
if(name.IsEmpty()||!ubo)
|
||||||
return(false);
|
return(false);
|
||||||
|
|
||||||
const int index=material->GetUBO(name);
|
const int index=shader_map->GetUBO(name);
|
||||||
|
|
||||||
if(index<0)
|
if(index<0)
|
||||||
return(false);
|
return(false);
|
||||||
@ -37,7 +37,7 @@ bool MaterialParameters::BindSSBO(const AnsiString &name,GPUBuffer *ssbo,bool dy
|
|||||||
if(name.IsEmpty()||!ssbo)
|
if(name.IsEmpty()||!ssbo)
|
||||||
return(false);
|
return(false);
|
||||||
|
|
||||||
const int index=material->GetSSBO(name);
|
const int index=shader_map->GetSSBO(name);
|
||||||
|
|
||||||
if(index<0)
|
if(index<0)
|
||||||
return(false);
|
return(false);
|
||||||
@ -53,7 +53,7 @@ bool MaterialParameters::BindSampler(const AnsiString &name,Texture *tex,Sampler
|
|||||||
if(name.IsEmpty()||!tex||!sampler)
|
if(name.IsEmpty()||!tex||!sampler)
|
||||||
return(false);
|
return(false);
|
||||||
|
|
||||||
const int index=material->GetSampler(name);
|
const int index=shader_map->GetSampler(name);
|
||||||
|
|
||||||
if(index<0)
|
if(index<0)
|
||||||
return(false);
|
return(false);
|
||||||
|
@ -50,11 +50,11 @@ IndexBuffer *RenderResource::CreateIBO(IndexType index_type,uint32_t count,const
|
|||||||
return(buf);
|
return(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
MaterialParameters *RenderResource::CreateMaterialInstance(Material *mtl)
|
MaterialInstance *RenderResource::CreateMaterialInstance(Material *mtl)
|
||||||
{
|
{
|
||||||
if(!mtl)return(nullptr);
|
if(!mtl)return(nullptr);
|
||||||
|
|
||||||
MaterialParameters *mi=mtl->CreateMP();
|
MaterialInstance *mi=mtl->CreateInstance();
|
||||||
|
|
||||||
if(mi)
|
if(mi)
|
||||||
Add(mi);
|
Add(mi);
|
||||||
@ -62,7 +62,7 @@ MaterialParameters *RenderResource::CreateMaterialInstance(Material *mtl)
|
|||||||
return mi;
|
return mi;
|
||||||
}
|
}
|
||||||
|
|
||||||
MaterialParameters *RenderResource::CreateMaterialInstance(const OSString &mtl_filename)
|
MaterialInstance *RenderResource::CreateMaterialInstance(const OSString &mtl_filename)
|
||||||
{
|
{
|
||||||
Material *mtl=this->CreateMaterial(mtl_filename);
|
Material *mtl=this->CreateMaterial(mtl_filename);
|
||||||
|
|
||||||
@ -96,7 +96,7 @@ TextRenderable *RenderResource::CreateTextRenderable(Material *mtl)
|
|||||||
return tr;
|
return tr;
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderableInstance *RenderResource::CreateRenderableInstance(Renderable *r,MaterialParameters *mi,Pipeline *p)
|
RenderableInstance *RenderResource::CreateRenderableInstance(Renderable *r,MaterialInstance *mi,Pipeline *p)
|
||||||
{
|
{
|
||||||
if(!p||!mi||!r)
|
if(!p||!mi||!r)
|
||||||
return(nullptr);
|
return(nullptr);
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
#include<hgl/graph/VKRenderTarget.h>
|
#include<hgl/graph/VKRenderTarget.h>
|
||||||
#include<hgl/graph/VKMaterialParameters.h>
|
#include<hgl/graph/VKMaterialInstance.h>
|
||||||
#include<hgl/graph/VKDevice.h>
|
#include<hgl/graph/VKDevice.h>
|
||||||
#include<hgl/graph/VKInlinePipeline.h>
|
#include<hgl/graph/VKInlinePipeline.h>
|
||||||
#include<hgl/graph/VKPipelineData.h>
|
#include<hgl/graph/VKPipelineData.h>
|
||||||
|
|
||||||
VK_NAMESPACE_BEGIN
|
VK_NAMESPACE_BEGIN
|
||||||
Pipeline *RenderTarget::CreatePipeline(Material *mtl,const InlinePipeline &ip,const Prim &prim,const bool prim_restart)
|
Pipeline *RenderTarget::CreatePipeline(const Material *mtl,const InlinePipeline &ip,const Prim &prim,const bool prim_restart)
|
||||||
{
|
{
|
||||||
if(!mtl)return(nullptr);
|
if(!mtl)return(nullptr);
|
||||||
|
|
||||||
@ -21,14 +21,14 @@ Pipeline *RenderTarget::CreatePipeline(Material *mtl,const InlinePipeline &ip,co
|
|||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
Pipeline *RenderTarget::CreatePipeline(MaterialParameters *mi,const InlinePipeline &ip,const Prim &prim,const bool prim_restart)
|
Pipeline *RenderTarget::CreatePipeline(const MaterialInstance *mi,const InlinePipeline &ip,const Prim &prim,const bool prim_restart)
|
||||||
{
|
{
|
||||||
if(!mi)return(nullptr);
|
if(!mi)return(nullptr);
|
||||||
|
|
||||||
return CreatePipeline(mi->GetMaterial(),ip,prim,prim_restart);
|
return CreatePipeline(mi->GetMaterial(),ip,prim,prim_restart);
|
||||||
}
|
}
|
||||||
|
|
||||||
Pipeline *RenderTarget::CreatePipeline(Material *mtl,PipelineData *pd,const Prim &prim,const bool prim_restart)
|
Pipeline *RenderTarget::CreatePipeline(const Material *mtl,PipelineData *pd,const Prim &prim,const bool prim_restart)
|
||||||
{
|
{
|
||||||
pd->Set(prim,prim_restart);
|
pd->Set(prim,prim_restart);
|
||||||
|
|
||||||
@ -40,12 +40,12 @@ Pipeline *RenderTarget::CreatePipeline(Material *mtl,PipelineData *pd,const Prim
|
|||||||
return(p);
|
return(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
Pipeline *RenderTarget::CreatePipeline(MaterialParameters *mi,PipelineData *pd,const Prim &prim,const bool prim_restart)
|
Pipeline *RenderTarget::CreatePipeline(const MaterialInstance *mi,PipelineData *pd,const Prim &prim,const bool prim_restart)
|
||||||
{
|
{
|
||||||
return CreatePipeline(mi->GetMaterial(),pd,prim,prim_restart);
|
return CreatePipeline(mi->GetMaterial(),pd,prim,prim_restart);
|
||||||
}
|
}
|
||||||
|
|
||||||
Pipeline *RenderTarget::CreatePipeline(Material *mtl,const OSString &pipeline_filename,const Prim &prim,const bool prim_restart)
|
Pipeline *RenderTarget::CreatePipeline(const Material *mtl,const OSString &pipeline_filename,const Prim &prim,const bool prim_restart)
|
||||||
{
|
{
|
||||||
PipelineData *pd=GetPipelineData(pipeline_filename);
|
PipelineData *pd=GetPipelineData(pipeline_filename);
|
||||||
|
|
||||||
@ -54,7 +54,7 @@ Pipeline *RenderTarget::CreatePipeline(Material *mtl,const OSString &pipeline_fi
|
|||||||
return CreatePipeline(mtl,pd,prim,prim_restart);
|
return CreatePipeline(mtl,pd,prim,prim_restart);
|
||||||
}
|
}
|
||||||
|
|
||||||
Pipeline *RenderTarget::CreatePipeline(MaterialParameters *mi,const OSString &filename,const Prim &prim,const bool prim_restart)
|
Pipeline *RenderTarget::CreatePipeline(const MaterialInstance *mi,const OSString &filename,const Prim &prim,const bool prim_restart)
|
||||||
{
|
{
|
||||||
return CreatePipeline(mi->GetMaterial(),filename,prim,prim_restart);
|
return CreatePipeline(mi->GetMaterial(),filename,prim,prim_restart);
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#include<hgl/graph/VKRenderableInstance.h>
|
#include<hgl/graph/VKRenderableInstance.h>
|
||||||
|
#include<hgl/graph/VKMaterialInstance.h>
|
||||||
#include<hgl/graph/VKMaterialParameters.h>
|
#include<hgl/graph/VKMaterialParameters.h>
|
||||||
#include<hgl/graph/VKMaterial.h>
|
#include<hgl/graph/VKMaterial.h>
|
||||||
#include<hgl/graph/VKVertexAttribBuffer.h>
|
#include<hgl/graph/VKVertexAttribBuffer.h>
|
||||||
@ -8,13 +9,13 @@ VK_NAMESPACE_BEGIN
|
|||||||
|
|
||||||
using namespace util;
|
using namespace util;
|
||||||
|
|
||||||
RenderableInstance::RenderableInstance(Renderable *r,MaterialParameters *mi,Pipeline *p,const uint32_t count,VkBuffer *bl,VkDeviceSize *bs)
|
RenderableInstance::RenderableInstance(Renderable *r,MaterialInstance *mi,Pipeline *p,const uint32_t count,VkBuffer *bl,VkDeviceSize *bs)
|
||||||
{
|
{
|
||||||
render_obj=r;
|
render_obj=r;
|
||||||
mat_inst=mi;
|
|
||||||
pipeline=p;
|
pipeline=p;
|
||||||
|
mat_inst=mi;
|
||||||
|
|
||||||
descriptor_sets=nullptr;
|
mp_r=mi->GetMaterial()->CreateMP(DescriptorSetsType::Renderable);
|
||||||
|
|
||||||
buffer_count=count;
|
buffer_count=count;
|
||||||
buffer_list=bl;
|
buffer_list=bl;
|
||||||
@ -28,18 +29,26 @@ RenderableInstance::RenderableInstance(Renderable *r,MaterialParameters *mi,Pipe
|
|||||||
|
|
||||||
RenderableInstance::~RenderableInstance()
|
RenderableInstance::~RenderableInstance()
|
||||||
{
|
{
|
||||||
SAFE_CLEAR(descriptor_sets);
|
SAFE_CLEAR(mp_r);
|
||||||
//需要在这里添加删除pipeline/desc_sets/render_obj引用计数的代码
|
//需要在这里添加删除pipeline/desc_sets/render_obj引用计数的代码
|
||||||
|
|
||||||
delete[] buffer_list;
|
delete[] buffer_list;
|
||||||
delete[] buffer_size;
|
delete[] buffer_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderableInstance *CreateRenderableInstance(Renderable *r,MaterialParameters *mi,Pipeline *p)
|
MaterialParameters *RenderableInstance::GetMP(const DescriptorSetsType &type)
|
||||||
|
{
|
||||||
|
if(type==DescriptorSetsType::Renderable)
|
||||||
|
return mp_r;
|
||||||
|
|
||||||
|
return mat_inst->GetMP(type);
|
||||||
|
}
|
||||||
|
|
||||||
|
RenderableInstance *CreateRenderableInstance(Renderable *r,MaterialInstance *mi,Pipeline *p)
|
||||||
{
|
{
|
||||||
if(!r||!mi||!p)return(nullptr);
|
if(!r||!mi||!p)return(nullptr);
|
||||||
|
|
||||||
Material *mtl=mi->GetMaterial();
|
const Material *mtl=mi->GetMaterial();
|
||||||
|
|
||||||
if(!mtl)return(nullptr);
|
if(!mtl)return(nullptr);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user