nouveauShader *current_fragprog;
nouveauShader *current_vertprog;
nouveauShader *passthrough_vp;
+ nouveauShader *passthrough_fp;
nouveauScreenRec *screen;
drm_nouveau_sarea_t *sarea;
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)
{
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;
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
*/
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
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);
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;
}