summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/matrix.c
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2005-05-04 20:11:35 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2005-05-04 20:11:35 +0000
commite4b2356c07d31fbeeabb13b2fb47db703b473080 (patch)
treed8b7f1c7c9e7c84d84349485f942dd205dd4c16d /src/mesa/main/matrix.c
parentebef61f5c0950572f9c6a81b08f447957461675c (diff)
downloadexternal_mesa3d-e4b2356c07d31fbeeabb13b2fb47db703b473080.zip
external_mesa3d-e4b2356c07d31fbeeabb13b2fb47db703b473080.tar.gz
external_mesa3d-e4b2356c07d31fbeeabb13b2fb47db703b473080.tar.bz2
Major check-in of changes for GL_EXT_framebuffer_object extension.
Main driver impacts: - new code for creating the Mesa GLframebuffer - new span/pixel read/write code Some drivers not yet updated/tested.
Diffstat (limited to 'src/mesa/main/matrix.c')
-rw-r--r--src/mesa/main/matrix.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/mesa/main/matrix.c b/src/mesa/main/matrix.c
index 70cbee5..2f0a1fa 100644
--- a/src/mesa/main/matrix.c
+++ b/src/mesa/main/matrix.c
@@ -569,9 +569,12 @@ void
_mesa_set_viewport( GLcontext *ctx, GLint x, GLint y,
GLsizei width, GLsizei height )
{
+ const GLfloat depthMax = ctx->DrawBuffer->_DepthMaxF;
const GLfloat n = ctx->Viewport.Near;
const GLfloat f = ctx->Viewport.Far;
+ ASSERT(depthMax > 0);
+
if (MESA_VERBOSE & VERBOSE_API)
_mesa_debug(ctx, "glViewport %d %d %d %d\n", x, y, width, height);
@@ -606,8 +609,8 @@ _mesa_set_viewport( GLcontext *ctx, GLint x, GLint y,
ctx->Viewport._WindowMap.m[MAT_TX] = ctx->Viewport._WindowMap.m[MAT_SX] + x;
ctx->Viewport._WindowMap.m[MAT_SY] = (GLfloat) height / 2.0F;
ctx->Viewport._WindowMap.m[MAT_TY] = ctx->Viewport._WindowMap.m[MAT_SY] + y;
- ctx->Viewport._WindowMap.m[MAT_SZ] = ctx->DepthMaxF * ((f - n) / 2.0F);
- ctx->Viewport._WindowMap.m[MAT_TZ] = ctx->DepthMaxF * ((f - n) / 2.0F + n);
+ ctx->Viewport._WindowMap.m[MAT_SZ] = depthMax * ((f - n) / 2.0F);
+ ctx->Viewport._WindowMap.m[MAT_TZ] = depthMax * ((f - n) / 2.0F + n);
ctx->Viewport._WindowMap.flags = MAT_FLAG_GENERAL_SCALE|MAT_FLAG_TRANSLATION;
ctx->Viewport._WindowMap.type = MATRIX_3D_NO_ROT;
ctx->NewState |= _NEW_VIEWPORT;
@@ -636,10 +639,13 @@ _mesa_DepthRange( GLclampd nearval, GLclampd farval )
* specifies a linear mapping of the normalized z coords in
* this range to window z coords.
*/
+ GLfloat depthMax;
GLfloat n, f;
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+ depthMax = ctx->DrawBuffer->_DepthMaxF;
+
if (MESA_VERBOSE&VERBOSE_API)
_mesa_debug(ctx, "glDepthRange %f %f\n", nearval, farval);
@@ -648,8 +654,8 @@ _mesa_DepthRange( GLclampd nearval, GLclampd farval )
ctx->Viewport.Near = n;
ctx->Viewport.Far = f;
- ctx->Viewport._WindowMap.m[MAT_SZ] = ctx->DepthMaxF * ((f - n) / 2.0F);
- ctx->Viewport._WindowMap.m[MAT_TZ] = ctx->DepthMaxF * ((f - n) / 2.0F + n);
+ ctx->Viewport._WindowMap.m[MAT_SZ] = depthMax * ((f - n) / 2.0F);
+ ctx->Viewport._WindowMap.m[MAT_TZ] = depthMax * ((f - n) / 2.0F + n);
ctx->NewState |= _NEW_VIEWPORT;
if (ctx->Driver.DepthRange) {
@@ -919,12 +925,14 @@ void _mesa_init_viewport( GLcontext *ctx )
ctx->Viewport.Far = 1.0;
_math_matrix_ctr(&ctx->Viewport._WindowMap);
+#if 0000
#define Sz 10
#define Tz 14
ctx->Viewport._WindowMap.m[Sz] = 0.5F * ctx->DepthMaxF;
ctx->Viewport._WindowMap.m[Tz] = 0.5F * ctx->DepthMaxF;
#undef Sz
#undef Tz
+#endif
ctx->Viewport._WindowMap.flags = MAT_FLAG_GENERAL_SCALE|MAT_FLAG_TRANSLATION;
ctx->Viewport._WindowMap.type = MATRIX_3D_NO_ROT;