[Piglit] [PATCH v3] arb_blend_func_extended: Test dual src blending without second color output
Ilia Mirkin
imirkin at alum.mit.edu
Fri Nov 9 19:19:24 UTC 2018
Sorry, I don't have time to review now, and may not for a bit. No
reason that I have to though...
On Fri, Nov 9, 2018 at 12:22 PM Dylan Baker <dylan at pnwbakers.com> wrote:
>
> I'm okay with merging this version, Ilia?
>
> Quoting Danylo Piliaiev (2018-11-09 05:27:05)
> > Hi,
> >
> > Since the fix for the underlying issue was pushed to Mesa in
> > eca4a6548d07bbbb02a7768edb397bad7b72cfc2
> > could this test be also pushed?
> >
> > - Danil
> >
> > On 7/9/18 11:54 AM, Danylo Piliaiev wrote:
> > > Using fragment shader without second color output should not hang gpu
> > > when dual source blending is enabled.
> > > It hanged Intel gen8+ GPUs when discarding fragments and depth test
> > > being enabled.
> > > There is also safeguard against lack of second color output in radeonsi.
> > >
> > > v2: by Ilia Mirkin
> > > - Set supports_gl_compat_version = 30
> > > - Moved drawing to piglit_display
> > > - Change drawing sequence to: clear red -> draw -> clear green
> > >
> > > v3: by Dylan Baker
> > > - Removed run_concurrent=False
> > >
> > > Signed-off-by: Danylo Piliaiev <danylo.piliaiev at globallogic.com>
> > > ---
> > > tests/opengl.py | 2 +
> > > .../execution/CMakeLists.gl.txt | 1 +
> > > .../execution/CMakeLists.gles3.txt | 1 +
> > > .../dual-src-blending-discard-without-src1.c | 126 ++++++++++++++++++
> > > 4 files changed, 130 insertions(+)
> > > create mode 100644 tests/spec/arb_blend_func_extended/execution/dual-src-blending-discard-without-src1.c
> > >
> > > diff --git a/tests/opengl.py b/tests/opengl.py
> > > index 02110ff86..1b088b75f 100644
> > > --- a/tests/opengl.py
> > > +++ b/tests/opengl.py
> > > @@ -4114,6 +4114,7 @@ with profile.test_list.group_manager(
> > > g(['arb_blend_func_extended-fbo-extended-blend'])
> > > g(['arb_blend_func_extended-fbo-extended-blend-explicit'])
> > > g(['arb_blend_func_extended-fbo-extended-blend-pattern'])
> > > + g(['arb_blend_func_extended-dual-src-blending-discard-without-src1'])
> > > g(['arb_blend_func_extended-blend-api_gles2'])
> > > g(['arb_blend_func_extended-builtins_gles2'])
> > > g(['arb_blend_func_extended-bindfragdataindexed-invalid-parameters_gles3'])
> > > @@ -4123,6 +4124,7 @@ with profile.test_list.group_manager(
> > > g(['arb_blend_func_extended-fbo-extended-blend-pattern_gles3'])
> > > g(['arb_blend_func_extended-fbo-extended-blend_gles3'])
> > > g(['arb_blend_func_extended-fbo-extended-blend-explicit_gles3'])
> > > + g(['arb_blend_func_extended-dual-src-blending-discard-without-src1_gles3'])
> > >
> > > with profile.test_list.group_manager(
> > > PiglitGLTest,
> > > diff --git a/tests/spec/arb_blend_func_extended/execution/CMakeLists.gl.txt b/tests/spec/arb_blend_func_extended/execution/CMakeLists.gl.txt
> > > index f48c352e1..09d45b72c 100644
> > > --- a/tests/spec/arb_blend_func_extended/execution/CMakeLists.gl.txt
> > > +++ b/tests/spec/arb_blend_func_extended/execution/CMakeLists.gl.txt
> > > @@ -12,4 +12,5 @@ link_libraries (
> > > piglit_add_executable (arb_blend_func_extended-fbo-extended-blend fbo-extended-blend.c)
> > > piglit_add_executable (arb_blend_func_extended-fbo-extended-blend-explicit fbo-extended-blend-explicit.c)
> > > piglit_add_executable (arb_blend_func_extended-fbo-extended-blend-pattern fbo-extended-blend-pattern.c)
> > > +piglit_add_executable (arb_blend_func_extended-dual-src-blending-discard-without-src1 dual-src-blending-discard-without-src1.c)
> > > # vim: ft=cmake:
> > > diff --git a/tests/spec/arb_blend_func_extended/execution/CMakeLists.gles3.txt b/tests/spec/arb_blend_func_extended/execution/CMakeLists.gles3.txt
> > > index a70e9fa5e..fd41622bd 100644
> > > --- a/tests/spec/arb_blend_func_extended/execution/CMakeLists.gles3.txt
> > > +++ b/tests/spec/arb_blend_func_extended/execution/CMakeLists.gles3.txt
> > > @@ -3,4 +3,5 @@ link_libraries(piglitutil_${piglit_target_api})
> > > piglit_add_executable (arb_blend_func_extended-fbo-extended-blend_${piglit_target_api} fbo-extended-blend.c)
> > > piglit_add_executable (arb_blend_func_extended-fbo-extended-blend-explicit_${piglit_target_api} fbo-extended-blend-explicit.c)
> > > piglit_add_executable (arb_blend_func_extended-fbo-extended-blend-pattern_${piglit_target_api} fbo-extended-blend-pattern.c)
> > > +piglit_add_executable (arb_blend_func_extended-dual-src-blending-discard-without-src1_${piglit_target_api} dual-src-blending-discard-without-src1.c)
> > > # vim: ft=cmake:
> > > diff --git a/tests/spec/arb_blend_func_extended/execution/dual-src-blending-discard-without-src1.c b/tests/spec/arb_blend_func_extended/execution/dual-src-blending-discard-without-src1.c
> > > new file mode 100644
> > > index 000000000..a0a45cd79
> > > --- /dev/null
> > > +++ b/tests/spec/arb_blend_func_extended/execution/dual-src-blending-discard-without-src1.c
> > > @@ -0,0 +1,126 @@
> > > +/* Copyright © 2018 Danylo Piliaiev
> > > + *
> > > + * 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.
> > > + */
> > > +
> > > +/**
> > > + * Drawing with dual source blending enabled while fragment shader
> > > + * doesn't write into src1 is undefined but it should not hang GPU.
> > > + * It hanged Intel gen8+ GPUs with depth test enabled.
> > > + *
> > > + * https://bugs.freedesktop.org/show_bug.cgi?id=107088
> > > + */
> > > +#include "piglit-util-gl.h"
> > > +
> > > +PIGLIT_GL_TEST_CONFIG_BEGIN
> > > +
> > > +#ifdef PIGLIT_USE_OPENGL
> > > + config.supports_gl_compat_version = 30;
> > > +#else // PIGLIT_USE_OPENGLES3
> > > + config.supports_gl_es_version = 30;
> > > +#endif
> > > + config.window_visual = PIGLIT_GL_VISUAL_RGBA | PIGLIT_GL_VISUAL_DEPTH;
> > > + config.khr_no_error_support = PIGLIT_NO_ERRORS;
> > > +
> > > +PIGLIT_GL_TEST_CONFIG_END
> > > +
> > > +#ifdef PIGLIT_USE_OPENGL
> > > +static const char *vs_text =
> > > + "#version 130\n"
> > > + "in vec4 vertex;\n"
> > > + "void main() { gl_Position = vertex; }\n"
> > > + ;
> > > +
> > > +static const char *fs_text =
> > > + "#version 130\n"
> > > + "void main() {\n"
> > > + " discard;\n"
> > > + "}\n"
> > > + ;
> > > +#else // PIGLIT_USE_OPENGLES3
> > > +static const char *vs_text =
> > > + "#version 300 es\n"
> > > + "in vec4 vertex;\n"
> > > + "void main() { gl_Position = vertex; }\n"
> > > + ;
> > > +
> > > +static const char *fs_text =
> > > + "#version 300 es\n"
> > > + "void main() {\n"
> > > + " discard;\n"
> > > + "}\n"
> > > + ;
> > > +#endif
> > > +
> > > +enum piglit_result
> > > +piglit_display(void)
> > > +{
> > > + const float green[] = {0.0, 1.0, 0.0};
> > > +
> > > + glClearColor(1.0, 0.0, 0.0, 1.0);
> > > + glClearDepth(1.0);
> > > +
> > > + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
> > > +
> > > + piglit_draw_rect(0, 0, 1, 1);
> > > +
> > > + bool pass = piglit_check_gl_error(GL_NO_ERROR);
> > > +
> > > + glClearColor(0.0, 1.0, 0.0, 1.0);
> > > + glClear(GL_COLOR_BUFFER_BIT);
> > > +
> > > + pass = pass && piglit_check_gl_error(GL_NO_ERROR);
> > > + pass = pass && piglit_probe_pixel_rgb(1, 1, green);
> > > +
> > > + glFinish();
> > > +
> > > + piglit_present_results();
> > > +
> > > + return pass ? PIGLIT_PASS : PIGLIT_FAIL;
> > > +}
> > > +
> > > +void piglit_init(int argc, char **argv)
> > > +{
> > > +#ifdef PIGLIT_USE_OPENGL
> > > + piglit_require_extension("GL_ARB_blend_func_extended");
> > > +#else // PIGLIT_USE_OPENGLES3
> > > + piglit_require_extension("GL_EXT_blend_func_extended");
> > > +#endif
> > > +
> > > + GLint max_dual_source;
> > > + glGetIntegerv(GL_MAX_DUAL_SOURCE_DRAW_BUFFERS, &max_dual_source);
> > > +
> > > + if (max_dual_source < 1) {
> > > + fprintf(stderr,
> > > + "ARB_blend_func_extended requires "
> > > + "GL_MAX_DUAL_SOURCE_DRAW_BUFFERS >= 1. "
> > > + "Only got %d!\n",
> > > + max_dual_source);
> > > + piglit_report_result(PIGLIT_FAIL);
> > > + }
> > > +
> > > + GLuint prog = piglit_build_simple_program(vs_text, fs_text);
> > > + glUseProgram(prog);
> > > +
> > > + glEnable(GL_BLEND);
> > > + glBlendFuncSeparate(GL_ONE, GL_SRC1_COLOR, GL_ONE, GL_ZERO);
> > > +
> > > + glEnable(GL_DEPTH_TEST);
> > > +}
> >
More information about the Piglit
mailing list