[Mesa-dev] [PATCH 16/22] meta/blit: Generate MSAA-MSAA shader with a single ralloc_asprintf call

Ian Romanick idr at freedesktop.org
Thu Feb 18 01:58:09 UTC 2016


From: Ian Romanick <ian.d.romanick at intel.com>

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
 src/mesa/drivers/common/meta_blit.c | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/src/mesa/drivers/common/meta_blit.c b/src/mesa/drivers/common/meta_blit.c
index 08dd4a4..1d40199 100644
--- a/src/mesa/drivers/common/meta_blit.c
+++ b/src/mesa/drivers/common/meta_blit.c
@@ -419,8 +419,6 @@ setup_glsl_msaa_blit_shader(struct gl_context *ctx,
       /* You can create 2D_MULTISAMPLE textures with 0 sample count (meaning 1
        * sample).  Yes, this is ridiculous.
        */
-      char *sample_resolve;
-
       name = ralloc_asprintf(mem_ctx, "%svec4 MSAA %s",
                              vec4_prefix,
                              dst_is_msaa ? "copy" : "resolve");
@@ -447,12 +445,6 @@ setup_glsl_msaa_blit_shader(struct gl_context *ctx,
             tex_coords = "texCoords";
          }
 
-         sample_resolve =
-            ralloc_asprintf(mem_ctx,
-                            "   out_color = texelFetch(texSampler, "
-                            "i%s(%s), gl_SampleID);",
-                            texcoord_type, tex_coords);
-
          fs_source = ralloc_asprintf(mem_ctx,
                                      "#version 130\n"
                                      "#extension GL_ARB_texture_multisample: require\n"
@@ -465,14 +457,17 @@ setup_glsl_msaa_blit_shader(struct gl_context *ctx,
                                      "\n"
                                      "void main()\n"
                                      "{\n"
-                                     "%s\n" /* sample_resolve */
+                                     "   out_color = texelFetch(texSampler, i%s(%s), gl_SampleID);\n"
                                      "}\n",
                                      vec4_prefix,
                                      vec4_prefix,
                                      sampler_array_suffix,
                                      texcoord_type,
-                                     sample_resolve);
+                                     texcoord_type,
+                                     tex_coords);
+
       } else {
+         char *sample_resolve;
          const char *merge_function;
          int i;
          int step;
-- 
2.5.0



More information about the mesa-dev mailing list