diff options
author | Brian Paul <[email protected]> | 2009-08-07 09:50:25 -0600 |
---|---|---|
committer | Brian Paul <[email protected]> | 2009-08-07 09:51:50 -0600 |
commit | 2c9812e3d346eb07180da520909b142e8afc1c59 (patch) | |
tree | c5498d11de27fe392a4e8c8a88bef792f7e8d33c /src/mesa | |
parent | 6807d96f8efeecd9d71e1e1bff856e7e04f5f364 (diff) |
mesa: use _mesa_set_vp_override() in glDraw/CopyPixels and glBitmap
We don't use the vertex program in these functions and the driver may
install its own. This fixes the broken glCopyPixels swrast fallback in
i965 and possibly other drivers. In particular, glCopyPixels sometimes
didn't work because the fixed-function fragment program was replacing all
fragment colors with the current raster color.
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/main/drawpix.c | 52 |
1 files changed, 38 insertions, 14 deletions
diff --git a/src/mesa/main/drawpix.c b/src/mesa/main/drawpix.c index a3d25f46b74..3ba285c4245 100644 --- a/src/mesa/main/drawpix.c +++ b/src/mesa/main/drawpix.c @@ -64,6 +64,11 @@ _mesa_DrawPixels( GLsizei width, GLsizei height, return; } + /* We're not using the current vertex program, and the driver may install + * it's own. + */ + _mesa_set_vp_override(ctx, GL_TRUE); + if (ctx->NewState) { _mesa_update_state(ctx); } @@ -71,22 +76,22 @@ _mesa_DrawPixels( GLsizei width, GLsizei height, if (!valid_fragment_program(ctx)) { _mesa_error(ctx, GL_INVALID_OPERATION, "glDrawPixels (invalid fragment program)"); - return; + goto end; } if (_mesa_error_check_format_type(ctx, format, type, GL_TRUE)) { /* the error was already recorded */ - return; + goto end; } if (ctx->DrawBuffer->_Status != GL_FRAMEBUFFER_COMPLETE_EXT) { _mesa_error(ctx, GL_INVALID_FRAMEBUFFER_OPERATION_EXT, "glDrawPixels(incomplete framebuffer)" ); - return; + goto end; } if (!ctx->Current.RasterPosValid) { - return; /* no-op, not an error */ + goto end; /* no-op, not an error */ } if (ctx->RenderMode == GL_RENDER) { @@ -101,13 +106,13 @@ _mesa_DrawPixels( GLsizei width, GLsizei height, format, type, pixels)) { _mesa_error(ctx, GL_INVALID_OPERATION, "glDrawPixels(invalid PBO access)"); - return; + goto end; } if (_mesa_bufferobj_mapped(ctx->Unpack.BufferObj)) { /* buffer is mapped - that's an error */ _mesa_error(ctx, GL_INVALID_OPERATION, "glDrawPixels(PBO is mapped)"); - return; + goto end; } } @@ -129,6 +134,9 @@ _mesa_DrawPixels( GLsizei width, GLsizei height, ASSERT(ctx->RenderMode == GL_SELECT); /* Do nothing. See OpenGL Spec, Appendix B, Corollary 6. */ } + +end: + _mesa_set_vp_override(ctx, GL_FALSE); } @@ -150,6 +158,11 @@ _mesa_CopyPixels( GLint srcx, GLint srcy, GLsizei width, GLsizei height, return; } + /* We're not using the current vertex program, and the driver may install + * it's own. + */ + _mesa_set_vp_override(ctx, GL_TRUE); + if (ctx->NewState) { _mesa_update_state(ctx); } @@ -157,25 +170,25 @@ _mesa_CopyPixels( GLint srcx, GLint srcy, GLsizei width, GLsizei height, if (!valid_fragment_program(ctx)) { _mesa_error(ctx, GL_INVALID_OPERATION, "glCopyPixels (invalid fragment program)"); - return; + goto end; } if (ctx->DrawBuffer->_Status != GL_FRAMEBUFFER_COMPLETE_EXT || ctx->ReadBuffer->_Status != GL_FRAMEBUFFER_COMPLETE_EXT) { _mesa_error(ctx, GL_INVALID_FRAMEBUFFER_OPERATION_EXT, "glCopyPixels(incomplete framebuffer)" ); - return; + goto end; } if (!_mesa_source_buffer_exists(ctx, type) || !_mesa_dest_buffer_exists(ctx, type)) { _mesa_error(ctx, GL_INVALID_OPERATION, "glCopyPixels(missing source or dest buffer)"); - return; + goto end; } if (!ctx->Current.RasterPosValid || width ==0 || height == 0) { - return; /* no-op, not an error */ + goto end; /* no-op, not an error */ } if (ctx->RenderMode == GL_RENDER) { @@ -200,6 +213,9 @@ _mesa_CopyPixels( GLint srcx, GLint srcy, GLsizei width, GLsizei height, ASSERT(ctx->RenderMode == GL_SELECT); /* Do nothing. See OpenGL Spec, Appendix B, Corollary 6. */ } + +end: + _mesa_set_vp_override(ctx, GL_FALSE); } #endif /* _HAVE_FULL_GL */ @@ -223,6 +239,11 @@ _mesa_Bitmap( GLsizei width, GLsizei height, return; /* do nothing */ } + /* We're not using the current vertex program, and the driver may install + * it's own. + */ + _mesa_set_vp_override(ctx, GL_TRUE); + if (ctx->NewState) { _mesa_update_state(ctx); } @@ -230,13 +251,13 @@ _mesa_Bitmap( GLsizei width, GLsizei height, if (!valid_fragment_program(ctx)) { _mesa_error(ctx, GL_INVALID_OPERATION, "glBitmap (invalid fragment program)"); - return; + goto end; } if (ctx->DrawBuffer->_Status != GL_FRAMEBUFFER_COMPLETE_EXT) { _mesa_error(ctx, GL_INVALID_FRAMEBUFFER_OPERATION_EXT, "glBitmap(incomplete framebuffer)"); - return; + goto end; } if (ctx->RenderMode == GL_RENDER) { @@ -252,12 +273,12 @@ _mesa_Bitmap( GLsizei width, GLsizei height, (GLvoid *) bitmap)) { _mesa_error(ctx, GL_INVALID_OPERATION, "glBitmap(invalid PBO access)"); - return; + goto end; } if (_mesa_bufferobj_mapped(ctx->Unpack.BufferObj)) { /* buffer is mapped - that's an error */ _mesa_error(ctx, GL_INVALID_OPERATION, "glBitmap(PBO is mapped)"); - return; + goto end; } } @@ -282,6 +303,9 @@ _mesa_Bitmap( GLsizei width, GLsizei height, /* update raster position */ ctx->Current.RasterPos[0] += xmove; ctx->Current.RasterPos[1] += ymove; + +end: + _mesa_set_vp_override(ctx, GL_FALSE); } |