diff options
Diffstat (limited to 'src/mesa/drivers/dri/r300/compiler')
-rw-r--r-- | src/mesa/drivers/dri/r300/compiler/radeon_compiler.h | 3 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r300/compiler/radeon_program_tex.c | 19 |
2 files changed, 16 insertions, 6 deletions
diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_compiler.h b/src/mesa/drivers/dri/r300/compiler/radeon_compiler.h index 934ae28da5..09794a52ad 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_compiler.h +++ b/src/mesa/drivers/dri/r300/compiler/radeon_compiler.h @@ -81,7 +81,10 @@ void rc_transform_fragment_wpos(struct radeon_compiler * c, unsigned wpos, unsig 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. */ diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_program_tex.c b/src/mesa/drivers/dri/r300/compiler/radeon_program_tex.c index 967fd74b00..200c1f710b 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_program_tex.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_program_tex.c @@ -31,13 +31,20 @@ /* 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; } @@ -102,7 +109,7 @@ int radeonTransformTEX( 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; @@ -164,7 +171,7 @@ int radeonTransformTEX( 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); } } |