summaryrefslogtreecommitdiffstats
path: root/src/mesa/state_tracker
diff options
context:
space:
mode:
authorMichel Dänzer <[email protected]>2008-04-25 15:01:09 +0100
committerMichel Dänzer <[email protected]>2008-04-25 15:01:09 +0100
commit3c0dc8242b64518d5635263ba65b39afa919dd86 (patch)
treeb8089bbdcf1859de568b1d5d180452e91c36c3ec /src/mesa/state_tracker
parent96cfd804f6dcc0ec9f5e887ff1b402a55886fb0b (diff)
gallium: Use util_blit_pixels() for glCopyTexSubImage when appropriate.
Diffstat (limited to 'src/mesa/state_tracker')
-rw-r--r--src/mesa/state_tracker/st_cb_texture.c37
1 files changed, 23 insertions, 14 deletions
diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
index 3db27902675..a6c4351fff6 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -49,6 +49,7 @@
#include "pipe/p_defines.h"
#include "pipe/p_inlines.h"
#include "util/p_tile.h"
+#include "util/u_blit.h"
#define DBG if (0) printf
@@ -1134,11 +1135,9 @@ do_copy_texsubimage(GLcontext *ctx,
dest_surface = screen->get_tex_surface(screen, stImage->pt, stImage->face,
stImage->level, destZ);
- if (src_format == dest_format &&
- ctx->_ImageTransferState == 0x0 &&
+ if (ctx->_ImageTransferState == 0x0 &&
strb->surface->buffer &&
- dest_surface->buffer &&
- strb->surface->cpp == stImage->pt->cpp) {
+ dest_surface->buffer) {
/* do blit-style copy */
/* XXX may need to invert image depending on window
@@ -1162,16 +1161,26 @@ do_copy_texsubimage(GLcontext *ctx,
GL_COPY); /* ? */
#else
- pipe->surface_copy(pipe,
- do_flip,
- /* dest */
- dest_surface,
- destX, destY,
- /* src */
- strb->surface,
- srcX, srcY,
- /* size */
- width, height);
+ if (src_format == dest_format) {
+ pipe->surface_copy(pipe,
+ do_flip,
+ /* dest */
+ dest_surface,
+ destX, destY,
+ /* src */
+ strb->surface,
+ srcX, srcY,
+ /* size */
+ width, height);
+ } else {
+ util_blit_pixels(ctx->st->blit,
+ strb->surface,
+ srcX, do_flip ? srcY + height : srcY,
+ srcX + width, do_flip ? srcY : srcY + height,
+ dest_surface,
+ destX, destY, destX + width, destY + height,
+ 0.0, PIPE_TEX_MIPFILTER_NEAREST);
+ }
#endif
}
else {