summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri/savage/savage_xmesa.c
diff options
context:
space:
mode:
authorFelix Kuehling <fxkuehl@gmx.de>2005-01-03 22:24:44 +0000
committerFelix Kuehling <fxkuehl@gmx.de>2005-01-03 22:24:44 +0000
commite3748eb19ba444f411ad66905dfddbe809225ca0 (patch)
tree726327849feaf57de43d5992201190042f252020 /src/mesa/drivers/dri/savage/savage_xmesa.c
parent87889aeab46ece5800cca9390fe95e83515b313d (diff)
Added support for floating point depth buffers on Savage4-based
hardware. By also reversing the depth range this can compensate the loss of accuracy of far objects caused by the projective transformation. Software fallbacks work but are slightly slower since floats in a custom (non IEEE) format have to be encoded and decoded. I havn't done anything about polygon offsets yet. There doesn't seem to be an easy way do get it right except making the offset unit as big as the lowest resolution of depth values. For now float depth is disabled by default but can be enabled through driconf (though I have seen only positive effects so far).
Diffstat (limited to 'src/mesa/drivers/dri/savage/savage_xmesa.c')
-rw-r--r--src/mesa/drivers/dri/savage/savage_xmesa.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/mesa/drivers/dri/savage/savage_xmesa.c b/src/mesa/drivers/dri/savage/savage_xmesa.c
index f1798de134..e269705073 100644
--- a/src/mesa/drivers/dri/savage/savage_xmesa.c
+++ b/src/mesa/drivers/dri/savage/savage_xmesa.c
@@ -64,6 +64,7 @@ DRI_CONF_BEGIN
DRI_CONF_SECTION_QUALITY
DRI_CONF_TEXTURE_DEPTH(DRI_CONF_TEXTURE_DEPTH_FB)
DRI_CONF_COLOR_REDUCTION(DRI_CONF_COLOR_REDUCTION_DITHER)
+ DRI_CONF_FLOAT_DEPTH(false)
DRI_CONF_SECTION_END
DRI_CONF_SECTION_PERFORMANCE
DRI_CONF_MAX_TEXTURE_UNITS(2,1,2)
@@ -72,7 +73,7 @@ DRI_CONF_BEGIN
DRI_CONF_NO_RAST(false)
DRI_CONF_SECTION_END
DRI_CONF_END;
-static const GLuint __driNConfigOptions = 4;
+static const GLuint __driNConfigOptions = 5;
#ifdef USE_NEW_INTERFACE
static PFNGLXCREATECONTEXTMODES create_context_modes = NULL;
@@ -308,6 +309,9 @@ savageCreateContext( const __GLcontextModes *mesaVis,
driParseConfigFiles (&imesa->optionCache, &savageScreen->optionCache,
sPriv->myNum, "savage");
+ imesa->float_depth = driQueryOptionb(&imesa->optionCache, "float_depth") &&
+ savageScreen->chipset >= S3_SAVAGE4;
+ imesa->no_rast = driQueryOptionb(&imesa->optionCache, "no_rast");
imesa->texture_depth = driQueryOptioni (&imesa->optionCache,
"texture_depth");
if (imesa->texture_depth == DRI_CONF_TEXTURE_DEPTH_FB)
@@ -407,7 +411,7 @@ savageCreateContext( const __GLcontextModes *mesaVis,
imesa->hw_stencil = mesaVis->stencilBits && mesaVis->depthBits == 24;
imesa->depth_scale = (imesa->savageScreen->zpp == 2) ?
- (1.0F/0x10000):(1.0F/0x1000000);
+ (1.0F/0xffff):(1.0F/0xffffff);
imesa->bufferSize = savageScreen->bufferSize;
imesa->dmaVtxBuf.total = 0;
@@ -479,8 +483,6 @@ savageCreateContext( const __GLcontextModes *mesaVis,
savageDDInitState( imesa );
- imesa->no_rast = driQueryOptionb(&imesa->optionCache, "no_rast");
-
driContextPriv->driverPrivate = (void *) imesa;
return GL_TRUE;