nv50: handle PIPE_TEX_FILTER_ANISO case
authorChristoph Bumiller <e0425955@student.tuwien.ac.at>
Thu, 22 Oct 2009 20:57:30 +0000 (22:57 +0200)
committerChristoph Bumiller <e0425955@student.tuwien.ac.at>
Thu, 22 Oct 2009 21:05:12 +0000 (23:05 +0200)
Set the same bits as for linear filtering (in addition
to max anisotropy), and 2 unknown bits I've seen set.

src/gallium/drivers/nv50/nv50_state.c
src/gallium/drivers/nv50/nv50_texture.h

index 81fa3e34c59c00f5a083c008d42957517ed0a13a..ffaa5e29d1c22286a422efa1afa3179cfd65e6f3 100644 (file)
@@ -146,6 +146,7 @@ nv50_sampler_state_create(struct pipe_context *pipe,
                  (wrap_mode(cso->wrap_r) << 6));
 
        switch (cso->mag_img_filter) {
+       case PIPE_TEX_FILTER_ANISO:
        case PIPE_TEX_FILTER_LINEAR:
                tsc[1] |= NV50TSC_1_1_MAGF_LINEAR;
                break;
@@ -156,6 +157,7 @@ nv50_sampler_state_create(struct pipe_context *pipe,
        }
 
        switch (cso->min_img_filter) {
+       case PIPE_TEX_FILTER_ANISO:
        case PIPE_TEX_FILTER_LINEAR:
                tsc[1] |= NV50TSC_1_1_MINF_LINEAR;
                break;
@@ -183,21 +185,15 @@ nv50_sampler_state_create(struct pipe_context *pipe,
        else
        if (cso->max_anisotropy >= 12.0)
                tsc[0] |= (6 << 20);
-       else
-       if (cso->max_anisotropy >= 10.0)
-               tsc[0] |= (5 << 20);
-       else
-       if (cso->max_anisotropy >= 8.0)
-               tsc[0] |= (4 << 20);
-       else
-       if (cso->max_anisotropy >= 6.0)
-               tsc[0] |= (3 << 20);
-       else
-       if (cso->max_anisotropy >= 4.0)
-               tsc[0] |= (2 << 20);
-       else
-       if (cso->max_anisotropy >= 2.0)
-               tsc[0] |= (1 << 20);
+       else {
+               tsc[0] |= (int)(cso->max_anisotropy * 0.5f) << 20;
+
+               if (cso->max_anisotropy >= 4.0)
+                       tsc[1] |= NV50TSC_1_1_UNKN_ANISO_35;
+               else
+               if (cso->max_anisotropy >= 2.0)
+                       tsc[1] |= NV50TSC_1_1_UNKN_ANISO_15;
+       }
 
        if (cso->compare_mode == PIPE_TEX_COMPARE_R_TO_TEXTURE) {
                tsc[0] |= (1 << 8);
index 207fb039f70eab9a4d6f1ef104a3e96e77701045..13f74c11c6b8aa50bab800bb2a12702364dd5737 100644 (file)
 #define NV50TSC_1_1_MIPF_NEAREST                                 0x00000080
 #define NV50TSC_1_1_MIPF_LINEAR                                  0x000000c0
 #define NV50TSC_1_1_LOD_BIAS_MASK                                0x01fff000
+#define NV50TSC_1_1_UNKN_ANISO_15                                0x10000000
+#define NV50TSC_1_1_UNKN_ANISO_35                                0x18000000
 
 #define NV50TSC_1_2_MIN_LOD_MASK                                 0x00000f00
 #define NV50TSC_1_2_MAX_LOD_MASK                                 0x00f00000