[Mesa-dev] [PATCH 4/4] mesa: Remove the _WindowMap from gl_viewport_attrib.
Mathias.Froehlich at gmx.net
Mathias.Froehlich at gmx.net
Mon Mar 30 23:37:36 PDT 2015
From: Mathias Froehlich <Mathias.Froehlich at gmx.net>
The _WindowMap can be dropped from gl_viewport_attrib now.
Simplify gl_viewport_attrib handling where possible.
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 8e1dba6..6444ac9 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -1456,7 +1456,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);
--
2.1.0
More information about the mesa-dev
mailing list