fixed TextureFormat example.

This commit is contained in:
hyzboy 2023-05-12 00:31:20 +08:00
parent ff184ecd7a
commit 9a24aa237d
No known key found for this signature in database
GPG Key ID: 067EE4525D4FB6D3

View File

@ -1,4 +1,5 @@
#include<iostream> #include<iostream>
#include<iomanip>
#include<hgl/graph/VK.h> #include<hgl/graph/VK.h>
#include<hgl/graph/VKDevice.h> #include<hgl/graph/VKDevice.h>
#include<hgl/graph/VKInstance.h> #include<hgl/graph/VKInstance.h>
@ -86,35 +87,39 @@ int main(int,char **)
for(uint32_t i=0;i<count;i++) for(uint32_t i=0;i<count;i++)
{ {
std::cout<<i<<". "; std::cout<<std::setw(4)<<i<<". ";
std::cout<<" Format [ID:"<<vf->format<<"]["<<vf->name<<"] "; std::cout<<"Format [ID:"<<std::setw(10)<<vf->format<<"]["<<std::setw(16)<<vf->name<<"]";
if(vf->compress_type!=TextureCompressType::NONE) if(vf->depth!=VulkanBaseType::NONE)
std::cout<<"use "<<texture_compress_name[size_t(vf->compress_type)]<<" compress."; std::cout<<"[ Depth:"<<std::setw(8)<<data_type_name[size_t(vf->depth)]<<"]";
else
std::cout<<vf->bytes<<" bytes/pixel.";
if(vf->depth!=VulkanNumberType::NONE)
std::cout<<"[Depth:"<<data_type_name[size_t(vf->depth)]<<"]";
if(vf->stencil!=VulkanNumberType::NONE) if(vf->stencil!=VulkanBaseType::NONE)
std::cout<<"[Stencil:"<<data_type_name[size_t(vf->stencil)]<<"]"; std::cout<<"[Stencil:"<<std::setw(8)<<data_type_name[size_t(vf->stencil)]<<"]";
if((vf->depth==VulkanNumberType::NONE) if((vf->depth==VulkanBaseType::NONE)
&&(vf->stencil==VulkanNumberType::NONE)) &&(vf->stencil==VulkanBaseType::NONE))
std::cout<<"[Color:"<<data_type_name[size_t(vf->color)]<<"]"; std::cout<<"[ Color:"<<std::setw(8)<<data_type_name[size_t(vf->color)]<<"]";
{ {
const VkFormatProperties fp=physical_device->GetFormatProperties(vf->format); const VkFormatProperties fp=physical_device->GetFormatProperties(vf->format);
char olb[]="[ ]";
if(fp.optimalTilingFeatures&VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT) if(fp.optimalTilingFeatures&VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT)
std::cout<<"[Optimal]"; olb[1]='O';
if(fp.linearTilingFeatures&VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT) if(fp.linearTilingFeatures&VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT)
std::cout<<"[Linear]"; olb[2]='L';
if(fp.bufferFeatures&VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT) if(fp.bufferFeatures&VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT)
std::cout<<"[Buffer]"; olb[2]='B';
std::cout<<olb;
} }
if(vf->compress_type!=TextureCompressType::NONE)
std::cout<<" use "<<texture_compress_name[size_t(vf->compress_type)]<<" compress.";
else
std::cout<<std::setw(4)<<vf->bytes<<" bytes/pixel.";
std::cout<<std::endl; std::cout<<std::endl;