[Piglit] [PATCH 1/2] glsl-es: Additional constant initializer tests.

2015-10-07 Thread Ian Romanick
From: Ian Romanick 

Most built-in functions with constant-expression parameters are also
constant expressions.  GLSL ES 1.00 and 3.00 differ as to whether or not
the sequence operator is a constant expression.

Note: spec/glsl-es-1.00/compiler/const-initializer/from-function.* and
spec/glsl-es-1.00/compiler/const-initializer/from-sequence-in-function.*
currently fail on Mesa.  This is very confusing because the nearly
identical spec/glsl-es-3.00/compiler/const-initializer/from-function.*
tests both pass!

Signed-off-by: Ian Romanick 
---
 .../compiler/const-initializer/from-function.frag  | 25 +++
 .../compiler/const-initializer/from-function.vert  | 23 ++
 .../from-sequence-in-function.frag | 28 ++
 .../from-sequence-in-function.vert | 26 
 .../compiler/const-initializer/from-function.frag  | 17 +
 .../compiler/const-initializer/from-function.vert  | 14 +++
 .../from-sequence-in-function.frag | 24 +++
 .../from-sequence-in-function.vert | 21 
 8 files changed, 178 insertions(+)
 create mode 100644 
tests/spec/glsl-es-1.00/compiler/const-initializer/from-function.frag
 create mode 100644 
tests/spec/glsl-es-1.00/compiler/const-initializer/from-function.vert
 create mode 100644 
tests/spec/glsl-es-1.00/compiler/const-initializer/from-sequence-in-function.frag
 create mode 100644 
tests/spec/glsl-es-1.00/compiler/const-initializer/from-sequence-in-function.vert
 create mode 100644 
tests/spec/glsl-es-3.00/compiler/const-initializer/from-function.frag
 create mode 100644 
tests/spec/glsl-es-3.00/compiler/const-initializer/from-function.vert
 create mode 100644 
tests/spec/glsl-es-3.00/compiler/const-initializer/from-sequence-in-function.frag
 create mode 100644 
tests/spec/glsl-es-3.00/compiler/const-initializer/from-sequence-in-function.vert

diff --git 
a/tests/spec/glsl-es-1.00/compiler/const-initializer/from-function.frag 
b/tests/spec/glsl-es-1.00/compiler/const-initializer/from-function.frag
new file mode 100644
index 000..fe0268c
--- /dev/null
+++ b/tests/spec/glsl-es-1.00/compiler/const-initializer/from-function.frag
@@ -0,0 +1,25 @@
+#version 100
+
+/* [config]
+ * expect_result: pass
+ * glsl_version: 1.00
+ * [end config]
+ *
+ * Section 5.10 (Constant Expressions) of the GLSL ES 1.00.17 spec says:
+ *
+ * "A constant expression is one of
+ *
+ * ...
+ *
+ * - a built-in function call whose arguments are all constant
+ *   expressions, with the exception of the texture lookup functions."
+ */
+
+precision mediump float;
+
+const float f = cos(0.0);
+
+void main()
+{
+gl_FragData[0] = vec4(f);
+}
diff --git 
a/tests/spec/glsl-es-1.00/compiler/const-initializer/from-function.vert 
b/tests/spec/glsl-es-1.00/compiler/const-initializer/from-function.vert
new file mode 100644
index 000..b96fcf8
--- /dev/null
+++ b/tests/spec/glsl-es-1.00/compiler/const-initializer/from-function.vert
@@ -0,0 +1,23 @@
+#version 100
+
+/* [config]
+ * expect_result: pass
+ * glsl_version: 1.00
+ * [end config]
+ *
+ * Section 5.10 (Constant Expressions) of the GLSL ES 1.00.17 spec says:
+ *
+ * "A constant expression is one of
+ *
+ * ...
+ *
+ * - a built-in function call whose arguments are all constant
+ *   expressions, with the exception of the texture lookup functions."
+ */
+
+const float f = cos(0.0);
+
+void main()
+{
+gl_Position = vec4(f);
+}
diff --git 
a/tests/spec/glsl-es-1.00/compiler/const-initializer/from-sequence-in-function.frag
 
b/tests/spec/glsl-es-1.00/compiler/const-initializer/from-sequence-in-function.frag
new file mode 100644
index 000..0e39817
--- /dev/null
+++ 
b/tests/spec/glsl-es-1.00/compiler/const-initializer/from-sequence-in-function.frag
@@ -0,0 +1,28 @@
+#version 100
+
+/* [config]
+ * expect_result: pass
+ * glsl_version: 1.00
+ * [end config]
+ *
+ * Section 5.10 (Constant Expressions) of the GLSL ES 1.00.17 spec says:
+ *
+ * "A constant expression is one of
+ *
+ * ...
+ *
+ * - a built-in function call whose arguments are all constant
+ *   expressions, with the exception of the texture lookup functions."
+ *
+ * While the sequence operator is specifically disallowed as a constant
+ * expression in GLSL ES 3.0 and later, it is allowed in GLSL ES 1.00.
+ */
+
+precision mediump float;
+
+const float f = cos((1.0, 2.0));
+
+void main()
+{
+gl_FragData[0] = vec4(f);
+}
diff --git 
a/tests/spec/glsl-es-1.00/compiler/const-initializer/from-sequence-in-function.vert
 
b/tests/spec/glsl-es-1.00/compiler/const-initializer/from-sequence-in-function.vert
new file mode 100644
index 000..ffebd6b
--- /dev/null
+++ 
b/tests/spec/glsl-es-1.00/compiler/const-initializer/from-sequence-in-function.vert
@@ -0,0 +1,26 @@
+#version 100
+
+/* [config]
+ * expect_result: pass
+ * glsl_version: 1.00
+ * [end con

[Piglit] [PATCH 2/2] glsl-es: Verify rules about constant expressions w.r.t. sizing arrays

2015-10-07 Thread Ian Romanick
From: Ian Romanick 

NOTE: Without patches recently posted to the mesa-dev mailing list,
Mesa fails spec/glsl-es-3.00/compiler/array-sized-by-sequence.*.

Signed-off-by: Ian Romanick 
---
 .../array-sized-by-sequence-in-parenthesis.vert | 17 +
 .../compiler/array-sized-by-sequence.vert   | 17 +
 .../array-sized-by-sequence-in-parenthesis.vert | 21 +
 .../compiler/array-sized-by-sequence.vert   | 21 +
 4 files changed, 76 insertions(+)
 create mode 100644 
tests/spec/glsl-es-1.00/compiler/array-sized-by-sequence-in-parenthesis.vert
 create mode 100644 
tests/spec/glsl-es-1.00/compiler/array-sized-by-sequence.vert
 create mode 100644 
tests/spec/glsl-es-3.00/compiler/array-sized-by-sequence-in-parenthesis.vert
 create mode 100644 
tests/spec/glsl-es-3.00/compiler/array-sized-by-sequence.vert

diff --git 
a/tests/spec/glsl-es-1.00/compiler/array-sized-by-sequence-in-parenthesis.vert 
b/tests/spec/glsl-es-1.00/compiler/array-sized-by-sequence-in-parenthesis.vert
new file mode 100644
index 000..bdec205
--- /dev/null
+++ 
b/tests/spec/glsl-es-1.00/compiler/array-sized-by-sequence-in-parenthesis.vert
@@ -0,0 +1,17 @@
+#version 100 es
+
+/* [config]
+ * expect_result: pass
+ * glsl_version: 1.00
+ * [end config]
+ *
+ * While the sequence operator is specifically disallowed as a constant
+ * expression in GLSL ES 3.0 and later, it is allowed in GLSL ES 1.00.
+ */
+
+uniform float uf[(1, 2)];
+
+void main()
+{
+gl_Position = vec4(uf[0]);
+}
diff --git a/tests/spec/glsl-es-1.00/compiler/array-sized-by-sequence.vert 
b/tests/spec/glsl-es-1.00/compiler/array-sized-by-sequence.vert
new file mode 100644
index 000..68aea95
--- /dev/null
+++ b/tests/spec/glsl-es-1.00/compiler/array-sized-by-sequence.vert
@@ -0,0 +1,17 @@
+#version 100
+
+/* [config]
+ * expect_result: fail
+ * glsl_version: 1.00
+ * [end config]
+ *
+ * The spec does not explicitly forbid this.  However, the normative grammar
+ * in the specification does not allow this production.
+ */
+
+uniform float uf[1, 2];
+
+void main()
+{
+gl_Position = vec4(uf[0]);
+}
diff --git 
a/tests/spec/glsl-es-3.00/compiler/array-sized-by-sequence-in-parenthesis.vert 
b/tests/spec/glsl-es-3.00/compiler/array-sized-by-sequence-in-parenthesis.vert
new file mode 100644
index 000..778c649
--- /dev/null
+++ 
b/tests/spec/glsl-es-3.00/compiler/array-sized-by-sequence-in-parenthesis.vert
@@ -0,0 +1,21 @@
+#version 300 es
+
+/* [config]
+ * expect_result: fail
+ * glsl_version: 3.00
+ * [end config]
+ *
+ * Section 4.3.3 "Constant Expressions" of the OpenGL GLSL ES 3.00.4 spec
+ * says:
+ *
+ * "However, the sequence operator ( , ) and the assignment operators ( =,
+ * +=, ...)  are not included in the operators that can create a constant
+ * expression."
+ */
+
+uniform float uf[(1, 2)];
+
+void main()
+{
+gl_Position = vec4(uf[0]);
+}
diff --git a/tests/spec/glsl-es-3.00/compiler/array-sized-by-sequence.vert 
b/tests/spec/glsl-es-3.00/compiler/array-sized-by-sequence.vert
new file mode 100644
index 000..d1ccae0
--- /dev/null
+++ b/tests/spec/glsl-es-3.00/compiler/array-sized-by-sequence.vert
@@ -0,0 +1,21 @@
+#version 300 es
+
+/* [config]
+ * expect_result: fail
+ * glsl_version: 3.00
+ * [end config]
+ *
+ * Section 4.3.3 "Constant Expressions" of the OpenGL GLSL ES 3.00.4 spec
+ * says:
+ *
+ * "However, the sequence operator ( , ) and the assignment operators ( =,
+ * +=, ...)  are not included in the operators that can create a constant
+ * expression."
+ */
+
+uniform float uf[1, 2];
+
+void main()
+{
+gl_Position = vec4(uf[0]);
+}
-- 
2.1.0

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


Re: [Piglit] [PATCH v1] Porting the OpenGL shading language from Glean to Piglit.

2015-10-07 Thread Matt Turner
On Wed, Oct 7, 2015 at 1:48 AM, Juliet Fru  wrote:
> This test replaces the original tglsl1.cpp test
> ---
>  tests/all.py|1 +
>  tests/spec/gl-1.0/CMakeLists.gl.txt |1 +
>  tests/spec/gl-1.0/shading-lang.c| 1939 
> +++
>  3 files changed, 1941 insertions(+)
>  create mode 100644 tests/spec/gl-1.0/shading-lang.c

I don't like this at all. These tests should become shader_test files
-- not just a straight port from glean to the piglit framework.
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH v1] Porting the OpenGL shading language from Glean to Piglit.

2015-10-07 Thread Brian Paul

Hi Juliet,

I only have time for a quick review for now.  See comments below.  I'll 
try to look closer tomorrow.



On 10/07/2015 02:48 AM, Juliet Fru wrote:

This test replaces the original tglsl1.cpp test
---
  tests/all.py|1 +
  tests/spec/gl-1.0/CMakeLists.gl.txt |1 +
  tests/spec/gl-1.0/shading-lang.c| 1939 +++
  3 files changed, 1941 insertions(+)
  create mode 100644 tests/spec/gl-1.0/shading-lang.c

diff --git a/tests/all.py b/tests/all.py
index fe088f5..6140320 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -999,6 +999,7 @@ with profile.group_manager(
  g(['gl-1.0-fpexceptions'])
  g(['gl-1.0-ortho-pos'])
  g(['gl-1.0-readpixsanity'])
+g(['gl-1.0-shading-lang'])
  g(['gl-1.0-logicop'])

  with profile.group_manager(
diff --git a/tests/spec/gl-1.0/CMakeLists.gl.txt 
b/tests/spec/gl-1.0/CMakeLists.gl.txt
index d04b835..28a1d42 100644
--- a/tests/spec/gl-1.0/CMakeLists.gl.txt
+++ b/tests/spec/gl-1.0/CMakeLists.gl.txt


The test should go in tests/spec/gl-2.0/ instead.  There was no GLSL 
support in GL 1.0




@@ -26,6 +26,7 @@ piglit_add_executable (gl-1.0-polygon-line-aa 
polygon-line-aa.c)
  piglit_add_executable (gl-1.0-push-no-attribs push-no-attribs.c)
  piglit_add_executable (gl-1.0-readpixsanity readpix.c)
  piglit_add_executable (gl-1.0-rendermode-feedback rendermode-feedback.c)
+piglit_add_executable (gl-1.0-shading-lang shading-lang.c)
  piglit_add_executable (gl-1.0-swapbuffers-behavior swapbuffers-behavior.c)

  # vim: ft=cmake:
diff --git a/tests/spec/gl-1.0/shading-lang.c b/tests/spec/gl-1.0/shading-lang.c
new file mode 100644
index 000..5b8ed9a
--- /dev/null
+++ b/tests/spec/gl-1.0/shading-lang.c
@@ -0,0 +1,1939 @@
+/*
+ * BEGIN_COPYRIGHT -*- glean -*-
+ *
+ * Copyright (C) 1999  Allen Akin   All Rights Reserved.
+ * Copyright (C) 2008  VMware, Inc.  All Rights Reserved.
+ *
+ * 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 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 ALLEN AKIN 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.
+ *
+ * END_COPYRIGHT
+ */
+
+/** @file shading-lang.c
+ *
+ * Test OpenGL shading language
+ *
+ * Authors:
+ * Brian Paul 
+ * Adapted to Piglit by Juliet Fru , October 
2015.
+ */
+
+#include "piglit-util-gl.h"
+
+#include 
+#include 
+#include 
+#include 
+
+
+PIGLIT_GL_TEST_CONFIG_BEGIN config.supports_gl_compat_version = 20;
+
+config.window_visual =
+   PIGLIT_GL_VISUAL_RGBA | PIGLIT_GL_VISUAL_DEPTH |
+   PIGLIT_GL_VISUAL_STENCIL;
+
+PIGLIT_GL_TEST_CONFIG_END
+#define GL_GLEXT_PROTOTYPES
+#define FLAG_NONE 0x0
+#define FLAG_LOOSE0x1  /* to indicate a looser tolerance test 
is needed */
+#define FLAG_ILLEGAL_SHADER   0x2  /* the shader test should not compile */
+#define FLAG_ILLEGAL_LINK 0x4  /* the shaders should not link */
+#define FLAG_VERSION_1_20 0x8  /* GLSL 1.20 test */
+#define FLAG_VERSION_1_30 0x10 /* GLSL 1.30 test */
+#define FLAG_WINDING_CW   0x20 /* clockwise-winding polygon */
+#define FLAG_VERTEX_TEXTURE   0x40
+#define FLAG_ARB_DRAW_BUFFERS 0x80
+#define DONT_CARE_Z -1.0
+#define NO_VERTEX_SHADER NULL
+#define NO_FRAGMENT_SHADER NULL
+#define PRIMARY_R 0.25
+#define PRIMARY_G 0.75
+#define PRIMARY_B 0.5
+#define PRIMARY_A 0.25
+#define SECONDARY_R 0.0
+#define SECONDARY_G 0.25
+#define SECONDARY_B 0.25
+#define SECONDARY_A 1.0
+#define AMBIENT { 0.2, 0.4, 0.6, 0.8 }
+#define LIGHT_DIFFUSE { 0.1, 0.3, 0.5, 0.7 }
+#define MAT_DIFFUSE { 0.1, 0.3, 0.5, 0.7 }
+#define DIFFUSE_PRODUCT { 0.01, 0.09, 0.25, 0.7 }  /* note alpha! */
+#define UNIFORM1 {1.0, 0.25, 0.75, 0.0 }   /* don't change! */
+#define PSIZE 3.0
+#define PSIZE_MIN 2.0
+#define PSIZE_MAX 8.0
+#define PSIZE_THRESH 1.5
+#define PSIZE_ATTEN0 4.0
+#define PSIZE_ATTEN1 5.0
+#define PSIZE_ATTEN2 6.0
+#define FOG_START 100.0
+#define FOG_END   200.0
+#define FOG_R 1.0
+#define FOG_G 0.5
+#define FOG_B 1.0
+#define FOG_A 0.0
+static const GLfloat PrimaryColor[4] = { PRIMARY_R, P

Re: [Piglit] cleanups to tesselation generators

2015-10-07 Thread Dylan Baker
On Wed, Oct 07, 2015 at 02:17:01PM -0700, Dylan Baker wrote:
> This series began it's life as an attempt to get the tessalation
> generators running in python 3.x.
> 
> And then I noticed how much code was duplicated between the two
> generators, and spend 20 patches cleaning up style issues, removing
> semi-colons, remove unused imprts, sorting imports, using
> textwrap.dedent, remove semi-colons, fixing whitespace issues, removing
> mixed tabs/spaces, etc.
> 
> In the end I removed a bunch of duplicate code, and got it generating in
> python 3.x, and discovered that python 3.x produced very different
> results than python 2.x did. So I decided to port to numpy and see what
> happened. Numpy produces numbers very similar to python 3.x (with a very
> tiny loss of precision, something like .0xx IIRC), when using
> both python 2.7.10 and python 3.3.6 (python 2.x and 3.x produce the same
> value with numpy).
> 
> However, I have a problem. I don't currently have access to anything
> other than i965 (HSW specifically), and tesselation isn't ready yet, so
> I have no way to test these changes.
> 
> There is a second issue I think. These tests use random to generate
> values. I ran the tests a considerable number of times (somewhere in the
> 1000's of times), and they always produced the same result the first
> time (don't make the mistake of calling them by importing into python,
> they don't always produce the same result that way). However, I feel
> somewhat uncomfortable with tests using random data (even if we're
> seeding the generator to ensure deterministic values).
> 
> Therefore I've sent these out RFC, with the hope that someone with
> RadeonSI or Nouveau will give them a shot and see if there are any
> regressions. And, so that other might comment on the use of random in
> test generators.
> 

rant: Gmail serious makes me mad, it keeps hanging up on me with large
emails. g


anyway, you can look at the truncated patches or download from my git
repo:
https://github.com/dcbaker/piglit.git wip/gen_tes_inputs_python3


signature.asc
Description: PGP signature
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 4/6] generated_tests/gen_tess_input_tests.py: simplify some of the logic

2015-10-07 Thread Dylan Baker
This produces the same result, but it's much clearer what's happening.
---
 generated_tests/gen_tess_input_tests.py | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/generated_tests/gen_tess_input_tests.py 
b/generated_tests/gen_tess_input_tests.py
index f4c50e6..4950976 100644
--- a/generated_tests/gen_tess_input_tests.py
+++ b/generated_tests/gen_tess_input_tests.py
@@ -143,8 +143,7 @@ class TcsTest(object):
 elif self.var_type.startswith('u'):
 rand = lambda: np.random.randint(0, 0x)
 else:
-rand = lambda: ((np.int_(-1) + np.int_(2) *
- np.random.randint(0, 1)) *
+rand = lambda: (np.int_(np.random.choice((-1, 1))) *
 np.random.randint(0, 2**23-1) *
 np.float_(2.0)**(np.random.randint(-126, 127)))
 
@@ -306,8 +305,7 @@ class TesTest(object):
 elif self.var_type.startswith('u'):
 rand = lambda: np.random.randint(0, 0x)
 else:
-rand = lambda: ((np.int_(-1) + np.int_(2) *
- np.random.randint(0, 1)) *
+rand = lambda: (np.int_(np.random.choice((-1, 1))) *
 np.random.randint(0, 2**23-1) *
 np.float_(2.0)**(np.random.randint(-126, 127)))
 
-- 
2.6.1

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


[Piglit] [PATCH 6/6] generated_tests/gen_tess_input_tests.py: Reduce code duplication

2015-10-07 Thread Dylan Baker
This uses a couple of mixin classes to reduce code duplication. It
splits the identical 'generate' functions out into a mixin, as well as
the 'components' and 'test_data' methods into a second mixin. It then
makes filename a lazy_property, to make even less code.

The result is the removal of about 50 LOC.
---
 generated_tests/gen_tess_input_tests.py | 181 
 1 file changed, 66 insertions(+), 115 deletions(-)

diff --git a/generated_tests/gen_tess_input_tests.py 
b/generated_tests/gen_tess_input_tests.py
index f96c725..6454b8b 100644
--- a/generated_tests/gen_tess_input_tests.py
+++ b/generated_tests/gen_tess_input_tests.py
@@ -43,7 +43,70 @@ from templates import template_dir
 _TEMPLATES = template_dir(os.path.basename(os.path.splitext(__file__)[0]))
 
 
-class TcsTest(object):
+class _DataMixin(object):
+"""Mixin class that provides data methods to tests."""
+def components(self):
+"""Returns the number of scalar components of the used data type."""
+n = 1
+
+if self.var_type.startswith('mat'):
+if 'x' in self.var_type:
+n *= int(self.var_type[-1])
+n *= int(self.var_type[-3])
+else:
+n *= int(self.var_type[-1])
+n *= int(self.var_type[-1])
+elif 'vec' in self.var_type:
+n *= int(self.var_type[-1])
+
+return n
+
+@lazy_property
+def test_data(self):
+"""Returns random but deterministic data as a list of strings.
+
+n strings are returned containing c random values, each.
+Where n is the number of vertices times the array length and
+c is the number of components in the tested scalar data type.
+
+"""
+np.random.seed(17)
+
+if self.var_array:
+n = self.var_array * self.reference_size
+else:
+n = self.reference_size
+
+if self.var_type.startswith('i'):
+rand = lambda: np.random.randint(-0x8000, 0x7fff)
+elif self.var_type.startswith('u'):
+rand = lambda: np.random.randint(0, 0x)
+else:
+rand = lambda: (np.int_(np.random.choice((-1, 1))) *
+np.random.randint(0, 2**23-1) *
+np.float_(2.0)**(np.random.randint(-126, 127)))
+
+c = self.components()
+
+ret = []
+for _ in range(n):
+ret.append(" ".join(str(rand()) for _ in range(c)))
+
+return ret
+
+
+class _GenerateMixin(object):  # pylint: disable=too-few-public-methods
+"""Mixin class that provides a generate method."""
+def generate(self):
+"""Generates and writes the test to disc."""
+dirname = os.path.dirname(self.filename)
+safe_makedirs(dirname)
+with open(self.filename, 'w') as f:
+f.write(self.TEMPLATE.render_unicode(
+params=self, generator_command=" ".join(sys.argv)))
+
+
+class TcsTest(_DataMixin, _GenerateMixin):
 """Test passing variables from the vertex shader to the tessellation
 control shader.
 
@@ -109,54 +172,7 @@ class TcsTest(object):
 def tcs_var_ref(self):
 return '.' + self.var_name if self.interface_tcs_instance else 
self.var_name
 
-def components(self):
-"""Returns the number of scalar components of the used data type."""
-n = 1
-
-if self.var_type.startswith('mat'):
-if 'x' in self.var_type:
-n *= int(self.var_type[-1])
-n *= int(self.var_type[-3])
-else:
-n *= int(self.var_type[-1])
-n *= int(self.var_type[-1])
-elif 'vec' in self.var_type:
-n *= int(self.var_type[-1])
-
-return n
-
 @lazy_property
-def test_data(self):
-"""Returns random but deterministic data as a list of strings.
-
-n strings are returned containing c random values, each.
-Where n is the number of vertices times the array length and
-c is the number of components in the tested scalar data type.
-"""
-np.random.seed(17)
-
-if self.var_array:
-n = self.var_array * self.reference_size
-else:
-n = self.reference_size
-
-if self.var_type.startswith('i'):
-rand = lambda: np.random.randint(-0x8000, 0x7fff)
-elif self.var_type.startswith('u'):
-rand = lambda: np.random.randint(0, 0x)
-else:
-rand = lambda: (np.int_(np.random.choice((-1, 1))) *
-np.random.randint(0, 2**23-1) *
-np.float_(2.0)**(np.random.randint(-126, 127)))
-
-c = self.components()
-
-ret = []
-for _ in range(n):
-ret.append(" ".join(str(rand()) for _ in range(c)))
-
-return ret
-
 def filename(self):
 """Returns the file name (including path) for the te

[Piglit] [PATCH 1/6] gen_tess_input_tests.py: Use mako to generate tests

2015-10-07 Thread Dylan Baker
This gives us a cached template, speeding up regenerating these tests,
which is especially helpful in a CI system like Jenkins.

Signed-off-by: Dylan Baker 
---
 generated_tests/CMakeLists.txt |   5 +-
 generated_tests/gen_tess_input_tests.py| 210 ++---
 .../gen_tess_input_tests/tcs.shader_test.mako  | 115 +++
 .../gen_tess_input_tests/tes.shader_test.mako  | 114 +++
 4 files changed, 245 insertions(+), 199 deletions(-)
 create mode 100644 
generated_tests/templates/gen_tess_input_tests/tcs.shader_test.mako
 create mode 100644 
generated_tests/templates/gen_tess_input_tests/tes.shader_test.mako

[truncated because gmail sucks]

-- 
2.6.1

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


[Piglit] [PATCH 3/6] gen_tess_input_tests.py: use numpy for random data

2015-10-07 Thread Dylan Baker
Python 2.x and python 3.x produce different results. This is probably a
difference between the implementations. This result is largely the same
in order of magnitude differences, but the numbers themselves are
sometimes significantly different. This might be due to the difference
between python 2 and python 3's int implementations (int in python 2 can
roll over, but it will grow to consume all memory in python 3), or it
might be due to differences in random.

When ported to numpy both python 2.x and python 3.x produce the same
result, which is very close to the value that python 3.x produces.
This produces deterministic results between python 2.x and python 3.x.

This has not been tested, i965 lacks tessalation support.
---
 generated_tests/gen_tess_input_tests.py | 30 --
 1 file changed, 16 insertions(+), 14 deletions(-)

diff --git a/generated_tests/gen_tess_input_tests.py 
b/generated_tests/gen_tess_input_tests.py
index cf1c1aa..f4c50e6 100644
--- a/generated_tests/gen_tess_input_tests.py
+++ b/generated_tests/gen_tess_input_tests.py
@@ -32,9 +32,9 @@ Currently test for VS -> TCS and TCS -> TES are generated.
 from __future__ import print_function, absolute_import, division
 import os
 import sys
-import random
 
-from six.moves import range
+from six.moves import range  # pylint: disable=redefined-builtin
+import numpy as np
 
 from modules.utils import safe_makedirs, lazy_property
 from templates import template_dir
@@ -131,7 +131,7 @@ class TcsTest(object):
 Where n is the number of vertices times the array length and
 c is the number of components in the tested scalar data type.
 """
-random.seed(17)
+np.random.seed(17)
 
 if self.var_array:
 n = self.var_array * 12
@@ -139,13 +139,14 @@ class TcsTest(object):
 n = 12
 
 if self.var_type.startswith('i'):
-rand = lambda: random.randint(-0x8000, 0x7fff)
+rand = lambda: np.random.randint(-0x8000, 0x7fff)
 elif self.var_type.startswith('u'):
-rand = lambda: random.randint(0, 0x)
+rand = lambda: np.random.randint(0, 0x)
 else:
-rand = lambda: ((-1 + 2 * random.randint(0, 1)) *
-random.randint(0, 2**23-1) *
-2.0**(random.randint(-126, 127)))
+rand = lambda: ((np.int_(-1) + np.int_(2) *
+ np.random.randint(0, 1)) *
+np.random.randint(0, 2**23-1) *
+np.float_(2.0)**(np.random.randint(-126, 127)))
 
 c = self.components()
 
@@ -293,7 +294,7 @@ class TesTest(object):
 Where n is the number of vertices times the array length and
 c is the number of components in the tested scalar data type.
 """
-random.seed(17)
+np.random.seed(17)
 
 if self.var_array:
 n = self.var_array * self.reference_size
@@ -301,13 +302,14 @@ class TesTest(object):
 n = self.reference_size
 
 if self.var_type.startswith('i'):
-rand = lambda: random.randint(-0x8000, 0x7fff)
+rand = lambda: np.random.randint(-0x8000, 0x7fff)
 elif self.var_type.startswith('u'):
-rand = lambda: random.randint(0, 0x)
+rand = lambda: np.random.randint(0, 0x)
 else:
-rand = lambda: ((-1 + 2 * random.randint(0, 1)) *
-random.randint(0, 2**23-1) *
-2.0**(random.randint(-126, 127)))
+rand = lambda: ((np.int_(-1) + np.int_(2) *
+ np.random.randint(0, 1)) *
+np.random.randint(0, 2**23-1) *
+np.float_(2.0)**(np.random.randint(-126, 127)))
 
 c = self.components()
 
-- 
2.6.1

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


[Piglit] [PATCH 5/6] generated_tests/gen_tess_input_tests.py: homogenize {Tes, Tcs}Test

2015-10-07 Thread Dylan Baker
This is going to allow for code sharing, which will simpliyf things
---
 generated_tests/gen_tess_input_tests.py | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/generated_tests/gen_tess_input_tests.py 
b/generated_tests/gen_tess_input_tests.py
index 4950976..f96c725 100644
--- a/generated_tests/gen_tess_input_tests.py
+++ b/generated_tests/gen_tess_input_tests.py
@@ -95,6 +95,8 @@ class TcsTest(object):
 else:
 self.var_type_full = self.var_type
 
+self.reference_size = 12
+
 @property
 def built_in(self):
 return self.var_name.startswith('gl_')
@@ -134,9 +136,9 @@ class TcsTest(object):
 np.random.seed(17)
 
 if self.var_array:
-n = self.var_array * 12
+n = self.var_array * self.reference_size
 else:
-n = 12
+n = self.reference_size
 
 if self.var_type.startswith('i'):
 rand = lambda: np.random.randint(-0x8000, 0x7fff)
-- 
2.6.1

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


[Piglit] [PATCH 2/6] gen_tess_input_tests.py: move some formatting logic into the templates

2015-10-07 Thread Dylan Baker
This logic was purely used for making content to appear in the generated
files. It is both simpler and less code if it put in the template.

Signed-off-by: Dylan Baker 
---
 generated_tests/gen_tess_input_tests.py| 44 ++
 .../gen_tess_input_tests/tcs.shader_test.mako  | 16 +++-
 .../gen_tess_input_tests/tes.shader_test.mako  | 16 +++-
 3 files changed, 33 insertions(+), 43 deletions(-)

diff --git a/generated_tests/gen_tess_input_tests.py 
b/generated_tests/gen_tess_input_tests.py
index b623cce..cf1c1aa 100644
--- a/generated_tests/gen_tess_input_tests.py
+++ b/generated_tests/gen_tess_input_tests.py
@@ -36,7 +36,7 @@ import random
 
 from six.moves import range
 
-from modules.utils import safe_makedirs
+from modules.utils import safe_makedirs, lazy_property
 from templates import template_dir
 
 
@@ -107,26 +107,6 @@ class TcsTest(object):
 def tcs_var_ref(self):
 return '.' + self.var_name if self.interface_tcs_instance else 
self.var_name
 
-@property
-def uniform_string(self):
-"""Returns string for loading uniform data by the shader_runner."""
-data = self.test_data()
-uniforms = ''
-if self.var_array:
-for i in range(12):
-for j in range(self.var_array):
-uniforms += 'uniform {0} reference[{1}].v[{2}] 
{3}\n'.format(
-self.var_type, i, j, data[i*j])
-else:
-for i in range(12):
-uniforms += 'uniform {0} reference[{1}].v {2}\n'.format(
-self.var_type,
-i,
-data[i])
-
-#strip last newline
-return uniforms[:-1]
-
 def components(self):
 """Returns the number of scalar components of the used data type."""
 n = 1
@@ -143,6 +123,7 @@ class TcsTest(object):
 
 return n
 
+@lazy_property
 def test_data(self):
 """Returns random but deterministic data as a list of strings.
 
@@ -288,26 +269,6 @@ class TesTest(object):
 def reference_size(self):
 return 4 if self.patch_in else 12
 
-@property
-def uniform_string(self):
-"""Returns string for loading uniform data by the shader_runner."""
-data = self.test_data()
-uniforms = ''
-if self.var_array:
-for i in range(self.reference_size):
-for j in range(self.var_array):
-uniforms += 'uniform {0} reference[{1}].v[{2}] 
{3}\n'.format(
-self.var_type, i, j, data[i*j])
-else:
-for i in range(self.reference_size):
-uniforms += 'uniform {0} reference[{1}].v {2}\n'.format(
-self.var_type,
-i,
-data[i])
-
-#strip last newline
-return uniforms[:-1]
-
 def components(self):
 """Returns the number of scalar components of the used data type."""
 n = 1
@@ -324,6 +285,7 @@ class TesTest(object):
 
 return n
 
+@lazy_property
 def test_data(self):
 """Returns random but deterministic data as a list of strings.
 
diff --git 
a/generated_tests/templates/gen_tess_input_tests/tcs.shader_test.mako 
b/generated_tests/templates/gen_tess_input_tests/tcs.shader_test.mako
index b5950c2..f57f84d 100644
--- a/generated_tests/templates/gen_tess_input_tests/tcs.shader_test.mako
+++ b/generated_tests/templates/gen_tess_input_tests/tcs.shader_test.mako
@@ -19,6 +19,12 @@
 ## OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 
THE
 ## SOFTWARE.
 
+<%!
+  import itertools
+
+  from six.moves import range
+%>
+
 
 # Test generated by:
 # ${generator_command}
@@ -107,7 +113,15 @@ void main()
 }
 
 [test]
-${params.uniform_string}
+% if params.var_array:
+  % for i, j in itertools.product(range(12), range(params.var_array)):
+uniform ${params.var_type} reference[${i}].v[${j}] ${params.test_data[i*j]}
+  % endfor
+% else:
+  % for i in range(12):
+uniform ${params.var_type} reference[${i}].v ${params.test_data[i]}
+  % endfor
+% endif
 draw arrays GL_PATCHES 0 12
 relative probe rgb (0.25, 0.25) (0.0, 1.0, 0.0)
 relative probe rgb (0.75, 0.25) (0.0, 1.0, 0.0)
diff --git 
a/generated_tests/templates/gen_tess_input_tests/tes.shader_test.mako 
b/generated_tests/templates/gen_tess_input_tests/tes.shader_test.mako
index 3428e11..ccde8bf 100644
--- a/generated_tests/templates/gen_tess_input_tests/tes.shader_test.mako
+++ b/generated_tests/templates/gen_tess_input_tests/tes.shader_test.mako
@@ -19,6 +19,12 @@
 ## OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 
THE
 ## SOFTWARE.
 
+<%!
+  import itertools
+
+  from six.moves import range
+%>
+
 
 # Test generated by:
 # ${generator_command}
@@ -106,7 +112,15 @@ void main()
 }
 
 [test]
-${params.uniform_string}
+% if params.var_array:
+  % for i, j in itertools.product(range(params.reference_size), 
range(params.v

[Piglit] [PATCH 3/9] gen_tess_input_tests.py: add missing docstring

2015-10-07 Thread Dylan Baker
Signed-off-by: Dylan Baker 
---
 generated_tests/gen_tess_input_tests.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/generated_tests/gen_tess_input_tests.py 
b/generated_tests/gen_tess_input_tests.py
index e0c2ac6..3149471 100644
--- a/generated_tests/gen_tess_input_tests.py
+++ b/generated_tests/gen_tess_input_tests.py
@@ -568,6 +568,7 @@ class TesTest(object):
 
 
 def all_tests():
+"""Generator yield test instances."""
 for type_name in ['float', 'vec2', 'vec3', 'vec4',
   'mat2', 'mat3', 'mat4',
   'mat2x3', 'mat2x4', 'mat3x2',
-- 
2.6.1

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


[Piglit] [PATCH 2/9] gen_tess_input_tests.py: use modules.utils.safe_makedirs

2015-10-07 Thread Dylan Baker
This if much like os.makedirs, but catches extra errors to handle corner
cases.

Signed-off-by: Dylan Baker 
---
 generated_tests/gen_tess_input_tests.py | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/generated_tests/gen_tess_input_tests.py 
b/generated_tests/gen_tess_input_tests.py
index bb23f8d..e0c2ac6 100644
--- a/generated_tests/gen_tess_input_tests.py
+++ b/generated_tests/gen_tess_input_tests.py
@@ -37,6 +37,8 @@ import textwrap
 
 from six.moves import range
 
+from modules.utils import safe_makedirs
+
 
 class TcsTest(object):
 """Test passing variables from the vertex shader to the tessellation
@@ -283,8 +285,7 @@ class TcsTest(object):
 
 filename = self.filename()
 dirname = os.path.dirname(filename)
-if not os.path.exists(dirname):
-os.makedirs(dirname)
+safe_makedirs(dirname)
 with open(filename, 'w') as f:
 f.write(test)
 
@@ -561,8 +562,7 @@ class TesTest(object):
 
 filename = self.filename()
 dirname = os.path.dirname(filename)
-if not os.path.exists(dirname):
-os.makedirs(dirname)
+safe_makedirs(dirname)
 with open(filename, 'w') as f:
 f.write(test)
 
-- 
2.6.1

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


[Piglit] [PATCH 1/9] generated_tests: combine gen_{tcs, tes}_input_tests

2015-10-07 Thread Dylan Baker
These two generators share a lot of boilerplate, and all of the
interesting logic is contained in the Test class. A little simple
renaming and the generators can be combined, reducing the amount of
boilerplate needed.

Signed-off-by: Dylan Baker 
---
 generated_tests/CMakeLists.txt |  10 +-
 generated_tests/gen_tcs_input_tests.py | 308 -
 ..._tes_input_tests.py => gen_tess_input_tests.py} | 289 +--
 3 files changed, 275 insertions(+), 332 deletions(-)
 delete mode 100644 generated_tests/gen_tcs_input_tests.py
 rename generated_tests/{gen_tes_input_tests.py => gen_tess_input_tests.py} 
(53%)

diff --git a/generated_tests/CMakeLists.txt b/generated_tests/CMakeLists.txt
index 0dc617b..dbfd5c8 100644
--- a/generated_tests/CMakeLists.txt
+++ b/generated_tests/CMakeLists.txt
@@ -43,11 +43,8 @@ piglit_make_generated_tests(
templates/gen_const_builtin_equal_tests/template.shader_test.mako
)
 piglit_make_generated_tests(
-   tes_input_tests.list
-   gen_tes_input_tests.py)
-piglit_make_generated_tests(
-   tcs_input_tests.list
-   gen_tcs_input_tests.py)
+   tess_input_tests.list
+   gen_tess_input_tests.py)
 piglit_make_generated_tests(
interpolation_tests.list
gen_interpolation_tests.py
@@ -162,8 +159,7 @@ add_custom_target(gen-gl-tests
constant_array_size_tests.list
const_builtin_equal_tests.list
builtin_packing_tests.list
-   tcs_input_tests.list
-   tes_input_tests.list
+   tess_input_tests.list
interpolation_tests.list
non-lvalue_tests.list
texture_query_lod_tests.list
diff --git a/generated_tests/gen_tcs_input_tests.py 
b/generated_tests/gen_tcs_input_tests.py
deleted file mode 100644
index 01e938c..000
--- a/generated_tests/gen_tcs_input_tests.py
+++ /dev/null
@@ -1,308 +0,0 @@
[truncated because gmail sucks]

diff --git a/generated_tests/gen_tes_input_tests.py 
b/generated_tests/gen_tess_input_tests.py
similarity index 53%
rename from generated_tests/gen_tes_input_tests.py
rename to generated_tests/gen_tess_input_tests.py
index d443f7f..bb23f8d 100644
--- a/generated_tests/gen_tes_input_tests.py
+++ b/generated_tests/gen_tess_input_tests.py
@@ -2,6 +2,7 @@
 # coding=utf-8
 #
 # Copyright © 2014 The Piglit Project
+# 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"),
@@ -22,21 +23,9 @@
 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 # DEALINGS IN THE SOFTWARE.
 
-"""Test passing variables from the tessellation control shader to the
-tessellation evaluation shader.
+"""Generate tests for tessellation input stages.
 
-For every combination of varying type as scalar and as two element array and
-per-vertex or per-patch varying create a test that that passes said variable
-between the tessellation shader stages.
-
-Copy a uniform value to the varying in the tessellation control shader and
-compare the varying to the same uniform in the tessellation evaluation
-shader.
-If the values are equal draw the screen green, red otherwise.
-
-Draw for tessellated quads. Each should cover one quarter of the screen.
-
-This script outputs, to stdout, the name of each file it generates.
+Currently test for VS -> TCS and TCS -> TES are generated.
 
 """
 
@@ -49,7 +38,271 @@ import textwrap
 from six.moves import range
 
 
-class Test(object):
+class TcsTest(object):
+"""Test passing variables from the vertex shader to the tessellation
+control shader.
+
+For every varying type create one tests that passes a scalar of that type
+and one test that passes a two element array. Copy an uniform value to the
+varying in the vertex shader and compare the varying to the same uniform in
+the tessellation control shader. If the values are equal draw the screen
+green, red otherwise.
+
+Draw four tessellated quads. Each should cover one quarter of the screen.
+
+"""
+def __init__(self, type_name, array, name):
+"""Creates a test.
+
+type_name -- varying type to test (e.g.: vec4, mat3x2, int, ...)
+array -- number of array elements to test, None for no array
+name -- name of the variable to test
+
+"""
+self.var_name = name or 'var'
+
+if self.var_name == 'gl_Position':
+self.var_type = 'vec4'
+self.var_array = None
+elif self.var_name == 'gl_PointSize':
+self.var_type = 'float'
+self.var_array = None
+elif self.var_name == 'gl_ClipDistance':
+self.var_type = 'float'
+self.var_array = 8
+else:
+self.var_type = type_name
+self.var_array = 

[Piglit] [RFC 07/25] gen_tes_input_tests.py: use texwrap.dedent

2015-10-07 Thread Dylan Baker
This increases the readability of the file by allowing the long test
string to be indented.

Signed-off-by: Dylan Baker 
---
 generated_tests/gen_tes_input_tests.py | 189 +
 1 file changed, 95 insertions(+), 94 deletions(-)

diff --git a/generated_tests/gen_tes_input_tests.py 
b/generated_tests/gen_tes_input_tests.py
index d716ca0..a0a0fdb 100644
--- a/generated_tests/gen_tes_input_tests.py
+++ b/generated_tests/gen_tes_input_tests.py
@@ -44,6 +44,7 @@ from __future__ import print_function, absolute_import, 
division
 import os
 import sys
 import random
+import textwrap
 
 from six.moves import range
 
@@ -208,100 +209,100 @@ class Test(object):
 
 def generate(self):
 """Generates and writes the test to disc."""
-test = \
-"""# Test generated by:
-# {generator_command}
-# Test tessellation control shader inputs
-[require]
-GLSL >= 1.50
-GL_ARB_tessellation_shader
-
-[vertex shader]
-void main()
-{{
-gl_Position = vec4(0);
-}}
-
-[tessellation control shader]
-#extension GL_ARB_tessellation_shader : require
-layout(vertices = 3) out;
-
-uniform struct S0 {{
-{self.var_type_full} v;
-}} reference[12];
-
-#if {self.use_block}
-{self.interface_prefix}out {self.interface_name} {{
-{self.var_type_full} {self.var_name};
-}} {self.interface_tcs_instance}{self.interface_postfix};
-#else
-{self.interface_prefix}out {self.var_type_full} {self.var_name};
-#endif
-
-void main()
-{{
-const int vertices_in = 3;
-{self.interface_tcs_instance}{self.tcs_var_ref} = 
reference[{self.tcs_reference_index}].v;
-gl_TessLevelOuter = float[4](1.0, 1.0, 1.0, 1.0);
-gl_TessLevelInner = float[2](1.0, 1.0);
-}}
-
-[tessellation evaluation shader]
-#extension GL_ARB_tessellation_shader : require
-layout(quads) in;
-
-uniform struct S0 {{
-{self.var_type_full} v;
-}} reference[12];
-
-#if {self.use_block}
-{self.interface_prefix}in {self.interface_name} {{
-{self.var_type_full} {self.var_name};
-}} {self.interface_tes_instance}{self.interface_postfix};
-#else
-{self.interface_prefix}in {self.var_type_full} {self.var_name};
-#endif
-
-out vec4 vert_color;
-
-void main()
-{{
-const int vertices_in = 3;
-const vec4 red = vec4(1, 0, 0, 1);
-const vec4 green = vec4(0, 1, 0, 1);
-vert_color = green;
-for (int i = 0; i < vertices_in; ++i)
-if ({self.interface_tes_instance}{self.tes_var_ref} != 
reference[{self.tes_reference_index}].v)
-vert_color = red;
-vec2[3] position = vec2[3](
-vec2(float(gl_PrimitiveID / 2) - 1.0, float(gl_PrimitiveID % 
2) - 1.0),
-vec2(float(gl_PrimitiveID / 2) - 0.0, float(gl_PrimitiveID % 
2) - 1.0),
-vec2(float(gl_PrimitiveID / 2) - 1.0, float(gl_PrimitiveID % 
2) - 0.0)
-);
-gl_Position = vec4(position[0]
-+ (position[1] - position[0]) * gl_TessCoord[0]
-+ (position[2] - position[0]) * gl_TessCoord[1], 0.0, 1.0);
-}}
-
-[fragment shader]
-
-in vec4 vert_color;
-
-out vec4 frag_color;
-
-void main()
-{{
-frag_color = vert_color;
-}}
-
-[test]
-{self.uniform_string}
-draw arrays GL_PATCHES 0 12
-relative probe rgb (0.25, 0.25) (0.0, 1.0, 0.0)
-relative probe rgb (0.75, 0.25) (0.0, 1.0, 0.0)
-relative probe rgb (0.25, 0.75) (0.0, 1.0, 0.0)
-relative probe rgb (0.75, 0.75) (0.0, 1.0, 0.0)
-"""
+test = textwrap.dedent("""\
+# Test generated by:
+# {generator_command}
+# Test tessellation control shader inputs
+[require]
+GLSL >= 1.50
+GL_ARB_tessellation_shader
+
+[vertex shader]
+void main()
+{{
+gl_Position = vec4(0);
+}}
+
+[tessellation control shader]
+#extension GL_ARB_tessellation_shader : require
+layout(vertices = 3) out;
+
+uniform struct S0 {{
+{self.var_type_full} v;
+}} reference[12];
+
+#if {self.use_block}
+{self.interface_prefix}out {self.interface_name} {{
+{self.var_type_full} {self.var_name};
+}} {self.interface_tcs_instance}{self.interface_postfix};
+#else
+{self.interface_prefix}out {self.var_type_full} {self.var_name};
+#endif
+
+void main()
+{{
+const int vertices_in = 3;
+{self.interface_tcs_instance}{self.tcs_var_ref} = 
reference[{self.tcs_reference_index}].v;
+gl_TessLevelOuter = float[4](1.0, 1.0, 1.0, 1.0);
+gl_TessLevelInner = float[2](1.0, 1.0);
+}}
+
+[tessellation evaluation shader]
+#extension GL_ARB_tessellation_shader : require
+layout(quads) in;
+
+uniform struct S0 {{
+

[Piglit] [RFC 06/25] gen_tes_input_tests.py: use six.moves.range

2015-10-07 Thread Dylan Baker
This maintains python 2.x and 3.x compatibility, while still using an
efficient iterator function (unlike range in python 2.x which returns a
list)

Signed-off-by: Dylan Baker 
---
 generated_tests/gen_tes_input_tests.py | 12 +++-
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/generated_tests/gen_tes_input_tests.py 
b/generated_tests/gen_tes_input_tests.py
index bff1c8e..d716ca0 100644
--- a/generated_tests/gen_tes_input_tests.py
+++ b/generated_tests/gen_tes_input_tests.py
@@ -45,6 +45,8 @@ import os
 import sys
 import random
 
+from six.moves import range
+
 
 class Test(object):
 def __init__(self, type_name, array, patch_in, name):
@@ -127,12 +129,12 @@ class Test(object):
 data = self.test_data()
 uniforms = ''
 if self.var_array:
-for i in xrange(self.reference_size):
-for j in xrange(self.var_array):
+for i in range(self.reference_size):
+for j in range(self.var_array):
 uniforms += 'uniform {0} reference[{1}].v[{2}] 
{3}\n'.format(
 self.var_type, i, j, data[i*j])
 else:
-for i in xrange(self.reference_size):
+for i in range(self.reference_size):
 uniforms += 'uniform {0} reference[{1}].v {2}\n'.format(
 self.var_type,
 i,
@@ -183,8 +185,8 @@ class Test(object):
 c = self.components()
 
 ret = []
-for i in xrange(n):
-ret.append(" ".join(str(rand()) for _ in xrange(c)))
+for i in range(n):
+ret.append(" ".join(str(rand()) for _ in range(c)))
 
 return ret
 
-- 
2.6.0

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


[Piglit] [RFC 09/25] gen_tcs_input_tests.py: remove unnecessary semicolons

2015-10-07 Thread Dylan Baker
Signed-off-by: Dylan Baker 
---
 generated_tests/gen_tcs_input_tests.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/generated_tests/gen_tcs_input_tests.py 
b/generated_tests/gen_tcs_input_tests.py
index 763c128..a2f7ae3 100644
--- a/generated_tests/gen_tcs_input_tests.py
+++ b/generated_tests/gen_tcs_input_tests.py
@@ -47,7 +47,7 @@ class Test(object):
 name -- name of the variable to test
 
 """
-self.var_name = name or 'var';
+self.var_name = name or 'var'
 
 if self.var_name == 'gl_Position':
 self.var_type = 'vec4'
@@ -288,7 +288,7 @@ def all_tests():
 for array in [None, 2]:
 yield Test(type_name=type_name, array=array, name=None)
 for var in ['gl_Position', 'gl_PointSize', 'gl_ClipDistance']:
-yield Test(type_name=None, array=None, name=var);
+yield Test(type_name=None, array=None, name=var)
 
 def main():
 for test in all_tests():
-- 
2.6.0

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


[Piglit] [RFC 15/25] gen_tcs_input_tests.py: use textwrap.dedent

2015-10-07 Thread Dylan Baker
Signed-off-by: Dylan Baker 
---
 generated_tests/gen_tcs_input_tests.py | 191 +
 1 file changed, 96 insertions(+), 95 deletions(-)

diff --git a/generated_tests/gen_tcs_input_tests.py 
b/generated_tests/gen_tcs_input_tests.py
index 9e761af..535074a 100644
--- a/generated_tests/gen_tcs_input_tests.py
+++ b/generated_tests/gen_tcs_input_tests.py
@@ -41,6 +41,7 @@ from __future__ import print_function, division, 
absolute_import
 import os
 import sys
 import random
+import textwrap
 
 from six.moves import range
 
@@ -178,101 +179,101 @@ class Test(object):
 
 def generate(self):
 """Generates and writes the test to disc."""
-test = \
-"""# Test generated by:
-# {generator_command}
-# Test tessellation control shader inputs
-[require]
-GLSL >= 1.50
-GL_ARB_tessellation_shader
-
-[vertex shader]
-uniform struct S0 {{
-{self.var_type_full} v;
-}} reference[12];
-
-out {self.interface_name} {{
-{self.var_type_full} {self.var_name};
-}} {self.interface_vs_instance};
-
-void main()
-{{
-{self.interface_vs_instance}{self.vs_var_ref} = 
reference[gl_VertexID].v;
-}}
-
-[tessellation control shader]
-#extension GL_ARB_tessellation_shader : require
-layout(vertices = 3) out;
-
-uniform struct S0 {{
-{self.var_type_full} v;
-}} reference[12];
-
-in {self.interface_name} {{
-{self.var_type_full} {self.var_name};
-}} {self.interface_tcs_instance}[];
-
-out int pass[];
-
-void main()
-{{
-const int vertices_in = 3;
-int local_pass = 1;
-for (int i = 0; i < vertices_in; ++i) {{
-int vertex_ID = gl_PrimitiveID * vertices_in + i;
-if ({self.interface_tcs_instance}[i]{self.tcs_var_ref} != 
reference[vertex_ID].v)
-local_pass = 0;
-}}
-pass[gl_InvocationID] = local_pass;
-gl_TessLevelOuter = float[4](1.0, 1.0, 1.0, 1.0);
-gl_TessLevelInner = float[2](1.0, 1.0);
-}}
-
-[tessellation evaluation shader]
-#extension GL_ARB_tessellation_shader : require
-layout(quads) in;
-
-in int pass[];
-
-out vec4 vert_color;
-
-void main()
-{{
-const vec4 red = vec4(1, 0, 0, 1);
-const vec4 green = vec4(0, 1, 0, 1);
-vec2[3] position = vec2[3](
-vec2(float(gl_PrimitiveID / 2) - 1.0, float(gl_PrimitiveID % 
2) - 1.0),
-vec2(float(gl_PrimitiveID / 2) - 0.0, float(gl_PrimitiveID % 
2) - 1.0),
-vec2(float(gl_PrimitiveID / 2) - 1.0, float(gl_PrimitiveID % 
2) - 0.0)
-);
-gl_Position = vec4(position[0]
-+ (position[1] - position[0]) * gl_TessCoord[0]
-+ (position[2] - position[0]) * gl_TessCoord[1], 0.0, 1.0);
-vert_color = green;
-if (pass[0] == 0 || pass[1] == 0 || pass[2] == 0) {{
-vert_color = red;
-}}
-}}
-
-[fragment shader]
-
-in vec4 vert_color;
-
-out vec4 frag_color;
-
-void main()
-{{
-frag_color = vert_color;
-}}
-
-[test]
-{self.uniform_string}
-draw arrays GL_PATCHES 0 12
-relative probe rgb (0.25, 0.25) (0.0, 1.0, 0.0)
-relative probe rgb (0.75, 0.25) (0.0, 1.0, 0.0)
-relative probe rgb (0.25, 0.75) (0.0, 1.0, 0.0)
-relative probe rgb (0.75, 0.75) (0.0, 1.0, 0.0)
-"""
+test = textwrap.dedent("""\
+# Test generated by:
+# {generator_command}
+# Test tessellation control shader inputs
+[require]
+GLSL >= 1.50
+GL_ARB_tessellation_shader
+
+[vertex shader]
+uniform struct S0 {{
+{self.var_type_full} v;
+}} reference[12];
+
+out {self.interface_name} {{
+{self.var_type_full} {self.var_name};
+}} {self.interface_vs_instance};
+
+void main()
+{{
+{self.interface_vs_instance}{self.vs_var_ref} = 
reference[gl_VertexID].v;
+}}
+
+[tessellation control shader]
+#extension GL_ARB_tessellation_shader : require
+layout(vertices = 3) out;
+
+uniform struct S0 {{
+{self.var_type_full} v;
+}} reference[12];
+
+in {self.interface_name} {{
+{self.var_type_full} {self.var_name};
+}} {self.interface_tcs_instance}[];
+
+out int pass[];
+
+void main()
+{{
+const int vertices_in = 3;
+int local_pass = 1;
+for (int i = 0; i < vertices_in; ++i) {{
+int vertex_ID = gl_PrimitiveID * vertices_in + i;
+if 
({self.interface_tcs_instance}[i]{self.tcs_var_ref} != reference[vertex_ID].v)
+local_pass = 0;
+}}
+pass[gl_InvocationID] = local_pass;
+gl_TessLevelOuter = float[4](1.0, 1.0, 1.0, 1.0);
+ 

[Piglit] [RFC 13/25] gen_tcs_input_tests.py: fix whitespace errors

2015-10-07 Thread Dylan Baker
Signed-off-by: Dylan Baker 
---
 generated_tests/gen_tcs_input_tests.py | 24 
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/generated_tests/gen_tcs_input_tests.py 
b/generated_tests/gen_tcs_input_tests.py
index c705844..5d2b4a5 100644
--- a/generated_tests/gen_tcs_input_tests.py
+++ b/generated_tests/gen_tcs_input_tests.py
@@ -102,13 +102,13 @@ class Test(object):
 for i in xrange(12):
 for j in xrange(self.var_array):
 uniforms += 'uniform {0} reference[{1}].v[{2}] 
{3}\n'.format(
-self.var_type, i, j, data[i*j])
+self.var_type, i, j, data[i*j])
 else:
 for i in xrange(12):
 uniforms += 'uniform {0} reference[{1}].v {2}\n'.format(
-self.var_type,
-i,
-data[i])
+self.var_type,
+i,
+data[i])
 
 #strip last newline
 return uniforms[:-1]
@@ -144,13 +144,13 @@ class Test(object):
 n = 12
 
 if self.var_type.startswith('i'):
-rand = lambda : random.randint(-0x8000, 0x7fff)
+rand = lambda: random.randint(-0x8000, 0x7fff)
 elif self.var_type.startswith('u'):
-rand = lambda : random.randint(0, 0x)
+rand = lambda: random.randint(0, 0x)
 else:
-rand = lambda : ((-1 + 2 * random.randint(0, 1)) *
- random.randint(0, 2**23-1) *
- 2.0**(random.randint(-126, 127)))
+rand = lambda: ((-1 + 2 * random.randint(0, 1)) *
+random.randint(0, 2**23-1) *
+2.0**(random.randint(-126, 127)))
 
 c = self.components()
 
@@ -272,8 +272,7 @@ relative probe rgb (0.25, 0.75) (0.0, 1.0, 0.0)
 relative probe rgb (0.75, 0.75) (0.0, 1.0, 0.0)
 """
 
-test = test.format(self = self,
-generator_command = " ".join(sys.argv))
+test = test.format(self=self, generator_command=" ".join(sys.argv))
 
 filename = self.filename()
 dirname = os.path.dirname(filename)
@@ -284,7 +283,7 @@ relative probe rgb (0.75, 0.75) (0.0, 1.0, 0.0)
 
 
 def all_tests():
-for type_name in ['float', 'vec2',  'vec3',  'vec4',
+for type_name in ['float', 'vec2', 'vec3', 'vec4',
   'mat2', 'mat3', 'mat4',
   'mat2x3', 'mat2x4', 'mat3x2',
   'mat3x4', 'mat4x2', 'mat4x3',
@@ -295,6 +294,7 @@ def all_tests():
 for var in ['gl_Position', 'gl_PointSize', 'gl_ClipDistance']:
 yield Test(type_name=None, array=None, name=var)
 
+
 def main():
 for test in all_tests():
 test.generate()
-- 
2.6.0

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


[Piglit] cleanups to tesselation generators

2015-10-07 Thread Dylan Baker
This series began it's life as an attempt to get the tessalation
generators running in python 3.x.

And then I noticed how much code was duplicated between the two
generators, and spend 20 patches cleaning up style issues, removing
semi-colons, remove unused imprts, sorting imports, using
textwrap.dedent, remove semi-colons, fixing whitespace issues, removing
mixed tabs/spaces, etc.

In the end I removed a bunch of duplicate code, and got it generating in
python 3.x, and discovered that python 3.x produced very different
results than python 2.x did. So I decided to port to numpy and see what
happened. Numpy produces numbers very similar to python 3.x (with a very
tiny loss of precision, something like .0xx IIRC), when using
both python 2.7.10 and python 3.3.6 (python 2.x and 3.x produce the same
value with numpy).

However, I have a problem. I don't currently have access to anything
other than i965 (HSW specifically), and tesselation isn't ready yet, so
I have no way to test these changes.

There is a second issue I think. These tests use random to generate
values. I ran the tests a considerable number of times (somewhere in the
1000's of times), and they always produced the same result the first
time (don't make the mistake of calling them by importing into python,
they don't always produce the same result that way). However, I feel
somewhat uncomfortable with tests using random data (even if we're
seeding the generator to ensure deterministic values).

Therefore I've sent these out RFC, with the hope that someone with
RadeonSI or Nouveau will give them a shot and see if there are any
regressions. And, so that other might comment on the use of random in
test generators.

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


[Piglit] [RFC 10/25] gen_tcs_input_tests.py: replace tabs with spaces

2015-10-07 Thread Dylan Baker
Signed-off-by: Dylan Baker 
---
 generated_tests/gen_tcs_input_tests.py | 60 +-
 1 file changed, 30 insertions(+), 30 deletions(-)

diff --git a/generated_tests/gen_tcs_input_tests.py 
b/generated_tests/gen_tcs_input_tests.py
index a2f7ae3..883c5cc 100644
--- a/generated_tests/gen_tcs_input_tests.py
+++ b/generated_tests/gen_tcs_input_tests.py
@@ -181,16 +181,16 @@ GL_ARB_tessellation_shader
 
 [vertex shader]
 uniform struct S0 {{
-   {self.var_type_full} v;
+{self.var_type_full} v;
 }} reference[12];
 
 out {self.interface_name} {{
-   {self.var_type_full} {self.var_name};
+{self.var_type_full} {self.var_name};
 }} {self.interface_vs_instance};
 
 void main()
 {{
-   {self.interface_vs_instance}{self.vs_var_ref} = 
reference[gl_VertexID].v;
+{self.interface_vs_instance}{self.vs_var_ref} = 
reference[gl_VertexID].v;
 }}
 
 [tessellation control shader]
@@ -198,27 +198,27 @@ void main()
 layout(vertices = 3) out;
 
 uniform struct S0 {{
-   {self.var_type_full} v;
+{self.var_type_full} v;
 }} reference[12];
 
 in {self.interface_name} {{
-   {self.var_type_full} {self.var_name};
+{self.var_type_full} {self.var_name};
 }} {self.interface_tcs_instance}[];
 
 out int pass[];
 
 void main()
 {{
-   const int vertices_in = 3;
-   int local_pass = 1;
-   for (int i = 0; i < vertices_in; ++i) {{
-   int vertex_ID = gl_PrimitiveID * vertices_in + i;
-   if ({self.interface_tcs_instance}[i]{self.tcs_var_ref} != 
reference[vertex_ID].v)
-   local_pass = 0;
-   }}
-   pass[gl_InvocationID] = local_pass;
-   gl_TessLevelOuter = float[4](1.0, 1.0, 1.0, 1.0);
-   gl_TessLevelInner = float[2](1.0, 1.0);
+const int vertices_in = 3;
+int local_pass = 1;
+for (int i = 0; i < vertices_in; ++i) {{
+int vertex_ID = gl_PrimitiveID * vertices_in + i;
+if ({self.interface_tcs_instance}[i]{self.tcs_var_ref} != 
reference[vertex_ID].v)
+local_pass = 0;
+}}
+pass[gl_InvocationID] = local_pass;
+gl_TessLevelOuter = float[4](1.0, 1.0, 1.0, 1.0);
+gl_TessLevelInner = float[2](1.0, 1.0);
 }}
 
 [tessellation evaluation shader]
@@ -231,20 +231,20 @@ out vec4 vert_color;
 
 void main()
 {{
-   const vec4 red = vec4(1, 0, 0, 1);
-   const vec4 green = vec4(0, 1, 0, 1);
-   vec2[3] position = vec2[3](
-   vec2(float(gl_PrimitiveID / 2) - 1.0, float(gl_PrimitiveID % 2) 
- 1.0),
-   vec2(float(gl_PrimitiveID / 2) - 0.0, float(gl_PrimitiveID % 2) 
- 1.0),
-   vec2(float(gl_PrimitiveID / 2) - 1.0, float(gl_PrimitiveID % 2) 
- 0.0)
-   );
-   gl_Position = vec4(position[0]
-   + (position[1] - position[0]) * gl_TessCoord[0]
-   + (position[2] - position[0]) * gl_TessCoord[1], 0.0, 1.0);
-   vert_color = green;
-   if (pass[0] == 0 || pass[1] == 0 || pass[2] == 0) {{
-   vert_color = red;
-   }}
+const vec4 red = vec4(1, 0, 0, 1);
+const vec4 green = vec4(0, 1, 0, 1);
+vec2[3] position = vec2[3](
+vec2(float(gl_PrimitiveID / 2) - 1.0, float(gl_PrimitiveID % 
2) - 1.0),
+vec2(float(gl_PrimitiveID / 2) - 0.0, float(gl_PrimitiveID % 
2) - 1.0),
+vec2(float(gl_PrimitiveID / 2) - 1.0, float(gl_PrimitiveID % 
2) - 0.0)
+);
+gl_Position = vec4(position[0]
++ (position[1] - position[0]) * gl_TessCoord[0]
++ (position[2] - position[0]) * gl_TessCoord[1], 0.0, 1.0);
+vert_color = green;
+if (pass[0] == 0 || pass[1] == 0 || pass[2] == 0) {{
+vert_color = red;
+}}
 }}
 
 [fragment shader]
@@ -255,7 +255,7 @@ out vec4 frag_color;
 
 void main()
 {{
-   frag_color = vert_color;
+frag_color = vert_color;
 }}
 
 [test]
-- 
2.6.0

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


[Piglit] [RFC 02/25] gen_tes_input_tests.py: remove unnecissary ; at end of python lines

2015-10-07 Thread Dylan Baker
python allows these, but they're not necessary and not normal

Signed-off-by: Dylan Baker 
---
 generated_tests/gen_tes_input_tests.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/generated_tests/gen_tes_input_tests.py 
b/generated_tests/gen_tes_input_tests.py
index ea87e72..cac1722 100644
--- a/generated_tests/gen_tes_input_tests.py
+++ b/generated_tests/gen_tes_input_tests.py
@@ -53,7 +53,7 @@ class Test(object):
 name -- name of the variable to test
 
 """
-self.var_name = name or 'var';
+self.var_name = name or 'var'
 self.use_block = 0 if patch_in else 1
 
 if self.var_name == 'gl_Position':
@@ -320,7 +320,7 @@ def all_tests():
 for patch_in in [True, False]:
 yield Test(type_name, array, patch_in, name=None)
 for var in ['gl_Position', 'gl_PointSize', 'gl_ClipDistance']:
-yield Test(type_name=None, array=None, patch_in=False, name=var);
+yield Test(type_name=None, array=None, patch_in=False, name=var)
 
 def main():
 for test in all_tests():
-- 
2.6.0

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


[Piglit] [RFC 14/25] gen_tcs_input_tests.py: use six.moves.range

2015-10-07 Thread Dylan Baker
Signed-off-by: Dylan Baker 
---
 generated_tests/gen_tcs_input_tests.py | 12 +++-
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/generated_tests/gen_tcs_input_tests.py 
b/generated_tests/gen_tcs_input_tests.py
index 5d2b4a5..9e761af 100644
--- a/generated_tests/gen_tcs_input_tests.py
+++ b/generated_tests/gen_tcs_input_tests.py
@@ -42,6 +42,8 @@ import os
 import sys
 import random
 
+from six.moves import range
+
 
 class Test(object):
 def __init__(self, type_name, array, name):
@@ -99,12 +101,12 @@ class Test(object):
 data = self.test_data()
 uniforms = ''
 if self.var_array:
-for i in xrange(12):
-for j in xrange(self.var_array):
+for i in range(12):
+for j in range(self.var_array):
 uniforms += 'uniform {0} reference[{1}].v[{2}] 
{3}\n'.format(
 self.var_type, i, j, data[i*j])
 else:
-for i in xrange(12):
+for i in range(12):
 uniforms += 'uniform {0} reference[{1}].v {2}\n'.format(
 self.var_type,
 i,
@@ -155,8 +157,8 @@ class Test(object):
 c = self.components()
 
 ret = []
-for i in xrange(n):
-ret.append(" ".join(str(rand()) for _ in xrange(c)))
+for i in range(n):
+ret.append(" ".join(str(rand()) for _ in range(c)))
 
 return ret
 
-- 
2.6.0

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


[Piglit] [RFC 01/25] gen_tes_input_Tests.py: use a proper docstring

2015-10-07 Thread Dylan Baker
This is just syntactic sugar.

Signed-off-by: Dylan Baker 
---
 generated_tests/gen_tes_input_tests.py | 32 +---
 1 file changed, 17 insertions(+), 15 deletions(-)

diff --git a/generated_tests/gen_tes_input_tests.py 
b/generated_tests/gen_tes_input_tests.py
index 8bad144..ea87e72 100644
--- a/generated_tests/gen_tes_input_tests.py
+++ b/generated_tests/gen_tes_input_tests.py
@@ -22,21 +22,23 @@
 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 # DEALINGS IN THE SOFTWARE.
 
-## Test passing variables from the tessellation control shader to the
-# tessellation evaluation shader.
-#
-# For every combination of varying type as scalar and as two element array and
-# per-vertex or per-patch varying create a test that that passes said variable
-# between the tessellation shader stages.
-#
-# Copy a uniform value to the varying in the tessellation control shader and
-# compare the varying to the same uniform in the tessellation evaluation
-# shader.
-# If the values are equal draw the screen green, red otherwise.
-#
-# Draw for tessellated quads. Each should cover one quarter of the screen.
-#
-# This script outputs, to stdout, the name of each file it generates.
+"""Test passing variables from the tessellation control shader to the
+tessellation evaluation shader.
+
+For every combination of varying type as scalar and as two element array and
+per-vertex or per-patch varying create a test that that passes said variable
+between the tessellation shader stages.
+
+Copy a uniform value to the varying in the tessellation control shader and
+compare the varying to the same uniform in the tessellation evaluation
+shader.
+If the values are equal draw the screen green, red otherwise.
+
+Draw for tessellated quads. Each should cover one quarter of the screen.
+
+This script outputs, to stdout, the name of each file it generates.
+
+"""
 
 import os, sys, random
 
-- 
2.6.0

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


[Piglit] [RFC 16/25] gen_tcs_input_tests.py: replace unused variable with _

2015-10-07 Thread Dylan Baker
Signed-off-by: Dylan Baker 
---
 generated_tests/gen_tcs_input_tests.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/generated_tests/gen_tcs_input_tests.py 
b/generated_tests/gen_tcs_input_tests.py
index 535074a..01e938c 100644
--- a/generated_tests/gen_tcs_input_tests.py
+++ b/generated_tests/gen_tcs_input_tests.py
@@ -158,7 +158,7 @@ class Test(object):
 c = self.components()
 
 ret = []
-for i in range(n):
+for _ in range(n):
 ret.append(" ".join(str(rand()) for _ in range(c)))
 
 return ret
-- 
2.6.0

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


[Piglit] [RFC 08/25] gen_tes_input_tests.py: replace unused variable with _

2015-10-07 Thread Dylan Baker
Signed-off-by: Dylan Baker 
---
 generated_tests/gen_tes_input_tests.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/generated_tests/gen_tes_input_tests.py 
b/generated_tests/gen_tes_input_tests.py
index a0a0fdb..d443f7f 100644
--- a/generated_tests/gen_tes_input_tests.py
+++ b/generated_tests/gen_tes_input_tests.py
@@ -186,7 +186,7 @@ class Test(object):
 c = self.components()
 
 ret = []
-for i in range(n):
+for _ in range(n):
 ret.append(" ".join(str(rand()) for _ in range(c)))
 
 return ret
-- 
2.6.0

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


[Piglit] [RFC 05/25] gen_tes_input_tests.py: cleanup whitespace issues

2015-10-07 Thread Dylan Baker
these are mostly bad hanging indents or oddly placed spaces

Signed-off-by: Dylan Baker 
---
 generated_tests/gen_tes_input_tests.py | 26 +-
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/generated_tests/gen_tes_input_tests.py 
b/generated_tests/gen_tes_input_tests.py
index 110193a..bff1c8e 100644
--- a/generated_tests/gen_tes_input_tests.py
+++ b/generated_tests/gen_tes_input_tests.py
@@ -130,13 +130,13 @@ class Test(object):
 for i in xrange(self.reference_size):
 for j in xrange(self.var_array):
 uniforms += 'uniform {0} reference[{1}].v[{2}] 
{3}\n'.format(
-self.var_type, i, j, data[i*j])
+self.var_type, i, j, data[i*j])
 else:
 for i in xrange(self.reference_size):
 uniforms += 'uniform {0} reference[{1}].v {2}\n'.format(
-self.var_type,
-i,
-data[i])
+self.var_type,
+i,
+data[i])
 
 #strip last newline
 return uniforms[:-1]
@@ -172,13 +172,13 @@ class Test(object):
 n = self.reference_size
 
 if self.var_type.startswith('i'):
-rand = lambda : random.randint(-0x8000, 0x7fff)
+rand = lambda: random.randint(-0x8000, 0x7fff)
 elif self.var_type.startswith('u'):
-rand = lambda : random.randint(0, 0x)
+rand = lambda: random.randint(0, 0x)
 else:
-rand = lambda : ((-1 + 2 * random.randint(0, 1)) *
- random.randint(0, 2**23-1) *
- 2.0**(random.randint(-126, 127)))
+rand = lambda: ((-1 + 2 * random.randint(0, 1)) *
+random.randint(0, 2**23-1) *
+2.0**(random.randint(-126, 127)))
 
 c = self.components()
 
@@ -301,8 +301,7 @@ relative probe rgb (0.25, 0.75) (0.0, 1.0, 0.0)
 relative probe rgb (0.75, 0.75) (0.0, 1.0, 0.0)
 """
 
-test = test.format(self = self,
-generator_command = " ".join(sys.argv))
+test = test.format(self=self, generator_command=" ".join(sys.argv))
 
 filename = self.filename()
 dirname = os.path.dirname(filename)
@@ -313,7 +312,7 @@ relative probe rgb (0.75, 0.75) (0.0, 1.0, 0.0)
 
 
 def all_tests():
-for type_name in ['float', 'vec2',  'vec3',  'vec4',
+for type_name in ['float', 'vec2', 'vec3', 'vec4',
   'mat2', 'mat3', 'mat4',
   'mat2x3', 'mat2x4', 'mat3x2',
   'mat3x4', 'mat4x2', 'mat4x3',
@@ -321,10 +320,11 @@ def all_tests():
   'uint', 'uvec2', 'uvec3', 'uvec4']:
 for array in [None, 2]:
 for patch_in in [True, False]:
-yield Test(type_name, array, patch_in, name=None)
+yield Test(type_name, array, patch_in, name=None)
 for var in ['gl_Position', 'gl_PointSize', 'gl_ClipDistance']:
 yield Test(type_name=None, array=None, patch_in=False, name=var)
 
+
 def main():
 for test in all_tests():
 test.generate()
-- 
2.6.0

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


[Piglit] [RFC 12/25] gen_tcs_input_tests.py: fix imports

2015-10-07 Thread Dylan Baker
Signed-off-by: Dylan Baker 
---
 generated_tests/gen_tcs_input_tests.py | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/generated_tests/gen_tcs_input_tests.py 
b/generated_tests/gen_tcs_input_tests.py
index ac56905..c705844 100644
--- a/generated_tests/gen_tcs_input_tests.py
+++ b/generated_tests/gen_tcs_input_tests.py
@@ -37,7 +37,10 @@ This script outputs, to stdout, the name of each file it 
generates.
 
 """
 
-import os, sys, random
+from __future__ import print_function, division, absolute_import
+import os
+import sys
+import random
 
 
 class Test(object):
-- 
2.6.0

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


[Piglit] [RFC 03/25] gen_tes_input_tests.py: replace tabs with spaces

2015-10-07 Thread Dylan Baker
This breaks python 3 compatibility

Signed-off-by: Dylan Baker 
---
 generated_tests/gen_tes_input_tests.py | 50 +-
 1 file changed, 25 insertions(+), 25 deletions(-)

diff --git a/generated_tests/gen_tes_input_tests.py 
b/generated_tests/gen_tes_input_tests.py
index cac1722..3bd1787 100644
--- a/generated_tests/gen_tes_input_tests.py
+++ b/generated_tests/gen_tes_input_tests.py
@@ -214,7 +214,7 @@ GL_ARB_tessellation_shader
 [vertex shader]
 void main()
 {{
-   gl_Position = vec4(0);
+gl_Position = vec4(0);
 }}
 
 [tessellation control shader]
@@ -222,12 +222,12 @@ void main()
 layout(vertices = 3) out;
 
 uniform struct S0 {{
-   {self.var_type_full} v;
+{self.var_type_full} v;
 }} reference[12];
 
 #if {self.use_block}
 {self.interface_prefix}out {self.interface_name} {{
-   {self.var_type_full} {self.var_name};
+{self.var_type_full} {self.var_name};
 }} {self.interface_tcs_instance}{self.interface_postfix};
 #else
 {self.interface_prefix}out {self.var_type_full} {self.var_name};
@@ -235,10 +235,10 @@ uniform struct S0 {{
 
 void main()
 {{
-   const int vertices_in = 3;
-   {self.interface_tcs_instance}{self.tcs_var_ref} = 
reference[{self.tcs_reference_index}].v;
-   gl_TessLevelOuter = float[4](1.0, 1.0, 1.0, 1.0);
-   gl_TessLevelInner = float[2](1.0, 1.0);
+const int vertices_in = 3;
+{self.interface_tcs_instance}{self.tcs_var_ref} = 
reference[{self.tcs_reference_index}].v;
+gl_TessLevelOuter = float[4](1.0, 1.0, 1.0, 1.0);
+gl_TessLevelInner = float[2](1.0, 1.0);
 }}
 
 [tessellation evaluation shader]
@@ -246,12 +246,12 @@ void main()
 layout(quads) in;
 
 uniform struct S0 {{
-   {self.var_type_full} v;
+{self.var_type_full} v;
 }} reference[12];
 
 #if {self.use_block}
 {self.interface_prefix}in {self.interface_name} {{
-   {self.var_type_full} {self.var_name};
+{self.var_type_full} {self.var_name};
 }} {self.interface_tes_instance}{self.interface_postfix};
 #else
 {self.interface_prefix}in {self.var_type_full} {self.var_name};
@@ -261,21 +261,21 @@ out vec4 vert_color;
 
 void main()
 {{
-   const int vertices_in = 3;
-   const vec4 red = vec4(1, 0, 0, 1);
-   const vec4 green = vec4(0, 1, 0, 1);
-   vert_color = green;
-   for (int i = 0; i < vertices_in; ++i)
-   if ({self.interface_tes_instance}{self.tes_var_ref} != 
reference[{self.tes_reference_index}].v)
-   vert_color = red;
-   vec2[3] position = vec2[3](
-   vec2(float(gl_PrimitiveID / 2) - 1.0, float(gl_PrimitiveID % 2) 
- 1.0),
-   vec2(float(gl_PrimitiveID / 2) - 0.0, float(gl_PrimitiveID % 2) 
- 1.0),
-   vec2(float(gl_PrimitiveID / 2) - 1.0, float(gl_PrimitiveID % 2) 
- 0.0)
-   );
-   gl_Position = vec4(position[0]
-   + (position[1] - position[0]) * gl_TessCoord[0]
-   + (position[2] - position[0]) * gl_TessCoord[1], 0.0, 1.0);
+const int vertices_in = 3;
+const vec4 red = vec4(1, 0, 0, 1);
+const vec4 green = vec4(0, 1, 0, 1);
+vert_color = green;
+for (int i = 0; i < vertices_in; ++i)
+if ({self.interface_tes_instance}{self.tes_var_ref} != 
reference[{self.tes_reference_index}].v)
+vert_color = red;
+vec2[3] position = vec2[3](
+vec2(float(gl_PrimitiveID / 2) - 1.0, float(gl_PrimitiveID % 
2) - 1.0),
+vec2(float(gl_PrimitiveID / 2) - 0.0, float(gl_PrimitiveID % 
2) - 1.0),
+vec2(float(gl_PrimitiveID / 2) - 1.0, float(gl_PrimitiveID % 
2) - 0.0)
+);
+gl_Position = vec4(position[0]
++ (position[1] - position[0]) * gl_TessCoord[0]
++ (position[2] - position[0]) * gl_TessCoord[1], 0.0, 1.0);
 }}
 
 [fragment shader]
@@ -286,7 +286,7 @@ out vec4 frag_color;
 
 void main()
 {{
-   frag_color = vert_color;
+frag_color = vert_color;
 }}
 
 [test]
-- 
2.6.0

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


[Piglit] [RFC 11/25] gen_tcs_input_tests.py: Use a proper docstring

2015-10-07 Thread Dylan Baker
Signed-off-by: Dylan Baker 
---
 generated_tests/gen_tcs_input_tests.py | 26 ++
 1 file changed, 14 insertions(+), 12 deletions(-)

diff --git a/generated_tests/gen_tcs_input_tests.py 
b/generated_tests/gen_tcs_input_tests.py
index 883c5cc..ac56905 100644
--- a/generated_tests/gen_tcs_input_tests.py
+++ b/generated_tests/gen_tcs_input_tests.py
@@ -22,18 +22,20 @@
 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 # DEALINGS IN THE SOFTWARE.
 
-## Test passing variables from the vertex shader to the tessellation control
-# shader.
-#
-# For every varying type create one tests that passes a scalar of that type
-# and one test that passes a two element array.
-# Copy a uniform value to the varying in the vertex shader and compare the
-# varying to the same uniform in the tessellation control shader.
-# If the values are equal draw the screen green, red otherwise.
-#
-# Draw for tessellated quads. Each should cover one quarter of the screen.
-#
-# This script outputs, to stdout, the name of each file it generates.
+"""Test passing variables from the vertex shader to the tessellation control
+shader.
+
+For every varying type create one tests that passes a scalar of that type
+and one test that passes a two element array.
+Copy a uniform value to the varying in the vertex shader and compare the
+varying to the same uniform in the tessellation control shader.
+If the values are equal draw the screen green, red otherwise.
+
+Draw for tessellated quads. Each should cover one quarter of the screen.
+
+This script outputs, to stdout, the name of each file it generates.
+
+"""
 
 import os, sys, random
 
-- 
2.6.0

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


[Piglit] [RFC 04/25] gen_tes_input_tests.py: Cleanup imports

2015-10-07 Thread Dylan Baker
one import per line per PEP8, and use the __future__ imports to enforce
python 2.x and python 3.x compatibility.

Signed-off-by: Dylan Baker 
---
 generated_tests/gen_tes_input_tests.py | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/generated_tests/gen_tes_input_tests.py 
b/generated_tests/gen_tes_input_tests.py
index 3bd1787..110193a 100644
--- a/generated_tests/gen_tes_input_tests.py
+++ b/generated_tests/gen_tes_input_tests.py
@@ -40,7 +40,10 @@ This script outputs, to stdout, the name of each file it 
generates.
 
 """
 
-import os, sys, random
+from __future__ import print_function, absolute_import, division
+import os
+import sys
+import random
 
 
 class Test(object):
-- 
2.6.0

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


Re: [Piglit] [PATCH] glsl-es: Verify restrictions on global variable initializers

2015-10-07 Thread Mark Janes

Reviewed-by: Mark Janes 
Tested-by: Mark Janes 

Ian Romanick  writes:

> From: Ian Romanick 
>
> Section 4.3 (Storage Qualifiers) of the OpenGL ES 1.00.17 spec says:
>
> "Declarations of globals without a storage qualifier, or with just
> the const qualifier, may include initializers, in which case they
> will be initialized before the first line of main() is executed.
> Such initializers must be a constant expression."
>
> The GLSL ES 3.00.4 spec has similar language.  Desktop GLSL does not
> restrict initializers for global variables.  Now it's okay for Matt to
> be irritated.
>
> Signed-off-by: Ian Romanick 
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92304
> Cc: Tapani Pälli 
> Cc: Mark Janes 
> Cc: Marta Lofstedt 
> ---
>  .../global-initializer/from-attribute.vert | 14 +
>  .../compiler/global-initializer/from-constant.frag | 14 +
>  .../compiler/global-initializer/from-constant.vert | 14 +
>  .../compiler/global-initializer/from-global.frag   | 14 +
>  .../compiler/global-initializer/from-global.vert   | 14 +
>  .../compiler/global-initializer/from-sequence.frag | 14 +
>  .../compiler/global-initializer/from-sequence.vert | 14 +
>  .../compiler/global-initializer/from-uniform.frag  | 14 +
>  .../compiler/global-initializer/from-uniform.vert  | 14 +
>  .../compiler/global-initializer/from-varying.frag  | 14 +
>  .../global-initializer/from-attribute.vert | 26 
>  .../compiler/global-initializer/from-constant.frag | 28 +
>  .../compiler/global-initializer/from-constant.vert | 26 
>  .../compiler/global-initializer/from-global.frag   | 28 +
>  .../compiler/global-initializer/from-global.vert   | 26 
>  .../compiler/global-initializer/from-sequence.frag | 31 +++
>  .../compiler/global-initializer/from-sequence.vert | 29 ++
>  .../compiler/global-initializer/from-uniform.frag  | 28 +
>  .../compiler/global-initializer/from-uniform.vert  | 26 
>  .../compiler/global-initializer/from-varying.frag  | 28 +
>  .../compiler/global-initializer/from-constant.frag | 28 +
>  .../compiler/global-initializer/from-constant.vert | 25 
>  .../compiler/global-initializer/from-global.frag   | 28 +
>  .../compiler/global-initializer/from-global.vert   | 25 
>  .../compiler/global-initializer/from-in.frag   | 28 +
>  .../compiler/global-initializer/from-in.vert   | 25 
>  .../compiler/global-initializer/from-sequence.frag | 35 
> ++
>  .../compiler/global-initializer/from-sequence.vert | 32 
>  .../compiler/global-initializer/from-uniform.frag  | 28 +
>  .../compiler/global-initializer/from-uniform.vert  | 25 
>  30 files changed, 695 insertions(+)
>  create mode 100644 
> tests/spec/glsl-1.10/compiler/global-initializer/from-attribute.vert
>  create mode 100644 
> tests/spec/glsl-1.10/compiler/global-initializer/from-constant.frag
>  create mode 100644 
> tests/spec/glsl-1.10/compiler/global-initializer/from-constant.vert
>  create mode 100644 
> tests/spec/glsl-1.10/compiler/global-initializer/from-global.frag
>  create mode 100644 
> tests/spec/glsl-1.10/compiler/global-initializer/from-global.vert
>  create mode 100644 
> tests/spec/glsl-1.10/compiler/global-initializer/from-sequence.frag
>  create mode 100644 
> tests/spec/glsl-1.10/compiler/global-initializer/from-sequence.vert
>  create mode 100644 
> tests/spec/glsl-1.10/compiler/global-initializer/from-uniform.frag
>  create mode 100644 
> tests/spec/glsl-1.10/compiler/global-initializer/from-uniform.vert
>  create mode 100644 
> tests/spec/glsl-1.10/compiler/global-initializer/from-varying.frag
>  create mode 100644 
> tests/spec/glsl-es-1.00/compiler/global-initializer/from-attribute.vert
>  create mode 100644 
> tests/spec/glsl-es-1.00/compiler/global-initializer/from-constant.frag
>  create mode 100644 
> tests/spec/glsl-es-1.00/compiler/global-initializer/from-constant.vert
>  create mode 100644 
> tests/spec/glsl-es-1.00/compiler/global-initializer/from-global.frag
>  create mode 100644 
> tests/spec/glsl-es-1.00/compiler/global-initializer/from-global.vert
>  create mode 100644 
> tests/spec/glsl-es-1.00/compiler/global-initializer/from-sequence.frag
>  create mode 100644 
> tests/spec/glsl-es-1.00/compiler/global-initializer/from-sequence.vert
>  create mode 100644 
> tests/spec/glsl-es-1.00/compiler/global-initializer/from-uniform.frag
>  create mode 100644 
> tests/spec/glsl-es-1.00/compiler/global-initializer/from-uniform.vert
>  create mode 100644 
> tests/spec/glsl-es-1.00/compiler/global-initializer/from-varying.frag
>  create mode 100644 
> tests/spec/glsl-es-3.00/compiler/global-initializer/fro

Re: [Piglit] [PATCH] arb_direct_state_access/create-textures: also check invalid zero target

2015-10-07 Thread Anuj Phogat
On Oct 5, 2015 10:23 AM, "Brian Paul"  wrote:
>
> Check that glCreateTextures rejects target=0, per the spec.  Also, Mesa
> internally uses target=0 for a special state (texture gen'd but not bound)
> so it's good to test.
> ---
>  tests/spec/arb_direct_state_access/create-textures.c | 4 
>  1 file changed, 4 insertions(+)
>
> diff --git a/tests/spec/arb_direct_state_access/create-textures.c
b/tests/spec/arb_direct_state_access/create-textures.c
> index ca6d43c..5479844 100644
> --- a/tests/spec/arb_direct_state_access/create-textures.c
> +++ b/tests/spec/arb_direct_state_access/create-textures.c
> @@ -62,6 +62,10 @@ piglit_display(void)
> glCreateTextures(GL_PROXY_TEXTURE_2D, 1, &name);
> pass = piglit_check_gl_error(GL_INVALID_ENUM) && pass;
>
> +   /* Invalid zero target */
> +   glCreateTextures(0, 1, &name);
> +   pass = piglit_check_gl_error(GL_INVALID_ENUM) && pass;
> +
> /* n is negative */
> glCreateTextures(GL_TEXTURE_2D, -1, &name);
> pass = piglit_check_gl_error(GL_INVALID_VALUE) && pass;
> --
> 1.9.1
>
> ___
> Piglit mailing list
> Piglit@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit

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


Re: [Piglit] [PATCH] oes_compressed_paletted_texture: fix BindTexture() parameter

2015-10-07 Thread Anuj Phogat
On Oct 5, 2015 4:23 PM, "Nanley Chery"  wrote:
>
> From: Nanley Chery 
>
> The second parameter to glBindTexture should accept a texture
> handle, not the address of one.
>
> Cc: Ian Romanick 
> Signed-off-by: Nanley Chery 
> ---
>  .../oes_compressed_paletted_texture-api.c
 | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git
a/tests/spec/oes_compressed_paletted_texture/oes_compressed_paletted_texture-api.c
b/tests/spec/oes_compressed_paletted_texture/oes_compressed_paletted_texture-api.c
> index 1560198..48780ed 100644
> ---
a/tests/spec/oes_compressed_paletted_texture/oes_compressed_paletted_texture-api.c
> +++
b/tests/spec/oes_compressed_paletted_texture/oes_compressed_paletted_texture-api.c
> @@ -71,7 +71,7 @@ piglit_init(int argc, char **argv)
> piglit_require_extension("GL_OES_compressed_paletted_texture");
>
> glGenTextures(1, &tex);
> -   glBindTexture(GL_TEXTURE_2D, &tex);
> +   glBindTexture(GL_TEXTURE_2D, tex);
>
> /* The OES_compressed_paletted_texture spec says:
>  *
> --
>
> This (visibly) small error managed to slip by.
>
> 2.6.0
>
> ___
> Piglit mailing list
> Piglit@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit

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


Re: [Piglit] [PATCH v2] clipflat: Fix subtest reporting

2015-10-07 Thread Dylan Baker
On Tue, Oct 06, 2015 at 05:13:03PM -0600, Brian Paul wrote:
> Looks great.
> Reviewed-by: Brian Paul 
> 

Thanks Brian.


signature.asc
Description: PGP signature
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH v1] Removed the two sided stencil extension Glean test.

2015-10-07 Thread Brian Paul

On 10/07/2015 08:48 AM, Brian Paul wrote:

On 10/06/2015 11:05 PM, Juliet Fru wrote:

Hi Brian,

I am currently porting the tglsl1.cpp Glean test to Piglit. I will be
sending in the patch soon.


Note that most of the things tested by tglsl1.cpp are already tested by
other piglit shader tests.  We should take a look at each test case and
see if there's a comparable piglit test, then create new piglit tests
only for whatever might be missing.  I have a feeling it'll only be a
few tests.

In most cases, we should be able to write shader_runner test scripts.
I'll take a look and make some recommendations...


OK, I just saw that you already ported the whole glean test.  I'll take 
a look.


-Biran


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


Re: [Piglit] [PATCH v1] Removed the two sided stencil extension Glean test.

2015-10-07 Thread Brian Paul

On 10/06/2015 11:05 PM, Juliet Fru wrote:

Hi Brian,

I am currently porting the tglsl1.cpp Glean test to Piglit. I will be
sending in the patch soon.


Note that most of the things tested by tglsl1.cpp are already tested by 
other piglit shader tests.  We should take a look at each test case and 
see if there's a comparable piglit test, then create new piglit tests 
only for whatever might be missing.  I have a feeling it'll only be a 
few tests.


In most cases, we should be able to write shader_runner test scripts.
I'll take a look and make some recommendations...

-Brian


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


[Piglit] [PATCH v1] Porting the OpenGL shading language from Glean to Piglit.

2015-10-07 Thread Juliet Fru
This test replaces the original tglsl1.cpp test
---
 tests/all.py|1 +
 tests/spec/gl-1.0/CMakeLists.gl.txt |1 +
 tests/spec/gl-1.0/shading-lang.c| 1939 +++
 3 files changed, 1941 insertions(+)
 create mode 100644 tests/spec/gl-1.0/shading-lang.c

diff --git a/tests/all.py b/tests/all.py
index fe088f5..6140320 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -999,6 +999,7 @@ with profile.group_manager(
 g(['gl-1.0-fpexceptions'])
 g(['gl-1.0-ortho-pos'])
 g(['gl-1.0-readpixsanity'])
+g(['gl-1.0-shading-lang'])
 g(['gl-1.0-logicop'])
 
 with profile.group_manager(
diff --git a/tests/spec/gl-1.0/CMakeLists.gl.txt 
b/tests/spec/gl-1.0/CMakeLists.gl.txt
index d04b835..28a1d42 100644
--- a/tests/spec/gl-1.0/CMakeLists.gl.txt
+++ b/tests/spec/gl-1.0/CMakeLists.gl.txt
@@ -26,6 +26,7 @@ piglit_add_executable (gl-1.0-polygon-line-aa 
polygon-line-aa.c)
 piglit_add_executable (gl-1.0-push-no-attribs push-no-attribs.c)
 piglit_add_executable (gl-1.0-readpixsanity readpix.c)
 piglit_add_executable (gl-1.0-rendermode-feedback rendermode-feedback.c)
+piglit_add_executable (gl-1.0-shading-lang shading-lang.c)
 piglit_add_executable (gl-1.0-swapbuffers-behavior swapbuffers-behavior.c)
 
 # vim: ft=cmake:
diff --git a/tests/spec/gl-1.0/shading-lang.c b/tests/spec/gl-1.0/shading-lang.c
new file mode 100644
index 000..5b8ed9a
--- /dev/null
+++ b/tests/spec/gl-1.0/shading-lang.c
@@ -0,0 +1,1939 @@
+/*
+ * BEGIN_COPYRIGHT -*- glean -*-
+ * 
+ * Copyright (C) 1999  Allen Akin   All Rights Reserved.
+ * Copyright (C) 2008  VMware, Inc.  All Rights Reserved.
+ * 
+ * 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 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 ALLEN AKIN 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.
+ * 
+ * END_COPYRIGHT
+ */
+
+/** @file shading-lang.c
+ *
+ * Test OpenGL shading language
+ *
+ * Authors:
+ * Brian Paul 
+ * Adapted to Piglit by Juliet Fru , October 
2015.
+ */
+
+#include "piglit-util-gl.h"
+
+#include 
+#include 
+#include 
+#include 
+
+
+PIGLIT_GL_TEST_CONFIG_BEGIN config.supports_gl_compat_version = 20;
+
+config.window_visual =
+   PIGLIT_GL_VISUAL_RGBA | PIGLIT_GL_VISUAL_DEPTH |
+   PIGLIT_GL_VISUAL_STENCIL;
+
+PIGLIT_GL_TEST_CONFIG_END
+#define GL_GLEXT_PROTOTYPES
+#define FLAG_NONE 0x0
+#define FLAG_LOOSE0x1  /* to indicate a looser tolerance test 
is needed */
+#define FLAG_ILLEGAL_SHADER   0x2  /* the shader test should not compile */
+#define FLAG_ILLEGAL_LINK 0x4  /* the shaders should not link */
+#define FLAG_VERSION_1_20 0x8  /* GLSL 1.20 test */
+#define FLAG_VERSION_1_30 0x10 /* GLSL 1.30 test */
+#define FLAG_WINDING_CW   0x20 /* clockwise-winding polygon */
+#define FLAG_VERTEX_TEXTURE   0x40
+#define FLAG_ARB_DRAW_BUFFERS 0x80
+#define DONT_CARE_Z -1.0
+#define NO_VERTEX_SHADER NULL
+#define NO_FRAGMENT_SHADER NULL
+#define PRIMARY_R 0.25
+#define PRIMARY_G 0.75
+#define PRIMARY_B 0.5
+#define PRIMARY_A 0.25
+#define SECONDARY_R 0.0
+#define SECONDARY_G 0.25
+#define SECONDARY_B 0.25
+#define SECONDARY_A 1.0
+#define AMBIENT { 0.2, 0.4, 0.6, 0.8 }
+#define LIGHT_DIFFUSE { 0.1, 0.3, 0.5, 0.7 }
+#define MAT_DIFFUSE { 0.1, 0.3, 0.5, 0.7 }
+#define DIFFUSE_PRODUCT { 0.01, 0.09, 0.25, 0.7 }  /* note alpha! */
+#define UNIFORM1 {1.0, 0.25, 0.75, 0.0 }   /* don't change! */
+#define PSIZE 3.0
+#define PSIZE_MIN 2.0
+#define PSIZE_MAX 8.0
+#define PSIZE_THRESH 1.5
+#define PSIZE_ATTEN0 4.0
+#define PSIZE_ATTEN1 5.0
+#define PSIZE_ATTEN2 6.0
+#define FOG_START 100.0
+#define FOG_END   200.0
+#define FOG_R 1.0
+#define FOG_G 0.5
+#define FOG_B 1.0
+#define FOG_A 0.0
+static const GLfloat PrimaryColor[4] = { PRIMARY_R, PRIMARY_G,
+   PRIMARY_B, PRIMARY_A
+};
+
+static const GLfloat SecondaryColor[4] = { SECONDARY_R, SECONDARY_G,
+   SECONDARY_B, SECONDARY_A
+};
+
+static const GLfloat Ambient[4] = AMBIENT;
+static const GLfloat MatDiffuse[4] = MAT_DIFFUSE;
+static const 

Re: [Piglit] [PATCH] arb_program_interface_query: rever linker test for querying varyings

2015-10-07 Thread Juha-Pekka Heikkila

Reviewed-by: Juha-Pekka Heikkila 


On 07.10.2015 09:34, Tapani Pälli wrote:

This reverts commit e68f387df54767c177fcbf9e2f0b44a98525eb2a.

This test is wrong. Varyings as GL_PROGRAM_INPUT should be in the
resource list only when using SSO, not in case of full shader programs
with multiple stages. I will write a separate test for that case.
---
  .../linker/query-varyings.shader_test  | 33 --
  1 file changed, 33 deletions(-)
  delete mode 100644 
tests/spec/arb_program_interface_query/linker/query-varyings.shader_test

diff --git 
a/tests/spec/arb_program_interface_query/linker/query-varyings.shader_test 
b/tests/spec/arb_program_interface_query/linker/query-varyings.shader_test
deleted file mode 100644
index 994ef54..000
--- a/tests/spec/arb_program_interface_query/linker/query-varyings.shader_test
+++ /dev/null
@@ -1,33 +0,0 @@
-# Tests that we can succesfully query properties of varyings
-# that have interface GL_PROGRAM_INPUT in fragment stage.
-#
-# This tests that possible optimization for packing variables
-# does not lose information about individual variables.
-#
-[require]
-GLSL >= 1.10
-GL_ARB_program_interface_query
-
-[vertex shader]
-#version 110
-varying float r, g, b;
-void main()
-{
-   r = 1.0;
-   g = 0.0;
-   b = 1.0;
-   gl_Position = vec4(0.0);
-}
-
-[fragment shader]
-#version 110
-varying float r, g, b;
-void main()
-{
-   gl_FragColor = vec4(r, g, b, 1.0);
-}
-
-[test]
-verify program_interface_query GL_PROGRAM_INPUT r GL_ARRAY_SIZE 1
-verify program_interface_query GL_PROGRAM_INPUT g GL_TYPE GL_FLOAT
-verify program_interface_query GL_PROGRAM_INPUT b 
GL_REFERENCED_BY_FRAGMENT_SHADER 1



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