<div dir="ltr">Thank you very much, Brian. </div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Apr 10, 2017 at 10:43 PM, Brian Paul <span dir="ltr"><<a href="mailto:brianp@vmware.com" target="_blank">brianp@vmware.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Pushed, with slightly more descriptive commit msg.<span class="HOEnZb"><font color="#888888"><br>
<br>
-Brian</font></span><div class="HOEnZb"><div class="h5"><br>
<br>
On 04/10/2017 12:31 PM, Bartosz Tomczyk wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
v2: fix indentation<br>
---<br>
src/mesa/main/readpix.c | 15 ++++++++++-----<br>
src/mesa/main/texstore.c | 15 +++++++++++----<br>
2 files changed, 21 insertions(+), 9 deletions(-)<br>
<br>
diff --git a/src/mesa/main/readpix.c b/src/mesa/main/readpix.c<br>
index 25823230d6..606d1e58e5 100644<br>
--- a/src/mesa/main/readpix.c<br>
+++ b/src/mesa/main/readpix.c<br>
@@ -220,7 +220,7 @@ readpixels_memcpy(struct gl_context *ctx,<br>
struct gl_renderbuffer *rb =<br>
_mesa_get_read_renderbuffer_f<wbr>or_format(ctx, format);<br>
GLubyte *dst, *map;<br>
- int dstStride, stride, j, texelBytes;<br>
+ int dstStride, stride, j, texelBytes, bytesPerRow;<br>
<br>
/* Fail if memcpy cannot be used. */<br>
if (!readpixels_can_use_memcpy(ct<wbr>x, format, type, packing)) {<br>
@@ -239,12 +239,17 @@ readpixels_memcpy(struct gl_context *ctx,<br>
}<br>
<br>
texelBytes = _mesa_get_format_bytes(rb->For<wbr>mat);<br>
+ bytesPerRow = texelBytes * width;<br>
<br>
/* memcpy*/<br>
- for (j = 0; j < height; j++) {<br>
- memcpy(dst, map, width * texelBytes);<br>
- dst += dstStride;<br>
- map += stride;<br>
+ if (dstStride == stride && dstStride == bytesPerRow) {<br>
+ memcpy(dst, map, bytesPerRow * height);<br>
+ } else {<br>
+ for (j = 0; j < height; j++) {<br>
+ memcpy(dst, map, bytesPerRow);<br>
+ dst += dstStride;<br>
+ map += stride;<br>
+ }<br>
}<br>
<br>
ctx->Driver.<wbr>UnmapRenderbuffer(ctx, rb);<br>
diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c<br>
index 615ba63362..3314e557c0 100644<br>
--- a/src/mesa/main/texstore.c<br>
+++ b/src/mesa/main/texstore.c<br>
@@ -1360,10 +1360,17 @@ _mesa_store_compressed_texsubi<wbr>mage(struct gl_context *ctx, GLuint dims,<br>
if (dstMap) {<br>
<br>
/* copy rows of blocks */<br>
- for (i = 0; i < store.CopyRowsPerSlice; i++) {<br>
- memcpy(dstMap, src, store.CopyBytesPerRow);<br>
- dstMap += dstRowStride;<br>
- src += store.TotalBytesPerRow;<br>
+ if (dstRowStride == store.TotalBytesPerRow &&<br>
+ dstRowStride == store.CopyBytesPerRow) {<br>
+ memcpy(dstMap, src, store.CopyBytesPerRow * store.CopyRowsPerSlice);<br>
+ src += store.CopyBytesPerRow * store.CopyRowsPerSlice;<br>
+ }<br>
+ else {<br>
+ for (i = 0; i < store.CopyRowsPerSlice; i++) {<br>
+ memcpy(dstMap, src, store.CopyBytesPerRow);<br>
+ dstMap += dstRowStride;<br>
+ src += store.TotalBytesPerRow;<br>
+ }<br>
}<br>
<br>
ctx->Driver.<wbr>UnmapTextureImage(ctx, texImage, slice + zoffset);<br>
<br>
</blockquote>
<br>
</div></div></blockquote></div><br></div>