<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Jan 16, 2017 at 1:13 AM, Topi Pohjolainen <span dir="ltr"><<a href="mailto:topi.pohjolainen@gmail.com" target="_blank">topi.pohjolainen@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Signed-off-by: Topi Pohjolainen <<a href="mailto:topi.pohjolainen@intel.com">topi.pohjolainen@intel.com</a>><br>
---<br>
src/mesa/drivers/dri/i965/<wbr>intel_pixel_read.c | 16 ++++++++++++++--<br>
1 file changed, 14 insertions(+), 2 deletions(-)<br>
<br>
diff --git a/src/mesa/drivers/dri/i965/<wbr>intel_pixel_read.c b/src/mesa/drivers/dri/i965/<wbr>intel_pixel_read.c<br>
index 2563897..ace94a0 100644<br>
--- a/src/mesa/drivers/dri/i965/<wbr>intel_pixel_read.c<br>
+++ b/src/mesa/drivers/dri/i965/<wbr>intel_pixel_read.c<br>
@@ -47,6 +47,19 @@<br>
<br>
#define FILE_DEBUG_FLAG DEBUG_PIXEL<br>
<br>
+static void<br>
+adjust_image_offset(const struct intel_renderbuffer *irb,<br>
+ int *xoffset, int *yoffset)<br>
+{<br>
+ unsigned x;<br>
+ unsigned y;<br>
+ intel_miptree_get_image_<wbr>offset(irb->mt, irb->mt_level, irb->mt_layer,<br>
+ &x, &y);<br>
+<br>
+ *xoffset += x;<br>
+ *yoffset += y;<br>
+}<br>
+<br>
/**<br>
* \brief A fast path for glReadPixels<br>
*<br>
@@ -153,8 +166,7 @@ intel_readpixels_tiled_memcpy(<wbr>struct gl_context * ctx,<br>
return false;<br>
}<br>
<br>
- xoffset += irb->mt->level[irb->mt_level].<wbr>slice[irb->mt_layer].x_offset;<br>
- yoffset += irb->mt->level[irb->mt_level].<wbr>slice[irb->mt_layer].y_offset;<br>
+ adjust_image_offset(irb, &xoffset, &yoffset);<br></blockquote><div><br></div><div>We do this a lot more places than just readpixels. Maybe we want to just add a intel_miptree_get_texel_xy_offset helper that takes a miptree, level, slice, and x/y and returns the total x/y. In any case, we really should make such a helper a bit more global and use it all of the other random places we do this calculation such as texsubimage_tiled_memcpy.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
dst_pitch = _mesa_image_row_stride(pack, width, format, type);<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
2.5.5<br>
<br>
______________________________<wbr>_________________<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/<wbr>mailman/listinfo/mesa-dev</a><br>
</font></span></blockquote></div><br></div></div>