diff options
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r-- | src/mesa/drivers/dri/r200/r200_screen.c | 4 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r200/r200_tex.c | 26 | ||||
-rw-r--r-- | src/mesa/drivers/dri/radeon/radeon_screen.c | 4 | ||||
-rw-r--r-- | src/mesa/drivers/dri/radeon/radeon_tex.c | 26 |
4 files changed, 54 insertions, 6 deletions
diff --git a/src/mesa/drivers/dri/r200/r200_screen.c b/src/mesa/drivers/dri/r200/r200_screen.c index a79ac71d42b..0d3c46da30d 100644 --- a/src/mesa/drivers/dri/r200/r200_screen.c +++ b/src/mesa/drivers/dri/r200/r200_screen.c @@ -64,6 +64,8 @@ DRI_CONF_BEGIN DRI_CONF_SECTION_END DRI_CONF_SECTION_QUALITY DRI_CONF_TEXTURE_DEPTH(DRI_CONF_TEXTURE_DEPTH_FB) + DRI_CONF_DEF_MAX_ANISOTROPY(1.0,"1.0,2.0,4.0,8.0,16.0") + DRI_CONF_NO_NEG_LOD_BIAS(false) DRI_CONF_COLOR_REDUCTION(DRI_CONF_COLOR_REDUCTION_DITHER) DRI_CONF_ROUND_MODE(DRI_CONF_ROUND_TRUNC) DRI_CONF_DITHER_MODE(DRI_CONF_DITHER_XERRORDIFF) @@ -72,7 +74,7 @@ DRI_CONF_BEGIN DRI_CONF_NO_RAST(false) DRI_CONF_SECTION_END DRI_CONF_END; -static const GLuint __driNConfigOptions = 8; +static const GLuint __driNConfigOptions = 10; #if 1 /* Including xf86PciInfo.h introduces a bunch of errors... diff --git a/src/mesa/drivers/dri/r200/r200_tex.c b/src/mesa/drivers/dri/r200/r200_tex.c index 6059bf5805b..f64bc2f089d 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"); } diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c index edd7c0f34e4..ec773de854b 100644 --- a/src/mesa/drivers/dri/radeon/radeon_screen.c +++ b/src/mesa/drivers/dri/radeon/radeon_screen.c @@ -63,6 +63,8 @@ DRI_CONF_BEGIN DRI_CONF_SECTION_END DRI_CONF_SECTION_QUALITY DRI_CONF_TEXTURE_DEPTH(DRI_CONF_TEXTURE_DEPTH_FB) + DRI_CONF_DEF_MAX_ANISOTROPY(1.0,"1.0,2.0,4.0,8.0,16.0") + DRI_CONF_NO_NEG_LOD_BIAS(false) DRI_CONF_COLOR_REDUCTION(DRI_CONF_COLOR_REDUCTION_DITHER) DRI_CONF_ROUND_MODE(DRI_CONF_ROUND_TRUNC) DRI_CONF_DITHER_MODE(DRI_CONF_DITHER_XERRORDIFF) @@ -71,7 +73,7 @@ DRI_CONF_BEGIN DRI_CONF_NO_RAST(false) DRI_CONF_SECTION_END DRI_CONF_END; -static const GLuint __driNConfigOptions = 8; +static const GLuint __driNConfigOptions = 10; #if 1 /* Including xf86PciInfo.h introduces a bunch of errors... diff --git a/src/mesa/drivers/dri/radeon/radeon_tex.c b/src/mesa/drivers/dri/radeon/radeon_tex.c index 269c0a4ebb6..73825a8d909 100644 --- a/src/mesa/drivers/dri/radeon/radeon_tex.c +++ b/src/mesa/drivers/dri/radeon/radeon_tex.c @@ -42,6 +42,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "texformat.h" #include "texstore.h" #include "teximage.h" +#include "texobj.h" #include "radeon_context.h" @@ -567,7 +568,7 @@ static void radeonTexEnv( GLcontext *ctx, GLenum target, } case GL_TEXTURE_LOD_BIAS_EXT: { - GLfloat bias; + GLfloat bias, min; GLuint b; /* The Radeon's LOD bias is a signed 2's complement value with a @@ -575,7 +576,9 @@ static void radeonTexEnv( GLcontext *ctx, GLenum target, * functions, one mapping [-1.0,0.0] to [-128,0] and one mapping * [0.0,4.0] to [0,127]. */ - bias = CLAMP( *param, -1.0, 4.0 ); + min = driQueryOptionb (&rmesa->optionCache, "no_neg_lod_bias") ? + 0.0 : -1.0; + bias = CLAMP( *param, min, 4.0 ); if ( bias == 0 ) { b = 0; } else if ( bias > 0 ) { @@ -712,6 +715,18 @@ static void radeonTexGen( GLcontext *ctx, rmesa->recheck_texgen[unit] = GL_TRUE; } +/* Fixup MaxAnisotropy according to user preference. + */ +static struct gl_texture_object *radeonNewTextureObject ( GLcontext *ctx, + GLuint name, + GLenum target ) { + struct gl_texture_object *obj; + obj = _mesa_new_texture_object (ctx, name, target); + obj->MaxAnisotropy = driQueryOptionf (&RADEON_CONTEXT(ctx)->optionCache, + "def_max_anisotropy"); + return obj; +} + void radeonInitTextureFuncs( GLcontext *ctx ) { @@ -732,6 +747,7 @@ void radeonInitTextureFuncs( GLcontext *ctx ) ctx->Driver.CopyTexSubImage3D = _swrast_copy_texsubimage3d; ctx->Driver.TestProxyTexImage = _mesa_test_proxy_teximage; + ctx->Driver.NewTextureObject = radeonNewTextureObject; ctx->Driver.BindTexture = radeonBindTexture; ctx->Driver.CreateTexture = NULL; /* FIXME: Is this used??? */ ctx->Driver.DeleteTexture = radeonDeleteTexture; @@ -747,4 +763,10 @@ void radeonInitTextureFuncs( GLcontext *ctx ) driInitTextureObjects( ctx, & rmesa->swapped, DRI_TEXMGR_DO_TEXTURE_1D | DRI_TEXMGR_DO_TEXTURE_2D ); + + /* Hack: radeonNewTextureObject 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"); } |