完整的纹数据结构输出
This commit is contained in:
@@ -2,19 +2,12 @@
|
||||
#define HGL_GRAPH_VULKAN_INCLUDE
|
||||
|
||||
#include<hgl/type/List.h>
|
||||
#include<vulkan/vulkan.h>
|
||||
#include<hgl/math/Math.h>
|
||||
#include<iostream>
|
||||
#include<hgl/graph/vulkan/VKNamespace.h>
|
||||
#include<hgl/graph/vulkan/VKFormat.h>
|
||||
#include<hgl/graph/vulkan/VKPrimivate.h>
|
||||
|
||||
#define VK_NAMESPACE hgl::graph::vulkan
|
||||
|
||||
#define VK_NAMESPACE_USING using namespace VK_NAMESPACE;
|
||||
|
||||
#define VK_NAMESPACE_BEGIN namespace hgl{namespace graph{namespace vulkan{
|
||||
#define VK_NAMESPACE_END }}}
|
||||
|
||||
VK_NAMESPACE_BEGIN
|
||||
|
||||
class Instance;
|
||||
@@ -83,13 +76,6 @@ inline void copy(VkExtent3D &e3d,const VkExtent2D &e2d)
|
||||
e3d.depth =1;
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
bool CheckStrideBytesByFormat(); ///<检验所有数据类型长度数组是否符合规则
|
||||
#endif//_DEBUG
|
||||
|
||||
uint32_t GetStrideByFormat(const VkFormat &); ///<根据数据类型获取得类型单个数据长度字节数
|
||||
const char *GetColorFormatName(const VkFormat &); ///<根据数据类型获取得类型名称
|
||||
|
||||
inline void debug_out(const hgl::List<VkLayerProperties> &layer_properties)
|
||||
{
|
||||
const int property_count=layer_properties.GetCount();
|
||||
|
@@ -1,7 +1,9 @@
|
||||
#ifndef HGL_GRAPH_VULKAN_FORMAT_INCLUDE
|
||||
#define HGL_GRAPH_VULKAN_FORMAT_INCLUDE
|
||||
|
||||
#include<vulkan/vulkan.h>
|
||||
#include<hgl/graph/vulkan/VKNamespace.h>
|
||||
|
||||
VK_NAMESPACE_BEGIN
|
||||
|
||||
#define FMT_UNDEFINED VK_FORMAT_UNDEFINED
|
||||
|
||||
@@ -162,4 +164,176 @@
|
||||
#define FMT_D24UN_S8U VK_FORMAT_D24_UNORM_S8_UINT
|
||||
#define FMT_D32F_S8U VK_FORMAT_D32_SFLOAT_S8_UINT
|
||||
|
||||
#define FMT_BC1_RGBUN VK_FORMAT_BC1_RGB_UNORM_BLOCK
|
||||
#define FMT_BC1_RGBs VK_FORMAT_BC1_RGB_SRGB_BLOCK
|
||||
#define FMT_BC1_RGBAUN VK_FORMAT_BC1_RGBA_UNORM_BLOCK
|
||||
#define FMT_BC1_RGBAs VK_FORMAT_BC1_RGBA_SRGB_BLOCK
|
||||
|
||||
#define FMT_BC2UN VK_FORMAT_BC2_UNORM_BLOCK
|
||||
#define FMT_BC2s VK_FORMAT_BC2_SRGB_BLOCK
|
||||
|
||||
#define FMT_BC3UN VK_FORMAT_BC3_UNORM_BLOCK
|
||||
#define FMT_BC3s VK_FORMAT_BC3_SRGB_BLOCK
|
||||
|
||||
#define FMT_BC4UN VK_FORMAT_BC4_UNORM_BLOCK
|
||||
#define FMT_BC4SN VK_FORMAT_BC4_SNORM_BLOCK
|
||||
|
||||
#define FMT_BC5UN VK_FORMAT_BC5_UNORM_BLOCK
|
||||
#define FMT_BC5SN VK_FORMAT_BC5_SNORM_BLOCK
|
||||
|
||||
#define FMT_BC6UF VK_FORMAT_BC6H_UFLOAT_BLOCK
|
||||
#define FMT_BC6SF VK_FORMAT_BC6H_SFLOAT_BLOCK
|
||||
|
||||
#define FMT_BC7UN VK_FORMAT_BC7_UNORM_BLOCK
|
||||
#define FMT_BC7s VK_FORMAT_BC7_SRGB_BLOCK
|
||||
|
||||
#define FMT_ETC2_RGB8UN VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK
|
||||
#define FMT_ETC2_RGB8s VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK
|
||||
#define FMT_ETC2_RGB8A1UN VK_FORMAT_ETC2_R8G8B8A1_UNORM_BLOCK
|
||||
#define FMT_ETC2_RGB8A1s VK_FORMAT_ETC2_R8G8B8A1_SRGB_BLOCK
|
||||
#define FMT_ETC2_RGBA8UN VK_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK
|
||||
#define FMT_ETC2_RGBA8s VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK
|
||||
|
||||
#define FMT_EAC_R11UN VK_FORMAT_EAC_R11_UNORM_BLOCK
|
||||
#define FMT_EAC_R11SN VK_FORMAT_EAC_R11_SNORM_BLOCK
|
||||
#define FMT_EAC_RG11UN VK_FORMAT_EAC_R11G11_UNORM_BLOCK
|
||||
#define FMT_EAC_RG11SN VK_FORMAT_EAC_R11G11_SNORM_BLOCK
|
||||
|
||||
#define FMT_ASTC_4x4UN VK_FORMAT_ASTC_4x4_UNORM_BLOCK
|
||||
#define FMT_ASTC_4x4s VK_FORMAT_ASTC_4x4_SRGB_BLOCK
|
||||
#define FMT_ASTC_5x4UN VK_FORMAT_ASTC_5x4_UNORM_BLOCK
|
||||
#define FMT_ASTC_5x4s VK_FORMAT_ASTC_5x4_SRGB_BLOCK
|
||||
#define FMT_ASTC_5x5UN VK_FORMAT_ASTC_5x5_UNORM_BLOCK
|
||||
#define FMT_ASTC_5x5s VK_FORMAT_ASTC_5x5_SRGB_BLOCK
|
||||
#define FMT_ASTC_6x5UN VK_FORMAT_ASTC_6x5_UNORM_BLOCK
|
||||
#define FMT_ASTC_6x5s VK_FORMAT_ASTC_6x5_SRGB_BLOCK
|
||||
#define FMT_ASTC_6x6UN VK_FORMAT_ASTC_6x6_UNORM_BLOCK
|
||||
#define FMT_ASTC_6x6s VK_FORMAT_ASTC_6x6_SRGB_BLOCK
|
||||
#define FMT_ASTC_8x5UN VK_FORMAT_ASTC_8x5_UNORM_BLOCK
|
||||
#define FMT_ASTC_8x5s VK_FORMAT_ASTC_8x5_SRGB_BLOCK
|
||||
#define FMT_ASTC_8x6UN VK_FORMAT_ASTC_8x6_UNORM_BLOCK
|
||||
#define FMT_ASTC_8x6s VK_FORMAT_ASTC_8x6_SRGB_BLOCK
|
||||
#define FMT_ASTC_8x8UN VK_FORMAT_ASTC_8x8_UNORM_BLOCK
|
||||
#define FMT_ASTC_8x8s VK_FORMAT_ASTC_8x8_SRGB_BLOCK
|
||||
#define FMT_ASTC_10x5UN VK_FORMAT_ASTC_10x5_UNORM_BLOCK
|
||||
#define FMT_ASTC_10x5s VK_FORMAT_ASTC_10x5_SRGB_BLOCK
|
||||
#define FMT_ASTC_10x6UN VK_FORMAT_ASTC_10x6_UNORM_BLOCK
|
||||
#define FMT_ASTC_10x6s VK_FORMAT_ASTC_10x6_SRGB_BLOCK
|
||||
#define FMT_ASTC_10x8UN VK_FORMAT_ASTC_10x8_UNORM_BLOCK
|
||||
#define FMT_ASTC_10x8s VK_FORMAT_ASTC_10x8_SRGB_BLOCK
|
||||
#define FMT_ASTC_10x10UN VK_FORMAT_ASTC_10x10_UNORM_BLOCK
|
||||
#define FMT_ASTC_10x10s VK_FORMAT_ASTC_10x10_SRGB_BLOCK
|
||||
#define FMT_ASTC_12x10UN VK_FORMAT_ASTC_12x10_UNORM_BLOCK
|
||||
#define FMT_ASTC_12x10s VK_FORMAT_ASTC_12x10_SRGB_BLOCK
|
||||
#define FMT_ASTC_12x12UN VK_FORMAT_ASTC_12x12_UNORM_BLOCK
|
||||
#define FMT_ASTC_12x12s VK_FORMAT_ASTC_12x12_SRGB_BLOCK
|
||||
|
||||
#define FMT_YUYV8_422 VK_FORMAT_G8B8G8R8_422_UNORM
|
||||
#define FMT_UYVY8_422 VK_FORMAT_B8G8R8G8_422_UNORM
|
||||
#define FMT_YUV8_420 VK_FORMAT_G8_B8_R8_3PLANE_420_UNORM
|
||||
#define FMT_Y8_UV8_420 VK_FORMAT_G8_B8R8_2PLANE_420_UNORM
|
||||
#define FMT_YUV8_422 VK_FORMAT_G8_B8_R8_3PLANE_422_UNORM
|
||||
#define FMT_Y8_UV8_422 VK_FORMAT_G8_B8R8_2PLANE_422_UNORM
|
||||
#define FMT_YUV8_444 VK_FORMAT_G8_B8_R8_3PLANE_444_UNORM
|
||||
|
||||
#define FMT_R10X6UN VK_FORMAT_R10X6_UNORM_PACK16
|
||||
#define FMT_RG10X6UN VK_FORMAT_R10X6G10X6_UNORM_2PACK16
|
||||
#define FMT_RGBA10X6UN VK_FORMAT_R10X6G10X6B10X6A10X6_UNORM_4PACK16
|
||||
#define FMT_YUYV10_422 VK_FORMAT_G10X6B10X6G10X6R10X6_422_UNORM_4PACK16
|
||||
#define FMT_UYVY10_422 VK_FORMAT_B10X6G10X6R10X6G10X6_422_UNORM_4PACK16
|
||||
#define FMT_YUV10_420 VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_420_UNORM_3PACK16
|
||||
#define FMT_Y10_UV10_420 VK_FORMAT_G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16
|
||||
#define FMT_YUV10_422 VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_422_UNORM_3PACK16
|
||||
#define FMT_Y10_UV10_422 VK_FORMAT_G10X6_B10X6R10X6_2PLANE_422_UNORM_3PACK16
|
||||
#define FMT_YUV10_444 VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_444_UNORM_3PACK16
|
||||
|
||||
#define FMT_R12X4UN VK_FORMAT_R12X4_UNORM_PACK16
|
||||
#define FMT_RG12X4UN VK_FORMAT_R12X4G12X4_UNORM_2PACK16
|
||||
#define FMT_RGBA12X4UN VK_FORMAT_R12X4G12X4B12X4A12X4_UNORM_4PACK16
|
||||
#define FMT_YUYV12_422 VK_FORMAT_G12X4B12X4G12X4R12X4_422_UNORM_4PACK16
|
||||
#define FMT_UYVY12_422 VK_FORMAT_B12X4G12X4R12X4G12X4_422_UNORM_4PACK16
|
||||
#define FMT_YUV12_420 VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_420_UNORM_3PACK16
|
||||
#define FMT_Y12_UV12_420 VK_FORMAT_G12X4_B12X4R12X4_2PLANE_420_UNORM_3PACK16
|
||||
#define FMT_YUV12_422 VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_422_UNORM_3PACK16
|
||||
#define FMT_Y12_UV12_422 VK_FORMAT_G12X4_B12X4R12X4_2PLANE_422_UNORM_3PACK16
|
||||
#define FMT_YUV12_444 VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_444_UNORM_3PACK16
|
||||
|
||||
#define FMT_YUYV16_422 VK_FORMAT_G16B16G16R16_422_UNORM
|
||||
#define FMT_UYVY16_422 VK_FORMAT_B16G16R16G16_422_UNORM
|
||||
#define FMT_YUV16_420 VK_FORMAT_G16_B16_R16_3PLANE_420_UNORM
|
||||
#define FMT_Y16_UV16_420 VK_FORMAT_G16_B16R16_2PLANE_420_UNORM
|
||||
#define FMT_YUV16_422 VK_FORMAT_G16_B16_R16_3PLANE_422_UNORM
|
||||
#define FMT_Y16_UV16_422 VK_FORMAT_G16_B16R16_2PLANE_422_UNORM
|
||||
#define FMT_YUV16_444 VK_FORMAT_G16_B16_R16_3PLANE_444_UNORM
|
||||
|
||||
#define FMT_PVRTC1_2UN VK_FORMAT_PVRTC1_2BPP_UNORM_BLOCK_IMG
|
||||
#define FMT_PVRTC1_4UN VK_FORMAT_PVRTC1_4BPP_UNORM_BLOCK_IMG
|
||||
#define FMT_PVRTC2_2UN VK_FORMAT_PVRTC2_2BPP_UNORM_BLOCK_IMG
|
||||
#define FMT_PVRTC2_4UN VK_FORMAT_PVRTC2_4BPP_UNORM_BLOCK_IMG
|
||||
#define FMT_PVRTC1_2s VK_FORMAT_PVRTC1_2BPP_SRGB_BLOCK_IMG
|
||||
#define FMT_PVRTC1_4s VK_FORMAT_PVRTC1_4BPP_SRGB_BLOCK_IMG
|
||||
#define FMT_PVRTC2_2s VK_FORMAT_PVRTC2_2BPP_SRGB_BLOCK_IMG
|
||||
#define FMT_PVRTC2_4s VK_FORMAT_PVRTC2_4BPP_SRGB_BLOCK_IMG
|
||||
|
||||
enum class TextureCompressType
|
||||
{
|
||||
NONE=0,
|
||||
S3TC,
|
||||
PVRTC,
|
||||
ETC1,
|
||||
ETC2,
|
||||
EAC,
|
||||
ATC,
|
||||
ASTC,
|
||||
YUV,
|
||||
};//
|
||||
|
||||
enum class VulkanDataType
|
||||
{
|
||||
NONE=0,
|
||||
UNORM,
|
||||
SNORM,
|
||||
USCALED,
|
||||
SSCALED,
|
||||
UINT,
|
||||
SINT,
|
||||
UFLOAT,
|
||||
SFLOAT,
|
||||
SRGB,
|
||||
};//
|
||||
|
||||
struct VulkanFormat
|
||||
{
|
||||
VkFormat format; ///<Vulkan格式,此值保留仅为参考
|
||||
|
||||
uint32_t bytes; ///<每象素字节数
|
||||
|
||||
char name[32]; ///<名称
|
||||
|
||||
TextureCompressType compress_type; ///<压缩类型
|
||||
VulkanDataType color; ///<颜色数据类型
|
||||
VulkanDataType depth,stencil; ///<是否含有depth,stencil数据
|
||||
};
|
||||
|
||||
#ifdef _DEBUG
|
||||
bool CheckStrideBytesByFormat(); ///<检验所有数据类型长度数组是否符合规则
|
||||
#endif//_DEBUG
|
||||
|
||||
const VulkanFormat *GetVulkanFormat(const VkFormat &format);
|
||||
const VulkanFormat *GetVulkanFormatList(uint32_t &);
|
||||
|
||||
inline uint32_t GetStrideByFormat(const VkFormat &format)
|
||||
{
|
||||
const VulkanFormat *vcf=GetVulkanFormat(format);
|
||||
|
||||
return (vcf?vcf->bytes:0);
|
||||
}
|
||||
|
||||
inline const char *GetVulkanFormatName(const VkFormat &format)
|
||||
{
|
||||
const VulkanFormat *vcf=GetVulkanFormat(format);
|
||||
|
||||
return (vcf?vcf->name:nullptr);
|
||||
}
|
||||
VK_NAMESPACE_END
|
||||
#endif//HGL_GRAPH_VULKAN_FORMAT_INCLUDE
|
||||
|
10
inc/hgl/graph/vulkan/VKNamespace.h
Normal file
10
inc/hgl/graph/vulkan/VKNamespace.h
Normal file
@@ -0,0 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
#include<vulkan/vulkan.h>
|
||||
|
||||
#define VK_NAMESPACE hgl::graph::vulkan
|
||||
|
||||
#define VK_NAMESPACE_USING using namespace VK_NAMESPACE;
|
||||
|
||||
#define VK_NAMESPACE_BEGIN namespace hgl{namespace graph{namespace vulkan{
|
||||
#define VK_NAMESPACE_END }}}
|
Reference in New Issue
Block a user