Mesa (master): mesa: Handle clip control in meta operations.

Mathias Fröhlich frohlich at kemper.freedesktop.org
Fri Oct 24 17:31:35 UTC 2014


Module: Mesa
Branch: master
Commit: 85edaa8b72cea5cb20ead812cd3c793eb55209e6
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=85edaa8b72cea5cb20ead812cd3c793eb55209e6

Author: Mathias Fröhlich <Mathias.Froehlich at gmx.net>
Date:   Thu Sep 25 19:39:31 2014 +0200

mesa: Handle clip control in meta operations.

Restore clip control to the default state if MESA_META_VIEWPORT
or MESA_META_DEPTH_TEST is requested.

v3:
Handle clip control state with MESA_META_TRANSFORM.

Reviewed-by: Brian Paul <brianp at vmware.com>
Signed-off-by: Mathias Froehlich <Mathias.Froehlich at web.de>

---

 src/mesa/drivers/common/meta.c |    6 ++++++
 src/mesa/drivers/common/meta.h |    3 +++
 2 files changed, 9 insertions(+)

diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
index 7a8e627..45c50fd 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -680,6 +680,10 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state)
          _mesa_Ortho(0.0, ctx->DrawBuffer->Width,
                      0.0, ctx->DrawBuffer->Height,
                      -1.0, 1.0);
+
+      save->ClipOrigin = ctx->Transform.ClipOrigin;
+      save->ClipDepthMode = ctx->Transform.ClipDepthMode;
+      _mesa_ClipControl(GL_LOWER_LEFT, GL_NEGATIVE_ONE_TO_ONE);
    }
 
    if (state & MESA_META_CLIP) {
@@ -1081,6 +1085,8 @@ _mesa_meta_end(struct gl_context *ctx)
       _mesa_LoadMatrixf(save->ProjectionMatrix);
 
       _mesa_MatrixMode(save->MatrixMode);
+
+      _mesa_ClipControl(save->ClipOrigin, save->ClipDepthMode);
    }
 
    if (state & MESA_META_CLIP) {
diff --git a/src/mesa/drivers/common/meta.h b/src/mesa/drivers/common/meta.h
index 2c9517b..6ecf3c0 100644
--- a/src/mesa/drivers/common/meta.h
+++ b/src/mesa/drivers/common/meta.h
@@ -136,6 +136,9 @@ struct save_state
    GLfloat ModelviewMatrix[16];
    GLfloat ProjectionMatrix[16];
    GLfloat TextureMatrix[16];
+   /** GL_ARB_clip_control */
+   GLenum ClipOrigin;     /**< GL_LOWER_LEFT or GL_UPPER_LEFT */
+   GLenum ClipDepthMode;  /**< GL_NEGATIVE_ONE_TO_ONE or GL_ZERO_TO_ONE */
 
    /** MESA_META_CLIP */
    GLbitfield ClipPlanesEnabled;




More information about the mesa-commit mailing list