[Piglit] [PATCH V2 1/6] ARB_sample_shading: Add test to verify new functions and enums
Paul Berry
stereotype441 at gmail.com
Tue Oct 29 15:39:35 CET 2013
On 25 October 2013 16:49, Anuj Phogat <anuj.phogat at gmail.com> wrote:
> Tests basic functionality of function:
> MinSampleShadingARB()
> and enums:
> SAMPLE_SHADING_ARB
> MIN_SAMPLE_SHADING_VALUE_ARB
>
> Signed-off-by: Anuj Phogat <anuj.phogat at gmail.com>
> ---
> tests/all.tests | 5 ++
> tests/spec/CMakeLists.txt | 1 +
> tests/spec/arb_sample_shading/CMakeLists.txt | 1 +
> .../arb_sample_shading/execution/CMakeLists.gl.txt | 14 +++++
> .../arb_sample_shading/execution/CMakeLists.txt | 1 +
> tests/spec/arb_sample_shading/execution/api.c | 69
> ++++++++++++++++++++++
> 6 files changed, 91 insertions(+)
> create mode 100644 tests/spec/arb_sample_shading/CMakeLists.txt
> create mode 100644
> tests/spec/arb_sample_shading/execution/CMakeLists.gl.txt
> create mode 100644 tests/spec/arb_sample_shading/execution/CMakeLists.txt
> create mode 100644 tests/spec/arb_sample_shading/execution/api.c
>
> diff --git a/tests/all.tests b/tests/all.tests
> index 9502ead..e30eb3b 100644
> --- a/tests/all.tests
> +++ b/tests/all.tests
> @@ -1331,6 +1331,11 @@ arb_sampler_objects['sampler-incomplete'] =
> concurrent_test('arb_sampler_objects
> arb_sampler_objects['GL_EXT_texture_sRGB_decode'] =
> concurrent_test('arb_sampler_objects-srgb-decode')
> arb_sampler_objects['framebufferblit'] =
> plain_test('arb_sampler_objects-framebufferblit')
>
> +# Group ARB_sample_shading
> +arb_sample_shading = Group()
> +spec['ARB_sample_shading'] = arb_sample_shading
> +add_plain_test(arb_sample_shading, 'arb_sample_shading-api')
> +
> # Group ARB_debug_output
> arb_debug_output = Group()
> spec['ARB_debug_output'] = arb_debug_output
> diff --git a/tests/spec/CMakeLists.txt b/tests/spec/CMakeLists.txt
> index 18b846d..4951c3c 100644
> --- a/tests/spec/CMakeLists.txt
> +++ b/tests/spec/CMakeLists.txt
> @@ -18,6 +18,7 @@ add_subdirectory (arb_occlusion_query)
> add_subdirectory (arb_occlusion_query2)
> add_subdirectory (arb_provoking_vertex)
> add_subdirectory (arb_robustness)
> +add_subdirectory (arb_sample_shading)
> add_subdirectory (arb_sampler_objects)
> add_subdirectory (arb_seamless_cube_map)
> add_subdirectory (amd_seamless_cubemap_per_texture)
> diff --git a/tests/spec/arb_sample_shading/CMakeLists.txt
> b/tests/spec/arb_sample_shading/CMakeLists.txt
> new file mode 100644
> index 0000000..bb76f08
> --- /dev/null
> +++ b/tests/spec/arb_sample_shading/CMakeLists.txt
> @@ -0,0 +1 @@
> +add_subdirectory (execution)
> diff --git a/tests/spec/arb_sample_shading/execution/CMakeLists.gl.txt
> b/tests/spec/arb_sample_shading/execution/CMakeLists.gl.txt
> new file mode 100644
> index 0000000..36289e0
> --- /dev/null
> +++ b/tests/spec/arb_sample_shading/execution/CMakeLists.gl.txt
> @@ -0,0 +1,14 @@
> +include_directories(
> + ${GLEXT_INCLUDE_DIR}
> + ${OPENGL_INCLUDE_PATH}
> + ${piglit_SOURCE_DIR}/tests/spec/arb_sample_shading
> +)
> +
> +link_libraries (
> + piglitutil_${piglit_target_api}
> + ${OPENGL_gl_LIBRARY}
> + ${OPENGL_glu_LIBRARY}
> +)
> +
> +piglit_add_executable (arb_sample_shading-api api.c)
> +# vim: ft=cmake:
> diff --git a/tests/spec/arb_sample_shading/execution/CMakeLists.txt
> b/tests/spec/arb_sample_shading/execution/CMakeLists.txt
> new file mode 100644
> index 0000000..144a306
> --- /dev/null
> +++ b/tests/spec/arb_sample_shading/execution/CMakeLists.txt
> @@ -0,0 +1 @@
> +piglit_include_target_api()
> diff --git a/tests/spec/arb_sample_shading/execution/api.c
> b/tests/spec/arb_sample_shading/execution/api.c
> new file mode 100644
> index 0000000..bb3f55b
> --- /dev/null
> +++ b/tests/spec/arb_sample_shading/execution/api.c
> @@ -0,0 +1,69 @@
> +/*
> + * 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 (including the
> next
> + * paragraph) 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
> + * THE AUTHORS OR COPYRIGHT HOLDERS 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.
> + */
> +
> +/**
> + * @file api.c
> + *
> + * Tests new APIs and enums added by ARB_sample_shading spec:
> + */
> +
> +
> +#include "piglit-util-gl-common.h"
> +
> +PIGLIT_GL_TEST_CONFIG_BEGIN
> +
> + config.supports_gl_compat_version = 10;
> + config.window_visual = PIGLIT_GL_VISUAL_RGB |
> PIGLIT_GL_VISUAL_DOUBLE;
> +
> +PIGLIT_GL_TEST_CONFIG_END
> +
> +enum piglit_result
> +piglit_display(void)
> +{
> + /* Unreached */
> + return PIGLIT_FAIL;
> +}
> +
> +void
> +piglit_init(int argc, char **argv)
> +{
> + float value;
> + bool pass = true;
> + piglit_require_extension("GL_ARB_sample_shading");
> +
> + pass = !glIsEnabled(GL_SAMPLE_SHADING_ARB) && pass;
> + glEnable(GL_SAMPLE_SHADING_ARB);
> + pass = glIsEnabled(GL_SAMPLE_SHADING_ARB) && pass;
> + glDisable(GL_SAMPLE_SHADING_ARB);
> + pass = !glIsEnabled(GL_SAMPLE_SHADING_ARB) && pass;
> + piglit_check_gl_error(GL_NO_ERROR);
> +
> + glGetFloatv(GL_MIN_SAMPLE_SHADING_VALUE_ARB, &value);
> + pass = (value == 0.0) && pass;
> + glMinSampleShadingARB(0.5);
> + glGetFloatv(GL_MIN_SAMPLE_SHADING_VALUE_ARB, &value);
> + pass = (value == 0.5) && pass;
> + piglit_check_gl_error(GL_NO_ERROR);
>
While we're at it, can we also verify that GL_MIN_SAMPLE_SHADING_VALUE_ARB
is clamped to the range [0, 1]?
With that added, this test is:
Reviewed-by: Paul Berry <stereotype441 at gmail.com>
> +
> + piglit_report_result( pass ? PIGLIT_PASS : PIGLIT_FAIL);
> +}
> --
> 1.8.1.4
>
> _______________________________________________
> 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/20131029/1729bb9d/attachment-0001.html>
More information about the Piglit
mailing list