Mesa (master): mesa: Remove the _WindowMap from gl_viewport_attrib.

Mathias Fröhlich frohlich at kemper.freedesktop.org
Sun Apr 5 06:14:28 UTC 2015


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

Author: Mathias Froehlich <Mathias.Froehlich at web.de>
Date:   Sun Mar 29 18:57:46 2015 +0200

mesa: Remove the _WindowMap from gl_viewport_attrib.

The _WindowMap can be dropped from gl_viewport_attrib now.
Simplify gl_viewport_attrib handling where possible.

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

---

 src/mesa/main/context.c  |   12 ++----------
 src/mesa/main/mtypes.h   |    1 -
 src/mesa/main/state.c    |   25 -------------------------
 src/mesa/main/viewport.c |   44 ++------------------------------------------
 src/mesa/main/viewport.h |    3 ---
 5 files changed, 4 insertions(+), 81 deletions(-)

diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index c1acda9..adf6497 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -1288,7 +1288,6 @@ _mesa_free_context_data( struct gl_context *ctx )
    _mesa_free_eval_data( ctx );
    _mesa_free_texture_data( ctx );
    _mesa_free_matrix_data( ctx );
-   _mesa_free_viewport_data( ctx );
    _mesa_free_pipeline_data(ctx);
    _mesa_free_program_data(ctx);
    _mesa_free_shader_state(ctx);
@@ -1449,17 +1448,10 @@ _mesa_copy_context( const struct gl_context *src, struct gl_context *dst,
       dst->Transform = src->Transform;
    }
    if (mask & GL_VIEWPORT_BIT) {
-      /* Cannot use memcpy, because of pointers in GLmatrix _WindowMap */
       unsigned i;
       for (i = 0; i < src->Const.MaxViewports; i++) {
-         dst->ViewportArray[i].X = src->ViewportArray[i].X;
-         dst->ViewportArray[i].Y = src->ViewportArray[i].Y;
-         dst->ViewportArray[i].Width = src->ViewportArray[i].Width;
-         dst->ViewportArray[i].Height = src->ViewportArray[i].Height;
-         dst->ViewportArray[i].Near = src->ViewportArray[i].Near;
-         dst->ViewportArray[i].Far = src->ViewportArray[i].Far;
-         _math_matrix_copy(&dst->ViewportArray[i]._WindowMap,
-                           &src->ViewportArray[i]._WindowMap);
+         /* OK to memcpy */
+         dst->ViewportArray[i] = src->ViewportArray[i];
       }
    }
 
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index c1e5dd3..3784e3b 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -1450,7 +1450,6 @@ struct gl_viewport_attrib
    GLfloat X, Y;		/**< position */
    GLfloat Width, Height;	/**< size */
    GLdouble Near, Far;		/**< Depth buffer range */
-   GLmatrix _WindowMap;		/**< Mapping transformation as a matrix. */
 };
 
 
diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c
index dadfb3c..6dc14b2 100644
--- a/src/mesa/main/state.c
+++ b/src/mesa/main/state.c
@@ -269,28 +269,6 @@ update_program_constants(struct gl_context *ctx)
 
 
 
-static void
-update_viewport_matrix(struct gl_context *ctx)
-{
-   const GLfloat depthMax = ctx->DrawBuffer->_DepthMaxF;
-   unsigned i;
-
-   assert(depthMax > 0);
-
-   /* Compute scale and bias values. This is really driver-specific
-    * and should be maintained elsewhere if at all.
-    * NOTE: RasterPos uses this.
-    */
-   for (i = 0; i < ctx->Const.MaxViewports; i++) {
-      double scale[3], translate[3];
-
-      _mesa_get_viewport_xform(ctx, i, scale, translate);
-      _math_matrix_viewport(&ctx->ViewportArray[i]._WindowMap,
-                            scale, translate, depthMax);
-   }
-}
-
-
 /**
  * Update the ctx->Polygon._FrontBit flag.
  */
@@ -407,9 +385,6 @@ _mesa_update_state_locked( struct gl_context *ctx )
    if (new_state & _NEW_PIXEL)
       _mesa_update_pixel( ctx, new_state );
 
-   if (new_state & (_NEW_BUFFERS | _NEW_VIEWPORT))
-      update_viewport_matrix(ctx);
-
    if (new_state & (_NEW_MULTISAMPLE | _NEW_BUFFERS))
       update_multisample( ctx );
 
diff --git a/src/mesa/main/viewport.c b/src/mesa/main/viewport.c
index 0adce9c..3f5ca79 100644
--- a/src/mesa/main/viewport.c
+++ b/src/mesa/main/viewport.c
@@ -72,16 +72,6 @@ set_viewport_no_notify(struct gl_context *ctx, unsigned idx,
    ctx->ViewportArray[idx].Y = y;
    ctx->ViewportArray[idx].Height = height;
    ctx->NewState |= _NEW_VIEWPORT;
-
-#if 1
-   /* XXX remove this someday.  Currently the DRI drivers rely on
-    * the WindowMap matrix being up to date in the driver's Viewport
-    * and DepthRange functions.
-    */
-   _mesa_get_viewport_xform(ctx, idx, scale, translate);
-   _math_matrix_viewport(&ctx->ViewportArray[idx]._WindowMap,
-                         scale, translate, ctx->DrawBuffer->_DepthMaxF);
-#endif
 }
 
 struct gl_viewport_inputs {
@@ -140,8 +130,8 @@ _mesa_Viewport(GLint x, GLint y, GLsizei width, GLsizei height)
 
 
 /**
- * Set new viewport parameters and update derived state (the _WindowMap
- * matrix).  Usually called from _mesa_Viewport().
+ * Set new viewport parameters and update derived state.
+ * Usually called from _mesa_Viewport().
  * 
  * \param ctx GL context.
  * \param idx    Index of the viewport to be updated.
@@ -255,16 +245,6 @@ set_depth_range_no_notify(struct gl_context *ctx, unsigned idx,
    ctx->ViewportArray[idx].Near = CLAMP(nearval, 0.0, 1.0);
    ctx->ViewportArray[idx].Far = CLAMP(farval, 0.0, 1.0);
    ctx->NewState |= _NEW_VIEWPORT;
-
-#if 1
-   /* XXX remove this someday.  Currently the DRI drivers rely on
-    * the WindowMap matrix being up to date in the driver's Viewport
-    * and DepthRange functions.
-    */
-   _mesa_get_viewport_xform(ctx, idx, scale, translate);
-   _math_matrix_viewport(&ctx->ViewportArray[idx]._WindowMap,
-                         scale, translate, ctx->DrawBuffer->_DepthMaxF);
-#endif
 }
 
 void
@@ -388,7 +368,6 @@ _mesa_DepthRangeIndexed(GLuint index, GLclampd nearval, GLclampd farval)
  */
 void _mesa_init_viewport(struct gl_context *ctx)
 {
-   GLfloat depthMax = 65535.0F; /* sorf of arbitrary */
    unsigned i;
 
    ctx->Transform.ClipOrigin = GL_LOWER_LEFT;
@@ -398,8 +377,6 @@ void _mesa_init_viewport(struct gl_context *ctx)
     * so just initialize all of them.
     */
    for (i = 0; i < MAX_VIEWPORTS; i++) {
-      double scale[3], translate[3];
-
       /* Viewport group */
       ctx->ViewportArray[i].X = 0;
       ctx->ViewportArray[i].Y = 0;
@@ -407,27 +384,10 @@ void _mesa_init_viewport(struct gl_context *ctx)
       ctx->ViewportArray[i].Height = 0;
       ctx->ViewportArray[i].Near = 0.0;
       ctx->ViewportArray[i].Far = 1.0;
-      _math_matrix_ctr(&ctx->ViewportArray[i]._WindowMap);
-
-      _mesa_get_viewport_xform(ctx, i, scale, translate);
-      _math_matrix_viewport(&ctx->ViewportArray[i]._WindowMap,
-                            scale, translate, depthMax);
    }
 }
 
 
-/** 
- * Free the context viewport attribute group data.
- * \param ctx  the GL context.
- */
-void _mesa_free_viewport_data(struct gl_context *ctx)
-{
-   unsigned i;
-
-   for (i = 0; i < MAX_VIEWPORTS; i++)
-      _math_matrix_dtr(&ctx->ViewportArray[i]._WindowMap);
-}
-
 extern void GLAPIENTRY
 _mesa_ClipControl(GLenum origin, GLenum depth)
 {
diff --git a/src/mesa/main/viewport.h b/src/mesa/main/viewport.h
index 426e194..899dc2d 100644
--- a/src/mesa/main/viewport.h
+++ b/src/mesa/main/viewport.h
@@ -68,9 +68,6 @@ extern void
 _mesa_init_viewport(struct gl_context *ctx);
 
 
-extern void 
-_mesa_free_viewport_data(struct gl_context *ctx);
-
 extern void GLAPIENTRY
 _mesa_ClipControl(GLenum origin, GLenum depth);
 




More information about the mesa-commit mailing list