summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2010-04-10 19:00:10 +0200
committerMarek Olšák <[email protected]>2010-04-10 19:00:10 +0200
commitcd499e76123f075c3201058f5fcda66425c4e5a8 (patch)
treefbbad1a294d8ff4e836a42d27099a99dc7788ec6 /src
parent287c94ea4987033f9c99a2f91c5750c9083504ca (diff)
r300g: use clamp-to-edge instead of repeat/mirrored-repeat for NPOT textures
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/r300/r300_state_derived.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c
index ae54d06372f..ade603a47cf 100644
--- a/src/gallium/drivers/r300/r300_state_derived.c
+++ b/src/gallium/drivers/r300/r300_state_derived.c
@@ -493,6 +493,25 @@ static void r300_merge_textures_and_samplers(struct r300_context* r300)
/* NPOT textures don't support mip filter, unfortunately.
* This prevents incorrect rendering. */
texstate->filter[0] &= ~R300_TX_MIN_FILTER_MIP_MASK;
+
+ /* Set repeat or mirrored-repeat to clamp-to-edge. */
+ /* Wrap S. */
+ if ((texstate->filter[0] & R300_TX_WRAP_S_MASK) ==
+ R300_TX_WRAP_S(R300_TX_REPEAT) ||
+ (texstate->filter[0] & R300_TX_WRAP_S_MASK) ==
+ R300_TX_WRAP_S(R300_TX_MIRRORED)) {
+ texstate->filter[0] &= ~R300_TX_WRAP_S_MASK;
+ texstate->filter[0] |= R300_TX_WRAP_S(R300_TX_CLAMP_TO_EDGE);
+ }
+
+ /* Wrap T. */
+ if ((texstate->filter[0] & R300_TX_WRAP_T_MASK) ==
+ R300_TX_WRAP_T(R300_TX_REPEAT) ||
+ (texstate->filter[0] & R300_TX_WRAP_T_MASK) ==
+ R300_TX_WRAP_T(R300_TX_MIRRORED)) {
+ texstate->filter[0] &= ~R300_TX_WRAP_T_MASK;
+ texstate->filter[0] |= R300_TX_WRAP_T(R300_TX_CLAMP_TO_EDGE);
+ }
} else {
/* determine min/max levels */
/* the MAX_MIP level is the largest (finest) one */