r5xx: Unbreak anisotropic filtering?
authorCorbin Simpson <MostAwesomeDude@gmail.com>
Sat, 7 Jun 2008 08:37:35 +0000 (01:37 -0700)
committerCorbin Simpson <MostAwesomeDude@gmail.com>
Sat, 7 Jun 2008 08:37:35 +0000 (01:37 -0700)
Not quite finished, maybe? Not sure.

src/mesa/drivers/dri/r300/r300_reg.h
src/mesa/drivers/dri/r300/r300_tex.c

index 999e8bc1b483c1b6f01e534d3b2d0012fb5beb3e..79f2fbfde77d82cf2895c7077d889d18212d384f 100644 (file)
@@ -1371,13 +1371,16 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 #      define R300_TX_MAG_FILTER_4              (0 << 9)
 #       define R300_TX_MAG_FILTER_NEAREST        (1 << 9)
 #       define R300_TX_MAG_FILTER_LINEAR         (2 << 9)
+#       define R300_TX_MAG_FILTER_ANISO          (3 << 9)
 #       define R300_TX_MAG_FILTER_MASK           (3 << 9)
 #       define R300_TX_MIN_FILTER_NEAREST        (1 << 11)
 #       define R300_TX_MIN_FILTER_LINEAR         (2 << 11)
+#      define R300_TX_MIN_FILTER_ANISO          (3 << 11)
 #      define R300_TX_MIN_FILTER_MASK           (3 << 11)
 #      define R300_TX_MIN_FILTER_MIP_NONE       (0 << 13)
 #      define R300_TX_MIN_FILTER_MIP_NEAREST    (1 << 13)
 #      define R300_TX_MIN_FILTER_MIP_LINEAR     (2 << 13)
+#      define R300_TX_MIN_FILTER_MIP_ANISO      (3 << 13)
 #      define R300_TX_MIN_FILTER_MIP_MASK       (3 << 13)
 #      define R300_TX_MAX_ANISO_1_TO_1  (0 << 21)
 #      define R300_TX_MAX_ANISO_2_TO_1  (2 << 21)
index 2ea65f8260e692fcf1bc472d872683ceaea6224f..55243dc7a47f534bcc379c1b10511d50d62e28c2 100644 (file)
@@ -184,11 +184,20 @@ static void r300SetTexMaxAnisotropy(r300TexObjPtr t, GLfloat max)
  * \param t Texture whose filter modes are to be set
  * \param minf Texture minification mode
  * \param magf Texture magnification mode
+ * \param anisotropy Maximum anisotropy level
  */
-static void r300SetTexFilter(r300TexObjPtr t, GLenum minf, GLenum magf)
+static void r300SetTexFilter(r300TexObjPtr t, GLenum minf, GLenum magf, GLfloat anisotropy)
 {
        t->filter &= ~(R300_TX_MIN_FILTER_MASK | R300_TX_MIN_FILTER_MIP_MASK | R300_TX_MAG_FILTER_MASK);
 
+       if (anisotropy > 1.0) {
+               t->filter |= R300_TX_MAG_FILTER_ANISO
+                       | R300_TX_MIN_FILTER_ANISO
+                       | R300_TX_MIN_FILTER_MIP_ANISO;
+               r300SetTexMaxAnisotropy(t, anisotropy);
+               return;
+       }
+
        switch (minf) {
        case GL_NEAREST:
                t->filter |= R300_TX_MIN_FILTER_NEAREST;
@@ -216,7 +225,7 @@ static void r300SetTexFilter(r300TexObjPtr t, GLenum minf, GLenum magf)
         * inside a mip level.
         */
        if (t->filter & R300_TX_MAX_ANISO_MASK) {
-               t->filter &= ~R300_TX_MIN_FILTER_MASK;
+               /* t->filter &= ~R300_TX_MIN_FILTER_MASK; */
        }
 
        /* Note we don't have 3D mipmaps so only use the mag filter setting
@@ -263,8 +272,7 @@ static r300TexObjPtr r300AllocTexObj(struct gl_texture_object *texObj)
                make_empty_list(&t->base);
 
                r300SetTexWrap(t, texObj->WrapS, texObj->WrapT, texObj->WrapR);
-               r300SetTexMaxAnisotropy(t, texObj->MaxAnisotropy);
-               r300SetTexFilter(t, texObj->MinFilter, texObj->MagFilter);
+               r300SetTexFilter(t, texObj->MinFilter, texObj->MagFilter, texObj->MaxAnisotropy);
                r300SetTexBorderColor(t, texObj->_BorderChan);
        }
 
@@ -1035,8 +1043,7 @@ static void r300TexParameter(GLcontext * ctx, GLenum target,
        case GL_TEXTURE_MIN_FILTER:
        case GL_TEXTURE_MAG_FILTER:
        case GL_TEXTURE_MAX_ANISOTROPY_EXT:
-               r300SetTexMaxAnisotropy(t, texObj->MaxAnisotropy);
-               r300SetTexFilter(t, texObj->MinFilter, texObj->MagFilter);
+               r300SetTexFilter(t, texObj->MinFilter, texObj->MagFilter, texObj->MaxAnisotropy);
                break;
 
        case GL_TEXTURE_WRAP_S: