[Piglit] [PATCH 4/5] fbo-drawbuffers-none: Add a sub test for fragment shader out variables

Ilia Mirkin imirkin at alum.mit.edu
Mon May 19 13:56:23 PDT 2014


On Mon, May 19, 2014 at 4:51 PM, Anuj Phogat <anuj.phogat at gmail.com> wrote:
> Signed-off-by: Anuj Phogat <anuj.phogat at gmail.com>
> ---
>  tests/all.py                                       |  1 +
>  .../arb_framebuffer_object/fbo-drawbuffers-none.c  | 22 +++++++++++++++++++++-
>  2 files changed, 22 insertions(+), 1 deletion(-)
>
> diff --git a/tests/all.py b/tests/all.py
> index c841110..0cb8f2e 100644
> --- a/tests/all.py
> +++ b/tests/all.py
> @@ -1706,6 +1706,7 @@ add_concurrent_test(arb_framebuffer_object, 'fbo-drawbuffers-none glClear')
>  add_concurrent_test(arb_framebuffer_object, 'fbo-drawbuffers-none glClearBuffer')
>  add_concurrent_test(arb_framebuffer_object, 'fbo-drawbuffers-none gl_FragColor')
>  add_concurrent_test(arb_framebuffer_object, 'fbo-drawbuffers-none gl_FragData')
> +add_concurrent_test(arb_framebuffer_object, 'fbo-drawbuffers-none frag_out')

Shouldn't this be "use_frag_out" (or change use_frag_out -> frag_out
in the code below)

>  add_concurrent_test(arb_framebuffer_object, 'fbo-drawbuffers-none glColorMaskIndexed')
>  add_concurrent_test(arb_framebuffer_object, 'fbo-drawbuffers-none glBlendFunci')
>  add_concurrent_test(arb_framebuffer_object, 'fbo-drawbuffers-none glDrawPixels')
> diff --git a/tests/spec/arb_framebuffer_object/fbo-drawbuffers-none.c b/tests/spec/arb_framebuffer_object/fbo-drawbuffers-none.c
> index 10cc133..ee97247 100644
> --- a/tests/spec/arb_framebuffer_object/fbo-drawbuffers-none.c
> +++ b/tests/spec/arb_framebuffer_object/fbo-drawbuffers-none.c
> @@ -107,6 +107,7 @@ static const char *fs_write_red =
>         "}\n";
>
>  static const char *fs_template_write_different =
> +       "%s \n"
>         "#define OUTVAR %s \n"
>         "void main() \n"
>         "{ \n"
> @@ -124,13 +125,17 @@ static GLuint fb, prog_write_all_red, prog_write_all_different;
>  static void
>  create_shaders(void)
>  {
> +       bool fs_uses_out_variables = streq(test_name, "use_frag_out");
> +
>         prog_write_all_red = piglit_build_simple_program_multiple_shaders(
>                                 GL_VERTEX_SHADER, vs,
>                                 GL_FRAGMENT_SHADER, fs_write_red,
>                                 0);
>
>         asprintf(&fs_write_different, fs_template_write_different,
> -                "gl_FragData");
> +                fs_uses_out_variables ?
> +                "#version 130 \nout vec4[4] color;" : "",
> +                fs_uses_out_variables ? "color" : "gl_FragData");
>
>         prog_write_all_different = piglit_build_simple_program_multiple_shaders(
>                                 GL_VERTEX_SHADER, vs,
> @@ -267,6 +272,16 @@ test_fragcolor(const GLenum drawbufs[4])
>  }
>
>  static bool
> +test_fragout(const GLenum drawbufs[4])
> +{
> +       glUseProgram(prog_write_all_different);
> +       piglit_draw_rect(-1, -1, 2, 2);
> +       glUseProgram(0);
> +
> +       return probe_buffers(drawbufs, colors_all_different);
> +}
> +
> +static bool
>  test_fragdata(const GLenum drawbufs[4])
>  {
>         glUseProgram(prog_write_all_different);
> @@ -395,6 +410,7 @@ print_usage_and_exit(void)
>                "    glClearBuffer\n"
>                "    gl_FragColor\n"
>                "    gl_FragData\n"
> +              "    use_frag_out\n"
>                "    glColorMaskIndexed\n"
>                "    glBlendFunci\n"
>                "    glDrawPixels\n"
> @@ -456,6 +472,10 @@ piglit_display(void)
>                 else if (strcmp(test_name, "gl_FragData") == 0) {
>                         pass = test_fragdata(drawbuf_config[i]) && pass;
>                 }
> +               else if (strcmp(test_name, "use_frag_out") == 0) {
> +                       piglit_require_GLSL_version(130);
> +                       pass = test_fragout(drawbuf_config[i]) && pass;
> +               }
>                 else if (strcmp(test_name, "glColorMaskIndexed") == 0) {
>                         piglit_require_extension("GL_EXT_draw_buffers2");
>                         pass = test_glColorMaskIndexed(drawbuf_config[i]) && pass;
> --
> 1.8.3.1
>
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit


More information about the Piglit mailing list