aux/vk: Take VkExtent2D and VkImageUsageFlags in vk_create_image_simple.

This commit is contained in:
Lubosz Sarnecki 2020-05-06 13:27:35 +02:00 committed by Jakob Bornecrantz
parent c09beb9efb
commit f131739c00
3 changed files with 12 additions and 12 deletions

View file

@ -217,31 +217,27 @@ vk_alloc_and_bind_image_memory(struct vk_bundle *vk,
VkResult
vk_create_image_simple(struct vk_bundle *vk,
uint32_t width,
uint32_t height,
VkExtent2D extent,
VkFormat format,
VkImageUsageFlags usage,
VkDeviceMemory *out_mem,
VkImage *out_image)
{
VkImageUsageFlags usage_flags = 0;
usage_flags |= VK_IMAGE_USAGE_SAMPLED_BIT;
usage_flags |= VK_IMAGE_USAGE_TRANSFER_DST_BIT;
VkImageCreateInfo image_info = {
.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO,
.imageType = VK_IMAGE_TYPE_2D,
.format = format,
.extent =
{
.width = width,
.height = height,
.width = extent.width,
.height = extent.height,
.depth = 1,
},
.mipLevels = 1,
.arrayLayers = 1,
.samples = VK_SAMPLE_COUNT_1_BIT,
.tiling = VK_IMAGE_TILING_LINEAR,
.usage = usage_flags,
.usage = usage,
.sharingMode = VK_SHARING_MODE_EXCLUSIVE,
.queueFamilyIndexCount = 0,
.pQueueFamilyIndices = NULL,

View file

@ -351,9 +351,9 @@ vk_create_image_from_fd(struct vk_bundle *vk,
*/
VkResult
vk_create_image_simple(struct vk_bundle *vk,
uint32_t width,
uint32_t height,
VkExtent2D extent,
VkFormat format,
VkImageUsageFlags usage,
VkDeviceMemory *out_mem,
VkImage *out_image);

View file

@ -560,10 +560,14 @@ renderer_init_dummy_images(struct comp_renderer *r)
.layerCount = 1};
VkClearColorValue color = {.float32 = {0.3, 0.3, 0.3, 1}};
VkExtent2D extent = {.width = 640, .height = 800};
VkImageUsageFlags usage =
VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT;
for (uint32_t i = 0; i < 2; i++) {
vk_create_image_simple(
&r->c->vk, 640, 800, VK_FORMAT_B8G8R8A8_SRGB,
&r->c->vk, extent, VK_FORMAT_B8G8R8A8_SRGB, usage,
&r->dummy_images[i].memory, &r->dummy_images[i].image);
_set_image_layout(