summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/i915simple/i915_state.c
diff options
context:
space:
mode:
authorKeith Whitwell <keith@tungstengraphics.com>2008-03-12 10:39:25 +0000
committerKeith Whitwell <keith@tungstengraphics.com>2008-03-12 10:42:49 +0000
commit98ae83d5cc73b61826823c915b5c59746c2e85c7 (patch)
treeeb1913d0641329b9b4a8618227af34f354eb71a8 /src/gallium/drivers/i915simple/i915_state.c
parentfeb02084a88ca6e23c34fa06e963765c890f0b65 (diff)
gallium: Add TEX_FILTER_ANISO img filter
Hardware almost universally expects us to set a special filtering mode when anisotropic filtering is enabled, as opposed to varying a max-aniso values. Do this once in the state tracker & simplify the driver code.
Diffstat (limited to 'src/gallium/drivers/i915simple/i915_state.c')
-rw-r--r--src/gallium/drivers/i915simple/i915_state.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/src/gallium/drivers/i915simple/i915_state.c b/src/gallium/drivers/i915simple/i915_state.c
index d9ab483bfc..57b195ea8d 100644
--- a/src/gallium/drivers/i915simple/i915_state.c
+++ b/src/gallium/drivers/i915simple/i915_state.c
@@ -71,6 +71,8 @@ static unsigned translate_img_filter( unsigned filter )
return FILTER_NEAREST;
case PIPE_TEX_FILTER_LINEAR:
return FILTER_LINEAR;
+ case PIPE_TEX_FILTER_ANISO:
+ return FILTER_ANISOTROPIC;
default:
assert(0);
return FILTER_NEAREST;
@@ -84,7 +86,7 @@ static unsigned translate_mip_filter( unsigned filter )
return MIPFILTER_NONE;
case PIPE_TEX_MIPFILTER_NEAREST:
return MIPFILTER_NEAREST;
- case PIPE_TEX_FILTER_LINEAR:
+ case PIPE_TEX_MIPFILTER_LINEAR:
return MIPFILTER_LINEAR;
default:
assert(0);
@@ -211,16 +213,11 @@ i915_create_sampler_state(struct pipe_context *pipe,
cso->templ = sampler;
mipFilt = translate_mip_filter(sampler->min_mip_filter);
- if (sampler->max_anisotropy > 1.0) {
- minFilt = FILTER_ANISOTROPIC;
- magFilt = FILTER_ANISOTROPIC;
- if (sampler->max_anisotropy > 2.0) {
- cso->state[0] |= SS2_MAX_ANISO_4;
- }
- }
- else {
- minFilt = translate_img_filter( sampler->min_img_filter );
- magFilt = translate_img_filter( sampler->mag_img_filter );
+ minFilt = translate_img_filter( sampler->min_img_filter );
+ magFilt = translate_img_filter( sampler->mag_img_filter );
+
+ if (sampler->max_anisotropy > 2.0) {
+ cso->state[0] |= SS2_MAX_ANISO_4;
}
{