[Mesa-dev] [PATCH 6/6] sis: Move to using core ChooseTexFormat.

Eric Anholt eric at anholt.net
Fri Sep 24 17:08:52 PDT 2010


---
 src/mesa/drivers/dri/sis/sis_context.c |   16 ++++
 src/mesa/drivers/dri/sis/sis_screen.c  |    5 +-
 src/mesa/drivers/dri/sis/sis_tex.c     |  127 --------------------------------
 3 files changed, 17 insertions(+), 131 deletions(-)

diff --git a/src/mesa/drivers/dri/sis/sis_context.c b/src/mesa/drivers/dri/sis/sis_context.c
index 85f26a0..6169d36 100644
--- a/src/mesa/drivers/dri/sis/sis_context.c
+++ b/src/mesa/drivers/dri/sis/sis_context.c
@@ -249,6 +249,22 @@ sisCreateContext( gl_api api,
    ctx->Const.MaxTextureImageUnits = ctx->Const.MaxTextureUnits;
    ctx->Const.MaxTextureCoordUnits = ctx->Const.MaxTextureUnits;
 
+   memset(&ctx->texture_format_supported, 0,
+	  sizeof(ctx->texture_format_supported));
+   ctx->texture_format_supported[MESA_FORMAT_ARGB8888] = GL_TRUE;
+   ctx->texture_format_supported[MESA_FORMAT_ARGB4444] = GL_TRUE;
+   ctx->texture_format_supported[MESA_FORMAT_ARGB1555] = GL_TRUE;
+   ctx->texture_format_supported[MESA_FORMAT_RGB565] = GL_TRUE;
+   ctx->texture_format_supported[MESA_FORMAT_RGB332] = GL_TRUE;
+   ctx->texture_format_supported[MESA_FORMAT_L8] = GL_TRUE;
+   ctx->texture_format_supported[MESA_FORMAT_A8] = GL_TRUE;
+   ctx->texture_format_supported[MESA_FORMAT_I8] = GL_TRUE;
+   ctx->texture_format_supported[MESA_FORMAT_AL88] = GL_TRUE;
+
+   /* ctx->Extensions.MESA_ycbcr_texture */
+   ctx->texture_format_supported[MESA_FORMAT_YCBCR] = GL_TRUE;
+   ctx->texture_format_supported[MESA_FORMAT_YCBCR_REV] = GL_TRUE;
+
    /* Parse configuration files */
    driParseConfigFiles (&smesa->optionCache, &sisScreen->optionCache,
 			sisScreen->driScreen->myNum, "sis");
diff --git a/src/mesa/drivers/dri/sis/sis_screen.c b/src/mesa/drivers/dri/sis/sis_screen.c
index 80fb455..a227506 100644
--- a/src/mesa/drivers/dri/sis/sis_screen.c
+++ b/src/mesa/drivers/dri/sis/sis_screen.c
@@ -51,15 +51,12 @@ 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
 		SIS_AGP_DISABLE(true)
 		DRI_CONF_NO_RAST(false)
 	DRI_CONF_SECTION_END
 DRI_CONF_END;
-static const GLuint __driNConfigOptions = 3;
+static const GLuint __driNConfigOptions = 2;
 
 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 31709c3..e9a1c79 100644
--- a/src/mesa/drivers/dri/sis/sis_tex.c
+++ b/src/mesa/drivers/dri/sis/sis_tex.c
@@ -226,132 +226,6 @@ static GLboolean sisIsTextureResident( GLcontext * ctx,
   return (texObj->DriverData != NULL);
 }
 
-static gl_format
-sisChooseTextureFormat( GLcontext *ctx, GLint internalFormat,
-			  GLenum format, GLenum type )
-{
-   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_FORMAT_ARGB8888 : MESA_FORMAT_ARGB1555;
-      case GL_UNSIGNED_SHORT_4_4_4_4:
-      case GL_UNSIGNED_SHORT_4_4_4_4_REV:
-	 return MESA_FORMAT_ARGB4444;
-      case GL_UNSIGNED_SHORT_5_5_5_1:
-      case GL_UNSIGNED_SHORT_1_5_5_5_REV:
-	 return MESA_FORMAT_ARGB1555;
-      default:
-         return do32bpt ? MESA_FORMAT_ARGB8888 : MESA_FORMAT_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_FORMAT_ARGB4444;
-      case GL_UNSIGNED_SHORT_5_5_5_1:
-      case GL_UNSIGNED_SHORT_1_5_5_5_REV:
-	 return MESA_FORMAT_ARGB1555;
-      case GL_UNSIGNED_SHORT_5_6_5:
-      case GL_UNSIGNED_SHORT_5_6_5_REV:
-	 return MESA_FORMAT_RGB565;
-      default:
-         return do32bpt ? MESA_FORMAT_ARGB8888 : MESA_FORMAT_RGB565;
-      }
-
-   case GL_RGBA8:
-   case GL_RGBA12:
-   case GL_RGBA16:
-      return !force16bpt ?
-	  MESA_FORMAT_ARGB8888 : MESA_FORMAT_ARGB4444;
-
-   case GL_RGB10_A2:
-      return !force16bpt ?
-	  MESA_FORMAT_ARGB8888 : MESA_FORMAT_ARGB1555;
-
-   case GL_RGBA4:
-   case GL_RGBA2:
-      return MESA_FORMAT_ARGB4444;
-
-   case GL_RGB5_A1:
-      return MESA_FORMAT_ARGB1555;
-
-   case GL_RGB8:
-   case GL_RGB10:
-   case GL_RGB12:
-   case GL_RGB16:
-      return !force16bpt ? MESA_FORMAT_ARGB8888 : MESA_FORMAT_RGB565;
-
-   case GL_RGB5:
-   case GL_RGB4:
-      return MESA_FORMAT_RGB565;
-
-   case GL_R3_G3_B2:
-      return MESA_FORMAT_RGB332;
-
-   case GL_ALPHA:
-   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_FORMAT_A8;
-
-   case 1:
-   case GL_LUMINANCE:
-   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_FORMAT_L8;
-
-   case 2:
-   case GL_LUMINANCE_ALPHA:
-   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:	/* FIXME: This could use its own texstore */
-   case GL_LUMINANCE12_ALPHA12:
-   case GL_LUMINANCE16_ALPHA16:
-   case GL_COMPRESSED_LUMINANCE_ALPHA:
-      return MESA_FORMAT_AL88;
-
-   case GL_INTENSITY:
-   case GL_INTENSITY4:
-   case GL_INTENSITY8:
-   case GL_INTENSITY12:
-   case GL_INTENSITY16:
-   case GL_COMPRESSED_INTENSITY:
-      return MESA_FORMAT_I8;
-
-   case GL_YCBCR_MESA:
-      if (type == GL_UNSIGNED_SHORT_8_8_APPLE ||
-          type == GL_UNSIGNED_BYTE)
-         return MESA_FORMAT_YCBCR;
-      else
-         return MESA_FORMAT_YCBCR_REV;
-
-   default:
-      _mesa_problem(ctx, "unexpected format in sisDDChooseTextureFormat: %d",
-         internalFormat);
-      return MESA_FORMAT_NONE;
-   }
-}
-
 static void sisTexImage1D( GLcontext *ctx, GLenum target, GLint level,
 			     GLint internalFormat,
 			     GLint width, GLint border,
@@ -555,7 +429,6 @@ sisNewTextureObject( GLcontext *ctx, GLuint name, GLenum target )
 void sisInitTextureFuncs( struct dd_function_table *functions )
 {
    functions->TexEnv			= sisTexEnv;
-   functions->ChooseTextureFormat	= sisChooseTextureFormat;
    functions->TexImage1D		= sisTexImage1D;
    functions->TexSubImage1D		= sisTexSubImage1D;
    functions->TexImage2D		= sisTexImage2D;
-- 
1.7.1



More information about the mesa-dev mailing list