summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri/r200/r200_tex.c
diff options
context:
space:
mode:
authorFelix Kuehling <fxkuehl@gmx.de>2004-01-05 02:40:28 +0000
committerFelix Kuehling <fxkuehl@gmx.de>2004-01-05 02:40:28 +0000
commiteffc73931f86c7961b4eb296d2d4c5d91624a9e3 (patch)
tree843e1b3a3eb93b135e0bd9c49047c8518a45576e /src/mesa/drivers/dri/r200/r200_tex.c
parentdbfe7ae848dc008ec878a7da8c39e4091996bb74 (diff)
Added def_max_anisotropy and no_neg_lod_bias options to radeon and r200.
The def_max_anisotropy option breaks driconf. :( I'm going to upload a fixed version soon.
Diffstat (limited to 'src/mesa/drivers/dri/r200/r200_tex.c')
-rw-r--r--src/mesa/drivers/dri/r200/r200_tex.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/src/mesa/drivers/dri/r200/r200_tex.c b/src/mesa/drivers/dri/r200/r200_tex.c
index 6059bf5805..f64bc2f089 100644
--- a/src/mesa/drivers/dri/r200/r200_tex.c
+++ b/src/mesa/drivers/dri/r200/r200_tex.c
@@ -44,6 +44,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "texutil.h"
#include "texmem.h"
#include "teximage.h"
+#include "texobj.h"
#include "r200_context.h"
#include "r200_state.h"
@@ -831,7 +832,7 @@ static void r200TexEnv( GLcontext *ctx, GLenum target,
}
case GL_TEXTURE_LOD_BIAS_EXT: {
- GLfloat bias;
+ GLfloat bias, min;
GLuint b;
const int fixed_one = 0x8000000;
@@ -841,7 +842,9 @@ static void r200TexEnv( GLcontext *ctx, GLenum target,
* NOTE: Add a small bias to the bias for conform mipsel.c test.
*/
bias = *param + .01;
- bias = CLAMP( bias, -16.0, 16.0 );
+ min = driQueryOptionb (&rmesa->optionCache, "no_neg_lod_bias") ?
+ 0.0 : -16.0;
+ bias = CLAMP( bias, min, 16.0 );
b = (int)(bias * fixed_one) & R200_LOD_BIAS_MASK;
if ( (rmesa->hw.tex[unit].cmd[TEX_PP_TXFORMAT_X] & R200_LOD_BIAS_MASK) != b ) {
@@ -974,6 +977,18 @@ static void r200TexGen( GLcontext *ctx,
rmesa->recheck_texgen[unit] = GL_TRUE;
}
+/* Fixup MaxAnisotropy according to user preference.
+ */
+static struct gl_texture_object *r200NewTextureObject ( GLcontext *ctx,
+ GLuint name,
+ GLenum target ) {
+ struct gl_texture_object *obj;
+ obj = _mesa_new_texture_object (ctx, name, target);
+ obj->MaxAnisotropy = driQueryOptionf (&R200_CONTEXT(ctx)->optionCache,
+ "def_max_anisotropy");
+ return obj;
+}
+
void r200InitTextureFuncs( GLcontext *ctx )
{
@@ -1002,6 +1017,7 @@ void r200InitTextureFuncs( GLcontext *ctx )
ctx->Driver.CopyTexSubImage3D = _swrast_copy_texsubimage3d;
ctx->Driver.TestProxyTexImage = _mesa_test_proxy_teximage;
+ ctx->Driver.NewTextureObject = r200NewTextureObject;
ctx->Driver.BindTexture = r200BindTexture;
ctx->Driver.CreateTexture = NULL; /* FIXME: Is this used??? */
ctx->Driver.DeleteTexture = r200DeleteTexture;
@@ -1017,4 +1033,10 @@ void r200InitTextureFuncs( GLcontext *ctx )
driInitTextureObjects( ctx, & rmesa->swapped,
DRI_TEXMGR_DO_TEXTURE_1D
| DRI_TEXMGR_DO_TEXTURE_2D );
+
+ /* Hack: r200NewTextureObject is not yet installed when the
+ * default textures are created. Therefore set MaxAnisotropy of the
+ * default 2D texture now. */
+ ctx->Shared->Default2D->MaxAnisotropy = driQueryOptionf (&rmesa->optionCache,
+ "def_max_anisotropy");
}