vec[1] = 1.0 / tex->height0;
break;
- /* Texture compare-fail value. Shouldn't ever show up, but if
- * it does, we'll be ready. */
- case RC_STATE_SHADOW_AMBIENT:
- vec[3] = 0;
- break;
-
case RC_STATE_R300_VIEWPORT_SCALE:
vec[0] = viewport->xscale;
vec[1] = viewport->yscale;
struct r300_fragment_program_compiler {
struct radeon_compiler Base;
struct rX00_fragment_program_code *code;
+ /* Optional transformations and features. */
struct r300_fragment_program_external_state state;
+ unsigned enable_shadow_ambient;
+ /* Hardware specification. */
unsigned is_r500;
unsigned max_temp_regs;
/* Register corresponding to the depthbuffer. */
/* Series of transformations to be done on textures. */
-static struct rc_src_register shadow_ambient(struct radeon_compiler * c, int tmu)
+static struct rc_src_register shadow_ambient(struct r300_fragment_program_compiler *compiler,
+ int tmu)
{
struct rc_src_register reg = { 0, };
- reg.File = RC_FILE_CONSTANT;
- reg.Index = rc_constants_add_state(&c->Program.Constants, RC_STATE_SHADOW_AMBIENT, tmu);
- reg.Swizzle = RC_SWIZZLE_WWWW;
+ if (compiler->enable_shadow_ambient) {
+ reg.File = RC_FILE_CONSTANT;
+ reg.Index = rc_constants_add_state(&compiler->Base.Program.Constants,
+ RC_STATE_SHADOW_AMBIENT, tmu);
+ reg.Swizzle = RC_SWIZZLE_WWWW;
+ } else {
+ reg.File = RC_FILE_NONE;
+ reg.Swizzle = RC_SWIZZLE_0000;
+ }
return reg;
}
inst->U.I.SrcReg[0].File = RC_FILE_NONE;
inst->U.I.SrcReg[0].Swizzle = RC_SWIZZLE_1111;
} else {
- inst->U.I.SrcReg[0] = shadow_ambient(c, inst->U.I.TexSrcUnit);
+ inst->U.I.SrcReg[0] = shadow_ambient(compiler, inst->U.I.TexSrcUnit);
}
return 1;
inst_cmp->U.I.SrcReg[pass].File = RC_FILE_NONE;
inst_cmp->U.I.SrcReg[pass].Swizzle = RC_SWIZZLE_1111;
- inst_cmp->U.I.SrcReg[fail] = shadow_ambient(c, inst->U.I.TexSrcUnit);
+ inst_cmp->U.I.SrcReg[fail] = shadow_ambient(compiler, inst->U.I.TexSrcUnit);
}
}
compiler.Base.Program.InputsRead = (1 << FRAG_ATTRIB_TEX0);
compiler.OutputColor[0] = FRAG_RESULT_COLOR;
compiler.OutputDepth = FRAG_RESULT_DEPTH;
+ compiler.enable_shadow_ambient = GL_TRUE;
compiler.is_r500 = (r300->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV515);
compiler.max_temp_regs = (compiler.is_r500) ? 128 : 32;
compiler.code = &r300->blit.fp_code;
compiler.code = &fp->code;
compiler.state = fp->state;
+ compiler.enable_shadow_ambient = GL_TRUE;
compiler.is_r500 = (r300->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV515) ? GL_TRUE : GL_FALSE;
compiler.max_temp_regs = (compiler.is_r500) ? 128 : 32;
compiler.OutputDepth = FRAG_RESULT_DEPTH;