各种类名结构名优化,不再使用GPU开头
This commit is contained in:
@@ -36,8 +36,8 @@ namespace hgl
|
||||
public:
|
||||
|
||||
graph::RenderFramework * GetRenderFramework (){return render_framework;}
|
||||
graph::GPUDevice * GetDevice (){return render_framework->GetDevice();}
|
||||
graph::VkDevAttr * GetDeviceAttribute (){return render_framework->GetDeviceAttribute();}
|
||||
graph::VulkanDevice * GetDevice (){return render_framework->GetDevice();}
|
||||
graph::VulkanDevAttr * GetDevAttr (){return render_framework->GetDevAttr();}
|
||||
|
||||
const VkExtent2D & GetExtent2D (){return cur_render_target->GetExtent();}
|
||||
|
||||
@@ -82,7 +82,7 @@ namespace hgl
|
||||
graph::MaterialInstance *CreateMaterialInstance(const AnsiString &mtl_name,graph::mtl::MaterialCreateConfig *mtl_cfg,const graph::VILConfig *vil_cfg=nullptr)
|
||||
{
|
||||
AutoDelete<graph::mtl::MaterialCreateInfo> mci=graph::mtl::CreateMaterialCreateInfo(
|
||||
GetDeviceAttribute(),
|
||||
GetDevAttr(),
|
||||
"VertexColor2D",mtl_cfg); //这个是使用名称创建
|
||||
|
||||
return db->CreateMaterialInstance(mci,vil_cfg);
|
||||
|
@@ -46,7 +46,7 @@ public:
|
||||
*/
|
||||
class MaterialRenderList
|
||||
{
|
||||
GPUDevice *device;
|
||||
VulkanDevice *device;
|
||||
RenderCmdBuffer *cmd_buf;
|
||||
|
||||
RenderPipelineIndex rp_index;
|
||||
@@ -106,7 +106,7 @@ protected:
|
||||
|
||||
public:
|
||||
|
||||
MaterialRenderList(GPUDevice *d,bool l2w,const RenderPipelineIndex &rpi);
|
||||
MaterialRenderList(VulkanDevice *d,bool l2w,const RenderPipelineIndex &rpi);
|
||||
~MaterialRenderList();
|
||||
|
||||
void Add(SceneNode *);
|
||||
|
@@ -13,7 +13,7 @@ class PrimitiveCreater
|
||||
{
|
||||
protected:
|
||||
|
||||
GPUDevice * device;
|
||||
VulkanDevice * device;
|
||||
VertexDataManager * vdm;
|
||||
|
||||
const VIL * vil;
|
||||
@@ -36,7 +36,7 @@ protected:
|
||||
|
||||
public:
|
||||
|
||||
PrimitiveCreater(GPUDevice *,const VIL *);
|
||||
PrimitiveCreater(VulkanDevice *,const VIL *);
|
||||
PrimitiveCreater(VertexDataManager *);
|
||||
virtual ~PrimitiveCreater();
|
||||
|
||||
|
@@ -27,7 +27,7 @@ class RenderFramework:public io::WindowEvent
|
||||
Window * win =nullptr;
|
||||
VulkanInstance * inst =nullptr;
|
||||
|
||||
GPUDevice * device =nullptr;
|
||||
VulkanDevice * device =nullptr;
|
||||
|
||||
RenderResource * render_resource =nullptr;
|
||||
|
||||
@@ -50,10 +50,10 @@ protected:
|
||||
public:
|
||||
|
||||
Window * GetWindow ()const{return win;}
|
||||
GPUDevice * GetDevice ()const{return device;}
|
||||
VulkanDevice * GetDevice ()const{return device;}
|
||||
VkDevice GetVkDevice ()const{return device->GetDevice();}
|
||||
const GPUPhysicalDevice * GetPhysicalDevice ()const{return device->GetPhysicalDevice();}
|
||||
VkDevAttr * GetDeviceAttribute ()const{return device->GetDeviceAttribute();}
|
||||
const VulkanPhyDevice * GetPhyDevice ()const{return device->GetPhyDevice();}
|
||||
VulkanDevAttr * GetDevAttr ()const{return device->GetDevAttr();}
|
||||
|
||||
RenderResource * GetRenderResource ()const{return render_resource;}
|
||||
|
||||
|
@@ -18,7 +18,7 @@ namespace hgl
|
||||
{
|
||||
protected:
|
||||
|
||||
GPUDevice * device;
|
||||
VulkanDevice * device;
|
||||
|
||||
CameraInfo * camera_info; ///<相机信息
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace hgl
|
||||
|
||||
public:
|
||||
|
||||
RenderList(GPUDevice *);
|
||||
RenderList(VulkanDevice *);
|
||||
virtual ~RenderList()=default;
|
||||
|
||||
virtual void SetCamera(CameraInfo *ci){camera_info=ci;} ///<设置相机信息
|
||||
|
@@ -41,9 +41,9 @@ class GraphModule;
|
||||
class RenderFramework;
|
||||
|
||||
class VulkanInstance;
|
||||
class GPUPhysicalDevice;
|
||||
class GPUDevice;
|
||||
struct VkDevAttr;
|
||||
class VulkanPhyDevice;
|
||||
class VulkanDevice;
|
||||
struct VulkanDevAttr;
|
||||
class DeviceQueue;
|
||||
class ImageView;
|
||||
class Framebuffer;
|
||||
@@ -84,7 +84,7 @@ class IndexBuffer;
|
||||
class VABMap;
|
||||
class IBMap;
|
||||
|
||||
class GPUCmdBuffer;
|
||||
class VulkanCmdBuffer;
|
||||
class RenderCmdBuffer;
|
||||
class TextureCmdBuffer;
|
||||
|
||||
|
@@ -1,5 +1,4 @@
|
||||
#ifndef HGL_GRAPH_VULKAN_ARRAY_BUFFER_INCLUDE
|
||||
#define HGL_GRAPH_VULKAN_ARRAY_BUFFER_INCLUDE
|
||||
#pragma once
|
||||
|
||||
#include<hgl/graph/VK.h>
|
||||
#include<hgl/graph/VKDynamicBufferAccess.h>
|
||||
@@ -15,7 +14,7 @@ namespace hgl
|
||||
* GPU数据阵列缓冲区<br>
|
||||
* 它用于储存多份相同格式的数据,常用于多物件渲染,instance等
|
||||
*/
|
||||
class GPUArrayBuffer
|
||||
class VulkanArrayBuffer
|
||||
{
|
||||
protected:
|
||||
|
||||
@@ -33,13 +32,13 @@ namespace hgl
|
||||
|
||||
private:
|
||||
|
||||
GPUArrayBuffer(VKMemoryAllocator *,const uint,const uint);
|
||||
VulkanArrayBuffer(VKMemoryAllocator *,const uint,const uint);
|
||||
|
||||
friend class GPUDevice;
|
||||
friend class VulkanDevice;
|
||||
|
||||
public:
|
||||
|
||||
virtual ~GPUArrayBuffer();
|
||||
virtual ~VulkanArrayBuffer();
|
||||
|
||||
const uint32_t GetAlignSize()const{return align_size;} ///<数据对齐字节数
|
||||
const uint32_t GetRangeSize()const{return range_size;} ///<单次渲染访问最大字节数
|
||||
@@ -71,7 +70,6 @@ namespace hgl
|
||||
|
||||
dba->Restart();
|
||||
}
|
||||
};//class GPUArrayBuffer
|
||||
};//class VulkanArrayBuffer
|
||||
}//namespace graph
|
||||
}//namespace hgl
|
||||
#endif//HGL_GRAPH_VULKAN_ARRAY_BUFFER_INCLUDE
|
||||
|
@@ -20,7 +20,7 @@ protected:
|
||||
|
||||
private:
|
||||
|
||||
friend class GPUDevice;
|
||||
friend class VulkanDevice;
|
||||
friend class VertexAttribBuffer;
|
||||
friend class IndexBuffer;
|
||||
template<typename T> friend class IndirectCommandBuffer;
|
||||
|
@@ -1,5 +1,4 @@
|
||||
#ifndef HGL_GRAPH_VULKAN_COMMAND_BUFFER_INCLUDE
|
||||
#define HGL_GRAPH_VULKAN_COMMAND_BUFFER_INCLUDE
|
||||
#pragma once
|
||||
|
||||
#include<hgl/graph/VK.h>
|
||||
#include<hgl/graph/VKVABList.h>
|
||||
@@ -8,11 +7,11 @@
|
||||
#include<hgl/graph/VKRenderable.h>
|
||||
#include<hgl/color/Color4f.h>
|
||||
VK_NAMESPACE_BEGIN
|
||||
class GPUCmdBuffer
|
||||
class VulkanCmdBuffer
|
||||
{
|
||||
protected:
|
||||
|
||||
const VkDevAttr *dev_attr;
|
||||
const VulkanDevAttr *dev_attr;
|
||||
|
||||
VkCommandBuffer cmd_buf;
|
||||
|
||||
@@ -20,8 +19,8 @@ protected:
|
||||
|
||||
public:
|
||||
|
||||
GPUCmdBuffer(const VkDevAttr *attr,VkCommandBuffer cb);
|
||||
virtual ~GPUCmdBuffer();
|
||||
VulkanCmdBuffer(const VulkanDevAttr *attr,VkCommandBuffer cb);
|
||||
virtual ~VulkanCmdBuffer();
|
||||
|
||||
operator VkCommandBuffer(){return cmd_buf;}
|
||||
operator const VkCommandBuffer()const{return cmd_buf;}
|
||||
@@ -48,11 +47,11 @@ public:
|
||||
void BeginRegion(const AnsiString &,const Color4f &){}
|
||||
void EndRegion(){}
|
||||
#endif//_DEBUG
|
||||
};//class GPUCmdBuffer
|
||||
};//class VulkanCmdBuffer
|
||||
|
||||
class DescriptorBinding;
|
||||
|
||||
class RenderCmdBuffer:public GPUCmdBuffer
|
||||
class RenderCmdBuffer:public VulkanCmdBuffer
|
||||
{
|
||||
uint32_t cv_count;
|
||||
VkClearValue *clear_values;
|
||||
@@ -70,7 +69,7 @@ private:
|
||||
|
||||
public:
|
||||
|
||||
RenderCmdBuffer(const VkDevAttr *attr,VkCommandBuffer cb);
|
||||
RenderCmdBuffer(const VulkanDevAttr *attr,VkCommandBuffer cb);
|
||||
~RenderCmdBuffer();
|
||||
|
||||
void SetDescriptorBinding(DescriptorBinding *db) { desc_binding=db; }
|
||||
@@ -79,7 +78,7 @@ public:
|
||||
{
|
||||
desc_binding=nullptr;
|
||||
|
||||
return GPUCmdBuffer::End();
|
||||
return VulkanCmdBuffer::End();
|
||||
}
|
||||
|
||||
void SetRenderArea(const VkRect2D &ra){render_area=ra;}
|
||||
@@ -256,15 +255,15 @@ public:
|
||||
|
||||
Draw(ri->GetDataBuffer(),ri->GetRenderData());
|
||||
}
|
||||
};//class RenderCmdBuffer:public GPUCmdBuffer
|
||||
};//class RenderCmdBuffer:public VulkanCmdBuffer
|
||||
|
||||
class TextureCmdBuffer:public GPUCmdBuffer
|
||||
class TextureCmdBuffer:public VulkanCmdBuffer
|
||||
{
|
||||
VkImageMemoryBarrier imageMemoryBarrier;
|
||||
|
||||
public:
|
||||
|
||||
TextureCmdBuffer(const VkDevAttr *attr,VkCommandBuffer cb):GPUCmdBuffer(attr,cb)
|
||||
TextureCmdBuffer(const VulkanDevAttr *attr,VkCommandBuffer cb):VulkanCmdBuffer(attr,cb)
|
||||
{
|
||||
imageMemoryBarrier.sType=VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER;
|
||||
imageMemoryBarrier.pNext=nullptr;
|
||||
@@ -301,6 +300,5 @@ public:
|
||||
0, nullptr,
|
||||
1, &imageMemoryBarrier);
|
||||
}
|
||||
};//class TextureCmdBuffer:public GPUCmdBuffer
|
||||
};//class TextureCmdBuffer:public VulkanCmdBuffer
|
||||
VK_NAMESPACE_END
|
||||
#endif//HGL_GRAPH_VULKAN_COMMAND_BUFFER_INCLUDE
|
||||
|
@@ -20,16 +20,16 @@ VK_NAMESPACE_BEGIN
|
||||
class TileData;
|
||||
class TileFont;
|
||||
class FontSource;
|
||||
class GPUArrayBuffer;
|
||||
class VulkanArrayBuffer;
|
||||
class IndirectDrawBuffer;
|
||||
class IndirectDrawIndexedBuffer;
|
||||
class IndirectDispatchBuffer;
|
||||
|
||||
struct CopyBufferToImageInfo;
|
||||
|
||||
class GPUDevice
|
||||
class VulkanDevice
|
||||
{
|
||||
VkDevAttr *attr;
|
||||
VulkanDevAttr *attr;
|
||||
|
||||
private:
|
||||
|
||||
@@ -39,18 +39,18 @@ private:
|
||||
|
||||
friend class VulkanDeviceCreater;
|
||||
|
||||
GPUDevice(VkDevAttr *da);
|
||||
VulkanDevice(VulkanDevAttr *da);
|
||||
|
||||
public:
|
||||
|
||||
virtual ~GPUDevice();
|
||||
virtual ~VulkanDevice();
|
||||
|
||||
operator VkDevice () {return attr->device;}
|
||||
VkDevAttr *GetDeviceAttribute () {return attr;}
|
||||
VulkanDevAttr * GetDevAttr () {return attr;}
|
||||
|
||||
VkSurfaceKHR GetSurface () {return attr->surface;}
|
||||
VkDevice GetDevice ()const {return attr->device;}
|
||||
const GPUPhysicalDevice * GetPhysicalDevice ()const {return attr->physical_device;}
|
||||
const VulkanPhyDevice * GetPhyDevice ()const {return attr->physical_device;}
|
||||
|
||||
VkDescriptorPool GetDescriptorPool () {return attr->desc_pool;}
|
||||
VkPipelineCache GetPipelineCache () {return attr->pipeline_cache;}
|
||||
@@ -131,8 +131,8 @@ public: //Buffer相关
|
||||
|
||||
#undef CREATE_BUFFER_OBJECT
|
||||
|
||||
GPUArrayBuffer *CreateArrayInUBO(const VkDeviceSize &uint_size);
|
||||
GPUArrayBuffer *CreateArrayInSSBO(const VkDeviceSize &uint_size);
|
||||
VulkanArrayBuffer *CreateArrayInUBO(const VkDeviceSize &uint_size);
|
||||
VulkanArrayBuffer *CreateArrayInSSBO(const VkDeviceSize &uint_size);
|
||||
|
||||
public: //间接绘制
|
||||
|
||||
@@ -172,5 +172,5 @@ public:
|
||||
TileData *CreateTileData(const VkFormat video_format,const uint width,const uint height,const uint count); ///<创建一个Tile数据集
|
||||
|
||||
TileFont *CreateTileFont(FontSource *fs,int limit_count=-1); ///<创建一个Tile字体
|
||||
};//class GPUDevice
|
||||
};//class VulkanDevice
|
||||
VK_NAMESPACE_END
|
||||
|
@@ -11,10 +11,10 @@ VK_NAMESPACE_BEGIN
|
||||
|
||||
constexpr uint32_t ERROR_FAMILY_INDEX=UINT32_MAX;
|
||||
|
||||
struct VkDevAttr
|
||||
struct VulkanDevAttr
|
||||
{
|
||||
VulkanInstance * instance =nullptr;
|
||||
const GPUPhysicalDevice * physical_device =nullptr;
|
||||
const VulkanPhyDevice * physical_device =nullptr;
|
||||
|
||||
VkPhysicalDeviceDriverPropertiesKHR driver_properties;
|
||||
|
||||
@@ -55,8 +55,8 @@ struct VkDevAttr
|
||||
|
||||
public:
|
||||
|
||||
VkDevAttr(VulkanInstance *inst,const GPUPhysicalDevice *pd,VkSurfaceKHR s);
|
||||
~VkDevAttr();
|
||||
VulkanDevAttr(VulkanInstance *inst,const VulkanPhyDevice *pd,VkSurfaceKHR s);
|
||||
~VulkanDevAttr();
|
||||
|
||||
int GetMemoryType(uint32_t typeBits,VkMemoryPropertyFlags properties) const;
|
||||
|
||||
@@ -75,5 +75,5 @@ public:
|
||||
{
|
||||
return instance->GetDeviceProc<T>(device,name);
|
||||
}
|
||||
};//class VkDevAttr
|
||||
};//class VulkanDevAttr
|
||||
VK_NAMESPACE_END
|
||||
|
@@ -238,7 +238,7 @@ protected:
|
||||
|
||||
VulkanInstance *instance;
|
||||
Window *window;
|
||||
const GPUPhysicalDevice *physical_device;
|
||||
const VulkanPhyDevice *physical_device;
|
||||
|
||||
VulkanHardwareRequirement require;
|
||||
|
||||
@@ -274,14 +274,14 @@ public:
|
||||
|
||||
virtual void ChooseSurfaceFormat();
|
||||
|
||||
virtual GPUDevice *CreateRenderDevice();
|
||||
virtual VulkanDevice *CreateRenderDevice();
|
||||
|
||||
public:
|
||||
|
||||
virtual GPUDevice *Create();
|
||||
virtual VulkanDevice *Create();
|
||||
};//class VulkanDeviceCreater
|
||||
|
||||
inline GPUDevice *CreateRenderDevice( VulkanInstance *vi,
|
||||
inline VulkanDevice *CreateRenderDevice( VulkanInstance *vi,
|
||||
Window *win,
|
||||
const VulkanHardwareRequirement *req=nullptr,
|
||||
const PreferFormats * spf_color =&PreferSDR,
|
||||
@@ -293,35 +293,35 @@ inline GPUDevice *CreateRenderDevice( VulkanInstance *vi,
|
||||
return vdc.Create();
|
||||
}
|
||||
|
||||
inline GPUDevice *CreateRenderDeviceLDR(VulkanInstance *vi,
|
||||
inline VulkanDevice *CreateRenderDeviceLDR(VulkanInstance *vi,
|
||||
Window *win,
|
||||
const VulkanHardwareRequirement *req=nullptr)
|
||||
{
|
||||
return CreateRenderDevice(vi,win,req,&PreferLDR,&PreferNonlinear,&PreferDepth);
|
||||
}
|
||||
|
||||
inline GPUDevice *CreateRenderDeviceSDR(VulkanInstance *vi,
|
||||
inline VulkanDevice *CreateRenderDeviceSDR(VulkanInstance *vi,
|
||||
Window *win,
|
||||
const VulkanHardwareRequirement *req=nullptr)
|
||||
{
|
||||
return CreateRenderDevice(vi,win,req,&PreferSDR,&PreferNonlinear,&PreferDepth);
|
||||
}
|
||||
|
||||
inline GPUDevice *CreateRenderDeviceHDR16( VulkanInstance *vi,
|
||||
inline VulkanDevice *CreateRenderDeviceHDR16( VulkanInstance *vi,
|
||||
Window *win,
|
||||
const VulkanHardwareRequirement *req=nullptr)
|
||||
{
|
||||
return CreateRenderDevice(vi,win,req,&PreferHDR16,&PreferLinear,&PreferDepth);
|
||||
}
|
||||
|
||||
inline GPUDevice *CreateRenderDeviceHDR32( VulkanInstance *vi,
|
||||
inline VulkanDevice *CreateRenderDeviceHDR32( VulkanInstance *vi,
|
||||
Window *win,
|
||||
const VulkanHardwareRequirement *req=nullptr)
|
||||
{
|
||||
return CreateRenderDevice(vi,win,req,&PreferHDR32,&PreferLinear,&PreferDepth);
|
||||
}
|
||||
|
||||
inline GPUDevice *CreateRenderDeviceHDR(VulkanInstance *vi,
|
||||
inline VulkanDevice *CreateRenderDeviceHDR(VulkanInstance *vi,
|
||||
Window *win,
|
||||
const VulkanHardwareRequirement *req=nullptr)
|
||||
{
|
||||
|
@@ -37,7 +37,7 @@ private:
|
||||
index=0;
|
||||
}
|
||||
|
||||
friend class GPUArrayBuffer;
|
||||
friend class VulkanArrayBuffer;
|
||||
|
||||
public:
|
||||
|
||||
|
@@ -10,7 +10,7 @@ class Fence
|
||||
|
||||
private:
|
||||
|
||||
friend class GPUDevice;
|
||||
friend class VulkanDevice;
|
||||
|
||||
Fence(VkDevice d,VkFence f)
|
||||
{
|
||||
|
@@ -12,7 +12,7 @@ class IndexBuffer:public DeviceBuffer
|
||||
|
||||
private:
|
||||
|
||||
friend class GPUDevice;
|
||||
friend class VulkanDevice;
|
||||
|
||||
IndexBuffer(VkDevice d,const DeviceBufferData &vb,IndexType it,uint32_t _count):DeviceBuffer(d,vb)
|
||||
{
|
||||
|
@@ -19,7 +19,7 @@ public:
|
||||
|
||||
private:
|
||||
|
||||
friend class GPUDevice;
|
||||
friend class VulkanDevice;
|
||||
|
||||
IndirectCommandBuffer(VkDevice d,const DeviceBufferData &vb,const uint32_t mc):DeviceBuffer(d,vb)
|
||||
{
|
||||
@@ -46,7 +46,7 @@ public:
|
||||
|
||||
class IndirectDrawBuffer:public IndirectCommandBuffer<VkDrawIndirectCommand>
|
||||
{
|
||||
friend class GPUDevice;
|
||||
friend class VulkanDevice;
|
||||
|
||||
public:
|
||||
|
||||
@@ -64,7 +64,7 @@ public:
|
||||
|
||||
class IndirectDrawIndexedBuffer:public IndirectCommandBuffer<VkDrawIndexedIndirectCommand>
|
||||
{
|
||||
friend class GPUDevice;
|
||||
friend class VulkanDevice;
|
||||
|
||||
public:
|
||||
|
||||
@@ -82,7 +82,7 @@ public:
|
||||
|
||||
class IndirectDispatchBuffer:public IndirectCommandBuffer<VkDispatchIndirectCommand>
|
||||
{
|
||||
friend class GPUDevice;
|
||||
friend class VulkanDevice;
|
||||
|
||||
public:
|
||||
|
||||
|
@@ -62,7 +62,7 @@ VK_NAMESPACE_BEGIN
|
||||
|
||||
VKDebugOut *debug_out;
|
||||
|
||||
ObjectList<GPUPhysicalDevice> physical_devices;
|
||||
ObjectList<VulkanPhyDevice> physical_devices;
|
||||
|
||||
private:
|
||||
|
||||
@@ -80,8 +80,8 @@ VK_NAMESPACE_BEGIN
|
||||
|
||||
operator VkInstance (){return inst;}
|
||||
|
||||
const ObjectList<GPUPhysicalDevice> &GetDeviceList ()const {return physical_devices;}
|
||||
const GPUPhysicalDevice * GetDevice (VkPhysicalDeviceType)const;
|
||||
const ObjectList<VulkanPhyDevice> &GetDeviceList ()const {return physical_devices;}
|
||||
const VulkanPhyDevice * GetDevice (VkPhysicalDeviceType)const;
|
||||
|
||||
template<typename T>
|
||||
T *GetInstanceProc(const char *name)
|
||||
|
@@ -16,7 +16,7 @@ class DeviceMemory
|
||||
|
||||
private:
|
||||
|
||||
friend class GPUDevice;
|
||||
friend class VulkanDevice;
|
||||
|
||||
DeviceMemory(VkDevice dev,VkDeviceMemory dm,const VkMemoryRequirements &mr,const uint32 i,const uint32_t p,const VkDeviceSize cas);
|
||||
|
||||
|
@@ -7,7 +7,7 @@
|
||||
VK_NAMESPACE_BEGIN
|
||||
class VKMemoryAllocator:public AbstractMemoryAllocator
|
||||
{
|
||||
GPUDevice *device;
|
||||
VulkanDevice *device;
|
||||
|
||||
uint32_t buffer_usage_flag_bits;
|
||||
|
||||
@@ -29,7 +29,7 @@ public:
|
||||
|
||||
public:
|
||||
|
||||
VKMemoryAllocator(GPUDevice *,const uint32_t flags,const VkDeviceSize r);
|
||||
VKMemoryAllocator(VulkanDevice *,const uint32_t flags,const VkDeviceSize r);
|
||||
~VKMemoryAllocator();
|
||||
|
||||
void Free() override {/* DON'T RUN ANY OPERATION.*/}
|
||||
|
@@ -5,7 +5,7 @@
|
||||
#include<hgl/type/SortedSet.h>
|
||||
|
||||
VK_NAMESPACE_BEGIN
|
||||
class GPUPhysicalDevice
|
||||
class VulkanPhyDevice
|
||||
{
|
||||
VkInstance instance=nullptr;
|
||||
VkPhysicalDevice physical_device=nullptr;
|
||||
@@ -23,9 +23,9 @@ class GPUPhysicalDevice
|
||||
VkPhysicalDeviceVulkan14Properties properties14;
|
||||
|
||||
VkPhysicalDeviceMemoryProperties memory_properties;
|
||||
ArrayList<VkLayerProperties> layer_properties;
|
||||
ArrayList<VkExtensionProperties> extension_properties;
|
||||
ArrayList<VkQueueFamilyProperties> queue_family_properties;
|
||||
ArrayList<VkLayerProperties> layer_properties;
|
||||
ArrayList<VkExtensionProperties> extension_properties;
|
||||
ArrayList<VkQueueFamilyProperties> queue_family_properties;
|
||||
|
||||
private:
|
||||
|
||||
@@ -46,8 +46,8 @@ public:
|
||||
|
||||
public:
|
||||
|
||||
GPUPhysicalDevice(VkInstance,VkPhysicalDevice);
|
||||
~GPUPhysicalDevice()=default;
|
||||
VulkanPhyDevice(VkInstance,VkPhysicalDevice);
|
||||
~VulkanPhyDevice()=default;
|
||||
|
||||
operator VkPhysicalDevice() {return physical_device;}
|
||||
operator const VkPhysicalDevice()const {return physical_device;}
|
||||
@@ -207,5 +207,5 @@ public:
|
||||
}
|
||||
|
||||
const bool SupportDynamicState() const {return dynamic_state;}
|
||||
};//class GPUPhysicalDevice
|
||||
};//class VulkanPhyDevice
|
||||
VK_NAMESPACE_END
|
||||
|
@@ -19,7 +19,7 @@ protected:
|
||||
|
||||
private:
|
||||
|
||||
friend class GPUDevice;
|
||||
friend class VulkanDevice;
|
||||
|
||||
DeviceQueue(VkDevice dev,VkQueue q,Fence **,const uint32_t fc);
|
||||
|
||||
@@ -42,7 +42,7 @@ public:
|
||||
bool WaitFence(const bool wait_all=true,const uint64_t time_out=HGL_NANO_SEC_PER_SEC);
|
||||
|
||||
bool Submit(const VkCommandBuffer *cmd_buf,const uint32_t count,Semaphore *wait_sem,Semaphore *complete_sem);
|
||||
bool Submit(GPUCmdBuffer *cmd_buf,Semaphore *wait_sem,Semaphore *complete_sem);
|
||||
bool Submit(VulkanCmdBuffer *cmd_buf,Semaphore *wait_sem,Semaphore *complete_sem);
|
||||
};//class DeviceQueue
|
||||
VK_NAMESPACE_END
|
||||
#endif//HGL_GRAPH_VULKAN_SUBMIT_QUEUE_INCLUDE
|
||||
|
@@ -11,13 +11,13 @@ class RenderContext
|
||||
{
|
||||
protected:
|
||||
|
||||
GPUDevice *device;
|
||||
VulkanDevice *device;
|
||||
|
||||
VkExtent2D extent;
|
||||
|
||||
public:
|
||||
|
||||
RenderContext(GPUDevice *,const VkExtent2D &);
|
||||
RenderContext(VulkanDevice *,const VkExtent2D &);
|
||||
virtual ~RenderContext();
|
||||
|
||||
void Prepare(
|
||||
|
@@ -43,7 +43,7 @@ constexpr const size_t VK_SHADER_STAGE_TYPE_COUNT=20;//GetBitOffset((uint32_t)VK
|
||||
*/
|
||||
class RenderResource
|
||||
{
|
||||
GPUDevice *device;
|
||||
VulkanDevice *device;
|
||||
|
||||
ShaderModuleMapByName shader_module_by_name[VK_SHADER_STAGE_TYPE_COUNT];
|
||||
Map<AnsiString,Material *> material_by_name;
|
||||
@@ -75,7 +75,7 @@ private:
|
||||
|
||||
public:
|
||||
|
||||
GPUDevice *GetDevice(){return device;}
|
||||
VulkanDevice *GetDevice(){return device;}
|
||||
|
||||
//注:并非一定要走这里,这里只是提供一个注册和自动绑定的机制
|
||||
DescriptorBinding static_descriptor; ///<静态属性描述符绑定管理
|
||||
@@ -83,7 +83,7 @@ public:
|
||||
|
||||
public:
|
||||
|
||||
RenderResource(GPUDevice *dev):device(dev),
|
||||
RenderResource(VulkanDevice *dev):device(dev),
|
||||
static_descriptor(DescriptorSetType::Static),
|
||||
global_descriptor(DescriptorSetType::Global)
|
||||
{}
|
||||
|
@@ -29,7 +29,7 @@ class IRenderTarget
|
||||
public:
|
||||
|
||||
RenderFramework * GetRenderFramework ()const{return render_framework;}
|
||||
GPUDevice * GetDevice ()const;
|
||||
VulkanDevice * GetDevice ()const;
|
||||
VkDevice GetVkDevice ()const;
|
||||
DescriptorBinding * GetDescriptorBinding(){return &desc_binding;}
|
||||
|
||||
|
@@ -12,7 +12,7 @@ class Sampler
|
||||
|
||||
protected:
|
||||
|
||||
friend class GPUDevice;
|
||||
friend class VulkanDevice;
|
||||
|
||||
Sampler(VkDevice dev,VkSampler s)
|
||||
{
|
||||
|
@@ -10,7 +10,7 @@ class Semaphore
|
||||
|
||||
private:
|
||||
|
||||
friend class GPUDevice;
|
||||
friend class VulkanDevice;
|
||||
|
||||
Semaphore(VkDevice d,VkSemaphore s)
|
||||
{
|
||||
|
@@ -9,7 +9,7 @@ class VkTextureLoader:public L
|
||||
{
|
||||
protected:
|
||||
|
||||
GPUDevice *device;
|
||||
VulkanDevice *device;
|
||||
GPUBuffer *buf;
|
||||
|
||||
T *tex;
|
||||
@@ -18,7 +18,7 @@ protected:
|
||||
|
||||
public:
|
||||
|
||||
VkTextureLoader(GPUDevice *dev,const bool am)
|
||||
VkTextureLoader(VulkanDevice *dev,const bool am)
|
||||
{
|
||||
device =dev;
|
||||
buf =nullptr;
|
||||
|
@@ -12,7 +12,7 @@ class VertexAttribBuffer:public DeviceBuffer
|
||||
|
||||
private:
|
||||
|
||||
friend class GPUDevice;
|
||||
friend class VulkanDevice;
|
||||
|
||||
VertexAttribBuffer(VkDevice d,const DeviceBufferData &vb,VkFormat fmt,uint32_t _stride,uint32_t _count):DeviceBuffer(d,vb)
|
||||
{
|
||||
|
@@ -8,7 +8,7 @@ VK_NAMESPACE_BEGIN
|
||||
|
||||
class VertexDataManager
|
||||
{
|
||||
GPUDevice *device;
|
||||
VulkanDevice *device;
|
||||
|
||||
protected:
|
||||
|
||||
@@ -30,10 +30,10 @@ protected:
|
||||
|
||||
public:
|
||||
|
||||
VertexDataManager(GPUDevice *dev,const VIL *_vil);
|
||||
VertexDataManager(VulkanDevice *dev,const VIL *_vil);
|
||||
~VertexDataManager();
|
||||
|
||||
GPUDevice * GetDevice ()const{return device;} ///<取得GPU设备
|
||||
VulkanDevice * GetDevice ()const{return device;} ///<取得GPU设备
|
||||
|
||||
const VIL * GetVIL ()const{return vil;} ///<取得顶点输入格式列表
|
||||
|
||||
|
@@ -11,7 +11,7 @@ namespace hgl
|
||||
*/
|
||||
class TextPrimitive:public Primitive
|
||||
{
|
||||
GPUDevice * device;
|
||||
VulkanDevice * device;
|
||||
Material * mtl;
|
||||
|
||||
uint max_count; ///<缓冲区最大容量
|
||||
@@ -36,7 +36,7 @@ namespace hgl
|
||||
|
||||
public:
|
||||
|
||||
TextPrimitive(GPUDevice *,Material *,uint mc=1024);
|
||||
TextPrimitive(VulkanDevice *,Material *,uint mc=1024);
|
||||
|
||||
public:
|
||||
|
||||
|
@@ -15,7 +15,7 @@ namespace hgl
|
||||
|
||||
class TextRender
|
||||
{
|
||||
GPUDevice * device;
|
||||
VulkanDevice * device;
|
||||
RenderResource * db;
|
||||
|
||||
Material * material;
|
||||
@@ -37,8 +37,8 @@ namespace hgl
|
||||
|
||||
private:
|
||||
|
||||
friend TextRender *CreateTextRender(GPUDevice *,FontSource *,RenderPass *,DeviceBuffer *,int limit=-1);
|
||||
TextRender(GPUDevice *dev,FontSource *);
|
||||
friend TextRender *CreateTextRender(VulkanDevice *,FontSource *,RenderPass *,DeviceBuffer *,int limit=-1);
|
||||
TextRender(VulkanDevice *dev,FontSource *);
|
||||
|
||||
bool InitTileFont(int limit);
|
||||
bool InitTextLayoutEngine();
|
||||
@@ -82,7 +82,7 @@ namespace hgl
|
||||
* 创建一个文本渲染器
|
||||
* @param limit 节数限制(-1表示自动)
|
||||
*/
|
||||
TextRender *CreateTextRender(GPUDevice *,FontSource *,RenderPass *,DeviceBuffer *,int limit);
|
||||
TextRender *CreateTextRender(VulkanDevice *,FontSource *,RenderPass *,DeviceBuffer *,int limit);
|
||||
}//namespace graph
|
||||
}//namespace hgl
|
||||
#endif//HGL_GRAPH_TEXT_RENDER_INCLUDE
|
||||
|
@@ -16,10 +16,10 @@ class GraphModule
|
||||
public:
|
||||
|
||||
RenderFramework * GetRenderFramework ()const{return render_framework;} ///<取得渲染框架
|
||||
GPUDevice * GetDevice (); ///<取得GPU设备
|
||||
VulkanDevice * GetDevice (); ///<取得GPU设备
|
||||
VkDevice GetVkDevice ()const; ///<取得VkDevice
|
||||
const GPUPhysicalDevice * GetPhysicalDevice ()const; ///<取得物理设备
|
||||
VkDevAttr *GetDeviceAttribute ()const; ///<取得设备属性
|
||||
const VulkanPhyDevice * GetPhyDevice ()const; ///<取得物理设备
|
||||
VulkanDevAttr *GetDevAttr ()const; ///<取得设备属性
|
||||
VkPipelineCache GetPipelineCache ()const; ///<取得PipelineCache
|
||||
|
||||
public:
|
||||
|
@@ -23,7 +23,7 @@ public:
|
||||
public:
|
||||
|
||||
RenderFramework * GetRenderFramework ()const{return render_framework;} ///<取得渲染框架
|
||||
GPUDevice * GetDevice ()const; ///<取得GPU设备
|
||||
VulkanDevice * GetDevice ()const; ///<取得GPU设备
|
||||
|
||||
public:
|
||||
|
||||
|
@@ -22,6 +22,6 @@ public:
|
||||
|
||||
#define RENDER_MODULE_CLASS(class_name) class class_name:public GraphModuleInherit<class_name,RenderModule>
|
||||
|
||||
#define RENDER_MODULE_CONSTRUCT(class_name) class_name::class_name(GPUDevice *dev):GraphModuleInherit<class_name,RenderModule>(dev,#class_name)
|
||||
#define RENDER_MODULE_CONSTRUCT(class_name) class_name::class_name(VulkanDevice *dev):GraphModuleInherit<class_name,RenderModule>(dev,#class_name)
|
||||
|
||||
VK_NAMESPACE_END
|
||||
|
@@ -52,13 +52,13 @@ public:
|
||||
|
||||
DEFINE_MATERIAL_FACTORY_CLASS(VertexColor2D,CreateVertexColor2D,const Material2DCreateConfig)
|
||||
|
||||
MaterialCreateInfo *CreatePureColor2D(const VkDevAttr *dev_attr,const Material2DCreateConfig *);
|
||||
MaterialCreateInfo *CreatePureColor2D(const VulkanDevAttr *dev_attr,const Material2DCreateConfig *);
|
||||
|
||||
MaterialCreateInfo *CreateLerpLine2D(const VkDevAttr *dev_attr,const Material2DCreateConfig *);
|
||||
MaterialCreateInfo *CreateLerpLine2D(const VulkanDevAttr *dev_attr,const Material2DCreateConfig *);
|
||||
|
||||
MaterialCreateInfo *CreatePureTexture2D(const VkDevAttr *dev_attr,const Material2DCreateConfig *);
|
||||
MaterialCreateInfo *CreateRectTexture2D(const VkDevAttr *dev_attr,Material2DCreateConfig *);
|
||||
MaterialCreateInfo *CreateRectTexture2DArray(const VkDevAttr *dev_attr,Material2DCreateConfig *);
|
||||
MaterialCreateInfo *CreatePureTexture2D(const VulkanDevAttr *dev_attr,const Material2DCreateConfig *);
|
||||
MaterialCreateInfo *CreateRectTexture2D(const VulkanDevAttr *dev_attr,Material2DCreateConfig *);
|
||||
MaterialCreateInfo *CreateRectTexture2DArray(const VulkanDevAttr *dev_attr,Material2DCreateConfig *);
|
||||
|
||||
// 为什么有了LoadMaterialFromFile,还需要保留以上Create系列函数?
|
||||
|
||||
@@ -72,6 +72,6 @@ MaterialCreateInfo *CreateRectTexture2DArray(const VkDevAttr *dev_attr,Material2
|
||||
* @param cfg 材质创建参数
|
||||
* @return 材质创建信息
|
||||
*/
|
||||
MaterialCreateInfo *LoadMaterialFromFile(const VkDevAttr *dev_attr,const AnsiString &mtl_name,Material2DCreateConfig *cfg); ///<从文件加载材质
|
||||
MaterialCreateInfo *LoadMaterialFromFile(const VulkanDevAttr *dev_attr,const AnsiString &mtl_name,Material2DCreateConfig *cfg); ///<从文件加载材质
|
||||
|
||||
STD_MTL_NAMESPACE_END
|
||||
|
@@ -50,10 +50,10 @@ public:
|
||||
}
|
||||
};//struct Material3DCreateConfig:public MaterialCreateConfig
|
||||
|
||||
MaterialCreateInfo *CreateVertexColor3D(const VkDevAttr *dev_attr,const Material3DCreateConfig *);
|
||||
MaterialCreateInfo *CreateVertexLuminance3D(const VkDevAttr *dev_attr,const Material3DCreateConfig *);
|
||||
MaterialCreateInfo *CreateVertexColor3D(const VulkanDevAttr *dev_attr,const Material3DCreateConfig *);
|
||||
MaterialCreateInfo *CreateVertexLuminance3D(const VulkanDevAttr *dev_attr,const Material3DCreateConfig *);
|
||||
|
||||
MaterialCreateInfo *CreateMaterialGizmo3D(const VkDevAttr *dev_attr,const Material3DCreateConfig *cfg);
|
||||
MaterialCreateInfo *CreateMaterialGizmo3D(const VulkanDevAttr *dev_attr,const Material3DCreateConfig *cfg);
|
||||
|
||||
struct BillboardMaterialCreateConfig:public Material3DCreateConfig
|
||||
{
|
||||
@@ -66,7 +66,7 @@ public:
|
||||
using Material3DCreateConfig::Material3DCreateConfig;
|
||||
};
|
||||
|
||||
MaterialCreateInfo *CreateBillboard2D(const VkDevAttr *dev_attr,mtl::BillboardMaterialCreateConfig *);
|
||||
MaterialCreateInfo *CreateBillboard2D(const VulkanDevAttr *dev_attr,mtl::BillboardMaterialCreateConfig *);
|
||||
|
||||
/**
|
||||
* 从文件加载材质
|
||||
@@ -74,5 +74,5 @@ MaterialCreateInfo *CreateBillboard2D(const VkDevAttr *dev_attr,mtl::BillboardMa
|
||||
* @param cfg 材质创建参数
|
||||
* @return 材质创建信息
|
||||
*/
|
||||
MaterialCreateInfo *LoadMaterialFromFile(const VkDevAttr *dev_attr,const AnsiString &name,Material3DCreateConfig *cfg);
|
||||
MaterialCreateInfo *LoadMaterialFromFile(const VulkanDevAttr *dev_attr,const AnsiString &name,Material3DCreateConfig *cfg);
|
||||
STD_MTL_NAMESPACE_END
|
||||
|
@@ -27,7 +27,7 @@ public:
|
||||
|
||||
//virtual const CoordinateSystem2D get2DCoordinateSystem()const=0;
|
||||
|
||||
virtual MaterialCreateInfo *Create(const VkDevAttr *dev_attr,MaterialCreateConfig *)=0;
|
||||
virtual MaterialCreateInfo *Create(const VulkanDevAttr *dev_attr,MaterialCreateConfig *)=0;
|
||||
|
||||
};//class MaterialFactory
|
||||
|
||||
@@ -45,7 +45,7 @@ public:
|
||||
};//class RegistryMaterialFactoryClass
|
||||
|
||||
#define DEFINE_MATERIAL_FACTORY_CLASS(name,create_func,cfg_type) \
|
||||
MaterialCreateInfo *Create##name(const VkDevAttr *dev_attr,cfg_type *); \
|
||||
MaterialCreateInfo *Create##name(const VulkanDevAttr *dev_attr,cfg_type *); \
|
||||
\
|
||||
namespace \
|
||||
{ \
|
||||
@@ -59,7 +59,7 @@ namespace \
|
||||
return mtl_name; \
|
||||
} \
|
||||
\
|
||||
MaterialCreateInfo *Create(const VkDevAttr *dev_attr,MaterialCreateConfig *cfg) override \
|
||||
MaterialCreateInfo *Create(const VulkanDevAttr *dev_attr,MaterialCreateConfig *cfg) override \
|
||||
{ \
|
||||
return create_func(dev_attr,(cfg_type *)cfg); \
|
||||
} \
|
||||
@@ -68,16 +68,16 @@ namespace \
|
||||
static RegistryMaterialFactoryClass<MaterialFactory##name> MaterialFactoryInstance_##name; \
|
||||
}
|
||||
|
||||
MaterialCreateInfo *CreateMaterialCreateInfo(const VkDevAttr *dev_attr,const MaterialName &,MaterialCreateConfig *cfg);
|
||||
MaterialCreateInfo *CreateMaterialCreateInfo(const VulkanDevAttr *dev_attr,const MaterialName &,MaterialCreateConfig *cfg);
|
||||
|
||||
inline MaterialCreateInfo *CreateMaterialCreateInfo(const VkDevAttr *dev_attr,const char *mtl_name,MaterialCreateConfig *cfg)
|
||||
inline MaterialCreateInfo *CreateMaterialCreateInfo(const VulkanDevAttr *dev_attr,const char *mtl_name,MaterialCreateConfig *cfg)
|
||||
{
|
||||
MaterialName mtl_id_name(mtl_name);
|
||||
|
||||
return CreateMaterialCreateInfo(dev_attr,mtl_id_name,cfg);
|
||||
}
|
||||
|
||||
inline MaterialCreateInfo *CreateMaterialCreateInfo(const VkDevAttr *dev_attr,const AnsiString &mtl_name,MaterialCreateConfig *cfg)
|
||||
inline MaterialCreateInfo *CreateMaterialCreateInfo(const VulkanDevAttr *dev_attr,const AnsiString &mtl_name,MaterialCreateConfig *cfg)
|
||||
{
|
||||
MaterialName mtl_id_name(mtl_name);
|
||||
|
||||
|
@@ -19,7 +19,7 @@ namespace hgl::graph
|
||||
class ShaderCreateInfoVertex;
|
||||
class ShaderCreateInfoGeometry;
|
||||
class ShaderCreateInfoFragment;
|
||||
struct VkDevAttr;
|
||||
struct VulkanDevAttr;
|
||||
|
||||
namespace mtl
|
||||
{
|
||||
@@ -51,7 +51,7 @@ namespace hgl::graph
|
||||
StdMaterial(const MaterialCreateConfig *);
|
||||
virtual ~StdMaterial()=default;
|
||||
|
||||
virtual MaterialCreateInfo *Create(const VkDevAttr *dev_attr);
|
||||
virtual MaterialCreateInfo *Create(const VulkanDevAttr *dev_attr);
|
||||
};//class StdMaterial
|
||||
}//namespace mtl
|
||||
}//namespace hgl::graph
|
||||
|
@@ -10,7 +10,7 @@ namespace hgl
|
||||
{
|
||||
namespace vulkan
|
||||
{
|
||||
class GPUDevice;
|
||||
class VulkanDevice;
|
||||
}//namespace vulkan
|
||||
|
||||
constexpr VkFormat DefaultRenderTargetFormat=UPF_ABGR8; ///<缺省窗体绘图表面格式
|
||||
@@ -19,7 +19,7 @@ namespace hgl
|
||||
{
|
||||
protected:
|
||||
|
||||
GPUDevice *device;
|
||||
VulkanDevice *device;
|
||||
|
||||
ObjectMap<Form *,ThemeForm> form_list;
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace hgl
|
||||
|
||||
public:
|
||||
|
||||
ThemeEngine(GPUDevice *dev){device=dev;}
|
||||
ThemeEngine(VulkanDevice *dev){device=dev;}
|
||||
virtual ~ThemeEngine()=default;
|
||||
|
||||
virtual bool Init()=0;
|
||||
@@ -49,4 +49,4 @@ namespace hgl
|
||||
ThemeEngine *GetDefaultThemeEngine(); ///<获取缺省主题引擎
|
||||
}//namespace gui
|
||||
}//namespace hgl
|
||||
#endif//HGL_GUI_THEME_ENGINE_INCLUDE
|
||||
#endif//HGL_GUI_THEME_ENGINE_INCLUDE
|
||||
|
@@ -12,7 +12,7 @@
|
||||
|
||||
namespace hgl::graph
|
||||
{
|
||||
struct VkDevAttr;
|
||||
struct VulkanDevAttr;
|
||||
struct UBODescriptor;
|
||||
|
||||
namespace mtl
|
||||
@@ -89,7 +89,7 @@ namespace hgl::graph
|
||||
|
||||
bool AddSampler(const VkShaderStageFlagBits flag_bits,const DescriptorSetType set_type,const SamplerType &st,const AnsiString &name);
|
||||
|
||||
bool CreateShader(const VkDevAttr *dev_attr);
|
||||
bool CreateShader(const VulkanDevAttr *dev_attr);
|
||||
};//class MaterialCreateInfo
|
||||
}//namespace mtl
|
||||
}//namespace hgl::graph
|
||||
|
Reference in New Issue
Block a user