upgraded codes based on newly CM... library.
This commit is contained in:
@@ -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
|
||||
|
@@ -120,11 +120,11 @@ private: //Buffer相关
|
||||
|
||||
public: //Buffer相关
|
||||
|
||||
DeviceBuffer * CreateBuffer(VkBufferUsageFlags buf_usage,VkDeviceSize range,VkDeviceSize size,const void *data, SharingMode sm=SharingMode::Exclusive);
|
||||
DeviceBuffer * CreateBuffer(VkBufferUsageFlags buf_usage,VkDeviceSize range,VkDeviceSize size, SharingMode sm=SharingMode::Exclusive){return CreateBuffer(buf_usage,range,size,nullptr,sm);}
|
||||
|
||||
DeviceBuffer * CreateBuffer(VkBufferUsageFlags buf_usage, VkDeviceSize size,const void *data, SharingMode sm=SharingMode::Exclusive){return CreateBuffer(buf_usage,size,size,data,sm);}
|
||||
DeviceBuffer * CreateBuffer(VkBufferUsageFlags buf_usage, VkDeviceSize size, SharingMode sm=SharingMode::Exclusive){return CreateBuffer(buf_usage,size,size,nullptr,sm);}
|
||||
DeviceBuffer * CreateBuffer(VkBufferUsageFlags buf_usage,VkDeviceSize range,VkDeviceSize size,const void *data, SharingMode sm=SharingMode::Exclusive);
|
||||
DeviceBuffer * CreateBuffer(VkBufferUsageFlags buf_usage,VkDeviceSize range,VkDeviceSize size, SharingMode sm=SharingMode::Exclusive){return CreateBuffer(buf_usage,range,size,nullptr,sm);}
|
||||
|
||||
DeviceBuffer * CreateBuffer(VkBufferUsageFlags buf_usage, VkDeviceSize size,const void *data, SharingMode sm=SharingMode::Exclusive){return CreateBuffer(buf_usage,size,size,data,sm);}
|
||||
DeviceBuffer * CreateBuffer(VkBufferUsageFlags buf_usage, VkDeviceSize size, SharingMode sm=SharingMode::Exclusive){return CreateBuffer(buf_usage,size,size,nullptr,sm);}
|
||||
|
||||
VBO * CreateVBO (VkFormat format, uint32_t count,const void *data, SharingMode sm=SharingMode::Exclusive);
|
||||
VBO * CreateVBO (VkFormat format, uint32_t count, SharingMode sm=SharingMode::Exclusive){return CreateVBO(format,count,nullptr,sm);}
|
||||
@@ -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 &);
|
||||
|
||||
@@ -238,7 +238,7 @@ public: //Command Buffer 相关
|
||||
|
||||
public:
|
||||
|
||||
RenderPass * AcquireRenderPass( const RenderbufferInfo *,const uint subpass_count=2);
|
||||
RenderPass * AcquireRenderPass( const RenderbufferInfo *,const uint subpass_count=2);
|
||||
|
||||
Fence * CreateFence(bool);
|
||||
Semaphore * CreateGPUSemaphore();
|
||||
|
@@ -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,9 +55,9 @@ 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);}
|
||||
BufferID Add(DeviceBuffer * buf ){return rm_buffers.Add(buf);}
|
||||
SamplerID Add(Sampler * s ){return rm_samplers.Add(s);}
|
||||
TextureID Add(Texture * t ){return rm_textures.Add(t);}
|
||||
RenderableID Add(Renderable * r ){return rm_renderables.Add(r);}
|
||||
@@ -109,9 +109,9 @@ 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);}
|
||||
DeviceBuffer * GetBuffer (const BufferID &id){return rm_buffers.Get(id);}
|
||||
Sampler * GetSampler (const SamplerID &id){return rm_samplers.Get(id);}
|
||||
Texture * GetTexture (const TextureID &id){return rm_textures.Get(id);}
|
||||
Renderable * GetRenderable (const RenderableID &id){return rm_renderables.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:
|
||||
|
||||
|
Reference in New Issue
Block a user