diff options
author | Alan Hourihane <alanh@tungstengraphics.com> | 2003-12-05 11:51:39 +0000 |
---|---|---|
committer | Alan Hourihane <alanh@tungstengraphics.com> | 2003-12-05 11:51:39 +0000 |
commit | 94965f2738c42b894f84fc8b46a979568f8f095f (patch) | |
tree | f8f49f22405bf7b9e12020994e2aab277a93ccc6 /src/mesa | |
parent | 98165fb1cf6d490ab152084710f11aee559bfec6 (diff) | |
download | external_mesa3d-94965f2738c42b894f84fc8b46a979568f8f095f.zip external_mesa3d-94965f2738c42b894f84fc8b46a979568f8f095f.tar.gz external_mesa3d-94965f2738c42b894f84fc8b46a979568f8f095f.tar.bz2 |
merge r128 DRI driver from DRI trunk
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/drivers/dri/r128/r128_context.c | 18 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r128/r128_context.h | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r128/r128_tex.c | 89 |
3 files changed, 67 insertions, 42 deletions
diff --git a/src/mesa/drivers/dri/r128/r128_context.c b/src/mesa/drivers/dri/r128/r128_context.c index e1b003a..1c7e868 100644 --- a/src/mesa/drivers/dri/r128/r128_context.c +++ b/src/mesa/drivers/dri/r128/r128_context.c @@ -66,19 +66,22 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. const char __driConfigOptions[] = DRI_CONF_BEGIN + DRI_CONF_SECTION_PERFORMANCE + DRI_CONF_VBLANK_MODE(DRI_CONF_VBLANK_DEF_INTERVAL_0) + DRI_CONF_SECTION_END + DRI_CONF_SECTION_QUALITY + DRI_CONF_TEXTURE_DEPTH(DRI_CONF_TEXTURE_DEPTH_FB) + DRI_CONF_SECTION_END #if ENABLE_PERF_BOXES DRI_CONF_SECTION_DEBUG DRI_CONF_PERFORMANCE_BOXES(false) DRI_CONF_SECTION_END #endif - DRI_CONF_SECTION_PERFORMANCE - DRI_CONF_VBLANK_MODE(DRI_CONF_VBLANK_DEF_INTERVAL_0) - DRI_CONF_SECTION_END DRI_CONF_END; #if ENABLE_PERF_BOXES -const GLuint __driNConfigOptions = 2; +const GLuint __driNConfigOptions = 3; #else -const GLuint __driNConfigOptions = 1; +const GLuint __driNConfigOptions = 2; #endif #ifndef R128_DEBUG @@ -176,6 +179,11 @@ GLboolean r128CreateContext( const __GLcontextModes *glVisual, driSetTextureSwapCounterLocation( rmesa->texture_heaps[i], & rmesa->c_textureSwaps ); } + rmesa->texture_depth = driQueryOptioni (&rmesa->optionCache, + "texture_depth"); + if (rmesa->texture_depth == DRI_CONF_TEXTURE_DEPTH_FB) + rmesa->texture_depth = ( r128scrn->cpp == 4 ) ? + DRI_CONF_TEXTURE_DEPTH_32 : DRI_CONF_TEXTURE_DEPTH_16; rmesa->RenderIndex = -1; /* Impossible value */ diff --git a/src/mesa/drivers/dri/r128/r128_context.h b/src/mesa/drivers/dri/r128/r128_context.h index 453ccb6..3a908d7 100644 --- a/src/mesa/drivers/dri/r128/r128_context.h +++ b/src/mesa/drivers/dri/r128/r128_context.h @@ -160,6 +160,8 @@ struct r128_context { driTextureObject swapped; r128TexObjPtr CurrentTexObj[2]; + + int texture_depth; /* Fallback rasterization functions */ diff --git a/src/mesa/drivers/dri/r128/r128_tex.c b/src/mesa/drivers/dri/r128/r128_tex.c index 2793a79..51c5514 100644 --- a/src/mesa/drivers/dri/r128/r128_tex.c +++ b/src/mesa/drivers/dri/r128/r128_tex.c @@ -51,6 +51,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "imports.h" #include "colormac.h" +#include "xmlpool.h" + #define TEX_0 1 #define TEX_1 2 @@ -174,80 +176,93 @@ r128ChooseTextureFormat( GLcontext *ctx, GLint internalFormat, GLenum format, GLenum type ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); + const GLboolean do32bpt = + ( rmesa->texture_depth == DRI_CONF_TEXTURE_DEPTH_32 ); + const GLboolean force16bpt = + ( rmesa->texture_depth == DRI_CONF_TEXTURE_DEPTH_FORCE_16 ); (void) format; (void) type; switch ( internalFormat ) { + /* non-sized formats with alpha */ + case GL_INTENSITY: + case GL_COMPRESSED_INTENSITY: case GL_ALPHA: - case GL_ALPHA4: - case GL_ALPHA8: - case GL_ALPHA12: - case GL_ALPHA16: case GL_COMPRESSED_ALPHA: case 2: case GL_LUMINANCE_ALPHA: + case GL_COMPRESSED_LUMINANCE_ALPHA: + case 4: + case GL_RGBA: + case GL_COMPRESSED_RGBA: + if (do32bpt) + return &_mesa_texformat_argb8888; + else + return &_mesa_texformat_argb4444; + + /* 16-bit formats with alpha */ + case GL_INTENSITY4: + case GL_ALPHA4: case GL_LUMINANCE4_ALPHA4: + case GL_RGBA2: + case GL_RGBA4: + return &_mesa_texformat_argb4444; + + /* 32-bit formats with alpha */ + case GL_INTENSITY8: + case GL_INTENSITY12: + case GL_INTENSITY16: + case GL_ALPHA8: + case GL_ALPHA12: + case GL_ALPHA16: case GL_LUMINANCE6_ALPHA2: case GL_LUMINANCE8_ALPHA8: case GL_LUMINANCE12_ALPHA4: case GL_LUMINANCE12_ALPHA12: case GL_LUMINANCE16_ALPHA16: - case GL_COMPRESSED_LUMINANCE_ALPHA: - case 4: - case GL_RGBA: - case GL_COMPRESSED_RGBA: - case GL_RGBA2: case GL_RGB5_A1: case GL_RGBA8: case GL_RGB10_A2: case GL_RGBA12: case GL_RGBA16: - if (rmesa->r128Screen->cpp == 4) + if (!force16bpt) return &_mesa_texformat_argb8888; else return &_mesa_texformat_argb4444; - case GL_RGBA4: - return &_mesa_texformat_argb4444; + /* non-sized formats without alpha */ + case 1: + case GL_LUMINANCE: + case GL_COMPRESSED_LUMINANCE: case 3: case GL_RGB: case GL_COMPRESSED_RGB: - case GL_R3_G3_B2: - case GL_RGB4: - case GL_RGB5: - case GL_RGB8: - case GL_RGB10: - case GL_RGB12: - case GL_RGB16: - if (rmesa->r128Screen->cpp == 4) + if (do32bpt) return &_mesa_texformat_argb8888; else return &_mesa_texformat_rgb565; - case 1: - case GL_LUMINANCE: + /* 16-bit formats without alpha */ case GL_LUMINANCE4: + case GL_R3_G3_B2: + case GL_RGB4: + case GL_RGB5: + return &_mesa_texformat_rgb565; + + /* 32-bit formats without alpha */ case GL_LUMINANCE8: case GL_LUMINANCE12: case GL_LUMINANCE16: - case GL_COMPRESSED_LUMINANCE: - if (rmesa->r128Screen->cpp == 4) - return &_mesa_texformat_argb8888; /* inefficient but accurate */ + case GL_RGB8: + case GL_RGB10: + case GL_RGB12: + case GL_RGB16: + if (!force16bpt) + return &_mesa_texformat_argb8888; else return &_mesa_texformat_rgb565; - case GL_INTENSITY4: - return &_mesa_texformat_argb4444; - case GL_INTENSITY: - case GL_INTENSITY8: - case GL_INTENSITY12: - case GL_INTENSITY16: - case GL_COMPRESSED_INTENSITY: - if (rmesa->r128Screen->cpp == 4) - return &_mesa_texformat_argb8888; /* inefficient but accurate */ - else - return &_mesa_texformat_argb4444; - + /* color-indexed formats */ case GL_COLOR_INDEX: case GL_COLOR_INDEX1_EXT: case GL_COLOR_INDEX2_EXT: |