nouveau: nv10: need to transpose mesa model+proj matrix for hw
authorPatrice Mandin <pmandin@caramail.com>
Tue, 4 Sep 2007 17:13:07 +0000 (19:13 +0200)
committerPatrice Mandin <pmandin@caramail.com>
Tue, 4 Sep 2007 17:17:06 +0000 (19:17 +0200)
src/mesa/drivers/dri/nouveau/nouveau_context.c
src/mesa/drivers/dri/nouveau/nouveau_context.h
src/mesa/drivers/dri/nouveau/nv10_state.c

index 0f7bd4aa074e048cbf317b7672259ae6590a85fc..1e13324b9837eb0d6ceaa6dd763b32e84c2f2d0b 100644 (file)
@@ -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 );
index 51666ef91c225ad7ed38e3f097ac07c11abf4ba5..77fe13a9cdc9414f2f88ea954727669a9ff86134 100644 (file)
@@ -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;
index 93fc4ff9364bb402b6149d826d26e07238a7ce6f..94525ba2a80504c7294567ea858690ac3516acd5 100644 (file)
@@ -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);