summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/r300/r300_fs.c
diff options
context:
space:
mode:
authorMarek Olšák <maraeo@gmail.com>2010-05-08 18:51:03 +0200
committerMarek Olšák <maraeo@gmail.com>2010-05-08 23:03:45 +0200
commit71584d0cc75dda3c579a2a0cb6c1ac9591f7d5c9 (patch)
treeee6ae2d414a69c87dfbded303b002bf7adad5ae6 /src/gallium/drivers/r300/r300_fs.c
parent78e881368b392d8a6945990c20493560fcd73231 (diff)
r300g: pass depth texture swizzle to the compiler if compare mode is enabled
Diffstat (limited to 'src/gallium/drivers/r300/r300_fs.c')
-rw-r--r--src/gallium/drivers/r300/r300_fs.c14
1 files changed, 11 insertions, 3 deletions
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;