diff options
author | Chad Versace <[email protected]> | 2016-08-25 16:08:27 -0700 |
---|---|---|
committer | Chad Versace <[email protected]> | 2016-08-25 16:52:00 -0700 |
commit | 5b03975889046640a0b87fb08cf06e8fb7ef9953 (patch) | |
tree | 2fc9dec9e5ea6d96fe10870949c47526987b4e8a /src/mesa | |
parent | c82f99e883cfa66b3a3b135e7b1dab0a5bfae164 (diff) |
i965: Respect miptree offsets in intel_readpixels_tiled_memcpy()
Respect intel_miptree_slice::x_offset,y_offset and
intel_mipmap_tree::offset. All three may be non-zero when glReadPixels
is called on an EGLImage created from the non-base slice of a miptree.
Patch 2/2 that fixes test
'dEQP-EGL.functional.image.create.gles2_cubemap_*'.
Reported-by: Haixia Shi <[email protected]>
Diagnosed-by: Haixia Shi <[email protected]>
Cc: [email protected]
Reviewed-by: Kenneth Graunke <[email protected]>
Change-Id: I4b397b27e55a743a7094d29fb0a6a4b6b34352b0
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/drivers/dri/i965/intel_pixel_read.c | 21 |
1 files changed, 4 insertions, 17 deletions
diff --git a/src/mesa/drivers/dri/i965/intel_pixel_read.c b/src/mesa/drivers/dri/i965/intel_pixel_read.c index a486d6e1ab9..cacd7e277c8 100644 --- a/src/mesa/drivers/dri/i965/intel_pixel_read.c +++ b/src/mesa/drivers/dri/i965/intel_pixel_read.c @@ -110,22 +110,6 @@ intel_readpixels_tiled_memcpy(struct gl_context * ctx, if (ctx->_ImageTransferState) return false; - /* This renderbuffer can come from a texture. In this case, we impose - * some of the same restrictions we have for textures and adjust for - * miplevels. - */ - if (rb->TexImage) { - if (rb->TexImage->TexObject->Target != GL_TEXTURE_2D && - rb->TexImage->TexObject->Target != GL_TEXTURE_RECTANGLE) - return false; - - int level = rb->TexImage->Level + rb->TexImage->TexObject->MinLevel; - - /* Adjust x and y offset based on miplevel */ - xoffset += irb->mt->level[level].level_x; - yoffset += irb->mt->level[level].level_y; - } - /* It is possible that the renderbuffer (or underlying texture) is * multisampled. Since ReadPixels from a multisampled buffer requires a * multisample resolve, we can't handle this here @@ -169,6 +153,9 @@ intel_readpixels_tiled_memcpy(struct gl_context * ctx, return false; } + xoffset += irb->mt->level[irb->mt_level].slice[irb->mt_layer].x_offset; + yoffset += irb->mt->level[irb->mt_level].slice[irb->mt_layer].y_offset; + dst_pitch = _mesa_image_row_stride(pack, width, format, type); /* For a window-system renderbuffer, the buffer is actually flipped @@ -201,7 +188,7 @@ intel_readpixels_tiled_memcpy(struct gl_context * ctx, xoffset * cpp, (xoffset + width) * cpp, yoffset, yoffset + height, pixels - (ptrdiff_t) yoffset * dst_pitch - (ptrdiff_t) xoffset * cpp, - bo->virtual, + bo->virtual + irb->mt->offset, dst_pitch, irb->mt->pitch, brw->has_swizzling, irb->mt->tiling, |