获取纹理格式支持改直接使用VK函数
This commit is contained in:
parent
3eaa4fa4d5
commit
6ec403d804
@ -35,7 +35,7 @@ constexpr VkFormat normal_candidate_format []={FMT_RGBA32F,
|
|||||||
FMT_RGBA16F,
|
FMT_RGBA16F,
|
||||||
FMT_A2RGB10UN,FMT_A2RGB10SN,FMT_A2BGR10UN,
|
FMT_A2RGB10UN,FMT_A2RGB10SN,FMT_A2BGR10UN,
|
||||||
FMT_A2BGR10SN};
|
FMT_A2BGR10SN};
|
||||||
constexpr VkFormat depth_candidate_format []={FMT_D32F,FMT_D32F_S8U,FMT_X8_D24,FMT_D24UN_S8U,FMT_D16UN,FMT_D16UN_S8U};
|
constexpr VkFormat depth_candidate_format []={FMT_D32F,FMT_D32F_S8U,FMT_X8_D24UN,FMT_D24UN_S8U,FMT_D16UN,FMT_D16UN_S8U};
|
||||||
|
|
||||||
class TestApp:public CameraAppFramework
|
class TestApp:public CameraAppFramework
|
||||||
{
|
{
|
||||||
|
@ -16,10 +16,6 @@ class PhysicalDevice
|
|||||||
List<VkLayerProperties> layer_properties;
|
List<VkLayerProperties> layer_properties;
|
||||||
List<VkExtensionProperties> extension_properties;
|
List<VkExtensionProperties> extension_properties;
|
||||||
|
|
||||||
VkFormatProperties format_properties[VK_FORMAT_RANGE_SIZE];
|
|
||||||
|
|
||||||
void InitFormatSupport();
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
PhysicalDevice(VkInstance,VkPhysicalDevice);
|
PhysicalDevice(VkInstance,VkPhysicalDevice);
|
||||||
@ -76,9 +72,9 @@ public:
|
|||||||
return fp;
|
return fp;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OptimalSupport (const VkFormat format,const VkFormatFeatureFlags flag)const{return((format<VK_FORMAT_BEGIN_RANGE||format>VK_FORMAT_END_RANGE)?false:(format_properties[format].optimalTilingFeatures&flag));}
|
bool OptimalSupport (const VkFormat format,const VkFormatFeatureFlags flag)const{VkFormatProperties fp;vkGetPhysicalDeviceFormatProperties(physical_device,format,&fp);return fp.optimalTilingFeatures&flag;}
|
||||||
bool LinearSupport (const VkFormat format,const VkFormatFeatureFlags flag)const{return((format<VK_FORMAT_BEGIN_RANGE||format>VK_FORMAT_END_RANGE)?false:(format_properties[format].linearTilingFeatures&flag));}
|
bool LinearSupport (const VkFormat format,const VkFormatFeatureFlags flag)const{VkFormatProperties fp;vkGetPhysicalDeviceFormatProperties(physical_device,format,&fp);return fp.linearTilingFeatures&flag;}
|
||||||
bool BufferSupport (const VkFormat format,const VkFormatFeatureFlags flag)const{return((format<VK_FORMAT_BEGIN_RANGE||format>VK_FORMAT_END_RANGE)?false:(format_properties[format].bufferFeatures&flag));}
|
bool BufferSupport (const VkFormat format,const VkFormatFeatureFlags flag)const{VkFormatProperties fp;vkGetPhysicalDeviceFormatProperties(physical_device,format,&fp);return fp.bufferFeatures&flag;}
|
||||||
|
|
||||||
bool IsColorAttachmentOptimal(const VkFormat format)const{return OptimalSupport(format,VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT);}
|
bool IsColorAttachmentOptimal(const VkFormat format)const{return OptimalSupport(format,VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT);}
|
||||||
bool IsDepthAttachmentOptimal(const VkFormat format)const{return OptimalSupport(format,VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT);}
|
bool IsDepthAttachmentOptimal(const VkFormat format)const{return OptimalSupport(format,VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT);}
|
||||||
|
@ -56,8 +56,6 @@ PhysicalDevice::PhysicalDevice(VkInstance inst,VkPhysicalDevice pd)
|
|||||||
|
|
||||||
hgl_zero(driver_properties);
|
hgl_zero(driver_properties);
|
||||||
}
|
}
|
||||||
|
|
||||||
InitFormatSupport();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const uint32_t PhysicalDevice::GetExtensionSpecVersion(const UTF8String &name)const
|
const uint32_t PhysicalDevice::GetExtensionSpecVersion(const UTF8String &name)const
|
||||||
@ -94,18 +92,6 @@ const bool PhysicalDevice::CheckMemoryType(uint32_t typeBits,VkMemoryPropertyFla
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PhysicalDevice::InitFormatSupport()
|
|
||||||
{
|
|
||||||
VkFormatProperties *fp=format_properties;
|
|
||||||
|
|
||||||
for(uint32 i=VK_FORMAT_BEGIN_RANGE;i<=VK_FORMAT_END_RANGE;i++)
|
|
||||||
{
|
|
||||||
vkGetPhysicalDeviceFormatProperties(physical_device,(VkFormat)i,fp);
|
|
||||||
|
|
||||||
++fp;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
VkFormat PhysicalDevice::GetDepthFormat(bool lower_to_high)const
|
VkFormat PhysicalDevice::GetDepthFormat(bool lower_to_high)const
|
||||||
{
|
{
|
||||||
constexpr VkFormat depthFormats[] =
|
constexpr VkFormat depthFormats[] =
|
||||||
|
Loading…
x
Reference in New Issue
Block a user