2019-04-10 21:54:39 +08:00
|
|
|
#ifndef HGL_GRAPH_RENDER_SURFACE_INCLUDE
|
|
|
|
#define HGL_GRAPH_RENDER_SURFACE_INCLUDE
|
|
|
|
|
|
|
|
#include<hgl/type/List.h>
|
|
|
|
#include"VK.h"
|
|
|
|
#include"Window.h"
|
2019-04-18 16:06:44 +08:00
|
|
|
#include"VKDeviceAttribute.h"
|
2019-04-10 21:54:39 +08:00
|
|
|
|
|
|
|
VK_NAMESPACE_BEGIN
|
2019-04-18 22:10:24 +08:00
|
|
|
struct PhysicalDevice;
|
|
|
|
class Buffer;
|
|
|
|
class VertexBuffer;
|
|
|
|
class CommandBuffer;
|
|
|
|
class RenderPass;
|
2019-04-19 19:58:01 +08:00
|
|
|
class Fence;
|
2019-04-10 21:54:39 +08:00
|
|
|
|
2019-04-18 16:06:44 +08:00
|
|
|
class Device
|
2019-04-11 02:29:21 +08:00
|
|
|
{
|
2019-04-18 22:24:39 +08:00
|
|
|
DeviceAttribute *attr;
|
2019-04-10 21:54:39 +08:00
|
|
|
|
2019-04-11 02:29:21 +08:00
|
|
|
private:
|
2019-04-10 21:54:39 +08:00
|
|
|
|
2019-04-18 16:06:44 +08:00
|
|
|
friend Device *CreateRenderDevice(VkInstance,const PhysicalDevice *,Window *);
|
2019-04-10 21:54:39 +08:00
|
|
|
|
2019-04-18 22:24:39 +08:00
|
|
|
Device(DeviceAttribute *da)
|
2019-04-11 02:29:21 +08:00
|
|
|
{
|
2019-04-18 22:24:39 +08:00
|
|
|
attr=da;
|
2019-04-11 02:29:21 +08:00
|
|
|
}
|
2019-04-10 21:54:39 +08:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
2019-04-18 22:24:39 +08:00
|
|
|
virtual ~Device();
|
2019-04-10 21:54:39 +08:00
|
|
|
|
2019-04-18 22:24:39 +08:00
|
|
|
VkSurfaceKHR GetSurface () {return attr->surface;}
|
|
|
|
VkDevice GetDevice () {return attr->device;}
|
|
|
|
const PhysicalDevice *GetPhysicalDevice ()const {return attr->physical_device;}
|
|
|
|
const VkExtent2D & GetExtent ()const {return attr->swapchain_extent;}
|
2019-04-10 21:54:39 +08:00
|
|
|
|
2019-04-19 00:46:49 +08:00
|
|
|
VkDescriptorPool GetDescriptorPool () {return attr->desc_pool;}
|
|
|
|
|
2019-04-10 21:54:39 +08:00
|
|
|
public:
|
|
|
|
|
2019-04-11 22:40:13 +08:00
|
|
|
Buffer * CreateBuffer(VkBufferUsageFlags buf_usage,VkDeviceSize size,VkSharingMode sharing_mode=VK_SHARING_MODE_EXCLUSIVE);
|
2019-04-16 02:21:35 +08:00
|
|
|
VertexBuffer * CreateBuffer(VkBufferUsageFlags buf_usage,VkFormat format,uint32_t count,VkSharingMode sharing_mode=VK_SHARING_MODE_EXCLUSIVE);
|
|
|
|
|
2019-04-18 22:10:24 +08:00
|
|
|
#define CREATE_FORMAT_BUFFER_OBJECT(LargeName,type) VertexBuffer *Create##LargeName(VkFormat format,uint32_t count,VkSharingMode sharing_mode=VK_SHARING_MODE_EXCLUSIVE){return CreateBuffer(VK_BUFFER_USAGE_##type##_BUFFER_BIT,format,count,sharing_mode);}
|
2019-04-16 02:21:35 +08:00
|
|
|
CREATE_FORMAT_BUFFER_OBJECT(VBO,VERTEX)
|
|
|
|
CREATE_FORMAT_BUFFER_OBJECT(IBO,INDEX)
|
|
|
|
#undef CREATE_FORMAT_BUFFER_OBJECT
|
2019-04-11 22:40:13 +08:00
|
|
|
|
2019-04-11 23:02:38 +08:00
|
|
|
#define CREATE_BUFFER_OBJECT(LargeName,type) Buffer *Create##LargeName(VkDeviceSize size,VkSharingMode sharing_mode=VK_SHARING_MODE_EXCLUSIVE){return CreateBuffer(VK_BUFFER_USAGE_##type##_BUFFER_BIT,size,sharing_mode);}
|
|
|
|
|
|
|
|
CREATE_BUFFER_OBJECT(UBO,UNIFORM)
|
2019-04-18 15:49:13 +08:00
|
|
|
CREATE_BUFFER_OBJECT(SBO,STORAGE)
|
2019-04-11 23:02:38 +08:00
|
|
|
CREATE_BUFFER_OBJECT(INBO,INDIRECT)
|
|
|
|
|
|
|
|
#undef CREATE_BUFFER_OBJECT
|
2019-04-11 22:40:13 +08:00
|
|
|
|
2019-04-11 02:29:21 +08:00
|
|
|
CommandBuffer * CreateCommandBuffer ();
|
2019-04-12 16:39:22 +08:00
|
|
|
|
|
|
|
// DescriptorSet * CreateDescSet(int);
|
|
|
|
|
|
|
|
RenderPass *CreateRenderPass();
|
2019-04-19 19:58:01 +08:00
|
|
|
|
|
|
|
Fence *CreateFence();
|
2019-04-18 16:06:44 +08:00
|
|
|
};//class Device
|
2019-04-10 21:54:39 +08:00
|
|
|
VK_NAMESPACE_END
|
|
|
|
#endif//HGL_GRAPH_RENDER_SURFACE_INCLUDE
|