diff options
author | Ben Skeggs <darktama@iinet.net.au> | 2007-02-06 13:49:39 +1100 |
---|---|---|
committer | Ben Skeggs <darktama@iinet.net.au> | 2007-02-06 14:01:19 +1100 |
commit | f46c19d965fb05a49d361aa251e37b5ef32dd839 (patch) | |
tree | 9e160130ba52028e37373d118aad5f7f539d8aac /src/mesa/drivers/dri/nouveau | |
parent | 8518ddda7b5f8e43de4859042fe59f55aa0c2760 (diff) |
nouveau: a couple of NV3x fixes
Diffstat (limited to 'src/mesa/drivers/dri/nouveau')
-rw-r--r-- | src/mesa/drivers/dri/nouveau/nouveau_context.h | 1 | ||||
-rw-r--r-- | src/mesa/drivers/dri/nouveau/nouveau_shader.c | 19 | ||||
-rw-r--r-- | src/mesa/drivers/dri/nouveau/nv10_swtcl.c | 10 | ||||
-rw-r--r-- | src/mesa/drivers/dri/nouveau/nv30_fragprog.c | 15 | ||||
-rw-r--r-- | src/mesa/drivers/dri/nouveau/nv30_state.c | 5 |
5 files changed, 45 insertions, 5 deletions
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.h b/src/mesa/drivers/dri/nouveau/nouveau_context.h index c1d06654ee..f61fcbb48c 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_context.h +++ b/src/mesa/drivers/dri/nouveau/nouveau_context.h @@ -159,6 +159,7 @@ typedef struct nouveau_context { nouveauShader *current_fragprog; nouveauShader *current_vertprog; nouveauShader *passthrough_vp; + nouveauShader *passthrough_fp; nouveauScreenRec *screen; drm_nouveau_sarea_t *sarea; diff --git a/src/mesa/drivers/dri/nouveau/nouveau_shader.c b/src/mesa/drivers/dri/nouveau/nouveau_shader.c index c78b72bd11..ba471325aa 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_shader.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_shader.c @@ -220,6 +220,21 @@ nvsBuildPassthroughVP(GLcontext *ctx) vp_text); } +static void +nvsBuildPassthroughFP(GLcontext *ctx) +{ + nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx); + + const char *fp_text = + "!!ARBfp1.0\n" + "MOV result.color, fragment.color;\n" + "END"; + + nmesa->passthrough_fp = nvsBuildTextShader(ctx, + GL_FRAGMENT_PROGRAM_ARB, + fp_text); +} + void nouveauShaderInitFuncs(GLcontext * ctx) { @@ -249,6 +264,10 @@ nouveauShaderInitFuncs(GLcontext * ctx) if (nmesa->screen->card->type >= NV_40) nvsBuildPassthroughVP(ctx); + /* Needed on NV30, even when using swtcl, if you want to get colours */ + if (nmesa->screen->card->type >= NV_30) + nvsBuildPassthroughFP(ctx); + ctx->Const.VertexProgram.MaxNativeInstructions = nmesa->VPfunc.MaxInst; ctx->Const.VertexProgram.MaxNativeAluInstructions = nmesa->VPfunc.MaxInst; ctx->Const.VertexProgram.MaxNativeTexInstructions = nmesa->VPfunc.MaxInst; diff --git a/src/mesa/drivers/dri/nouveau/nv10_swtcl.c b/src/mesa/drivers/dri/nouveau/nv10_swtcl.c index eec67bd805..32da40661b 100644 --- a/src/mesa/drivers/dri/nouveau/nv10_swtcl.c +++ b/src/mesa/drivers/dri/nouveau/nv10_swtcl.c @@ -527,6 +527,16 @@ static void nv10ChooseVertexState( GLcontext *ctx ) nv10OutputVertexFormat(nmesa); } + if (nmesa->screen->card->type == NV_30) { + nouveauShader *fp; + + if (ctx->FragmentProgram.Enabled) { + fp = (nouveauShader *) ctx->FragmentProgram.Current; + nvsUpdateShader(ctx, fp); + } else + nvsUpdateShader(ctx, nmesa->passthrough_fp); + } + if (nmesa->screen->card->type >= NV_40) { /* Ensure passthrough shader is being used, and mvp matrix * is up to date diff --git a/src/mesa/drivers/dri/nouveau/nv30_fragprog.c b/src/mesa/drivers/dri/nouveau/nv30_fragprog.c index f868ec9293..e32452361e 100644 --- a/src/mesa/drivers/dri/nouveau/nv30_fragprog.c +++ b/src/mesa/drivers/dri/nouveau/nv30_fragprog.c @@ -46,9 +46,18 @@ NV30FPUploadToHW(GLcontext *ctx, nouveauShader *nvs) */ BEGIN_RING_SIZE(NvSub3D, NV30_TCL_PRIMITIVE_3D_FP_ACTIVE_PROGRAM, 1); OUT_RING (offset | 1); - BEGIN_RING_SIZE(NvSub3D, 0x1d60 /*NV30_TCL_PRIMITIVE_3D_FP_CONTROL*/, 1); - OUT_RING ((priv->NV30FP.uses_kil << 7) | - (priv->NV30FP.num_regs << 24)); + if (nmesa->screen->card->type == NV_30) { + BEGIN_RING_SIZE(NvSub3D, + 0x1d60 /*NV30_TCL_PRIMITIVE_3D_FP_CONTROL*/, 1); + OUT_RING ((priv->NV30FP.uses_kil << 7)); + BEGIN_RING_SIZE(NvSub3D, 0x1450, 1); + OUT_RING (priv->NV30FP.num_regs << 16); + } else { + BEGIN_RING_SIZE(NvSub3D, + 0x1d60 /*NV30_TCL_PRIMITIVE_3D_FP_CONTROL*/, 1); + OUT_RING ((priv->NV30FP.uses_kil << 7) | + (priv->NV30FP.num_regs << 24)); + } } static void diff --git a/src/mesa/drivers/dri/nouveau/nv30_state.c b/src/mesa/drivers/dri/nouveau/nv30_state.c index 96a07fd536..ad21fa2730 100644 --- a/src/mesa/drivers/dri/nouveau/nv30_state.c +++ b/src/mesa/drivers/dri/nouveau/nv30_state.c @@ -811,8 +811,6 @@ static GLboolean nv30InitCard(nouveauContextPtr nmesa) OUT_RING(0); BEGIN_RING_SIZE(NvSub3D, 0x1d80, 1); OUT_RING(3); - BEGIN_RING_SIZE(NvSub3D, 0x1450, 1); - OUT_RING(0x00030004); /* NEW */ BEGIN_RING_SIZE(NvSub3D, 0x1e98, 1); @@ -840,6 +838,9 @@ static GLboolean nv30InitCard(nouveauContextPtr nmesa) BEGIN_RING_SIZE(NvSub3D, 0x1d88, 1); OUT_RING(0x00001200); + BEGIN_RING_SIZE(NvSub3D, NV30_TCL_PRIMITIVE_3D_RC_ENABLE, 1); + OUT_RING (0); + return GL_TRUE; } |