[Piglit] [PATCH] arb_dsa: avoid non-determinism in create-programpipelines subtests

2015-06-17 Thread Ilia Mirkin
Right now the default label size test fails due to mesa not implementing
the call, and length is uninitialized, which causes the subtest name to
keep changing. A well-behaved impl won't modify the param on error, so
initialize it to a known-bad value.

Signed-off-by: Ilia Mirkin 
---
 tests/spec/arb_direct_state_access/create-programpipelines.c | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/tests/spec/arb_direct_state_access/create-programpipelines.c 
b/tests/spec/arb_direct_state_access/create-programpipelines.c
index 981c206..c9992e2 100644
--- a/tests/spec/arb_direct_state_access/create-programpipelines.c
+++ b/tests/spec/arb_direct_state_access/create-programpipelines.c
@@ -87,27 +87,32 @@ piglit_display(void)
SUBTESTCONDITION(glIsProgramPipeline(ids[2]), pass,
 "IsProgramPipeline()");
 
+   param = -1;
glGetProgramPipelineiv(ids[2], GL_ACTIVE_PROGRAM, ¶m);
piglit_check_gl_error(GL_NO_ERROR);
SUBTESTCONDITION(param == 0, pass,
 "default active program(%d) == 0", param);
 
+   param = -1;
glGetProgramPipelineiv(ids[2], GL_VERTEX_SHADER, ¶m);
piglit_check_gl_error(GL_NO_ERROR);
SUBTESTCONDITION(param == 0, pass,
 "default vertex shader program(%d) == 0", param);
 
+   param = -1;
glGetProgramPipelineiv(ids[2], GL_GEOMETRY_SHADER, ¶m);
piglit_check_gl_error(GL_NO_ERROR);
SUBTESTCONDITION(param == 0, pass,
 "default geometry shader program(%d) == 0", param);
 
+   param = -1;
glGetProgramPipelineiv(ids[2], GL_FRAGMENT_SHADER, ¶m);
piglit_check_gl_error(GL_NO_ERROR);
SUBTESTCONDITION(param == 0, pass,
 "default fragment shader program(%d) == 0", param);
 
if (piglit_is_extension_supported("GL_ARB_compute_shader")) {
+   param = -1;
glGetProgramPipelineiv(ids[2], GL_COMPUTE_SHADER, ¶m);
piglit_check_gl_error(GL_NO_ERROR);
SUBTESTCONDITION(param == 0, pass,
@@ -119,11 +124,13 @@ piglit_display(void)
}
 
if (piglit_is_extension_supported("GL_ARB_tessellation_shader")) {
+   param = -1;
glGetProgramPipelineiv(ids[2], GL_TESS_CONTROL_SHADER, ¶m);
piglit_check_gl_error(GL_NO_ERROR);
SUBTESTCONDITION(param == 0, pass,
 "default TCS(%d) == 0", param);
 
+   param = -1;
glGetProgramPipelineiv(ids[2], GL_TESS_EVALUATION_SHADER,
   ¶m);
piglit_check_gl_error(GL_NO_ERROR);
@@ -137,16 +144,19 @@ piglit_display(void)
 "default TES == 0");
}
 
+   param = -1;
glGetProgramPipelineiv(ids[2], GL_VALIDATE_STATUS, ¶m);
piglit_check_gl_error(GL_NO_ERROR);
SUBTESTCONDITION(param == GL_FALSE, pass,
 "default validate status(%d) == FALSE", param);
 
+   param = -1;
glGetProgramPipelineiv(ids[2], GL_INFO_LOG_LENGTH, ¶m);
piglit_check_gl_error(GL_NO_ERROR);
SUBTESTCONDITION(param == 0, pass,
 "startup log length(%d) == 0", param);
 
+   length = -1;
glGetObjectLabel(GL_PROGRAM_PIPELINE, ids[2], 11, &length, label);
piglit_check_gl_error(GL_NO_ERROR);
SUBTESTCONDITION(length == 0, pass,
-- 
2.3.6

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


Re: [Piglit] [PATCH] glsl-es-3.10: dont run gles tests where restrictions apply

2015-06-17 Thread Mark Janes
Tested-by: Mark Janes 

Timothy Arceri  writes:

> In GLES vertex shader outputs cant be arrays of structs or structs that
> contain arrays or structs.
>
> The GLSL ES 3.0 spec says:
>
> "Vertex output variables output per-vertex data and are declared
> using the out storage qualifier or the centroid out storage qualifier.
> They can only be float, floating-point vectors, matrices, signed or
> unsigned integers or integer vectors, or arrays or structures of any
> these."
>
> The GLSL ES 3.1 is a bit clearer about this:
>
> It is a compile-time error to declare a vertex shader output with,
>  or that contains, any of the following types:
>
> * A boolean type
> * An opaque type
> * An array of arrays
> * An array of structures
> * A structure containing an array
> * A structure containing a structure
>
> CC: Mark Janes 
> ---
>  tests/all.py   |  13 +-
>  .../execution/varying-struct-arrays.shader_test| 237 
> -
>  2 files changed, 9 insertions(+), 241 deletions(-)
>  delete mode 100644 
> tests/spec/glsl-es-3.00/execution/varying-struct-arrays.shader_test
>
> diff --git a/tests/all.py b/tests/all.py
> index 2839059..47fe503 100755
> --- a/tests/all.py
> +++ b/tests/all.py
> @@ -3287,10 +3287,15 @@ with profile.group_manager(
>  
>  for api_suffix, possible_options in [('', [[], ['interface']]),
>   ('_gles3', [[]])]:
> -for subtest in ['basic-struct', 'struct-whole-array',
> -'struct-array-elem', 'array-struct',
> -'array-struct-whole-array', 
> 'array-struct-array-elem',
> -'struct-struct', 'array-struct-array-struct']:
> +if api_suffix == '_gles3':
> +subtest_list = ['basic-struct']
> +else:
> +subtest_list = ['basic-struct', 'struct-whole-array',
> +'struct-array-elem', 'array-struct',
> +'array-struct-whole-array',
> +'array-struct-array-elem', 'struct-struct',
> +'array-struct-array-struct']
> +for subtest in subtest_list:
>  for mode in ['error', 'get', 'run', 'run-no-fs']:
>  for options in possible_options:
>  
> g(['ext_transform_feedback-structs{0}'.format(api_suffix),
> diff --git 
> a/tests/spec/glsl-es-3.00/execution/varying-struct-arrays.shader_test 
> b/tests/spec/glsl-es-3.00/execution/varying-struct-arrays.shader_test
> deleted file mode 100644
> index 88b7a8d..000
> --- a/tests/spec/glsl-es-3.00/execution/varying-struct-arrays.shader_test
> +++ /dev/null
> @@ -1,237 +0,0 @@
> -# Test that varying structs work properly in conjunction with arrays.
> -#
> -# From the GLSL ES 3.00 specification, section 4.3.4 ("Input Variables"):
> -#
> -# Fragment inputs can only be signed and unsigned integers and
> -# integer vectors, float, floating-point vectors, matrices, or
> -# arrays or structures of these.
> -#
> -# And from section 4.3.6 ("Output Variables"):
> -#
> -# Vertex output variables ... can only be float, floating-point
> -# vectors, matrices, signed or unsigned integers or integer
> -# vectors, or arrays or structures of any these.
> -#
> -# This test verifies the proper functioning of varyings whose types
> -# are a struct containing an array, an array of structs, and various
> -# complex combinations of arrays and structs.
> -#
> -# Note: chapter 11 of the GLSL ES 3.00 spec ("Counting of Inputs and
> -# Outputs") specifies a packing algorithm which constitutes a minimum
> -# requirement for when a set of varyings must be supported by a
> -# conformant implementation.  Although that chapter has not yet been
> -# updated to reflect varying structs, Khronos's internal bugzilla
> -# indicates that structs should be flattened before applying the
> -# packing algorithm
> -# (https://cvs.khronos.org/bugzilla/show_bug.cgi?id=9828).  The
> -# varyings in this test flatten as follows:
> -#
> -# float s1.f; // A
> -# float[3]  s1.af[];  // B
> -# float[3]  as1[].f;  // C
> -# float[9]  as1[].af[];   // D
> -# float s2.s1.f;  // E
> -# float[3]  s2.s1.af[];   // F
> -# float[2]  s2.as1[].f;   // G
> -# float[6]  s2.as1[].af[];// H
> -# float[2]  as2[].s1.f;   // I
> -# float[6]  as2[].s1.af[];// J
> -# float[4]  as2[].as1[].f;// K
> -# float[12] as2[].as1[].af[]; // L
> -#
> -# And the flattened varyings would in turn be packed like so:
> -#x y z w
> -#  0 L D J G
> -#  1 L D J G
> -#  2 L D J I
> -#  3 L D J I
> -#  4 L D J
> -#  5 L D J
> -#  6 L D B
> -#  7 L D B
> -#  8 L D B
> -#  9 L H C
> -# 10 L H C
> -# 11 L H C
> -# 12 K H F
> -# 13 K H F
> -# 14 K H F
> -# 15 K A E
> -
> -[require]
> -GL ES >= 3.0
> -GLSL ES >= 3.00
> -
> -[vertex shader]
> -#version 300 es
> -
> -uniform float ref;
> -
> -in vec4 ver

[Piglit] [PATCH] glsl-es-3.10: dont run gles tests where restrictions apply

2015-06-17 Thread Timothy Arceri
In GLES vertex shader outputs cant be arrays of structs or structs that
contain arrays or structs.

The GLSL ES 3.0 spec says:

"Vertex output variables output per-vertex data and are declared
using the out storage qualifier or the centroid out storage qualifier.
They can only be float, floating-point vectors, matrices, signed or
unsigned integers or integer vectors, or arrays or structures of any
these."

The GLSL ES 3.1 is a bit clearer about this:

It is a compile-time error to declare a vertex shader output with,
 or that contains, any of the following types:

* A boolean type
* An opaque type
* An array of arrays
* An array of structures
* A structure containing an array
* A structure containing a structure

CC: Mark Janes 
---
 tests/all.py   |  13 +-
 .../execution/varying-struct-arrays.shader_test| 237 -
 2 files changed, 9 insertions(+), 241 deletions(-)
 delete mode 100644 
tests/spec/glsl-es-3.00/execution/varying-struct-arrays.shader_test

diff --git a/tests/all.py b/tests/all.py
index 2839059..47fe503 100755
--- a/tests/all.py
+++ b/tests/all.py
@@ -3287,10 +3287,15 @@ with profile.group_manager(
 
 for api_suffix, possible_options in [('', [[], ['interface']]),
  ('_gles3', [[]])]:
-for subtest in ['basic-struct', 'struct-whole-array',
-'struct-array-elem', 'array-struct',
-'array-struct-whole-array', 'array-struct-array-elem',
-'struct-struct', 'array-struct-array-struct']:
+if api_suffix == '_gles3':
+subtest_list = ['basic-struct']
+else:
+subtest_list = ['basic-struct', 'struct-whole-array',
+'struct-array-elem', 'array-struct',
+'array-struct-whole-array',
+'array-struct-array-elem', 'struct-struct',
+'array-struct-array-struct']
+for subtest in subtest_list:
 for mode in ['error', 'get', 'run', 'run-no-fs']:
 for options in possible_options:
 g(['ext_transform_feedback-structs{0}'.format(api_suffix),
diff --git 
a/tests/spec/glsl-es-3.00/execution/varying-struct-arrays.shader_test 
b/tests/spec/glsl-es-3.00/execution/varying-struct-arrays.shader_test
deleted file mode 100644
index 88b7a8d..000
--- a/tests/spec/glsl-es-3.00/execution/varying-struct-arrays.shader_test
+++ /dev/null
@@ -1,237 +0,0 @@
-# Test that varying structs work properly in conjunction with arrays.
-#
-# From the GLSL ES 3.00 specification, section 4.3.4 ("Input Variables"):
-#
-# Fragment inputs can only be signed and unsigned integers and
-# integer vectors, float, floating-point vectors, matrices, or
-# arrays or structures of these.
-#
-# And from section 4.3.6 ("Output Variables"):
-#
-# Vertex output variables ... can only be float, floating-point
-# vectors, matrices, signed or unsigned integers or integer
-# vectors, or arrays or structures of any these.
-#
-# This test verifies the proper functioning of varyings whose types
-# are a struct containing an array, an array of structs, and various
-# complex combinations of arrays and structs.
-#
-# Note: chapter 11 of the GLSL ES 3.00 spec ("Counting of Inputs and
-# Outputs") specifies a packing algorithm which constitutes a minimum
-# requirement for when a set of varyings must be supported by a
-# conformant implementation.  Although that chapter has not yet been
-# updated to reflect varying structs, Khronos's internal bugzilla
-# indicates that structs should be flattened before applying the
-# packing algorithm
-# (https://cvs.khronos.org/bugzilla/show_bug.cgi?id=9828).  The
-# varyings in this test flatten as follows:
-#
-# float s1.f; // A
-# float[3]  s1.af[];  // B
-# float[3]  as1[].f;  // C
-# float[9]  as1[].af[];   // D
-# float s2.s1.f;  // E
-# float[3]  s2.s1.af[];   // F
-# float[2]  s2.as1[].f;   // G
-# float[6]  s2.as1[].af[];// H
-# float[2]  as2[].s1.f;   // I
-# float[6]  as2[].s1.af[];// J
-# float[4]  as2[].as1[].f;// K
-# float[12] as2[].as1[].af[]; // L
-#
-# And the flattened varyings would in turn be packed like so:
-#x y z w
-#  0 L D J G
-#  1 L D J G
-#  2 L D J I
-#  3 L D J I
-#  4 L D J
-#  5 L D J
-#  6 L D B
-#  7 L D B
-#  8 L D B
-#  9 L H C
-# 10 L H C
-# 11 L H C
-# 12 K H F
-# 13 K H F
-# 14 K H F
-# 15 K A E
-
-[require]
-GL ES >= 3.0
-GLSL ES >= 3.00
-
-[vertex shader]
-#version 300 es
-
-uniform float ref;
-
-in vec4 vertex;
-struct S1
-{
-   float f;
-   float af[3];
-};
-struct S2
-{
-   S1 s1;
-   S1 as1[2];
-};
-out S1 s1;
-out S1 as1[3];
-out S2 s2;
-out S2 as2[2];
-
-void main()
-{
-   gl_Position = vertex;
-   float f = ref;
-   s1.f = f++;
-   s1.af[0] = f++;
-   s1.af[1] = f++;
-   s

[Piglit] [Bug 90993] [m32 bisected] arb_gpu_shader5.execution.*array_indexing.vs-nonuniform-control-flow

2015-06-17 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=90993

--- Comment #4 from Mark Janes  ---
This reproduces 100% of the time on the build system, and the output is always
the same:

jenkins@otc-gfxtest-hswgt2-01:~$ PIGLIT_PLATFORM=gbm
LIBGL_DRIVERS_PATH=/tmp/build_root/m32/lib/dri S2TC_DITHER_MODE=NONE
LD_LIBRARY_PATH=/tmp/build_root/m32/lib:/tmp/build_root/m32/lib/i386-linux-gnu:/tmp/build_root/m32/lib/dri:/tmp/build_root/m32/lib/piglit/lib
GBM_DRI\
VERS_PATH=/tmp/build_root/m32/lib/dri
/tmp/build_root/m32/lib/piglit/bin/shader_runner
/tmp/build_root/m32/lib/piglit/tests/spec/arb_gpu_shader5/execution/ubo_array_indexing/vs-nonuniform-control-flow.shader_test
-auto
Probe color at (174,0)
  Expected: 0.40 0.60 0.80 0.20
  Observed: 0.20 0.20 0.20 0.20
Probe color at (174,50)
  Expected: 0.40 0.60 0.80 0.20
  Observed: 0.20 0.20 0.20 0.20
Probe color at (174,75)
  Expected: 0.40 0.60 0.80 0.20
  Observed: 0.20 0.20 0.20 0.20
Probe color at (174,125)
  Expected: 0.40 0.60 0.80 0.20
  Observed: 0.20 0.20 0.20 0.20
PIGLIT: {"result": "fail" }


Curro, I can give you time on a build system if necessary, so you can debug it.

-- 
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] deqp-integration: Fix running deqp when extra_args not set

2015-06-17 Thread Dylan Baker
When extra_args aren't set in piglit.conf and the envrionment variable
isn't set either, there is a bug that causes the deqp tests to not run.
This patch corrects that by providing a mechanism for setting an
appropriate fallback value.

Signed-off-by: Dylan Baker 
---
 framework/test/deqp.py| 6 +++---
 framework/tests/deqp_tests.py | 9 +
 tests/deqp_gles2.py   | 3 ++-
 tests/deqp_gles3.py   | 4 +++-
 tests/deqp_gles31.py  | 3 ++-
 5 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/framework/test/deqp.py b/framework/test/deqp.py
index a63611d..843cde8 100644
--- a/framework/test/deqp.py
+++ b/framework/test/deqp.py
@@ -46,10 +46,10 @@ def make_profile(test_list, test_class):
 return profile
 
 
-def get_option(env_varname, config_option):
+def get_option(env_varname, config_option, default=None):
 """Query the given environment variable and then piglit.conf for the 
option.
 
-Return None if the option is unset.
+Return the value of the default argument if opt is None.
 
 """
 opt = os.environ.get(env_varname, None)
@@ -58,7 +58,7 @@ def get_option(env_varname, config_option):
 
 opt = core.PIGLIT_CONFIG.safe_get(config_option[0], config_option[1])
 
-return opt
+return opt or default
 
 
 def gen_caselist_txt(bin_, caselist):
diff --git a/framework/tests/deqp_tests.py b/framework/tests/deqp_tests.py
index d472c75..1225523 100644
--- a/framework/tests/deqp_tests.py
+++ b/framework/tests/deqp_tests.py
@@ -59,6 +59,15 @@ def test_get_option_conf():
 
 
 @utils.set_env(_PIGLIT_TEST_ENV=None)
+def test_get_option_default():
+"""deqp.get_option: default value is returned when env and conf are unset
+"""
+nt.eq_(deqp.get_option('_PIGLIT_TEST_ENV', ('deqp_test', 'test_env'),
+   'foobar'),
+   'foobar')
+
+
+@utils.set_env(_PIGLIT_TEST_ENV=None)
 def test_get_option_conf_no_section():
 """deqp.get_option: if a no_section error is raised and env is unset None 
is return
 """
diff --git a/tests/deqp_gles2.py b/tests/deqp_gles2.py
index 0b7fbd3..b97cb5d 100644
--- a/tests/deqp_gles2.py
+++ b/tests/deqp_gles2.py
@@ -33,7 +33,8 @@ _DEQP_GLES2_BIN = deqp.get_option('PIGLIT_DEQP_GLES2_BIN',
 class DEQPGLES2Test(deqp.DEQPBaseTest):
 deqp_bin = _DEQP_GLES2_BIN
 extra_args = deqp.get_option('PIGLIT_DEQP_GLES2_EXTRA_ARGS',
- ('deqp-gles2', 'extra_args')).split() or []
+ ('deqp-gles2', 'extra_args'),
+ default='').split()
 
 
 profile = deqp.make_profile(  # pylint: disable=invalid-name
diff --git a/tests/deqp_gles3.py b/tests/deqp_gles3.py
index 574a5e5..dfb82c9 100644
--- a/tests/deqp_gles3.py
+++ b/tests/deqp_gles3.py
@@ -74,7 +74,9 @@ def filter_mustpass(caselist_path):
 class DEQPGLES3Test(deqp.DEQPBaseTest):
 deqp_bin = _DEQP_GLES3_EXE
 extra_args = deqp.get_option('PIGLIT_DEQP_GLES3_EXTRA_ARGS',
- ('deqp-gles3', 'extra_args')).split() or []
+ ('deqp-gles3', 'extra_args'),
+ default='').split()
+
 
 def __init__(self, *args, **kwargs):
 super(DEQPGLES3Test, self).__init__(*args, **kwargs)
diff --git a/tests/deqp_gles31.py b/tests/deqp_gles31.py
index ba148f8..423c1bf 100644
--- a/tests/deqp_gles31.py
+++ b/tests/deqp_gles31.py
@@ -33,7 +33,8 @@ _DEQP_GLES31_BIN = deqp.get_option('PIGLIT_DEQP_GLES31_BIN',
 class DEQPGLES31Test(deqp.DEQPBaseTest):
 deqp_bin = _DEQP_GLES31_BIN
 extra_args = deqp.get_option('PIGLIT_DEQP_GLES31_EXTRA_ARGS',
- ('deqp-gles31', 'extra_args')).split() or []
+ ('deqp-gles31', 'extra_args'),
+ default='').split()
 
 
 profile = deqp.make_profile(  # pylint: disable=invalid-name
-- 
2.4.3

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


[Piglit] [PATCH] arb_gpu_shader_fp64: verify function parameter overloads

2015-06-17 Thread Ilia Mirkin
fp64 adds variants of all sorts of functions. make sure that we're still
able to resolve otherwise-ambiguous calls in the presence of gs5.

Signed-off-by: Ilia Mirkin 
---
 .../compiler/implicit-conversions-func.vert| 22 ++
 1 file changed, 22 insertions(+)
 create mode 100644 
tests/spec/arb_gpu_shader_fp64/compiler/implicit-conversions-func.vert

diff --git 
a/tests/spec/arb_gpu_shader_fp64/compiler/implicit-conversions-func.vert 
b/tests/spec/arb_gpu_shader_fp64/compiler/implicit-conversions-func.vert
new file mode 100644
index 000..224aecb
--- /dev/null
+++ b/tests/spec/arb_gpu_shader_fp64/compiler/implicit-conversions-func.vert
@@ -0,0 +1,22 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.50
+// require_extensions: GL_ARB_gpu_shader_fp64 GL_ARB_gpu_shader5
+// [end config]
+
+// Test that overloaded function selection still works in the presence
+// of new double variants. ARB_gpu_shader5 provides the overload
+// selection rules that allow the implementatino to pick one of the
+// candidates.
+
+#version 150
+#extension GL_ARB_gpu_shader_fp64: enable
+#extension GL_ARB_gpu_shader5: enable
+
+void foo(double a);
+void foo(float a);
+
+void test() {
+  mod(5, 6);
+  foo(5);
+}
-- 
2.3.6

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


[Piglit] [PATCH] shader_runner: Check return value on sscanf (clip plane / draw arrays)

2015-06-17 Thread Jordan Justen
sscanf returns EOF if not all values are scanned. This can be
interpreted as 'true' in these cases leading to the clip plane command
being incorrectly requested.

Signed-off-by: Jordan Justen 
---
 tests/shaders/shader_runner.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index 38a0fcf..7e5b7b4 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -2339,7 +2339,7 @@ piglit_display(void)
glClear(clear_bits);
} else if (sscanf(line,
  "clip plane %d %lf %lf %lf %lf",
- &x, &d[0], &d[1], &d[2], &d[3])) {
+ &x, &d[0], &d[1], &d[2], &d[3]) == 5) {
if (x < 0 || x >= gl_max_clip_planes) {
printf("clip plane id %d out of range\n", x);
piglit_report_result(PIGLIT_FAIL);
@@ -2381,7 +2381,7 @@ piglit_display(void)
   &primcount,
   c + 0, c + 1, c + 2, c + 3);
draw_instanced_rect(primcount, c[0], c[1], c[2], c[3]);
-   } else if (sscanf(line, "draw arrays %31s %d %d", s, &x, &y)) {
+   } else if (sscanf(line, "draw arrays %31s %d %d", s, &x, &y) == 
3) {
GLenum mode = decode_drawing_mode(s);
int first = x;
size_t count = (size_t) y;
-- 
2.1.4

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


Re: [Piglit] [PATCH v2 1/4] shader_runner: Use strndup to get a null-terminated string for 'line'

2015-06-17 Thread Jordan Justen
On 2015-06-16 04:07:35, Francisco Jerez wrote:
> Jordan Justen  writes:
> 
> > In order to use sscanf with optional parameters, the string needs to
> > be null terminated. Otherwise, sscanf will treat the newline as
> > whitespace and continue to look for matches on the following lines.
> >
> > v2:
> >  * Call strndup before skipping newline char in next_line
> >
> > Signed-off-by: Jordan Justen 
> > ---
> >  tests/shaders/shader_runner.c | 25 +
> >  1 file changed, 17 insertions(+), 8 deletions(-)
> >
> > diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
> > index 1827e08..41024cd 100644
> > --- a/tests/shaders/shader_runner.c
> > +++ b/tests/shaders/shader_runner.c
> > @@ -2294,7 +2294,7 @@ probe_atomic_counter(GLint counter_num, const char 
> > *op, uint32_t value)
> >  enum piglit_result
> >  piglit_display(void)
> >  {
> > - const char *line;
> > + const char *line, *next_line;
> >   bool pass = true;
> >   GLbitfield clear_bits = 0;
> >   bool link_error_expected = false;
> > @@ -2303,16 +2303,27 @@ piglit_display(void)
> >   if (test_start == NULL)
> >   return PIGLIT_PASS;
> >  
> > - line = test_start;
> > - while (line[0] != '\0') {
> > + next_line = test_start;
> > + while (next_line[0] != '\0') {
> >   float c[32];
> >   double d[4];
> >   int x, y, z, w, h, l, tex, level;
> >   char s[32];
> >  
> > - line = eat_whitespace(line);
> >  
> > - if (sscanf(line, "atomic counters %d", &x) == 1) {
> > + line = eat_whitespace(next_line);
> > +
> > + next_line = strchrnul(next_line, '\n');
> > +
> > + /* Duplicate the line to make it null terminated */
> > + line = strndup(line, next_line - line);
> > +
> > + /* If strchrnul found a newline, then skip it */
> > + if (next_line[0] != '\0')
> > + next_line++;
> > +
> > + if (line[0] == '\0') {
> 
> Hmm.  Isn't this already handled in the last block of the else-if chain?

True, it should skip all portions of the if-else block (including the
last), except sscanf was being incorrectly used by two commands,
meaning another command was being hit. I'll reply to this email with a
new patch to fix that issue, but I still think we should add the null
string check up top to be safer.

-Jordan

> > + } else if (sscanf(line, "atomic counters %d", &x) == 1) {
> >   GLuint *atomics_buf = calloc(x, sizeof(GLuint));
> >   glGenBuffers(1, &atomics_bo);
> >   glBindBufferBase(GL_ATOMIC_COUNTER_BUFFER, 0, 
> > atomics_bo);
> > @@ -2701,9 +2712,7 @@ piglit_display(void)
> >   piglit_report_result(PIGLIT_FAIL);
> >   }
> >  
> > - line = strchrnul(line, '\n');
> > - if (line[0] != '\0')
> > - line++;
> > + free((void*) line);
> >   }
> >  
> >   if (!link_ok && !link_error_expected) {
> > -- 
> > 2.1.4
> >
> > ___
> > Piglit mailing list
> > Piglit@lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/piglit
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] CL: Fix check of ULP when probing float/double results

2015-06-17 Thread Micah Fedke
Just throwing a few ideas/warnings your way :)  I ran into these same 
issues when implementing arb_shader_precision for GLSL.


It's not my intention to introduce more questions than answers here. 
This is all simply coming from a fellow dev who's been beaten down by 
float's guerrilla attacks, not a float expert by any means.


First, float is bees, let's get that out of the way.

nextafter does sound like the clearest solution.  I used a 
hand-generated method to convert to the binary representation for my 
purposes, which made the most sense to me:


def _floatToBits(f):
s = struct.pack('>f', f)
# capital 'L' is important - sign bit is already built into 754
return struct.unpack('>L', s)[0]

def _bitsToFloat(b):
s = struct.pack('>l', b)
return struct.unpack('>f', s)[0]

However nextafter accomplishes the same thing.

I did find it easiest/clearest to move to the binary representation to 
do all ulp-boundary math and comparisons, and only convert back to float 
at the end.


There are many gotcha's here in addition to the ones you've already 
mentioned.  The first would be "who's ulp?"  I haven't checked the spec 
governing these CL tests in question, but arb_shader_precision never 
specified which ulp it was referring to.  Is it the value of an ulp at 
the expected value?  Or the value of an ulp at one of the inputs?  Or 
the largest of all those?  Also, it's very helpful when the spec 
specifies a range of values for which the operation can be held to the 
specified number of ulps.


Secondly the rounding issue you raised is valid and difficult to get 
right.  Operations submitted to the CPU will use the rounding mode it is 
set up for.  I believe the default on intel chips is round-to-nearest, 
ties-to-even, which seems to be the case for most GPUs as well, but I'm 
not an expert on this subject by any means.  Rounding doesn't just 
happen at the end, either - intermediate values in complex equations 
will be rounded as well - these rounding errors could multiply, or 
cancel, depending on the inputs.  The other thing to consider is if the 
equation that produced the expected value used python's round(), and it 
was run with Python2, then round() would use round-away-from-zero; 
python3's round uses round-to-nearest, ties-to-even.


Regarding the generation of expected values, it's important to be very 
cautious about equations that stack multiple floating point operations, 
as this is where errors have the potential to get out of hand quickly. 
The most difficult issue here, in my mind, is fma.  Unless you're 
testing 64-bit floating point on the GPU, it will be doing its 
calculations in 32-bit space, however, if the GPU compiler employs fma, 
this can cause intermediate operations to be done at higher precisions. 
 This means that the GPU may be jumping between low-precision and 
high-precision operations over the course of a single equation, where 
python may well be doing all operations at a uniform level of precision. 
 This can result in differences in expected results that are very hard 
to track down.  Sadly, it's nearly impossible to predict how a compiler 
might employ fma for any give equation.  You can use python's decimal, 
bigfloat or numpy (ugh) to clamp down the precision at which the 
operation is evaluated, but again, it will be difficult-to-impossible to 
predict if and where the GPU compiler employed fma.


Ultimately, you're attempting to get python to run an equation *in 
exactly the same way* that the shader code does, in order to produce an 
identical result.  This is a difficult thing.  Your ulps tolerance will 
likely, in some way, be accounting for these differences between the CPU 
and GPU generated results, in addition to its true purpose which is to 
identify real issues in the GPU compiler or hardware that introduce 
unintended floating point errors.


You will, ultimately, have to run all the test vectors through your 
chosen solution and carefully inspect any differences in the results. 
You may discover that certain test vectors are simply not appropriate.


In the end, good floating point tests use very carefully selected 
inputs.  Wisdom or deception?  Perhaps a bit of both.




On 06/15/2015 09:29 AM, Jan Vesely wrote:



On Sun, Jun 14, 2015 at 7:48 PM, Aaron Watry mailto:awa...@gmail.com>> wrote:



On Sun, Jun 14, 2015 at 4:19 PM, Jan Vesely mailto:jan.ves...@rutgers.edu>> wrote:

On Sat, 2015-06-13 at 21:22 -0500, Aaron Watry wrote:
> Meh, this still feels broken.  Give me a bit longer.

and it is :). I don't think this can work based on abs(expected
- real),
since ULP depends on the magnitude of the numbers. This
information is
lost after subtraction.


Yeah, that's essentially the conclusion that I came to last night as
well.  Currently, we're saying that 3 ULP is 3x the smallest
representable floating point number, not 3x the interval between
adjacent float value

[Piglit] [Bug 90993] [m32 bisected] arb_gpu_shader5.execution.*array_indexing.vs-nonuniform-control-flow

2015-06-17 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=90993

--- Comment #3 from Francisco Jerez  ---
I'm unable to reproduce on mesa master, both tests pass for me on HSW GT2.

10.5 is expected to fail because the fix
(e1ae0c3bc37be7b1de21ee248d674671d01da8e6 and
b234537cc3e513ded9b5385d876e4c531f72af94) was applied after the branching
point.

-- 
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] arb_separate_shader_objects: extend active sampler conflict to test arrays

2015-06-17 Thread Timothy Arceri
---
 .../active-sampler-conflict.c  | 187 -
 1 file changed, 143 insertions(+), 44 deletions(-)

diff --git a/tests/spec/arb_separate_shader_objects/active-sampler-conflict.c 
b/tests/spec/arb_separate_shader_objects/active-sampler-conflict.c
index 5388449..a9b87ab 100644
--- a/tests/spec/arb_separate_shader_objects/active-sampler-conflict.c
+++ b/tests/spec/arb_separate_shader_objects/active-sampler-conflict.c
@@ -81,56 +81,108 @@ static const char *fs_code =
"}\n"
;
 
+static const char *fs_arrays_code =
+   "#version 130\n"
+   "#extension GL_ARB_separate_shader_objects: require\n"
+   "\n"
+   "out vec4 out_color;\n"
+   "\n"
+   "uniform sampler2D s2[2];\n"
+   "uniform sampler3D s3[2];\n"
+   "\n"
+   "void main()\n"
+   "{\n"
+   "out_color = texture(s2[1], vec2(0)) + texture(s3[1], vec3(0));\n"
+   "}\n"
+   ;
+
+static const char *fs_arrays_of_arrays_code =
+   "#version 130\n"
+   "#extension GL_ARB_separate_shader_objects: require\n"
+   "#extension GL_ARB_arrays_of_arrays: require\n"
+   "\n"
+   "out vec4 out_color;\n"
+   "\n"
+   "uniform sampler2D s2[2][2];\n"
+   "uniform sampler3D s3[2][2];\n"
+   "\n"
+   "void main()\n"
+   "{\n"
+   "out_color = texture(s2[1][1], vec2(0)) + texture(s3[1][1], 
vec3(0));\n"
+   "}\n"
+   ;
+
 static const float vert[2] = {
0.0, 0.0
 };
 
-void piglit_init(int argc, char **argv)
+static bool
+setup_program(GLuint *prog, GLuint *pipe, GLuint *vao,
+ GLuint *bo, const char **fs_code)
 {
-   GLuint prog;
-   GLint s2_loc;
-   GLint s3_loc;
-   GLuint pipe;
-   GLuint vao;
-   GLuint bo;
bool pass = true;
 
-   piglit_require_extension("GL_ARB_separate_shader_objects");
-
-   prog = glCreateShaderProgramv(GL_FRAGMENT_SHADER, 1,
-(const GLchar *const *) &fs_code);
-   piglit_link_check_status(prog);
-
-   s2_loc = glGetUniformLocation(prog, "s2");
-   if (s2_loc == -1) {
-   fprintf(stderr, "Failed to get uniform location for s2.\n");
-   pass = false;
-   }
-
-   s3_loc = glGetUniformLocation(prog, "s3");
-   if (s3_loc == -1) {
-   fprintf(stderr, "Failed to get uniform location for s3.\n");
-   pass = false;
-   }
+   *prog = glCreateShaderProgramv(GL_FRAGMENT_SHADER, 1,
+ (const GLchar *const *) fs_code);
+   piglit_link_check_status(*prog);
 
-   glGenProgramPipelines(1, &pipe);
-   glUseProgramStages(pipe,
+   glGenProgramPipelines(1, pipe);
+   glUseProgramStages(*pipe,
   GL_FRAGMENT_SHADER_BIT,
-  prog);
-   glActiveShaderProgram(pipe, prog);
-   glBindProgramPipeline(pipe);
+  *prog);
+   glActiveShaderProgram(*pipe, *prog);
+   glBindProgramPipeline(*pipe);
 
-   glGenVertexArrays(1, &vao);
-   glBindVertexArray(vao);
+   glGenVertexArrays(1, vao);
+   glBindVertexArray(*vao);
 
/* Configure a vertex array object and buffer object that will
 * be used for drawing later.
 */
-   glGenBuffers(1, &bo);
-   glBindBuffer(GL_ARRAY_BUFFER, bo);
+   glGenBuffers(1, bo);
+   glBindBuffer(GL_ARRAY_BUFFER, *bo);
glBufferData(GL_ARRAY_BUFFER, sizeof(vert), vert, GL_STATIC_DRAW);
 
-   pass = piglit_check_gl_error(GL_NO_ERROR) && pass;
+   return piglit_check_gl_error(GL_NO_ERROR) && pass;
+}
+
+static void
+cleanup(GLuint prog, GLuint *pipe, GLuint *vao, GLuint *bo)
+{
+   glBindProgramPipeline(0);
+   glDeleteProgram(prog);
+   glDeleteProgramPipelines(1, pipe);
+
+   glBindBuffer(GL_ARRAY_BUFFER, 0);
+   glBindVertexArray(0);
+
+   glDeleteBuffers(1, bo);
+   glDeleteVertexArrays(1, vao);
+}
+
+static bool
+get_uniform_location(GLuint prog, GLint *loc, char *uni_name)
+{
+   bool pass = true;
+   *loc = glGetUniformLocation(prog, uni_name);
+   if (*loc == -1) {
+   fprintf(stderr, "Failed to get uniform location for %s.\n",
+uni_name);
+   pass = false;
+   }
+   return pass;
+}
+
+static bool
+test_sampler_conflict(GLuint prog, GLuint pipe,
+ char *s2_uni_name, char *s3_uni_name)
+{
+   GLint s2_loc;
+   GLint s3_loc;
+   bool pass = true;
+
+   pass = get_uniform_location(prog, &s2_loc, s2_uni_name);
+   pass = get_uniform_location(prog, &s3_loc, s3_uni_name);
 
/* First, try an invalid configuration.
 */
@@ -187,17 +239,64 @@ void piglit_init(int argc, char **argv)
 
pass = piglit_check_gl_error(GL_NO_ERROR) && pass;
 
-   /* Clean up.
-*/
-   glBindProgramPipeline(0);
-   glDeleteProgram(prog);
-   glDeleteProgramPip