[Piglit] [PATCH] ARB_seamless_cube_map: test that sample from three faces returns value without border color

Paul Berry stereotype441 at gmail.com
Mon Aug 19 09:55:20 PDT 2013


On 15 August 2013 12:40, Steve Miller <dervishx at gmail.com> wrote:

> add new test to existing arb_seamless_cube_map group: sample three
> adjoining
>      faces and use average. if three faces are the same color, that color
> must
>      be used.
> add test to makelists and all.tests
> ---
>  tests/all.tests                                    |   1 +
>  tests/spec/arb_seamless_cube_map/CMakeLists.gl.txt |   1 +
>  .../arb_seamless_cube_map/three-faces-average.c    | 142
> +++++++++++++++++++++
>  3 files changed, 144 insertions(+)
>  create mode 100644 tests/spec/arb_seamless_cube_map/three-faces-average.c
>
> diff --git a/tests/all.tests b/tests/all.tests
> index 8766572..7240312 100644
> --- a/tests/all.tests
> +++ b/tests/all.tests
> @@ -2233,6 +2233,7 @@ arb_seamless_cube_map = Group()
>  spec['ARB_seamless_cube_map'] = arb_seamless_cube_map
>  add_plain_test(arb_seamless_cube_map, 'arb_seamless_cubemap')
>  add_plain_test(arb_seamless_cube_map,
> 'arb_seamless_cubemap-initially-disabled')
> +add_plain_test(arb_seamless_cube_map,
> 'arb_seamless_cubemap-three-faces-average')
>
>  amd_seamless_cubemap_per_texture = Group()
>  spec['AMD_seamless_cubemap_per_texture'] =
> amd_seamless_cubemap_per_texture
> diff --git a/tests/spec/arb_seamless_cube_map/CMakeLists.gl.txt
> b/tests/spec/arb_seamless_cube_map/CMakeLists.gl.txt
> index eac572a..e31759a 100644
> --- a/tests/spec/arb_seamless_cube_map/CMakeLists.gl.txt
> +++ b/tests/spec/arb_seamless_cube_map/CMakeLists.gl.txt
> @@ -11,5 +11,6 @@ link_libraries (
>
>  piglit_add_executable (arb_seamless_cubemap arb_seamless_cubemap.c)
>  piglit_add_executable (arb_seamless_cubemap-initially-disabled
> initially-disabled.c)
> +piglit_add_executable (arb_seamless_cubemap-three-faces-average
> three-faces-average.c)
>
>  # vim: ft=cmake:
> diff --git a/tests/spec/arb_seamless_cube_map/three-faces-average.c
> b/tests/spec/arb_seamless_cube_map/three-faces-average.c
> new file mode 100644
> index 0000000..5c3609d
> --- /dev/null
> +++ b/tests/spec/arb_seamless_cube_map/three-faces-average.c
> @@ -0,0 +1,142 @@
> +/*
> + * Copyright © Marek Olšák <maraeo at gmail.com>
>

I think you changed enough from the test you were cribbing from that it
makes sense to change this to "Copyright © 2013 Intel Corporation".


> + *
> + * Permission is hereby granted, free of charge, to any person obtaining a
> + * copy of this software and associated documentation files (the
> "Software"),
> + * to deal in the Software without restriction, including without
> limitation
> + * the rights to use, copy, modify, merge, publish, distribute,
> sublicense,
> + * and/or sell copies of the Software, and to permit persons to whom the
> + * Software is furnished to do so, subject to the following conditions:
> + *
> + * The above copyright notice and this permission notice shall be included
> + * in all copies or substantial portions of the Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
> + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
> MERCHANTABILITY,
> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT
> SHALL
> + * AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
> + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
> + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> SOFTWARE.
> + */
> +
> +/*
> + * Test verifies that when sampling from three ajoining faces in a cube
> map,
> + * samples will be averaged.If they share the same value, that value must
> be
>

Space after the period.


> + * guaranteed to be the result of the average. Resulting color should not
> include
> + * border color contamination.
> + */
> +
> +/*
> + * ARB_seamless_cube_map Section 3.8.7 says:
> + *     "If LINEAR filtering is done within a miplevel, always apply wrap
> mode
> + *     CLAMP_TO_BORDER. Then, ...
> + *
> + *     If a texture sample location would lie in the texture border in
> + *     both u and v (in one of the corners of the cube), there is no
> + *     unique neighboring face from which to extract one texel. The
> + *     recommended method is to average the values of the three
> + *     available samples. However, implementations are free to
> + *     construct this fourth texel in another way, so long as, when the
> + *     three available samples have the same value, this texel also has
> + *     that value."
> + */
> +
> +#include "piglit-util-gl-common.h"
> +
> +PIGLIT_GL_TEST_CONFIG_BEGIN
> +
> +       config.supports_gl_compat_version = 10;
> +
> +       config.window_width = 100;
> +       config.window_height = 40;
> +       config.window_visual = PIGLIT_GL_VISUAL_RGB |
> PIGLIT_GL_VISUAL_DOUBLE;
> +
> +PIGLIT_GL_TEST_CONFIG_END
> +
> +static const float red[3] = { 1., 0., 0. };
> +static const float blue[3] = { 0., 0., 1. };
> +static const float black[3] = { 0., 0., 0. };
> +
> +static const GLenum targets[6] = {
> +   GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB,
> +   GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB,
> +   GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB,
> +   GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB,
> +   GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB,
> +   GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB
> +};
> +
> +static void draw_quad(int x, int y, float s, float t, float r)
> +{
> +   glBegin(GL_QUADS);
> +      glTexCoord3f(s, t, r);
> +      glVertex2i(x,    y);
> +      glVertex2i(x,    y+20);
> +      glVertex2i(x+20, y+20);
> +      glVertex2i(x+20, y);
> +   glEnd();
> +}
>

We try to avoid using deprecated functionality in new tests.  Please
rewrite this test to use shaders, VBO's, etc.

Other than that, the test looks reasonable.  Thanks!


> +
> +void piglit_init( int argc, char **argv)
> +{
> +       GLint i;
> +
> +       piglit_require_extension( "GL_ARB_texture_cube_map" );
> +       piglit_require_extension( "GL_ARB_seamless_cube_map" );
> +
> +       glBindTexture( GL_TEXTURE_CUBE_MAP_ARB, 1 );
> +       /* set filter to linear, hardware should behave as if
> +        * wrap modes are set to CLAMP_TO_BORDER
> +        */
> +       glTexParameterfv( GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_BORDER_COLOR,
> +                         black );
> +       glTexParameteri( GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_MIN_FILTER,
> +                        GL_LINEAR );
> +       glTexParameteri( GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_MAG_FILTER,
> +                        GL_LINEAR );
> +
> +       /* texture positive axes/faces red */
> +       for( i = 0; i < 3; i++ )
> +       {
> +               glTexImage2D( targets[i], 0, GL_RGBA8, 1, 1, 0, GL_RGB,
> GL_FLOAT,
> +                             red );
> +       }
> +
> +       /* texuture negative axes/faces blue */
> +       for( i = 3; i < 6; i++ )
> +       {
> +               glTexImage2D( targets[i], 0, GL_RGBA8, 1, 1, 0, GL_RGB,
> GL_FLOAT,
> +                             blue );
> +       }
> +
> +       glEnable( GL_TEXTURE_CUBE_MAP_ARB );
> +
> +       glClearColor( 0.0, 0.0, 0.0, 0.0  );
> +
> +       piglit_ortho_projection( piglit_width, piglit_height, GL_FALSE );
> +}
> +
> +enum piglit_result piglit_display(void)
> +{
> +       bool pass = true;
> +
> +       glClear( GL_COLOR_BUFFER_BIT );
> +
> +       glEnable( GL_TEXTURE_CUBE_MAP_SEAMLESS );
> +
> +       /* texcoords should target vector to upper corner */
> +       draw_quad( 10, 10, 0.5, 0.5, 0.5 );
> +       /* expect red */
> +       pass = piglit_probe_pixel_rgb( 20, 20, red ) && pass;
> +
> +       /* texcoords should target vector to bottom corner */
> +       draw_quad ( 40, 10, -0.5, -0.5, -0.5 );
> +       /* expect blue */
> +       pass = piglit_probe_pixel_rgb( 50, 20, blue ) && pass;
> +
> +       glDisable( GL_TEXTURE_CUBE_MAP_SEAMLESS );
> +
> +       piglit_present_results();
> +
> +       return pass ? PIGLIT_PASS : PIGLIT_FAIL;
> +}
> --
> 1.8.3.1
>
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/piglit/attachments/20130819/77a630a3/attachment.html>


More information about the Piglit mailing list