summaryrefslogtreecommitdiff
path: root/src/mesa/drivers
diff options
context:
space:
mode:
authorCorbin Simpson <MostAwesomeDude@gmail.com>2008-06-07 01:37:35 -0700
committerCorbin Simpson <MostAwesomeDude@gmail.com>2008-06-07 01:37:35 -0700
commit5e58e5d77792891fac953ff0ec30990f3e0ca854 (patch)
tree9b001dfa11523b1815f237509b01a0d7373c0538 /src/mesa/drivers
parentf39780242e0dc7060d716fe255977a0a89734945 (diff)
r5xx: Unbreak anisotropic filtering?
Not quite finished, maybe? Not sure.
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r--src/mesa/drivers/dri/r300/r300_reg.h3
-rw-r--r--src/mesa/drivers/dri/r300/r300_tex.c19
2 files changed, 16 insertions, 6 deletions
diff --git a/src/mesa/drivers/dri/r300/r300_reg.h b/src/mesa/drivers/dri/r300/r300_reg.h
index 999e8bc1b4..79f2fbfde7 100644
--- a/src/mesa/drivers/dri/r300/r300_reg.h
+++ b/src/mesa/drivers/dri/r300/r300_reg.h
@@ -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)
diff --git a/src/mesa/drivers/dri/r300/r300_tex.c b/src/mesa/drivers/dri/r300/r300_tex.c
index 2ea65f8260..55243dc7a4 100644
--- a/src/mesa/drivers/dri/r300/r300_tex.c
+++ b/src/mesa/drivers/dri/r300/r300_tex.c
@@ -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: