2019-04-09 02:02:43 +08:00
|
|
|
|
#ifndef HGL_GRAPH_VULKAN_INCLUDE
|
|
|
|
|
#define HGL_GRAPH_VULKAN_INCLUDE
|
|
|
|
|
|
2019-04-11 02:29:21 +08:00
|
|
|
|
#include<hgl/type/List.h>
|
2019-05-28 21:17:37 +08:00
|
|
|
|
#include<hgl/math/Math.h>
|
2019-04-13 15:34:34 +08:00
|
|
|
|
#include<iostream>
|
2020-10-21 11:43:18 +08:00
|
|
|
|
#include<hgl/graph/VKNamespace.h>
|
|
|
|
|
#include<hgl/graph/VKFormat.h>
|
|
|
|
|
#include<hgl/graph/VKPrimivate.h>
|
|
|
|
|
#include<hgl/graph/VKStruct.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
|
|
|
|
|
2019-11-13 20:50:34 +08:00
|
|
|
|
using CharPointerList=hgl::List<const char *>;
|
|
|
|
|
|
2019-05-07 12:46:25 +08:00
|
|
|
|
class Instance;
|
2019-05-28 21:17:37 +08:00
|
|
|
|
class PhysicalDevice;
|
2019-05-07 12:46:25 +08:00
|
|
|
|
class Device;
|
2019-07-15 22:37:00 +08:00
|
|
|
|
struct DeviceAttribute;
|
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;
|
|
|
|
|
class SwapchainRenderTarget;
|
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;
|
|
|
|
|
class TextureCubemap;
|
|
|
|
|
class TextureCubemapArray;
|
|
|
|
|
|
2019-05-18 16:10:42 +08:00
|
|
|
|
class Sampler;
|
|
|
|
|
|
2019-06-26 15:18:31 +08:00
|
|
|
|
class Memory;
|
2019-05-07 12:46:25 +08:00
|
|
|
|
class Buffer;
|
2019-11-25 22:05:05 +08:00
|
|
|
|
struct BufferData;
|
2020-08-07 21:59:20 +08:00
|
|
|
|
|
2020-07-14 14:03:26 +08:00
|
|
|
|
class VertexAttribBuffer;
|
2020-08-07 21:59:20 +08:00
|
|
|
|
using VAB=VertexAttribBuffer;
|
|
|
|
|
|
2019-05-07 12:46:25 +08:00
|
|
|
|
class IndexBuffer;
|
|
|
|
|
|
|
|
|
|
class CommandBuffer;
|
|
|
|
|
class RenderPass;
|
|
|
|
|
class Fence;
|
2020-10-18 13:52:06 +08:00
|
|
|
|
class GPUSemaphore;
|
2019-05-07 12:46:25 +08:00
|
|
|
|
|
2020-09-19 23:49:32 +08:00
|
|
|
|
class DescriptorSetLayoutCreater;
|
|
|
|
|
|
2020-07-20 17:31:33 +08:00
|
|
|
|
struct ShaderStage;
|
|
|
|
|
|
2020-09-19 23:49:32 +08:00
|
|
|
|
class ShaderResource;
|
2019-05-07 12:46:25 +08:00
|
|
|
|
class ShaderModule;
|
|
|
|
|
class VertexShaderModule;
|
|
|
|
|
class Material;
|
2020-01-20 15:39:39 +08:00
|
|
|
|
class MaterialInstance;
|
2019-05-07 12:46:25 +08:00
|
|
|
|
class PipelineLayout;
|
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;
|
|
|
|
|
class DescriptorSets;
|
|
|
|
|
class VertexAttributeBinding;
|
|
|
|
|
|
|
|
|
|
class Renderable;
|
2020-09-21 19:05:25 +08:00
|
|
|
|
class RenderableInstance;
|
2019-05-07 12:46:25 +08:00
|
|
|
|
|
2020-09-02 19:06:12 +08:00
|
|
|
|
class Database;
|
|
|
|
|
|
2020-09-02 18:27:19 +08:00
|
|
|
|
enum class SharingMode
|
|
|
|
|
{
|
|
|
|
|
Exclusive = 0,
|
|
|
|
|
Concurrent
|
|
|
|
|
};//
|
|
|
|
|
|
2020-09-02 18:36:24 +08:00
|
|
|
|
enum ImageTiling
|
|
|
|
|
{
|
|
|
|
|
Optimal=0,
|
|
|
|
|
Linear
|
|
|
|
|
};//
|
|
|
|
|
|
2020-09-02 19:06:12 +08:00
|
|
|
|
enum IndexType
|
|
|
|
|
{
|
|
|
|
|
U16=0,
|
|
|
|
|
U32
|
|
|
|
|
};
|
|
|
|
|
|
2020-06-09 19:40:08 +08:00
|
|
|
|
enum class ShaderStageBit
|
2019-05-28 20:12:55 +08:00
|
|
|
|
{
|
|
|
|
|
Vertex =VK_SHADER_STAGE_VERTEX_BIT,
|
|
|
|
|
TessControl =VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT,
|
|
|
|
|
TessEval =VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT,
|
|
|
|
|
Geometry =VK_SHADER_STAGE_GEOMETRY_BIT,
|
|
|
|
|
Fragment =VK_SHADER_STAGE_FRAGMENT_BIT,
|
|
|
|
|
Compute =VK_SHADER_STAGE_COMPUTE_BIT
|
2020-06-09 19:40:08 +08:00
|
|
|
|
};//enum class ShaderStageBit
|
2019-05-28 20:12:55 +08:00
|
|
|
|
|
2020-09-17 21:49:23 +08:00
|
|
|
|
inline const uint GetShaderCountByBits(const uint32_t bits)
|
|
|
|
|
{
|
|
|
|
|
uint comp=(uint)VK_SHADER_STAGE_VERTEX_BIT;
|
|
|
|
|
uint result=0;
|
|
|
|
|
|
|
|
|
|
for(uint i=0;i<6;i++)
|
|
|
|
|
{
|
|
|
|
|
if(bits&comp)
|
|
|
|
|
++result;
|
|
|
|
|
|
|
|
|
|
comp<<=1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
2020-01-14 18:09:40 +08:00
|
|
|
|
/**
|
|
|
|
|
* max-lengths:
|
|
|
|
|
*
|
|
|
|
|
256 bytes: nvidia,arm
|
|
|
|
|
128 bytes: amd,intel,powervr,adreno
|
|
|
|
|
*/
|
|
|
|
|
struct PushConstant
|
2019-05-29 21:48:56 +08:00
|
|
|
|
{
|
|
|
|
|
Matrix4f local_to_world;
|
|
|
|
|
};
|
|
|
|
|
|
2020-06-09 19:40:08 +08:00
|
|
|
|
constexpr uint32_t MAX_PUSH_CONSTANT_BYTES=sizeof(PushConstant);
|
|
|
|
|
|
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-13 15:34:34 +08:00
|
|
|
|
inline void debug_out(const hgl::List<VkLayerProperties> &layer_properties)
|
|
|
|
|
{
|
|
|
|
|
const int property_count=layer_properties.GetCount();
|
|
|
|
|
|
|
|
|
|
if(property_count<=0)return;
|
|
|
|
|
|
|
|
|
|
const VkLayerProperties *lp=layer_properties.GetData();
|
|
|
|
|
|
|
|
|
|
for(int i=0;i<property_count;i++)
|
|
|
|
|
{
|
|
|
|
|
std::cout<<"Layer Propertyes ["<<i<<"] : "<<lp->layerName<<" desc: "<<lp->description<<std::endl;
|
|
|
|
|
++lp;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline void debug_out(const hgl::List<VkExtensionProperties> &extension_properties)
|
|
|
|
|
{
|
|
|
|
|
const int extension_count=extension_properties.GetCount();
|
|
|
|
|
|
|
|
|
|
if(extension_count<=0)return;
|
|
|
|
|
|
|
|
|
|
VkExtensionProperties *ep=extension_properties.GetData();
|
|
|
|
|
for(int i=0;i<extension_count;i++)
|
|
|
|
|
{
|
|
|
|
|
std::cout<<"Extension Propertyes ["<<i<<"] : "<<ep->extensionName<<" ver: "<<ep->specVersion<<std::endl;
|
|
|
|
|
++ep;
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-04-16 14:18:10 +08:00
|
|
|
|
VK_NAMESPACE_END
|
2019-04-09 02:02:43 +08:00
|
|
|
|
#endif//HGL_GRAPH_VULKAN_INCLUDE
|