Mesa (master): swrast: merge get_texel_fetch_func() and set_fetch_functions ()

Brian Paul brianp at kemper.freedesktop.org
Fri Dec 14 14:32:52 UTC 2012


Module: Mesa
Branch: master
Commit: 90b7797a1d962e64eabd98b3aeb9251fd5b873bb
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=90b7797a1d962e64eabd98b3aeb9251fd5b873bb

Author: Brian Paul <brianp at vmware.com>
Date:   Sat Dec  8 15:19:44 2012 -0700

swrast: merge get_texel_fetch_func() and set_fetch_functions()

No real need for separate functions anymore.

---

 src/mesa/swrast/s_texfetch.c |   46 ++++++++++++++++++-----------------------
 1 files changed, 20 insertions(+), 26 deletions(-)

diff --git a/src/mesa/swrast/s_texfetch.c b/src/mesa/swrast/s_texfetch.c
index 9117885..c133eac 100644
--- a/src/mesa/swrast/s_texfetch.c
+++ b/src/mesa/swrast/s_texfetch.c
@@ -1175,9 +1175,15 @@ texfetch_funcs[] =
 };
 
 
-static FetchTexelFunc
-get_texel_fetch_func(gl_format format, GLuint dims)
+/**
+ * Initialize the texture image's FetchTexel methods.
+ */
+static void
+set_fetch_functions(const struct gl_sampler_object *samp,
+                    struct swrast_texture_image *texImage, GLuint dims)
 {
+   gl_format format = texImage->Base.TexFormat;
+
 #ifdef DEBUG
    /* check that the table entries are sorted by format name */
    gl_format fmt;
@@ -1188,39 +1194,27 @@ get_texel_fetch_func(gl_format format, GLuint dims)
 
    STATIC_ASSERT(Elements(texfetch_funcs) == MESA_FORMAT_COUNT);
 
+   if (samp->sRGBDecode == GL_SKIP_DECODE_EXT &&
+       _mesa_get_format_color_encoding(format) == GL_SRGB) {
+      format = _mesa_get_srgb_format_linear(format);
+   }
+
    assert(format < MESA_FORMAT_COUNT);
 
    switch (dims) {
    case 1:
-      return texfetch_funcs[format].Fetch1D;
+      texImage->FetchTexel = texfetch_funcs[format].Fetch1D;
+      break;
    case 2:
-      return texfetch_funcs[format].Fetch2D;
+      texImage->FetchTexel = texfetch_funcs[format].Fetch2D;
+      break;
    case 3:
-      return texfetch_funcs[format].Fetch3D;
+      texImage->FetchTexel = texfetch_funcs[format].Fetch3D;
+      break;
    default:
-      assert(0 && "bad dims in get_texel_fetch_func");
-      return NULL;
-   }
-}
-
-
-/**
- * Initialize the texture image's FetchTexel methods.
- */
-static void
-set_fetch_functions(struct gl_sampler_object *samp,
-                    struct swrast_texture_image *texImage, GLuint dims)
-{
-   gl_format format = texImage->Base.TexFormat;
-
-   ASSERT(dims == 1 || dims == 2 || dims == 3);
-
-   if (samp->sRGBDecode == GL_SKIP_DECODE_EXT &&
-       _mesa_get_format_color_encoding(format) == GL_SRGB) {
-      format = _mesa_get_srgb_format_linear(format);
+      assert(!"Bad dims in set_fetch_functions()");
    }
 
-   texImage->FetchTexel = get_texel_fetch_func(format, dims);
    ASSERT(texImage->FetchTexel);
 }
 




More information about the mesa-commit mailing list