From: Patrice Mandin Date: Tue, 4 Sep 2007 17:13:07 +0000 (+0200) Subject: nouveau: nv10: need to transpose mesa model+proj matrix for hw X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ece08b7fd9af5ba67afa0a5d8e0a11f688ab4b0f;p=mesa.git nouveau: nv10: need to transpose mesa model+proj matrix for hw --- 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);