增加物理设备初始化,输出该设备是否支持对应的纹理格式
This commit is contained in:
parent
66d0041ccc
commit
3eaa4fa4d5
@ -1,5 +1,10 @@
|
||||
#include<hgl/graph/vulkan/VK.h>
|
||||
#include<iostream>
|
||||
#include<iostream>
|
||||
#include<hgl/graph/vulkan/VK.h>
|
||||
#include<hgl/graph/vulkan/VKDevice.h>
|
||||
#include<hgl/graph/vulkan/VKInstance.h>
|
||||
|
||||
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);
|
||||
|
||||
@ -66,10 +94,25 @@ int main(int,char **)
|
||||
&&(vf->stencil==VulkanDataType::NONE))
|
||||
std::cout<<"[Color:"<<data_type_name[size_t(vf->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<<std::endl;
|
||||
|
||||
++vf;
|
||||
}
|
||||
|
||||
win->CloseRenderDevice();
|
||||
delete inst;
|
||||
delete win;
|
||||
|
||||
return 0;
|
||||
}
|
@ -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,
|
||||
|
@ -4,7 +4,7 @@
|
||||
#include<hgl/type/BaseString.h>
|
||||
#include<hgl/type/List.h>
|
||||
#include<hgl/platform/Window.h>
|
||||
#include<hgl/graph/vulkan/VK.h>
|
||||
#include<hgl/graph/vulkan/VKPhysicalDevice.h>
|
||||
|
||||
VK_NAMESPACE_BEGIN
|
||||
class Instance
|
||||
|
Loading…
x
Reference in New Issue
Block a user