diff options
author | Eric Anholt <[email protected]> | 2005-10-24 09:59:43 +0000 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2005-10-24 09:59:43 +0000 |
commit | 60b639b9a6df6e53997d3c8acdb768229b654a5f (patch) | |
tree | 71ef3ad74c762a2724bc35dfff9372e6417d32a1 | |
parent | 971bdc193cb4ce07f4ca20bac13276095b5f0b83 (diff) |
- Add a few more hardware internal formats that are supported. Some remaining
ones require custom texstore, so they aren't done yet.
- Add YCBCR support commented out, since the yuvsquare test didn't work with
just the bits I've added.
- Add the no-compression GL_ARB_texture_compression support.
- Add the driconf texture depth option and try to respect it.
-rw-r--r-- | src/mesa/drivers/dri/sis/sis_context.c | 4 | ||||
-rw-r--r-- | src/mesa/drivers/dri/sis/sis_context.h | 1 | ||||
-rw-r--r-- | src/mesa/drivers/dri/sis/sis_screen.c | 16 | ||||
-rw-r--r-- | src/mesa/drivers/dri/sis/sis_tex.c | 155 |
4 files changed, 135 insertions, 41 deletions
diff --git a/src/mesa/drivers/dri/sis/sis_context.c b/src/mesa/drivers/dri/sis/sis_context.c index fab38474965..8e2aa88ca39 100644 --- a/src/mesa/drivers/dri/sis/sis_context.c +++ b/src/mesa/drivers/dri/sis/sis_context.c @@ -59,6 +59,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "tnl/t_pipeline.h" #define need_GL_ARB_multisample +#define need_GL_ARB_texture_compression #include "extension_helper.h" #ifndef SIS_DEBUG @@ -74,9 +75,11 @@ struct dri_extension card_extensions[] = { "GL_ARB_multisample", GL_ARB_multisample_functions }, { "GL_ARB_multitexture", NULL }, { "GL_ARB_texture_border_clamp", NULL }, + { "GL_ARB_texture_compression", GL_ARB_texture_compression_functions }, { "GL_ARB_texture_mirrored_repeat", NULL }, { "GL_EXT_texture_lod_bias", NULL }, { "GL_EXT_stencil_wrap", NULL }, + /*{ "GL_MESA_ycbcr_texture", NULL },*/ /* not working yet */ { "GL_NV_blend_square", NULL }, { NULL, NULL } }; @@ -290,6 +293,7 @@ sisCreateContext( const __GLcontextModes *glVisual, fprintf(stderr, "disabling 3D acceleration\n"); FALLBACK(smesa, SIS_FALLBACK_DISABLE, 1); } + smesa->texture_depth = driQueryOptioni(&smesa->optionCache, "texture_depth"); return GL_TRUE; } diff --git a/src/mesa/drivers/dri/sis/sis_context.h b/src/mesa/drivers/dri/sis/sis_context.h index 17d283995fc..54c1f0458f2 100644 --- a/src/mesa/drivers/dri/sis/sis_context.h +++ b/src/mesa/drivers/dri/sis/sis_context.h @@ -367,6 +367,7 @@ struct sis_context /* Configuration cache */ driOptionCache optionCache; + GLint texture_depth; }; #define SIS_CONTEXT(ctx) ((sisContextPtr)(ctx->DriverCtx)) diff --git a/src/mesa/drivers/dri/sis/sis_screen.c b/src/mesa/drivers/dri/sis/sis_screen.c index d213cc406ce..7409fd59398 100644 --- a/src/mesa/drivers/dri/sis/sis_screen.c +++ b/src/mesa/drivers/dri/sis/sis_screen.c @@ -46,16 +46,22 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "GL/internal/dri_interface.h" +#define SIS_AGP_DISABLE(def) \ +DRI_CONF_OPT_BEGIN(agp_disable,bool,def) \ + DRI_CONF_DESC(en,"Disable AGP vertex dispatch") \ +DRI_CONF_OPT_END + PUBLIC const char __driConfigOptions[] = DRI_CONF_BEGIN + DRI_CONF_SECTION_QUALITY + DRI_CONF_TEXTURE_DEPTH(DRI_CONF_TEXTURE_DEPTH_FB) + DRI_CONF_SECTION_END DRI_CONF_SECTION_DEBUG - DRI_CONF_OPT_BEGIN(agp_disable,bool,false) - DRI_CONF_DESC(en,"Disable AGP vertex dispatch") - DRI_CONF_OPT_END - DRI_CONF_NO_RAST(false) + SIS_AGP_DISABLE(false) + DRI_CONF_NO_RAST(false) DRI_CONF_SECTION_END DRI_CONF_END; -static const GLuint __driNConfigOptions = 2; +static const GLuint __driNConfigOptions = 3; extern const struct dri_extension card_extensions[]; diff --git a/src/mesa/drivers/dri/sis/sis_tex.c b/src/mesa/drivers/dri/sis/sis_tex.c index a8b4c0e74d5..e2b7e93b807 100644 --- a/src/mesa/drivers/dri/sis/sis_tex.c +++ b/src/mesa/drivers/dri/sis/sis_tex.c @@ -40,6 +40,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "teximage.h" #include "texobj.h" +#include "xmlpool.h" + #define ALIGN(value, align) (GLubyte *)((long)(value + align - 1) & ~(align - 1)) #define TEXTURE_HW_ALIGNMENT 4 @@ -64,28 +66,44 @@ sisAllocTexImage( sisContextPtr smesa, sisTexObjPtr t, int level, if (t->format == 0) { t->format = image->_BaseFormat; - switch (t->format) + switch (image->TexFormat->MesaFormat) { - case GL_RGBA: + case MESA_FORMAT_ARGB8888: t->hwformat = TEXEL_ARGB_8888_32; break; - case GL_INTENSITY: + case MESA_FORMAT_ARGB4444: + t->hwformat = TEXEL_ARGB_4444_16; + break; + case MESA_FORMAT_ARGB1555: + t->hwformat = TEXEL_ARGB_1555_16; + break; + case MESA_FORMAT_RGB565: + t->hwformat = TEXEL_RGB_565_16; + break; + case MESA_FORMAT_RGB332: + t->hwformat = TEXEL_RGB_332_8; + break; + case MESA_FORMAT_I8: t->hwformat = TEXEL_I8; break; - case GL_ALPHA: + case MESA_FORMAT_A8: t->hwformat = TEXEL_A8; break; - case GL_LUMINANCE: + case MESA_FORMAT_L8: t->hwformat = TEXEL_L8; break; - case GL_LUMINANCE_ALPHA: + case MESA_FORMAT_AL88: t->hwformat = TEXEL_AL88; break; - case GL_RGB: - t->hwformat = TEXEL_ARGB_0888_32; + case MESA_FORMAT_YCBCR: + t->hwformat = TEXEL_YVU422; /* Doesn't work? Extension disabled */ + break; + case MESA_FORMAT_YCBCR_REV: + t->hwformat = TEXEL_YUV422; /* Doesn't work? Extension disabled */ break; default: - sis_fatal_error("Bad texture format.\n"); + sis_fatal_error("Bad texture format 0x%x.\n", + image->TexFormat->MesaFormat); } } assert(t->format == image->_BaseFormat); @@ -215,58 +233,123 @@ static const struct gl_texture_format * sisChooseTextureFormat( GLcontext *ctx, GLint internalFormat, GLenum format, GLenum type ) { - /* XXX 16-bit internal texture formats? */ + sisContextPtr smesa = SIS_CONTEXT(ctx); + + const GLboolean do32bpt = + (smesa->texture_depth == DRI_CONF_TEXTURE_DEPTH_32); + const GLboolean force16bpt = + (smesa->texture_depth == DRI_CONF_TEXTURE_DEPTH_FORCE_16); + switch ( internalFormat ) { + case 4: + case GL_RGBA: + case GL_COMPRESSED_RGBA: + switch ( type ) { + case GL_UNSIGNED_INT_10_10_10_2: + case GL_UNSIGNED_INT_2_10_10_10_REV: + return do32bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_argb1555; + case GL_UNSIGNED_SHORT_4_4_4_4: + case GL_UNSIGNED_SHORT_4_4_4_4_REV: + return &_mesa_texformat_argb4444; + case GL_UNSIGNED_SHORT_5_5_5_1: + case GL_UNSIGNED_SHORT_1_5_5_5_REV: + return &_mesa_texformat_argb1555; + default: + return do32bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_argb4444; + } + + case 3: + case GL_RGB: + case GL_COMPRESSED_RGB: + switch ( type ) { + case GL_UNSIGNED_SHORT_4_4_4_4: + case GL_UNSIGNED_SHORT_4_4_4_4_REV: + return &_mesa_texformat_argb4444; + case GL_UNSIGNED_SHORT_5_5_5_1: + case GL_UNSIGNED_SHORT_1_5_5_5_REV: + return &_mesa_texformat_argb1555; + case GL_UNSIGNED_SHORT_5_6_5: + case GL_UNSIGNED_SHORT_5_6_5_REV: + return &_mesa_texformat_rgb565; + default: + return do32bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_rgb565; + } + + case GL_RGBA8: + case GL_RGBA12: + case GL_RGBA16: + return !force16bpt ? + &_mesa_texformat_argb8888 : &_mesa_texformat_argb4444; + + case GL_RGB10_A2: + return !force16bpt ? + &_mesa_texformat_argb8888 : &_mesa_texformat_argb1555; + + case GL_RGBA4: + case GL_RGBA2: + return &_mesa_texformat_argb4444; + + case GL_RGB5_A1: + return &_mesa_texformat_argb1555; + + case GL_RGB8: + case GL_RGB10: + case GL_RGB12: + case GL_RGB16: + return !force16bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_rgb565; + + case GL_RGB5: + case GL_RGB4: + return &_mesa_texformat_rgb565; + + case GL_R3_G3_B2: + return &_mesa_texformat_rgb332; + case GL_ALPHA: - case GL_ALPHA4: + case GL_ALPHA4: /* FIXME: This could use its own texstore */ case GL_ALPHA8: case GL_ALPHA12: case GL_ALPHA16: + case GL_COMPRESSED_ALPHA: return &_mesa_texformat_a8; + case 1: case GL_LUMINANCE: - case GL_LUMINANCE4: + case GL_LUMINANCE4: /* FIXME: This could use its own texstore */ case GL_LUMINANCE8: case GL_LUMINANCE12: case GL_LUMINANCE16: + case GL_COMPRESSED_LUMINANCE: return &_mesa_texformat_l8; + case 2: case GL_LUMINANCE_ALPHA: - case GL_LUMINANCE4_ALPHA4: - case GL_LUMINANCE6_ALPHA2: + case GL_LUMINANCE4_ALPHA4: /* FIXME: This could use its own texstore */ + case GL_LUMINANCE6_ALPHA2: /* FIXME: This could use its own texstore */ case GL_LUMINANCE8_ALPHA8: - case GL_LUMINANCE12_ALPHA4: + case GL_LUMINANCE12_ALPHA4: /* FIXME: This could use its own texstore */ case GL_LUMINANCE12_ALPHA12: case GL_LUMINANCE16_ALPHA16: + case GL_COMPRESSED_LUMINANCE_ALPHA: return &_mesa_texformat_al88; + case GL_INTENSITY: case GL_INTENSITY4: case GL_INTENSITY8: case GL_INTENSITY12: case GL_INTENSITY16: + case GL_COMPRESSED_INTENSITY: return &_mesa_texformat_i8; - case GL_R3_G3_B2: - case GL_RGB4: - case GL_RGB5: - case 3: - case GL_RGB: - case GL_RGB8: - case GL_RGB10: - case GL_RGB12: - case GL_RGB16: - return &_mesa_texformat_argb8888 /*_mesa_texformat_rgb888*/; /* XXX */ - case GL_RGBA2: - case GL_RGBA4: - case GL_RGB5_A1: - case 4: - case GL_RGBA: - case GL_RGBA8: - case GL_RGB10_A2: - case GL_RGBA12: - case GL_RGBA16: - return &_mesa_texformat_argb8888; + + case GL_YCBCR_MESA: + if (type == GL_UNSIGNED_SHORT_8_8_APPLE || + type == GL_UNSIGNED_BYTE) + return &_mesa_texformat_ycbcr; + else + return &_mesa_texformat_ycbcr_rev; + default: - _mesa_problem(ctx, "unexpected format in tdfxDDChooseTextureFormat: %d", + _mesa_problem(ctx, "unexpected format in sisDDChooseTextureFormat: %d", internalFormat); return NULL; } |