[Mesa-dev] [PATCH 13/22] meta/blit: Generate separate shaders for MSAA-MSAA and MSAA-SS blits

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


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

This just copies and pastes the same code to both places.  The next
patches will clean it up.  This was done to ease reviewing.

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

diff --git a/src/mesa/drivers/common/meta_blit.c b/src/mesa/drivers/common/meta_blit.c
index 342627a..bd93e64 100644
--- a/src/mesa/drivers/common/meta_blit.c
+++ b/src/mesa/drivers/common/meta_blit.c
@@ -454,6 +454,28 @@ setup_glsl_msaa_blit_shader(struct gl_context *ctx,
                             texcoord_type, tex_coords);
 
          merge_function = "";
+
+         fs_source = ralloc_asprintf(mem_ctx,
+                                     "#version 130\n"
+                                     "#extension GL_ARB_texture_multisample : enable\n"
+                                     "#extension GL_ARB_sample_shading : enable\n"
+                                     "#extension GL_ARB_gpu_shader5 : enable\n"
+                                     "#define gvec4 %svec4\n"
+                                     "uniform %ssampler2DMS%s texSampler;\n"
+                                     "in %s texCoords;\n"
+                                     "out gvec4 out_color;\n"
+                                     "\n"
+                                     "%s" /* merge_function */
+                                     "void main()\n"
+                                     "{\n"
+                                     "%s\n" /* sample_resolve */
+                                     "}\n",
+                                     vec4_prefix,
+                                     vec4_prefix,
+                                     sampler_array_suffix,
+                                     texcoord_type,
+                                     merge_function,
+                                     sample_resolve);
       } else {
          int i;
          int step;
@@ -505,6 +527,28 @@ setup_glsl_msaa_blit_shader(struct gl_context *ctx,
                                    "   gl_FragColor = sample_%d_0 / %f;\n",
                                    samples, (float)samples);
          }
+
+         fs_source = ralloc_asprintf(mem_ctx,
+                                     "#version 130\n"
+                                     "#extension GL_ARB_texture_multisample : enable\n"
+                                     "#extension GL_ARB_sample_shading : enable\n"
+                                     "#extension GL_ARB_gpu_shader5 : enable\n"
+                                     "#define gvec4 %svec4\n"
+                                     "uniform %ssampler2DMS%s texSampler;\n"
+                                     "in %s texCoords;\n"
+                                     "out gvec4 out_color;\n"
+                                     "\n"
+                                     "%s" /* merge_function */
+                                     "void main()\n"
+                                     "{\n"
+                                     "%s\n" /* sample_resolve */
+                                     "}\n",
+                                     vec4_prefix,
+                                     vec4_prefix,
+                                     sampler_array_suffix,
+                                     texcoord_type,
+                                     merge_function,
+                                     sample_resolve);
       }
 
       vs_source = ralloc_asprintf(mem_ctx,
@@ -519,27 +563,6 @@ setup_glsl_msaa_blit_shader(struct gl_context *ctx,
                                   "}\n",
                                   texcoord_type,
                                   texcoord_type);
-      fs_source = ralloc_asprintf(mem_ctx,
-                                  "#version 130\n"
-                                  "#extension GL_ARB_texture_multisample : enable\n"
-                                  "#extension GL_ARB_sample_shading : enable\n"
-                                  "#extension GL_ARB_gpu_shader5 : enable\n"
-                                  "#define gvec4 %svec4\n"
-                                  "uniform %ssampler2DMS%s texSampler;\n"
-                                  "in %s texCoords;\n"
-                                  "out gvec4 out_color;\n"
-                                  "\n"
-                                  "%s" /* merge_function */
-                                  "void main()\n"
-                                  "{\n"
-                                  "%s\n" /* sample_resolve */
-                                  "}\n",
-                                  vec4_prefix,
-                                  vec4_prefix,
-                                  sampler_array_suffix,
-                                  texcoord_type,
-                                  merge_function,
-                                  sample_resolve);
    }
 
    _mesa_meta_compile_and_link_program(ctx, vs_source, fs_source, name,
-- 
2.5.0



More information about the mesa-dev mailing list