[Mesa-dev] [PATCH 1/2] mesa: fix clip plane enable breakage

Marek Olšák maraeo at gmail.com
Mon Jun 26 00:49:32 UTC 2017


From: Marek Olšák <marek.olsak at amd.com>

Broken by:

commit 00173d91b70ae4dcea7c6324ee4858c498cae14b
Author: Marek Olšák <marek.olsak at amd.com>
Date:   Sat Jun 10 12:09:43 2017 +0200

    mesa: don't flag _NEW_TRANSFORM for st/mesa if possible

It also optimizes the case slightly for GL core.

It doesn't try to fix that glEnable might be a bad place to do the
clip plane transformation.
---
 src/mesa/main/enable.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c
index e1293f9..18a288d 100644
--- a/src/mesa/main/enable.c
+++ b/src/mesa/main/enable.c
@@ -354,22 +354,27 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
             if (ctx->API == API_OPENGL_COMPAT || ctx->API == API_OPENGLES ||
                 !ctx->DriverFlags.NewClipPlaneEnable) {
                FLUSH_VERTICES(ctx, _NEW_TRANSFORM);
             } else {
                FLUSH_VERTICES(ctx, 0);
             }
             ctx->NewDriverState |= ctx->DriverFlags.NewClipPlaneEnable;
 
             if (state) {
                ctx->Transform.ClipPlanesEnabled |= (1 << p);
-               if (ctx->API == API_OPENGL_COMPAT || ctx->API == API_OPENGLES)
+
+               /* The projection matrix transforms the clip plane. */
+               /* TODO: glEnable might not be the best place to do it. */
+               if (ctx->API == API_OPENGL_COMPAT || ctx->API == API_OPENGLES) {
                   _mesa_update_clip_plane(ctx, p);
+                  ctx->NewDriverState |= ctx->DriverFlags.NewClipPlane;
+               }
             }
             else {
                ctx->Transform.ClipPlanesEnabled &= ~(1 << p);
             }
          }
          break;
       case GL_COLOR_MATERIAL:
          if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
             goto invalid_enum_error;
          if (ctx->Light.ColorMaterialEnabled == state)
-- 
2.7.4



More information about the mesa-dev mailing list