aboutsummaryrefslogtreecommitdiff
path: root/render/vulkan/pixel_format.c
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2022-11-28 10:18:30 +0100
committerSimon Ser <contact@emersion.fr>2022-12-02 16:10:41 +0100
commit338a9616bdb5b0067af09c907c61fc608b47dc76 (patch)
tree9c897663e67222eba93e871fbfecddf659c89329 /render/vulkan/pixel_format.c
parenta3874cac6c11b1951f92cdd937e709403ac0e858 (diff)
render/vulkan: simplify vulkan_format_props_query()
Diffstat (limited to 'render/vulkan/pixel_format.c')
-rw-r--r--render/vulkan/pixel_format.c42
1 files changed, 19 insertions, 23 deletions
diff --git a/render/vulkan/pixel_format.c b/render/vulkan/pixel_format.c
index b6daae4b..9442ce3e 100644
--- a/render/vulkan/pixel_format.c
+++ b/render/vulkan/pixel_format.c
@@ -340,25 +340,16 @@ void vulkan_format_props_query(struct wlr_vk_device *dev,
format_name ? format_name : "<unknown>", format->drm);
free(format_name);
- // get general features and modifiers
- VkFormatProperties2 fmtp = {0};
- fmtp.sType = VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2;
-
- VkDrmFormatModifierPropertiesListEXT modp = {0};
- modp.sType = VK_STRUCTURE_TYPE_DRM_FORMAT_MODIFIER_PROPERTIES_LIST_EXT;
- fmtp.pNext = &modp;
+ VkDrmFormatModifierPropertiesListEXT modp = {
+ .sType = VK_STRUCTURE_TYPE_DRM_FORMAT_MODIFIER_PROPERTIES_LIST_EXT,
+ };
+ VkFormatProperties2 fmtp = {
+ .sType = VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2,
+ .pNext = &modp,
+ };
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;
struct wlr_vk_format_props props = {0};
props.format = *format;
@@ -366,13 +357,18 @@ void vulkan_format_props_query(struct wlr_vk_device *dev,
// non-dmabuf texture properties
const char *shm_texture_status;
if ((fmtp.formatProperties.optimalTilingFeatures & tex_features) == tex_features) {
- fmti.pNext = NULL;
- ifmtp.pNext = NULL;
- fmti.tiling = VK_IMAGE_TILING_OPTIMAL;
- fmti.usage = tex_usage;
-
- res = vkGetPhysicalDeviceImageFormatProperties2(
- dev->phdev, &fmti, &ifmtp);
+ VkPhysicalDeviceImageFormatInfo2 fmti = {
+ .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_FORMAT_INFO_2,
+ .type = VK_IMAGE_TYPE_2D,
+ .format = format->vk,
+ .tiling = VK_IMAGE_TILING_OPTIMAL,
+ .usage = tex_usage,
+ };
+ VkImageFormatProperties2 ifmtp = {
+ .sType = VK_STRUCTURE_TYPE_IMAGE_FORMAT_PROPERTIES_2,
+ };
+
+ res = vkGetPhysicalDeviceImageFormatProperties2(dev->phdev, &fmti, &ifmtp);
if (res != VK_SUCCESS) {
if (res != VK_ERROR_FORMAT_NOT_SUPPORTED) {
wlr_vk_error("vkGetPhysicalDeviceImageFormatProperties2",