[Piglit] [PATCH 19/20] msaa: Make a static identity matrix for convenience.
Anuj Phogat
anuj.phogat at gmail.com
Wed Jun 6 16:51:40 PDT 2012
On Tue, Jun 5, 2012 at 5:03 PM, Paul Berry <stereotype441 at gmail.com> wrote:
> This patch adds a constant matrix TestPattern::no_projection (which is
> the identity matrix), for use by tests that don't need to pass a
> projection matrix when calling TestPattern::draw().
> ---
> tests/spec/ext_framebuffer_multisample/common.cpp | 9 +++++++++
> tests/spec/ext_framebuffer_multisample/common.h | 5 +++++
> .../multisample-blit.cpp | 8 +-------
> .../ext_framebuffer_multisample/unaligned-blit.cpp | 8 +-------
> 4 files changed, 16 insertions(+), 14 deletions(-)
>
> diff --git a/tests/spec/ext_framebuffer_multisample/common.cpp b/tests/spec/ext_framebuffer_multisample/common.cpp
> index bbd4d8f..982d991 100644
> --- a/tests/spec/ext_framebuffer_multisample/common.cpp
> +++ b/tests/spec/ext_framebuffer_multisample/common.cpp
> @@ -570,6 +570,15 @@ ManifestDepth::run()
> glDisable(GL_DEPTH_TEST);
> }
>
> +
> +const float TestPattern::no_projection[4][4] = {
> + { 1, 0, 0, 0 },
> + { 0, 1, 0, 0 },
> + { 0, 0, 1, 0 },
> + { 0, 0, 0, 1 }
> +};
> +
> +
> void Triangles::compile()
> {
> /* Triangle coords within (-1,-1) to (1,1) rect */
> diff --git a/tests/spec/ext_framebuffer_multisample/common.h b/tests/spec/ext_framebuffer_multisample/common.h
> index 659e1c8..07d892d 100644
> --- a/tests/spec/ext_framebuffer_multisample/common.h
> +++ b/tests/spec/ext_framebuffer_multisample/common.h
> @@ -220,8 +220,13 @@ public:
> * Draw the test pattern, applying the given projection matrix
> * to vertex coordinates. The projection matrix is in
> * row-major order.
> + *
> + * If no projection transformation is needed, pass
> + * TestPattern::no_projection for \c proj.
> */
> virtual void draw(const float (*proj)[4]) = 0;
> +
> + static const float no_projection[4][4];
> };
>
> /**
> diff --git a/tests/spec/ext_framebuffer_multisample/multisample-blit.cpp b/tests/spec/ext_framebuffer_multisample/multisample-blit.cpp
> index d8380f4..33a019a 100644
> --- a/tests/spec/ext_framebuffer_multisample/multisample-blit.cpp
> +++ b/tests/spec/ext_framebuffer_multisample/multisample-blit.cpp
> @@ -110,15 +110,9 @@ piglit_display()
> bool pass = true;
>
> /* Draw the test pattern in src_fbo. */
> - float proj[4][4] = {
> - { 1, 0, 0, 0 },
> - { 0, 1, 0, 0 },
> - { 0, 0, 1, 0 },
> - { 0, 0, 0, 1 }
> - };
> glBindFramebuffer(GL_DRAW_FRAMEBUFFER, src_fbo.handle);
> src_fbo.set_viewport();
> - test_pattern->draw(proj);
> + test_pattern->draw(TestPattern::no_projection);
>
> /* Blit from src_fbo to dst_fbo. */
> glBindFramebuffer(GL_READ_FRAMEBUFFER, src_fbo.handle);
> diff --git a/tests/spec/ext_framebuffer_multisample/unaligned-blit.cpp b/tests/spec/ext_framebuffer_multisample/unaligned-blit.cpp
> index ae6eac4..4a1c3f9 100644
> --- a/tests/spec/ext_framebuffer_multisample/unaligned-blit.cpp
> +++ b/tests/spec/ext_framebuffer_multisample/unaligned-blit.cpp
> @@ -168,15 +168,9 @@ piglit_display()
> bool pass = true;
>
> /* Draw the test pattern in src_fbo. */
> - float proj[4][4] = {
> - { 1, 0, 0, 0 },
> - { 0, 1, 0, 0 },
> - { 0, 0, 1, 0 },
> - { 0, 0, 0, 1 }
> - };
> glBindFramebuffer(GL_DRAW_FRAMEBUFFER, src_fbo.handle);
> src_fbo.set_viewport();
> - test_pattern->draw(proj);
> + test_pattern->draw(TestPattern::no_projection);
>
> /* Blit from src_fbo to dst_fbo, scrambling the pattern as we go. */
> glBindFramebuffer(GL_READ_FRAMEBUFFER, src_fbo.handle);
> --
> 1.7.7.6
>
Reviewed-by: Anuj Phogat <anuj.phogat at gmail.com>
More information about the Piglit
mailing list