# Environment Variables

Normally, no environment variables need to be set. Most of the environment variables used by Mesa/Gallium are for debugging purposes, but they can sometimes be useful for debugging end-user issues.

## LibGL environment variables

- LIBGL_DEBUG - If defined debug information will be printed to stderr. If set to 'verbose' additional information will be printed.
- LIBGL_DRIVERS_PATH - colon-separated list of paths to search for DRI drivers
- LIBGL_ALWAYS_INDIRECT - forces an indirect rendering context/connection.
- LIBGL_ALWAYS_SOFTWARE - if set, always use software rendering
- LIBGL_NO_DRAWARRAYS - if set do not use DrawArrays GLX protocol (for debugging)

## Core Mesa environment variables

- MESA_NO_ASM - if set, disables all assembly language optimizations
- MESA_NO_MMX - if set, disables Intel MMX optimizations
- MESA_NO_3DNOW - if set, disables AMD 3DNow! optimizations
- MESA_NO_SSE - if set, disables Intel SSE optimizations
- MESA_DEBUG - if set, error messages are printed to stderr. For example, if the application generates a GL_INVALID_ENUM error, a corresponding error message indicating where the error occured, and possibly why, will be printed to stderr.
  If the value of MESA_DEBUG is 'FP' floating point arithmetic errors will generate exceptions.
- MESA_TEX_PROG - if set, implement conventional texture env modes with fragment programs (intended for developers only)
- MESA_TNL_PROG - if set, implement conventional vertex transformation operations with vertex programs (intended for developers only). Setting this variable automatically sets the MESA_TEX_PROG variable as well.
- MESA_EXTENSION_OVERRIDE - can be used to enable/disable extensions. A value such as "GL_EXT_foo -GL_EXT_bar" will enable the GL_EXT_foo extension and disable the GL_EXT_bar extension.
- MESA_EXTENSION_MAX_YEAR - The GL_EXTENSIONS string returned by Mesa is sorted by extension year. If this variable is set to year X, only extensions defined on or before year X will be reported. This is to work-around a bug in some games where the extension string is copied into a fixed-size buffer without truncating. If the extension string is too long, the buffer overrun can cause the game to crash. This is a work-around for that.
- MESA_GL_VERSION_OVERRIDE - changes the value returned by glGetString(GL_VERSION). Valid values are point-separated version numbers, such as "3.0". Mesa will not really implement all the features of the given version if it's higher than what's normally reported.
- MESA_GLSL_VERSION_OVERRIDE - changes the value returned by glGetString(GL_SHADING_LANGUAGE_VERSION). Valid values are integers, such as "130". Mesa will not really implement all the features of the given language version if it's higher than what's normally reported. (for developers only)
- MESA_GLSL - shading language compiler options

## Mesa Xlib driver environment variables

The following are only applicable to the Mesa Xlib software driver. See the Xlib software driver page for details.

- MESA_RGB_VISUAL - specifies the X visual and depth for RGB mode
- MESA_CI_VISUAL - specifies the X visual and depth for CI mode
- MESA_BACK_BUFFER - specifies how to implement the back color buffer, either "pixmap" or "ximage"
- MESA_GAMMA - gamma correction coefficients for red, green, blue channels
- MESA_XSYNC - enable synchronous X behavior (for debugging only)
- MESA_GLX_FORCE_CI - if set, force GLX to treat 8bpp visuals as CI visuals
- MESA_GLX_FORCE_ALPHA - if set, forces RGB windows to have an alpha channel.
- MESA_GLX_DEPTH_BITS - specifies default number of bits for depth buffer.
- MESA_GLX_ALPHA_BITS - specifies default number of bits for alpha channel.

## i945/i965 driver environment variables (non-Gallium)

- INTEL_STRICT_CONFORMANCE - if set to 1, enable sw fallbacks to improve OpenGL conformance. If set to 2, always use software rendering.
- INTEL_NO_BLIT - if set, disable hardware-accelerated glBitmap, glCopyPixels, glDrawPixels.

## Radeon R300 driver environment variables (non-Gallium)

- R300_NO_TCL - if set, disable hardware-accelerated Transform/Clip/Lighting.

## EGL environment variables

Mesa EGL supports different sets of environment variables. See the Mesa EGL page for the details.

## Gallium environment variables

- GALLIUM_PRINT_OPTIONS - if non-zero, print all the Gallium environment variables which are used, and their current values.
- GALLIUM_NOSSE - if non-zero, do not use SSE runtime code generation for shader execution
- GALLIUM_NOPPC - if non-zero, do not use PPC runtime code generation for shader execution
- GALLIUM_DUMP_CPU - if non-zero, print information about the CPU on start-up
- TGSI_PRINT_SANITY - if set, do extra sanity checking on TGSI shaders and print any errors to stderr.
- DRAW_FSE - ???
- DRAW_NO_FSE - ???
- DRAW_USE_LLVM - if set to zero, the draw module will not use LLVM to execute shaders, vertex fetch, etc.

### Softpipe driver environment variables

- SOFTPIPE_DUMP_FS - if set, the softpipe driver will print fragment shaders to stderr
- SOFTPIPE_DUMP_GS - if set, the softpipe driver will print geometry shaders to stderr
- SOFTPIPE_NO_RAST - if set, rasterization is no-op'd. For profiling purposes.
- SOFTPIPE_USE_LLVM - if set, the softpipe driver will try to use LLVM JIT for vertex shading procesing.

### LLVMpipe driver environment variables

- LP_NO_RAST - if set LLVMpipe will no-op rasterization
- LP_DEBUG - a comma-separated list of debug options is acceptec. See the source code for details.
- LP_PERF - a comma-separated list of options to selectively no-op various parts of the driver. See the source code for details.
- LP_NUM_THREADS - an integer indicating how many threads to use for rendering. Zero turns of threading completely. The default value is the number of CPU cores present.

Other Gallium drivers have their own environment variables. These may change frequently so the source code should be consulted for details.