st/mesa: fix incorrect texture level/face/slice accesses

If we use FBOs to access mipmap levels with glRead/Draw/CopyPixels()
we need to be sure to access the correct mipmap level/face/slice.
Before, we were just passing zero in quite a few places.

This fixes the new piglit fbo-mipmap-copypix test.

NOTE: This is a candidate for the 7.10 branch.
This commit is contained in:
Brian Paul 2011-05-25 18:07:33 -06:00
parent 1697dac642
commit bf14ab417c
2 changed files with 21 additions and 12 deletions

View File

@ -793,9 +793,10 @@ draw_stencil_pixels(struct gl_context *ctx, GLint x, GLint y,
else
usage = PIPE_TRANSFER_WRITE;
pt = pipe_get_transfer(st_context(ctx)->pipe, strb->texture, 0, 0,
usage, x, y,
width, height);
pt = pipe_get_transfer(st_context(ctx)->pipe, strb->texture,
strb->rtt_level, strb->rtt_face + strb->rtt_slice,
usage, x, y,
width, height);
stmap = pipe_transfer_map(pipe, pt);
@ -1131,7 +1132,9 @@ copy_stencil_pixels(struct gl_context *ctx, GLint srcx, GLint srcy,
}
ptDraw = pipe_get_transfer(st_context(ctx)->pipe,
rbDraw->texture, 0, 0,
rbDraw->texture,
rbDraw->rtt_level,
rbDraw->rtt_face + rbDraw->rtt_slice,
usage, dstx, dsty,
width, height);
@ -1291,8 +1294,10 @@ blit_copy_pixels(struct gl_context *ctx, GLint srcx, GLint srcy,
u_box_2d(readX, readY, readW, readH, &srcBox);
pipe->resource_copy_region(pipe,
rbDraw->texture, 0, drawX, drawY, 0,
rbRead->texture, 0, &srcBox);
rbDraw->texture,
rbDraw->rtt_level, drawX, drawY, 0,
rbRead->texture,
rbRead->rtt_level, &srcBox);
return GL_TRUE;
}
}
@ -1444,10 +1449,10 @@ st_CopyPixels(struct gl_context *ctx, GLint srcx, GLint srcy,
/* copy source framebuffer surface into mipmap/texture */
pipe->resource_copy_region(pipe,
pt, /* dest tex */
0,
0, /* dest lvl */
pack.SkipPixels, pack.SkipRows, 0, /* dest pos */
rbRead->texture, /* src tex */
0,
rbRead->rtt_level, /* src lvl */
&src_box);
}
@ -1455,7 +1460,8 @@ st_CopyPixels(struct gl_context *ctx, GLint srcx, GLint srcy,
/* CPU-based fallback/conversion */
struct pipe_transfer *ptRead =
pipe_get_transfer(st->pipe, rbRead->texture,
0, 0, /* level, layer */
rbRead->rtt_level,
rbRead->rtt_face + rbRead->rtt_slice,
PIPE_TRANSFER_READ,
readX, readY, readW, readH);
struct pipe_transfer *ptTex;

View File

@ -82,7 +82,8 @@ st_read_stencil_pixels(struct gl_context *ctx, GLint x, GLint y,
/* Create a read transfer from the renderbuffer's texture */
pt = pipe_get_transfer(pipe, strb->texture,
0, 0,
strb->rtt_level,
strb->rtt_face + strb->rtt_slice,
PIPE_TRANSFER_READ,
x, y, width, height);
@ -250,7 +251,8 @@ st_fast_readpixels(struct gl_context *ctx, struct st_renderbuffer *strb,
}
trans = pipe_get_transfer(pipe, strb->texture,
0, 0,
strb->rtt_level,
strb->rtt_face + strb->rtt_slice,
PIPE_TRANSFER_READ,
x, y, width, height);
if (!trans) {
@ -445,7 +447,8 @@ st_readpixels(struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei h
/* Create a read transfer from the renderbuffer's texture */
trans = pipe_get_transfer(pipe, strb->texture,
0, 0,
strb->rtt_level, /* level */
strb->rtt_face + strb->rtt_slice, /* layer */
PIPE_TRANSFER_READ,
x, y, width, height);