[Mesa-dev] [PATCH] intel: Remove intel_context::has_xrgb_textures/has_luminance_srgb.

Kenneth Graunke kenneth at whitecape.org
Sat Sep 24 01:01:18 PDT 2011


Seeing as they were only used once (in the same function they were
defined), having them as context members seemed rather pointless.

Remove them entirely (rather than using local variables) since the
chipset generation checks are actually just as straightforward.

While we're at it, clean up the remainder of the if-tree that set them.

Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
---
 src/mesa/drivers/dri/intel/intel_context.c |   37 ++++++++-------------------
 src/mesa/drivers/dri/intel/intel_context.h |    2 -
 2 files changed, 11 insertions(+), 28 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c
index 5625a78..01fb638 100644
--- a/src/mesa/drivers/dri/intel/intel_context.c
+++ b/src/mesa/drivers/dri/intel/intel_context.c
@@ -613,31 +613,14 @@ intelInitContext(struct intel_context *intel,
    intel->driContext = driContextPriv;
    intel->driFd = sPriv->fd;
 
-   intel->has_xrgb_textures = GL_TRUE;
    intel->gen = intelScreen->gen;
-   if (IS_GEN7(intel->intelScreen->deviceID)) {
-      intel->needs_ff_sync = GL_TRUE;
-      intel->has_luminance_srgb = GL_TRUE;
-   } else if (IS_GEN6(intel->intelScreen->deviceID)) {
-      intel->needs_ff_sync = GL_TRUE;
-      intel->has_luminance_srgb = GL_TRUE;
-   } else if (IS_GEN5(intel->intelScreen->deviceID)) {
-      intel->needs_ff_sync = GL_TRUE;
-      intel->has_luminance_srgb = GL_TRUE;
-   } else if (IS_965(intel->intelScreen->deviceID)) {
-      if (IS_G4X(intel->intelScreen->deviceID)) {
-	  intel->has_luminance_srgb = GL_TRUE;
-	  intel->is_g4x = GL_TRUE;
-      }
-   } else if (IS_9XX(intel->intelScreen->deviceID)) {
-      if (IS_945(intel->intelScreen->deviceID)) {
-	 intel->is_945 = GL_TRUE;
-      }
-   } else {
-      if (intel->intelScreen->deviceID == PCI_CHIP_I830_M ||
-	  intel->intelScreen->deviceID == PCI_CHIP_845_G) {
-	 intel->has_xrgb_textures = GL_FALSE;
-      }
+
+   if (intel->gen >= 5) {
+      intel->needs_ff_sync = true;
+   } else if (IS_G4X(intel->intelScreen->deviceID)) {
+      intel->is_g4x = GL_TRUE;
+   } else if (IS_945(intel->intelScreen->deviceID)) {
+      intel->is_945 = GL_TRUE;
    }
 
    intel->has_separate_stencil = intel->intelScreen->hw_has_separate_stencil;
@@ -647,8 +630,10 @@ intelInitContext(struct intel_context *intel,
    memset(&ctx->TextureFormatSupported, 0,
 	  sizeof(ctx->TextureFormatSupported));
    ctx->TextureFormatSupported[MESA_FORMAT_ARGB8888] = GL_TRUE;
-   if (intel->has_xrgb_textures)
+   if (intelScreen->deviceID != PCI_CHIP_I830_M &&
+       intelScreen->deviceID != PCI_CHIP_845_G) {
       ctx->TextureFormatSupported[MESA_FORMAT_XRGB8888] = GL_TRUE;
+   }
    ctx->TextureFormatSupported[MESA_FORMAT_ARGB4444] = GL_TRUE;
    ctx->TextureFormatSupported[MESA_FORMAT_ARGB1555] = GL_TRUE;
    ctx->TextureFormatSupported[MESA_FORMAT_RGB565] = GL_TRUE;
@@ -717,7 +702,7 @@ intelInitContext(struct intel_context *intel,
    ctx->TextureFormatSupported[MESA_FORMAT_SRGBA_DXT1] = GL_TRUE;
    ctx->TextureFormatSupported[MESA_FORMAT_SRGBA_DXT3] = GL_TRUE;
    ctx->TextureFormatSupported[MESA_FORMAT_SRGBA_DXT5] = GL_TRUE;
-   if (intel->has_luminance_srgb) {
+   if (intel->gen >= 5 || intel->is_g4x) {
       ctx->TextureFormatSupported[MESA_FORMAT_SL8] = GL_TRUE;
       ctx->TextureFormatSupported[MESA_FORMAT_SLA8] = GL_TRUE;
    }
diff --git a/src/mesa/drivers/dri/intel/intel_context.h b/src/mesa/drivers/dri/intel/intel_context.h
index b7989dd..171814d 100644
--- a/src/mesa/drivers/dri/intel/intel_context.h
+++ b/src/mesa/drivers/dri/intel/intel_context.h
@@ -169,8 +169,6 @@ struct intel_context
    GLboolean needs_ff_sync;
    GLboolean is_g4x;
    GLboolean is_945;
-   GLboolean has_luminance_srgb;
-   GLboolean has_xrgb_textures;
    GLboolean has_separate_stencil;
    GLboolean must_use_separate_stencil;
    GLboolean has_hiz;
-- 
1.7.6.1



More information about the mesa-dev mailing list