diff options
author | Simon Ser <contact@emersion.fr> | 2023-07-19 09:19:29 +0200 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2023-09-09 23:32:28 +0000 |
commit | 65bbbbbf0c3d6844cee3c4e294d0ba07e1f82211 (patch) | |
tree | b97e457c56df26b83a1cb652a337b6d4cf3920f9 /render/vulkan/pixel_format.c | |
parent | b18a849fc3659e6eaf9c414564b9f733bfe99194 (diff) |
render/vulkan: de-duplicate VkImageUsageFlags
The flags passed to vkCreateImage() must match the flags used when
querying formats. Make this clearer by using the same variable.
Diffstat (limited to 'render/vulkan/pixel_format.c')
-rw-r--r-- | render/vulkan/pixel_format.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/render/vulkan/pixel_format.c b/render/vulkan/pixel_format.c index 98eb4f7b..90fb5f54 100644 --- a/render/vulkan/pixel_format.c +++ b/render/vulkan/pixel_format.c @@ -230,13 +230,13 @@ const struct wlr_vk_format *vulkan_get_format_from_drm(uint32_t drm_format) { return NULL; } -static const VkImageUsageFlags render_usage = +const VkImageUsageFlags vulkan_render_usage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_TRANSFER_SRC_BIT; -static const VkImageUsageFlags shm_tex_usage = +const VkImageUsageFlags vulkan_shm_tex_usage = VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT; -static const VkImageUsageFlags dma_tex_usage = +const VkImageUsageFlags vulkan_dma_tex_usage = VK_IMAGE_USAGE_SAMPLED_BIT; static const VkFormatFeatureFlags render_features = @@ -357,7 +357,7 @@ static bool query_modifier_support(struct wlr_vk_device *dev, if ((m.drmFormatModifierTilingFeatures & render_features) == render_features && !props->format.is_ycbcr) { struct wlr_vk_format_modifier_props p = {0}; - if (query_modifier_usage_support(dev, props->format.vk, render_usage, &m, &p, &errmsg)) { + if (query_modifier_usage_support(dev, props->format.vk, vulkan_render_usage, &m, &p, &errmsg)) { props->dmabuf.render_mods[props->dmabuf.render_mod_count++] = p; wlr_drm_format_set_add(&dev->dmabuf_render_formats, props->format.drm, m.drmFormatModifier); @@ -380,7 +380,7 @@ static bool query_modifier_support(struct wlr_vk_device *dev, } if ((m.drmFormatModifierTilingFeatures & features) == features) { struct wlr_vk_format_modifier_props p = {0}; - if (query_modifier_usage_support(dev, props->format.vk, dma_tex_usage, &m, &p, &errmsg)) { + if (query_modifier_usage_support(dev, props->format.vk, vulkan_dma_tex_usage, &m, &p, &errmsg)) { props->dmabuf.texture_mods[props->dmabuf.texture_mod_count++] = p; wlr_drm_format_set_add(&dev->dmabuf_texture_formats, props->format.drm, m.drmFormatModifier); @@ -445,7 +445,7 @@ void vulkan_format_props_query(struct wlr_vk_device *dev, .type = VK_IMAGE_TYPE_2D, .format = format->vk, .tiling = VK_IMAGE_TILING_OPTIMAL, - .usage = shm_tex_usage, + .usage = vulkan_shm_tex_usage, }; VkImageFormatProperties2 ifmtp = { .sType = VK_STRUCTURE_TYPE_IMAGE_FORMAT_PROPERTIES_2, |