增加物理设备初始化,输出该设备是否支持对应的纹理格式
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;
|
VK_NAMESPACE_USING;
|
||||||
|
|
||||||
@ -32,6 +37,11 @@ constexpr char *data_type_name[]
|
|||||||
|
|
||||||
int main(int,char **)
|
int main(int,char **)
|
||||||
{
|
{
|
||||||
|
Window * win =nullptr;
|
||||||
|
vulkan::Instance * inst =nullptr;
|
||||||
|
vulkan::Device * device =nullptr;
|
||||||
|
const vulkan::PhysicalDevice *physical_device =nullptr;
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
if(!CheckStrideBytesByFormat())
|
if(!CheckStrideBytesByFormat())
|
||||||
{
|
{
|
||||||
@ -40,6 +50,24 @@ int main(int,char **)
|
|||||||
}
|
}
|
||||||
#endif//_DEBUG
|
#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;
|
uint32_t count;
|
||||||
const VulkanFormat *vf=GetVulkanFormatList(count);
|
const VulkanFormat *vf=GetVulkanFormatList(count);
|
||||||
|
|
||||||
@ -65,11 +93,26 @@ int main(int,char **)
|
|||||||
if((vf->depth==VulkanDataType::NONE)
|
if((vf->depth==VulkanDataType::NONE)
|
||||||
&&(vf->stencil==VulkanDataType::NONE))
|
&&(vf->stencil==VulkanDataType::NONE))
|
||||||
std::cout<<"[Color:"<<data_type_name[size_t(vf->color)]<<"]";
|
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;
|
std::cout<<std::endl;
|
||||||
|
|
||||||
++vf;
|
++vf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
win->CloseRenderDevice();
|
||||||
|
delete inst;
|
||||||
|
delete win;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
@ -278,6 +278,7 @@ VK_NAMESPACE_BEGIN
|
|||||||
enum class TextureCompressType
|
enum class TextureCompressType
|
||||||
{
|
{
|
||||||
NONE=0,
|
NONE=0,
|
||||||
|
|
||||||
S3TC,
|
S3TC,
|
||||||
PVRTC,
|
PVRTC,
|
||||||
ETC1,
|
ETC1,
|
||||||
@ -291,6 +292,7 @@ enum class TextureCompressType
|
|||||||
enum class VulkanDataType
|
enum class VulkanDataType
|
||||||
{
|
{
|
||||||
NONE=0,
|
NONE=0,
|
||||||
|
|
||||||
UNORM,
|
UNORM,
|
||||||
SNORM,
|
SNORM,
|
||||||
USCALED,
|
USCALED,
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
#include<hgl/type/BaseString.h>
|
#include<hgl/type/BaseString.h>
|
||||||
#include<hgl/type/List.h>
|
#include<hgl/type/List.h>
|
||||||
#include<hgl/platform/Window.h>
|
#include<hgl/platform/Window.h>
|
||||||
#include<hgl/graph/vulkan/VK.h>
|
#include<hgl/graph/vulkan/VKPhysicalDevice.h>
|
||||||
|
|
||||||
VK_NAMESPACE_BEGIN
|
VK_NAMESPACE_BEGIN
|
||||||
class Instance
|
class Instance
|
||||||
|
Loading…
x
Reference in New Issue
Block a user