nouveau: a couple of NV3x fixes

This commit is contained in:
Ben Skeggs 2007-02-06 13:49:39 +11:00
parent 8518ddda7b
commit f46c19d965
5 changed files with 45 additions and 5 deletions

View file

@ -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;

View file

@ -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;

View file

@ -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

View file

@ -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

View file

@ -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;
}