From 36137d22e54354eb70c3f74ba0dac8e107a9432b Mon Sep 17 00:00:00 2001 From: aliaspider Date: Mon, 15 May 2017 05:35:17 +0100 Subject: [PATCH] Vulkan: use the command buffer provided as parameter in vulkan_copy_staging_to_dynamic. --- gfx/common/vulkan_common.c | 18 +++++++++--------- gfx/common/vulkan_common.h | 2 +- gfx/drivers/vulkan.c | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/gfx/common/vulkan_common.c b/gfx/common/vulkan_common.c index 1f3aebbaa7..eaf1efefa6 100644 --- a/gfx/common/vulkan_common.c +++ b/gfx/common/vulkan_common.c @@ -159,7 +159,7 @@ void vulkan_copy_staging_to_dynamic(vk_t *vk, VkCommandBuffer cmd, retro_assert(staging->type == VULKAN_TEXTURE_STAGING); vulkan_sync_texture_to_gpu(vk, staging); - vulkan_transition_texture(vk, staging); + vulkan_transition_texture(vk, cmd, staging); /* We don't have to sync against previous TRANSFER, * since we observed the completion by fences. @@ -170,7 +170,7 @@ void vulkan_copy_staging_to_dynamic(vk_t *vk, VkCommandBuffer cmd, * We would also need to optionally maintain extra textures due to * changes in resolution, so this seems like the sanest and * simplest solution. */ - vulkan_image_layout_transition(vk, vk->cmd, dynamic->image, + vulkan_image_layout_transition(vk, cmd, dynamic->image, VK_IMAGE_LAYOUT_UNDEFINED, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, 0, VK_ACCESS_TRANSFER_WRITE_BIT, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, @@ -184,12 +184,12 @@ void vulkan_copy_staging_to_dynamic(vk_t *vk, VkCommandBuffer cmd, region.srcSubresource.layerCount = 1; region.dstSubresource = region.srcSubresource; - vkCmdCopyImage(vk->cmd, + vkCmdCopyImage(cmd, staging->image, VK_IMAGE_LAYOUT_GENERAL, dynamic->image, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, 1, ®ion); - vulkan_image_layout_transition(vk, vk->cmd, + vulkan_image_layout_transition(vk, cmd, dynamic->image, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL, @@ -729,7 +729,7 @@ static void vulkan_write_quad_descriptors( } } -void vulkan_transition_texture(vk_t *vk, struct vk_texture *texture) +void vulkan_transition_texture(vk_t *vk, VkCommandBuffer cmd, struct vk_texture *texture) { /* Transition to GENERAL layout for linear streamed textures. * We're using linear textures here, so only @@ -744,7 +744,7 @@ void vulkan_transition_texture(vk_t *vk, struct vk_texture *texture) switch (texture->type) { case VULKAN_TEXTURE_STREAMED: - vulkan_image_layout_transition(vk, vk->cmd, texture->image, + vulkan_image_layout_transition(vk, cmd, texture->image, texture->layout, VK_IMAGE_LAYOUT_GENERAL, VK_ACCESS_HOST_WRITE_BIT, VK_ACCESS_SHADER_READ_BIT, VK_PIPELINE_STAGE_HOST_BIT, @@ -752,7 +752,7 @@ void vulkan_transition_texture(vk_t *vk, struct vk_texture *texture) break; case VULKAN_TEXTURE_STAGING: - vulkan_image_layout_transition(vk, vk->cmd, texture->image, + vulkan_image_layout_transition(vk, cmd, texture->image, texture->layout, VK_IMAGE_LAYOUT_GENERAL, VK_ACCESS_HOST_WRITE_BIT, VK_ACCESS_TRANSFER_READ_BIT, VK_PIPELINE_STAGE_HOST_BIT, @@ -786,7 +786,7 @@ static void vulkan_check_dynamic_state( void vulkan_draw_triangles(vk_t *vk, const struct vk_draw_triangles *call) { if (call->texture) - vulkan_transition_texture(vk, call->texture); + vulkan_transition_texture(vk, vk->cmd, call->texture); if (call->pipeline != vk->tracker.pipeline) { @@ -844,7 +844,7 @@ void vulkan_draw_triangles(vk_t *vk, const struct vk_draw_triangles *call) void vulkan_draw_quad(vk_t *vk, const struct vk_draw_quad *quad) { - vulkan_transition_texture(vk, quad->texture); + vulkan_transition_texture(vk, vk->cmd, quad->texture); if (quad->pipeline != vk->tracker.pipeline) { diff --git a/gfx/common/vulkan_common.h b/gfx/common/vulkan_common.h index 69298845c5..519570de34 100644 --- a/gfx/common/vulkan_common.h +++ b/gfx/common/vulkan_common.h @@ -413,7 +413,7 @@ struct vk_texture vulkan_create_texture(vk_t *vk, void vulkan_sync_texture_to_gpu(vk_t *vk, const struct vk_texture *tex); void vulkan_sync_texture_to_cpu(vk_t *vk, const struct vk_texture *tex); -void vulkan_transition_texture(vk_t *vk, struct vk_texture *texture); +void vulkan_transition_texture(vk_t *vk, VkCommandBuffer cmd, struct vk_texture *texture); void vulkan_transfer_image_ownership(VkCommandBuffer cmd, VkImage image, VkImageLayout layout, diff --git a/gfx/drivers/vulkan.c b/gfx/drivers/vulkan.c index 8d8e142d61..29b806cbbc 100644 --- a/gfx/drivers/vulkan.c +++ b/gfx/drivers/vulkan.c @@ -1714,7 +1714,7 @@ static bool vulkan_frame(void *data, const void *frame, if (vk->swapchain[vk->last_valid_index].texture_optimal.memory != VK_NULL_HANDLE) tex = &vk->swapchain[vk->last_valid_index].texture_optimal; else - vulkan_transition_texture(vk, tex); + vulkan_transition_texture(vk, vk->cmd, tex); input.image = tex->image; input.view = tex->view;