diff options
Diffstat (limited to 'src/mesa/state_tracker/st_cb_texture.c')
-rw-r--r-- | src/mesa/state_tracker/st_cb_texture.c | 74 |
1 files changed, 31 insertions, 43 deletions
diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index ed65f3b0aa..7d52d1da1b 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -1157,11 +1157,13 @@ do_copy_texsubimage(GLcontext *ctx, struct pipe_context *pipe = ctx->st->pipe; struct pipe_screen *screen = pipe->screen; uint dest_format, src_format; - uint do_flip = FALSE; GLboolean use_fallback = GL_TRUE; (void) texImage; + /* XX need this?*/ + st_flush(ctx->st, PIPE_FLUSH_RENDER_CACHE, NULL); + /* determine if copying depth or color data */ if (baseFormat == GL_DEPTH_COMPONENT) { strb = st_renderbuffer(fb->_DepthBuffer); @@ -1178,40 +1180,15 @@ do_copy_texsubimage(GLcontext *ctx, assert(strb->surface); assert(stImage->pt); - if (st_fb_orientation(ctx->ReadBuffer) == Y_0_TOP) { - srcY = strb->Base.Height - srcY - height; - do_flip = TRUE; - } - src_format = strb->surface->format; dest_format = stImage->pt->format; if (ctx->_ImageTransferState == 0x0) { /* do blit-style copy */ - - /* XXX may need to invert image depending on window - * vs. user-created FBO - */ - -#if 0 - /* A bit of fiddling to get the blitter to work with -ve - * pitches. But we get a nice inverted blit this way, so it's - * worth it: - */ - intelEmitCopyBlit(intel, - stImage->pt->cpp, - -src->pitch, - src->buffer, - src->height * src->pitch * src->cpp, - stImage->pt->pitch, - stImage->pt->region->buffer, - dest_offset, - x, y + height, dstx, dsty, width, height, - GL_COPY); /* ? */ -#else struct pipe_surface *dest_surface; - dest_surface = screen->get_tex_surface(screen, stImage->pt, stImage->face, + dest_surface = screen->get_tex_surface(screen, stImage->pt, + stImage->face, stImage->level, destZ, PIPE_BUFFER_USAGE_GPU_WRITE); @@ -1219,34 +1196,45 @@ do_copy_texsubimage(GLcontext *ctx, assert(dest_surface->buffer); if (src_format == dest_format) { - pipe->surface_copy(pipe, - do_flip, - /* dest */ - dest_surface, - destX, destY, - /* src */ - strb->surface, - srcX, srcY, - /* size */ - width, height); - use_fallback = GL_FALSE; + boolean do_flip = (st_fb_orientation(ctx->ReadBuffer) == Y_0_TOP); + pipe->surface_copy(pipe, + do_flip, + /* dest */ + dest_surface, + destX, destY, + /* src */ + strb->surface, + srcX, srcY, + /* size */ + width, height); + use_fallback = GL_FALSE; } else if (screen->is_format_supported(screen, strb->surface->format, PIPE_TEXTURE) && screen->is_format_supported(screen, dest_surface->format, PIPE_SURFACE)) { + boolean do_flip = (st_fb_orientation(ctx->ReadBuffer) == Y_0_TOP); + int srcY0, srcY1; + if (do_flip) { + srcY1 = strb->Base.Height - srcY - height; + srcY0 = srcY1 + height; + } + else { + srcY0 = srcY; + srcY1 = srcY0 + height; + } util_blit_pixels(ctx->st->blit, strb->surface, - srcX, do_flip ? srcY + height : srcY, - srcX + width, do_flip ? srcY : srcY + height, + srcX, srcY0, + srcX + width, srcY1, dest_surface, - destX, destY, destX + width, destY + height, + destX, destY, + destX + width, destY + height, 0.0, PIPE_TEX_MIPFILTER_NEAREST); use_fallback = GL_FALSE; } pipe_surface_reference(&dest_surface, NULL); -#endif } if (use_fallback) { |