aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_context.c2
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_context.h9
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_state.c22
-rw-r--r--src/mesa/drivers/dri/nouveau/nv10_state.c18
-rw-r--r--src/mesa/drivers/dri/nouveau/nv20_state.c5
-rw-r--r--src/mesa/drivers/dri/nouveau/nv30_state.c5
-rw-r--r--src/mesa/drivers/dri/nouveau/nv50_state.c5
7 files changed, 32 insertions, 34 deletions
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.c b/src/mesa/drivers/dri/nouveau/nouveau_context.c
index ae0a6d5c9e7..0f7bd4aa074 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_context.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_context.c
@@ -210,7 +210,7 @@ GLboolean nouveauCreateContext( const __GLcontextModes *glVisual,
_swsetup_CreateContext( ctx );
_math_matrix_ctr(&nmesa->viewport);
- _math_matrix_ctr(&nmesa->model_proj);
+ _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 94d729daef1..51666ef91c2 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_context.h
+++ b/src/mesa/drivers/dri/nouveau/nouveau_context.h
@@ -88,7 +88,10 @@ typedef struct nouveau_hw_func_t {
void (*WindowMoved)(struct nouveau_context *);
/* Update projection matrix */
- void (*UpdateModelProjMatrix)(struct nouveau_context *);
+ void (*UpdateProjectionMatrix)(GLcontext *);
+
+ /* Update modelview matrix (used for lighting and vertex weight) */
+ void (*UpdateModelviewMatrix)(GLcontext *);
} nouveau_hw_func;
typedef struct nouveau_context {
@@ -120,8 +123,8 @@ typedef struct nouveau_context {
GLuint color_offset;
GLuint specular_offset;
- /* Projection*modelview matrix */
- GLmatrix model_proj;
+ /* Projection matrix */
+ GLmatrix projection;
/* Vertex state */
GLuint vertex_size;
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_state.c b/src/mesa/drivers/dri/nouveau/nouveau_state.c
index 6c63b12c469..9e64a7010ef 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_state.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_state.c
@@ -100,14 +100,12 @@ static void nouveauDepthRange(GLcontext *ctx, GLclampd near, GLclampd far)
nouveauCalcViewport(ctx);
}
-static void nouveauUpdateModelProjMatrix(GLcontext *ctx)
+static void nouveauUpdateProjectionMatrix(GLcontext *ctx)
{
- nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx);
-
- _math_matrix_mul_matrix(&(nmesa->model_proj), &(ctx->_ModelProjectMatrix),
- ctx->ModelviewMatrixStack.Top);
+}
- nmesa->hw_func.UpdateModelProjMatrix(nmesa);
+static void nouveauUpdateModelviewMatrix(GLcontext *ctx)
+{
}
static void nouveauDDUpdateHWState(GLcontext *ctx)
@@ -151,11 +149,13 @@ static void nouveauDDUpdateHWState(GLcontext *ctx)
static void nouveauDDInvalidateState(GLcontext *ctx, GLuint new_state)
{
+ nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx);
+
if ( new_state & _NEW_PROJECTION ) {
- nouveauUpdateModelProjMatrix(ctx);
+ nmesa->hw_func.UpdateProjectionMatrix(ctx);
}
if ( new_state & _NEW_MODELVIEW ) {
- nouveauUpdateModelProjMatrix(ctx);
+ nmesa->hw_func.UpdateModelviewMatrix(ctx);
}
_swrast_InvalidateState( ctx, new_state );
@@ -203,6 +203,8 @@ void nouveauDDInitState(nouveauContextPtr nmesa)
/* Initialize the driver's state functions */
void nouveauDDInitStateFuncs(GLcontext *ctx)
{
+ nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx);
+
ctx->Driver.UpdateState = nouveauDDInvalidateState;
ctx->Driver.ClearIndex = NULL;
@@ -253,6 +255,10 @@ void nouveauDDInitStateFuncs(GLcontext *ctx)
ctx->Driver.CopyColorSubTable = _swrast_CopyColorSubTable;
ctx->Driver.CopyConvolutionFilter1D = _swrast_CopyConvolutionFilter1D;
ctx->Driver.CopyConvolutionFilter2D = _swrast_CopyConvolutionFilter2D;
+
+ /* Matrix updates */
+ nmesa->hw_func.UpdateProjectionMatrix = nouveauUpdateProjectionMatrix;
+ nmesa->hw_func.UpdateModelviewMatrix = nouveauUpdateModelviewMatrix;
}
#define STATE_INIT(a) if (ctx->Driver.a) ctx->Driver.a
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;
}
diff --git a/src/mesa/drivers/dri/nouveau/nv20_state.c b/src/mesa/drivers/dri/nouveau/nv20_state.c
index c6efa6b72c9..6b583980a49 100644
--- a/src/mesa/drivers/dri/nouveau/nv20_state.c
+++ b/src/mesa/drivers/dri/nouveau/nv20_state.c
@@ -636,10 +636,6 @@ static void nv20TextureMatrix(GLcontext *ctx, GLuint unit, const GLmatrix *mat)
OUT_RING_CACHEp(mat->m, 16);
}
-static void nv20UpdateModelProjMatrix(nouveauContextPtr nmesa)
-{
-}
-
/* Update anything that depends on the window position/size */
static void nv20WindowMoved(nouveauContextPtr nmesa)
{
@@ -824,6 +820,5 @@ void nv20InitStateFuncs(GLcontext *ctx, struct dd_function_table *func)
nmesa->hw_func.InitCard = nv20InitCard;
nmesa->hw_func.BindBuffers = nv20BindBuffers;
nmesa->hw_func.WindowMoved = nv20WindowMoved;
- nmesa->hw_func.UpdateModelProjMatrix = nv20UpdateModelProjMatrix;
}
diff --git a/src/mesa/drivers/dri/nouveau/nv30_state.c b/src/mesa/drivers/dri/nouveau/nv30_state.c
index ebd9e1c5145..cd3ee986880 100644
--- a/src/mesa/drivers/dri/nouveau/nv30_state.c
+++ b/src/mesa/drivers/dri/nouveau/nv30_state.c
@@ -767,10 +767,6 @@ static void nv30TextureMatrix(GLcontext *ctx, GLuint unit, const GLmatrix *mat)
}
}
-static void nv30UpdateModelProjMatrix(nouveauContextPtr nmesa)
-{
-}
-
static void nv30WindowMoved(nouveauContextPtr nmesa)
{
GLcontext *ctx = nmesa->glCtx;
@@ -1002,6 +998,5 @@ void nv30InitStateFuncs(GLcontext *ctx, struct dd_function_table *func)
nmesa->hw_func.InitCard = nv30InitCard;
nmesa->hw_func.BindBuffers = nv30BindBuffers;
nmesa->hw_func.WindowMoved = nv30WindowMoved;
- nmesa->hw_func.UpdateModelProjMatrix = nv30UpdateModelProjMatrix;
}
diff --git a/src/mesa/drivers/dri/nouveau/nv50_state.c b/src/mesa/drivers/dri/nouveau/nv50_state.c
index 66a18c4a156..a9236f093c3 100644
--- a/src/mesa/drivers/dri/nouveau/nv50_state.c
+++ b/src/mesa/drivers/dri/nouveau/nv50_state.c
@@ -520,10 +520,6 @@ static void nv50TextureMatrix(GLcontext *ctx, GLuint unit, const GLmatrix *mat)
/* Only with shaders */
}
-static void nv50UpdateModelProjMatrix(nouveauContextPtr nmesa)
-{
-}
-
static void nv50WindowMoved(nouveauContextPtr nmesa)
{
GLcontext *ctx = nmesa->glCtx;
@@ -642,5 +638,4 @@ void nv50InitStateFuncs(GLcontext *ctx, struct dd_function_table *func)
nmesa->hw_func.InitCard = nv50InitCard;
nmesa->hw_func.BindBuffers = nv50BindBuffers;
nmesa->hw_func.WindowMoved = nv50WindowMoved;
- nmesa->hw_func.UpdateModelProjMatrix = nv50UpdateModelProjMatrix;
}