summaryrefslogtreecommitdiffstats
path: root/src/amd/vulkan/radv_meta_copy.c
diff options
context:
space:
mode:
authorDave Airlie <[email protected]>2016-11-29 23:52:55 +0000
committerBas Nieuwenhuizen <[email protected]>2016-12-18 20:52:20 +0100
commit983af3a6d11d8d1dcd3c23514f92abceb664642f (patch)
treef05bbfee19e580f79bef87cabe30dc0dcf2c3dc8 /src/amd/vulkan/radv_meta_copy.c
parent35cf08ef64250c612bca4253df8ecdabd1735095 (diff)
radv: add a compute shader implementation for buffer to image
This implements the reverse of the current buffer->image path and can be used when we need to do image transfer on compute queues This just adds the code turned off as we don't support separate computes queues yet, and we don't want to use this path on the GFX queues for DCC reasons. Reviewed-by: Bas Nieuwenhuizen <[email protected]>
Diffstat (limited to 'src/amd/vulkan/radv_meta_copy.c')
-rw-r--r--src/amd/vulkan/radv_meta_copy.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/src/amd/vulkan/radv_meta_copy.c b/src/amd/vulkan/radv_meta_copy.c
index d81fc482429..2073a2c77f4 100644
--- a/src/amd/vulkan/radv_meta_copy.c
+++ b/src/amd/vulkan/radv_meta_copy.c
@@ -100,6 +100,11 @@ blit_surf_for_image_level_layer(struct radv_image *image,
};
}
+union meta_saved_state {
+ struct radv_meta_saved_state gfx;
+ struct radv_meta_saved_compute_state compute;
+};
+
static void
meta_copy_buffer_to_image(struct radv_cmd_buffer *cmd_buffer,
struct radv_buffer* buffer,
@@ -107,14 +112,18 @@ meta_copy_buffer_to_image(struct radv_cmd_buffer *cmd_buffer,
uint32_t regionCount,
const VkBufferImageCopy* pRegions)
{
- struct radv_meta_saved_state saved_state;
+ bool cs = cmd_buffer->queue_family_index == RADV_QUEUE_COMPUTE;
+ union meta_saved_state saved_state;
/* The Vulkan 1.0 spec says "dstImage must have a sample count equal to
* VK_SAMPLE_COUNT_1_BIT."
*/
assert(image->samples == 1);
- radv_meta_save_graphics_reset_vport_scissor(&saved_state, cmd_buffer);
+ if (cs)
+ radv_meta_begin_bufimage(cmd_buffer, &saved_state.compute);
+ else
+ radv_meta_save_graphics_reset_vport_scissor(&saved_state.gfx, cmd_buffer);
for (unsigned r = 0; r < regionCount; r++) {
@@ -172,7 +181,10 @@ meta_copy_buffer_to_image(struct radv_cmd_buffer *cmd_buffer,
/* Perform Blit */
- radv_meta_blit2d(cmd_buffer, NULL, &buf_bsurf, &img_bsurf, 1, &rect);
+ if (cs)
+ radv_meta_buffer_to_image_cs(cmd_buffer, &buf_bsurf, &img_bsurf, 1, &rect);
+ else
+ radv_meta_blit2d(cmd_buffer, NULL, &buf_bsurf, &img_bsurf, 1, &rect);
/* Once we've done the blit, all of the actual information about
* the image is embedded in the command buffer so we can just
@@ -188,7 +200,10 @@ meta_copy_buffer_to_image(struct radv_cmd_buffer *cmd_buffer,
slice_array++;
}
}
- radv_meta_restore(&saved_state, cmd_buffer);
+ if (cs)
+ radv_meta_end_bufimage(cmd_buffer, &saved_state.compute);
+ else
+ radv_meta_restore(&saved_state.gfx, cmd_buffer);
}
void radv_CmdCopyBufferToImage(