[Piglit] [PATCH] gl-1.3-alpha_to_coverage_nop: new test of no-op GL_SAMPLE_ALPHA_TO_COVERAGE
Roland Scheidegger
sroland at vmware.com
Thu Sep 15 20:39:11 UTC 2016
This is proabably a feature not a bug in llvmpipe. The reason is that
d3d10 docs state
https://msdn.microsoft.com/de-de/library/windows/desktop/bb205072(v=vs.85).aspx
"Alpha-to-coverage will work regardless of whether or not multisampling
is also turned on in the rasterizer state (by setting MultisampleEnable
to TRUE or FALSE)."
(Albeit I've seen some other docs which stated otherwise...)
Therefore the gallium interface definition has to be that
alpha_to_coverage always applies regardless if multisampling
rasterization state is enabled or not, and the mesa state tracker would
need to translate the alpha_to_coverage bit away, otherwise it's
impossible for a driver to implement both gl and d3d10 behavior.
Reviewed-by: Roland Scheidegger <sroland at vmware.com>
Am 15.09.2016 um 22:16 schrieb Brian Paul:
> Currently fails with llvmpipe. Fragments with alpha <= 0.5 are discarded.
> Passes with softpipe, NVIDIA driver.
> ---
> tests/all.py | 1 +
> tests/spec/CMakeLists.txt | 1 +
> tests/spec/gl-1.3/CMakeLists.gl.txt | 13 +++++
> tests/spec/gl-1.3/CMakeLists.txt | 1 +
> tests/spec/gl-1.3/alpha_to_coverage_nop.c | 90 +++++++++++++++++++++++++++++++
> 5 files changed, 106 insertions(+)
> create mode 100644 tests/spec/gl-1.3/CMakeLists.gl.txt
> create mode 100644 tests/spec/gl-1.3/CMakeLists.txt
> create mode 100644 tests/spec/gl-1.3/alpha_to_coverage_nop.c
>
> diff --git a/tests/all.py b/tests/all.py
> index a448331..8610101 100644
> --- a/tests/all.py
> +++ b/tests/all.py
> @@ -840,6 +840,7 @@ with profile.group_manager(
> g(['gl-1.1-xor'])
> g(['gl-1.1-xor-copypixels'])
> g(['gl-1.2-texture-base-level'])
> + g(['gl-1.3-alpha_to_coverage'])
> g(['hiz'], run_concurrent=False)
> g(['infinite-spot-light'], run_concurrent=False)
> g(['line-aa-width'], run_concurrent=False)
> diff --git a/tests/spec/CMakeLists.txt b/tests/spec/CMakeLists.txt
> index 9b0f73e..9972785 100644
> --- a/tests/spec/CMakeLists.txt
> +++ b/tests/spec/CMakeLists.txt
> @@ -106,6 +106,7 @@ add_subdirectory (glsl-es-3.00)
> add_subdirectory (gl-1.0)
> add_subdirectory (gl-1.1)
> add_subdirectory (gl-1.2)
> +add_subdirectory (gl-1.3)
> add_subdirectory (gl-1.4)
> add_subdirectory (gl-1.5)
> add_subdirectory (gl-2.0)
> diff --git a/tests/spec/gl-1.3/CMakeLists.gl.txt b/tests/spec/gl-1.3/CMakeLists.gl.txt
> new file mode 100644
> index 0000000..607d2c1
> --- /dev/null
> +++ b/tests/spec/gl-1.3/CMakeLists.gl.txt
> @@ -0,0 +1,13 @@
> +include_directories(
> + ${GLEXT_INCLUDE_DIR}
> + ${OPENGL_INCLUDE_PATH}
> +)
> +
> +link_libraries (
> + piglitutil_${piglit_target_api}
> + ${OPENGL_gl_LIBRARY}
> +)
> +
> +piglit_add_executable (gl-1.3-alpha_to_coverage_nop alpha_to_coverage_nop.c)
> +
> +# vim: ft=cmake:
> diff --git a/tests/spec/gl-1.3/CMakeLists.txt b/tests/spec/gl-1.3/CMakeLists.txt
> new file mode 100644
> index 0000000..4a012b9
> --- /dev/null
> +++ b/tests/spec/gl-1.3/CMakeLists.txt
> @@ -0,0 +1 @@
> +piglit_include_target_api()
> \ No newline at end of file
> diff --git a/tests/spec/gl-1.3/alpha_to_coverage_nop.c b/tests/spec/gl-1.3/alpha_to_coverage_nop.c
> new file mode 100644
> index 0000000..da8323e
> --- /dev/null
> +++ b/tests/spec/gl-1.3/alpha_to_coverage_nop.c
> @@ -0,0 +1,90 @@
> +/*
> + * Copyright © 2016 VMware, Inc.
> + *
> + * 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.
> + */
> +
> +
> +/**
> + * Test that enabling GL_ALPHA_TO_COVERAGE has no effect for non-MSAA
> + * rendering.
> + */
> +
> +
> +#include "piglit-util-gl.h"
> +
> +PIGLIT_GL_TEST_CONFIG_BEGIN
> + config.supports_gl_compat_version = 13;
> + config.window_visual = PIGLIT_GL_VISUAL_RGBA | PIGLIT_GL_VISUAL_DOUBLE;
> +PIGLIT_GL_TEST_CONFIG_END
> +
> +
> +void
> +piglit_init(int argc, char **argv)
> +{
> + /* nothing */
> +}
> +
> +enum piglit_result
> +piglit_display(void)
> +{
> + GLint samples;
> + float alpha;
> +
> + glGetIntegerv(GL_SAMPLES, &samples);
> + if (samples != 0) {
> + printf("Unexpected GL_SAMPLES = %d\n", samples);
> + return PIGLIT_FAIL;
> + }
> +
> + glGetIntegerv(GL_SAMPLE_BUFFERS, &samples);
> + if (samples != 0) {
> + printf("Unexpected GL_SAMPLE_BUFFERS = %d\n", samples);
> + return PIGLIT_FAIL;
> + }
> +
> + glClearColor(1, 0, 0, 0);
> +
> + /* Enabling GL_SAMPLE_ALPHA_TO_COVERAGE should have no effect
> + * with a non-MSAA drawing surface.
> + */
> + glEnable(GL_SAMPLE_ALPHA_TO_COVERAGE);
> +
> + /* Render quad with varying alpha value. Make sure it draws
> + * and is not missing because of some kind of MSAA coverage bug.
> + */
> + for (alpha = 1.0; alpha >= 0.0; alpha -= 1.0/128) {
> + float expected[4] = {alpha, alpha, alpha, alpha};
> +
> + glClear(GL_COLOR_BUFFER_BIT);
> + glColor4fv(expected);
> + piglit_draw_rect(-1, -1, 2, 2);
> +
> + if (!piglit_probe_rect_rgba(0, 0, piglit_width, piglit_height,
> + expected)) {
> + printf("Rect did not draw for alpha = %g\n", alpha);
> + return PIGLIT_FAIL;
> + }
> +
> + piglit_present_results();
> + }
> +
> + return PIGLIT_PASS;
> +}
>
More information about the Piglit
mailing list