vulkan-1.0.0: Rework blits to use four offsets
authorJason Ekstrand <jason.ekstrand@intel.com>
Thu, 14 Jan 2016 15:59:37 +0000 (07:59 -0800)
committerJason Ekstrand <jason.ekstrand@intel.com>
Thu, 14 Jan 2016 15:59:37 +0000 (07:59 -0800)
include/vulkan/vulkan.h
src/vulkan/anv_dump.c
src/vulkan/anv_meta.c

index 0aefccf1d5c10f5402f854884ce1b7d5b7f48746..36459b14c58bde4be241084344dd9d1ed4ab492c 100644 (file)
@@ -2076,11 +2076,9 @@ typedef struct VkImageCopy {
 
 typedef struct VkImageBlit {
     VkImageSubresourceLayers                    srcSubresource;
-    VkOffset3D                                  srcOffset;
-    VkExtent3D                                  srcExtent;
+    VkOffset3D                                  srcOffsets[2];
     VkImageSubresourceLayers                    dstSubresource;
-    VkOffset3D                                  dstOffset;
-    VkExtent3D                                  dstExtent;
+    VkOffset3D                                  dstOffsets[2];
 } VkImageBlit;
 
 typedef struct VkBufferImageCopy {
index 7aef32b864858a2ab5cce79668e58a8d46324152..2a747d469247a0a0277107b26495a59b032c4a7c 100644 (file)
@@ -108,11 +108,9 @@ anv_dump_image_to_ppm(struct anv_device *device,
             .baseArrayLayer = array_layer,
             .layerCount = 1,
          },
-         .srcOffset = (VkOffset3D) { 0, 0, 0 },
-         .srcExtent = (VkExtent3D) {
-            extent.width,
-            extent.height,
-            1
+         .srcOffsets = {
+            { 0, 0, 0 },
+            { extent.width, extent.height, 1 },
          },
          .dstSubresource = {
             .aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
@@ -120,11 +118,9 @@ anv_dump_image_to_ppm(struct anv_device *device,
             .baseArrayLayer = 0,
             .layerCount = 1,
          },
-         .dstOffset = (VkOffset3D) { 0, 0, 0 },
-         .dstExtent = (VkExtent3D) {
-            extent.width,
-            extent.height,
-            1
+         .dstOffsets = {
+            { 0, 0, 0 },
+            { extent.width, extent.height, 1 },
          },
       }, VK_FILTER_NEAREST);
 
index aa5fd0488c058fe13e14851a3a7b119ce2cd6c19..3cbb3a65f226202d88823181d85f5ee94d4dc5b3 100644 (file)
@@ -1047,20 +1047,37 @@ void anv_CmdBlitImage(
          cmd_buffer);
 
       const VkOffset3D dest_offset = {
-         .x = pRegions[r].dstOffset.x,
-         .y = pRegions[r].dstOffset.y,
+         .x = pRegions[r].dstOffsets[0].x,
+         .y = pRegions[r].dstOffsets[0].y,
          .z = 0,
       };
 
+      if (pRegions[r].dstOffsets[1].x < pRegions[r].dstOffsets[0].x ||
+          pRegions[r].dstOffsets[1].y < pRegions[r].dstOffsets[0].y ||
+          pRegions[r].srcOffsets[1].x < pRegions[r].srcOffsets[0].x ||
+          pRegions[r].srcOffsets[1].y < pRegions[r].srcOffsets[0].y)
+         anv_finishme("FINISHME: Allow flipping in blits");
+
+      const VkExtent3D dest_extent = {
+         .width = pRegions[r].dstOffsets[1].x - pRegions[r].dstOffsets[0].x,
+         .height = pRegions[r].dstOffsets[1].y - pRegions[r].dstOffsets[0].y,
+      };
+
+      const VkExtent3D src_extent = {
+         .width = pRegions[r].srcOffsets[1].x - pRegions[r].srcOffsets[0].x,
+         .height = pRegions[r].srcOffsets[1].y - pRegions[r].srcOffsets[0].y,
+      };
+
       const uint32_t dest_array_slice =
          meta_blit_get_dest_view_base_array_slice(dest_image,
                                                   &pRegions[r].dstSubresource,
-                                                  &pRegions[r].dstOffset);
+                                                  &pRegions[r].dstOffsets[0]);
 
       if (pRegions[r].srcSubresource.layerCount > 1)
          anv_finishme("FINISHME: copy multiple array layers");
 
-      if (pRegions[r].dstExtent.depth > 1)
+      if (pRegions[r].srcOffsets[0].z != pRegions[r].srcOffsets[1].z ||
+          pRegions[r].dstOffsets[0].z != pRegions[r].dstOffsets[1].z)
          anv_finishme("FINISHME: copy multiple depth layers");
 
       struct anv_image_view dest_iview;
@@ -1082,11 +1099,9 @@ void anv_CmdBlitImage(
 
       meta_emit_blit(cmd_buffer,
                      src_image, &src_iview,
-                     pRegions[r].srcOffset,
-                     pRegions[r].srcExtent,
+                     pRegions[r].srcOffsets[0], src_extent,
                      dest_image, &dest_iview,
-                     dest_offset,
-                     pRegions[r].dstExtent,
+                     dest_offset, dest_extent,
                      filter);
    }