mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-26 06:35:58 +01:00
render/vulkan: simplify vulkan_format_props_query()
This commit is contained in:
parent
a3874cac6c
commit
338a9616bd
1 changed files with 18 additions and 22 deletions
|
@ -340,25 +340,16 @@ void vulkan_format_props_query(struct wlr_vk_device *dev,
|
||||||
format_name ? format_name : "<unknown>", format->drm);
|
format_name ? format_name : "<unknown>", format->drm);
|
||||||
free(format_name);
|
free(format_name);
|
||||||
|
|
||||||
// get general features and modifiers
|
VkDrmFormatModifierPropertiesListEXT modp = {
|
||||||
VkFormatProperties2 fmtp = {0};
|
.sType = VK_STRUCTURE_TYPE_DRM_FORMAT_MODIFIER_PROPERTIES_LIST_EXT,
|
||||||
fmtp.sType = VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2;
|
};
|
||||||
|
VkFormatProperties2 fmtp = {
|
||||||
VkDrmFormatModifierPropertiesListEXT modp = {0};
|
.sType = VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2,
|
||||||
modp.sType = VK_STRUCTURE_TYPE_DRM_FORMAT_MODIFIER_PROPERTIES_LIST_EXT;
|
.pNext = &modp,
|
||||||
fmtp.pNext = &modp;
|
};
|
||||||
|
|
||||||
vkGetPhysicalDeviceFormatProperties2(dev->phdev, format->vk, &fmtp);
|
vkGetPhysicalDeviceFormatProperties2(dev->phdev, format->vk, &fmtp);
|
||||||
|
|
||||||
// detailed check
|
|
||||||
VkPhysicalDeviceImageFormatInfo2 fmti = {0};
|
|
||||||
fmti.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_FORMAT_INFO_2;
|
|
||||||
fmti.type = VK_IMAGE_TYPE_2D;
|
|
||||||
fmti.format = format->vk;
|
|
||||||
|
|
||||||
VkImageFormatProperties2 ifmtp = {0};
|
|
||||||
ifmtp.sType = VK_STRUCTURE_TYPE_IMAGE_FORMAT_PROPERTIES_2;
|
|
||||||
|
|
||||||
bool add_fmt_props = false;
|
bool add_fmt_props = false;
|
||||||
struct wlr_vk_format_props props = {0};
|
struct wlr_vk_format_props props = {0};
|
||||||
props.format = *format;
|
props.format = *format;
|
||||||
|
@ -366,13 +357,18 @@ void vulkan_format_props_query(struct wlr_vk_device *dev,
|
||||||
// non-dmabuf texture properties
|
// non-dmabuf texture properties
|
||||||
const char *shm_texture_status;
|
const char *shm_texture_status;
|
||||||
if ((fmtp.formatProperties.optimalTilingFeatures & tex_features) == tex_features) {
|
if ((fmtp.formatProperties.optimalTilingFeatures & tex_features) == tex_features) {
|
||||||
fmti.pNext = NULL;
|
VkPhysicalDeviceImageFormatInfo2 fmti = {
|
||||||
ifmtp.pNext = NULL;
|
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_FORMAT_INFO_2,
|
||||||
fmti.tiling = VK_IMAGE_TILING_OPTIMAL;
|
.type = VK_IMAGE_TYPE_2D,
|
||||||
fmti.usage = tex_usage;
|
.format = format->vk,
|
||||||
|
.tiling = VK_IMAGE_TILING_OPTIMAL,
|
||||||
|
.usage = tex_usage,
|
||||||
|
};
|
||||||
|
VkImageFormatProperties2 ifmtp = {
|
||||||
|
.sType = VK_STRUCTURE_TYPE_IMAGE_FORMAT_PROPERTIES_2,
|
||||||
|
};
|
||||||
|
|
||||||
res = vkGetPhysicalDeviceImageFormatProperties2(
|
res = vkGetPhysicalDeviceImageFormatProperties2(dev->phdev, &fmti, &ifmtp);
|
||||||
dev->phdev, &fmti, &ifmtp);
|
|
||||||
if (res != VK_SUCCESS) {
|
if (res != VK_SUCCESS) {
|
||||||
if (res != VK_ERROR_FORMAT_NOT_SUPPORTED) {
|
if (res != VK_ERROR_FORMAT_NOT_SUPPORTED) {
|
||||||
wlr_vk_error("vkGetPhysicalDeviceImageFormatProperties2",
|
wlr_vk_error("vkGetPhysicalDeviceImageFormatProperties2",
|
||||||
|
|
Loading…
Reference in a new issue