Re: [Piglit] [PATCH 4/4] ext_shader_samples_identical: Simple fragment shader rendering test

2015-11-19 Thread Ian Romanick
On 11/19/2015 09:59 AM, Neil Roberts wrote:
> Ian Romanick  writes:
> 
>> +# Group EXT_shader_samples_identical
>> +with profile.group_manager(
>> +PiglitGLTest,
>> +grouptools.join('spec', 'EXT_shader_samples_identical')) as g:
>> +g(['ext_shader_samples_identical', '2'])
>> +g(['ext_shader_samples_identical', '4'])
>> +g(['ext_shader_samples_identical', '8'])
>> +g(['ext_shader_samples_identical', '16'])
> 
> It might be nice to iterate over MSAA_SAMPLE_COUNTS instead of
> hardcoding the sample counts.

There are a couple other places in all.py that use a hardcoded list.
I'll change those two.

>> +glUseProgram(draw_prog);
>> +glVertexAttribPointer(PIGLIT_ATTRIB_POS, 2, GL_FLOAT,
>> +  GL_FALSE, 0, tri_verts);
>> +glEnableVertexAttribArray(PIGLIT_ATTRIB_POS);
>> +glDrawArrays(GL_TRIANGLES, 0, 3);
>> +glDisableVertexAttribArray(PIGLIT_ATTRIB_POS);
> 
> It could be good to use piglit_draw_rect_from_arrays here and maybe draw
> a diamond shape or something instead of a triangle. That way it would be
> less code and it would be easier to port to a core profile because it
> wouldn't rely on being able to skip using a VBO and VAO. It should just
> work because you are using the standard Piglit names for your
> attributes.

Yeah, that's a good suggestion.  This is part of the "Much code borrowed
from tests/spec/arb_texture_multisample/texelfetch.c." :)  I'll change
the arb_texture_multisample test too.

I'll have v2 out in a couple hours.

>> +glVertexAttribPointer(PIGLIT_ATTRIB_POS, 2, GL_FLOAT,
>> +  GL_FALSE, 0, quad_verts);
>> +glVertexAttribPointer(PIGLIT_ATTRIB_TEX, 2, GL_FLOAT,
>> +  GL_FALSE, 0, quad_texcoords);
>> +glEnableVertexAttribArray(PIGLIT_ATTRIB_POS);
>> +glEnableVertexAttribArray(PIGLIT_ATTRIB_TEX);
>> +glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
>> +glDisableVertexAttribArray(PIGLIT_ATTRIB_POS);
>> +glDisableVertexAttribArray(PIGLIT_ATTRIB_TEX);
> 
> Same here, I think it could be good to use piglit_draw_rect_tex.
> 
> Otherwise seems like a neat test.
> 
> Regards,
> - Neil
> 

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 4/4] ext_shader_samples_identical: Simple fragment shader rendering test

2015-11-19 Thread Neil Roberts
Ian Romanick  writes:

> +# Group EXT_shader_samples_identical
> +with profile.group_manager(
> +PiglitGLTest,
> +grouptools.join('spec', 'EXT_shader_samples_identical')) as g:
> +g(['ext_shader_samples_identical', '2'])
> +g(['ext_shader_samples_identical', '4'])
> +g(['ext_shader_samples_identical', '8'])
> +g(['ext_shader_samples_identical', '16'])

It might be nice to iterate over MSAA_SAMPLE_COUNTS instead of
hardcoding the sample counts.

> + glUseProgram(draw_prog);
> + glVertexAttribPointer(PIGLIT_ATTRIB_POS, 2, GL_FLOAT,
> +   GL_FALSE, 0, tri_verts);
> + glEnableVertexAttribArray(PIGLIT_ATTRIB_POS);
> + glDrawArrays(GL_TRIANGLES, 0, 3);
> + glDisableVertexAttribArray(PIGLIT_ATTRIB_POS);

It could be good to use piglit_draw_rect_from_arrays here and maybe draw
a diamond shape or something instead of a triangle. That way it would be
less code and it would be easier to port to a core profile because it
wouldn't rely on being able to skip using a VBO and VAO. It should just
work because you are using the standard Piglit names for your
attributes.

> + glVertexAttribPointer(PIGLIT_ATTRIB_POS, 2, GL_FLOAT,
> +   GL_FALSE, 0, quad_verts);
> + glVertexAttribPointer(PIGLIT_ATTRIB_TEX, 2, GL_FLOAT,
> +   GL_FALSE, 0, quad_texcoords);
> + glEnableVertexAttribArray(PIGLIT_ATTRIB_POS);
> + glEnableVertexAttribArray(PIGLIT_ATTRIB_TEX);
> + glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
> + glDisableVertexAttribArray(PIGLIT_ATTRIB_POS);
> + glDisableVertexAttribArray(PIGLIT_ATTRIB_TEX);

Same here, I think it could be good to use piglit_draw_rect_tex.

Otherwise seems like a neat test.

Regards,
- Neil
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 4/4] ext_shader_samples_identical: Simple fragment shader rendering test

2015-11-18 Thread Ian Romanick
On 11/18/2015 05:46 PM, Ian Romanick wrote:
> From: Ian Romanick 
> 
> Render a simple image.  Scan the image.  At each texel, render blue if
> textureSamplesIdenticalEXT returns false.  If textureSamplesIdenticalEXT
> returns true, examine each sample.  If the samples are all the same
> color, render green.  Render red otherwise.  The test passes if there
> are zero red pixels and non-zero green pixels.

This (and the similar text in the code) were a little backwards.

It renders *green* if textureSamplesIdenticalEXT returns false.

It renders *blue* textureSamplesIdenticalEXT returns true and all the
samples match.

There still must be some green pixels... because there are edges in the
image drawn, and at least one of those must (statistically) have only
partial coverage.  This could probably be made more robust by modifying
the output sample coverage during rendering of some pixels.  Not sure
it's worth the effort.

Anyway... I've fixed the text locally.

> Much code borrowed from tests/spec/arb_texture_multisample/texelfetch.c.
> 
> Note: This is a pretty weak test.  A stronger test would read back the
> original multisampled image and verify the sample-indenticalness using
> that.
> 
> Signed-off-by: Ian Romanick 
> ---
>  tests/all.py   |   9 +
>  .../ext_shader_samples_identical/CMakeLists.gl.txt |  13 +
>  .../ext_shader_samples_identical/CMakeLists.txt|   1 +
>  .../spec/ext_shader_samples_identical/simple-fs.c  | 268 
> +
>  4 files changed, 291 insertions(+)
>  create mode 100644 tests/spec/ext_shader_samples_identical/CMakeLists.gl.txt
>  create mode 100644 tests/spec/ext_shader_samples_identical/CMakeLists.txt
>  create mode 100644 tests/spec/ext_shader_samples_identical/simple-fs.c
> 
> diff --git a/tests/all.py b/tests/all.py
> index e7cbddd..54281a9 100644
> --- a/tests/all.py
> +++ b/tests/all.py
> @@ -4528,5 +4528,14 @@ with profile.group_manager(
>  g(['oes_draw_elements_base_vertex-multidrawelements'],
>run_concurrent=False)
>  
> +# Group EXT_shader_samples_identical
> +with profile.group_manager(
> +PiglitGLTest,
> +grouptools.join('spec', 'EXT_shader_samples_identical')) as g:
> +g(['ext_shader_samples_identical', '2'])
> +g(['ext_shader_samples_identical', '4'])
> +g(['ext_shader_samples_identical', '8'])
> +g(['ext_shader_samples_identical', '16'])
> +
>  if platform.system() is 'Windows':
>  profile.filter_tests(lambda p, _: not p.startswith('glx'))
> diff --git a/tests/spec/ext_shader_samples_identical/CMakeLists.gl.txt 
> b/tests/spec/ext_shader_samples_identical/CMakeLists.gl.txt
> new file mode 100644
> index 000..0752483
> --- /dev/null
> +++ b/tests/spec/ext_shader_samples_identical/CMakeLists.gl.txt
> @@ -0,0 +1,13 @@
> +include_directories(
> + ${GLEXT_INCLUDE_DIR}
> + ${OPENGL_INCLUDE_PATH}
> + ${piglit_SOURCE_DIR}/tests/spec/arb_texture_multisample
> +)
> +
> +link_libraries (
> + piglitutil_${piglit_target_api}
> + ${OPENGL_gl_LIBRARY}
> +)
> +
> +piglit_add_executable (ext_shader_samples_identical-simple-fs simple-fs.c)
> +# vim: ft=cmake:
> diff --git a/tests/spec/ext_shader_samples_identical/CMakeLists.txt 
> b/tests/spec/ext_shader_samples_identical/CMakeLists.txt
> new file mode 100644
> index 000..144a306
> --- /dev/null
> +++ b/tests/spec/ext_shader_samples_identical/CMakeLists.txt
> @@ -0,0 +1 @@
> +piglit_include_target_api()
> diff --git a/tests/spec/ext_shader_samples_identical/simple-fs.c 
> b/tests/spec/ext_shader_samples_identical/simple-fs.c
> new file mode 100644
> index 000..c6cbfac
> --- /dev/null
> +++ b/tests/spec/ext_shader_samples_identical/simple-fs.c
> @@ -0,0 +1,268 @@
> +/*
> + * Copyright (c) 2015 Intel Corporation
> + * Copyright 2014 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.
> + */
> +
>

[Piglit] [PATCH 4/4] ext_shader_samples_identical: Simple fragment shader rendering test

2015-11-18 Thread Ian Romanick
From: Ian Romanick 

Render a simple image.  Scan the image.  At each texel, render blue if
textureSamplesIdenticalEXT returns false.  If textureSamplesIdenticalEXT
returns true, examine each sample.  If the samples are all the same
color, render green.  Render red otherwise.  The test passes if there
are zero red pixels and non-zero green pixels.

Much code borrowed from tests/spec/arb_texture_multisample/texelfetch.c.

Note: This is a pretty weak test.  A stronger test would read back the
original multisampled image and verify the sample-indenticalness using
that.

Signed-off-by: Ian Romanick 
---
 tests/all.py   |   9 +
 .../ext_shader_samples_identical/CMakeLists.gl.txt |  13 +
 .../ext_shader_samples_identical/CMakeLists.txt|   1 +
 .../spec/ext_shader_samples_identical/simple-fs.c  | 268 +
 4 files changed, 291 insertions(+)
 create mode 100644 tests/spec/ext_shader_samples_identical/CMakeLists.gl.txt
 create mode 100644 tests/spec/ext_shader_samples_identical/CMakeLists.txt
 create mode 100644 tests/spec/ext_shader_samples_identical/simple-fs.c

diff --git a/tests/all.py b/tests/all.py
index e7cbddd..54281a9 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -4528,5 +4528,14 @@ with profile.group_manager(
 g(['oes_draw_elements_base_vertex-multidrawelements'],
   run_concurrent=False)
 
+# Group EXT_shader_samples_identical
+with profile.group_manager(
+PiglitGLTest,
+grouptools.join('spec', 'EXT_shader_samples_identical')) as g:
+g(['ext_shader_samples_identical', '2'])
+g(['ext_shader_samples_identical', '4'])
+g(['ext_shader_samples_identical', '8'])
+g(['ext_shader_samples_identical', '16'])
+
 if platform.system() is 'Windows':
 profile.filter_tests(lambda p, _: not p.startswith('glx'))
diff --git a/tests/spec/ext_shader_samples_identical/CMakeLists.gl.txt 
b/tests/spec/ext_shader_samples_identical/CMakeLists.gl.txt
new file mode 100644
index 000..0752483
--- /dev/null
+++ b/tests/spec/ext_shader_samples_identical/CMakeLists.gl.txt
@@ -0,0 +1,13 @@
+include_directories(
+   ${GLEXT_INCLUDE_DIR}
+   ${OPENGL_INCLUDE_PATH}
+   ${piglit_SOURCE_DIR}/tests/spec/arb_texture_multisample
+)
+
+link_libraries (
+   piglitutil_${piglit_target_api}
+   ${OPENGL_gl_LIBRARY}
+)
+
+piglit_add_executable (ext_shader_samples_identical-simple-fs simple-fs.c)
+# vim: ft=cmake:
diff --git a/tests/spec/ext_shader_samples_identical/CMakeLists.txt 
b/tests/spec/ext_shader_samples_identical/CMakeLists.txt
new file mode 100644
index 000..144a306
--- /dev/null
+++ b/tests/spec/ext_shader_samples_identical/CMakeLists.txt
@@ -0,0 +1 @@
+piglit_include_target_api()
diff --git a/tests/spec/ext_shader_samples_identical/simple-fs.c 
b/tests/spec/ext_shader_samples_identical/simple-fs.c
new file mode 100644
index 000..c6cbfac
--- /dev/null
+++ b/tests/spec/ext_shader_samples_identical/simple-fs.c
@@ -0,0 +1,268 @@
+/*
+ * Copyright (c) 2015 Intel Corporation
+ * Copyright 2014 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.
+ */
+
+/** \file simple-fs.c
+ * Simple fragment shader test for textureSamplesIdenticalEXT.
+ *
+ * Render a simple image.  Scan the image.  At each texel, render blue if
+ * textureSamplesIdenticalEXT returns false.  If textureSamplesIdenticalEXT
+ * returns true, examine each sample.  If the samples are all the same color,
+ * render green.  Render red otherwise.  The test passes if there are zero red
+ * pixels and non-zero green pixels.
+ *
+ * Much code borrowed from tests/spec/arb_texture_multisample/texelfetch.c.
+ *
+ * \note
+ * This is a pretty weak test.  A stronger test would read back the original
+ * multisampled image and verify the sample-indenticalness using that.
+ */
+#include "piglit-util-gl.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+config.supports_gl_compat_version = 30;
+confi