From 9a24aa237d71f6e3fa658dcca85acb897275763a Mon Sep 17 00:00:00 2001 From: hyzboy Date: Fri, 12 May 2023 00:31:20 +0800 Subject: [PATCH] fixed TextureFormat example. --- example/Vulkan/TextureFormat.cpp | 39 ++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/example/Vulkan/TextureFormat.cpp b/example/Vulkan/TextureFormat.cpp index 87ee3853..fffb06bd 100644 --- a/example/Vulkan/TextureFormat.cpp +++ b/example/Vulkan/TextureFormat.cpp @@ -1,4 +1,5 @@ #include +#include #include #include #include @@ -86,35 +87,39 @@ int main(int,char **) for(uint32_t i=0;iformat<<"]["<name<<"] "; + std::cout<<"Format [ID:"<format<<"]["<name<<"]"; - if(vf->compress_type!=TextureCompressType::NONE) - std::cout<<"use "<compress_type)]<<" compress."; - else - std::cout<bytes<<" bytes/pixel."; - - if(vf->depth!=VulkanNumberType::NONE) - std::cout<<"[Depth:"<depth)]<<"]"; + if(vf->depth!=VulkanBaseType::NONE) + std::cout<<"[ Depth:"<depth)]<<"]"; - if(vf->stencil!=VulkanNumberType::NONE) - std::cout<<"[Stencil:"<stencil)]<<"]"; + if(vf->stencil!=VulkanBaseType::NONE) + std::cout<<"[Stencil:"<stencil)]<<"]"; - if((vf->depth==VulkanNumberType::NONE) - &&(vf->stencil==VulkanNumberType::NONE)) - std::cout<<"[Color:"<color)]<<"]"; + if((vf->depth==VulkanBaseType::NONE) + &&(vf->stencil==VulkanBaseType::NONE)) + std::cout<<"[ Color:"<color)]<<"]"; { const VkFormatProperties fp=physical_device->GetFormatProperties(vf->format); + char olb[]="[ ]"; + if(fp.optimalTilingFeatures&VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT) - std::cout<<"[Optimal]"; + olb[1]='O'; if(fp.linearTilingFeatures&VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT) - std::cout<<"[Linear]"; + olb[2]='L'; if(fp.bufferFeatures&VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT) - std::cout<<"[Buffer]"; + olb[2]='B'; + + std::cout<compress_type!=TextureCompressType::NONE) + std::cout<<" use "<compress_type)]<<" compress."; + else + std::cout<bytes<<" bytes/pixel."; std::cout<