upgraded codes based on newly CM... library.
This commit is contained in:
parent
8fc83ba9b3
commit
251d851f65
2
CMCore
2
CMCore
@ -1 +1 @@
|
||||
Subproject commit 48abdf2a894ba87d609f9ea4b3c9464467cec797
|
||||
Subproject commit 68d0082e0e2dd2ec2d55fe0756aeb0bfb3c2be69
|
@ -1 +1 @@
|
||||
Subproject commit eca08f0ae7aeaf81ab5818572b32051e16dd41a7
|
||||
Subproject commit c91c3780f42df182fdb752b8165ed41a03358949
|
@ -1 +1 @@
|
||||
Subproject commit 966025309dba8921bd0ba1c198fbae38620b0aa3
|
||||
Subproject commit c539ce808b9a8a3acf451c3e26d47881631be954
|
2
CMUtil
2
CMUtil
@ -1 +1 @@
|
||||
Subproject commit 13b5a7347ea6a2b44f728847c2ce131e844f6d7c
|
||||
Subproject commit b0ca13cfb34175fd90c370ded64e8c0f3586b8ec
|
@ -65,6 +65,9 @@ private:
|
||||
|
||||
render_obj=db->CreateRenderable(primitive,material_instance,pipeline);
|
||||
|
||||
if(!render_obj)
|
||||
return(false);
|
||||
|
||||
render_root.CreateSubNode(render_obj);
|
||||
|
||||
render_root.RefreshMatrix();
|
||||
|
@ -23,7 +23,7 @@ namespace hgl
|
||||
}
|
||||
};//struct ShaderStageBind
|
||||
|
||||
using ShaderStageBindMap=MapObject<AnsiString,ShaderStageBind>;
|
||||
using ShaderStageBindMap=ObjectMap<AnsiString,ShaderStageBind>;
|
||||
|
||||
/**
|
||||
* 可绘制图元创建器
|
||||
|
@ -40,7 +40,7 @@ namespace hgl
|
||||
List<Renderable *> ri_list;
|
||||
|
||||
VkDescriptorSet ds_list[(size_t)DescriptorSetsType::RANGE_SIZE];
|
||||
DescriptorSets *renderable_desc_sets;
|
||||
DescriptorSet *renderable_desc_sets;
|
||||
|
||||
uint32_t ubo_offset;
|
||||
uint32_t ubo_align;
|
||||
|
@ -92,13 +92,13 @@ constexpr char *DescriptSetsTypeName[]=
|
||||
|
||||
inline const char *GetDescriptorSetsTypeName(const enum class DescriptorSetsType &type)
|
||||
{
|
||||
ENUM_CLASS_RANGE_ERROR_RETURN_NULLPTR(type);
|
||||
RANGE_CHECK_RETURN_NULLPTR(type);
|
||||
|
||||
return DescriptSetsTypeName[(size_t)type];
|
||||
}
|
||||
|
||||
struct PipelineLayoutData;
|
||||
class DescriptorSets;
|
||||
class DescriptorSet;
|
||||
|
||||
struct ShaderStage;
|
||||
|
||||
|
@ -105,7 +105,7 @@ public:
|
||||
return(true);
|
||||
}
|
||||
|
||||
bool BindDescriptorSets(DescriptorSets *dsl)
|
||||
bool BindDescriptorSets(DescriptorSet *dsl)
|
||||
{
|
||||
if(!dsl)return(false);
|
||||
|
||||
@ -118,7 +118,7 @@ public:
|
||||
return(true);
|
||||
}
|
||||
|
||||
bool BindDescriptorSets(DescriptorSets *dsl,const uint32_t offset)
|
||||
bool BindDescriptorSets(DescriptorSet *dsl,const uint32_t offset)
|
||||
{
|
||||
if(!dsl)return(false);
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
VK_NAMESPACE_BEGIN
|
||||
class DeviceBuffer;
|
||||
|
||||
class DescriptorSets
|
||||
class DescriptorSet
|
||||
{
|
||||
VkDevice device;
|
||||
int binding_count;
|
||||
@ -27,7 +27,7 @@ private:
|
||||
|
||||
friend class GPUDevice;
|
||||
|
||||
DescriptorSets(VkDevice dev,const int bc,VkPipelineLayout pl,VkDescriptorSet ds)
|
||||
DescriptorSet(VkDevice dev,const int bc,VkPipelineLayout pl,VkDescriptorSet ds)
|
||||
{
|
||||
device =dev;
|
||||
binding_count =bc;
|
||||
@ -39,7 +39,7 @@ private:
|
||||
|
||||
public:
|
||||
|
||||
~DescriptorSets()=default;
|
||||
~DescriptorSet()=default;
|
||||
|
||||
const uint32_t GetCount ()const{return binding_count;}
|
||||
const VkDescriptorSet GetDescriptorSet ()const{return desc_set;}
|
||||
@ -57,6 +57,6 @@ public:
|
||||
bool BindSampler(const int binding,Texture *,Sampler *);
|
||||
bool BindInputAttachment(const int binding,ImageView *);
|
||||
void Update();
|
||||
};//class DescriptorSets
|
||||
};//class DescriptorSet
|
||||
VK_NAMESPACE_END
|
||||
#endif//HGL_GRAPH_VULKAN_DESCRIPTOR_SETS_LAYOUT_INCLUDE
|
||||
|
@ -219,7 +219,7 @@ public: //shader & material
|
||||
PipelineLayoutData *CreatePipelineLayoutData(const MaterialDescriptorSets *);
|
||||
void Destroy(PipelineLayoutData *);
|
||||
|
||||
DescriptorSets * CreateDescriptorSets(const PipelineLayoutData *,const DescriptorSetsType &type)const;
|
||||
DescriptorSet * CreateDescriptorSets(const PipelineLayoutData *,const DescriptorSetsType &type)const;
|
||||
MaterialParameters *CreateMP(const MaterialDescriptorSets *,const PipelineLayoutData *,const DescriptorSetsType &);
|
||||
MaterialParameters *CreateMP(Material *,const DescriptorSetsType &);
|
||||
|
||||
|
@ -11,18 +11,18 @@ class MaterialParameters
|
||||
|
||||
DescriptorSetsType ds_type;
|
||||
|
||||
DescriptorSets *descriptor_sets;
|
||||
DescriptorSet *descriptor_sets;
|
||||
|
||||
private:
|
||||
|
||||
friend class GPUDevice;
|
||||
|
||||
MaterialParameters(const MaterialDescriptorSets *,const DescriptorSetsType &type,DescriptorSets *);
|
||||
MaterialParameters(const MaterialDescriptorSets *,const DescriptorSetsType &type,DescriptorSet *);
|
||||
|
||||
public:
|
||||
|
||||
const DescriptorSetsType GetType (){return ds_type;}
|
||||
DescriptorSets * GetDescriptorSet (){return descriptor_sets;}
|
||||
DescriptorSet * GetDescriptorSet (){return descriptor_sets;}
|
||||
const VkDescriptorSet GetVkDescriptorSet ()const{return descriptor_sets->GetDescriptorSet();}
|
||||
|
||||
const uint32_t GetCount ()const{return descriptor_sets->GetCount();}
|
||||
|
@ -18,7 +18,7 @@ VK_NAMESPACE_BEGIN
|
||||
using MaterialID =int;
|
||||
using MaterialInstanceID =int;
|
||||
using BufferID =int;
|
||||
using DescriptorSetsID =int;
|
||||
using DescriptorSetID =int;
|
||||
using PrimitiveID =int;
|
||||
using RenderableID =int;
|
||||
using SamplerID =int;
|
||||
@ -33,13 +33,13 @@ class RenderResource
|
||||
{
|
||||
GPUDevice *device;
|
||||
|
||||
MapObject<OSString,ShaderModule> shader_module_by_name;
|
||||
ObjectMap<OSString,ShaderModule> shader_module_by_name;
|
||||
Map<OSString,Material *> material_by_name;
|
||||
Map<OSString,Texture *> texture_by_name;
|
||||
|
||||
IDResManage<MaterialID, Material> rm_material; ///<材质合集
|
||||
IDResManage<MaterialInstanceID, MaterialInstance> rm_material_instance; ///<材质实例合集
|
||||
IDResManage<DescriptorSetsID, DescriptorSets> rm_desc_sets; ///<描述符合集
|
||||
IDResManage<DescriptorSetID, DescriptorSet> rm_desc_sets; ///<描述符合集
|
||||
IDResManage<PrimitiveID, Primitive> rm_primitives; ///<图元合集
|
||||
IDResManage<BufferID, DeviceBuffer> rm_buffers; ///<顶点缓冲区合集
|
||||
IDResManage<SamplerID, Sampler> rm_samplers; ///<采样器合集
|
||||
@ -55,7 +55,7 @@ public: //Add
|
||||
|
||||
MaterialID Add(Material * mtl ){return rm_material.Add(mtl);}
|
||||
MaterialInstanceID Add(MaterialInstance * mi ){return rm_material_instance.Add(mi);}
|
||||
DescriptorSetsID Add(DescriptorSets * ds ){return rm_desc_sets.Add(ds);}
|
||||
DescriptorSetID Add(DescriptorSet * ds ){return rm_desc_sets.Add(ds);}
|
||||
PrimitiveID Add(Primitive * p ){return rm_primitives.Add(p);}
|
||||
BufferID Add(DeviceBuffer * buf ){return rm_buffers.Add(buf);}
|
||||
SamplerID Add(Sampler * s ){return rm_samplers.Add(s);}
|
||||
@ -109,7 +109,7 @@ public: //Get
|
||||
|
||||
Material * GetMaterial (const MaterialID &id){return rm_material.Get(id);}
|
||||
MaterialInstance * GetMaterialInstance (const MaterialInstanceID &id){return rm_material_instance.Get(id);}
|
||||
DescriptorSets * GetDescSets (const DescriptorSetsID &id){return rm_desc_sets.Get(id);}
|
||||
DescriptorSet * GetDescSets (const DescriptorSetID &id){return rm_desc_sets.Get(id);}
|
||||
Primitive * GetPrimitive (const PrimitiveID &id){return rm_primitives.Get(id);}
|
||||
DeviceBuffer * GetBuffer (const BufferID &id){return rm_buffers.Get(id);}
|
||||
Sampler * GetSampler (const SamplerID &id){return rm_samplers.Get(id);}
|
||||
|
@ -16,7 +16,7 @@ struct ShaderStage
|
||||
VertexAttribType type; ///<成份数量(如vec4中的4)
|
||||
|
||||
bool global; ///<是否全局数据
|
||||
bool dynamic; ///<是否动态数量
|
||||
bool dynamic; ///<是否动态数据
|
||||
};//struct ShaderStage
|
||||
|
||||
using ShaderStageList =ObjectList<ShaderStage>;
|
||||
@ -29,7 +29,7 @@ class ShaderResource
|
||||
uint32 spv_size;
|
||||
|
||||
ShaderStageList stage_inputs;
|
||||
ShaderStageList stage_outputs;
|
||||
// ShaderStageList stage_outputs;
|
||||
|
||||
public:
|
||||
|
||||
@ -43,10 +43,10 @@ public:
|
||||
const uint32_t GetCodeSize ()const {return spv_size;}
|
||||
|
||||
ShaderStageList & GetStageInputs () {return stage_inputs;}
|
||||
ShaderStageList & GetStageOutputs () {return stage_outputs;}
|
||||
// ShaderStageList & GetStageOutputs () {return stage_outputs;}
|
||||
|
||||
const uint GetStageInputCount ()const {return stage_inputs.GetCount();}
|
||||
const uint GetStageOutputCount ()const {return stage_outputs.GetCount();}
|
||||
// const uint GetStageOutputCount ()const {return stage_outputs.GetCount();}
|
||||
|
||||
const ShaderStage * GetStageInput (const AnsiString &)const;
|
||||
const int GetStageInputBinding(const AnsiString &)const;
|
||||
|
@ -14,9 +14,9 @@ namespace hgl
|
||||
*/
|
||||
class FontManage
|
||||
{
|
||||
MapObject<Font,FontSource> sources;
|
||||
ObjectMap<Font,FontSource> sources;
|
||||
|
||||
MapObject<FontConfig,TileFont> tilefonts;
|
||||
ObjectMap<FontConfig,TileFont> tilefonts;
|
||||
};//class FontManage
|
||||
}//namespace graph
|
||||
}//namespace hgl
|
||||
|
@ -73,7 +73,7 @@ namespace hgl
|
||||
|
||||
SortedSets<void *> ref_object;
|
||||
|
||||
MapObject<u32char,CLA> cla_cache;
|
||||
ObjectMap<u32char,CLA> cla_cache;
|
||||
|
||||
public:
|
||||
|
||||
@ -98,7 +98,7 @@ namespace hgl
|
||||
|
||||
Font fnt;
|
||||
|
||||
MapObject<u32char,FontBitmap> chars_bitmap; ///<字符位图
|
||||
ObjectMap<u32char,FontBitmap> chars_bitmap; ///<字符位图
|
||||
|
||||
protected:
|
||||
|
||||
|
@ -21,7 +21,7 @@ namespace hgl
|
||||
|
||||
GPUDevice *device;
|
||||
|
||||
MapObject<Form *,ThemeForm> form_list;
|
||||
ObjectMap<Form *,ThemeForm> form_list;
|
||||
|
||||
RenderTarget *CreateRenderTarget(const uint32_t,const uint32_t,const VkFormat);
|
||||
|
||||
|
@ -321,7 +321,7 @@ namespace hgl
|
||||
|
||||
if(cci->color_type!=CubeCreateInfo::ColorType::NoColor)
|
||||
{
|
||||
ENUM_CLASS_RANGE_ERROR_RETURN_NULLPTR(cci->color_type);
|
||||
RANGE_CHECK_RETURN_NULLPTR(cci->color_type);
|
||||
|
||||
AutoDelete<VB4f> color=rc.CreateVADA<VB4f>(VAN::Color);
|
||||
|
||||
@ -1203,7 +1203,7 @@ namespace hgl
|
||||
|
||||
if(cci->color_type!=BoundingBoxCreateInfo::ColorType::NoColor)
|
||||
{
|
||||
ENUM_CLASS_RANGE_ERROR_RETURN_NULLPTR(cci->color_type);
|
||||
RANGE_CHECK_RETURN_NULLPTR(cci->color_type);
|
||||
|
||||
AutoDelete<VB4f> color=rc.CreateVADA<VB4f>(VAN::Color);
|
||||
|
||||
|
@ -67,7 +67,7 @@ namespace
|
||||
};//struct DescriptorImageInfo:public VkDescriptorImageInfo
|
||||
}//namespace
|
||||
|
||||
void DescriptorSets::Clear()
|
||||
void DescriptorSet::Clear()
|
||||
{
|
||||
buffer_list.ClearData();
|
||||
image_list.ClearData();
|
||||
@ -76,7 +76,7 @@ void DescriptorSets::Clear()
|
||||
is_dirty=true;
|
||||
}
|
||||
|
||||
bool DescriptorSets::BindUBO(const int binding,const DeviceBuffer *buf,bool dynamic)
|
||||
bool DescriptorSet::BindUBO(const int binding,const DeviceBuffer *buf,bool dynamic)
|
||||
{
|
||||
if(binding<0||!buf)
|
||||
return(false);
|
||||
@ -92,7 +92,7 @@ bool DescriptorSets::BindUBO(const int binding,const DeviceBuffer *buf,bool dyna
|
||||
return(true);
|
||||
}
|
||||
|
||||
bool DescriptorSets::BindUBO(const int binding,const DeviceBuffer *buf,const VkDeviceSize offset,const VkDeviceSize range,bool dynamic)
|
||||
bool DescriptorSet::BindUBO(const int binding,const DeviceBuffer *buf,const VkDeviceSize offset,const VkDeviceSize range,bool dynamic)
|
||||
{
|
||||
if(binding<0||!buf)
|
||||
return(false);
|
||||
@ -112,7 +112,7 @@ bool DescriptorSets::BindUBO(const int binding,const DeviceBuffer *buf,const VkD
|
||||
return(true);
|
||||
}
|
||||
|
||||
bool DescriptorSets::BindSSBO(const int binding,const DeviceBuffer *buf,bool dynamic)
|
||||
bool DescriptorSet::BindSSBO(const int binding,const DeviceBuffer *buf,bool dynamic)
|
||||
{
|
||||
if(binding<0||!buf)
|
||||
return(false);
|
||||
@ -128,7 +128,7 @@ bool DescriptorSets::BindSSBO(const int binding,const DeviceBuffer *buf,bool dyn
|
||||
return(true);
|
||||
}
|
||||
|
||||
bool DescriptorSets::BindSSBO(const int binding,const DeviceBuffer *buf,const VkDeviceSize offset,const VkDeviceSize range,bool dynamic)
|
||||
bool DescriptorSet::BindSSBO(const int binding,const DeviceBuffer *buf,const VkDeviceSize offset,const VkDeviceSize range,bool dynamic)
|
||||
{
|
||||
if(binding<0||!buf)
|
||||
return(false);
|
||||
@ -148,7 +148,7 @@ bool DescriptorSets::BindSSBO(const int binding,const DeviceBuffer *buf,const Vk
|
||||
return(true);
|
||||
}
|
||||
|
||||
bool DescriptorSets::BindSampler(const int binding,Texture *tex,Sampler *sampler)
|
||||
bool DescriptorSet::BindSampler(const int binding,Texture *tex,Sampler *sampler)
|
||||
{
|
||||
if(binding<0||!tex||!sampler)
|
||||
return(false);
|
||||
@ -166,7 +166,7 @@ bool DescriptorSets::BindSampler(const int binding,Texture *tex,Sampler *sampler
|
||||
return(true);
|
||||
}
|
||||
|
||||
bool DescriptorSets::BindInputAttachment(const int binding,ImageView *iv)
|
||||
bool DescriptorSet::BindInputAttachment(const int binding,ImageView *iv)
|
||||
{
|
||||
if(binding<0||!iv)
|
||||
return(false);
|
||||
@ -184,7 +184,7 @@ bool DescriptorSets::BindInputAttachment(const int binding,ImageView *iv)
|
||||
return(true);
|
||||
}
|
||||
|
||||
void DescriptorSets::Update()
|
||||
void DescriptorSet::Update()
|
||||
{
|
||||
if(!is_dirty)return;
|
||||
|
||||
|
@ -32,8 +32,11 @@ namespace
|
||||
VK_EXT_DEBUG_MARKER_EXTENSION_NAME,
|
||||
#endif//_DEBUG
|
||||
// VK_EXT_EXTENDED_DYNAMIC_STATE_EXTENSION_NAME,
|
||||
// VK_EXT_EXTENDED_DYNAMIC_STATE_2_EXTENSION_NAME,
|
||||
// VK_EXT_EXTENDED_DYNAMIC_STATE_3_EXTENSION_NAME,
|
||||
// VK_EXT_VERTEX_INPUT_DYNAMIC_STATE_EXTENSION_NAME,
|
||||
VK_EXT_PRIMITIVE_TOPOLOGY_LIST_RESTART_EXTENSION_NAME,
|
||||
VK_EXT_CONDITIONAL_RENDERING_EXTENSION_NAME,
|
||||
// VK_EXT_CONDITIONAL_RENDERING_EXTENSION_NAME,
|
||||
// VK_KHR_PUSH_DESCRIPTOR_EXTENSION_NAME,
|
||||
// VK_EXT_HDR_METADATA_EXTENSION_NAME,
|
||||
// VK_EXT_FULL_SCREEN_EXCLUSIVE_EXTENSION_NAME,
|
||||
|
@ -8,9 +8,9 @@
|
||||
#include"VKPipelineLayoutData.h"
|
||||
|
||||
VK_NAMESPACE_BEGIN
|
||||
DescriptorSets *GPUDevice::CreateDescriptorSets(const PipelineLayoutData *pld,const DescriptorSetsType &type)const
|
||||
DescriptorSet *GPUDevice::CreateDescriptorSets(const PipelineLayoutData *pld,const DescriptorSetsType &type)const
|
||||
{
|
||||
ENUM_CLASS_RANGE_ERROR_RETURN_NULLPTR(type);
|
||||
RANGE_CHECK_RETURN_NULLPTR(type);
|
||||
|
||||
const uint32_t binding_count=pld->binding_count[size_t(type)];
|
||||
|
||||
@ -28,7 +28,7 @@ DescriptorSets *GPUDevice::CreateDescriptorSets(const PipelineLayoutData *pld,co
|
||||
if(vkAllocateDescriptorSets(attr->device,&alloc_info,&desc_set)!=VK_SUCCESS)
|
||||
return(nullptr);
|
||||
|
||||
return(new DescriptorSets(attr->device,binding_count,pld->pipeline_layout,desc_set));
|
||||
return(new DescriptorSet(attr->device,binding_count,pld->pipeline_layout,desc_set));
|
||||
}
|
||||
|
||||
MaterialParameters *GPUDevice::CreateMP(const MaterialDescriptorSets *mds,const PipelineLayoutData *pld,const DescriptorSetsType &desc_set_type)
|
||||
@ -37,7 +37,7 @@ MaterialParameters *GPUDevice::CreateMP(const MaterialDescriptorSets *mds,const
|
||||
if(!RangeCheck<DescriptorSetsType>(desc_set_type))
|
||||
return(nullptr);
|
||||
|
||||
DescriptorSets *ds=CreateDescriptorSets(pld,desc_set_type);
|
||||
DescriptorSet *ds=CreateDescriptorSets(pld,desc_set_type);
|
||||
|
||||
if(!ds)return(nullptr);
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
#include<hgl/graph/VKDescriptorSets.h>
|
||||
|
||||
VK_NAMESPACE_BEGIN
|
||||
MaterialParameters::MaterialParameters(const MaterialDescriptorSets *_mds,const DescriptorSetsType &type,DescriptorSets *ds)
|
||||
MaterialParameters::MaterialParameters(const MaterialDescriptorSets *_mds,const DescriptorSetsType &type,DescriptorSet *ds)
|
||||
{
|
||||
mds=_mds;
|
||||
ds_type=type;
|
||||
|
@ -40,7 +40,7 @@ PipelineLayoutData *GPUDevice::CreatePipelineLayoutData(const MaterialDescriptor
|
||||
}
|
||||
else
|
||||
{
|
||||
//没有任何DescriptorSets的情况也是存在的
|
||||
//没有任何DescriptorSet的情况也是存在的
|
||||
}
|
||||
|
||||
//VkPushConstantRange push_constant_range;
|
||||
|
@ -21,7 +21,7 @@ VK_NAMESPACE_BEGIN
|
||||
|
||||
namespace
|
||||
{
|
||||
MapObject<OSString,ShaderResource> shader_resource_by_filename;
|
||||
ObjectMap<OSString,ShaderResource> shader_resource_by_filename;
|
||||
|
||||
const uint8 *LoadShaderStages(ShaderStageList &ss_list,const uint8 *data)
|
||||
{
|
||||
@ -138,7 +138,7 @@ VK_NAMESPACE_BEGIN
|
||||
filedata+=spv_size;
|
||||
|
||||
filedata=LoadShaderStages(sr->GetStageInputs(),filedata);
|
||||
filedata=LoadShaderStages(sr->GetStageOutputs(),filedata);
|
||||
//filedata=LoadShaderStages(sr->GetStageOutputs(),filedata);
|
||||
|
||||
return sr;
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ namespace hgl
|
||||
constexpr int CurrencySymbolsCount=(sizeof(CurrencySymbols)/sizeof(u32char))-1;
|
||||
constexpr int VRotateSymbolsCount =(sizeof(VRotateSymbols) /sizeof(u32char))-1;
|
||||
|
||||
MapObject<u32char,CharAttributes> all_char_attrs;
|
||||
ObjectMap<u32char,CharAttributes> all_char_attrs;
|
||||
}//namespace
|
||||
|
||||
const CLA *FontSource::GetCLA(const u32char &ch)
|
||||
|
@ -5,7 +5,7 @@ namespace hgl
|
||||
{
|
||||
FontSource *CreateFontSource(const Font &f); //各平台独立提供
|
||||
|
||||
static MapObject<Font,FontSource> FontStorage;
|
||||
static ObjectMap<Font,FontSource> FontStorage;
|
||||
|
||||
FontSource *AcquireFontSource(const Font &f)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user