summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2016-01-14 07:59:37 -0800
committerJason Ekstrand <[email protected]>2016-01-14 07:59:37 -0800
commitb57c72d9646c3f7ef595379328e5b7d64d8e94dc (patch)
tree867e18fbccaa941e27af72a0ee07e01769b7c33f
parentf6cae9929441da7c851372a2433b91be8d9ff317 (diff)
vulkan-1.0.0: Rework blits to use four offsets
-rw-r--r--include/vulkan/vulkan.h6
-rw-r--r--src/vulkan/anv_dump.c16
-rw-r--r--src/vulkan/anv_meta.c31
3 files changed, 31 insertions, 22 deletions
diff --git a/include/vulkan/vulkan.h b/include/vulkan/vulkan.h
index 0aefccf1d5c..36459b14c58 100644
--- a/include/vulkan/vulkan.h
+++ b/include/vulkan/vulkan.h
@@ -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 {
diff --git a/src/vulkan/anv_dump.c b/src/vulkan/anv_dump.c
index 7aef32b8648..2a747d46924 100644
--- a/src/vulkan/anv_dump.c
+++ b/src/vulkan/anv_dump.c
@@ -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);
diff --git a/src/vulkan/anv_meta.c b/src/vulkan/anv_meta.c
index aa5fd0488c0..3cbb3a65f22 100644
--- a/src/vulkan/anv_meta.c
+++ b/src/vulkan/anv_meta.c
@@ -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);
}