aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/tnl/t_context.c
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src/mesa/tnl/t_context.c')
-rw-r--r--mesalib/src/mesa/tnl/t_context.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/mesalib/src/mesa/tnl/t_context.c b/mesalib/src/mesa/tnl/t_context.c
index bc705d7a3..5b9dd54d7 100644
--- a/mesalib/src/mesa/tnl/t_context.c
+++ b/mesalib/src/mesa/tnl/t_context.c
@@ -35,6 +35,7 @@
#include "math/m_translate.h"
#include "math/m_xform.h"
#include "main/state.h"
+#include "main/viewport.h"
#include "tnl.h"
#include "t_context.h"
@@ -69,6 +70,8 @@ _tnl_CreateContext( struct gl_context *ctx )
_tnl_install_pipeline( ctx, _tnl_default_pipeline );
}
+ _math_matrix_ctr(&tnl->_WindowMap);
+
tnl->NeedNdcCoords = GL_TRUE;
tnl->AllowVertexFog = GL_TRUE;
tnl->AllowPixelFog = GL_TRUE;
@@ -108,6 +111,8 @@ _tnl_DestroyContext( struct gl_context *ctx )
struct tnl_shine_tab *s, *tmps;
TNLcontext *tnl = TNL_CONTEXT(ctx);
+ _math_matrix_dtr(&tnl->_WindowMap);
+
/* Free lighting shininess exponentiation table */
foreach_s( s, tmps, tnl->_ShineTabList ) {
free( s );
@@ -182,6 +187,13 @@ _tnl_InvalidateState( struct gl_context *ctx, GLuint new_state )
}
}
}
+
+ if (new_state & (_NEW_VIEWPORT | _NEW_BUFFERS)) {
+ double scale[3], translate[3];
+ _mesa_get_viewport_xform(ctx, 0, scale, translate);
+ _math_matrix_viewport(&tnl->_WindowMap, scale, translate,
+ ctx->DrawBuffer->_DepthMaxF);
+ }
}