aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPatrice Mandin <[email protected]>2007-09-04 19:13:07 +0200
committerPatrice Mandin <[email protected]>2007-09-04 19:17:06 +0200
commitece08b7fd9af5ba67afa0a5d8e0a11f688ab4b0f (patch)
treed61940914ad37b5f157a859d299c0637faeba9b1 /src
parentc2e1ee08b083638a7306e15ca48e9ea516d42dc4 (diff)
nouveau: nv10: need to transpose mesa model+proj matrix for hw
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_context.c1
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_context.h3
-rw-r--r--src/mesa/drivers/dri/nouveau/nv10_state.c15
3 files changed, 5 insertions, 14 deletions
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.c b/src/mesa/drivers/dri/nouveau/nouveau_context.c
index 0f7bd4aa074..1e13324b983 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_context.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_context.c
@@ -210,7 +210,6 @@ GLboolean nouveauCreateContext( const __GLcontextModes *glVisual,
_swsetup_CreateContext( ctx );
_math_matrix_ctr(&nmesa->viewport);
- _math_matrix_ctr(&nmesa->projection);
nouveauDDInitStateFuncs( ctx );
nouveauSpanInitFunctions( ctx );
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.h b/src/mesa/drivers/dri/nouveau/nouveau_context.h
index 51666ef91c2..77fe13a9cdc 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_context.h
+++ b/src/mesa/drivers/dri/nouveau/nouveau_context.h
@@ -123,9 +123,6 @@ typedef struct nouveau_context {
GLuint color_offset;
GLuint specular_offset;
- /* Projection matrix */
- GLmatrix projection;
-
/* Vertex state */
GLuint vertex_size;
GLubyte *verts;
diff --git a/src/mesa/drivers/dri/nouveau/nv10_state.c b/src/mesa/drivers/dri/nouveau/nv10_state.c
index 93fc4ff9364..94525ba2a80 100644
--- a/src/mesa/drivers/dri/nouveau/nv10_state.c
+++ b/src/mesa/drivers/dri/nouveau/nv10_state.c
@@ -40,7 +40,6 @@ static void nv10ViewportScale(nouveauContextPtr nmesa)
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;
- int i;
if (ctx->DrawBuffer) {
if (ctx->DrawBuffer->_DepthBuffer) {
@@ -757,22 +756,18 @@ static void nv10UpdateProjectionMatrix(GLcontext *ctx)
}
}
- /* Calc projection * modelview */
- _math_matrix_mul_matrix(&(nmesa->projection), &(ctx->_ModelProjectMatrix),
- ctx->ModelviewMatrixStack.Top);
-
- /* Rescale for viewport */
+ /* Transpose and rescale for viewport */
for (i=0; i<4; i++) {
- projection[i] = w * nmesa->projection.m[i];
+ projection[i] = w * ctx->_ModelProjectMatrix.m[i*4];
}
for (i=0; i<4; i++) {
- projection[i+4] = -h * nmesa->projection.m[i+4];
+ projection[i+4] = -h * ctx->_ModelProjectMatrix.m[i*4+1];
}
for (i=0; i<4; i++) {
- projection[i+8] = max_depth * nmesa->projection.m[i+8];
+ projection[i+8] = max_depth * ctx->_ModelProjectMatrix.m[i*4+2];
}
for (i=0; i<4; i++) {
- projection[i+12] = nmesa->projection.m[i+12];
+ projection[i+12] = ctx->_ModelProjectMatrix.m[i*4+3];
}
BEGIN_RING_SIZE(NvSub3D, NV10_TCL_PRIMITIVE_3D_PROJECTION_MATRIX(0), 16);