Re: [Piglit] [PATCH] arb_draw_indirect: test when 0 bound to DRAW_INDIRECT_BUFFER in compat

2018-06-25 Thread Ian Romanick
Assuming this passes on closed-source drivers that support the feature,

Reviewed-by: Ian Romanick 

On 06/23/2018 12:06 AM, Timothy Arceri wrote:
> From the ARB_draw_indirect spec:
> 
> "Initially zero is bound to DRAW_INDIRECT_BUFFER. In the
> compatibility profile, this indicates that DrawArraysIndirect and
> DrawElementsIndirect are to source their arguments directly from the
> pointer passed as their  parameters."
> ---
>  tests/opengl.py   |   2 +
>  .../spec/arb_draw_indirect/CMakeLists.gl.txt  |   2 +
>  .../arb_draw_indirect/draw-arrays-compat.c| 120 
>  .../arb_draw_indirect/draw-elements-compat.c  | 130 ++
>  4 files changed, 254 insertions(+)
>  create mode 100644 tests/spec/arb_draw_indirect/draw-arrays-compat.c
>  create mode 100644 tests/spec/arb_draw_indirect/draw-elements-compat.c
> 
> diff --git a/tests/opengl.py b/tests/opengl.py
> index 669d9055b..2460b0a88 100644
> --- a/tests/opengl.py
> +++ b/tests/opengl.py
> @@ -1728,8 +1728,10 @@ with profile.test_list.group_manager(
>  grouptools.join('spec', 'ARB_draw_indirect')) as g:
>  g(['arb_draw_indirect-api-errors'])
>  g(['arb_draw_indirect-draw-arrays'])
> +g(['arb_draw_indirect-draw-arrays-compat'])
>  g(['arb_draw_indirect-draw-arrays-prim-restart'])
>  g(['arb_draw_indirect-draw-elements'])
> +g(['arb_draw_indirect-draw-elements-compat'])
>  g(['arb_draw_indirect-draw-arrays-base-instance'])
>  g(['arb_draw_indirect-draw-elements-base-instance'])
>  g(['arb_draw_indirect-draw-elements-prim-restart'])
> diff --git a/tests/spec/arb_draw_indirect/CMakeLists.gl.txt 
> b/tests/spec/arb_draw_indirect/CMakeLists.gl.txt
> index 977911140..6e038d403 100644
> --- a/tests/spec/arb_draw_indirect/CMakeLists.gl.txt
> +++ b/tests/spec/arb_draw_indirect/CMakeLists.gl.txt
> @@ -10,8 +10,10 @@ link_libraries (
>  
>  piglit_add_executable (arb_draw_indirect-api-errors api-errors.c)
>  piglit_add_executable (arb_draw_indirect-draw-arrays draw-arrays.c)
> +piglit_add_executable (arb_draw_indirect-draw-arrays-compat 
> draw-arrays-compat.c)
>  piglit_add_executable (arb_draw_indirect-draw-arrays-prim-restart 
> draw-arrays-prim-restart.c)
>  piglit_add_executable (arb_draw_indirect-draw-elements draw-elements.c)
> +piglit_add_executable (arb_draw_indirect-draw-elements-compat 
> draw-elements-compat.c)
>  piglit_add_executable (arb_draw_indirect-draw-arrays-base-instance 
> draw-arrays-base-instance.c)
>  piglit_add_executable (arb_draw_indirect-draw-elements-base-instance 
> draw-elements-base-instance.c)
>  piglit_add_executable (arb_draw_indirect-draw-elements-prim-restart 
> draw-elements-prim-restart.c)
> diff --git a/tests/spec/arb_draw_indirect/draw-arrays-compat.c 
> b/tests/spec/arb_draw_indirect/draw-arrays-compat.c
> new file mode 100644
> index 0..fd906fe2f
> --- /dev/null
> +++ b/tests/spec/arb_draw_indirect/draw-arrays-compat.c
> @@ -0,0 +1,120 @@
> +/*
> + * Copyright © 2013 Intel Corporation
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining a
> + * copy of this software and associated documentation files (the "Software"),
> + * to deal in the Software without restriction, including without limitation
> + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
> + * and/or sell copies of the Software, and to permit persons to whom the
> + * Software is furnished to do so, subject to the following conditions:
> + *
> + * The above copyright notice and this permission notice (including the next
> + * paragraph) shall be included in all copies or substantial portions of the
> + * Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
> + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
> DEALINGS
> + * IN THE SOFTWARE.
> + *
> + */
> +
> +/* Basic test of glDrawArraysIndirect for compat profile. Test that indirect
> + * data can be passed directly when GL_DRAW_INDIRECT_BUFFER is 0 (the default
> + * value).
> + *
> + * This test is adapted from draw-arrays.c
> + */
> +
> +#include "piglit-util-gl.h"
> +
> +PIGLIT_GL_TEST_CONFIG_BEGIN
> +
> + config.supports_gl_compat_version = 31;
> +
> + config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGB;
> + config.khr_no_error_support = PIGLIT_NO_ERRORS;
> +
> +PIGLIT_GL_TEST_CONFIG_END
> +
> +GLuint vao;
> +GLint prog;
> +
> +float red[] = {1,0,0};
> +float blue[] = {0,0,1};
> +
> +float vertices_data[] = {
> + -1, -1,
> +  1, -1,
> + -1,  1,
> +};
> +
> +GLuint indirect_data[] = {
> + 3,  /* c

Re: [Piglit] [PATCH v4] unsized_array_member: It should expect link success instead of link error

2018-06-25 Thread Ian Romanick
On 06/25/2018 08:57 AM, Dylan Baker wrote:
> Quoting Eleni Maria Stea (2018-06-23 01:43:52)
>> Modified the unsized_array_member.shader_test to expect successful
>> linking instead of linker error.
>>
>> Section 4.2 (Scoping) of the OpenGL Shading Language Specification says:
>> "An array implicitly sized in one shader can be explicitly sized by
>> another shader in the same stage. If no shader in a stage has an explicit
>> size for the array, the largest implicit size (one more than the largest
>> index used) in that stage is used. There is no cross-stage array sizing.
>> If there is no static access to an implicitly sized array within the stage
>> declaring it, then the array is given a size of 1, which is relevant when
>> the array is declared within an interface block that is shared with other
>> stages or the application (other unused arrays might be eliminated by the
>> optimizer)."
>>
>> This means that the unused array s of the following shader block in the
>> unsized_array_member.shader_test:
>> buffer a {
>> vec4 s[];
>> vec4 a[];
>> } b;
>> should be an array of size 1 and not an unsized array, and so no linker
>> error should be generated.
>>
>> Ref: https://bugs.freedesktop.org/show_bug.cgi?id=106915
>>
>> v2:
>>   - replaces the comment at the top with the relevant part of the spec
>> v3:
>>   - fixes in the quoted part of the spec (Ian Romanick)
>> v4:
>>   - updates the commit message accordingly (Dylan Baker)
>> ---
>>  .../linker/unsized_array_member.shader_test   | 20 ++-
>>  1 file changed, 11 insertions(+), 9 deletions(-)
>>
>> diff --git 
>> a/tests/spec/arb_shader_storage_buffer_object/linker/unsized_array_member.shader_test
>>  
>> b/tests/spec/arb_shader_storage_buffer_object/linker/unsized_array_member.shader_test
>> index 47d0483ac..946bf1cb2 100644
>> --- 
>> a/tests/spec/arb_shader_storage_buffer_object/linker/unsized_array_member.shader_test
>> +++ 
>> b/tests/spec/arb_shader_storage_buffer_object/linker/unsized_array_member.shader_test
>> @@ -1,12 +1,14 @@
>> -# From ARB_program_interface_query spec:
>> +# Section 4.2 (Scoping) of the OpenGL Shading Language Specification says:
>>  #
>> -#"For the property of BUFFER_DATA_SIZE, then the 
>> implementation-dependent
>> -#minimum total buffer object size, in basic machine units, required to
>> -#hold all active variables associated with an active uniform block, 
>> shader
>> -#storage block, or atomic counter buffer is written to .  If the
>> -#final member of an active shader storage block is array with no 
>> declared
>> -#size, the minimum buffer size is computed assuming the array was 
>> declared
>> -#as an array with one element."
>> +#"An array implicitly sized in one shader can be explicitly sized by
>> +#another shader in the same stage. If no shader in a stage has an
>> +#explicit size for the array, the largest implicit size (one more than
>> +#the largest index used) in that stage is used. There is no cross-stage
>> +#array sizing. If there is no static access to an implicitly sized array
>> +#within the stage declaring it, then the array is given a size of 1,
>> +#which is relevant when the array is declared within an interface block
>> +#that is shared with other stages or the application (other unused 
>> arrays
>> +#might be eliminated by the optimizer)."
>>  
>>  [require]
>>  GLSL >= 1.50
>> @@ -31,4 +33,4 @@ void main(void) {
>>  }
>>  
>>  [test]
>> -link error
>> +link success
>> -- 
>> 2.17.1
>>
> 
> This looks good to me, Ian?

Not until we get clarity on the issue from Khronos.  I'll update the bug
as soon as I know anything.  Hopefully I can bring it up in the meeting
this week.

> Dylan



signature.asc
Description: OpenPGP digital signature
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 0/6] Fix missing binaries in opengl.py

2018-06-25 Thread Ian Romanick
I think a bunch of those were rebase errors. :(  I'm pretty sure patch 4
fixes a rebase error of mine.

Series is

Reviewed-by: Ian Romanick 

On 06/25/2018 04:24 PM, Dylan Baker wrote:
> This is a few patches to fix a number of binaries that were removed, renamed, 
> or
> never existed.
> 
> Dylan Baker (6):
>   tests/opengl.py: Fix misnamed test binary
>   tests/opengl.py: re-remove layout-std140 test
>   tests/opengl.py: Fix name of gl-4.3 test
>   tests/opengl.py: fix ext_shader_samples_indentical tests
>   tests/opengl.py: remove ext_transform-get-buffer-size
>   tests: Add cmake for oes_texture_compression_astc with Desktop GL
> 
>  tests/opengl.py| 14 +-
>  .../oes_texture_compression_astc/CMakeLists.gl.txt |  4 
>  2 files changed, 9 insertions(+), 9 deletions(-)
>  create mode 100644 tests/spec/oes_texture_compression_astc/CMakeLists.gl.txt
> 

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


[Piglit] [PATCH 3/7] unittests/wflinfo: Update tests for new API

2018-06-25 Thread Dylan Baker
---
 unittests/framework/test_wflinfo.py | 118 +---
 1 file changed, 35 insertions(+), 83 deletions(-)

diff --git a/unittests/framework/test_wflinfo.py 
b/unittests/framework/test_wflinfo.py
index fcff30034..bd2d936cc 100644
--- a/unittests/framework/test_wflinfo.py
+++ b/unittests/framework/test_wflinfo.py
@@ -74,8 +74,8 @@ class TestWflInfo(object):
 """Setup each instance, patching necissary bits."""
 self._test = wflinfo.WflInfo()
 
-def test_gl_extension(self):
-"""wflinfo.WflInfo.gl_extensions: Provides list of gl
+def test_extension(self):
+"""wflinfo.WflInfo..extensions: Provides list of gl
 extensions.
 """
 rv = textwrap.dedent("""\
@@ -90,10 +90,10 @@ class TestWflInfo(object):
 
 with mock.patch('framework.wflinfo.subprocess.check_output',
 mock.Mock(return_value=rv)):
-assert self._test.gl_extensions == expected
+assert self._test.compat.extensions == expected
 
-def test_gl_version(self):
-"""wflinfo.WflInfo.gl_version: Provides a version number."""
+def test_api_version(self):
+"""wflinfo.WflInfo..api_version: Provides a version number."""
 rv = textwrap.dedent("""\
 Waffle platform: gbm
 Waffle api: gl
@@ -102,14 +102,17 @@ class TestWflInfo(object):
 OpenGL context flags: 0x0
 OpenGL shading language: 1.1
 OpenGL extensions: GL_foobar GL_ham_sandwhich
-OpenGL version string: 18 (Core Profile) Mesa 11.0.4
+OpenGL version string: 18 (Compat Profile) Mesa 11.0.4
 """).encode('utf-8')
 with mock.patch('framework.wflinfo.subprocess.check_output',
 mock.Mock(return_value=rv)):
-assert self._test.gl_version == 18.0
+assert self._test.compat.api_version == 18.0
 
-def test_gles_version(self):
-"""wflinfo.WflInfo.gles_version: Provides a version number."""
+def test_api_version_gles(self):
+"""wflinfo.WflInfo..api_version: Provides a version number.
+
+The format for GLES is different than for Desktop GL.
+"""
 rv = textwrap.dedent("""\
 Waffle platform: gbm
 Waffle api: gles3
@@ -121,10 +124,10 @@ class TestWflInfo(object):
 """).encode('utf-8')
 with mock.patch('framework.wflinfo.subprocess.check_output',
 mock.Mock(return_value=rv)):
-assert self._test.gles_version == 7.1
+assert self._test.es2.api_version == 7.1
 
 def test_glsl_version(self):
-"""wflinfo.WflInfo.glsl_version: Provides a version number."""
+"""wflinfo.WflInfo..shader_version: Provides a version 
number."""
 rv = textwrap.dedent("""\
 Waffle platform: gbm
 Waffle api: gl
@@ -137,10 +140,10 @@ class TestWflInfo(object):
 """).encode('utf-8')
 with mock.patch('framework.wflinfo.subprocess.check_output',
 mock.Mock(return_value=rv)):
-assert self._test.glsl_version == 9.3
+assert self._test.core.shader_version == 9.3
 
-def test_glsl_es_version_1(self):
-"""wflinfo.WflInfo.glsl_es_version: works with gles2."""
+def test_glsl_es_version(self):
+"""wflinfo.WflInfo..shader_version: works with gles2."""
 rv = textwrap.dedent("""\
 Waffle platform: gbm
 Waffle api: gles2
@@ -153,25 +156,10 @@ class TestWflInfo(object):
 """).encode('utf-8')
 with mock.patch('framework.wflinfo.subprocess.check_output',
 mock.Mock(return_value=rv)):
-assert self._test.glsl_es_version == 1.0
-
-def test_glsl_es_version_3plus(self):
-"""wflinfo.WflInfo.glsl_es_version: works with gles3."""
-rv = textwrap.dedent("""\
-Waffle platform: gbm
-Waffle api: gles3
-OpenGL vendor string: Intel Open Source Technology Center
-OpenGL renderer string: Mesa DRI Intel(R) Haswell Mobile
-OpenGL version string: OpenGL ES 3.0 Mesa 11.0.4
-OpenGL shading language version string: OpenGL ES GLSL ES 5.00
-OpenGL extensions: this is some extension strings.
-""").encode('utf-8')
-with mock.patch('framework.wflinfo.subprocess.check_output',
-mock.Mock(return_value=rv)):
-assert self._test.glsl_es_version == 5.0
+assert self._test.es2.shader_version == 1.0
 
 def test_gl_version_patch(self):
-"""wflinfo.WflIn

[Piglit] [PATCH 0/7] Rework fast skipping to handle compat profile

2018-06-25 Thread Dylan Baker
This series makes reworks the way that fast skipping works in piglit to be
somewhat simpler and better suited for handling compat profile.

The biggest change is that piglit now treats GLES 1, GLES 2+, OpenGL Core
Profile, and OpenGL Compat and "legacy" pre-profile OpenGL as separate things.
This allows us to have finer grained support for skipping. This allows i965
(which doesn't support compat) to skip some things in advance that it can't run.

Dylan Baker (7):
  framework/test: Fix whitespace
  wflinfo: Reimplement wflinfo separating the various API's
  unittests/wflinfo: Update tests for new API
  framework/test: Convert tests to new fast-skip interface
  serializer: serialize new fast-skip attributes
  framework/shader_test: GL_NUM_PROGRAM_BINARY_FORMATS >= 1 is not an
extension
  framework/wflinfo: delete deprecated interface

 framework/test/glsl_parser_test.py|  54 ++--
 framework/test/opengl.py  | 185 ---
 framework/test/piglit_test.py |   1 +
 framework/test/shader_test.py |  74 ++---
 framework/wflinfo.py  | 293 +-
 tests/serializer.py   |  25 +-
 .../framework/test/test_glsl_parser_test.py   |  47 ++-
 unittests/framework/test/test_opengl.py   | 172 +-
 unittests/framework/test/test_shader_test.py  |  24 +-
 unittests/framework/test_wflinfo.py   | 139 -
 10 files changed, 482 insertions(+), 532 deletions(-)

-- 
2.17.1

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


[Piglit] [PATCH 4/7] framework/test: Convert tests to new fast-skip interface

2018-06-25 Thread Dylan Baker
This converts the two test types that use the fast-skipping mechanism
(glsl parser and shader) to use the new interfaces. This has been
verified by running with PIGLIT_NO_FAST_SKIP=1 and without, and sans 1
test (that is fixed later in the series) the results are the same.
---
 framework/test/glsl_parser_test.py|  54 +++--
 framework/test/opengl.py  | 185 +++---
 framework/test/shader_test.py |  70 +++
 .../framework/test/test_glsl_parser_test.py   |  47 +++--
 unittests/framework/test/test_opengl.py   | 172 
 unittests/framework/test/test_shader_test.py  |  24 +--
 6 files changed, 263 insertions(+), 289 deletions(-)

diff --git a/framework/test/glsl_parser_test.py 
b/framework/test/glsl_parser_test.py
index 21879739c..1cce65036 100644
--- a/framework/test/glsl_parser_test.py
+++ b/framework/test/glsl_parser_test.py
@@ -95,9 +95,9 @@ class Parser(object):
 def __init__(self, filepath, installpath=None):
 # a set that stores a list of keys that have been found already
 self.__found_keys = set()
-self.gl_required = set()
-self.glsl_es_version = None
-self.glsl_version = None
+self.api = None
+self.extensions = set()
+self.shader_version = None
 abs_filepath = os.path.join(ROOT_DIR, filepath)
 
 try:
@@ -115,29 +115,39 @@ class Parser(object):
 """Set OpenGL and OpenGL ES fast skipping conditions."""
 glsl = self.config['glsl_version']
 if _is_gles_version(glsl):
-self.glsl_es_version = float(glsl[:3])
+self.shader_version = float(glsl[:3])
+if self.shader_version >= 3.0:
+self.api = 'gles3'
+else:
+self.api = 'gles2'
 elif glsl.endswith('compatibility'):
-self.glsl_version = float(glsl[:3])
+self.shader_version = float(glsl[:3])
+self.api = 'compat'
 else:
-self.glsl_version = float(glsl)
+self.shader_version = float(glsl)
+self.api = 'core'
 
 req = self.config['require_extensions']
-self.gl_required = set(r for r in req.split() if not r.startswith('!'))
+self.extensions = set(r for r in req.split() if not r.startswith('!'))
+
+if self.api != 'compat' and 'GL_ARB_compatibility' in self.extensions:
+assert self.api == 'core', 'arb_compat with gles?'
+self.api = 'compat'
 
 # If GLES is requested, but piglit was not built with a gles version,
 # then ARB_ES3_compatibility is required. Add it to
-# self.gl_required
-if self.glsl_es_version and _FORCE_DESKTOP_VERSION:
-if self.glsl_es_version == 1.0:
+# self.extensions
+if self.api.startswith('gles') and _FORCE_DESKTOP_VERSION:
+if self.shader_version == 1.0:
 ver = '2'
-elif self.glsl_es_version == 3.0:
+elif self.shader_version == 3.0:
 ver = '3'
-elif self.glsl_es_version == 3.1:
+elif self.shader_version == 3.1:
 ver = '3_1'
-elif self.glsl_es_version == 3.2:
+elif self.shader_version == 3.2:
 ver = '3_2'
 ext = 'ARB_ES{}_compatibility'.format(ver)
-self.gl_required.add(ext)
+self.extensions.add(ext)
 self.command.append(ext)
 
 @staticmethod
@@ -274,11 +284,13 @@ class GLSLParserTest(FastSkipMixin, PiglitBaseTest):
 .tesc, .tese, .geom or .frag
 """
 
-def __init__(self, command, gl_required=set(), glsl_version=None,
- glsl_es_version=None, **kwargs):
+def __init__(self, command, api=None, extensions=set(),
+ shader_version=None, **kwargs):
 super(GLSLParserTest, self).__init__(
-command, run_concurrent=True, gl_required=gl_required,
-glsl_version=glsl_version, glsl_es_version=glsl_es_version)
+command, run_concurrent=True,
+api=api,
+extensions=extensions,
+shader_version=shader_version)
 
 @PiglitBaseTest.command.getter
 def command(self):
@@ -298,9 +310,9 @@ class GLSLParserTest(FastSkipMixin, PiglitBaseTest):
 parsed = Parser(filepath, installpath)
 return cls(
 parsed.command,
-gl_required=parsed.gl_required,
-glsl_version=parsed.glsl_version,
-glsl_es_version=parsed.glsl_es_version)
+api=parsed.api,
+extensions=parsed.extensions,
+shader_version=parsed.shader_version)
 
 def is_skip(self):
 if os.path.basename(self.command[0]) == 'glslparsertest' and not 
_HAS_GL_BIN:
diff --git a/framework/test/opengl.py b/framework/test/opengl.py
index 4941d8ce8..3c8460e28 100644
--- a/framework/test/opengl.py
+++ b/framework/test/opengl.py
@@ -5

[Piglit] [PATCH 1/7] framework/test: Fix whitespace

2018-06-25 Thread Dylan Baker
---
 framework/test/piglit_test.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/framework/test/piglit_test.py b/framework/test/piglit_test.py
index 6511e0f53..f52915d18 100644
--- a/framework/test/piglit_test.py
+++ b/framework/test/piglit_test.py
@@ -205,6 +205,7 @@ class BuiltInConstantsTest(PiglitBaseTest):
 command[1] = os.path.join(ROOT_DIR, 'tests', command[1])
 return command
 
+
 class PiglitCLTest(PiglitBaseTest):  # pylint: disable=too-few-public-methods
 """ OpenCL specific Test class.
 
-- 
2.17.1

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


[Piglit] [PATCH 5/7] serializer: serialize new fast-skip attributes

2018-06-25 Thread Dylan Baker
---
 tests/serializer.py | 25 ++---
 1 file changed, 10 insertions(+), 15 deletions(-)

diff --git a/tests/serializer.py b/tests/serializer.py
index 32beb428c..998a72a86 100644
--- a/tests/serializer.py
+++ b/tests/serializer.py
@@ -54,21 +54,16 @@ def parser():
 
 
 def _serialize_skips(test, elem):
-if getattr(test, 'gl_required', None):
-et.SubElement(elem, 'option', name='gl_required',
-  value=repr(test.gl_required))
-if getattr(test, 'gl_version', None):
-et.SubElement(elem, 'option', name='gl_version',
-  value=repr(test.gl_version))
-if getattr(test, 'gles_version', None):
-et.SubElement(elem, 'option', name='gles_version',
-  value=repr(test.gles_version))
-if getattr(test, 'glsl_version', None):
-et.SubElement(elem, 'option', name='glsl_version',
-  value=repr(test.glsl_version))
-if getattr(test, 'glsl_es_version', None):
-et.SubElement(elem, 'option', name='glsl_es_version',
-  value=repr(test.glsl_es_version))
+elems = [
+('require_shader', 'shader_version'),
+('require_api', 'api'),
+('require_version', 'api_version'),
+('require_extensions', 'extensions'),
+]
+for e, f in elems:
+value = getattr(test, e, None)
+if value:
+et.SubElement(elem, 'option', name=f, value=repr(value))
 
 
 def serializer(name, profile, outfile):
-- 
2.17.1

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


[Piglit] [PATCH 7/7] framework/wflinfo: delete deprecated interface

2018-06-25 Thread Dylan Baker
This is the old interface which is now not depended on by any tests.
---
 framework/wflinfo.py | 33 -
 1 file changed, 33 deletions(-)

diff --git a/framework/wflinfo.py b/framework/wflinfo.py
index d3a79437d..a568bc344 100644
--- a/framework/wflinfo.py
+++ b/framework/wflinfo.py
@@ -299,36 +299,3 @@ class WflInfo(object):
 @lazy_property
 def es3(self):
 return self.es2
-
-@property
-def gles_version(self):
-v = max([self.es1.api_version, self.es2.api_version])
-if v == 0.0:
-return None
-return v
-
-@property
-def gl_version(self):
-v = max([self.core.api_version, self.compat.api_version])
-if v == 0.0:
-return None
-return v
-
-@property
-def glsl_version(self):
-v = max([self.core.shader_version, self.compat.shader_version])
-if v == 0.0:
-return None
-return v
-
-@property
-def glsl_es_version(self):
-v = max([self.es1.shader_version, self.es2.shader_version])
-if v == 0.0:
-return None
-return v
-
-@property
-def gl_extensions(self):
-return set.union(self.es1.extensions, self.es2.extensions,
- self.core.extensions, self.compat.extensions)
-- 
2.17.1

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


[Piglit] [PATCH 6/7] framework/shader_test: GL_NUM_PROGRAM_BINARY_FORMATS >= 1 is not an extension

2018-06-25 Thread Dylan Baker
So don't treat it like one. Stops one test from being fast-skipped that
shouldn't be.
---
 framework/test/shader_test.py | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/framework/test/shader_test.py b/framework/test/shader_test.py
index 3d3cf2e06..863f3e79d 100644
--- a/framework/test/shader_test.py
+++ b/framework/test/shader_test.py
@@ -84,8 +84,10 @@ class Parser(object):
 "In file {}: Config block not found".format(self.filename))
 
 for line in lines:
-if line.startswith('GL_') and not line.startswith('GL_MAX'):
-self.extensions.add(line.strip())
+if line.startswith('GL_'):
+line = line.strip()
+if not (line.startswith('GL_MAX') or 
line.startswith('GL_NUM')):
+self.extensions.add(line)
 continue
 
 # Find any GLES requirements.
-- 
2.17.1

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


[Piglit] [PATCH 2/7] wflinfo: Reimplement wflinfo separating the various API's

2018-06-25 Thread Dylan Baker
Currently fast skipping is implemented such that it assumes there's a
single version of ES, a single version of desktop, and all extensions
are shared between them. This has basically worked because 1) there are
basically no gles1 tests, and 2) piglit didn't have compat profile. But
worked and correct are two different things.

With the addition of compat profiles it's time to re-evaluate how fast
skipping works. Namely we need to have different attributes for ES1,
ES1+, core, compat, and I've added on for "legacy" (pre-profile), since
waffle supports that.

This maintains legacy interfaces so that existing code continues to
work.
---
 framework/wflinfo.py| 320 
 unittests/framework/test_wflinfo.py |  23 +-
 2 files changed, 201 insertions(+), 142 deletions(-)

diff --git a/framework/wflinfo.py b/framework/wflinfo.py
index 8c7da084a..d3a79437d 100644
--- a/framework/wflinfo.py
+++ b/framework/wflinfo.py
@@ -25,12 +25,14 @@ import errno
 import os
 import subprocess
 import sys
+import threading
 
 import six
 
-from framework import exceptions, core
+from framework import exceptions
+from framework.core import lazy_property
 from framework.options import OPTIONS
-from framework.test import piglit_test
+# from framework.test import piglit_test
 
 
 class StopWflinfo(exceptions.PiglitException):
@@ -40,6 +42,15 @@ class StopWflinfo(exceptions.PiglitException):
 self.reason = reason
 
 
+class ProfileInfo(object):
+"""Information about a single profile (core, compat, es1, es2, etc)."""
+
+def __init__(self, shader_version, language_version, extensions):
+self.shader_version = shader_version
+self.api_version = language_version
+self.extensions = extensions
+
+
 class WflInfo(object):
 """Class representing platform information as provided by wflinfo.
 
@@ -56,6 +67,15 @@ class WflInfo(object):
 
 """
 __shared_state = {}
+__core_init = False
+__core_lock = threading.Lock()
+__compat_init = False
+__compat_lock = threading.Lock()
+__es1_init = False
+__es1_lock = threading.Lock()
+__es2_init = False
+__es2_lock = threading.Lock()
+
 def __new__(cls, *args, **kwargs):
 # Implement the borg pattern:
 # 
https://code.activestate.com/recipes/66531-singleton-we-dont-need-no-stinkin-singleton-the-bo/
@@ -94,9 +114,9 @@ class WflInfo(object):
 
 # setup execution environment where we extend the PATH env var
 # to include the piglit TEST_BIN_DIR
-new_env = os.environ
-new_env['PATH'] = ':'.join([piglit_test.TEST_BIN_DIR,
-os.environ['PATH']])
+new_env = os.environ.copy()
+# new_env['PATH'] = ':'.join([piglit_test.TEST_BIN_DIR,
+# os.environ['PATH']])
 
 raw = subprocess.check_output(cmd, env=new_env, stderr=d)
 
@@ -120,8 +140,79 @@ class WflInfo(object):
 return line
 raise Exception('Unreachable')
 
-@core.lazy_property
-def gl_extensions(self):
+def __get_shader_version(self, profile):
+"""Calculate the maximum OpenGL Shader Language version."""
+ret = 0.0
+if profile in ['core', 'compat', 'none']:
+try:
+raw = self.__call_wflinfo(
+['--verbose', '--api', 'gl', '--profile', profile])
+except StopWflinfo as e:
+if e.reason not in ['Called', 'OSError']:
+raise
+else:
+try:
+# GLSL versions are M.mm formatted
+line = self.__getline(raw.split('\n'), 'OpenGL shading 
language')
+ret = float(line.split(":")[1][:5])
+except (IndexError, ValueError):
+# This is caused by wflinfo returning an error
+pass
+elif profile in ['gles2', 'gles3']:
+try:
+raw = self.__call_wflinfo(['--verbose', '--api', profile])
+except StopWflinfo as e:
+if e.reason not in ['Called', 'OSError']:
+raise
+else:
+try:
+# GLSL ES version numbering is insane.
+# For version >= 3 the numbers are 3.00, 3.10, etc.
+# For version 2, they are 1.0.xx
+ret = float(self.__getline(
+raw.split('\n'),
+'OpenGL shading language').split()[-1][:3])
+except (IndexError, ValueError):
+# Handle wflinfo internal errors
+pass
+return ret
+
+def __get_language_version(self, profile):
+ret = 0.0
+if profile in ['core', 'compat', 'none']:
+try:
+raw = self.__call_wflinfo(['--api', 'gl', '--pr

[Piglit] [PATCH 0/6] Fix missing binaries in opengl.py

2018-06-25 Thread Dylan Baker
This is a few patches to fix a number of binaries that were removed, renamed, or
never existed.

Dylan Baker (6):
  tests/opengl.py: Fix misnamed test binary
  tests/opengl.py: re-remove layout-std140 test
  tests/opengl.py: Fix name of gl-4.3 test
  tests/opengl.py: fix ext_shader_samples_indentical tests
  tests/opengl.py: remove ext_transform-get-buffer-size
  tests: Add cmake for oes_texture_compression_astc with Desktop GL

 tests/opengl.py| 14 +-
 .../oes_texture_compression_astc/CMakeLists.gl.txt |  4 
 2 files changed, 9 insertions(+), 9 deletions(-)
 create mode 100644 tests/spec/oes_texture_compression_astc/CMakeLists.gl.txt

-- 
2.17.1

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


[Piglit] [PATCH 1/6] tests/opengl.py: Fix misnamed test binary

2018-06-25 Thread Dylan Baker
---
 tests/opengl.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tests/opengl.py b/tests/opengl.py
index 59d5d3e1f..92ad56a86 100644
--- a/tests/opengl.py
+++ b/tests/opengl.py
@@ -754,7 +754,7 @@ with profile.test_list.group_manager(
 g(['lodclamp-between'])
 g(['lodclamp-between-max'])
 g(['mipmap-setup'])
-g(['gl-1.2-rescale_normal'])
+g(['gl-1.2-rescale-normal'])
 g(['tex-skipped-unit'])
 g(['tex3d'])
 g(['tex3d-maxsize'], run_concurrent=False)
@@ -941,8 +941,8 @@ with profile.test_list.group_manager(
 g(['gl-3.1-genned-names'], 'genned-names')
 g(['gl-3.1-link-empty-prog-core'])
 g(['gl-3.1-minmax'], 'minmax')
-g(['gl-3-1-mixed-int-float-fbo'])
-g(['gl-3-1-mixed-int-float-fbo', 'int_second'])
+g(['gl-3.1-mixed-int-float-fbo'])
+g(['gl-3.1-mixed-int-float-fbo', 'int_second'])
 g(['gl-3.1-vao-broken-attrib'], 'vao-broken-attrib')
 g(['gl-3.0-required-renderbuffer-attachment-formats', '31'],
   'required-renderbuffer-attachment-formats')
-- 
2.17.1

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


[Piglit] [PATCH 2/6] tests/opengl.py: re-remove layout-std140 test

2018-06-25 Thread Dylan Baker
This was removed and then re-added (likely due to a rebase error).
---
 tests/opengl.py | 1 -
 1 file changed, 1 deletion(-)

diff --git a/tests/opengl.py b/tests/opengl.py
index 92ad56a86..cf7c048fb 100644
--- a/tests/opengl.py
+++ b/tests/opengl.py
@@ -3589,7 +3589,6 @@ with profile.test_list.group_manager(
   'getuniformblockindex')
 g(['arb_uniform_buffer_object-getuniformindices'], 'getuniformindices')
 g(['arb_uniform_buffer_object-getuniformlocation'], 'getuniformlocation')
-g(['arb_uniform_buffer_object-layout-std140'], 'layout-std140')
 g(['arb_uniform_buffer_object-layout-std140-base-size-and-alignment'],
   'layout-std140-base-size-and-alignment')
 g(['arb_uniform_buffer_object-link-mismatch-blocks'],
-- 
2.17.1

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


[Piglit] [PATCH 4/6] tests/opengl.py: fix ext_shader_samples_indentical tests

2018-06-25 Thread Dylan Baker
These are all wrong, the last line does nothing since there aren't
enough arguments and always skips, the loop doesn't work since it points
at a non-existent binary.
---
 tests/opengl.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/tests/opengl.py b/tests/opengl.py
index e12f84e27..8556c9f22 100644
--- a/tests/opengl.py
+++ b/tests/opengl.py
@@ -4746,8 +4746,7 @@ with profile.test_list.group_manager(
 PiglitGLTest,
 grouptools.join('spec', 'EXT_shader_samples_identical')) as g:
 for sample_count in MSAA_SAMPLE_COUNTS:
-g(['ext_shader_samples_identical', sample_count])
-g(['ext_shader_samples_identical-simple-fs'], 'simple-fs')
+g(['ext_shader_samples_identical-simple-fs', sample_count])
 
 # Group ARB_shader_draw_parameters
 with profile.test_list.group_manager(
-- 
2.17.1

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


[Piglit] [PATCH 3/6] tests/opengl.py: Fix name of gl-4.3 test

2018-06-25 Thread Dylan Baker
The binary name has been wrong since it's addition. Keep the test name
the same by adding an explicit test name, so that old results will still
compare correctly.
---
 tests/opengl.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/opengl.py b/tests/opengl.py
index cf7c048fb..e12f84e27 100644
--- a/tests/opengl.py
+++ b/tests/opengl.py
@@ -1065,7 +1065,7 @@ with profile.test_list.group_manager(
 with profile.test_list.group_manager(
 PiglitGLTest,
 grouptools.join('spec', '!opengl 4.3')) as g:
-g(['get_glsl_versions'])
+g(['gl-4.3-get_glsl_versions'], 'get_glsl_version')
 
 with profile.test_list.group_manager(
 PiglitGLTest,
-- 
2.17.1

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


[Piglit] [PATCH 6/6] tests: Add cmake for oes_texture_compression_astc with Desktop GL

2018-06-25 Thread Dylan Baker
This is a bit odd, there seems to be support in the test for running
with ARB_ES3_compatibility and there are entries in opengl.py for the GL
versions, but no cmake was added.
---
 tests/spec/oes_texture_compression_astc/CMakeLists.gl.txt | 4 
 1 file changed, 4 insertions(+)
 create mode 100644 tests/spec/oes_texture_compression_astc/CMakeLists.gl.txt

diff --git a/tests/spec/oes_texture_compression_astc/CMakeLists.gl.txt 
b/tests/spec/oes_texture_compression_astc/CMakeLists.gl.txt
new file mode 100644
index 0..eca1d5dbf
--- /dev/null
+++ b/tests/spec/oes_texture_compression_astc/CMakeLists.gl.txt
@@ -0,0 +1,4 @@
+link_libraries(piglitutil_${piglit_target_api})
+piglit_add_executable(oes_compressed_astc-miptree-3d_${piglit_target_api} 
oes_compressed_astc-miptree-3d.c)
+
+# vim: ft=cmake:
-- 
2.17.1

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


[Piglit] [PATCH 5/6] tests/opengl.py: remove ext_transform-get-buffer-size

2018-06-25 Thread Dylan Baker
This has never existed, it was added by mistake when the format of
all.py was changed.
---
 tests/opengl.py | 2 --
 1 file changed, 2 deletions(-)

diff --git a/tests/opengl.py b/tests/opengl.py
index 8556c9f22..7ac1ef078 100644
--- a/tests/opengl.py
+++ b/tests/opengl.py
@@ -3352,8 +3352,6 @@ with profile.test_list.group_manager(
 
 for mode in ['main_binding', 'indexed_binding', 'buffer_start',
  'buffer_size']:
-g(['ext_transform_feedback-get-buffer-size', mode],
-  'get-buffer-size {}'.format(mode))
 g(['ext_transform_feedback-get-buffer-state', mode],
   'get-buffer-state {}'.format(mode))
 
-- 
2.17.1

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


Re: [Piglit] [PATCH 03/24] framework: add --glsl option

2018-06-25 Thread Dylan Baker
Quoting Alejandro Piñeiro (2018-06-23 04:26:33)
> On 22/06/18 19:14, Dylan Baker wrote:
> > Quoting Alejandro Piñeiro (2018-06-20 05:40:38)
> >> So when executing shader tests, they will be executed with -glsl. This
> >> is the force GLSL mode, that is only relevant if the shader test
> >> includes SPIR-V shaders.
> > I'm not sure I understand what you're doing. It looks like you're planning 
> > to
> > build tests that can be run in either SPIRV or GLSL mode, that they can be
> > forced into GLSL mode using a switch, or use SPIRV mode if available. Is 
> > that
> > correct?
> 
> Yes. Perhaps the commit message is not really clear, as all the details
> are included on the previous commit "shader_runner/spirv: support
> loading SPIR-V shaders". On that commit we explain that we add a -glsl
> option to shader_runner, that is mostly a debugging option. What this
> commits adds is adding the -glsl option when running the tests in a
> batch. With this series, the -glsl option would only make sense with the
> ARB_gl_spirv tests we are adding.
> 
> Do you think that I should update the commit message to be more clear?
> 
> BR
> 

My concern is that you could end up with two tests with the same name that
aren't the same (I think), since the --glsl option won't change the name of the
test.

Dylan


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


Re: [Piglit] [PATCH v4] unsized_array_member: It should expect link success instead of link error

2018-06-25 Thread Dylan Baker
Quoting Eleni Maria Stea (2018-06-23 01:43:52)
> Modified the unsized_array_member.shader_test to expect successful
> linking instead of linker error.
> 
> Section 4.2 (Scoping) of the OpenGL Shading Language Specification says:
> "An array implicitly sized in one shader can be explicitly sized by
> another shader in the same stage. If no shader in a stage has an explicit
> size for the array, the largest implicit size (one more than the largest
> index used) in that stage is used. There is no cross-stage array sizing.
> If there is no static access to an implicitly sized array within the stage
> declaring it, then the array is given a size of 1, which is relevant when
> the array is declared within an interface block that is shared with other
> stages or the application (other unused arrays might be eliminated by the
> optimizer)."
> 
> This means that the unused array s of the following shader block in the
> unsized_array_member.shader_test:
> buffer a {
> vec4 s[];
> vec4 a[];
> } b;
> should be an array of size 1 and not an unsized array, and so no linker
> error should be generated.
> 
> Ref: https://bugs.freedesktop.org/show_bug.cgi?id=106915
> 
> v2:
>   - replaces the comment at the top with the relevant part of the spec
> v3:
>   - fixes in the quoted part of the spec (Ian Romanick)
> v4:
>   - updates the commit message accordingly (Dylan Baker)
> ---
>  .../linker/unsized_array_member.shader_test   | 20 ++-
>  1 file changed, 11 insertions(+), 9 deletions(-)
> 
> diff --git 
> a/tests/spec/arb_shader_storage_buffer_object/linker/unsized_array_member.shader_test
>  
> b/tests/spec/arb_shader_storage_buffer_object/linker/unsized_array_member.shader_test
> index 47d0483ac..946bf1cb2 100644
> --- 
> a/tests/spec/arb_shader_storage_buffer_object/linker/unsized_array_member.shader_test
> +++ 
> b/tests/spec/arb_shader_storage_buffer_object/linker/unsized_array_member.shader_test
> @@ -1,12 +1,14 @@
> -# From ARB_program_interface_query spec:
> +# Section 4.2 (Scoping) of the OpenGL Shading Language Specification says:
>  #
> -#"For the property of BUFFER_DATA_SIZE, then the implementation-dependent
> -#minimum total buffer object size, in basic machine units, required to
> -#hold all active variables associated with an active uniform block, 
> shader
> -#storage block, or atomic counter buffer is written to .  If the
> -#final member of an active shader storage block is array with no declared
> -#size, the minimum buffer size is computed assuming the array was 
> declared
> -#as an array with one element."
> +#"An array implicitly sized in one shader can be explicitly sized by
> +#another shader in the same stage. If no shader in a stage has an
> +#explicit size for the array, the largest implicit size (one more than
> +#the largest index used) in that stage is used. There is no cross-stage
> +#array sizing. If there is no static access to an implicitly sized array
> +#within the stage declaring it, then the array is given a size of 1,
> +#which is relevant when the array is declared within an interface block
> +#that is shared with other stages or the application (other unused arrays
> +#might be eliminated by the optimizer)."
>  
>  [require]
>  GLSL >= 1.50
> @@ -31,4 +33,4 @@ void main(void) {
>  }
>  
>  [test]
> -link error
> +link success
> -- 
> 2.17.1
> 

This looks good to me, Ian?

Dylan


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


Re: [Piglit] [PATCH v2] ARB_vertex_attrib_64bit: add doubles support to attributes test

2018-06-25 Thread Alejandro Piñeiro
LGTM. Just a nitpick below. But in any case:
Reviewed-by: Alejandro Piñeiro 

On 25/06/18 10:45, Timothy Arceri wrote:
> ---
>
>  V2: Add missing opengl.py entry.
>
>  tests/general/attribs.c | 68 +++--
>  tests/opengl.py |  3 +-
>  2 files changed, 67 insertions(+), 4 deletions(-)
>
> diff --git a/tests/general/attribs.c b/tests/general/attribs.c
> index 05a0d4a1e..bf627dece 100644
> --- a/tests/general/attribs.c
> +++ b/tests/general/attribs.c
> @@ -53,6 +53,7 @@ enum {
>  };
>  
>  enum {
> + DOUBLE_TYPE,
>   FLOAT_TYPE,
>   INT_TYPE,
>   UINT_TYPE
> @@ -120,12 +121,13 @@ static GLboolean test(int x, int y, const char 
> *shaderfunc,
> const char *info)
>  {
>   static const char *templ = {
> + "%s \n"

Is this extra line really needed?

>   "%s \n"
>   "#extension GL_ARB_explicit_attrib_location : require \n"
>   "layout(location = 1) in %s attr; \n"
>   "void main() { \n"
>   "  gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; \n"
> - "  gl_FrontColor = (%s) * vec4(1.0, 1.0, 1.0, 0.5); \n"
> + "  gl_FrontColor = vec4(%s %s) * vec4(1.0, 1.0, 1.0, 0.5); \n"
>   "} \n"
>   };
>   GLuint prog, vs;
> @@ -139,10 +141,56 @@ static GLboolean test(int x, int y, const char 
> *shaderfunc,
>   {0.5, 0.3, 0.9, 0.2}
>   };
>  
> + char *defaults;
> + char *type_string;
> +
> + /* From Section 11.1.1 (Vertex Attributes) of the OpenGL 4.6
> +  * Compatibility Profile spec:
> +  *
> +  *"Scalar and vector vertex attribute types and VertexAttrib*
> +  *commands used to set the values of the corresponding generic
> +  *attribute. values are provided if the values of the vertex
> +  *attribute variable are specified with fewer components than
> +  *required for the attribute variable. For example, the fourth
> +  *component of a variable of type dvec4 will be undefined if
> +  *specified using VertexAttribL3dv, or using a vertex array
> +  *specified with VertexAttribLPointer and a size of three.
> +  *
> +  * TODO: We should probably also be doing this for attribute functions
> +  *   other than doubles.
> +  */
> + if (type == DOUBLE_TYPE) {
> + switch (mask) {
> + case R:
> + type_string = "double";
> + defaults = ", dvec3(0.0, 0.0, 1.0)";
> + break;
> + case RG:
> + type_string = "dvec2";
> + defaults = ", dvec2(0.0, 1.0)";
> + break;
> + case RGB:
> + type_string = "dvec3";
> + defaults = ", 1.0";
> + break;
> + case RGBA:
> + type_string = "dvec4";
> + defaults = "";
> + break;
> + default:
> + assert(0);
> + }
> + } else {
> + defaults = "";
> + type_string =
> + type == INT_TYPE ? "ivec4" : type == UINT_TYPE ? 
> "uvec4" : "vec4";
> + }
> +
>   sprintf(vstext, templ,
>   type != FLOAT_TYPE ? "#version 130" : "",
> - type == INT_TYPE ? "ivec4" : type == UINT_TYPE ? "uvec4" : 
> "vec4",
> - shaderfunc);
> + type == DOUBLE_TYPE ?
> + "#extension GL_ARB_gpu_shader_fp64: enable\n#extension 
> GL_ARB_vertex_attrib_64bit: enable" : "",
> + type_string, shaderfunc, defaults);
>  
>   /* Create the shader. */
>   vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vstext);
> @@ -343,6 +391,19 @@ static test_func tests_GL3[] = {
>   test_glVertexAttribI4ui,
>  };
>  
> +/* ARB_vertex_attrib_64bit */
> +DEFINE_TEST(glVertexAttribL1d,,  (1, x), "attr", R, DOUBLE_TYPE, 
> "")
> +DEFINE_TEST(glVertexAttribL2d,,  (1, x, y),  "attr", RG, 
> DOUBLE_TYPE, "")
> +DEFINE_TEST(glVertexAttribL3d,,  (1, x, y, z),   "attr", RGB, 
> DOUBLE_TYPE, "")
> +DEFINE_TEST(glVertexAttribL4d,,  (1, x, y, z, w),"attr", RGBA, 
> DOUBLE_TYPE, "")
> +
> +static test_func tests_GL_ARB_vertex_attrib_64bit[] = {
> + test_glVertexAttribL1d,
> + test_glVertexAttribL2d,
> + test_glVertexAttribL3d,
> + test_glVertexAttribL4d,
> +};
> +
>  /* ARB_vertex_type_2_10_10_10_rev */
>  /* Packing functions for a signed normalized 2-bit component.
>   * These are based on equation 2.2 and 2.3 from the opengl specification, 
> see:
> @@ -503,6 +564,7 @@ struct test_set {
>  } test_sets[] = {
>   { TESTS(GL2) },
>   { TESTS(GL3), 30 },
> + { TESTS(GL_ARB_vertex_attrib_64bit), 32 },
>   { TESTS(GL_ARB_vertex_type_2_10_10_10_rev), 0, 
> "GL_ARB_vertex_type_2_10_10_10_rev" },
>  };
>  
> diff --git a/tests/

[Piglit] [PATCH v2] ARB_vertex_attrib_64bit: add doubles support to attributes test

2018-06-25 Thread Timothy Arceri
---

 V2: Add missing opengl.py entry.

 tests/general/attribs.c | 68 +++--
 tests/opengl.py |  3 +-
 2 files changed, 67 insertions(+), 4 deletions(-)

diff --git a/tests/general/attribs.c b/tests/general/attribs.c
index 05a0d4a1e..bf627dece 100644
--- a/tests/general/attribs.c
+++ b/tests/general/attribs.c
@@ -53,6 +53,7 @@ enum {
 };
 
 enum {
+   DOUBLE_TYPE,
FLOAT_TYPE,
INT_TYPE,
UINT_TYPE
@@ -120,12 +121,13 @@ static GLboolean test(int x, int y, const char 
*shaderfunc,
  const char *info)
 {
static const char *templ = {
+   "%s \n"
"%s \n"
"#extension GL_ARB_explicit_attrib_location : require \n"
"layout(location = 1) in %s attr; \n"
"void main() { \n"
"  gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; \n"
-   "  gl_FrontColor = (%s) * vec4(1.0, 1.0, 1.0, 0.5); \n"
+   "  gl_FrontColor = vec4(%s %s) * vec4(1.0, 1.0, 1.0, 0.5); \n"
"} \n"
};
GLuint prog, vs;
@@ -139,10 +141,56 @@ static GLboolean test(int x, int y, const char 
*shaderfunc,
{0.5, 0.3, 0.9, 0.2}
};
 
+   char *defaults;
+   char *type_string;
+
+   /* From Section 11.1.1 (Vertex Attributes) of the OpenGL 4.6
+* Compatibility Profile spec:
+*
+*"Scalar and vector vertex attribute types and VertexAttrib*
+*commands used to set the values of the corresponding generic
+*attribute. values are provided if the values of the vertex
+*attribute variable are specified with fewer components than
+*required for the attribute variable. For example, the fourth
+*component of a variable of type dvec4 will be undefined if
+*specified using VertexAttribL3dv, or using a vertex array
+*specified with VertexAttribLPointer and a size of three.
+*
+* TODO: We should probably also be doing this for attribute functions
+*   other than doubles.
+*/
+   if (type == DOUBLE_TYPE) {
+   switch (mask) {
+   case R:
+   type_string = "double";
+   defaults = ", dvec3(0.0, 0.0, 1.0)";
+   break;
+   case RG:
+   type_string = "dvec2";
+   defaults = ", dvec2(0.0, 1.0)";
+   break;
+   case RGB:
+   type_string = "dvec3";
+   defaults = ", 1.0";
+   break;
+   case RGBA:
+   type_string = "dvec4";
+   defaults = "";
+   break;
+   default:
+   assert(0);
+   }
+   } else {
+   defaults = "";
+   type_string =
+   type == INT_TYPE ? "ivec4" : type == UINT_TYPE ? 
"uvec4" : "vec4";
+   }
+
sprintf(vstext, templ,
type != FLOAT_TYPE ? "#version 130" : "",
-   type == INT_TYPE ? "ivec4" : type == UINT_TYPE ? "uvec4" : 
"vec4",
-   shaderfunc);
+   type == DOUBLE_TYPE ?
+   "#extension GL_ARB_gpu_shader_fp64: enable\n#extension 
GL_ARB_vertex_attrib_64bit: enable" : "",
+   type_string, shaderfunc, defaults);
 
/* Create the shader. */
vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vstext);
@@ -343,6 +391,19 @@ static test_func tests_GL3[] = {
test_glVertexAttribI4ui,
 };
 
+/* ARB_vertex_attrib_64bit */
+DEFINE_TEST(glVertexAttribL1d,,  (1, x),   "attr", R, DOUBLE_TYPE, 
"")
+DEFINE_TEST(glVertexAttribL2d,,  (1, x, y),"attr", RG, 
DOUBLE_TYPE, "")
+DEFINE_TEST(glVertexAttribL3d,,  (1, x, y, z), "attr", RGB, 
DOUBLE_TYPE, "")
+DEFINE_TEST(glVertexAttribL4d,,  (1, x, y, z, w),  "attr", RGBA, 
DOUBLE_TYPE, "")
+
+static test_func tests_GL_ARB_vertex_attrib_64bit[] = {
+   test_glVertexAttribL1d,
+   test_glVertexAttribL2d,
+   test_glVertexAttribL3d,
+   test_glVertexAttribL4d,
+};
+
 /* ARB_vertex_type_2_10_10_10_rev */
 /* Packing functions for a signed normalized 2-bit component.
  * These are based on equation 2.2 and 2.3 from the opengl specification, see:
@@ -503,6 +564,7 @@ struct test_set {
 } test_sets[] = {
{ TESTS(GL2) },
{ TESTS(GL3), 30 },
+   { TESTS(GL_ARB_vertex_attrib_64bit), 32 },
{ TESTS(GL_ARB_vertex_type_2_10_10_10_rev), 0, 
"GL_ARB_vertex_type_2_10_10_10_rev" },
 };
 
diff --git a/tests/opengl.py b/tests/opengl.py
index 669d9055b..3ed00e5b7 100644
--- a/tests/opengl.py
+++ b/tests/opengl.py
@@ -4697,7 +4697,8 @@ with profile.test_list.group_manager(
 with profile.test_list.group_manager(
 PiglitGLTest,
 grouptools.join('spec', 

[Piglit] [PATCH] ARB_vertex_attrib_64bit: add doubles support to attributes test

2018-06-25 Thread Timothy Arceri
---
 tests/general/attribs.c | 68 +++--
 1 file changed, 65 insertions(+), 3 deletions(-)

diff --git a/tests/general/attribs.c b/tests/general/attribs.c
index 05a0d4a1e..bf627dece 100644
--- a/tests/general/attribs.c
+++ b/tests/general/attribs.c
@@ -53,6 +53,7 @@ enum {
 };
 
 enum {
+   DOUBLE_TYPE,
FLOAT_TYPE,
INT_TYPE,
UINT_TYPE
@@ -120,12 +121,13 @@ static GLboolean test(int x, int y, const char 
*shaderfunc,
  const char *info)
 {
static const char *templ = {
+   "%s \n"
"%s \n"
"#extension GL_ARB_explicit_attrib_location : require \n"
"layout(location = 1) in %s attr; \n"
"void main() { \n"
"  gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; \n"
-   "  gl_FrontColor = (%s) * vec4(1.0, 1.0, 1.0, 0.5); \n"
+   "  gl_FrontColor = vec4(%s %s) * vec4(1.0, 1.0, 1.0, 0.5); \n"
"} \n"
};
GLuint prog, vs;
@@ -139,10 +141,56 @@ static GLboolean test(int x, int y, const char 
*shaderfunc,
{0.5, 0.3, 0.9, 0.2}
};
 
+   char *defaults;
+   char *type_string;
+
+   /* From Section 11.1.1 (Vertex Attributes) of the OpenGL 4.6
+* Compatibility Profile spec:
+*
+*"Scalar and vector vertex attribute types and VertexAttrib*
+*commands used to set the values of the corresponding generic
+*attribute. values are provided if the values of the vertex
+*attribute variable are specified with fewer components than
+*required for the attribute variable. For example, the fourth
+*component of a variable of type dvec4 will be undefined if
+*specified using VertexAttribL3dv, or using a vertex array
+*specified with VertexAttribLPointer and a size of three.
+*
+* TODO: We should probably also be doing this for attribute functions
+*   other than doubles.
+*/
+   if (type == DOUBLE_TYPE) {
+   switch (mask) {
+   case R:
+   type_string = "double";
+   defaults = ", dvec3(0.0, 0.0, 1.0)";
+   break;
+   case RG:
+   type_string = "dvec2";
+   defaults = ", dvec2(0.0, 1.0)";
+   break;
+   case RGB:
+   type_string = "dvec3";
+   defaults = ", 1.0";
+   break;
+   case RGBA:
+   type_string = "dvec4";
+   defaults = "";
+   break;
+   default:
+   assert(0);
+   }
+   } else {
+   defaults = "";
+   type_string =
+   type == INT_TYPE ? "ivec4" : type == UINT_TYPE ? 
"uvec4" : "vec4";
+   }
+
sprintf(vstext, templ,
type != FLOAT_TYPE ? "#version 130" : "",
-   type == INT_TYPE ? "ivec4" : type == UINT_TYPE ? "uvec4" : 
"vec4",
-   shaderfunc);
+   type == DOUBLE_TYPE ?
+   "#extension GL_ARB_gpu_shader_fp64: enable\n#extension 
GL_ARB_vertex_attrib_64bit: enable" : "",
+   type_string, shaderfunc, defaults);
 
/* Create the shader. */
vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vstext);
@@ -343,6 +391,19 @@ static test_func tests_GL3[] = {
test_glVertexAttribI4ui,
 };
 
+/* ARB_vertex_attrib_64bit */
+DEFINE_TEST(glVertexAttribL1d,,  (1, x),   "attr", R, DOUBLE_TYPE, 
"")
+DEFINE_TEST(glVertexAttribL2d,,  (1, x, y),"attr", RG, 
DOUBLE_TYPE, "")
+DEFINE_TEST(glVertexAttribL3d,,  (1, x, y, z), "attr", RGB, 
DOUBLE_TYPE, "")
+DEFINE_TEST(glVertexAttribL4d,,  (1, x, y, z, w),  "attr", RGBA, 
DOUBLE_TYPE, "")
+
+static test_func tests_GL_ARB_vertex_attrib_64bit[] = {
+   test_glVertexAttribL1d,
+   test_glVertexAttribL2d,
+   test_glVertexAttribL3d,
+   test_glVertexAttribL4d,
+};
+
 /* ARB_vertex_type_2_10_10_10_rev */
 /* Packing functions for a signed normalized 2-bit component.
  * These are based on equation 2.2 and 2.3 from the opengl specification, see:
@@ -503,6 +564,7 @@ struct test_set {
 } test_sets[] = {
{ TESTS(GL2) },
{ TESTS(GL3), 30 },
+   { TESTS(GL_ARB_vertex_attrib_64bit), 32 },
{ TESTS(GL_ARB_vertex_type_2_10_10_10_rev), 0, 
"GL_ARB_vertex_type_2_10_10_10_rev" },
 };
 
-- 
2.17.1

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