summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/r300/r300_state.c
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2009-11-14 23:27:20 +0100
committerCorbin Simpson <[email protected]>2009-11-20 17:58:13 -0800
commitb7078a88119e248b0196f7446abe029c22f1ee28 (patch)
tree7a52ddadbaca3266017bc818cb7598f0b5c12ff5 /src/gallium/drivers/r300/r300_state.c
parent1c181a7eff96816b5d72ea5daab5818eef0ebc60 (diff)
r300g: add texture lod clamping
These now work: piglit/lodclamp piglit/levelclamp
Diffstat (limited to 'src/gallium/drivers/r300/r300_state.c')
-rw-r--r--src/gallium/drivers/r300/r300_state.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c
index 5422a2cc9c8..f2867675f0f 100644
--- a/src/gallium/drivers/r300/r300_state.c
+++ b/src/gallium/drivers/r300/r300_state.c
@@ -523,6 +523,11 @@ static void*
state->mag_img_filter,
state->min_mip_filter);
+ /* Unfortunately, r300-r500 don't support floating-point mipmap lods. */
+ /* We must pass these to the emit function to clamp them properly. */
+ sampler->min_lod = MAX2((unsigned)state->min_lod, 0);
+ sampler->max_lod = MAX2((unsigned)ceilf(state->max_lod), 0);
+
lod_bias = CLAMP((int)(state->lod_bias * 32), -(1 << 9), (1 << 9) - 1);
sampler->filter1 |= lod_bias << R300_LOD_BIAS_SHIFT;