summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Olšák <maraeo@gmail.com>2011-06-09 04:23:14 +0200
committerMarek Olšák <maraeo@gmail.com>2011-06-09 04:23:14 +0200
commite5408efb20327c46fe67d35e18348ddd6300e282 (patch)
treed155eaf84d3140e36d08069ff5168bdf7d470b26
parent8f8d7d0803a51d2f88493042b31fbf99ccf62f47 (diff)
r300g: fix texturing with non-3D textures and wrap R mode set to sample border
If the wrap R (3rd) mode is set to CLAMP or CLAMP_TO_BORDER and the texture isn't 3D, r300 always samples the border color regardless of texture coordinates. I HATE THIS HARDWARE. NOTE: This is a candidate for the 7.10 branch. (cherry picked from commit da8b4c07986e202b0596b729a5eec31c9aec5fcc) Conflicts: src/gallium/drivers/r300/r300_state_derived.c
-rw-r--r--src/gallium/drivers/r300/r300_state_derived.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c
index d5fc8ece252..e833d3d4bad 100644
--- a/src/gallium/drivers/r300/r300_state_derived.c
+++ b/src/gallium/drivers/r300/r300_state_derived.c
@@ -782,6 +782,12 @@ static void r300_merge_textures_and_samplers(struct r300_context* r300)
texstate->filter0 |= R300_TX_WRAP_T(R300_TX_CLAMP_TO_EDGE);
}
+ /* The hardware doesn't like CLAMP and CLAMP_TO_BORDER
+ * for the 3rd coordinate if the texture isn't 3D. */
+ if (tex->desc.b.b.target != PIPE_TEXTURE_3D) {
+ texstate->filter0 &= ~R300_TX_WRAP_R_MASK;
+ }
+
if (tex->desc.is_npot) {
/* NPOT textures don't support mip filter, unfortunately.
* This prevents incorrect rendering. */