From 47ba4543261ce2cabd585abe0b357428c5925991 Mon Sep 17 00:00:00 2001 From: "HuYingzhuo(hugo/hyzboy)" Date: Tue, 6 Jun 2023 12:18:19 +0800 Subject: [PATCH] used VulkanBaseType instead of VulkanNumberType --- TextureFileCreater.cpp | 4 +- TextureFileCreater.h | 2 +- pixel_format.cpp | 96 +++++++++++++++++++++--------------------- pixel_format.h | 4 +- 4 files changed, 53 insertions(+), 53 deletions(-) diff --git a/TextureFileCreater.cpp b/TextureFileCreater.cpp index a851d06..61377f2 100644 --- a/TextureFileCreater.cpp +++ b/TextureFileCreater.cpp @@ -3,9 +3,9 @@ using namespace hgl::filesystem; -bool ToILType(ILuint &type,const uint8 bits,const VulkanNumberType cdt) +bool ToILType(ILuint &type,const uint8 bits,const VulkanBaseType cdt) { - constexpr ILuint target_type[3][(uint)VulkanNumberType::END_RANGE-1]= + constexpr ILuint target_type[3][(uint)VulkanBaseType::END_RANGE-1]= { //UINT SINT, UNORM SNORM USCALE,SSCALE, UFLOAT SFLOAT /* 8 */{IL_UNSIGNED_BYTE, IL_BYTE, IL_UNSIGNED_BYTE, IL_BYTE, 0,0, 0, 0}, diff --git a/TextureFileCreater.h b/TextureFileCreater.h index 4aa33c5..5b51ef7 100644 --- a/TextureFileCreater.h +++ b/TextureFileCreater.h @@ -8,7 +8,7 @@ using namespace hgl; -bool ToILType(ILuint &type,const uint8 bits,const hgl::graph::VulkanNumberType cdt); +bool ToILType(ILuint &type,const uint8 bits,const hgl::graph::VulkanBaseType cdt); class TextureFileCreater { diff --git a/pixel_format.cpp b/pixel_format.cpp index 22a48c3..c361f93 100644 --- a/pixel_format.cpp +++ b/pixel_format.cpp @@ -23,56 +23,56 @@ namespace hgl constexpr PixelFormat pf_list[]= { - {ColorFormat::RGBA4, "RGBA4", 4,{'R','G','B','A'},{ 4, 4, 4, 4}, 16,VulkanNumberType::UNORM}, - {ColorFormat::BGRA4, "BGRA4", 4,{'B','G','R','A'},{ 4, 4, 4, 4}, 16,VulkanNumberType::UNORM}, - {ColorFormat::RGB565, "RGB565", 3,{'R','G','B', 0 },{ 5, 6, 5, 0}, 16,VulkanNumberType::UNORM}, - {ColorFormat::A1RGB5, "A1RGB5", 4,{'A','R','G','B'},{ 1, 5, 5, 5}, 16,VulkanNumberType::UNORM}, - {ColorFormat::R8, "R8", 1,{'R', 0 , 0 , 0 },{ 8, 0, 0, 0}, 8,VulkanNumberType::UNORM}, - {ColorFormat::RG8, "RG8", 2,{'R','G', 0 , 0 },{ 8, 8, 0, 0}, 16,VulkanNumberType::UNORM}, - {ColorFormat::RGBA8, "RGBA8", 4,{'R','G','B','A'},{ 8, 8, 8, 8}, 32,VulkanNumberType::UNORM}, - {ColorFormat::RGBA8SN, "RGBA8S", 4,{'R','G','B','A'},{ 8, 8, 8, 8}, 32,VulkanNumberType::SNORM}, - {ColorFormat::RGBA8U, "RGBA8U", 4,{'R','G','B','A'},{ 8, 8, 8, 8}, 32,VulkanNumberType::UINT}, - {ColorFormat::RGBA8I, "RGBA8I", 4,{'R','G','B','A'},{ 8, 8, 8, 8}, 32,VulkanNumberType::SINT}, - {ColorFormat::ABGR8, "ABGR8", 4,{'A','B','G','R'},{ 8, 8, 8, 8}, 32,VulkanNumberType::UNORM}, - {ColorFormat::A2BGR10, "A2BGR10", 4,{'A','B','G','R'},{ 2,10,10,10}, 32,VulkanNumberType::UNORM}, - {ColorFormat::R16, "R16", 1,{'R', 0 , 0 , 0 },{16, 0, 0, 0}, 16,VulkanNumberType::UNORM}, - {ColorFormat::R16U, "R16U", 1,{'R', 0 , 0 , 0 },{16, 0, 0, 0}, 16,VulkanNumberType::UINT}, - {ColorFormat::R16I, "R16I", 1,{'R', 0 , 0 , 0 },{16, 0, 0, 0}, 16,VulkanNumberType::SINT}, - {ColorFormat::R16F, "R16F", 1,{'R', 0 , 0 , 0 },{16, 0, 0, 0}, 16,VulkanNumberType::SFLOAT}, - {ColorFormat::RG16, "RG16", 2,{'R','G', 0 , 0 },{16,16, 0, 0}, 32,VulkanNumberType::UNORM}, - {ColorFormat::RG16U, "RG16U", 2,{'R','G', 0 , 0 },{16,16, 0, 0}, 32,VulkanNumberType::UINT}, - {ColorFormat::RG16I, "RG16I", 2,{'R','G', 0 , 0 },{16,16, 0, 0}, 32,VulkanNumberType::SINT}, - {ColorFormat::RG16F, "RG16F", 2,{'R','G', 0 , 0 },{16,16, 0, 0}, 32,VulkanNumberType::SFLOAT}, - {ColorFormat::RGBA16, "RGBA16", 4,{'R','G','B','A'},{16,16,16,16}, 64,VulkanNumberType::UNORM}, - {ColorFormat::RGBA16SN, "RGBA16S", 4,{'R','G','B','A'},{16,16,16,16}, 64,VulkanNumberType::SNORM}, - {ColorFormat::RGBA16U, "RGBA16U", 4,{'R','G','B','A'},{16,16,16,16}, 64,VulkanNumberType::UINT}, - {ColorFormat::RGBA16I, "RGBA16I", 4,{'R','G','B','A'},{16,16,16,16}, 64,VulkanNumberType::SINT}, - {ColorFormat::RGBA16F, "RGBA16F", 4,{'R','G','B','A'},{16,16,16,16}, 64,VulkanNumberType::SFLOAT}, - {ColorFormat::R32U, "R32U", 1,{'R', 0 , 0 , 0 },{32, 0, 0, 0}, 32,VulkanNumberType::UINT}, - {ColorFormat::R32I, "R32I", 1,{'R', 0 , 0 , 0 },{32, 0, 0, 0}, 32,VulkanNumberType::SINT}, - {ColorFormat::R32F, "R32F", 1,{'R', 0 , 0 , 0 },{32, 0, 0, 0}, 32,VulkanNumberType::SFLOAT}, - {ColorFormat::RG32U, "RG32U", 2,{'R','G', 0 , 0 },{32,32, 0, 0}, 64,VulkanNumberType::UINT}, - {ColorFormat::RG32I, "RG32I", 2,{'R','G', 0 , 0 },{32,32, 0, 0}, 64,VulkanNumberType::SINT}, - {ColorFormat::RG32F, "RG32F", 2,{'R','G', 0 , 0 },{32,32, 0, 0}, 64,VulkanNumberType::SFLOAT}, - {ColorFormat::RGB32U, "RGB32U", 3,{'R','G','B', 0 },{32,32,32, 0}, 96,VulkanNumberType::UINT}, - {ColorFormat::RGB32I, "RGB32I", 3,{'R','G','B', 0 },{32,32,32, 0}, 96,VulkanNumberType::SINT}, - {ColorFormat::RGB32F, "RGB32F", 3,{'R','G','B', 0 },{32,32,32, 0}, 96,VulkanNumberType::SFLOAT}, - {ColorFormat::RGBA32U, "RGBA32U", 4,{'R','G','B','A'},{32,32,32,32},128,VulkanNumberType::UINT}, - {ColorFormat::RGBA32I, "RGBA32I", 4,{'R','G','B','A'},{32,32,32,32},128,VulkanNumberType::SINT}, - {ColorFormat::RGBA32F, "RGBA32F", 4,{'R','G','B','A'},{32,32,32,32},128,VulkanNumberType::SFLOAT}, - {ColorFormat::B10GR11UF,"B10GR11UF",3,{'B','G','R', 0 },{10,11,11, 0}, 32,VulkanNumberType::UFLOAT}, + {ColorFormat::RGBA4, "RGBA4", 4,{'R','G','B','A'},{ 4, 4, 4, 4}, 16,VulkanBaseType::UNORM}, + {ColorFormat::BGRA4, "BGRA4", 4,{'B','G','R','A'},{ 4, 4, 4, 4}, 16,VulkanBaseType::UNORM}, + {ColorFormat::RGB565, "RGB565", 3,{'R','G','B', 0 },{ 5, 6, 5, 0}, 16,VulkanBaseType::UNORM}, + {ColorFormat::A1RGB5, "A1RGB5", 4,{'A','R','G','B'},{ 1, 5, 5, 5}, 16,VulkanBaseType::UNORM}, + {ColorFormat::R8, "R8", 1,{'R', 0 , 0 , 0 },{ 8, 0, 0, 0}, 8,VulkanBaseType::UNORM}, + {ColorFormat::RG8, "RG8", 2,{'R','G', 0 , 0 },{ 8, 8, 0, 0}, 16,VulkanBaseType::UNORM}, + {ColorFormat::RGBA8, "RGBA8", 4,{'R','G','B','A'},{ 8, 8, 8, 8}, 32,VulkanBaseType::UNORM}, + {ColorFormat::RGBA8SN, "RGBA8S", 4,{'R','G','B','A'},{ 8, 8, 8, 8}, 32,VulkanBaseType::SNORM}, + {ColorFormat::RGBA8U, "RGBA8U", 4,{'R','G','B','A'},{ 8, 8, 8, 8}, 32,VulkanBaseType::UINT}, + {ColorFormat::RGBA8I, "RGBA8I", 4,{'R','G','B','A'},{ 8, 8, 8, 8}, 32,VulkanBaseType::SINT}, + {ColorFormat::ABGR8, "ABGR8", 4,{'A','B','G','R'},{ 8, 8, 8, 8}, 32,VulkanBaseType::UNORM}, + {ColorFormat::A2BGR10, "A2BGR10", 4,{'A','B','G','R'},{ 2,10,10,10}, 32,VulkanBaseType::UNORM}, + {ColorFormat::R16, "R16", 1,{'R', 0 , 0 , 0 },{16, 0, 0, 0}, 16,VulkanBaseType::UNORM}, + {ColorFormat::R16U, "R16U", 1,{'R', 0 , 0 , 0 },{16, 0, 0, 0}, 16,VulkanBaseType::UINT}, + {ColorFormat::R16I, "R16I", 1,{'R', 0 , 0 , 0 },{16, 0, 0, 0}, 16,VulkanBaseType::SINT}, + {ColorFormat::R16F, "R16F", 1,{'R', 0 , 0 , 0 },{16, 0, 0, 0}, 16,VulkanBaseType::SFLOAT}, + {ColorFormat::RG16, "RG16", 2,{'R','G', 0 , 0 },{16,16, 0, 0}, 32,VulkanBaseType::UNORM}, + {ColorFormat::RG16U, "RG16U", 2,{'R','G', 0 , 0 },{16,16, 0, 0}, 32,VulkanBaseType::UINT}, + {ColorFormat::RG16I, "RG16I", 2,{'R','G', 0 , 0 },{16,16, 0, 0}, 32,VulkanBaseType::SINT}, + {ColorFormat::RG16F, "RG16F", 2,{'R','G', 0 , 0 },{16,16, 0, 0}, 32,VulkanBaseType::SFLOAT}, + {ColorFormat::RGBA16, "RGBA16", 4,{'R','G','B','A'},{16,16,16,16}, 64,VulkanBaseType::UNORM}, + {ColorFormat::RGBA16SN, "RGBA16S", 4,{'R','G','B','A'},{16,16,16,16}, 64,VulkanBaseType::SNORM}, + {ColorFormat::RGBA16U, "RGBA16U", 4,{'R','G','B','A'},{16,16,16,16}, 64,VulkanBaseType::UINT}, + {ColorFormat::RGBA16I, "RGBA16I", 4,{'R','G','B','A'},{16,16,16,16}, 64,VulkanBaseType::SINT}, + {ColorFormat::RGBA16F, "RGBA16F", 4,{'R','G','B','A'},{16,16,16,16}, 64,VulkanBaseType::SFLOAT}, + {ColorFormat::R32U, "R32U", 1,{'R', 0 , 0 , 0 },{32, 0, 0, 0}, 32,VulkanBaseType::UINT}, + {ColorFormat::R32I, "R32I", 1,{'R', 0 , 0 , 0 },{32, 0, 0, 0}, 32,VulkanBaseType::SINT}, + {ColorFormat::R32F, "R32F", 1,{'R', 0 , 0 , 0 },{32, 0, 0, 0}, 32,VulkanBaseType::SFLOAT}, + {ColorFormat::RG32U, "RG32U", 2,{'R','G', 0 , 0 },{32,32, 0, 0}, 64,VulkanBaseType::UINT}, + {ColorFormat::RG32I, "RG32I", 2,{'R','G', 0 , 0 },{32,32, 0, 0}, 64,VulkanBaseType::SINT}, + {ColorFormat::RG32F, "RG32F", 2,{'R','G', 0 , 0 },{32,32, 0, 0}, 64,VulkanBaseType::SFLOAT}, + {ColorFormat::RGB32U, "RGB32U", 3,{'R','G','B', 0 },{32,32,32, 0}, 96,VulkanBaseType::UINT}, + {ColorFormat::RGB32I, "RGB32I", 3,{'R','G','B', 0 },{32,32,32, 0}, 96,VulkanBaseType::SINT}, + {ColorFormat::RGB32F, "RGB32F", 3,{'R','G','B', 0 },{32,32,32, 0}, 96,VulkanBaseType::SFLOAT}, + {ColorFormat::RGBA32U, "RGBA32U", 4,{'R','G','B','A'},{32,32,32,32},128,VulkanBaseType::UINT}, + {ColorFormat::RGBA32I, "RGBA32I", 4,{'R','G','B','A'},{32,32,32,32},128,VulkanBaseType::SINT}, + {ColorFormat::RGBA32F, "RGBA32F", 4,{'R','G','B','A'},{32,32,32,32},128,VulkanBaseType::SFLOAT}, + {ColorFormat::B10GR11UF,"B10GR11UF",3,{'B','G','R', 0 },{10,11,11, 0}, 32,VulkanBaseType::UFLOAT}, - {ColorFormat::COMPRESS, "COMPRESS", 0,{ 0 , 0 , 0 , 0 },{ 0, 0, 0, 0}, 0,VulkanNumberType::NONE}, + {ColorFormat::COMPRESS, "COMPRESS", 0,{ 0 , 0 , 0 , 0 },{ 0, 0, 0, 0}, 0,VulkanBaseType::NONE}, - {ColorFormat::BC1RGB, "BC1RGB", 0,{ 0 , 0 , 0 , 0 },{ 0, 0, 0, 0}, 4,VulkanNumberType::NONE}, - {ColorFormat::BC1RGBA, "BC1RGBA", 0,{ 0 , 0 , 0 , 0 },{ 0, 0, 0, 0}, 4,VulkanNumberType::NONE}, - {ColorFormat::BC2, "BC2", 0,{ 0 , 0 , 0 , 0 },{ 0, 0, 0, 0}, 8,VulkanNumberType::NONE}, - {ColorFormat::BC3, "BC3", 0,{ 0 , 0 , 0 , 0 },{ 0, 0, 0, 0}, 8,VulkanNumberType::NONE}, - {ColorFormat::BC4, "BC4", 0,{ 0 , 0 , 0 , 0 },{ 0, 0, 0, 0}, 4,VulkanNumberType::NONE}, - {ColorFormat::BC5, "BC5", 0,{ 0 , 0 , 0 , 0 },{ 0, 0, 0, 0}, 8,VulkanNumberType::NONE}, - {ColorFormat::BC6H, "BC6H", 0,{ 0 , 0 , 0 , 0 },{ 0, 0, 0, 0}, 8,VulkanNumberType::NONE}, - {ColorFormat::BC6H_SF, "BC6H_SF", 0,{ 0 , 0 , 0 , 0 },{ 0, 0, 0, 0}, 8,VulkanNumberType::NONE}, - {ColorFormat::BC7, "BC7", 0,{ 0 , 0 , 0 , 0 },{ 0, 0, 0, 0}, 8,VulkanNumberType::NONE} + {ColorFormat::BC1RGB, "BC1RGB", 0,{ 0 , 0 , 0 , 0 },{ 0, 0, 0, 0}, 4,VulkanBaseType::NONE}, + {ColorFormat::BC1RGBA, "BC1RGBA", 0,{ 0 , 0 , 0 , 0 },{ 0, 0, 0, 0}, 4,VulkanBaseType::NONE}, + {ColorFormat::BC2, "BC2", 0,{ 0 , 0 , 0 , 0 },{ 0, 0, 0, 0}, 8,VulkanBaseType::NONE}, + {ColorFormat::BC3, "BC3", 0,{ 0 , 0 , 0 , 0 },{ 0, 0, 0, 0}, 8,VulkanBaseType::NONE}, + {ColorFormat::BC4, "BC4", 0,{ 0 , 0 , 0 , 0 },{ 0, 0, 0, 0}, 4,VulkanBaseType::NONE}, + {ColorFormat::BC5, "BC5", 0,{ 0 , 0 , 0 , 0 },{ 0, 0, 0, 0}, 8,VulkanBaseType::NONE}, + {ColorFormat::BC6H, "BC6H", 0,{ 0 , 0 , 0 , 0 },{ 0, 0, 0, 0}, 8,VulkanBaseType::NONE}, + {ColorFormat::BC6H_SF, "BC6H_SF", 0,{ 0 , 0 , 0 , 0 },{ 0, 0, 0, 0}, 8,VulkanBaseType::NONE}, + {ColorFormat::BC7, "BC7", 0,{ 0 , 0 , 0 , 0 },{ 0, 0, 0, 0}, 8,VulkanBaseType::NONE} }; constexpr uint PixelFormatCount=sizeof(pf_list)/sizeof(PixelFormat); diff --git a/pixel_format.h b/pixel_format.h index e11a6e0..dbae9fc 100644 --- a/pixel_format.h +++ b/pixel_format.h @@ -67,7 +67,7 @@ enum class ColorFormat struct ColorDataFormat { char color; //颜色成份 R/G/B/A/D等 - VulkanNumberType type; //UNORM/SNORM等 + VulkanBaseType type; //UNORM/SNORM等 uint8 bits; //位数 };// @@ -80,7 +80,7 @@ struct PixelFormat char color[4]; uint8 bits[4]; uint total_bits; //每象素总位数 - VulkanNumberType type; + VulkanBaseType type; };//struct PixelFormat const PixelFormat *GetPixelFormat(ColorFormat); ///<根据获取获取象素格式类型