refactor and renamed MaterialInstance to MaterialParameters.
This commit is contained in:
parent
bc8848afa6
commit
3658171954
2
CMCore
2
CMCore
@ -1 +1 @@
|
||||
Subproject commit c22207b6401476bf8859e581a28346326e6d482b
|
||||
Subproject commit 109e52db4da1c88a30ecb33e121f9ac06fcab397
|
@ -15,7 +15,7 @@
|
||||
#include<hgl/graph/VKFormat.h>
|
||||
#include<hgl/graph/VKFramebuffer.h>
|
||||
#include<hgl/graph/VKMaterial.h>
|
||||
#include<hgl/graph/VKMaterialInstance.h>
|
||||
#include<hgl/graph/VKMaterialParameters.h>
|
||||
#include<hgl/graph/VKRenderTarget.h>
|
||||
#include<hgl/graph/VKRenderResource.h>
|
||||
#include<hgl/graph/RenderList.h>
|
||||
|
@ -4,7 +4,7 @@
|
||||
#include<hgl/graph/RenderList.h>
|
||||
#include<hgl/graph/VKPipeline.h>
|
||||
#include<hgl/graph/VKMaterial.h>
|
||||
#include<hgl/graph/VKMaterialInstance.h>
|
||||
#include<hgl/graph/VKMaterialParameters.h>
|
||||
|
||||
using RenderNodePointer=hgl::graph::RenderNode *;
|
||||
|
||||
|
@ -54,7 +54,21 @@ class RenderPass;
|
||||
class GPUFence;
|
||||
class GPUSemaphore;
|
||||
|
||||
enum class DescriptorSetsType
|
||||
{
|
||||
//设计使其对应shader中的sets
|
||||
|
||||
Material=0, ///<材质中永远不变的参数
|
||||
// Texture, ///<材质中的纹理参数
|
||||
Values, ///<材质中的变量参数
|
||||
Renderable, ///<渲染实例参数(如Local2World matrix)
|
||||
Global, ///<全局参数(如太阳光等)
|
||||
|
||||
ENUM_CLASS_RANGE(Material,Global)
|
||||
};//
|
||||
|
||||
class DescriptorSetLayoutCreater;
|
||||
class DescriptorSets;
|
||||
|
||||
struct ShaderStage;
|
||||
|
||||
@ -67,7 +81,6 @@ class PipelineLayout;
|
||||
struct PipelineData;
|
||||
enum class InlinePipeline;
|
||||
class Pipeline;
|
||||
class DescriptorSets;
|
||||
class VertexAttributeBinding;
|
||||
|
||||
class Renderable;
|
||||
|
@ -23,8 +23,7 @@ class Material
|
||||
|
||||
DescriptorSetLayoutCreater *dsl_creater;
|
||||
|
||||
DescriptorSets *g_desc_sets;
|
||||
DescriptorSets *ri_desc_sets;
|
||||
MaterialParameters *mp_m,*mp_g,*mp_r;
|
||||
|
||||
VertexAttributeBinding *vab;
|
||||
|
||||
@ -63,10 +62,6 @@ public:
|
||||
const VkPipelineShaderStageCreateInfo * GetStages ()const{return shader_stage_list->GetData();}
|
||||
|
||||
const VkPipelineLayout GetPipelineLayout ()const;
|
||||
DescriptorSets * CreateMIDescriptorSets ()const;
|
||||
|
||||
DescriptorSets * GetGlobalDescriptorSets (){return g_desc_sets;}
|
||||
DescriptorSets * GetRIDescriptorSets (){return ri_desc_sets;}
|
||||
|
||||
const VertexAttributeBinding * GetVAB ()const{return vab;}
|
||||
const uint32_t GetVertexAttrCount ()const{return vab->GetVertexAttrCount();}
|
||||
@ -75,7 +70,14 @@ public:
|
||||
|
||||
public:
|
||||
|
||||
MaterialParameters * CreateInstance ();
|
||||
MaterialParameters * CreateMP (const DescriptorSetsType &type=DescriptorSetsType::Values);
|
||||
MaterialParameters * GetMP (const DescriptorSetsType &type)
|
||||
{
|
||||
if(type==DescriptorSetsType::Material )return mp_m;else
|
||||
if(type==DescriptorSetsType::Renderable )return mp_r;else
|
||||
if(type==DescriptorSetsType::Global )return mp_g;else
|
||||
return(nullptr);
|
||||
}
|
||||
};//class Material
|
||||
VK_NAMESPACE_END
|
||||
#endif//HGL_GRAPH_VULKAN_MATERIAL_INCLUDE
|
||||
|
@ -28,7 +28,7 @@ public:
|
||||
|
||||
#define MP_TYPE_IS(name) const bool is##name()const{return ds_type==DescriptorSetsType::name;}
|
||||
MP_TYPE_IS(Material)
|
||||
MP_TYPE_IS(Texture)
|
||||
// MP_TYPE_IS(Texture)
|
||||
MP_TYPE_IS(Values)
|
||||
MP_TYPE_IS(Renderable)
|
||||
MP_TYPE_IS(Global)
|
@ -8,7 +8,7 @@
|
||||
#include<hgl/graph/VKBuffer.h>
|
||||
#include<hgl/graph/VKSampler.h>
|
||||
#include<hgl/graph/VKTexture.h>
|
||||
#include<hgl/graph/VKMaterialInstance.h>
|
||||
#include<hgl/graph/VKMaterialParameters.h>
|
||||
#include<hgl/graph/VertexAttribData.h>
|
||||
#include<hgl/graph/VKRenderableInstance.h>
|
||||
#include<hgl/graph/font/TextRenderable.h>
|
||||
|
@ -55,11 +55,11 @@ public:
|
||||
public: //pipeline
|
||||
|
||||
Pipeline *CreatePipeline(Material *, const InlinePipeline &, const Prim &prim=Prim::Triangles,const bool prim_restart=false);
|
||||
Pipeline *CreatePipeline(MaterialInstance *, 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(Material *, PipelineData *, const Prim &prim=Prim::Triangles,const bool prim_restart=false);
|
||||
Pipeline *CreatePipeline(MaterialInstance *, 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(Material *, const OSString &, const Prim &prim=Prim::Triangles,const bool prim_restart=false);
|
||||
Pipeline *CreatePipeline(MaterialInstance *, 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);
|
||||
|
||||
public: // command buffer
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
#include<hgl/graph/VKRenderable.h>
|
||||
#include<hgl/graph/VKPipeline.h>
|
||||
#include<hgl/graph/VKDescriptorSets.h>
|
||||
#include<hgl/graph/VKMaterialInstance.h>
|
||||
#include<hgl/graph/VKMaterialParameters.h>
|
||||
VK_NAMESPACE_BEGIN
|
||||
/**
|
||||
* 可渲染对象实例<br>
|
||||
|
@ -7,25 +7,6 @@
|
||||
|
||||
VK_NAMESPACE_BEGIN
|
||||
|
||||
/**
|
||||
* Shader数据来源
|
||||
*/
|
||||
enum class ShaderDataSource
|
||||
{
|
||||
Global=0, ///<由全局系统提供的数据(如CameraMatrix)
|
||||
Private=1, ///<每种材质的私有数据
|
||||
};//
|
||||
|
||||
/**
|
||||
* Shader数据来源类型
|
||||
*/
|
||||
enum class ShaderDataSourceType
|
||||
{
|
||||
Static=0,
|
||||
Dynamic,
|
||||
Instance
|
||||
};
|
||||
|
||||
struct ShaderStage
|
||||
{
|
||||
AnsiString name;
|
||||
@ -51,17 +32,6 @@ struct ShaderDescriptor
|
||||
|
||||
using ShaderDescriptorList=List<ShaderDescriptor>;
|
||||
|
||||
enum class DescriptorSetsType
|
||||
{
|
||||
//设计使其对应shader中的sets
|
||||
|
||||
Material=0, ///<材质中永远不变的参数
|
||||
Texture, ///<材质中的纹理参数
|
||||
Values, ///<材质中的变量参数
|
||||
Renderable, ///<渲染实例参数(如Local2World matrix)
|
||||
Global, ///<全局参数(如太阳光等)
|
||||
};//
|
||||
|
||||
#ifndef VK_DESCRIPTOR_TYPE_BEGIN_RANGE
|
||||
constexpr size_t VK_DESCRIPTOR_TYPE_BEGIN_RANGE=VK_DESCRIPTOR_TYPE_SAMPLER;
|
||||
#endif//VK_DESCRIPTOR_TYPE_BEGIN_RANGE
|
||||
|
@ -1,7 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include<hgl/gui/ThemeEngine.h>
|
||||
#include<hgl/graph/VKMaterialInstance.h>
|
||||
#include<hgl/graph/VKPipeline.h>
|
||||
#include<hgl/type/Map.h>
|
||||
#include"DefaultThemeForm.h"
|
||||
|
@ -122,6 +122,7 @@ SET(VK_DEVICE_SOURCE ${SG_INCLUDE_PATH}/VKDevice.h
|
||||
Vulkan/VKDeviceBuffer.cpp
|
||||
Vulkan/VKDeviceImage.cpp
|
||||
Vulkan/VKDeviceTexture.cpp
|
||||
Vulkan/VKDeviceMaterial.cpp
|
||||
Vulkan/VKDeviceFramebuffer.cpp
|
||||
Vulkan/VKDeviceSwapchain.cpp
|
||||
Vulkan/VKDeviceRenderPass.cpp
|
||||
@ -159,9 +160,9 @@ SET(VK_TEXTURE_SOURCE ${SG_INCLUDE_PATH}/VKImageView.h
|
||||
Vulkan/VKTextureLoader.cpp)
|
||||
|
||||
SET(VK_MATERIAL_SOURCE ${SG_INCLUDE_PATH}/VKMaterial.h
|
||||
${SG_INCLUDE_PATH}/VKMaterialInstance.h
|
||||
${SG_INCLUDE_PATH}/VKMaterialParameters.h
|
||||
Vulkan/VKMaterial.cpp
|
||||
Vulkan/VKMaterialInstance.cpp)
|
||||
Vulkan/VKMaterialParameters.cpp)
|
||||
|
||||
SOURCE_GROUP("Vulkan\\Material" FILES ${VK_MATERIAL_SOURCE})
|
||||
SOURCE_GROUP("Vulkan\\Material\\Texture" FILES ${VK_TEXTURE_SOURCE})
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include<hgl/graph/VKRenderable.h>
|
||||
#include<hgl/graph/VKCommandBuffer.h>
|
||||
#include<hgl/graph/VertexAttribDataAccess.h>
|
||||
#include<hgl/graph/VKMaterialInstance.h>
|
||||
#include<hgl/graph/VKMaterialParameters.h>
|
||||
#include<hgl/graph/VKRenderableInstance.h>
|
||||
|
||||
namespace hgl
|
||||
|
@ -35,8 +35,7 @@ void DescriptorSetLayoutCreater::Bind(const ShaderDescriptorList *sd_list,VkDesc
|
||||
{
|
||||
//重复的绑定点是有可能存在的,比如CameraInfo在vs/fs中同时存在
|
||||
|
||||
if((!index_by_binding.KeyExist(sd.binding))
|
||||
&&(!index_by_binding_ri.KeyExist(sd.binding)))
|
||||
if(!all_index_by_binding.KeyExist(sd.binding))
|
||||
{
|
||||
p->binding = sd.binding;
|
||||
p->descriptorType = desc_type;
|
||||
@ -45,15 +44,16 @@ void DescriptorSetLayoutCreater::Bind(const ShaderDescriptorList *sd_list,VkDesc
|
||||
p->pImmutableSamplers = nullptr;
|
||||
|
||||
if(sd.name[0]=='r'
|
||||
&&sd.name[1]=='i'
|
||||
&&sd.name[2]=='_')
|
||||
index_by_binding_ri.Add(sd.binding,fin_count+old_count);
|
||||
&&sd.name[1]=='_')
|
||||
index_by_binding[(size_t)DescriptorSetsType::Renderable].Add(sd.binding,fin_count+old_count);
|
||||
else
|
||||
if(sd.name[0]=='g'
|
||||
&&sd.name[1]=='_')
|
||||
index_by_binding_global.Add(sd.binding,fin_count+old_count);
|
||||
index_by_binding[(size_t)DescriptorSetsType::Global].Add(sd.binding,fin_count+old_count);
|
||||
else
|
||||
index_by_binding.Add(sd.binding,fin_count+old_count);
|
||||
index_by_binding[(size_t)DescriptorSetsType::Values].Add(sd.binding,fin_count+old_count);
|
||||
|
||||
all_index_by_binding.Add(sd.binding,fin_count+old_count);
|
||||
|
||||
++p;
|
||||
++fin_count;
|
||||
@ -113,14 +113,15 @@ DescriptorSets *DescriptorSetLayoutCreater::Create(const DescriptorSetsType &typ
|
||||
BindingMapping *bm=nullptr;
|
||||
|
||||
if(type==DescriptorSetsType::Material
|
||||
||type==DescriptorSetsType::MaterialInstance) //未开会区分开
|
||||
bm=&index_by_binding;
|
||||
// ||type==DescriptorSetsType::Texture
|
||||
||type==DescriptorSetsType::Values) //未来会区分开
|
||||
bm=&index_by_binding[(size_t)DescriptorSetsType::Values];
|
||||
else
|
||||
if(type==DescriptorSetsType::RenderableInstance)
|
||||
bm=&index_by_binding_ri;
|
||||
if(type==DescriptorSetsType::Renderable)
|
||||
bm=&index_by_binding[(size_t)DescriptorSetsType::Renderable];
|
||||
else
|
||||
if(type==DescriptorSetsType::Global)
|
||||
bm=&index_by_binding_global;
|
||||
bm=&index_by_binding[(size_t)DescriptorSetsType::Global];
|
||||
else
|
||||
return(nullptr);
|
||||
|
||||
|
@ -17,9 +17,8 @@ class DescriptorSetLayoutCreater
|
||||
List<VkDescriptorSetLayoutBinding> layout_binding_list;
|
||||
VkDescriptorSetLayout dsl=VK_NULL_HANDLE;
|
||||
|
||||
BindingMapping index_by_binding;
|
||||
BindingMapping index_by_binding_ri;
|
||||
BindingMapping index_by_binding_global;
|
||||
BindingMapping all_index_by_binding;
|
||||
BindingMapping index_by_binding[size_t(DescriptorSetsType::RANGE_SIZE)];
|
||||
|
||||
VkPipelineLayout pipeline_layout=VK_NULL_HANDLE;
|
||||
|
||||
|
83
src/SceneGraph/Vulkan/VKDeviceMaterial.cpp
Normal file
83
src/SceneGraph/Vulkan/VKDeviceMaterial.cpp
Normal file
@ -0,0 +1,83 @@
|
||||
#include<hgl/graph/VKDevice.h>
|
||||
#include<hgl/graph/VKMaterial.h>
|
||||
#include"VKDescriptorSetLayoutCreater.h"
|
||||
|
||||
VK_NAMESPACE_BEGIN
|
||||
Material *GPUDevice::CreateMaterial(const UTF8String &mtl_name,ShaderModuleMap *shader_maps)
|
||||
{
|
||||
const int shader_count=shader_maps->GetCount();
|
||||
|
||||
if(shader_count<2)
|
||||
return(nullptr);
|
||||
|
||||
const ShaderModule *sm;
|
||||
|
||||
if(!shader_maps->Get(VK_SHADER_STAGE_VERTEX_BIT,sm))
|
||||
return(nullptr);
|
||||
|
||||
DescriptorSetLayoutCreater *dsl_creater=CreateDescriptorSetLayoutCreater();
|
||||
List<VkPipelineShaderStageCreateInfo> *shader_stage_list=new List<VkPipelineShaderStageCreateInfo>;
|
||||
|
||||
shader_stage_list->SetCount(shader_count);
|
||||
|
||||
VkPipelineShaderStageCreateInfo *p=shader_stage_list->GetData();
|
||||
|
||||
auto **itp=shader_maps->GetDataList();
|
||||
for(int i=0;i<shader_count;i++)
|
||||
{
|
||||
sm=(*itp)->right;
|
||||
hgl_cpy(p,sm->GetCreateInfo());
|
||||
|
||||
dsl_creater->Bind(sm->GetDescriptorList(),sm->GetStage());
|
||||
|
||||
++p;
|
||||
++itp;
|
||||
}
|
||||
|
||||
if(!dsl_creater->CreatePipelineLayout())
|
||||
{
|
||||
delete shader_stage_list;
|
||||
delete dsl_creater;
|
||||
delete shader_maps;
|
||||
return(nullptr);
|
||||
}
|
||||
|
||||
return(new Material(mtl_name,shader_maps,shader_stage_list,dsl_creater));
|
||||
}
|
||||
|
||||
Material *GPUDevice::CreateMaterial(const UTF8String &mtl_name,const VertexShaderModule *vertex_shader_module,const ShaderModule *fragment_shader_module)
|
||||
{
|
||||
if(!vertex_shader_module||!fragment_shader_module)
|
||||
return(nullptr);
|
||||
|
||||
if(!vertex_shader_module->IsVertex())return(nullptr);
|
||||
if(!fragment_shader_module->IsFragment())return(nullptr);
|
||||
|
||||
ShaderModuleMap *smm=new ShaderModuleMap;
|
||||
|
||||
smm->Add(vertex_shader_module);
|
||||
smm->Add(fragment_shader_module);
|
||||
|
||||
return CreateMaterial(mtl_name,smm);
|
||||
}
|
||||
|
||||
Material *GPUDevice::CreateMaterial(const UTF8String &mtl_name,const VertexShaderModule *vertex_shader_module,const ShaderModule *geometry_shader_module,const ShaderModule *fragment_shader_module)
|
||||
{
|
||||
if(!vertex_shader_module
|
||||
||!geometry_shader_module
|
||||
||!fragment_shader_module)
|
||||
return(nullptr);
|
||||
|
||||
if(!vertex_shader_module->IsVertex())return(nullptr);
|
||||
if(!geometry_shader_module->IsGeometry())return(nullptr);
|
||||
if(!fragment_shader_module->IsFragment())return(nullptr);
|
||||
|
||||
ShaderModuleMap *smm=new ShaderModuleMap;
|
||||
|
||||
smm->Add(vertex_shader_module);
|
||||
smm->Add(geometry_shader_module);
|
||||
smm->Add(fragment_shader_module);
|
||||
|
||||
return CreateMaterial(mtl_name,smm);
|
||||
}
|
||||
VK_NAMESPACE_END
|
@ -1,90 +1,7 @@
|
||||
#include<hgl/graph/VKMaterial.h>
|
||||
#include<hgl/graph/VKDevice.h>
|
||||
#include<hgl/graph/VKDescriptorSets.h>
|
||||
#include<hgl/graph/VKShaderModule.h>
|
||||
#include<hgl/graph/VKShaderModuleMap.h>
|
||||
#include<hgl/graph/VKVertexAttributeBinding.h>
|
||||
#include<hgl/graph/VKBuffer.h>
|
||||
#include<hgl/graph/VKMaterialParameters.h>
|
||||
#include"VKDescriptorSetLayoutCreater.h"
|
||||
VK_NAMESPACE_BEGIN
|
||||
Material *GPUDevice::CreateMaterial(const UTF8String &mtl_name,ShaderModuleMap *shader_maps)
|
||||
{
|
||||
const int shader_count=shader_maps->GetCount();
|
||||
|
||||
if(shader_count<2)
|
||||
return(nullptr);
|
||||
|
||||
const ShaderModule *sm;
|
||||
|
||||
if(!shader_maps->Get(VK_SHADER_STAGE_VERTEX_BIT,sm))
|
||||
return(nullptr);
|
||||
|
||||
DescriptorSetLayoutCreater *dsl_creater=CreateDescriptorSetLayoutCreater();
|
||||
List<VkPipelineShaderStageCreateInfo> *shader_stage_list=new List<VkPipelineShaderStageCreateInfo>;
|
||||
|
||||
shader_stage_list->SetCount(shader_count);
|
||||
|
||||
VkPipelineShaderStageCreateInfo *p=shader_stage_list->GetData();
|
||||
|
||||
auto **itp=shader_maps->GetDataList();
|
||||
for(int i=0;i<shader_count;i++)
|
||||
{
|
||||
sm=(*itp)->right;
|
||||
hgl_cpy(p,sm->GetCreateInfo());
|
||||
|
||||
dsl_creater->Bind(sm->GetDescriptorList(),sm->GetStage());
|
||||
|
||||
++p;
|
||||
++itp;
|
||||
}
|
||||
|
||||
if(!dsl_creater->CreatePipelineLayout())
|
||||
{
|
||||
delete shader_stage_list;
|
||||
delete dsl_creater;
|
||||
delete shader_maps;
|
||||
return(nullptr);
|
||||
}
|
||||
|
||||
return(new Material(mtl_name,shader_maps,shader_stage_list,dsl_creater));
|
||||
}
|
||||
|
||||
Material *GPUDevice::CreateMaterial(const UTF8String &mtl_name,const VertexShaderModule *vertex_shader_module,const ShaderModule *fragment_shader_module)
|
||||
{
|
||||
if(!vertex_shader_module||!fragment_shader_module)
|
||||
return(nullptr);
|
||||
|
||||
if(!vertex_shader_module->IsVertex())return(nullptr);
|
||||
if(!fragment_shader_module->IsFragment())return(nullptr);
|
||||
|
||||
ShaderModuleMap *smm=new ShaderModuleMap;
|
||||
|
||||
smm->Add(vertex_shader_module);
|
||||
smm->Add(fragment_shader_module);
|
||||
|
||||
return CreateMaterial(mtl_name,smm);
|
||||
}
|
||||
|
||||
Material *GPUDevice::CreateMaterial(const UTF8String &mtl_name,const VertexShaderModule *vertex_shader_module,const ShaderModule *geometry_shader_module,const ShaderModule *fragment_shader_module)
|
||||
{
|
||||
if(!vertex_shader_module
|
||||
||!geometry_shader_module
|
||||
||!fragment_shader_module)
|
||||
return(nullptr);
|
||||
|
||||
if(!vertex_shader_module->IsVertex())return(nullptr);
|
||||
if(!geometry_shader_module->IsGeometry())return(nullptr);
|
||||
if(!fragment_shader_module->IsFragment())return(nullptr);
|
||||
|
||||
ShaderModuleMap *smm=new ShaderModuleMap;
|
||||
|
||||
smm->Add(vertex_shader_module);
|
||||
smm->Add(geometry_shader_module);
|
||||
smm->Add(fragment_shader_module);
|
||||
|
||||
return CreateMaterial(mtl_name,smm);
|
||||
}
|
||||
|
||||
Material::Material(const UTF8String &name,ShaderModuleMap *smm,List<VkPipelineShaderStageCreateInfo> *psci_list,DescriptorSetLayoutCreater *dslc)
|
||||
{
|
||||
mtl_name=name;
|
||||
@ -105,12 +22,17 @@ Material::Material(const UTF8String &name,ShaderModuleMap *smm,List<VkPipelineSh
|
||||
vab=nullptr;
|
||||
}
|
||||
|
||||
ri_desc_sets=dsl_creater->Create(DescriptorSetsType::RenderableInstance);
|
||||
mp_m=CreateMP(DescriptorSetsType::Material);
|
||||
mp_r=CreateMP(DescriptorSetsType::Renderable);
|
||||
mp_g=CreateMP(DescriptorSetsType::Global);
|
||||
}
|
||||
|
||||
Material::~Material()
|
||||
{
|
||||
SAFE_CLEAR(ri_desc_sets);
|
||||
SAFE_CLEAR(mp_m);
|
||||
SAFE_CLEAR(mp_r);
|
||||
SAFE_CLEAR(mp_g);
|
||||
|
||||
delete dsl_creater;
|
||||
|
||||
if(vab)
|
||||
@ -153,8 +75,12 @@ const VkPipelineLayout Material::GetPipelineLayout()const
|
||||
return dsl_creater->GetPipelineLayout();
|
||||
}
|
||||
|
||||
DescriptorSets *Material::CreateMIDescriptorSets()const
|
||||
MaterialParameters *Material::CreateMP(const DescriptorSetsType &type)
|
||||
{
|
||||
return dsl_creater->Create(DescriptorSetsType::MaterialInstance);
|
||||
DescriptorSets *ds=dsl_creater->Create(type);
|
||||
|
||||
if(!ds)return(nullptr);
|
||||
|
||||
return(new MaterialParameters(this,type,ds));
|
||||
}
|
||||
VK_NAMESPACE_END
|
||||
|
@ -1,12 +1,13 @@
|
||||
#include<hgl/graph/VKMaterialInstance.h>
|
||||
#include<hgl/graph/VKMaterialParameters.h>
|
||||
|
||||
#include<hgl/graph/VKMaterial.h>
|
||||
#include<hgl/graph/VKDescriptorSets.h>
|
||||
|
||||
VK_NAMESPACE_BEGIN
|
||||
MaterialParameters::MaterialParameters(Material *m,DescriptorSets *ds)
|
||||
MaterialParameters::MaterialParameters(Material *m,const DescriptorSetsType &type,DescriptorSets *ds)
|
||||
{
|
||||
material=m;
|
||||
ds_type=type;
|
||||
descriptor_sets=ds;
|
||||
}
|
||||
|
||||
@ -67,13 +68,4 @@ void MaterialParameters::Update()
|
||||
{
|
||||
descriptor_sets->Update();
|
||||
}
|
||||
|
||||
MaterialParameters *Material::CreateInstance()
|
||||
{
|
||||
DescriptorSets *ds=CreateMIDescriptorSets();
|
||||
|
||||
if(!ds)return(nullptr);
|
||||
|
||||
return(new MaterialParameters(this,ds));
|
||||
}
|
||||
VK_NAMESPACE_END
|
@ -54,7 +54,7 @@ MaterialParameters *RenderResource::CreateMaterialInstance(Material *mtl)
|
||||
{
|
||||
if(!mtl)return(nullptr);
|
||||
|
||||
MaterialParameters *mi=mtl->CreateInstance();
|
||||
MaterialParameters *mi=mtl->CreateMP();
|
||||
|
||||
if(mi)
|
||||
Add(mi);
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include<hgl/graph/VKRenderTarget.h>
|
||||
#include<hgl/graph/VKMaterialInstance.h>
|
||||
#include<hgl/graph/VKMaterialParameters.h>
|
||||
#include<hgl/graph/VKDevice.h>
|
||||
#include<hgl/graph/VKInlinePipeline.h>
|
||||
#include<hgl/graph/VKPipelineData.h>
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include<hgl/graph/VKRenderableInstance.h>
|
||||
#include<hgl/graph/VKMaterialInstance.h>
|
||||
#include<hgl/graph/VKMaterialParameters.h>
|
||||
#include<hgl/graph/VKMaterial.h>
|
||||
#include<hgl/graph/VKVertexAttribBuffer.h>
|
||||
#include<hgl/util/hash/Hash.h>
|
||||
|
Loading…
x
Reference in New Issue
Block a user