Hi,

This patch series fixes compilation errors/warnings when features are
disabled.  The errors mainly come from the missing symbols when texture
format features like FEATURE_texture_{fxt1,s3tc,sRGB} are disabled.

The first patch makes _mesa_get_texstore_func never return NULL.  This
is analogous with the what _mesa_get_texel_store_func does.

The following two patches fix compilation errors when
FEATURE_texture_{fxt1,s3tc} are disabled.  The fetch/store functions are
#define'd to be NULL when the respective features are disabled.  This
approach is more clear than having a bunch of #ifdef or no-op static
inline functions.  It is noted in the sources.  If this turns out to be
a problem, it can always be changed to use static inline functions.

The last patch fixes compilation errors and warnings when some of
features are disabled.  They are all simple fixes.

-- 
Regards,
olv
>From 6f76409d7679a2e18583e842e62a8c2469b76f0b Mon Sep 17 00:00:00 2001
From: Chia-I Wu <[email protected]>
Date: Thu, 29 Oct 2009 15:19:59 +0800
Subject: [PATCH 1/4] mesa/main: Never return NULL in _mesa_get_texstore_func.


Signed-off-by: Chia-I Wu <[email protected]>
---
 src/mesa/main/texstore.c |   28 +++++++++++++++++++++++++---
 1 files changed, 25 insertions(+), 3 deletions(-)

diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c
index 36228e6..01fea47 100644
--- a/src/mesa/main/texstore.c
+++ b/src/mesa/main/texstore.c
@@ -3083,6 +3083,26 @@ texstore_funcs[MESA_FORMAT_COUNT] =
 };
 
 
+static GLboolean
+_mesa_texstore_null(TEXSTORE_PARAMS)
+{
+   (void) ctx; (void) dims;
+   (void) baseInternalFormat;
+   (void) dstFormat;
+   (void) dstAddr;
+   (void) dstXoffset; (void) dstYoffset; (void) dstZoffset;
+   (void) dstRowStride; (void) dstImageOffsets;
+   (void) srcWidth; (void) srcHeight; (void) srcDepth;
+   (void) srcFormat; (void) srcType;
+   (void) srcAddr;
+   (void) srcPacking;
+
+   /* should never happen */
+   _mesa_problem(NULL, "_mesa_texstore_null() is called");
+   return GL_FALSE;
+}
+
+
 /**
  * Return the StoreTexImageFunc pointer to store an image in the given format.
  */
@@ -3096,7 +3116,11 @@ _mesa_get_texstore_func(gl_format format)
    }
 #endif
    ASSERT(texstore_funcs[format].Name == format);
-   return texstore_funcs[format].Store;
+
+   if (texstore_funcs[format].Store)
+      return texstore_funcs[format].Store;
+   else
+      return _mesa_texstore_null;
 }
 
 
@@ -3112,8 +3136,6 @@ _mesa_texstore(TEXSTORE_PARAMS)
 
    storeImage = _mesa_get_texstore_func(dstFormat);
 
-   assert(storeImage);
-
    success = storeImage(ctx, dims, baseInternalFormat,
                         dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
                         dstRowStride, dstImageOffsets,
-- 
1.6.3.3

>From a46ff1a9e898b0737f515f4c80409dc3bbefaf3a Mon Sep 17 00:00:00 2001
From: Chia-I Wu <[email protected]>
Date: Thu, 29 Oct 2009 14:14:04 +0800
Subject: [PATCH 2/4] mesa/main: Make FEATURE_texture_fxt1 follow feature conventions.

Also remove the unused initialization and GLchan fetch functions.

Signed-off-by: Chia-I Wu <[email protected]>
---
 src/mesa/main/context.c          |    3 ---
 src/mesa/main/texcompress.h      |    3 ---
 src/mesa/main/texcompress_fxt1.c |   35 ++++++-----------------------------
 src/mesa/main/texcompress_fxt1.h |   22 ++++++++++++++--------
 4 files changed, 20 insertions(+), 43 deletions(-)

diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index c57d7c1..1d540eb 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -706,9 +706,6 @@ init_attrib_groups(GLcontext *ctx)
 #if FEATURE_texture_s3tc
    _mesa_init_texture_s3tc( ctx );
 #endif
-#if FEATURE_texture_fxt1
-   _mesa_init_texture_fxt1( ctx );
-#endif
 
    /* Miscellaneous */
    ctx->NewState = _NEW_ALL;
diff --git a/src/mesa/main/texcompress.h b/src/mesa/main/texcompress.h
index 4184167..d4873db 100644
--- a/src/mesa/main/texcompress.h
+++ b/src/mesa/main/texcompress.h
@@ -48,9 +48,6 @@ _mesa_compressed_image_address(GLint col, GLint row, GLint img,
 extern void
 _mesa_init_texture_s3tc( GLcontext *ctx );
 
-extern void
-_mesa_init_texture_fxt1( GLcontext *ctx );
-
 
 #else /* _HAVE_FULL_GL */
 
diff --git a/src/mesa/main/texcompress_fxt1.c b/src/mesa/main/texcompress_fxt1.c
index ef42fb9..85becb8 100644
--- a/src/mesa/main/texcompress_fxt1.c
+++ b/src/mesa/main/texcompress_fxt1.c
@@ -41,6 +41,9 @@
 #include "texstore.h"
 
 
+#if FEATURE_texture_fxt1
+
+
 static void
 fxt1_encode (GLuint width, GLuint height, GLint comps,
              const void *source, GLint srcRowStride,
@@ -52,16 +55,6 @@ fxt1_decode_1 (const void *texture, GLint stride,
 
 
 /**
- * Called during context initialization.
- */
-void
-_mesa_init_texture_fxt1( GLcontext *ctx )
-{
-   (void) ctx;
-}
-
-
-/**
  * Store user's image in rgb_fxt1 format.
  */
 GLboolean
@@ -176,15 +169,6 @@ _mesa_texstore_rgba_fxt1(TEXSTORE_PARAMS)
 
 
 void
-_mesa_fetch_texel_2d_rgba_fxt1( const struct gl_texture_image *texImage,
-                                GLint i, GLint j, GLint k, GLchan *texel )
-{
-   (void) k;
-   fxt1_decode_1(texImage->Data, texImage->RowStride, i, j, texel);
-}
-
-
-void
 _mesa_fetch_texel_2d_f_rgba_fxt1( const struct gl_texture_image *texImage,
                                   GLint i, GLint j, GLint k, GLfloat *texel )
 {
@@ -200,16 +184,6 @@ _mesa_fetch_texel_2d_f_rgba_fxt1( const struct gl_texture_image *texImage,
 
 
 void
-_mesa_fetch_texel_2d_rgb_fxt1( const struct gl_texture_image *texImage,
-                               GLint i, GLint j, GLint k, GLchan *texel )
-{
-   (void) k;
-   fxt1_decode_1(texImage->Data, texImage->RowStride, i, j, texel);
-   texel[ACOMP] = 255;
-}
-
-
-void
 _mesa_fetch_texel_2d_f_rgb_fxt1( const struct gl_texture_image *texImage,
                                  GLint i, GLint j, GLint k, GLfloat *texel )
 {
@@ -1673,3 +1647,6 @@ fxt1_decode_1 (const void *texture, GLint stride, /* in pixels */
 
    decode_1[mode](code, t, rgba);
 }
+
+
+#endif /* FEATURE_texture_fxt1 */
diff --git a/src/mesa/main/texcompress_fxt1.h b/src/mesa/main/texcompress_fxt1.h
index b74f955..d63ca71 100644
--- a/src/mesa/main/texcompress_fxt1.h
+++ b/src/mesa/main/texcompress_fxt1.h
@@ -25,8 +25,11 @@
 #ifndef TEXCOMPRESS_FXT1_H
 #define TEXCOMPRESS_FXT1_H
 
+#include "main/mtypes.h"
 #include "texstore.h"
 
+#if FEATURE_texture_fxt1
+
 extern GLboolean
 _mesa_texstore_rgb_fxt1(TEXSTORE_PARAMS);
 
@@ -34,20 +37,23 @@ extern GLboolean
 _mesa_texstore_rgba_fxt1(TEXSTORE_PARAMS);
 
 extern void
-_mesa_fetch_texel_2d_rgba_fxt1(const struct gl_texture_image *texImage,
-                               GLint i, GLint j, GLint k, GLchan *texel);
-
-extern void
 _mesa_fetch_texel_2d_f_rgba_fxt1(const struct gl_texture_image *texImage,
                                  GLint i, GLint j, GLint k, GLfloat *texel);
 
 extern void
-_mesa_fetch_texel_2d_rgb_fxt1(const struct gl_texture_image *texImage,
-                              GLint i, GLint j, GLint k, GLchan *texel);
-
-extern void
 _mesa_fetch_texel_2d_f_rgb_fxt1(const struct gl_texture_image *texImage,
                                 GLint i, GLint j, GLint k, GLfloat *texel);
 
+#else /* FEATURE_texture_fxt1 */
+
+/* these are used only in texstore_funcs[] */
+#define _mesa_texstore_rgb_fxt1 NULL
+#define _mesa_texstore_rgba_fxt1 NULL
+
+/* these are used only in texfetch_funcs[] */
+#define _mesa_fetch_texel_2d_f_rgba_fxt1 NULL
+#define _mesa_fetch_texel_2d_f_rgb_fxt1 NULL
+
+#endif /* FEATURE_texture_fxt1 */
 
 #endif /* TEXCOMPRESS_FXT1_H */
-- 
1.6.3.3

>From af110cbf3cd5769949069fee5d5c4e1576adf509 Mon Sep 17 00:00:00 2001
From: Chia-I Wu <[email protected]>
Date: Thu, 29 Oct 2009 14:59:42 +0800
Subject: [PATCH 3/4] mesa/main: Make FEATURE_texture_s3tc follow feature conventions.


Signed-off-by: Chia-I Wu <[email protected]>
---
 src/mesa/main/context.c          |    4 +---
 src/mesa/main/texcompress.h      |    5 -----
 src/mesa/main/texcompress_s3tc.c |    8 +++++++-
 src/mesa/main/texcompress_s3tc.h |   31 +++++++++++++++++++++++++++++++
 4 files changed, 39 insertions(+), 9 deletions(-)

diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 1d540eb..101d3c6 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -123,7 +123,7 @@
 #include "simple_list.h"
 #include "state.h"
 #include "stencil.h"
-#include "texcompress.h"
+#include "texcompress_s3tc.h"
 #include "teximage.h"
 #include "texobj.h"
 #include "texstate.h"
@@ -703,9 +703,7 @@ init_attrib_groups(GLcontext *ctx)
    if (!_mesa_init_texture( ctx ))
       return GL_FALSE;
 
-#if FEATURE_texture_s3tc
    _mesa_init_texture_s3tc( ctx );
-#endif
 
    /* Miscellaneous */
    ctx->NewState = _NEW_ALL;
diff --git a/src/mesa/main/texcompress.h b/src/mesa/main/texcompress.h
index d4873db..5e73a31 100644
--- a/src/mesa/main/texcompress.h
+++ b/src/mesa/main/texcompress.h
@@ -44,11 +44,6 @@ _mesa_compressed_image_address(GLint col, GLint row, GLint img,
                                gl_format mesaFormat,
                                GLsizei width, const GLubyte *image);
 
-
-extern void
-_mesa_init_texture_s3tc( GLcontext *ctx );
-
-
 #else /* _HAVE_FULL_GL */
 
 /* no-op macros */
diff --git a/src/mesa/main/texcompress_s3tc.c b/src/mesa/main/texcompress_s3tc.c
index 9fc73fe..b271a53 100644
--- a/src/mesa/main/texcompress_s3tc.c
+++ b/src/mesa/main/texcompress_s3tc.c
@@ -44,6 +44,10 @@
 #include "texcompress_s3tc.h"
 #include "texstore.h"
 
+
+#if FEATURE_texture_s3tc
+
+
 #ifdef __MINGW32__
 #define DXTN_LIBNAME "dxtn.dll"
 #define RTLD_LAZY 0
@@ -564,5 +568,7 @@ _mesa_fetch_texel_2d_f_srgba_dxt5(const struct gl_texture_image *texImage,
    texel[BCOMP] = nonlinear_to_linear(rgba[BCOMP]);
    texel[ACOMP] = CHAN_TO_FLOAT(rgba[ACOMP]);
 }
-#endif
+#endif /* FEATURE_EXT_texture_sRGB */
+
 
+#endif /* FEATURE_texture_s3tc */
diff --git a/src/mesa/main/texcompress_s3tc.h b/src/mesa/main/texcompress_s3tc.h
index 4041d24..2e7688d 100644
--- a/src/mesa/main/texcompress_s3tc.h
+++ b/src/mesa/main/texcompress_s3tc.h
@@ -25,8 +25,12 @@
 #ifndef TEXCOMPRESS_S3TC_H
 #define TEXCOMPRESS_S3TC_H
 
+#include "main/mtypes.h"
 #include "texstore.h"
 
+
+#if FEATURE_texture_s3tc
+
 extern GLboolean
 _mesa_texstore_rgb_dxt1(TEXSTORE_PARAMS);
 
@@ -71,5 +75,32 @@ extern void
 _mesa_fetch_texel_2d_f_srgba_dxt5(const struct gl_texture_image *texImage,
                                   GLint i, GLint j, GLint k, GLfloat *texel);
 
+extern void
+_mesa_init_texture_s3tc(GLcontext *ctx);
+
+#else /* FEATURE_texture_s3tc */
+
+/* these are used only in texstore_funcs[] */
+#define _mesa_texstore_rgb_dxt1 NULL
+#define _mesa_texstore_rgba_dxt1 NULL
+#define _mesa_texstore_rgba_dxt3 NULL
+#define _mesa_texstore_rgba_dxt5 NULL
+
+/* these are used only in texfetch_funcs[] */
+#define _mesa_fetch_texel_2d_f_rgb_dxt1 NULL
+#define _mesa_fetch_texel_2d_f_rgba_dxt1 NULL
+#define _mesa_fetch_texel_2d_f_rgba_dxt3 NULL
+#define _mesa_fetch_texel_2d_f_rgba_dxt5 NULL
+#define _mesa_fetch_texel_2d_f_srgb_dxt1 NULL
+#define _mesa_fetch_texel_2d_f_srgba_dxt1 NULL
+#define _mesa_fetch_texel_2d_f_srgba_dxt3 NULL
+#define _mesa_fetch_texel_2d_f_srgba_dxt5 NULL
+
+static INLINE void
+_mesa_init_texture_s3tc(GLcontext *ctx)
+{
+}
+
+#endif /* FEATURE_texture_s3tc */
 
 #endif /* TEXCOMPRESS_S3TC_H */
-- 
1.6.3.3

>From fbc5991b722ae8119cd763f6dd5b90b29c9a8f52 Mon Sep 17 00:00:00 2001
From: Chia-I Wu <[email protected]>
Date: Fri, 2 Oct 2009 15:32:04 +0800
Subject: [PATCH 4/4] mesa: Fix compilation errors and warnings when features are disabled.

Some of the fixes are cherry-picked from opengl-es branch.

Signed-off-by: Chia-I Wu <[email protected]>
---
 src/mesa/main/fbobject.c            |    2 ++
 src/mesa/main/texparam.c            |    2 +-
 src/mesa/main/texstore.c            |   21 ++++++++++-----------
 src/mesa/state_tracker/st_cb_blit.c |    2 ++
 4 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index 1d6ccf7..4c6528b 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -650,6 +650,8 @@ _mesa_test_framebuffer_completeness(GLcontext *ctx, struct gl_framebuffer *fb)
          return;
       }
    }
+#else
+   (void) j;
 #endif
 
    if (numImages == 0) {
diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c
index 4258476..79298e8 100644
--- a/src/mesa/main/texparam.c
+++ b/src/mesa/main/texparam.c
@@ -600,7 +600,7 @@ _mesa_TexParameterfv(GLenum target, GLenum pname, const GLfloat *params)
          iparams[1] = (GLint) params[1];
          iparams[2] = (GLint) params[2];
          iparams[3] = (GLint) params[3];
-         need_update = set_tex_parameteri(ctx, target, iparams);
+         need_update = set_tex_parameteri(ctx, texObj, pname, iparams);
       }
       break;
 #endif
diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c
index 01fea47..7b449d0 100644
--- a/src/mesa/main/texstore.c
+++ b/src/mesa/main/texstore.c
@@ -277,16 +277,6 @@ compute_component_mapping(GLenum inFormat, GLenum outFormat,
 }
 
 
-#if !FEATURE_convolve
-static void
-_mesa_adjust_image_for_convolution(GLcontext *ctx, GLuint dims,
-                                   GLsizei *srcWidth, GLsizei *srcHeight)
-{
-   /* no-op */
-}
-#endif
-
-
 /**
  * Make a temporary (color) texture image with GLfloat components.
  * Apply all needed pixel unpacking and pixel transfer operations.
@@ -353,7 +343,7 @@ make_temp_float_image(GLcontext *ctx, GLuint dims,
       const GLuint postConvTransferOps
          = (transferOps & IMAGE_POST_CONVOLUTION_BITS) | IMAGE_CLAMP_BIT;
       GLint img, row;
-      GLint convWidth, convHeight;
+      GLint convWidth = srcWidth, convHeight = srcHeight;
       GLfloat *convImage;
 
       /* pre-convolution image buffer (3D) */
@@ -3004,6 +2994,15 @@ _mesa_texstore_sla8(TEXSTORE_PARAMS)
    return k;
 }
 
+#else
+
+/* these are used only in texstore_funcs[] below */
+#define _mesa_texstore_srgb8 NULL
+#define _mesa_texstore_srgba8 NULL
+#define _mesa_texstore_sargb8 NULL
+#define _mesa_texstore_sl8 NULL
+#define _mesa_texstore_sla8 NULL
+
 #endif /* FEATURE_EXT_texture_sRGB */
 
 
diff --git a/src/mesa/state_tracker/st_cb_blit.c b/src/mesa/state_tracker/st_cb_blit.c
index 5626e25..563615e 100644
--- a/src/mesa/state_tracker/st_cb_blit.c
+++ b/src/mesa/state_tracker/st_cb_blit.c
@@ -64,6 +64,7 @@ st_destroy_blit(struct st_context *st)
 }
 
 
+#if FEATURE_EXT_framebuffer_blit
 static void
 st_BlitFramebuffer(GLcontext *ctx,
                    GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
@@ -206,6 +207,7 @@ st_BlitFramebuffer(GLcontext *ctx,
       }
    }
 }
+#endif /* FEATURE_EXT_framebuffer_blit */
 
 
 
-- 
1.6.3.3

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Mesa3d-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev

Reply via email to