vk/0.170.2: Rework blits to use ImageSubresourceCopy
authorJason Ekstrand <jason.ekstrand@intel.com>
Tue, 6 Oct 2015 17:04:04 +0000 (10:04 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Tue, 6 Oct 2015 17:04:04 +0000 (10:04 -0700)
include/vulkan/vulkan.h
src/vulkan/anv_meta.c

index c7b7f47c3c35ae569747e600182145245064eae0..cec176f3bf9be536b8cc7d427de405f1943fbcb5 100644 (file)
@@ -1949,18 +1949,25 @@ typedef struct {
 } VkBufferCopy;
 
 typedef struct {
-    VkImageSubresource                          srcSubresource;
+    VkImageAspect                               aspect;
+    uint32_t                                    mipLevel;
+    uint32_t                                    arrayLayer;
+    uint32_t                                    arraySize;
+} VkImageSubresourceCopy;
+
+typedef struct {
+    VkImageSubresourceCopy                      srcSubresource;
     VkOffset3D                                  srcOffset;
-    VkImageSubresource                          destSubresource;
+    VkImageSubresourceCopy                      destSubresource;
     VkOffset3D                                  destOffset;
     VkExtent3D                                  extent;
 } VkImageCopy;
 
 typedef struct {
-    VkImageSubresource                          srcSubresource;
+    VkImageSubresourceCopy                      srcSubresource;
     VkOffset3D                                  srcOffset;
     VkExtent3D                                  srcExtent;
-    VkImageSubresource                          destSubresource;
+    VkImageSubresourceCopy                      destSubresource;
     VkOffset3D                                  destOffset;
     VkExtent3D                                  destExtent;
 } VkImageBlit;
@@ -1969,7 +1976,7 @@ typedef struct {
     VkDeviceSize                                bufferOffset;
     uint32_t                                    bufferRowLength;
     uint32_t                                    bufferImageHeight;
-    VkImageSubresource                          imageSubresource;
+    VkImageSubresourceCopy                      imageSubresource;
     VkOffset3D                                  imageOffset;
     VkExtent3D                                  imageExtent;
 } VkBufferImageCopy;
index 4e6ddf49f7654edb875af545cc99d3b4c1aee5cc..ad65403b100346a079fba5e228ccce7af7a87823 100644 (file)
@@ -502,13 +502,13 @@ meta_blit_get_src_image_view_type(const struct anv_image *src_image)
 
 static uint32_t
 meta_blit_get_dest_view_base_array_slice(const struct anv_image *dest_image,
-                                         const VkImageSubresource *dest_subresource,
+                                         const VkImageSubresourceCopy *dest_subresource,
                                          const VkOffset3D *dest_offset)
 {
    switch (dest_image->type) {
    case VK_IMAGE_TYPE_1D:
    case VK_IMAGE_TYPE_2D:
-      return dest_subresource->arraySlice;
+      return dest_subresource->arrayLayer;
    case VK_IMAGE_TYPE_3D:
       /* HACK: Vulkan does not allow attaching a 3D image to a framebuffer,
        * but meta does it anyway. When doing so, we translate the
@@ -1163,7 +1163,7 @@ void anv_CmdCopyImage(
                .aspectMask = 1 << pRegions[r].srcSubresource.aspect,
                .baseMipLevel = pRegions[r].srcSubresource.mipLevel,
                .mipLevels = 1,
-               .baseArraySlice = pRegions[r].srcSubresource.arraySlice,
+               .baseArraySlice = pRegions[r].srcSubresource.arrayLayer,
                .arraySize = 1
             },
          },
@@ -1180,6 +1180,9 @@ void anv_CmdCopyImage(
                                                   &pRegions[r].destSubresource,
                                                   &pRegions[r].destOffset);
 
+      if (pRegions[r].srcSubresource.arraySize > 1)
+         anv_finishme("FINISHME: copy multiple array layers");
+
       if (pRegions[r].extent.depth > 1)
          anv_finishme("FINISHME: copy multiple depth layers");
 
@@ -1249,7 +1252,7 @@ void anv_CmdBlitImage(
                .aspectMask = 1 << pRegions[r].srcSubresource.aspect,
                .baseMipLevel = pRegions[r].srcSubresource.mipLevel,
                .mipLevels = 1,
-               .baseArraySlice = pRegions[r].srcSubresource.arraySlice,
+               .baseArraySlice = pRegions[r].srcSubresource.arrayLayer,
                .arraySize = 1
             },
          },
@@ -1266,6 +1269,9 @@ void anv_CmdBlitImage(
                                                   &pRegions[r].destSubresource,
                                                   &pRegions[r].destOffset);
 
+      if (pRegions[r].srcSubresource.arraySize > 1)
+         anv_finishme("FINISHME: copy multiple array layers");
+
       if (pRegions[r].destExtent.depth > 1)
          anv_finishme("FINISHME: copy multiple depth layers");
 
@@ -1446,6 +1452,9 @@ void anv_CmdCopyImageToBuffer(
    meta_prepare_blit(cmd_buffer, &saved_state);
 
    for (unsigned r = 0; r < regionCount; r++) {
+      if (pRegions[r].imageSubresource.arraySize > 1)
+         anv_finishme("FINISHME: copy multiple array layers");
+
       if (pRegions[r].imageExtent.depth > 1)
          anv_finishme("FINISHME: copy multiple depth layers");
 
@@ -1466,7 +1475,7 @@ void anv_CmdCopyImageToBuffer(
                .aspectMask = 1 << pRegions[r].imageSubresource.aspect,
                .baseMipLevel = pRegions[r].imageSubresource.mipLevel,
                .mipLevels = 1,
-               .baseArraySlice = pRegions[r].imageSubresource.arraySlice,
+               .baseArraySlice = pRegions[r].imageSubresource.arrayLayer,
                .arraySize = 1
             },
          },