Mesa (master): r300g: respect compare mode regardless of sampler type
Marek Olšák
mareko at kemper.freedesktop.org
Sat May 8 21:25:51 UTC 2010
Module: Mesa
Branch: master
Commit: 78e881368b392d8a6945990c20493560fcd73231
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=78e881368b392d8a6945990c20493560fcd73231
Author: Marek Olšák <maraeo at gmail.com>
Date: Sat May 8 05:59:28 2010 +0200
r300g: respect compare mode regardless of sampler type
---
src/gallium/drivers/r300/r300_fs.c | 2 ++
src/mesa/drivers/dri/r300/compiler/radeon_code.h | 6 ++++++
.../drivers/dri/r300/compiler/radeon_program_tex.c | 3 ++-
3 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/src/gallium/drivers/r300/r300_fs.c b/src/gallium/drivers/r300/r300_fs.c
index 5173e2c..1902345 100644
--- a/src/gallium/drivers/r300/r300_fs.c
+++ b/src/gallium/drivers/r300/r300_fs.c
@@ -146,6 +146,8 @@ 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;
diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_code.h b/src/mesa/drivers/dri/r300/compiler/radeon_code.h
index 17703a9..1979e7e 100644
--- a/src/mesa/drivers/dri/r300/compiler/radeon_code.h
+++ b/src/mesa/drivers/dri/r300/compiler/radeon_code.h
@@ -144,6 +144,12 @@ struct r300_fragment_program_external_state {
unsigned texture_compare_func : 3;
/**
+ * No matter what the sampler type is,
+ * this field turns it into a shadow sampler.
+ */
+ unsigned compare_mode_enabled : 1;
+
+ /**
* If the sampler needs to fake NPOT, this field is set.
*/
unsigned fake_npot : 1;
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 53154f7..42c08cd 100644
--- a/src/mesa/drivers/dri/r300/compiler/radeon_program_tex.c
+++ b/src/mesa/drivers/dri/r300/compiler/radeon_program_tex.c
@@ -97,7 +97,8 @@ int radeonTransformTEX(
/* ARB_shadow & EXT_shadow_funcs */
if (inst->U.I.Opcode != RC_OPCODE_KIL &&
- c->Program.ShadowSamplers & (1 << inst->U.I.TexSrcUnit)) {
+ ((c->Program.ShadowSamplers & (1 << inst->U.I.TexSrcUnit)) ||
+ (compiler->state.unit[inst->U.I.TexSrcUnit].compare_mode_enabled))) {
rc_compare_func comparefunc = compiler->state.unit[inst->U.I.TexSrcUnit].texture_compare_func;
if (comparefunc == RC_COMPARE_FUNC_NEVER || comparefunc == RC_COMPARE_FUNC_ALWAYS) {
More information about the mesa-commit
mailing list