diff options
author | Ben Skeggs <skeggsb@gmail.com> | 2008-04-27 18:04:50 +1000 |
---|---|---|
committer | Ben Skeggs <skeggsb@gmail.com> | 2008-04-27 18:04:50 +1000 |
commit | 0cca90cea1dbe1a76dbf9ac1985c3676ec460b0a (patch) | |
tree | 6e496a5d77d13a9f1679006c3c5334e0b8d889f4 /src/mesa/state_tracker/st_cb_texture.c | |
parent | 7342688286cc3b7c938af2dfeac22df4fa8c8464 (diff) | |
parent | a8e39b6f5a1fedf2f8719e1adb8802ebbfc09688 (diff) |
Merge remote branch 'upstream/gallium-0.1' into nouveau-gallium-0.1
Diffstat (limited to 'src/mesa/state_tracker/st_cb_texture.c')
-rw-r--r-- | src/mesa/state_tracker/st_cb_texture.c | 47 |
1 files changed, 31 insertions, 16 deletions
diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index 3db2790267..005bb2e54d 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 @@ -895,6 +896,11 @@ st_TexSubimage(GLcontext * ctx, dstRowStride = stImage->surface->pitch * stImage->surface->cpp; } + if (!texImage->Data) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexSubImage"); + return; + } + src = (const GLubyte *) pixels; for (i = 0; i++ < depth;) { @@ -906,10 +912,11 @@ st_TexSubimage(GLcontext * ctx, texImage->ImageOffsets, width, height, 1, format, type, src, packing)) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "st_TexSubImage"); + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexSubImage"); } if (stImage->pt && i < depth) { + /* map next slice of 3D texture */ st_texture_image_unmap(stImage); texImage->Data = st_texture_image_map(ctx->st, stImage, zoffset + i); src += srcImageStride; @@ -1134,11 +1141,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 +1167,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 { @@ -1358,7 +1373,7 @@ copy_image_data_to_texture(struct st_context *st, pipe_texture_release(&stImage->pt); } - else { + else if (stImage->base.Data) { assert(stImage->base.Data != NULL); /* More straightforward upload. |