[Piglit] [PATCH 04/16] msaa/formats: Adapt test pattern drawing to handle integer formats.

Anuj Phogat anuj.phogat at gmail.com
Thu Jun 21 18:41:59 PDT 2012


On Fri, Jun 15, 2012 at 8:32 AM, Paul Berry <stereotype441 at gmail.com> wrote:
> This patch adapts the MSAA "formats" test so that it can draw to
> integer framebuffers, by creating 3 instantiations of the
> ColorGradientSunburst class, one for testing vec4's (for floating
> point and normalized formats), one for testing ivec4's (for signed
> integer formats), and one for testing uvec4's (for unsigned integer
> formats).
>
> The test determines which ColorGradientSunburst to use by querying
> GL_FRAMEBUFFERATTACHMENT_COMPONENT_TYPE.
> ---
>  tests/spec/ext_framebuffer_multisample/formats.cpp |   45 ++++++++++++++++++-
>  1 files changed, 42 insertions(+), 3 deletions(-)
>
> diff --git a/tests/spec/ext_framebuffer_multisample/formats.cpp b/tests/spec/ext_framebuffer_multisample/formats.cpp
> index 907f3d1..dc46038 100644
> --- a/tests/spec/ext_framebuffer_multisample/formats.cpp
> +++ b/tests/spec/ext_framebuffer_multisample/formats.cpp
> @@ -51,7 +51,9 @@ const int pattern_width = 256; const int pattern_height = 256;
>
>  int num_samples;
>
> -TestPattern *test_pattern;
> +ColorGradientSunburst *test_pattern_vec4;
> +ColorGradientSunburst *test_pattern_ivec4;
> +ColorGradientSunburst *test_pattern_uvec4;
>
>
>  /**
> @@ -74,6 +76,18 @@ public:
>         */
>        GLint color_bits[4];
>
> +       /**
> +        * Type of data in the color buffer.  E.g. GL_FLOAT,
> +        * GL_UNSIGNED_NORMALIZED, or GL_UNSIGNED_INT.
> +        */
> +       GLenum component_type;
> +
> +       /**
> +        * ColorGradientSunburst object that will be used to draw the
> +        * test pattern.
> +        */
> +       ColorGradientSunburst *test_pattern;
> +
>        Fbo fbo_msaa;
>        Fbo fbo_downsampled;
>  };
> @@ -110,6 +124,27 @@ PatternRenderer::try_setup(GLenum internalformat)
>        glGetFramebufferAttachmentParameteriv(
>                GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
>                GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE, &color_bits[3]);
> +       glGetFramebufferAttachmentParameteriv(
> +               GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
> +               GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE,
> +               (GLint *) &component_type);
> +
> +       switch (component_type) {
> +       case GL_INT:
> +               test_pattern = test_pattern_ivec4;
> +               break;
> +       case GL_UNSIGNED_INT:
> +               test_pattern = test_pattern_uvec4;
> +               break;
> +       case GL_UNSIGNED_NORMALIZED:
> +       case GL_FLOAT:
> +               test_pattern = test_pattern_vec4;
> +               break;
> +       default:
> +               printf("Unrecognized component type: %s\n",
> +                      piglit_get_gl_enum_name(component_type));
> +               piglit_report_result(PIGLIT_FAIL);
> +       }
>
>        return true;
>  }
> @@ -427,8 +462,12 @@ piglit_init(int argc, char **argv)
>
>        fbo_formats_init_test_set(0 /* core formats */,
>                                  GL_TRUE /* print_options */);
> -       test_pattern = new ColorGradientSunburst(GL_UNSIGNED_NORMALIZED);
> -       test_pattern->compile();
> +       test_pattern_vec4 = new ColorGradientSunburst(GL_UNSIGNED_NORMALIZED);
> +       test_pattern_vec4->compile();
> +       test_pattern_ivec4 = new ColorGradientSunburst(GL_INT);
> +       test_pattern_ivec4->compile();
> +       test_pattern_uvec4 = new ColorGradientSunburst(GL_UNSIGNED_INT);
> +       test_pattern_uvec4->compile();
>  }
>
>  extern "C" enum piglit_result
> --
> 1.7.7.6
>
> _______________________________________________
> 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