[Piglit] [PATCH] EXT_framebuffer_multisample: Fix many tests with MAX_DRAW_BUFFERS 0.

Anuj Phogat anuj.phogat at gmail.com
Mon Jun 29 09:21:41 PDT 2015


On Tue, Jun 23, 2015 at 12:49 PM, Eric Anholt <eric at anholt.net> wrote:
> We've got a bunch of tests that only attach a single color attachment,
> but we were building the shader to always output 2/3 colors, which
> would fail on an implementation that didn't support that many draw
> buffers.
> ---
>  tests/spec/ext_framebuffer_multisample/draw-buffers-common.cpp | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/tests/spec/ext_framebuffer_multisample/draw-buffers-common.cpp b/tests/spec/ext_framebuffer_multisample/draw-buffers-common.cpp
> index 6d8634b..0d5adef 100644
> --- a/tests/spec/ext_framebuffer_multisample/draw-buffers-common.cpp
> +++ b/tests/spec/ext_framebuffer_multisample/draw-buffers-common.cpp
> @@ -124,6 +124,7 @@ static const char *vert_template =
>   */
>  static const char *frag_template =
>         "#version %s\n"
> +       "#define NUM_ATTACHMENTS %d\n"
>         "#define DUAL_SRC_BLEND %d\n"
>         "#define ALPHA_TO_COVERAGE %d\n"
>         "#define OUT_TYPE %s\n"
> @@ -133,14 +134,17 @@ static const char *frag_template =
>         "out vec4 frag_out_2;\n"
>         "#else\n"
>         "#define frag_out_0 gl_FragData[0]\n"
> +       "#if NUM_ATTACHMENTS > 1\n"
>         "#define frag_out_1 gl_FragData[1]\n"
>         "#define frag_out_2 gl_FragData[2]\n"
>         "#endif\n"
> +       "#endif\n"
>         "uniform OUT_TYPE frag_0_color;\n"
>         "uniform vec4 color;\n"
>         "void main()\n"
>         "{\n"
>         "  frag_out_0 = frag_0_color;\n"
> +       "#if NUM_ATTACHMENTS > 1\n"
>         "  #if DUAL_SRC_BLEND\n"
>         "    frag_out_1 = vec4(color.rgb, 1.0 - color.a / 2.0);\n"
>         "  #elif ALPHA_TO_COVERAGE\n"
> @@ -149,6 +153,7 @@ static const char *frag_template =
>         "  #else\n"
>         "    frag_out_1 = frag_out_2 = color;\n"
>         "  #endif\n"
> +       " #endif\n"
>         "}\n";
>
>  const char *
> @@ -183,6 +188,7 @@ shader_compile(bool sample_alpha_to_coverage, bool dual_src_blend)
>                                   strlen(out_type_glsl) + 4;
>         char *frag = (char *) malloc(frag_alloc_len);
>         sprintf(frag, frag_template, need_glsl130 ? "130" : "120",
> +               num_draw_buffers,
>                 is_dual_src_blending,
>                 sample_alpha_to_coverage, out_type_glsl);
>
> --
> 2.1.4
>
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit

Reviewed-by: Anuj Phogat <anuj.phogat at gmail.com>


More information about the Piglit mailing list