summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2006-03-29 23:44:31 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2006-03-29 23:44:31 +0000
commit75a8383e8d9940bd933dea1ef3b33d8321a6a723 (patch)
tree0506859c8f24841a3837e1c2a9c8ecddf126ca0c
parent920023240c2fc42675f318732b43bdc6f339113c (diff)
Update the _WindowMap matrix in _mesa_set_viewport() and _mesa_DepthRange().
This is a temporary fix for the DRI drivers. Should really only have to update the matrix via _mesa_update_state().
-rw-r--r--src/mesa/main/matrix.c34
1 files changed, 28 insertions, 6 deletions
diff --git a/src/mesa/main/matrix.c b/src/mesa/main/matrix.c
index 069c5c9738..ecd3732c93 100644
--- a/src/mesa/main/matrix.c
+++ b/src/mesa/main/matrix.c
@@ -575,18 +575,28 @@ _mesa_set_viewport( GLcontext *ctx, GLint x, GLint y,
return;
}
- /* clamp width, and height to implementation dependent range */
- width = CLAMP( width, 1, ctx->Const.MaxViewportWidth );
- height = CLAMP( height, 1, ctx->Const.MaxViewportHeight );
+ /* clamp width and height to the implementation dependent range */
+ width = CLAMP(width, 1, ctx->Const.MaxViewportWidth);
+ height = CLAMP(height, 1, ctx->Const.MaxViewportHeight);
- /* Save viewport */
ctx->Viewport.X = x;
ctx->Viewport.Width = width;
ctx->Viewport.Y = y;
ctx->Viewport.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.
+ */
+ _math_matrix_viewport(&ctx->Viewport._WindowMap,
+ ctx->Viewport.X, ctx->Viewport.Y,
+ ctx->Viewport.Width, ctx->Viewport.Height,
+ ctx->Viewport.Near, ctx->Viewport.Far,
+ ctx->DrawBuffer->_DepthMaxF);
+#endif
+
if (ctx->Driver.Viewport) {
/* Many drivers will use this call to check for window size changes
* and reallocate the z/stencil/accum/etc buffers if needed.
@@ -597,7 +607,6 @@ _mesa_set_viewport( GLcontext *ctx, GLint x, GLint y,
#if _HAVE_FULL_GL
-void GLAPIENTRY
/**
* Called by glDepthRange
*
@@ -606,6 +615,7 @@ void GLAPIENTRY
* \param farval specifies the Z buffer value which should correspond to
* the far clip plane
*/
+void GLAPIENTRY
_mesa_DepthRange( GLclampd nearval, GLclampd farval )
{
GET_CURRENT_CONTEXT(ctx);
@@ -618,6 +628,18 @@ _mesa_DepthRange( GLclampd nearval, GLclampd farval )
ctx->Viewport.Far = (GLfloat) 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.
+ */
+ _math_matrix_viewport(&ctx->Viewport._WindowMap,
+ ctx->Viewport.X, ctx->Viewport.Y,
+ ctx->Viewport.Width, ctx->Viewport.Height,
+ ctx->Viewport.Near, ctx->Viewport.Far,
+ ctx->DrawBuffer->_DepthMaxF);
+#endif
+
if (ctx->Driver.DepthRange) {
(*ctx->Driver.DepthRange)( ctx, nearval, farval );
}