Mesa (master): mesa: add clip_control() helper

Samuel Pitoiset hakzsam at kemper.freedesktop.org
Fri Jun 23 07:28:35 UTC 2017


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

Author: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Date:   Thu Jun 22 11:58:44 2017 +0200

mesa: add clip_control() helper

Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Reviewed-by: Timothy Arceri <tarceri at itsqueeze.com>

---

 src/mesa/main/viewport.c | 61 +++++++++++++++++++++++++++---------------------
 1 file changed, 34 insertions(+), 27 deletions(-)

diff --git a/src/mesa/main/viewport.c b/src/mesa/main/viewport.c
index 5529f55ee7..b424d8f654 100644
--- a/src/mesa/main/viewport.c
+++ b/src/mesa/main/viewport.c
@@ -420,40 +420,16 @@ void _mesa_init_viewport(struct gl_context *ctx)
 }
 
 
-extern void GLAPIENTRY
-_mesa_ClipControl(GLenum origin, GLenum depth)
+static void
+clip_control(struct gl_context *ctx, GLenum origin, GLenum depth)
 {
-   GET_CURRENT_CONTEXT(ctx);
-
-   if (MESA_VERBOSE&VERBOSE_API)
-      _mesa_debug(ctx, "glClipControl(%s, %s)\n",
-	          _mesa_enum_to_string(origin),
-                  _mesa_enum_to_string(depth));
-
-   ASSERT_OUTSIDE_BEGIN_END(ctx);
-
-   if (!ctx->Extensions.ARB_clip_control) {
-      _mesa_error(ctx, GL_INVALID_OPERATION, "glClipControl");
-      return;
-   }
-
-   if (origin != GL_LOWER_LEFT && origin != GL_UPPER_LEFT) {
-      _mesa_error(ctx, GL_INVALID_ENUM, "glClipControl");
-      return;
-   }
-
-   if (depth != GL_NEGATIVE_ONE_TO_ONE && depth != GL_ZERO_TO_ONE) {
-      _mesa_error(ctx, GL_INVALID_ENUM, "glClipControl");
-      return;
-   }
-
    if (ctx->Transform.ClipOrigin == origin &&
        ctx->Transform.ClipDepthMode == depth)
       return;
 
    /* Affects transform state and the viewport transform */
    FLUSH_VERTICES(ctx, ctx->DriverFlags.NewClipControl ? 0 :
-                                          _NEW_TRANSFORM | _NEW_VIEWPORT);
+                  _NEW_TRANSFORM | _NEW_VIEWPORT);
    ctx->NewDriverState |= ctx->DriverFlags.NewClipControl;
 
    if (ctx->Transform.ClipOrigin != origin) {
@@ -477,6 +453,37 @@ _mesa_ClipControl(GLenum origin, GLenum depth)
    }
 }
 
+
+void GLAPIENTRY
+_mesa_ClipControl(GLenum origin, GLenum depth)
+{
+   GET_CURRENT_CONTEXT(ctx);
+
+   if (MESA_VERBOSE & VERBOSE_API)
+      _mesa_debug(ctx, "glClipControl(%s, %s)\n",
+	          _mesa_enum_to_string(origin),
+                  _mesa_enum_to_string(depth));
+
+   ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+   if (!ctx->Extensions.ARB_clip_control) {
+      _mesa_error(ctx, GL_INVALID_OPERATION, "glClipControl");
+      return;
+   }
+
+   if (origin != GL_LOWER_LEFT && origin != GL_UPPER_LEFT) {
+      _mesa_error(ctx, GL_INVALID_ENUM, "glClipControl");
+      return;
+   }
+
+   if (depth != GL_NEGATIVE_ONE_TO_ONE && depth != GL_ZERO_TO_ONE) {
+      _mesa_error(ctx, GL_INVALID_ENUM, "glClipControl");
+      return;
+   }
+
+   clip_control(ctx, origin, depth);
+}
+
 /**
  * Computes the scaling and the translation part of the
  * viewport transform matrix of the \param i-th viewport




More information about the mesa-commit mailing list