aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/nouveau/nv10_state.c
diff options
context:
space:
mode:
authorPatrice Mandin <[email protected]>2007-09-03 23:08:57 +0200
committerPatrice Mandin <[email protected]>2007-09-03 23:10:55 +0200
commitc45bb05b3c0b65981b6ddeaf1bb043b9a6f7f3fc (patch)
tree633e8c3b4b675850806713146a0458e171993db1 /src/mesa/drivers/dri/nouveau/nv10_state.c
parentcb7da3f09655f9c66eabb6a38f581c9176980cd2 (diff)
nouveau: separate modelview and projection matrix updates
Diffstat (limited to 'src/mesa/drivers/dri/nouveau/nv10_state.c')
-rw-r--r--src/mesa/drivers/dri/nouveau/nv10_state.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/mesa/drivers/dri/nouveau/nv10_state.c b/src/mesa/drivers/dri/nouveau/nv10_state.c
index bdfc75b8750..f9a83567724 100644
--- a/src/mesa/drivers/dri/nouveau/nv10_state.c
+++ b/src/mesa/drivers/dri/nouveau/nv10_state.c
@@ -736,9 +736,9 @@ static void nv10TextureMatrix(GLcontext *ctx, GLuint unit, const GLmatrix *mat)
OUT_RING_CACHEp(mat->m, 16);
}
-static void nv10UpdateModelProjMatrix(nouveauContextPtr nmesa)
+static void nv10UpdateProjectionMatrix(GLcontext *ctx)
{
- GLcontext *ctx = nmesa->glCtx;
+ nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx);
GLfloat w = ((GLfloat) ctx->Viewport.Width) * 0.5;
GLfloat h = ((GLfloat) ctx->Viewport.Height) * 0.5;
GLfloat max_depth = (ctx->Viewport.Near + ctx->Viewport.Far) * 0.5;
@@ -758,18 +758,22 @@ static void nv10UpdateModelProjMatrix(nouveauContextPtr nmesa)
}
}
+ /* Calc projection * modelview */
+ _math_matrix_mul_matrix(&(nmesa->projection), &(ctx->_ModelProjectMatrix),
+ ctx->ModelviewMatrixStack.Top);
+
/* Rescale for viewport */
for (i=0; i<4; i++) {
- projection[i] = w * nmesa->model_proj.m[i];
+ projection[i] = w * nmesa->projection.m[i];
}
for (i=0; i<4; i++) {
- projection[i+4] = -h * nmesa->model_proj.m[i+4];
+ projection[i+4] = -h * nmesa->projection.m[i+4];
}
for (i=0; i<4; i++) {
- projection[i+8] = max_depth * nmesa->model_proj.m[i+8];
+ projection[i+8] = max_depth * nmesa->projection.m[i+8];
}
for (i=0; i<4; i++) {
- projection[i+12] = nmesa->model_proj.m[i+12];
+ projection[i+12] = nmesa->projection.m[i+12];
}
BEGIN_RING_SIZE(NvSub3D, NV10_TCL_PRIMITIVE_3D_PROJECTION_MATRIX(0), 16);
@@ -1037,5 +1041,5 @@ void nv10InitStateFuncs(GLcontext *ctx, struct dd_function_table *func)
nmesa->hw_func.InitCard = nv10InitCard;
nmesa->hw_func.BindBuffers = nv10BindBuffers;
nmesa->hw_func.WindowMoved = nv10WindowMoved;
- nmesa->hw_func.UpdateModelProjMatrix = nv10UpdateModelProjMatrix;
+ nmesa->hw_func.UpdateProjectionMatrix = nv10UpdateProjectionMatrix;
}