Zitat von Michel Dänzer <[email protected]>:

diff --git a/src/mesa/state_tracker/st_atom_sampler.c b/src/mesa/state_tracker/st_atom_sampler.c
index 06024ad..0dba553 100644
--- a/src/mesa/state_tracker/st_atom_sampler.c
+++ b/src/mesa/state_tracker/st_atom_sampler.c
@@ -177,8 +177,9 @@ static void convert_sampler(struct st_context *st,
                          sampler->border_color);
     }

-    sampler->max_anisotropy = (msamp->MaxAnisotropy == 1.0 ?
-                              0 : (GLuint) msamp->MaxAnisotropy);
+    sampler->max_anisotropy = MAX2((msamp->MaxAnisotropy == 1.0 ?
+                              0 : (GLuint) msamp->MaxAnisotropy),
+                              st->min_anisotropy);

Might be better to write this something like

float max_anisotropy = MAX2(msamp->MaxAnisotropy, st->min_anisotropy); sampler->max_anisotropy = max_anisotropy == 1.0f ? 0 : max_anisotropy;

This way sampler->max_anisotropy will still end up being 0 even if
st->min_anisotropy is 1.0.



I attached a patch which introduces the global min_anisotropy.
Asking driconf for it is not implemented because I have to think it over how to access the context with only having the st_screen. (this future patch would require the last two ones, so would be nice if they're discussed and applied)
>From 4dab2441e2c63da4b9ec470e5994a81cdf954c3b Mon Sep 17 00:00:00 2001
From: Carl-Philip Haensch <[email protected]>
Date: Fri, 20 May 2011 16:37:07 +0200
Subject: [PATCH 2/2] st/mesa: introduce flag to globally force a minimum level 
of anisotropy

---
 src/gallium/state_trackers/dri/common/dri_screen.c |   21 ++++++++++++-------
 src/mesa/state_tracker/st_atom_sampler.c           |    5 ++-
 src/mesa/state_tracker/st_context.h                |    1 +
 src/mesa/state_tracker/st_manager.c                |    1 +
 4 files changed, 18 insertions(+), 10 deletions(-)

diff --git a/src/gallium/state_trackers/dri/common/dri_screen.c 
b/src/gallium/state_trackers/dri/common/dri_screen.c
index 5931df9..baee00c 100644
--- a/src/gallium/state_trackers/dri/common/dri_screen.c
+++ b/src/gallium/state_trackers/dri/common/dri_screen.c
@@ -42,15 +42,20 @@
 #include "util/u_debug.h"
 
 PUBLIC const char __driConfigOptions[] =
-   DRI_CONF_BEGIN DRI_CONF_SECTION_PERFORMANCE
-   DRI_CONF_FTHROTTLE_MODE(DRI_CONF_FTHROTTLE_IRQS)
-   DRI_CONF_VBLANK_MODE(DRI_CONF_VBLANK_DEF_INTERVAL_0)
-   DRI_CONF_SECTION_END DRI_CONF_SECTION_QUALITY
-/* DRI_CONF_FORCE_S3TC_ENABLE(false) */
-   DRI_CONF_ALLOW_LARGE_TEXTURES(1)
-   DRI_CONF_SECTION_END DRI_CONF_END;
-
-static const uint __driNConfigOptions = 3;
+   DRI_CONF_BEGIN
+      DRI_CONF_SECTION_PERFORMANCE
+         DRI_CONF_FTHROTTLE_MODE(DRI_CONF_FTHROTTLE_IRQS)
+         DRI_CONF_VBLANK_MODE(DRI_CONF_VBLANK_DEF_INTERVAL_0)
+      DRI_CONF_SECTION_END
+   
+      DRI_CONF_SECTION_QUALITY
+         /*DRI_CONF_FORCE_S3TC_ENABLE(false)*/
+         DRI_CONF_ALLOW_LARGE_TEXTURES(1)
+         DRI_CONF_DEF_MAX_ANISOTROPY(1.0, "1.0,2.0,4.0,8.0,16.0")
+      DRI_CONF_SECTION_END
+   DRI_CONF_END;
+
+static const uint __driNConfigOptions = 4;
 
 static const __DRIconfig **
 dri_fill_in_modes(struct dri_screen *screen,
diff --git a/src/mesa/state_tracker/st_atom_sampler.c 
b/src/mesa/state_tracker/st_atom_sampler.c
index 06024ad..63c9eda 100644
--- a/src/mesa/state_tracker/st_atom_sampler.c
+++ b/src/mesa/state_tracker/st_atom_sampler.c
@@ -177,8 +177,9 @@ static void convert_sampler(struct st_context *st,
                          sampler->border_color);
     }
 
-    sampler->max_anisotropy = (msamp->MaxAnisotropy == 1.0 ?
-                              0 : (GLuint) msamp->MaxAnisotropy);
+    float max_anisotropy = MAX2(msamp->MaxAnisotropy, st->min_anisotropy);
+    sampler->max_anisotropy = max_anisotropy == 1.0 ?
+                              0 : (GLuint) max_anisotropy;
 
     /* only care about ARB_shadow, not SGI shadow */
     if (msamp->CompareMode == GL_COMPARE_R_TO_TEXTURE) {
diff --git a/src/mesa/state_tracker/st_context.h 
b/src/mesa/state_tracker/st_context.h
index c6fc318..4d1aba6 100644
--- a/src/mesa/state_tracker/st_context.h
+++ b/src/mesa/state_tracker/st_context.h
@@ -187,6 +187,7 @@ struct st_context
    struct cso_context *cso_context;
 
    int force_msaa;
+   float min_anisotropy;
    void *winsys_drawable_handle;
 
    /* User vertex buffers. */
diff --git a/src/mesa/state_tracker/st_manager.c 
b/src/mesa/state_tracker/st_manager.c
index a68544d..9fb3b74 100644
--- a/src/mesa/state_tracker/st_manager.c
+++ b/src/mesa/state_tracker/st_manager.c
@@ -694,6 +694,7 @@ st_api_create_context(struct st_api *stapi, struct 
st_manager *smapi,
 
    st->invalidate_on_gl_viewport =
       smapi->get_param(smapi, ST_MANAGER_BROKEN_INVALIDATE);
+   st->min_anisotropy = 0; // ToDo: ask the context for the value
 
    st->iface.destroy = st_context_destroy;
    st->iface.notify_invalid_framebuffer =
-- 
1.7.1

_______________________________________________
mesa-dev mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to