<p dir="ltr">I don't think I received the rest of the series, and neither did the list archive. If all you want to do is test the shader parsing, just use a glslparsertest-runnable shader file.</p>
<p dir="ltr">IMHO there's not much point in testing the sample mask without any of the other frag tests.</p>
<div class="gmail_extra"><br><div class="gmail_quote">On Nov 10, 2016 7:03 AM, "Manolova, Plamena" <<a href="mailto:plamena.manolova@intel.com">plamena.manolova@intel.com</a>> wrote:<br type="attribution"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
______________________________<wbr>__________<br>
From: <a href="mailto:ibmirkin@gmail.com">ibmirkin@gmail.com</a> [<a href="mailto:ibmirkin@gmail.com">ibmirkin@gmail.com</a>] on behalf of Ilia Mirkin [<a href="mailto:imirkin@alum.mit.edu">imirkin@alum.mit.edu</a>]<br>
Sent: 10 November 2016 01:49<br>
To: Manolova, Plamena<br>
Cc: <a href="mailto:piglit@lists.freedesktop.org">piglit@lists.freedesktop.org</a><br>
Subject: Re: [Piglit] [PATCH 1/5] arb_post_depth_coverage-basic: Add a basic initial test.<br>
<div class="elided-text"><br>
On Wed, Nov 9, 2016 at 6:39 PM, Plamena Manolova<br>
<<a href="mailto:plamena.manolova@intel.com">plamena.manolova@intel.com</a>> wrote:<br>
> A basic test to check whether the values written to gl_SampleMaskIn<br>
> are still correct after enabling the ARB_post_depth_coverage<br>
> extension.<br>
><br>
> Signed-off-by: Plamena Manolova <<a href="mailto:plamena.manolova@intel.com">plamena.manolova@intel.com</a>><br>
> ---<br>
> registry/gl.xml | 2 +<br>
> tests/all.py | 5 +<br>
> tests/spec/CMakeLists.txt | 1 +<br>
> .../spec/arb_post_depth_<wbr>coverage/CMakeLists.gl.txt | 11 ++<br>
> tests/spec/arb_post_depth_<wbr>coverage/CMakeLists.txt | 1 +<br>
> tests/spec/arb_post_depth_<wbr>coverage/basic.c | 165 +++++++++++++++++++++<br>
> 6 files changed, 185 insertions(+)<br>
> create mode 100644 tests/spec/arb_post_depth_<wbr>coverage/CMakeLists.gl.txt<br>
> create mode 100644 tests/spec/arb_post_depth_<wbr>coverage/CMakeLists.txt<br>
> create mode 100644 tests/spec/arb_post_depth_<wbr>coverage/basic.c<br>
><br>
> diff --git a/registry/gl.xml b/registry/gl.xml<br>
> index 3fc8863..59894e8 100644<br>
> --- a/registry/gl.xml<br>
> +++ b/registry/gl.xml<br>
<br>
This file comes from Khronos and should be synchronized accordingly.<br>
It appears that there's already a line<br>
<br>
<extension name="GL_ARB_post_depth_<wbr>coverage" supported="gl"/><br>
<br>
in there. Not sure why you needed your change in the first place, this<br>
only matters for dispatch, of which there is none for this ext.<br>
<br>
> @@ -38345,6 +38345,8 @@ typedef unsigned int GLhandleARB;<br>
> <enum name="GL_ANY_SAMPLES_PASSED"/><br>
> </require><br>
> </extension><br>
> + <extension name="GL_ARB_post_depth_<wbr>coverage" supported="gl|glcore"><br>
> + </extension><br>
> <extension name="GL_ARB_parallel_shader_<wbr>compile" supported="gl"><br>
> <require><br>
> <enum name="GL_MAX_SHADER_COMPILER_<wbr>THREADS_ARB"/><br>
> diff --git a/tests/all.py b/tests/all.py<br>
> index e56cae8..d47187e 100644<br>
> --- a/tests/all.py<br>
> +++ b/tests/all.py<br>
> @@ -4766,6 +4766,11 @@ with profile.group_manager(<br>
> g(['arb_shader_image_load_<wbr>store-unused'], 'unused')<br>
><br>
> with profile.group_manager(<br>
> + PiglitGLTest,<br>
> + grouptools.join('spec', 'arb_post_depth_coverage')) as g:<br>
> + g(['arb_post_depth_coverage-<wbr>basic'])<br>
> +<br>
> +with profile.group_manager(<br>
> PiglitGLTest,<br>
> grouptools.join('spec', 'arb_shader_image_size')) as g:<br>
> g(['arb_shader_image_size-<wbr>builtin'], 'builtin')<br>
> diff --git a/tests/spec/CMakeLists.txt b/tests/spec/CMakeLists.txt<br>
> index a057c02..4377196 100644<br>
> --- a/tests/spec/CMakeLists.txt<br>
> +++ b/tests/spec/CMakeLists.txt<br>
> @@ -152,3 +152,4 @@ add_subdirectory (arb_query_buffer_object)<br>
> add_subdirectory (ext_window_rectangles)<br>
> add_subdirectory (arb_shader_texture_image_<wbr>samples)<br>
> add_subdirectory (arb_texture_barrier)<br>
> +add_subdirectory (arb_post_depth_coverage)<br>
> diff --git a/tests/spec/arb_post_depth_<wbr>coverage/CMakeLists.gl.txt b/tests/spec/arb_post_depth_<wbr>coverage/CMakeLists.gl.txt<br>
> new file mode 100644<br>
> index 0000000..1a71774<br>
> --- /dev/null<br>
> +++ b/tests/spec/arb_post_depth_<wbr>coverage/CMakeLists.gl.txt<br>
> @@ -0,0 +1,11 @@<br>
> +include_directories(<br>
> + ${GLEXT_INCLUDE_DIR}<br>
> + ${OPENGL_INCLUDE_PATH}<br>
> +)<br>
> +<br>
> +link_libraries (<br>
> + piglitutil_${piglit_target_<wbr>api}<br>
> + ${OPENGL_gl_LIBRARY}<br>
> +)<br>
> +<br>
> +piglit_add_executable (arb_post_depth_coverage-basic basic.c)<br>
> diff --git a/tests/spec/arb_post_depth_<wbr>coverage/CMakeLists.txt b/tests/spec/arb_post_depth_<wbr>coverage/CMakeLists.txt<br>
> new file mode 100644<br>
> index 0000000..144a306<br>
> --- /dev/null<br>
> +++ b/tests/spec/arb_post_depth_<wbr>coverage/CMakeLists.txt<br>
> @@ -0,0 +1 @@<br>
> +piglit_include_target_api()<br>
> diff --git a/tests/spec/arb_post_depth_<wbr>coverage/basic.c b/tests/spec/arb_post_depth_<wbr>coverage/basic.c<br>
> new file mode 100644<br>
> index 0000000..e1bd71f<br>
> --- /dev/null<br>
> +++ b/tests/spec/arb_post_depth_<wbr>coverage/basic.c<br>
> @@ -0,0 +1,165 @@<br>
> +/*<br>
> + * Copyright (c) 2015 Intel Corporation.<br>
> + *<br>
> + * Permission is hereby granted, free of charge, to any person obtaining a<br>
> + * copy of this software and associated documentation files (the "Software"),<br>
> + * to deal in the Software without restriction, including without limitation<br>
> + * the rights to use, copy, modify, merge, publish, distribute, sublicense,<br>
> + * and/or sell copies of the Software, and to permit persons to whom the<br>
> + * Software is furnished to do so, subject to the following conditions:<br>
> + *<br>
> + * The above copyright notice and this permission notice (including the next<br>
> + * paragraph) shall be included in all copies or substantial portions of the<br>
> + * Software.<br>
> + *<br>
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR<br>
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,<br>
> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL<br>
> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER<br>
> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING<br>
> + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER<br>
> + * DEALINGS IN THE SOFTWARE.<br>
> + */<br>
> +<br>
> +#include "piglit-util-gl.h"<br>
> +<br>
> +PIGLIT_GL_TEST_CONFIG_BEGIN<br>
> + config.supports_gl_compat_<wbr>version = 45;<br>
> + config.supports_gl_core_<wbr>version = 45;<br>
> + config.window_width = 160;<br>
> + config.window_height = 160;<br>
> + config.window_visual = PIGLIT_GL_VISUAL_DEPTH | PIGLIT_GL_VISUAL_RGBA;<br>
> +PIGLIT_GL_TEST_CONFIG_END<br>
> +<br>
> +static GLuint prog, vao, ssbo;<br>
> +static GLint *sample_mask;<br>
> +<br>
> +static GLuint<br>
> +make_shader_program(void)<br>
> +{<br>
> + static const char *vs_text =<br>
> + "#version 430\n"<br>
> + "in vec4 pos_in;\n"<br>
> + "void main()\n"<br>
> + "{\n"<br>
> + " gl_Position = pos_in;\n"<br>
<br>
I think if you use something called "piglit_vertex", you can just use<br>
piglit_draw_rect or whatever and avoid having to do all the vertex<br>
stuff by hand.<br>
<br>
> + "}\n";<br>
> +<br>
> + static const char *fs_text =<br>
> + "#version 430\n"<br>
> + "out vec4 color;\n"<br>
> + "layout(early_fragment_tests) in;\n"<br>
> + "layout(post_depth_coverage) in;\n"<br>
> + "layout(std430, binding = 0) buffer MaskOutput {"<br>
<br>
buffer restrict<br>
<br>
> + " int data[25600];"<br>
> + "} mask_output;"<br>
> + "void main()\n"<br>
> + "{\n"<br>
> + " int index = int(gl_FragCoord.y) * 160 + int(gl_FragCoord.x);\n"<br>
> + " mask_output.data[index] = gl_SampleMaskIn[0] & 0x1;\n"<br>
> + " color = vec4(1.0, 0.0, 0.0, 1.0);\n"<br>
> + "}\n";<br>
> +<br>
> + GLuint prog;<br>
> +<br>
> + prog = piglit_build_simple_program(<wbr>vs_text, fs_text);<br>
> + glUseProgram(prog);<br>
> +<br>
> + glBindAttribLocation(prog, 0, "pos_in");<br>
> +<br>
> + glLinkProgram(prog);<br>
> +<br>
> + if (!piglit_check_gl_error(GL_NO_<wbr>ERROR)) {<br>
> + piglit_report_result(PIGLIT_<wbr>FAIL);<br>
> + }<br>
> +<br>
> + return prog;<br>
> +}<br>
> +<br>
> +static void<br>
> +make_ssbo(void)<br>
> +{<br>
> + glGenBuffers(1, &ssbo);<br>
> + glBindBuffer(GL_SHADER_<wbr>STORAGE_BUFFER, ssbo);<br>
> +}<br>
> +<br>
> +static GLuint<br>
> +make_vao(void)<br>
> +{<br>
> + static const float pos_tc[4][2] = {<br>
> + { -1.0, -1.0 },<br>
> + { 1.0, -1.0 },<br>
> + { 1.0, 1.0 },<br>
> + { -1.0, 1.0 }<br>
> + };<br>
> + const int stride = sizeof(pos_tc[0]);<br>
> + GLuint vbo, vao;<br>
> +<br>
> + glGenVertexArrays(1, &vao);<br>
> + glBindVertexArray(vao);<br>
> +<br>
> + glGenBuffers(1, &vbo);<br>
> + glBindBuffer(GL_ARRAY_BUFFER, vbo);<br>
> + glBufferData(GL_ARRAY_BUFFER, sizeof(pos_tc), pos_tc, GL_STATIC_DRAW);<br>
> + piglit_check_gl_error(GL_NO_<wbr>ERROR);<br>
> +<br>
> + glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, stride, (void *) 0);<br>
> +<br>
> + glEnableVertexAttribArray(0);<br>
> +<br>
> + if (!piglit_check_gl_error(GL_NO_<wbr>ERROR)) {<br>
> + piglit_report_result(PIGLIT_<wbr>FAIL);<br>
> + }<br>
> +<br>
> + return vbo;<br>
> +}<br>
> +<br>
> +<br>
> +void<br>
> +piglit_init(int argc, char **argv)<br>
> +{<br>
> + piglit_require_gl_version(45);<br>
> + piglit_require_extension("GL_<wbr>ARB_post_depth_coverage");<br>
> + prog = make_shader_program();<br>
> + vao = make_vao();<br>
> + make_ssbo();<br>
> +}<br>
> +<br>
> +<br>
> +enum piglit_result<br>
> +piglit_display(void)<br>
> +{<br>
> + float red[4] = {1.0, 0.0, 0.0, 1.0};<br>
> + bool pass = true;<br>
> + int i;<br>
> +<br>
> + glViewport(0, 0, piglit_width, piglit_height);<br>
> + sample_mask = (GLint*) malloc (sizeof(GLint) * piglit_width * piglit_height);<br>
> + glBufferData(GL_SHADER_<wbr>STORAGE_BUFFER, sizeof(GLint) * piglit_width *<br>
> + piglit_height, &sample_mask[0], GL_DYNAMIC_DRAW);<br>
<br>
This will upload random stuff into the ssbo on start. I think you can<br>
just pass NULL in.<br>
<br>
> + glBindBufferBase(GL_SHADER_<wbr>STORAGE_BUFFER, 0, ssbo);<br>
> +<br>
> + glClearColor(0.0, 0.0, 0.0, 1.0);<br>
> + glClear(GL_COLOR_BUFFER_BIT);<br>
> + glDrawArrays(GL_TRIANGLE_FAN, 0, 4);<br>
> +<br>
> + glMemoryBarrier(GL_BUFFER_<wbr>UPDATE_BARRIER_BIT);<br>
> + glGetBufferSubData(GL_SHADER_<wbr>STORAGE_BUFFER, 0, sizeof(GLint) *<br>
> + piglit_width * piglit_height, &sample_mask[0]);<br>
> +<br>
> + for (i = 0; i < piglit_width * piglit_height; i++)<br>
> + {<br>
> + if (sample_mask[i] != 1) {<br>
<br>
So ... you don't have a depth test set up. And you're not using<br>
multi-sampling. How would this detect a no-op implementation, for<br>
example, that just parsed the layout param and did nothing with it?<br>
<br>
</div>Hi Ilia, thank you for reviewing! This is the first patch from a series<br>
of tests that I got ready for the arb_post_depth_coverage extension.<br>
The other 3 test the depth, stencil and multisampling capabilities.<br>
I made this test just to check whether the values in gl_SampleMaskIn<br>
are still correct after enabling the extension. I can combine this<br>
test with one of the others if you think there's no point to have it<br>
standalone.<br>
<div class="elided-text"><br>
> + pass = false;<br>
> + break;<br>
> + }<br>
> + }<br>
> +<br>
> + pass = piglit_probe_rect_rgba(0, 0, 160, 160, red) && pass;<br>
> + piglit_present_results();<br>
> +<br>
> + pass = piglit_check_gl_error(GL_NO_<wbr>ERROR) && pass;<br>
> +<br>
> + free(sample_mask);<br>
> + return pass ? PIGLIT_PASS : PIGLIT_FAIL;<br>
> +}<br>
> --<br>
> 2.7.4<br>
><br>
> ______________________________<wbr>_________________<br>
> Piglit mailing list<br>
> <a href="mailto:Piglit@lists.freedesktop.org">Piglit@lists.freedesktop.org</a><br>
> <a href="https://lists.freedesktop.org/mailman/listinfo/piglit" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/piglit</a><br>
</div></blockquote></div><br></div>