summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2009-05-01 18:04:07 -0600
committerBrian Paul <brianp@vmware.com>2009-06-17 11:30:02 -0600
commit268f43a5fb100951b75fc6180e72ba5157898a6e (patch)
treec548ac77b10846aafe168f2e259b87fa5e46a360 /src
parent41e1cb57c26006daa835b5772c90fb35ce674aff (diff)
mesa: fix state validation bug for glCopyTex[Sub]Image()
We need to make sure the framebuffer state is up to date to make sure we read pixels from the right buffer when doing a texture image copy. (cherry-picked from master, commit 63f01309801c5a900d8d7f5ccd63413e33ff9bff)
Diffstat (limited to 'src')
-rw-r--r--src/mesa/main/teximage.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index 70ef2093111..babf579773c 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -50,6 +50,17 @@
/**
+ * State changes which we care about for glCopyTex[Sub]Image() calls.
+ * In particular, we care about pixel transfer state and buffer state
+ * (such as glReadBuffer to make sure we read from the right renderbuffer).
+ */
+#define NEW_COPY_TEX_STATE (_IMAGE_NEW_TRANSFER_STATE | \
+ _NEW_BUFFERS | \
+ _NEW_PIXEL)
+
+
+
+/**
* We allocate texture memory on 512-byte boundaries so we can use MMX/SSE
* elsewhere.
*/
@@ -2929,7 +2940,7 @@ _mesa_CopyTexImage1D( GLenum target, GLint level,
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
- if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE)
+ if (ctx->NewState & NEW_COPY_TEX_STATE)
_mesa_update_state(ctx);
#if FEATURE_convolve
@@ -2994,7 +3005,7 @@ _mesa_CopyTexImage2D( GLenum target, GLint level, GLenum internalFormat,
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
- if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE)
+ if (ctx->NewState & NEW_COPY_TEX_STATE)
_mesa_update_state(ctx);
#if FEATURE_convolve
@@ -3062,7 +3073,7 @@ _mesa_CopyTexSubImage1D( GLenum target, GLint level,
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
- if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE)
+ if (ctx->NewState & NEW_COPY_TEX_STATE)
_mesa_update_state(ctx);
if (copytexsubimage_error_check1(ctx, 1, target, level))
@@ -3117,7 +3128,7 @@ _mesa_CopyTexSubImage2D( GLenum target, GLint level,
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
- if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE)
+ if (ctx->NewState & NEW_COPY_TEX_STATE)
_mesa_update_state(ctx);
if (copytexsubimage_error_check1(ctx, 2, target, level))
@@ -3172,7 +3183,7 @@ _mesa_CopyTexSubImage3D( GLenum target, GLint level,
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
- if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE)
+ if (ctx->NewState & NEW_COPY_TEX_STATE)
_mesa_update_state(ctx);
if (copytexsubimage_error_check1(ctx, 3, target, level))