<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, May 9, 2016 at 12:26 PM, Nanley Chery <span dir="ltr"><<a href="mailto:nanleychery@gmail.com" target="_blank">nanleychery@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">From: Nanley Chery <<a href="mailto:nanley.g.chery@intel.com">nanley.g.chery@intel.com</a>><br>
<br>
This function previously assumed that the Buffer and Image had matching<br>
dimensions. However, it is possible to copy from a buffer with larger<br>
dimensions than the image. Modify the copy function to enable this.<br>
<br>
Bugzilla: <a href="https://bugs.freedesktop.org/show_bug.cgi?id=95292" rel="noreferrer" target="_blank">https://bugs.freedesktop.org/show_bug.cgi?id=95292</a><br>
Signed-off-by: Nanley Chery <<a href="mailto:nanley.g.chery@intel.com">nanley.g.chery@intel.com</a>><br>
---<br>
src/intel/vulkan/anv_meta_copy.c | 19 +++++++++++--------<br>
1 file changed, 11 insertions(+), 8 deletions(-)<br>
<br>
diff --git a/src/intel/vulkan/anv_meta_copy.c b/src/intel/vulkan/anv_meta_copy.c<br>
index 982fa7e..1d131d3 100644<br>
--- a/src/intel/vulkan/anv_meta_copy.c<br>
+++ b/src/intel/vulkan/anv_meta_copy.c<br>
@@ -128,18 +128,20 @@ meta_copy_buffer_to_image(struct anv_cmd_buffer *cmd_buffer,<br>
const VkOffset3D img_offset_el =<br>
meta_region_offset_el(image, &pRegions[r].imageOffset);<br>
const VkExtent3D bufferExtent = {<br>
- .width = pRegions[r].bufferRowLength,<br>
- .height = pRegions[r].bufferImageHeight,<br>
+ .width = MAX(pRegions[r].bufferRowLength,<br>
+ pRegions[r].imageExtent.width),<br></blockquote><div><br></div><div>As I commented on IRC, I think this would be better as "pRegions[r].bufferRowLength ? pRegions[r].BufferRowLength : pRegions[r].imageExtent.width"<br><br></div><div>With that,<br><br></div><div>Reviewed-by: Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
+ .height = MAX(pRegions[r].bufferImageHeight,<br>
+ pRegions[r].imageExtent.height),<br>
};<br>
-<br>
- /* Start creating blit rect */<br>
const VkExtent3D buf_extent_el =<br>
meta_region_extent_el(image, &bufferExtent);<br>
+<br>
+ /* Start creating blit rect */<br>
const VkExtent3D img_extent_el =<br>
meta_region_extent_el(image, &pRegions[r].imageExtent);<br>
struct anv_meta_blit2d_rect rect = {<br>
- .width = MAX2(buf_extent_el.width, img_extent_el.width),<br>
- .height = MAX2(buf_extent_el.height, img_extent_el.height),<br>
+ .width = img_extent_el.width,<br>
+ .height = img_extent_el.height,<br>
};<br>
<br>
/* Create blit surfaces */<br>
@@ -153,7 +155,7 @@ meta_copy_buffer_to_image(struct anv_cmd_buffer *cmd_buffer,<br>
.tiling = ISL_TILING_LINEAR,<br>
.base_offset = buffer->offset + pRegions[r].bufferOffset,<br>
.bs = forward ? image->format->isl_layout->bs : <a href="http://img_bsurf.bs" rel="noreferrer" target="_blank">img_bsurf.bs</a>,<br>
- .pitch = rect.width * <a href="http://buf_bsurf.bs" rel="noreferrer" target="_blank">buf_bsurf.bs</a>,<br>
+ .pitch = buf_extent_el.width * <a href="http://buf_bsurf.bs" rel="noreferrer" target="_blank">buf_bsurf.bs</a>,<br>
};<br>
<br>
/* Set direction-dependent variables */<br>
@@ -188,7 +190,8 @@ meta_copy_buffer_to_image(struct anv_cmd_buffer *cmd_buffer,<br>
* increment the offset directly in the image effectively<br>
* re-binding it to different backing memory.<br>
*/<br>
- buf_bsurf.base_offset += rect.width * rect.height * <a href="http://buf_bsurf.bs" rel="noreferrer" target="_blank">buf_bsurf.bs</a>;<br>
+ buf_bsurf.base_offset += buf_extent_el.width *<br>
+ buf_extent_el.height * <a href="http://buf_bsurf.bs" rel="noreferrer" target="_blank">buf_bsurf.bs</a>;<br>
<br>
if (image->type == VK_IMAGE_TYPE_3D)<br>
slice_3d++;<br>
<span class=""><font color="#888888">--<br>
2.8.2<br>
<br>
_______________________________________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</font></span></blockquote></div><br></div></div>