Mesa (master): meta: Eliminate samplers[] array in favor of using vec4_prefix.

Kenneth Graunke kwg at kemper.freedesktop.org
Sat Feb 22 03:15:52 UTC 2014


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

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Fri Feb 21 16:58:09 2014 -0800

meta: Eliminate samplers[] array in favor of using vec4_prefix.

We don't need an array mapping the shader index to "sampler2DMS",
"isampler2DMS", and so on.  We can simply do "%ssampler2DMS" and pass in
vec4_prefix, which is "", "i", or "u".

This eliminates the use of C99 array initializers and should fix the
MSVC build.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=75344
Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
Reviewed-by: Eric Anholt <eric at anholt.net>

---

 src/mesa/drivers/common/meta_blit.c |   12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/src/mesa/drivers/common/meta_blit.c b/src/mesa/drivers/common/meta_blit.c
index 34b58d9..69c2590 100644
--- a/src/mesa/drivers/common/meta_blit.c
+++ b/src/mesa/drivers/common/meta_blit.c
@@ -93,14 +93,6 @@ setup_glsl_msaa_blit_shader(struct gl_context *ctx,
    GLuint vs, fs;
    void *mem_ctx;
    enum blit_msaa_shader shader_index;
-   const char *samplers[] = {
-      [BLIT_MSAA_SHADER_2D_MULTISAMPLE_RESOLVE] = "sampler2DMS",
-      [BLIT_MSAA_SHADER_2D_MULTISAMPLE_RESOLVE_INT] = "isampler2DMS",
-      [BLIT_MSAA_SHADER_2D_MULTISAMPLE_RESOLVE_UINT] = "usampler2DMS",
-      [BLIT_MSAA_SHADER_2D_MULTISAMPLE_COPY] = "sampler2DMS",
-      [BLIT_MSAA_SHADER_2D_MULTISAMPLE_COPY_INT] = "isampler2DMS",
-      [BLIT_MSAA_SHADER_2D_MULTISAMPLE_COPY_UINT] = "usampler2DMS",
-   };
    bool dst_is_msaa = false;
    GLenum src_datatype;
    const char *vec4_prefix;
@@ -305,7 +297,7 @@ setup_glsl_msaa_blit_shader(struct gl_context *ctx,
                                   "#version 130\n"
                                   "#extension GL_ARB_texture_multisample : enable\n"
                                   "%s\n"
-                                  "uniform %s texSampler;\n"
+                                  "uniform %ssampler2DMS texSampler;\n"
                                   "in vec2 texCoords;\n"
                                   "out %svec4 out_color;\n"
                                   "\n"
@@ -315,7 +307,7 @@ setup_glsl_msaa_blit_shader(struct gl_context *ctx,
                                   "%s\n" /* sample_resolve */
                                   "}\n",
                                   arb_sample_shading_extension_string,
-                                  samplers[shader_index],
+                                  vec4_prefix,
                                   vec4_prefix,
                                   merge_function,
                                   sample_resolve);




More information about the mesa-commit mailing list