diff options
author | Brian Paul <[email protected]> | 2004-07-23 23:32:15 +0000 |
---|---|---|
committer | Brian Paul <[email protected]> | 2004-07-23 23:32:15 +0000 |
commit | dfa5c2bfbbba1e24829582863caeafd97f124d5e (patch) | |
tree | ac5eb6f3c0f9b4b07972b4c69601539bb0852ecf | |
parent | eae26ca4ba62506f6751ec6ca3e3d50709f28d81 (diff) |
new MESA_GLX_DEPTH_BITS env var
-rw-r--r-- | docs/VERSIONS | 2 | ||||
-rw-r--r-- | docs/envvars.html | 1 | ||||
-rw-r--r-- | src/mesa/drivers/x11/fakeglx.c | 31 |
3 files changed, 28 insertions, 6 deletions
diff --git a/docs/VERSIONS b/docs/VERSIONS index a0e4d7dcd31..2cb781b1ac8 100644 --- a/docs/VERSIONS +++ b/docs/VERSIONS @@ -1249,7 +1249,7 @@ Mesa Version History (Justin Novosad of Discreet) (see config.h file) - support for AUX buffers in software GLX driver - updated glext.h to version 23 - - new MESA_GLX_FORCE_ALPHA environment variable for x11 driver + - new MESA_GLX_FORCE_ALPHA and MESA_GLX_DEPTH_BITS env vars Changes: - fragment fog interpolation is perspective corrected now - new glTexImage code, much cleaner, may be a bit faster diff --git a/docs/envvars.html b/docs/envvars.html index 7cda0e48987..12e44e288a9 100644 --- a/docs/envvars.html +++ b/docs/envvars.html @@ -32,6 +32,7 @@ software driver: <li>MESA_GLX_FX - set to either "fullscreen" for full-screen rendering, "window" to render into a window, or "disable" to disable the Glide driver. <li>MESA_GLX_FORCE_ALPHA - if set, forces RGB windows to have an alpha channel. +<li>MESA_GLX_DEPTH_BITS - specifies default number of bits for depth buffer. </ul> diff --git a/src/mesa/drivers/x11/fakeglx.c b/src/mesa/drivers/x11/fakeglx.c index c380ba27dcc..2176b2dae15 100644 --- a/src/mesa/drivers/x11/fakeglx.c +++ b/src/mesa/drivers/x11/fakeglx.c @@ -339,6 +339,25 @@ save_glx_visual( Display *dpy, XVisualInfo *vinfo, } +/** + * Return the default number of bits for the Z buffer. + * If defined, use the MESA_GLX_DEPTH_BITS env var value. + * Otherwise, use the DEFAULT_SOFTWARE_DEPTH_BITS constant. + * XXX probably do the same thing for stencil, accum, etc. + */ +static GLint +default_depth_bits(void) +{ + int zBits; + const char *zEnv = _mesa_getenv("MESA_GLX_DEPTH_BITS"); + if (zEnv) + zBits = _mesa_atoi(zEnv); + else + zBits = DEFAULT_SOFTWARE_DEPTH_BITS; + return zBits; +} + + /* * Create a GLX visual from a regular XVisualInfo. @@ -352,6 +371,7 @@ static XMesaVisual create_glx_visual( Display *dpy, XVisualInfo *visinfo ) { int vislevel; + GLint zBits = default_depth_bits(); vislevel = level_of_visual( dpy, visinfo ); if (vislevel) { @@ -376,7 +396,7 @@ create_glx_visual( Display *dpy, XVisualInfo *visinfo ) GL_FALSE, /* alpha */ GL_TRUE, /* double */ GL_FALSE, /* stereo */ - DEFAULT_SOFTWARE_DEPTH_BITS, + zBits, 8 * sizeof(GLstencil), 0 * sizeof(GLaccum), /* r */ 0 * sizeof(GLaccum), /* g */ @@ -395,7 +415,7 @@ create_glx_visual( Display *dpy, XVisualInfo *visinfo ) GL_FALSE, /* alpha */ GL_TRUE, /* double */ GL_FALSE, /* stereo */ - DEFAULT_SOFTWARE_DEPTH_BITS, + zBits, 8 * sizeof(GLstencil), 8 * sizeof(GLaccum), /* r */ 8 * sizeof(GLaccum), /* g */ @@ -1131,7 +1151,7 @@ static XMesaVisual choose_visual( Display *dpy, int screen, const int *list, double_flag = GL_TRUE; if (vis->depth > 8) rgb_flag = GL_TRUE; - depth_size = DEFAULT_SOFTWARE_DEPTH_BITS; + depth_size = default_depth_bits(); stencil_size = STENCIL_BITS; /* XXX accum??? */ } @@ -1182,8 +1202,9 @@ static XMesaVisual choose_visual( Display *dpy, int screen, const int *list, depth_size = 31; /* 32 causes int overflow problems */ else if (depth_size > 16) depth_size = 24; - else if (depth_size > 0) - depth_size = DEFAULT_SOFTWARE_DEPTH_BITS; /*16*/ + else if (depth_size > 0) { + depth_size = default_depth_bits(); + } /* we only support one size of stencil and accum buffers. */ if (stencil_size > 0) |