2019-04-09 02:02:43 +08:00
|
|
|
|
#ifndef HGL_GRAPH_VULKAN_INCLUDE
|
|
|
|
|
#define HGL_GRAPH_VULKAN_INCLUDE
|
|
|
|
|
|
2023-07-28 20:17:46 +08:00
|
|
|
|
#include<hgl/type/List.h>
|
2019-05-28 21:17:37 +08:00
|
|
|
|
#include<hgl/math/Math.h>
|
2020-11-05 14:02:35 +08:00
|
|
|
|
#include<hgl/type/String.h>
|
2020-11-30 17:56:40 +08:00
|
|
|
|
#include<hgl/type/Map.h>
|
2020-10-21 11:43:18 +08:00
|
|
|
|
#include<hgl/graph/VKNamespace.h>
|
|
|
|
|
#include<hgl/graph/VKFormat.h>
|
2022-06-24 17:51:05 +08:00
|
|
|
|
#include<hgl/graph/VKPrimitiveType.h>
|
2020-10-21 11:43:18 +08:00
|
|
|
|
#include<hgl/graph/VKStruct.h>
|
2020-10-27 22:43:24 +08:00
|
|
|
|
#include<hgl/graph/VKRenderbufferInfo.h>
|
2019-04-09 02:02:43 +08:00
|
|
|
|
|
2019-05-05 14:22:58 +08:00
|
|
|
|
VK_NAMESPACE_BEGIN
|
2019-04-19 12:11:16 +08:00
|
|
|
|
|
2021-09-13 20:39:25 +08:00
|
|
|
|
#ifndef VK_DESCRIPTOR_TYPE_BEGIN_RANGE
|
|
|
|
|
constexpr size_t VK_DESCRIPTOR_TYPE_BEGIN_RANGE=VK_DESCRIPTOR_TYPE_SAMPLER;
|
|
|
|
|
#endif//VK_DESCRIPTOR_TYPE_BEGIN_RANGE
|
|
|
|
|
|
|
|
|
|
#ifndef VK_DESCRIPTOR_TYPE_END_RANGE
|
|
|
|
|
constexpr size_t VK_DESCRIPTOR_TYPE_END_RANGE=VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT;
|
|
|
|
|
#endif//VK_DESCRIPTOR_TYPE_END_RANGE
|
|
|
|
|
|
|
|
|
|
#ifndef VK_DESCRIPTOR_TYPE_RANGE_SIZE
|
|
|
|
|
constexpr size_t VK_DESCRIPTOR_TYPE_RANGE_SIZE=VK_DESCRIPTOR_TYPE_END_RANGE-VK_DESCRIPTOR_TYPE_BEGIN_RANGE+1;
|
|
|
|
|
#endif//VK_DESCRIPTOR_TYPE_RANGE_SIZE
|
|
|
|
|
|
2024-03-06 00:29:17 +08:00
|
|
|
|
using BindingMap =Map<AnsiString,int>;
|
2024-03-06 00:26:23 +08:00
|
|
|
|
using BindingMapArray =BindingMap[VK_DESCRIPTOR_TYPE_RANGE_SIZE];
|
2019-11-13 20:50:34 +08:00
|
|
|
|
|
2020-10-21 12:39:22 +08:00
|
|
|
|
class VulkanInstance;
|
|
|
|
|
class GPUPhysicalDevice;
|
|
|
|
|
class GPUDevice;
|
|
|
|
|
struct GPUDeviceAttribute;
|
2023-03-02 20:19:25 +08:00
|
|
|
|
class DeviceQueue;
|
2019-05-07 12:46:25 +08:00
|
|
|
|
class ImageView;
|
|
|
|
|
class Framebuffer;
|
2019-07-16 20:57:17 +08:00
|
|
|
|
struct Swapchain;
|
2019-07-16 19:59:53 +08:00
|
|
|
|
class RenderTarget;
|
2023-08-17 11:08:21 +08:00
|
|
|
|
class RTSwapchain;
|
2019-05-07 12:46:25 +08:00
|
|
|
|
|
2019-05-21 12:02:57 +08:00
|
|
|
|
class Texture;
|
2019-05-18 15:41:49 +08:00
|
|
|
|
class Texture1D;
|
|
|
|
|
class Texture1DArray;
|
|
|
|
|
class Texture2D;
|
|
|
|
|
class Texture2DArray;
|
|
|
|
|
class Texture3D;
|
2022-01-05 16:10:42 +08:00
|
|
|
|
class TextureCube;
|
|
|
|
|
class TextureCubeArray;
|
2019-05-18 15:41:49 +08:00
|
|
|
|
|
2019-05-18 16:10:42 +08:00
|
|
|
|
class Sampler;
|
|
|
|
|
|
2022-10-14 17:52:35 +08:00
|
|
|
|
class DeviceMemory;
|
|
|
|
|
class DeviceBuffer;
|
|
|
|
|
struct DeviceBufferData;
|
2020-08-07 21:59:20 +08:00
|
|
|
|
|
2024-05-28 02:21:33 +08:00
|
|
|
|
struct PrimitiveDataBuffer;
|
2024-05-27 01:42:10 +08:00
|
|
|
|
struct PrimitiveRenderData;
|
2024-04-26 00:41:53 +08:00
|
|
|
|
|
2020-07-14 14:03:26 +08:00
|
|
|
|
class VertexAttribBuffer;
|
2024-04-24 01:38:55 +08:00
|
|
|
|
using VAB=VertexAttribBuffer;
|
2020-08-07 21:59:20 +08:00
|
|
|
|
|
2019-05-07 12:46:25 +08:00
|
|
|
|
class IndexBuffer;
|
|
|
|
|
|
2024-06-12 02:07:54 +08:00
|
|
|
|
class VABMap;
|
|
|
|
|
class IBMap;
|
|
|
|
|
|
2020-10-21 12:39:22 +08:00
|
|
|
|
class GPUCmdBuffer;
|
2020-11-09 15:37:00 +08:00
|
|
|
|
class RenderCmdBuffer;
|
|
|
|
|
class TextureCmdBuffer;
|
2021-09-22 15:32:20 +08:00
|
|
|
|
|
2019-05-07 12:46:25 +08:00
|
|
|
|
class RenderPass;
|
2021-09-22 16:28:39 +08:00
|
|
|
|
class DeviceRenderPassManage;
|
|
|
|
|
|
2022-10-14 19:27:29 +08:00
|
|
|
|
class Fence;
|
2022-10-14 19:40:16 +08:00
|
|
|
|
class Semaphore;
|
2019-05-07 12:46:25 +08:00
|
|
|
|
|
2021-09-14 20:31:15 +08:00
|
|
|
|
struct PipelineLayoutData;
|
2023-02-13 11:48:53 +08:00
|
|
|
|
class DescriptorSet;
|
2020-09-19 23:49:32 +08:00
|
|
|
|
|
2024-06-18 02:04:11 +08:00
|
|
|
|
struct VertexInputAttribute;
|
2020-07-20 17:31:33 +08:00
|
|
|
|
|
2020-09-19 23:49:32 +08:00
|
|
|
|
class ShaderResource;
|
2019-05-07 12:46:25 +08:00
|
|
|
|
class ShaderModule;
|
2021-06-16 20:29:25 +08:00
|
|
|
|
class ShaderModuleMap;
|
2023-03-20 13:55:47 +08:00
|
|
|
|
class MaterialDescriptorManager;
|
2021-06-16 20:29:25 +08:00
|
|
|
|
|
2019-05-07 12:46:25 +08:00
|
|
|
|
class Material;
|
2021-06-16 10:41:04 +08:00
|
|
|
|
class MaterialParameters;
|
2021-06-16 20:29:25 +08:00
|
|
|
|
class MaterialInstance;
|
2020-09-19 23:49:32 +08:00
|
|
|
|
struct PipelineData;
|
2020-10-16 12:48:54 +08:00
|
|
|
|
enum class InlinePipeline;
|
2019-05-07 12:46:25 +08:00
|
|
|
|
class Pipeline;
|
2021-11-29 17:04:55 +08:00
|
|
|
|
|
2023-03-19 19:41:21 +08:00
|
|
|
|
struct VAConfig;
|
|
|
|
|
class VILConfig;
|
|
|
|
|
class VertexInput;
|
2021-11-29 20:12:10 +08:00
|
|
|
|
|
2023-05-04 19:35:09 +08:00
|
|
|
|
struct VertexInputFormat;
|
2024-04-01 23:32:18 +08:00
|
|
|
|
using VIF=VertexInputFormat;
|
2023-05-04 19:35:09 +08:00
|
|
|
|
|
2022-10-11 19:16:06 +08:00
|
|
|
|
class VertexInputLayout;
|
|
|
|
|
using VIL=VertexInputLayout;
|
2019-05-07 12:46:25 +08:00
|
|
|
|
|
2024-05-25 01:46:19 +08:00
|
|
|
|
class PrimitiveData;
|
2022-06-24 17:51:05 +08:00
|
|
|
|
class Primitive;
|
2022-06-24 21:06:38 +08:00
|
|
|
|
class Renderable;
|
2019-05-07 12:46:25 +08:00
|
|
|
|
|
2024-05-23 02:19:40 +08:00
|
|
|
|
class VertexDataManager;
|
2024-05-30 01:14:27 +08:00
|
|
|
|
using VDM=VertexDataManager;
|
|
|
|
|
|
2024-05-30 01:58:32 +08:00
|
|
|
|
class IndirectDrawBuffer;
|
|
|
|
|
class IndirectDrawIndexedBuffer;
|
|
|
|
|
class IndirectDispatchBuffer;
|
|
|
|
|
|
2020-10-21 12:39:22 +08:00
|
|
|
|
class RenderResource;
|
2020-09-02 19:06:12 +08:00
|
|
|
|
|
2020-09-02 18:27:19 +08:00
|
|
|
|
enum class SharingMode
|
|
|
|
|
{
|
|
|
|
|
Exclusive = 0,
|
|
|
|
|
Concurrent
|
|
|
|
|
};//
|
|
|
|
|
|
2020-10-23 21:21:09 +08:00
|
|
|
|
enum class Filter
|
|
|
|
|
{
|
|
|
|
|
Nearest=0,
|
|
|
|
|
Linear,
|
|
|
|
|
};//
|
|
|
|
|
|
2020-09-02 18:36:24 +08:00
|
|
|
|
enum ImageTiling
|
|
|
|
|
{
|
|
|
|
|
Optimal=0,
|
|
|
|
|
Linear
|
|
|
|
|
};//
|
|
|
|
|
|
2020-10-25 15:07:41 +08:00
|
|
|
|
inline const uint32_t GetMipLevel(const VkExtent2D &ext)
|
|
|
|
|
{
|
|
|
|
|
return hgl::GetMipLevel(ext.width,ext.height);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline const uint32_t GetMipLevel(const VkExtent3D &ext)
|
|
|
|
|
{
|
|
|
|
|
return hgl::GetMipLevel(ext.width,ext.height,ext.depth);
|
|
|
|
|
}
|
|
|
|
|
|
2021-09-28 20:26:36 +08:00
|
|
|
|
/**
|
|
|
|
|
* 索引类型,等同于VkIndexType
|
|
|
|
|
*/
|
2024-04-19 00:40:51 +08:00
|
|
|
|
enum IndexType:int
|
2020-09-02 19:06:12 +08:00
|
|
|
|
{
|
2024-04-19 00:40:51 +08:00
|
|
|
|
AUTO=-1,
|
2020-09-02 19:06:12 +08:00
|
|
|
|
U16=0,
|
2023-05-11 21:07:26 +08:00
|
|
|
|
U32,
|
|
|
|
|
U8=VK_INDEX_TYPE_UINT8_EXT,
|
2024-03-16 14:08:55 +08:00
|
|
|
|
|
|
|
|
|
ERR=VK_INDEX_TYPE_MAX_ENUM
|
2020-09-02 19:06:12 +08:00
|
|
|
|
};
|
|
|
|
|
|
2024-04-19 00:40:51 +08:00
|
|
|
|
inline const bool IsIndexType(const IndexType it)
|
|
|
|
|
{
|
|
|
|
|
return it>=U16&&it<=U8;
|
|
|
|
|
}
|
|
|
|
|
|
2023-12-24 01:35:30 +08:00
|
|
|
|
//Push Constant max-lengths:
|
|
|
|
|
//
|
|
|
|
|
// 256 bytes: nvidia,arm
|
|
|
|
|
// 128 bytes: amd,intel,powervr,adreno
|
2020-06-09 19:40:08 +08:00
|
|
|
|
|
2020-06-24 19:13:29 +08:00
|
|
|
|
inline void copy(VkExtent3D &e3d,const VkExtent2D &e2d,const uint32 depth=1)
|
2019-07-10 21:00:36 +08:00
|
|
|
|
{
|
|
|
|
|
e3d.width =e2d.width;
|
|
|
|
|
e3d.height =e2d.height;
|
2020-06-24 19:13:29 +08:00
|
|
|
|
e3d.depth =depth;
|
2019-07-10 21:00:36 +08:00
|
|
|
|
}
|
2019-04-16 14:18:10 +08:00
|
|
|
|
VK_NAMESPACE_END
|
2019-04-09 02:02:43 +08:00
|
|
|
|
#endif//HGL_GRAPH_VULKAN_INCLUDE
|