summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChad Versace <[email protected]>2016-01-20 17:03:29 -0800
committerChad Versace <[email protected]>2016-01-22 17:19:57 -0800
commitfa5f45e8aa95189244edb12a3dc0af165418086a (patch)
treec6eca9ca41ffe86742ffc00a44a5784852dc85cb
parentdfcb4ee6df5d069ab409ae532a6ad5c5eeda91db (diff)
anv/meta: Assert correct sample counts for blit funcs
Add assertions to: anv_CmdBlitImage anv_CmdCopyImage anv_CmdCopyImageToBuffer anv_CmdCopyBufferToImage
-rw-r--r--src/vulkan/anv_meta.c30
1 files changed, 28 insertions, 2 deletions
diff --git a/src/vulkan/anv_meta.c b/src/vulkan/anv_meta.c
index 083ee371f60..483469348c8 100644
--- a/src/vulkan/anv_meta.c
+++ b/src/vulkan/anv_meta.c
@@ -503,6 +503,8 @@ meta_emit_blit(struct anv_cmd_buffer *cmd_buffer,
float tex_coord[3];
} *vb_data;
+ assert(src_image->samples == dest_image->samples);
+
unsigned vb_size = sizeof(struct anv_vue_header) + 3 * sizeof(*vb_data);
struct anv_state vb_state =
@@ -987,9 +989,15 @@ void anv_CmdCopyImage(
ANV_FROM_HANDLE(anv_cmd_buffer, cmd_buffer, commandBuffer);
ANV_FROM_HANDLE(anv_image, src_image, srcImage);
ANV_FROM_HANDLE(anv_image, dest_image, destImage);
-
struct anv_meta_saved_state saved_state;
+ /* From the Vulkan 1.0 spec:
+ *
+ * vkCmdCopyImage can be used to copy image data between multisample
+ * images, but both images must have the same number of samples.
+ */
+ assert(src_image->samples == dest_image->samples);
+
meta_prepare_blit(cmd_buffer, &saved_state);
for (unsigned r = 0; r < regionCount; r++) {
@@ -1090,9 +1098,16 @@ void anv_CmdBlitImage(
ANV_FROM_HANDLE(anv_cmd_buffer, cmd_buffer, commandBuffer);
ANV_FROM_HANDLE(anv_image, src_image, srcImage);
ANV_FROM_HANDLE(anv_image, dest_image, destImage);
-
struct anv_meta_saved_state saved_state;
+ /* From the Vulkan 1.0 spec:
+ *
+ * vkCmdBlitImage must not be used for multisampled source or
+ * destination images. Use vkCmdResolveImage for this purpose.
+ */
+ assert(src_image->samples == 1);
+ assert(dest_image->samples == 1);
+
anv_finishme("respect VkFilter");
meta_prepare_blit(cmd_buffer, &saved_state);
@@ -1233,6 +1248,11 @@ void anv_CmdCopyBufferToImage(
VkDevice vk_device = anv_device_to_handle(cmd_buffer->device);
struct anv_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(dest_image->samples == 1);
+
meta_prepare_blit(cmd_buffer, &saved_state);
for (unsigned r = 0; r < regionCount; r++) {
@@ -1345,6 +1365,12 @@ void anv_CmdCopyImageToBuffer(
VkDevice vk_device = anv_device_to_handle(cmd_buffer->device);
struct anv_meta_saved_state saved_state;
+
+ /* The Vulkan 1.0 spec says "srcImage must have a sample count equal to
+ * VK_SAMPLE_COUNT_1_BIT."
+ */
+ assert(src_image->samples == 1);
+
meta_prepare_blit(cmd_buffer, &saved_state);
for (unsigned r = 0; r < regionCount; r++) {