diff --git a/example/Vulkan/TextureFormat.cpp b/example/Vulkan/TextureFormat.cpp index 046cdeea..1e9d2882 100644 --- a/example/Vulkan/TextureFormat.cpp +++ b/example/Vulkan/TextureFormat.cpp @@ -1,5 +1,10 @@ -#include -#include +#include +#include +#include +#include + +using namespace hgl; +using namespace hgl::graph; VK_NAMESPACE_USING; @@ -32,6 +37,11 @@ constexpr char *data_type_name[] int main(int,char **) { + Window * win =nullptr; + vulkan::Instance * inst =nullptr; + vulkan::Device * device =nullptr; + const vulkan::PhysicalDevice *physical_device =nullptr; + #ifdef _DEBUG if(!CheckStrideBytesByFormat()) { @@ -40,6 +50,24 @@ int main(int,char **) } #endif//_DEBUG + InitNativeWindowSystem(); + + win=CreateRenderWindow(OS_TEXT("VulkanTest")); + if(!win) + return(false); + + if(!win->Create(128,128)) + return(false); + + inst=vulkan::CreateInstance(U8_TEXT("VulkanTest")); + + if(!inst) + return(false); + + device=win->CreateRenderDevice(inst); + + physical_device=device->GetPhysicalDevice(); + uint32_t count; const VulkanFormat *vf=GetVulkanFormatList(count); @@ -65,11 +93,26 @@ int main(int,char **) if((vf->depth==VulkanDataType::NONE) &&(vf->stencil==VulkanDataType::NONE)) std::cout<<"[Color:"<color)]<<"]"; + + { + const VkFormatProperties fp=physical_device->GetFormatProperties(vf->format); + + if(fp.optimalTilingFeatures&VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT) + std::cout<<"[Optimal]"; + if(fp.linearTilingFeatures&VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT) + std::cout<<"[Linear]"; + if(fp.bufferFeatures&VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT) + std::cout<<"[Buffer]"; + } std::cout<CloseRenderDevice(); + delete inst; + delete win; + return 0; } \ No newline at end of file diff --git a/inc/hgl/graph/vulkan/VKFormat.h b/inc/hgl/graph/vulkan/VKFormat.h index 583e009b..eda179c0 100644 --- a/inc/hgl/graph/vulkan/VKFormat.h +++ b/inc/hgl/graph/vulkan/VKFormat.h @@ -278,6 +278,7 @@ VK_NAMESPACE_BEGIN enum class TextureCompressType { NONE=0, + S3TC, PVRTC, ETC1, @@ -291,6 +292,7 @@ enum class TextureCompressType enum class VulkanDataType { NONE=0, + UNORM, SNORM, USCALED, diff --git a/inc/hgl/graph/vulkan/VKInstance.h b/inc/hgl/graph/vulkan/VKInstance.h index 38be4468..0a98a5bf 100644 --- a/inc/hgl/graph/vulkan/VKInstance.h +++ b/inc/hgl/graph/vulkan/VKInstance.h @@ -4,7 +4,7 @@ #include #include #include -#include +#include VK_NAMESPACE_BEGIN class Instance