summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/common/meta.c
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2009-08-27 14:47:24 -0600
committerBrian Paul <[email protected]>2009-08-30 09:10:36 -0600
commit0243f79eac707cb2209346b0be2f7b67ce6efdf8 (patch)
treeda93bf9f2a9e9a00dde43865ad4740a749093227 /src/mesa/drivers/common/meta.c
parentc28f253ac26e2d5a8cc7befa35e754515d4510dd (diff)
mesa: avoid redundant viewport changes in meta code
Diffstat (limited to 'src/mesa/drivers/common/meta.c')
-rw-r--r--src/mesa/drivers/common/meta.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
index e42beabc9ba..f086112ec55 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -432,13 +432,23 @@ _mesa_meta_begin(GLcontext *ctx, GLbitfield state)
}
if (state & META_VIEWPORT) {
+ /* save viewport state */
save->ViewportX = ctx->Viewport.X;
save->ViewportY = ctx->Viewport.Y;
save->ViewportW = ctx->Viewport.Width;
save->ViewportH = ctx->Viewport.Height;
- _mesa_Viewport(0, 0, ctx->DrawBuffer->Width, ctx->DrawBuffer->Height);
+ /* set viewport to match window size */
+ if (ctx->Viewport.X != 0 ||
+ ctx->Viewport.Y != 0 ||
+ ctx->Viewport.Width != ctx->DrawBuffer->Width ||
+ ctx->Viewport.Height != ctx->DrawBuffer->Height) {
+ _mesa_set_viewport(ctx, 0, 0,
+ ctx->DrawBuffer->Width, ctx->DrawBuffer->Height);
+ }
+ /* save depth range state */
save->DepthNear = ctx->Viewport.Near;
save->DepthFar = ctx->Viewport.Far;
+ /* set depth range to default */
_mesa_DepthRange(0.0, 1.0);
}
@@ -642,8 +652,13 @@ _mesa_meta_end(GLcontext *ctx)
}
if (state & META_VIEWPORT) {
- _mesa_Viewport(save->ViewportX, save->ViewportY,
- save->ViewportW, save->ViewportH);
+ if (save->ViewportX != ctx->Viewport.X ||
+ save->ViewportY != ctx->Viewport.Y ||
+ save->ViewportW != ctx->Viewport.Width ||
+ save->ViewportH != ctx->Viewport.Height) {
+ _mesa_set_viewport(ctx, save->ViewportX, save->ViewportY,
+ save->ViewportW, save->ViewportH);
+ }
_mesa_DepthRange(save->DepthNear, save->DepthFar);
}