i915: Move the texture format setup for this driver out of shared code.
authorEric Anholt <eric@anholt.net>
Tue, 15 Nov 2011 23:57:39 +0000 (15:57 -0800)
committerEric Anholt <eric@anholt.net>
Tue, 22 Nov 2011 21:58:39 +0000 (13:58 -0800)
The i965 driver is now enabling all of these formats on its own from
the surface format table.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/drivers/dri/i915/i830_context.c
src/mesa/drivers/dri/i915/i915_context.c
src/mesa/drivers/dri/intel/intel_context.c
src/mesa/drivers/dri/intel/intel_context.h

index f801abcf43a23c551d56c44d590c87bfd23f42af..663909ea4b68a220628589c06339da5e8c37e001 100644 (file)
@@ -69,6 +69,8 @@ i830CreateContext(const struct gl_config * mesaVis,
       return false;
    }
 
+   intel_init_texture_formats(ctx);
+
    _math_matrix_ctr(&intel->ViewportMatrix);
 
    /* Initialize swrast, tnl driver tables: */
index ca03ad0416cae635133acbaeefa240624348faa0..c5e589d8e6e303dc0fbcfa8aaf4a8a556f9d98e8 100644 (file)
@@ -88,6 +88,55 @@ i915InitDriverFunctions(struct dd_function_table *functions)
    functions->UpdateState = i915InvalidateState;
 }
 
+/* Note: this is shared with i830. */
+void
+intel_init_texture_formats(struct gl_context *ctx)
+{
+   struct intel_context *intel = intel_context(ctx);
+   struct intel_screen *intel_screen = intel->intelScreen;
+
+   ctx->TextureFormatSupported[MESA_FORMAT_ARGB8888] = true;
+   if (intel_screen->deviceID != PCI_CHIP_I830_M &&
+       intel_screen->deviceID != PCI_CHIP_845_G)
+      ctx->TextureFormatSupported[MESA_FORMAT_XRGB8888] = true;
+   ctx->TextureFormatSupported[MESA_FORMAT_ARGB4444] = true;
+   ctx->TextureFormatSupported[MESA_FORMAT_ARGB1555] = true;
+   ctx->TextureFormatSupported[MESA_FORMAT_RGB565] = true;
+   ctx->TextureFormatSupported[MESA_FORMAT_L8] = true;
+   ctx->TextureFormatSupported[MESA_FORMAT_A8] = true;
+   ctx->TextureFormatSupported[MESA_FORMAT_I8] = true;
+   ctx->TextureFormatSupported[MESA_FORMAT_AL88] = true;
+
+   /* Depth and stencil */
+   ctx->TextureFormatSupported[MESA_FORMAT_S8_Z24] = true;
+   ctx->TextureFormatSupported[MESA_FORMAT_X8_Z24] = true;
+   ctx->TextureFormatSupported[MESA_FORMAT_S8] = intel->has_separate_stencil;
+
+   /*
+    * This was disabled in initial FBO enabling to avoid combinations
+    * of depth+stencil that wouldn't work together.  We since decided
+    * that it was OK, since it's up to the app to come up with the
+    * combo that actually works, so this can probably be re-enabled.
+    */
+   /*
+   ctx->TextureFormatSupported[MESA_FORMAT_Z16] = true;
+   ctx->TextureFormatSupported[MESA_FORMAT_Z24] = true;
+   */
+
+   /* ctx->Extensions.MESA_ycbcr_texture */
+   ctx->TextureFormatSupported[MESA_FORMAT_YCBCR] = true;
+   ctx->TextureFormatSupported[MESA_FORMAT_YCBCR_REV] = true;
+
+   /* GL_3DFX_texture_compression_FXT1 */
+   ctx->TextureFormatSupported[MESA_FORMAT_RGB_FXT1] = true;
+   ctx->TextureFormatSupported[MESA_FORMAT_RGBA_FXT1] = true;
+
+   /* GL_EXT_texture_compression_s3tc */
+   ctx->TextureFormatSupported[MESA_FORMAT_RGB_DXT1] = true;
+   ctx->TextureFormatSupported[MESA_FORMAT_RGBA_DXT1] = true;
+   ctx->TextureFormatSupported[MESA_FORMAT_RGBA_DXT3] = true;
+   ctx->TextureFormatSupported[MESA_FORMAT_RGBA_DXT5] = true;
+}
 
 extern const struct tnl_pipeline_stage *intel_pipeline[];
 
index 4973b247c88ea7c0a443c83ec25132b1dd6652de..068b305bded18d657598286e54c8bed23ce2ff93 100644 (file)
@@ -629,48 +629,8 @@ intelInitContext(struct intel_context *intel,
    intel->must_use_separate_stencil = intel->intelScreen->hw_must_use_separate_stencil;
    intel->has_hiz = intel->intelScreen->hw_has_hiz;
 
-   memset(&ctx->TextureFormatSupported, 0,
-         sizeof(ctx->TextureFormatSupported));
-   ctx->TextureFormatSupported[MESA_FORMAT_ARGB8888] = true;
-   if (devID != PCI_CHIP_I830_M && devID != PCI_CHIP_845_G)
-      ctx->TextureFormatSupported[MESA_FORMAT_XRGB8888] = true;
-   ctx->TextureFormatSupported[MESA_FORMAT_ARGB4444] = true;
-   ctx->TextureFormatSupported[MESA_FORMAT_ARGB1555] = true;
-   ctx->TextureFormatSupported[MESA_FORMAT_RGB565] = true;
-   ctx->TextureFormatSupported[MESA_FORMAT_L8] = true;
-   ctx->TextureFormatSupported[MESA_FORMAT_A8] = true;
-   ctx->TextureFormatSupported[MESA_FORMAT_I8] = true;
-   ctx->TextureFormatSupported[MESA_FORMAT_AL88] = true;
-
-   /* Depth and stencil */
-   ctx->TextureFormatSupported[MESA_FORMAT_S8_Z24] = true;
-   ctx->TextureFormatSupported[MESA_FORMAT_X8_Z24] = true;
-   ctx->TextureFormatSupported[MESA_FORMAT_S8] = intel->has_separate_stencil;
-
-   /*
-    * This was disabled in initial FBO enabling to avoid combinations
-    * of depth+stencil that wouldn't work together.  We since decided
-    * that it was OK, since it's up to the app to come up with the
-    * combo that actually works, so this can probably be re-enabled.
-    */
-   /*
-   ctx->TextureFormatSupported[MESA_FORMAT_Z16] = true;
-   ctx->TextureFormatSupported[MESA_FORMAT_Z24] = true;
-   */
-
-   /* ctx->Extensions.MESA_ycbcr_texture */
-   ctx->TextureFormatSupported[MESA_FORMAT_YCBCR] = true;
-   ctx->TextureFormatSupported[MESA_FORMAT_YCBCR_REV] = true;
-
-   /* GL_3DFX_texture_compression_FXT1 */
-   ctx->TextureFormatSupported[MESA_FORMAT_RGB_FXT1] = true;
-   ctx->TextureFormatSupported[MESA_FORMAT_RGBA_FXT1] = true;
-
-   /* GL_EXT_texture_compression_s3tc */
-   ctx->TextureFormatSupported[MESA_FORMAT_RGB_DXT1] = true;
-   ctx->TextureFormatSupported[MESA_FORMAT_RGBA_DXT1] = true;
-   ctx->TextureFormatSupported[MESA_FORMAT_RGBA_DXT3] = true;
-   ctx->TextureFormatSupported[MESA_FORMAT_RGBA_DXT5] = true;
+   memset(&ctx->TextureFormatSupported,
+         0, sizeof(ctx->TextureFormatSupported));
 
    driParseConfigFiles(&intel->optionCache, &intelScreen->optionCache,
                        sPriv->myNum, (intel->gen >= 4) ? "i965" : "i915");
index a61ac4c164fbc64ce02561ec517f3c3b6c515db4..d49255b44a220391147bafd5c30e492661d994e2 100644 (file)
@@ -588,6 +588,7 @@ void intel_prepare_render(struct intel_context *intel);
 
 void i915_set_buf_info_for_region(uint32_t *state, struct intel_region *region,
                                  uint32_t buffer_id);
+void intel_init_texture_formats(struct gl_context *ctx);
 
 /*======================================================================
  * Inline conversion functions.