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-04-09 02:02:43 +08:00
|
|
|
|
#include<vulkan/vulkan.h>
|
2019-05-28 21:17:37 +08:00
|
|
|
|
#include<hgl/math/Math.h>
|
2019-04-13 15:34:34 +08:00
|
|
|
|
#include<iostream>
|
2019-05-07 12:46:25 +08:00
|
|
|
|
#include<hgl/graph/vulkan/VKFormat.h>
|
|
|
|
|
#include<hgl/graph/vulkan/VKPrimivate.h>
|
2019-04-09 02:02:43 +08:00
|
|
|
|
|
2019-04-18 16:06:44 +08:00
|
|
|
|
#define VK_NAMESPACE hgl::graph::vulkan
|
2019-04-09 02:02:43 +08:00
|
|
|
|
#define VK_NAMESPACE_BEGIN namespace hgl{namespace graph{namespace vulkan{
|
|
|
|
|
#define VK_NAMESPACE_END }}}
|
|
|
|
|
|
2019-05-05 14:22:58 +08:00
|
|
|
|
VK_NAMESPACE_BEGIN
|
2019-04-19 12:11:16 +08:00
|
|
|
|
|
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;
|
|
|
|
|
class ImageView;
|
|
|
|
|
class Framebuffer;
|
|
|
|
|
|
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;
|
|
|
|
|
class VertexBuffer;
|
|
|
|
|
class IndexBuffer;
|
|
|
|
|
|
|
|
|
|
class CommandBuffer;
|
|
|
|
|
class RenderPass;
|
|
|
|
|
class Fence;
|
|
|
|
|
class Semaphore;
|
|
|
|
|
|
|
|
|
|
class ShaderModule;
|
|
|
|
|
class ShaderModuleManage;
|
|
|
|
|
class VertexShaderModule;
|
|
|
|
|
class Material;
|
|
|
|
|
class PipelineLayout;
|
|
|
|
|
class Pipeline;
|
|
|
|
|
class DescriptorSets;
|
|
|
|
|
class VertexAttributeBinding;
|
|
|
|
|
|
|
|
|
|
class Renderable;
|
|
|
|
|
|
2019-04-11 02:29:21 +08:00
|
|
|
|
using CharPointerList=hgl::List<const char *>;
|
|
|
|
|
|
2019-05-30 11:46:46 +08:00
|
|
|
|
enum class ShaderStage
|
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
|
2019-05-30 11:46:46 +08:00
|
|
|
|
};//enum class ShaderStage
|
2019-05-28 20:12:55 +08:00
|
|
|
|
|
2019-05-29 21:48:56 +08:00
|
|
|
|
struct PushConstant
|
|
|
|
|
{
|
|
|
|
|
Matrix4f local_to_world;
|
|
|
|
|
};
|
|
|
|
|
|
2019-04-16 14:52:48 +08:00
|
|
|
|
#ifdef _DEBUG
|
2019-04-16 14:58:10 +08:00
|
|
|
|
bool CheckStrideBytesByFormat(); ///<检验所有数据类型长度数组是否符合规则
|
2019-04-16 14:52:48 +08:00
|
|
|
|
#endif//_DEBUG
|
|
|
|
|
|
2019-04-16 14:58:10 +08:00
|
|
|
|
uint32_t GetStrideByFormat(const VkFormat &); ///<根据数据类型获取访类型单个数据长度字节数
|
2019-04-16 14:18:10 +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
|