Re: [Piglit] [PATCH] fbo-depth-array: Don't create an enormous color render target

2015-11-27 Thread Ilia Mirkin
On Thu, Oct 29, 2015 at 7:32 AM, Neil Roberts  wrote:
> @@ -424,12 +446,7 @@ test_once(void)
> x = 1 + (layer % 3) * (width + 1);
> y = 1 + (layer / 3) * (height + 1);
> }
> -   draw_layer(x, y, layer);
> -
> -   pass &= test_layer_drawing(x, y,
> -  test_stencil ?
> -  get_stencil_value_float(layer) :
> -  get_depth_value(layer));
> +   draw_and_test_layer(x, y, layer);

That probably should have been pass &= draw_and_test_layer()
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] fbo-depth-array: Don't create an enormous color render target

2015-11-27 Thread Marek Olšák
Hi Neil,

This patch breaks the test. Now it always reports "pass" even when it
clearly prints failures.

Marek

On Thu, Oct 29, 2015 at 12:32 PM, Neil Roberts  wrote:
> When the -fbo option is given to the fbo-depth-array test it tries to
> render to a range of different depth/stencil buffer sizes with
> dimensions of up to 8192. It verifies the rendering was correct by
> binding the depth or stencil buffer as a texture source, rendering the
> texture into the Piglit winsys fbo and then probing the result. In
> order to cope with all of the possible buffer sizes it was setting the
> winsys framebuffer size to 8192x8192. Doing glReadPixels on a buffer
> this size causes problems for some platforms and makes the test run
> extremely slowly. The point of the test is just to check rendering to
> depth and stencil array textures of different sizes so the size of the
> renderbuffer isn't really relevant. This patch makes it instead leave
> the winsys buffer at the default size when an FBO is used and then
> render the texture multiple times in slices until it has checked the
> entire texture.
> ---
>  tests/fbo/fbo-depth-array.c | 53 
> ++---
>  1 file changed, 35 insertions(+), 18 deletions(-)
>
> diff --git a/tests/fbo/fbo-depth-array.c b/tests/fbo/fbo-depth-array.c
> index 1ea6611..b0acd5e 100644
> --- a/tests/fbo/fbo-depth-array.c
> +++ b/tests/fbo/fbo-depth-array.c
> @@ -65,11 +65,7 @@ PIGLIT_GL_TEST_CONFIG_BEGIN
> config.supports_gl_compat_version = 33;
> config.supports_gl_core_version = 33;
>
> -   if (piglit_use_fbo && !test_single_size) {
> -   config.window_width = MAX_DIM;
> -   config.window_height = MAX_DIM;
> -   }
> -   else {
> +   if (!piglit_use_fbo || test_single_size) {
> config.window_width = (width + 2) * MIN2(layers, 4);
> config.window_height = (height + 2) * ((layers + 2) / 3);
> }
> @@ -359,7 +355,10 @@ done:
>   * array texture.
>   */
>  static void
> -draw_layer(int x, int y, int depth)
> +draw_layer(int x, int y,
> +  int tx, int ty,
> +  int tw, int th,
> +  int depth)
>  {
> GLfloat depth_coord = (GLfloat)depth;
> GLuint prog = test_stencil ? program_texstencil : program_texdepth;
> @@ -385,18 +384,41 @@ draw_layer(int x, int y, int depth)
>
> piglit_draw_rect_tex((double)x / piglit_width * 2 - 1,
>  (double)y / piglit_height * 2 - 1,
> -(double)width / piglit_width * 2,
> -(double)height / piglit_height * 2,
> -0, 0, 1, 1);
> +(double)tw / piglit_width * 2,
> +(double)th / piglit_height * 2,
> +tx / (float) width, ty / (float) height,
> +tw / (float) width, th / (float) height);
> glUseProgram(0);
> if (!piglit_check_gl_error(GL_NO_ERROR))
> piglit_report_result(PIGLIT_FAIL);
>  }
>
> -static GLboolean test_layer_drawing(int start_x, int start_y, float expected)
> +static GLboolean draw_and_test_layer(int start_x, int start_y,
> +int layer)
>  {
> -   return piglit_probe_rect_r_ubyte(start_x, start_y, width, height,
> -expected * 255.0);
> +   float expected = (test_stencil ?
> + get_stencil_value_float(layer) :
> + get_depth_value(layer));
> +   int tx, ty, tw, th;
> +   GLboolean pass = GL_TRUE;
> +
> +   for (ty = 0; ty < height; ty += piglit_height - start_y) {
> +   for (tx = 0; tx < width; tx += piglit_width - start_x) {
> +   tw = MIN2(piglit_width - start_x, width - tx);
> +   th = MIN2(piglit_height - start_y, height - ty);
> +   draw_layer(start_x, start_y,
> +  tx, ty,
> +  tw, th,
> +  layer);
> +
> +   pass = piglit_probe_rect_r_ubyte(start_x, start_y,
> +tw, th,
> +expected * 255.0) &&
> +   pass;
> +   }
> +   }
> +
> +   return pass;
>  }
>
>  static bool
> @@ -424,12 +446,7 @@ test_once(void)
> x = 1 + (layer % 3) * (width + 1);
> y = 1 + (layer / 3) * (height + 1);
> }
> -   draw_layer(x, y, layer);
> -
> -   pass &= test_layer_drawing(x, y,
> -  test_stencil ?
> -  get_stencil_value_float(layer) :
> -  get_depth_value(layer));
> +   

Re: [Piglit] [PATCH v5] sso: test program pipeline with atomic counters

2015-11-27 Thread Timothy Arceri
On Fri, 2015-11-27 at 14:58 +0200, Tapani Pälli wrote:
> Test fails on current Mesa (i965 BDW) but passes on NVIDIA binary
> driver version 355.11 and AMD binary driver version 15.201.1151.
> 
> v2: - add error checks
> - modify to render points
> - make it possible to use regular program (makes test pass on
> Mesa)
> 
> v3: - bump up glsl version to 1.50 and redeclare gl_Position in vs
>   (makes the vs compile and test pass on AMD)
> 
> v4: - simplify and modify test to make sure to draw all pixels
>   (makes the test pass on NVIDIA, previously likely all pixels
>just got clipped away)
> 
> v5: - doh, do not free objects in piglit_display(), it can get called
>   multiple times ..
> 
> Signed-off-by: Tapani Pälli 
> ---
>  tests/all.py   |   2 +
>  .../arb_separate_shader_objects/CMakeLists.gl.txt  |   1 +
>  .../arb_separate_shader_objects/atomic-counter.c   | 153
> +
>  3 files changed, 156 insertions(+)
>  create mode 100644 tests/spec/arb_separate_shader_objects/atomic
> -counter.c
> 
> diff --git a/tests/all.py b/tests/all.py
> index 7689796..8d1b9f7 100644
> --- a/tests/all.py
> +++ b/tests/all.py
> @@ -2175,6 +2175,8 @@ with profile.group_manager(
>'400 combinations by name', run_concurrent=False)
>  g(['arb_separate_shader_object-active-sampler-conflict'],
>'active sampler conflict')
> +g(['arb_separate_shader_object-atomic-counter'],
> +  'atomic counter')
>  
>  # Group ARB_sampler_objects
>  with profile.group_manager(
> diff --git a/tests/spec/arb_separate_shader_objects/CMakeLists.gl.txt
> b/tests/spec/arb_separate_shader_objects/CMakeLists.gl.txt
> index db5f7c8..3a55130 100644
> --- a/tests/spec/arb_separate_shader_objects/CMakeLists.gl.txt
> +++ b/tests/spec/arb_separate_shader_objects/CMakeLists.gl.txt
> @@ -23,3 +23,4 @@ piglit_add_executable (arb_separate_shader_object
> -rendezvous_by_name rendezvous_
>  piglit_add_executable (arb_separate_shader_object
> -rendezvous_by_name_interpolation rendezvous_by_name_interpolation.c
> sso-common.c)
>  piglit_add_executable (arb_separate_shader_object-UseProgramStages
> -non-separable UseProgramStages-non-separable.c)
>  piglit_add_executable (arb_separate_shader_object
> -ValidateProgramPipeline ValidateProgramPipeline.c)
> +piglit_add_executable (arb_separate_shader_object-atomic-counter
> atomic-counter.c)
> diff --git a/tests/spec/arb_separate_shader_objects/atomic-counter.c
> b/tests/spec/arb_separate_shader_objects/atomic-counter.c
> new file mode 100644
> index 000..ca3c7d7
> --- /dev/null
> +++ b/tests/spec/arb_separate_shader_objects/atomic-counter.c
> @@ -0,0 +1,153 @@
> +/*
> + * Copyright © 2015 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 atomic-counter.c
> + *
> + * Test incrementing atomic counter in a separable program. A debug
> define
> + * REGULAR_PROGRAM can be used to test same program without SSO when
> debugging.

If we are going to include the code anyway and its usedfull for
debugging why not just make it a subtest?


> + */
> +
> +#include "piglit-util-gl.h"
> +
> +PIGLIT_GL_TEST_CONFIG_BEGIN
> +
> + config.supports_gl_core_version = 31;
> + config.window_visual = PIGLIT_GL_VISUAL_RGB |
> PIGLIT_GL_VISUAL_DOUBLE;
> +
> +PIGLIT_GL_TEST_CONFIG_END
> +
> +const char *vs_source =
> + "#version 150\n"
> + "in vec4 vertex;\n"
> + "out gl_PerVertex { vec4 gl_Position; }; \n"
> + "void main() {\n"
> + "   gl_Position = vertex;\n"
> + "}\n";
> +
> +const char *fs_source =
> + "#version 150\n"
> + "#extension GL_ARB_shader_atomic_counters : enable\n"
> + "layout(binding = 0, offset = 0) uniform atomic_uint
> counter;\n"
> + "out vec4 color;\n"
> + "void main() {\n"
> + "   atomi

[Piglit] [PATCH v5] sso: test program pipeline with atomic counters

2015-11-27 Thread Tapani Pälli
Test fails on current Mesa (i965 BDW) but passes on NVIDIA binary
driver version 355.11 and AMD binary driver version 15.201.1151.

v2: - add error checks
- modify to render points
- make it possible to use regular program (makes test pass on Mesa)

v3: - bump up glsl version to 1.50 and redeclare gl_Position in vs
  (makes the vs compile and test pass on AMD)

v4: - simplify and modify test to make sure to draw all pixels
  (makes the test pass on NVIDIA, previously likely all pixels
   just got clipped away)

v5: - doh, do not free objects in piglit_display(), it can get called
  multiple times ..

Signed-off-by: Tapani Pälli 
---
 tests/all.py   |   2 +
 .../arb_separate_shader_objects/CMakeLists.gl.txt  |   1 +
 .../arb_separate_shader_objects/atomic-counter.c   | 153 +
 3 files changed, 156 insertions(+)
 create mode 100644 tests/spec/arb_separate_shader_objects/atomic-counter.c

diff --git a/tests/all.py b/tests/all.py
index 7689796..8d1b9f7 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -2175,6 +2175,8 @@ with profile.group_manager(
   '400 combinations by name', run_concurrent=False)
 g(['arb_separate_shader_object-active-sampler-conflict'],
   'active sampler conflict')
+g(['arb_separate_shader_object-atomic-counter'],
+  'atomic counter')
 
 # Group ARB_sampler_objects
 with profile.group_manager(
diff --git a/tests/spec/arb_separate_shader_objects/CMakeLists.gl.txt 
b/tests/spec/arb_separate_shader_objects/CMakeLists.gl.txt
index db5f7c8..3a55130 100644
--- a/tests/spec/arb_separate_shader_objects/CMakeLists.gl.txt
+++ b/tests/spec/arb_separate_shader_objects/CMakeLists.gl.txt
@@ -23,3 +23,4 @@ piglit_add_executable 
(arb_separate_shader_object-rendezvous_by_name rendezvous_
 piglit_add_executable 
(arb_separate_shader_object-rendezvous_by_name_interpolation 
rendezvous_by_name_interpolation.c sso-common.c)
 piglit_add_executable 
(arb_separate_shader_object-UseProgramStages-non-separable 
UseProgramStages-non-separable.c)
 piglit_add_executable (arb_separate_shader_object-ValidateProgramPipeline 
ValidateProgramPipeline.c)
+piglit_add_executable (arb_separate_shader_object-atomic-counter 
atomic-counter.c)
diff --git a/tests/spec/arb_separate_shader_objects/atomic-counter.c 
b/tests/spec/arb_separate_shader_objects/atomic-counter.c
new file mode 100644
index 000..ca3c7d7
--- /dev/null
+++ b/tests/spec/arb_separate_shader_objects/atomic-counter.c
@@ -0,0 +1,153 @@
+/*
+ * Copyright © 2015 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 atomic-counter.c
+ *
+ * Test incrementing atomic counter in a separable program. A debug define
+ * REGULAR_PROGRAM can be used to test same program without SSO when debugging.
+ */
+
+#include "piglit-util-gl.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+   config.supports_gl_core_version = 31;
+   config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+const char *vs_source =
+   "#version 150\n"
+   "in vec4 vertex;\n"
+   "out gl_PerVertex { vec4 gl_Position; }; \n"
+   "void main() {\n"
+   "   gl_Position = vertex;\n"
+   "}\n";
+
+const char *fs_source =
+   "#version 150\n"
+   "#extension GL_ARB_shader_atomic_counters : enable\n"
+   "layout(binding = 0, offset = 0) uniform atomic_uint counter;\n"
+   "out vec4 color;\n"
+   "void main() {\n"
+   "   atomicCounterIncrement(counter);\n"
+   "   uint c = atomicCounter(counter);\n"
+   "   color = vec4(0.0, c, 0.0, 1.0);\n"
+   "}\n";
+
+GLuint buffer;
+#ifdef REGULAR_PROGRAM
+GLuint prog;
+#else
+GLuint vs, fs, pipe;
+#endif
+
+enum piglit_result
+piglit_display(void)
+{
+   bool pass = true;
+   uint32_t *data;
+
+   glViewport(0, 0, piglit_width, piglit_height);
+   

Re: [Piglit] [PATCH v3 4/4] framework/test/base.py: use subprocess32 for timeouts.

2015-11-27 Thread Thomas Wood
On 12 November 2015 at 22:52,   wrote:
> From: Dylan Baker 
>
> Subprocess32 provides a backport of (ironically) python 3.3's subprocess
> module, which has a timeout parameter. When the timeout runs out then an
> exception is raised, and when that exception is caught we can kill the
> process.
>
> This is fairly similar to the way the current timeout mechanism works,
> except that the current mechanism is not thread safe. Since one of the
> major features of piglit is that it offer's processes isolated
> concurrency of tests, it makes sense to make the effort to provide a
> timeout mechanism that can be used outside of IGT, which is a
> non-concurrent test suite.
>
> This patch look pretty substantial. It's not as big as it looks, since
> it adds some fairly big tests.
>
> v3: - Wait before terminating process
> - use os.getgrpid instead of os.getsid

os.getpgid?


> - use subprocess32 for accel profile in tox
> - Add warning when using the dummy version of TimeoutMixin

TimeoutExpired?


> - mark more unittests as slow and add timeouts to them
> - Remove the use of a Mixin, timeouts are an important enough
>   feature every test suite should have the option to use them, and
>   by not using a mixin there is no need for the ugly interface.
>
> Signed-off-by: Dylan Baker 
> ---
>  framework/results.py  |   2 +
>  framework/test/base.py| 130 
> --
>  framework/tests/base_tests.py | 117 -
>  tox.ini   |  10 ++--
>  4 files changed, 171 insertions(+), 88 deletions(-)
>
> diff --git a/framework/results.py b/framework/results.py
> index eeffcb7..ee41126 100644
> --- a/framework/results.py
> +++ b/framework/results.py
> @@ -96,6 +96,8 @@ class StringDescriptor(object):  # pylint: 
> disable=too-few-public-methods
>  setattr(instance, self.__name, value.decode('utf-8', 'replace'))
>  elif isinstance(value, unicode):
>  setattr(instance, self.__name, value)
> +elif value is None:
> +setattr(instance, self.__name, u'')

Unrelated change?


>  else:
>  raise TypeError('{} attribute must be a str or unicode instance, 
> '
>  'but was {}.'.format(self.__name, type(value)))
> diff --git a/framework/test/base.py b/framework/test/base.py
> index 7c7c410..d1b0c35 100644
> --- a/framework/test/base.py
> +++ b/framework/test/base.py
> @@ -25,16 +25,36 @@
>  from __future__ import print_function, absolute_import
>  import errno
>  import os
> -import subprocess
>  import time
>  import sys
>  import traceback
> -from datetime import datetime
> -import threading
> -import signal
>  import itertools
>  import abc
>  import copy
> +import signal
> +import warnings
> +
> +try:
> +import subprocess32 as subprocess
> +_EXTRA_POPEN_ARGS = {'start_new_session': True}
> +except ImportError:
> +import subprocess
> +
> +class TimeoutExpired(Exception):
> +pass
> +
> +class Popen(subprocess.Popen):
> +"""Sublcass of Popen that accepts and ignores a timeout argument."""
> +def communicate(self, *args, **kwargs):
> +if 'timeout' in kwargs:
> +del kwargs['timeout']
> +return super(Popen, self).communicate(*args, **kwargs)
> +
> +subprocess.TimeoutExpired = TimeoutExpired
> +subprocess.Popen = Popen
> +_EXTRA_POPEN_ARGS = {}
> +
> +warnings.warn('Timeouts are not available')
>
>  from framework import exceptions, options
>  from framework.results import TestResult
> @@ -61,56 +81,6 @@ class TestRunError(exceptions.PiglitException):
>  self.status = status
>
>
> -class ProcessTimeout(threading.Thread):
> -""" Timeout class for test processes
> -
> -This class is for terminating tests that run for longer than a certain
> -amount of time. Create an instance by passing it a timeout in seconds
> -and the Popen object that is running your test. Then call the start
> -method (inherited from Thread) to start the timer. The Popen object is
> -killed if the timeout is reached and it has not completed. Wait for the
> -outcome by calling the join() method from the parent.
> -
> -"""
> -
> -def __init__(self, timeout, proc):
> -threading.Thread.__init__(self)
> -self.proc = proc
> -self.timeout = timeout
> -self.status = 0
> -
> -def run(self):
> -start_time = datetime.now()
> -delta = 0
> -
> -# poll() returns the returncode attribute, which is either the return
> -# code of the child process (which could be zero), or None if the
> -# process has not yet terminated.
> -
> -while delta < self.timeout and self.proc.poll() is None:
> -time.sleep(1)
> -delta = (datetime.now() - start_time).total_seconds()
> -
> -# if the test is not finished after timeout, first try

Re: [Piglit] [PATCH 1/4] mulitsample-fast-clear: Test enabling GL_FRAMEBUFFER_SRGB

2015-11-27 Thread Pohjolainen, Topi
On Fri, Nov 27, 2015 at 11:03:05AM +0100, Neil Roberts wrote:
> "Pohjolainen, Topi"  writes:
> 
> >>glBindFramebuffer(GL_FRAMEBUFFER, piglit_winsys_fbo);
> >>piglit_draw_rect(offset * 16 * 2.0f / piglit_width - 1.0f,
> >
> > This is a question regarding the existing logic. Earlier the test
> > calls "glBindFramebuffer(GL_FRAMEBUFFER, fbo)" and clears the
> > framebuffer desigbated by "fbo". Then just above the test sets the
> > target framebuffer to "piglit_winsys_fbo", and blits into
> > "piglit_winsys_fbo" using piglit_draw_rect(). Please bare with me, but
> > I understand the idea being that the cleared values from "fbo" are
> > blit to "piglit_winsys_fbo". But "glBindFramebuffer(GL_FRAMEBUFFER,
> > piglit_winsys_fbo)" sets "piglit_winsys_fbo" both as source and
> > destination, doesn't it?
> 
> That is correct, but the read buffer is only used for a blit, ie when
> calling glBlitFramebuffer. This is not actually doing a blit but is
> instead drawing a regular rectangle while using the texture from the
> test framebuffer as a texture source. That means only the draw
> framebuffer is actually used. The idea of the test is to test sampling
> from the surface so that we can be sure the clear color programmed in
> the texture surface state works correctly, so I think it makes sense
> here to explicitly use the surface as a texture source rather than a
> blit.

Thanks for the explanation, it makes sense now. The patch is:

Reviewed-by: Topi Pohjolainen 
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 1/4] mulitsample-fast-clear: Test enabling GL_FRAMEBUFFER_SRGB

2015-11-27 Thread Neil Roberts
"Pohjolainen, Topi"  writes:

>>  glBindFramebuffer(GL_FRAMEBUFFER, piglit_winsys_fbo);
>>  piglit_draw_rect(offset * 16 * 2.0f / piglit_width - 1.0f,
>
> This is a question regarding the existing logic. Earlier the test
> calls "glBindFramebuffer(GL_FRAMEBUFFER, fbo)" and clears the
> framebuffer desigbated by "fbo". Then just above the test sets the
> target framebuffer to "piglit_winsys_fbo", and blits into
> "piglit_winsys_fbo" using piglit_draw_rect(). Please bare with me, but
> I understand the idea being that the cleared values from "fbo" are
> blit to "piglit_winsys_fbo". But "glBindFramebuffer(GL_FRAMEBUFFER,
> piglit_winsys_fbo)" sets "piglit_winsys_fbo" both as source and
> destination, doesn't it?

That is correct, but the read buffer is only used for a blit, ie when
calling glBlitFramebuffer. This is not actually doing a blit but is
instead drawing a regular rectangle while using the texture from the
test framebuffer as a texture source. That means only the draw
framebuffer is actually used. The idea of the test is to test sampling
from the surface so that we can be sure the clear color programmed in
the texture surface state works correctly, so I think it makes sense
here to explicitly use the surface as a texture source rather than a
blit.

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


[Piglit] [Bug 91670] [bisected] piglit.spec.!opengl 3_2.layered-rendering.framebuffertexture fails

2015-11-27 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=91670

--- Comment #12 from marius predut  ---
ok, I hope Kronos will update this manual reference pages, because seems Google
indexed it first , before any other specs.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH v4] sso: test program pipeline with atomic counters

2015-11-27 Thread Tapani Pälli
Test fails on current Mesa but passes on NVIDIA binary driver
version 355.11 and AMD binary driver version 15.201.1151.

v2: - add error checks
- modify to render points
- make it possible to use regular program (makes test pass on Mesa)

v3: - bump up glsl version to 1.50 and redeclare gl_Position in vs
  (makes the vs compile and test pass on AMD)

v4: - simplify and modify test to make sure to draw all pixels
  (makes the test pass on NVIDIA, previously likely all pixels
   just got clipped away)

Signed-off-by: Tapani Pälli 
---
 tests/all.py   |   2 +
 .../arb_separate_shader_objects/CMakeLists.gl.txt  |   1 +
 .../arb_separate_shader_objects/atomic-counter.c   | 163 +
 3 files changed, 166 insertions(+)
 create mode 100644 tests/spec/arb_separate_shader_objects/atomic-counter.c

diff --git a/tests/all.py b/tests/all.py
index 7689796..8d1b9f7 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -2175,6 +2175,8 @@ with profile.group_manager(
   '400 combinations by name', run_concurrent=False)
 g(['arb_separate_shader_object-active-sampler-conflict'],
   'active sampler conflict')
+g(['arb_separate_shader_object-atomic-counter'],
+  'atomic counter')
 
 # Group ARB_sampler_objects
 with profile.group_manager(
diff --git a/tests/spec/arb_separate_shader_objects/CMakeLists.gl.txt 
b/tests/spec/arb_separate_shader_objects/CMakeLists.gl.txt
index db5f7c8..3a55130 100644
--- a/tests/spec/arb_separate_shader_objects/CMakeLists.gl.txt
+++ b/tests/spec/arb_separate_shader_objects/CMakeLists.gl.txt
@@ -23,3 +23,4 @@ piglit_add_executable 
(arb_separate_shader_object-rendezvous_by_name rendezvous_
 piglit_add_executable 
(arb_separate_shader_object-rendezvous_by_name_interpolation 
rendezvous_by_name_interpolation.c sso-common.c)
 piglit_add_executable 
(arb_separate_shader_object-UseProgramStages-non-separable 
UseProgramStages-non-separable.c)
 piglit_add_executable (arb_separate_shader_object-ValidateProgramPipeline 
ValidateProgramPipeline.c)
+piglit_add_executable (arb_separate_shader_object-atomic-counter 
atomic-counter.c)
diff --git a/tests/spec/arb_separate_shader_objects/atomic-counter.c 
b/tests/spec/arb_separate_shader_objects/atomic-counter.c
new file mode 100644
index 000..13c5cba
--- /dev/null
+++ b/tests/spec/arb_separate_shader_objects/atomic-counter.c
@@ -0,0 +1,163 @@
+/*
+ * Copyright © 2015 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 atomic-counter.c
+ *
+ * Test incrementing atomic counter in a separable program. A debug define
+ * REGULAR_PROGRAM can be used to test same program without SSO when debugging.
+ */
+
+#include "piglit-util-gl.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+   config.supports_gl_core_version = 31;
+   config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+const char *vs_source =
+   "#version 150\n"
+   "in vec4 vertex;\n"
+   "out gl_PerVertex { vec4 gl_Position; }; \n"
+   "void main() {\n"
+   "   gl_Position = vertex;\n"
+   "}\n";
+
+const char *fs_source =
+   "#version 150\n"
+   "#extension GL_ARB_shader_atomic_counters : enable\n"
+   "layout(binding = 0, offset = 0) uniform atomic_uint counter;\n"
+   "out vec4 color;\n"
+   "void main() {\n"
+   "   atomicCounterIncrement(counter);\n"
+   "   uint c = atomicCounter(counter);\n"
+   "   color = vec4(0.0, c, 0.0, 1.0);\n"
+   "}\n";
+
+GLuint buffer;
+#ifdef REGULAR_PROGRAM
+GLuint prog;
+#else
+GLuint vs, fs, pipe;
+#endif
+
+enum piglit_result
+piglit_display(void)
+{
+   bool pass = true;
+   uint32_t *data;
+
+   glViewport(0, 0, piglit_width, piglit_height);
+   glClear(GL_COLOR_BUFFER_BIT);
+
+   piglit_draw_rect(-1, -1, 2, 2);
+
+   piglit_present_results()

Re: [Piglit] [PATCH 1/4] mulitsample-fast-clear: Test enabling GL_FRAMEBUFFER_SRGB

2015-11-27 Thread Pohjolainen, Topi
On Wed, Nov 25, 2015 at 06:11:50PM +0100, Neil Roberts wrote:

There is a typo in the subject: "mulitsample-fast-clear"
^

> If ???enable-fb-srgb??? is given on the command line to the fast clear
> test it will now enable GL_FRAMEBUFFER_SRGB before clearing the
> buffer. This should cause the clear color to be converted from SRGB to
> linear before being written to the framebuffer. The expected color is
> therefore converted to match. This exposes a bug on SKL in the i965
> driver when clearing SRGB MSRTs.
> ---
>  tests/all.py   |  4 ++
>  .../spec/ext_framebuffer_multisample/fast-clear.c  | 63 
> ++
>  2 files changed, 57 insertions(+), 10 deletions(-)
> 
> diff --git a/tests/all.py b/tests/all.py
> index 07e3599..fd07adb 100644
> --- a/tests/all.py
> +++ b/tests/all.py
> @@ -2039,6 +2039,10 @@ with profile.group_manager(
>  g(['framebuffer-srgb'], run_concurrent=False)
>  g(['arb_framebuffer_srgb-clear'])
>  g(['arb_framebuffer_srgb-pushpop'])
> +g(['ext_framebuffer_multisample-fast-clear',
> +   'GL_EXT_texture_sRGB',
> +   'enable-fb-srgb'],
> +  'msaa-fast-clear')
>  
>  with profile.group_manager(
>  PiglitGLTest,
> diff --git a/tests/spec/ext_framebuffer_multisample/fast-clear.c 
> b/tests/spec/ext_framebuffer_multisample/fast-clear.c
> index b3b57bf..9634eeb 100644
> --- a/tests/spec/ext_framebuffer_multisample/fast-clear.c
> +++ b/tests/spec/ext_framebuffer_multisample/fast-clear.c
> @@ -33,6 +33,13 @@
>   * various different code paths to implement a fast clear optimisation
>   * and the path taken depends on the color chosen to a certain
>   * degree.
> + *
> + * The test can take the following additional arguments:
> + *
> + *  enable-fb-srgb: This will cause it to enable GL_FRAMEBUFFER_SRGB
> + *before clearing the buffer so that it can test that the color
> + *gets correctly converted to SRGB before being stored in the
> + *color buffer.
>   */
>  
>  #include "piglit-util-gl.h"
> @@ -109,6 +116,36 @@ clear_colors[][4] = {
>  };
>  
>  static GLuint prog_float, prog_int, prog_uint;
> +static bool enable_fb_srgb = false;
> +
> +static void
> +convert_srgb_color(const struct format_desc *format,
> +float *color)
> +{
> + int i;
> +
> + /* If the texture is not an sRGB format then no conversion is
> +  * needed regardless of the sRGB settings.
> +  */
> + if (strstr(format->name, "SRGB") == NULL &&
> + strstr(format->name, "SLUMINANCE") == NULL)
> + return;
> +
> + /* If GL_FRAMEBUFFER_SRGB was enabled when we did the clear
> +  * then the clear color would have been converted to SRGB
> +  * before being written. When it is sampled it will be
> +  * converted back to linear. The two conversions cancel each
> +  * other out so we don't need to do anything.
> +  */
> + if (enable_fb_srgb)
> + return;
> +
> + /* Otherwise we need to compensate for the color being
> +  * converted to linear when sampled.
> +  */
> + for (i = 0; i < 3; i++)
> + color[i] = piglit_srgb_to_linear(color[i]);
> +}
>  
>  static enum piglit_result
>  test_color(GLuint fbo,
> @@ -119,10 +156,12 @@ test_color(GLuint fbo,
>  {
>   float expected_color[4];
>   float alpha_override;
> - int i;
>  
>   glBindFramebuffer(GL_FRAMEBUFFER, fbo);
>  
> + if (enable_fb_srgb)
> + glEnable(GL_FRAMEBUFFER_SRGB);
> +
>   switch (clear_type) {
>   case GL_INT: {
>   GLint clear_color_int[4] = {
> @@ -167,6 +206,9 @@ test_color(GLuint fbo,
>   break;
>   }
>  
> + if (enable_fb_srgb)
> + glDisable(GL_FRAMEBUFFER_SRGB);
> +
>   memcpy(expected_color, clear_color, sizeof expected_color);
>  
>   switch (format->base_internal_format) {
> @@ -204,13 +246,7 @@ test_color(GLuint fbo,
>   break;
>   }
>  
> - if (strstr(format->name, "SRGB") ||
> - strstr(format->name, "SLUMINANCE")) {
> - for (i = 0; i < 3; i++) {
> - expected_color[i] =
> - piglit_srgb_to_linear(expected_color[i]);
> - }
> - }
> + convert_srgb_color(format, expected_color);
>  
>   glBindFramebuffer(GL_FRAMEBUFFER, piglit_winsys_fbo);
>   piglit_draw_rect(offset * 16 * 2.0f / piglit_width - 1.0f,

This is a question regarding the existing logic. Earlier the test calls
"glBindFramebuffer(GL_FRAMEBUFFER, fbo)" and clears the framebuffer
desigbated by "fbo". Then just above the test sets the target framebuffer
to "piglit_winsys_fbo", and blits into "piglit_winsys_fbo" using
piglit_draw_rect().
Please bare with me, but I understand the idea being that the cleared values
from "fbo" are blit to "piglit_winsys_fbo". But
"glBindFramebuffer(GL_FRAMEBUFFER, piglit_winsys_fbo)" sets "piglit_winsys_fbo"
both as source and dest