From 71584d0cc75dda3c579a2a0cb6c1ac9591f7d5c9 Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Sat, 8 May 2010 18:51:03 +0200 Subject: r300g: pass depth texture swizzle to the compiler if compare mode is enabled --- src/gallium/drivers/r300/r300_fs.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src/gallium/drivers/r300/r300_fs.c') diff --git a/src/gallium/drivers/r300/r300_fs.c b/src/gallium/drivers/r300/r300_fs.c index 19023457bf..30aa065139 100644 --- a/src/gallium/drivers/r300/r300_fs.c +++ b/src/gallium/drivers/r300/r300_fs.c @@ -137,6 +137,7 @@ static void get_external_state( { struct r300_textures_state *texstate = r300->textures_state.state; unsigned i; + unsigned char *swizzle; for (i = 0; i < texstate->sampler_state_count; i++) { struct r300_sampler_state* s = texstate->sampler_states[i]; @@ -148,9 +149,16 @@ static void get_external_state( if (s->state.compare_mode == PIPE_TEX_COMPARE_R_TO_TEXTURE) { state->unit[i].compare_mode_enabled = 1; - /* XXX Gallium doesn't provide us with any information regarding - * this mode, so we are screwed. Let's set INTENSITY for now. */ - state->unit[i].depth_texture_swizzle = RC_SWIZZLE_XYZW; + /* Pass depth texture swizzling to the compiler. */ + if (texstate->sampler_views[i]) { + swizzle = texstate->sampler_views[i]->swizzle; + + state->unit[i].depth_texture_swizzle = + RC_MAKE_SWIZZLE(swizzle[0], swizzle[1], + swizzle[2], swizzle[3]); + } else { + state->unit[i].depth_texture_swizzle = RC_SWIZZLE_XYZW; + } /* Fortunately, no need to translate this. */ state->unit[i].texture_compare_func = s->state.compare_func; -- cgit v1.2.3