[Mesa-dev] [PATCH 3/5] vulkan/wsi: Move the ImageCreateInfo higher up
Jason Ekstrand
jason at jlekstrand.net
Mon Oct 1 21:24:27 UTC 2018
Future changes will be easier if we can modify it based on whether or
not we're using modifiers.
---
src/vulkan/wsi/wsi_common.c | 43 +++++++++++++++++++------------------
1 file changed, 22 insertions(+), 21 deletions(-)
diff --git a/src/vulkan/wsi/wsi_common.c b/src/vulkan/wsi/wsi_common.c
index 3416fef3076..00d6b5dcaa7 100644
--- a/src/vulkan/wsi/wsi_common.c
+++ b/src/vulkan/wsi/wsi_common.c
@@ -228,6 +228,28 @@ wsi_create_native_image(const struct wsi_swapchain *chain,
.pNext = NULL,
};
+ const VkImageCreateInfo image_info = {
+ .sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO,
+ .pNext = &image_wsi_info,
+ .flags = 0,
+ .imageType = VK_IMAGE_TYPE_2D,
+ .format = pCreateInfo->imageFormat,
+ .extent = {
+ .width = pCreateInfo->imageExtent.width,
+ .height = pCreateInfo->imageExtent.height,
+ .depth = 1,
+ },
+ .mipLevels = 1,
+ .arrayLayers = 1,
+ .samples = VK_SAMPLE_COUNT_1_BIT,
+ .tiling = VK_IMAGE_TILING_OPTIMAL,
+ .usage = pCreateInfo->imageUsage,
+ .sharingMode = pCreateInfo->imageSharingMode,
+ .queueFamilyIndexCount = pCreateInfo->queueFamilyIndexCount,
+ .pQueueFamilyIndices = pCreateInfo->pQueueFamilyIndices,
+ .initialLayout = VK_IMAGE_LAYOUT_UNDEFINED,
+ };
+
uint32_t image_modifier_count = 0, modifier_prop_count = 0;
struct wsi_format_modifier_properties *modifier_props = NULL;
uint64_t *image_modifiers = NULL;
@@ -308,27 +330,6 @@ wsi_create_native_image(const struct wsi_swapchain *chain,
}
}
- const VkImageCreateInfo image_info = {
- .sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO,
- .pNext = &image_wsi_info,
- .flags = 0,
- .imageType = VK_IMAGE_TYPE_2D,
- .format = pCreateInfo->imageFormat,
- .extent = {
- .width = pCreateInfo->imageExtent.width,
- .height = pCreateInfo->imageExtent.height,
- .depth = 1,
- },
- .mipLevels = 1,
- .arrayLayers = 1,
- .samples = VK_SAMPLE_COUNT_1_BIT,
- .tiling = VK_IMAGE_TILING_OPTIMAL,
- .usage = pCreateInfo->imageUsage,
- .sharingMode = pCreateInfo->imageSharingMode,
- .queueFamilyIndexCount = pCreateInfo->queueFamilyIndexCount,
- .pQueueFamilyIndices = pCreateInfo->pQueueFamilyIndices,
- .initialLayout = VK_IMAGE_LAYOUT_UNDEFINED,
- };
result = wsi->CreateImage(chain->device, &image_info,
&chain->alloc, &image->image);
if (result != VK_SUCCESS)
--
2.17.1
More information about the mesa-dev
mailing list