Re: [Piglit] [PATCH] tests: Added a new GLES test profile for the Khronos CTS runner

2018-02-14 Thread Mark Janes
Mesa i965 CI doesn't use piglit anymore to run CTS, so we won't be
affected by this patch.

Andres Gomez  writes:

> OpenGL GLES*-CTS case lists were renamed to KHR-GLES* in the upstream
> repository.
>
> We want to keep the existing profiles so we are able to keep running
> the caselists from previous CTS releases and for branches in the open
> sourced repository created for API-specific release branches, as
> explained at:
> https://github.com/KhronosGroup/VK-GL-CTS/wiki/Contributing#branches
>
> Therefore, we add this new test profile to be able to run the renamed
> tests in the master branch of the opensourced Khronos CTS tests at:
> https://github.com/KhronosGroup/VK-GL-CTS
>
> Cc: Mark Janes 
> Cc: Dylan Baker 
> Cc: Juan A. Suarez Romero 
> Signed-off-by: Andres Gomez 
> ---
>  tests/khr_gles.py | 88 
> +++
>  1 file changed, 88 insertions(+)
>  create mode 100644 tests/khr_gles.py
>
> diff --git a/tests/khr_gles.py b/tests/khr_gles.py
> new file mode 100644
> index 0..59a0fe089
> --- /dev/null
> +++ b/tests/khr_gles.py
> @@ -0,0 +1,88 @@
> +# Copyright (c) 2017 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 shall be included in
> +# all copies or substantial portions of the Software.
> +
> +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
> FROM,
> +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 
> THE
> +# SOFTWARE.
> +
> +"""Piglit integration for the now open sourced Khronos CTS tests being
> +developed at https://github.com/KhronosGroup/VK-GL-CTS
> +
> +By default this will run GLES2, GLES3, GLES31, GLES32, and GLESEXT
> +test cases. Those desiring to run only a subset of them should
> +consider using the -t or -x options to include or exclude tests.
> +
> +For example:
> +./piglit run khr_gles -c foo -t ES3- would run only ES3 tests (note
> +the dash to exclude ES31 tests)
> +
> +This integration requires some configuration in piglit.conf, or the
> +use of environment variables.
> +
> +In piglit.conf one should set the following:
> +[khr_gles]:bin -- Path to the glcts binary
> +[khr_gles]:extra_args -- any extra arguments to be passed to cts
> +(optional)
> +
> +Alternatively (or in addition, since environment variables have
> +precedence), one could set:
> +PIGLIT_KHR_GLES_BIN -- environment equivalent of [khr_gles]:bin
> +PIGLIT_KHR_GLES_EXTRA_ARGS -- environment equivalent of
> +[khr_gles]:extra_args
> +
> +"""
> +
> +from __future__ import (
> +absolute_import, division, print_function, unicode_literals
> +)
> +import itertools
> +
> +from framework.test import deqp
> +
> +__all__ = ['profile']
> +
> +_KHR_BIN = deqp.get_option('PIGLIT_KHR_GLES_BIN', ('khr_gles', 'bin'),
> +   required=True)
> +
> +_EXTRA_ARGS = deqp.get_option('PIGLIT_KHR_GLES_EXTRA_ARGS', ('khr_gles', 
> 'extra_args'),
> +  default='').split()
> +
> +
> +class DEQPKHRTest(deqp.DEQPBaseTest):
> +deqp_bin = _KHR_BIN
> +
> +@property
> +def extra_args(self):
> +return super(DEQPKHRTest, self).extra_args + \
> +[x for x in _EXTRA_ARGS if not x.startswith('--deqp-case')]
> +
> +
> +# Add all of the suites by default, users can use filters to remove them.
> +profile = deqp.make_profile(  # pylint: disable=invalid-name
> +itertools.chain(
> +deqp.iter_deqp_test_cases(
> +deqp.gen_caselist_txt(_KHR_BIN, 'KHR-GLES2-cases.txt', 
> _EXTRA_ARGS)),
> +deqp.iter_deqp_test_cases(
> +deqp.gen_caselist_txt(_KHR_BIN, 'KHR-GLES3-cases.txt', 
> _EXTRA_ARGS)),
> +deqp.iter_deqp_test_cases(
> +deqp.gen_caselist_txt(_KHR_BIN, 'KHR-GLES31-cases.txt', 
> _EXTRA_ARGS)),
> +deqp.iter_deqp_test_cases(
> +deqp.gen_caselist_txt(_KHR_BIN, 'KHR-GLES32-cases.txt', 
> _EXTRA_ARGS)),
> +deqp.iter_deqp_test_cases(
> +deqp.gen_caselist_txt(_KHR_BIN, 'KHR-GLESEXT-cases.txt',
> +  _EXTRA_ARGS)),
> +),
> +  

[Piglit] [PATCH 3/7] EXT_shader_framebuffer_fetch: Parameterize more tests on the GL API version.

2018-02-14 Thread Francisco Jerez
This makes the GL API version of the test available to several
Mako templates as a macro instead of a magic number.
---
 .../gen_shader_framebuffer_fetch_tests.py  | 28 --
 1 file changed, 16 insertions(+), 12 deletions(-)

diff --git a/generated_tests/gen_shader_framebuffer_fetch_tests.py 
b/generated_tests/gen_shader_framebuffer_fetch_tests.py
index a7c54ed55..f7e148b39 100644
--- a/generated_tests/gen_shader_framebuffer_fetch_tests.py
+++ b/generated_tests/gen_shader_framebuffer_fetch_tests.py
@@ -426,7 +426,7 @@ def main():
 #
 gen_execution("""\
 [require]
-GL ES >= 3.0
+GL ES >= ${api_version}
 GLSL ES >= 3.00
 GL_${extension}
 
@@ -460,9 +460,10 @@ def main():
 relative probe rect rgb (0.0, 0.55, 0.45, 0.45) (0.5, 0.0, 0.5)
 relative probe rect rgb (0.55, 0.55, 0.45, 0.45) (1.0, 0.5, 0.5)
 
-${display_fb(3.0)}
+${display_fb(api_version)}
 """, product(common_defs,
- [{'name': 'texture-gles3'}]))
+ [{'name': 'texture-gles3',
+   'api_version': 3.0}]))
 
 #
 # Test non-uniform fragment discard dependent on the result read
@@ -472,7 +473,7 @@ def main():
 #
 gen_execution("""\
 [require]
-GL ES >= 3.0
+GL ES >= ${api_version}
 GLSL ES >= 3.00
 GL_${extension}
 %if samples > 0:
@@ -529,9 +530,10 @@ def main():
 relative probe rect rgb (0.0, 0.55, 0.45, 0.45) (0.1, 0.5, 1.0)
 relative probe rect rgb (0.55, 0.55, 0.45, 0.45) (0.5, 0.5, 1.0)
 
-${display_fb(3.0)}
+${display_fb(api_version)}
 """, product(common_defs,
- [{'name': 'discard-gles3-'}],
+ [{'name': 'discard-gles3-',
+   'api_version': 3.0}],
  [{'name': 'ss', 'samples': 0},
   {'name': 'ms8', 'samples': 8}]))
 
@@ -669,7 +671,7 @@ def main():
 #
 gen_execution("""\
 [require]
-GL ES >= 3.0
+GL ES >= ${api_version}
 GLSL ES >= 3.00
 GL_${extension}
 
@@ -718,9 +720,10 @@ def main():
 relative probe rect rgb (0.0, 0.55, 0.45, 0.45) (1.0, 1.0, 1.0)
 relative probe rect rgb (0.55, 0.55, 0.45, 0.45) (1.0, 1.0, 1.0)
 
-${display_fb(3.0)}
+${display_fb(api_version)}
 """, product(common_defs,
- [{'name': 'overwrite-gles3'}]))
+ [{'name': 'overwrite-gles3',
+   'api_version': 3.0}]))
 
 #
 # Test framebuffer fetch functionality on individual slices of a
@@ -728,7 +731,7 @@ def main():
 #
 gen_execution("""\
 [require]
-GL ES >= 3.0
+GL ES >= ${api_version}
 GLSL ES >= 3.00
 GL_${extension}
 
@@ -783,9 +786,10 @@ def main():
 %endfor
 %endfor
 
-${display_fb(3.0)}
+${display_fb(api_version)}
 """, product(common_defs,
- [{'name': 'single-slice-'}],
+ [{'name': 'single-slice-',
+   'api_version': 3.0}],
  [{'name': '2darray-gles3', 'target': '2DArray',
'levels': 1, 'layers': 4},
   {'name': '2darray-mipmap-gles3', 'target': '2DArray',
-- 
2.16.1

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


[Piglit] [PATCH 6/7] EXT_shader_framebuffer_fetch: Add tests for framebuffer fetch outputs with invalid layout qualifier.

2018-02-14 Thread Francisco Jerez
---
 .../gen_shader_framebuffer_fetch_tests.py  | 36 ++
 1 file changed, 36 insertions(+)

diff --git a/generated_tests/gen_shader_framebuffer_fetch_tests.py 
b/generated_tests/gen_shader_framebuffer_fetch_tests.py
index eb0e48c9a..157652329 100644
--- a/generated_tests/gen_shader_framebuffer_fetch_tests.py
+++ b/generated_tests/gen_shader_framebuffer_fetch_tests.py
@@ -221,6 +221,42 @@ def main():
  [{'name': 'negative-gl_LastFragData-write-gles2',
'shader_stage': 'frag'}]))
 
+#
+# Test framebuffer fetch output declarations with invalid layout
+# qualifiers.  From the EXT_shader_framebuffer_fetch extension:
+#
+# "It is an error to declare an inout fragment output not
+#  qualified with layout(noncoherent) if the
+#  GL_EXT_shader_framebuffer_fetch extension hasn't been enabled."
+#
+# "The ability to use the inout and layout(noncoherent) qualifiers
+#  at global scope in a fragment shader are optional and can be
+#  enabled by
+#   #extension GL_EXT_shader_framebuffer_fetch_non_coherent : "
+#
+gen_compiler("""\
+/*
+ * [config]
+ * expect_result: fail
+ * glsl_version: ${3.0 if api_version >= 3.0 else 1.0} es
+ * require_extensions: GL_${extension}
+ * [end config]
+ */
+#version ${'300 es' if api_version >= 3.0 else '100'}
+#extension GL_${extension} : enable
+
+${decl_frag_data(api_version, '' if layout else 'layout(noncoherent)')}
+
+void main()
+{
+${last_frag_data(api_version)};
+}
+""", product(all_defs,
+ [{'name': 'negative-output-layout-',
+   'shader_stage': 'frag'}],
+ [{'name': 'gles2', 'api_version': 2.0},
+  {'name': 'gles3', 'api_version': 3.0}]))
+
 #
 # Test that GL(ES) 3+ user-defined inout arrays are not accepted
 # in earlier GLSL versions.
-- 
2.16.1

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


[Piglit] [PATCH 7/7] EXT_shader_framebuffer_fetch: Add test cases specific to desktop GL.

2018-02-14 Thread Francisco Jerez
Implement generators for framebuffer fetch test cases using desktop GL
features like 1D and layered framebuffers.
---
 .../gen_shader_framebuffer_fetch_tests.py  | 155 +
 1 file changed, 155 insertions(+)

diff --git a/generated_tests/gen_shader_framebuffer_fetch_tests.py 
b/generated_tests/gen_shader_framebuffer_fetch_tests.py
index 157652329..267fad9e2 100644
--- a/generated_tests/gen_shader_framebuffer_fetch_tests.py
+++ b/generated_tests/gen_shader_framebuffer_fetch_tests.py
@@ -868,5 +868,160 @@ def main():
   {'name': 'cubemap-gles3', 'target': 'Cube',
'levels': 1, 'layers': 6}]))
 
+#
+# Test framebuffer fetch functionality on a 1D framebuffer.
+#
+gen_execution("""\
+[require]
+GL >= ${api_version}
+GLSL >= 1.50
+GL_ARB_texture_storage
+GL_${extension}
+
+[vertex shader]
+#version 150
+
+in vec4 vertex;
+out vec4 vcolor;
+
+void main()
+{
+gl_Position = vertex;
+// Transform the vertex coordinates so that the R
+// component of the vertex color ranges between 0.0 and 1.0.
+vcolor = vec4((1.0 + vertex.x) / 2.0, 0.7, 0.0, 1.0);
+}
+
+[fragment shader]
+#version 150
+#extension GL_${extension} : enable
+
+in vec4 vcolor;
+${decl_frag_data(api_version, layout)}
+
+void main()
+{
+// The else branch will be executed during the second
+// overdraw.
+if (${last_frag_data(api_version)}.x <= 0.5 &&
+${last_frag_data(api_version)}.y <= 0.5) {
+${frag_data(api_version)} = ${last_frag_data(api_version)} +
+vcolor;
+} else {
+// Will give a solid color as result different for
+// each half, assuming that the first branch was taken
+// during the first pass.
+${frag_data(api_version)} = ${last_frag_data(api_version)} +
+vec4((vcolor.x >= 0.5 ? 1.0 : 0.0) 
- vcolor.x,
+ (vcolor.y >= 0.5 ? 1.0 : 0.0) 
- vcolor.y, 0, 0);
+}
+}
+
+[test]
+texture storage 0 1D GL_RGBA8 (1 250)
+fb tex slice 1D 0 0 0
+
+clear color 0.0 0.0 1.0 0.0
+clear
+${barrier}
+draw rect -1 -1 2 2
+${barrier}
+draw rect -1 -1 2 2
+
+relative probe rect rgb (0.0, 0.0, 0.45, 1.0) (0.0, 1.0, 1.0)
+relative probe rect rgb (0.55, 0.0, 0.45, 1.0) (1.0, 1.0, 1.0)
+
+fb draw winsys
+blit color linear
+""", product(all_defs,
+ [{'name': '1d-gl32',
+   'api_version': 3.2}]))
+
+#
+# Test framebuffer fetch functionality while rendering into
+# multiple layers of an array or cubemap framebuffer
+# simultaneously.
+#
+gen_execution("""\
+[require]
+GL >= ${api_version}
+GLSL >= 1.50
+GL_ARB_texture_storage
+GL_${extension}
+
+[vertex shader passthrough]
+[geometry shader]
+#version 150
+
+layout(triangles) in;
+layout(triangle_strip, max_vertices=18) out;
+
+flat out int glayer;
+
+void main()
+{
+for (int layer = 0; layer < ${layers}; layer++) {
+for (int i = 0; i < 3; i++) {
+gl_Position = gl_in[i].gl_Position;
+gl_Layer = glayer = layer;
+EmitVertex();
+}
+EndPrimitive();
+}
+}
+
+[fragment shader]
+#version 150
+#extension GL_${extension} : enable
+
+flat in int glayer;
+${decl_frag_data(api_version, layout)}
+
+void main()
+{
+${frag_data(api_version)} = ${last_frag_data(api_version)} +
+(glayer == 5 ? vec4(0.0, 0.5, 0.5, 0.0) :
+ glayer == 4 ? vec4(0.5, 0.0, 0.5, 0.0) :
+ glayer == 3 ? vec4(0.0, 0.0, 0.5, 0.0) :
+ glayer == 2 ? vec4(0.5, 0.5, 0.0, 0.0) :
+ glayer == 1 ? vec4(0.0, 0.5, 0.0, 0.0) :
+ vec4(0.5, 0.0, 0.0, 0.0));
+}
+
+[test]
+texture storage 0 ${target} GL_RGBA8 (${dimensions})
+fb tex layered 0
+
+clear color 0.0 0.0 0.5 0.0
+clear
+${barrier}
+draw rect -1 -1 2 2
+${barrier}
+draw rect -1 -1 2 2
+
+<%! expected_colors = ['(1.0, 0.0, 0.5)',
+   '(0.0, 1.0, 0.5)',
+   '(1.0, 1.0, 0.5)',
+   '(0.0, 0.0, 1.0)',
+   '(1.0, 0.0, 1.0)',
+   '(0.0, 1.0, 1.0)'] %>
+
+%for z in 

[Piglit] [PATCH 2/7] shader_runner: Add fbfetch barrier command.

2018-02-14 Thread Francisco Jerez
---
 tests/shaders/shader_runner.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index 700b11327..f5eb5c6a7 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -3345,6 +3345,8 @@ piglit_display(void)

glMemoryBarrier(piglit_get_gl_memory_barrier_enum_from_name(s));
} else if (parse_str(line, "blend barrier", NULL)) {
glBlendBarrier();
+   } else if (parse_str(line, "fbfetch barrier", NULL)) {
+   glFramebufferFetchBarrierEXT();
} else if (sscanf(line, "ortho %f %f %f %f",
  c + 0, c + 1, c + 2, c + 3) == 4) {
piglit_gen_ortho_projection(c[0], c[1], c[2], c[3],
-- 
2.16.1

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


[Piglit] [PATCH 1/7] Update XML for latest version of GL_EXT_shader_framebuffer_fetch.

2018-02-14 Thread Francisco Jerez
---
 registry/gl.xml | 11 ++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/registry/gl.xml b/registry/gl.xml
index 7b13ff907..54eb4223a 100644
--- a/registry/gl.xml
+++ b/registry/gl.xml
@@ -13932,6 +13932,9 @@ typedef unsigned int GLhandleARB;
 GLfloat 
gainY
 GLfloat 
foveaArea
 
+
+void glFramebufferFetchBarrierEXT
+
 
 void glFramebufferParameteri
 GLenum target
@@ -42781,9 +42784,15 @@ typedef unsigned int GLhandleARB;
 
 
 
-
+
+
+
+
+
+
 
 
+
 
 
 
-- 
2.16.1

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


[Piglit] [PATCH 5/7] EXT_shader_framebuffer_fetch: Port existing tests to non-coherent extension.

2018-02-14 Thread Francisco Jerez
For the most part this is just a matter of specifying the noncoherent
layout qualifier and making sure that glFramebufferFetchBarrier is
called between rendering passes.
---
 .../gen_shader_framebuffer_fetch_tests.py  | 90 ++
 1 file changed, 60 insertions(+), 30 deletions(-)

diff --git a/generated_tests/gen_shader_framebuffer_fetch_tests.py 
b/generated_tests/gen_shader_framebuffer_fetch_tests.py
index 201d2cec9..eb0e48c9a 100644
--- a/generated_tests/gen_shader_framebuffer_fetch_tests.py
+++ b/generated_tests/gen_shader_framebuffer_fetch_tests.py
@@ -93,11 +93,10 @@ def gen_compiler(src, tests):
 
 
 #
-# Common definitions for framebuffer fetch tests.
+# Common test definitions independent of the framebuffer fetch
+# extension.
 #
-common_defs = [{'extension': 'EXT_shader_framebuffer_fetch',
-
-# Allocate and bind a framebuffer object of the given
+common_defs = [{# Allocate and bind a framebuffer object of the given
 # format and number of samples.
 'bind_fb': lambda fmt, samples = 0:
'fb ms {0} 250 250 {1}'.format(fmt, samples) if samples > 0 
else
@@ -138,11 +137,14 @@ common_defs = [{'extension': 
'EXT_shader_framebuffer_fetch',
 # 'frag_data' and 'last_frag_data' macros defined
 # below to make sure the generated test is valid
 # irrespective of the GLSL version.
-'decl_frag_data': lambda api_version, n = 0, t = 'vec4', p = 
'mediump':
-   '' if api_version < 3.0 and t == 'vec4' and p == 'mediump' 
else
-   p + ' ' + t + ' gl_LastFragData[gl_MaxDrawBuffers];' if 
api_version < 3.0 else
-   'inout ' + p + ' ' + t + ' fcolor;' if n == 0 else
-   'inout ' + p + ' ' + t + ' fcolor[{0}];'.format(n),
+'decl_frag_data': lambda api_version, layout, n = 0, \
+ t = 'vec4', p = 'mediump':
+   '' if api_version < 3.0 and not layout and t == 'vec4' \
+   and p == 'mediump' else
+   layout + ' ' + p + ' ' + t + ' 
gl_LastFragData[gl_MaxDrawBuffers];' \
+   if api_version < 3.0 
else
+   layout + ' inout ' + p + ' ' + t + ' fcolor;' if n == 0 else
+   layout + ' inout ' + p + ' ' + t + ' 
fcolor[{0}];'.format(n),
 
 'frag_data': lambda api_version, i = -1:
'gl_FragData[{0}]'.format(max(0, i)) if api_version < 3.0 
else
@@ -155,6 +157,18 @@ common_defs = [{'extension': 
'EXT_shader_framebuffer_fetch',
'fcolor'}]
 
 
+#
+# Common test definitions for all supported extensions.
+#
+all_defs = list(product(common_defs,
+   [{'extension': 'EXT_shader_framebuffer_fetch',
+ 'layout': '',
+ 'barrier': ''},
+{'extension': 
'EXT_shader_framebuffer_fetch_non_coherent',
+ 'layout': 'layout(noncoherent)',
+ 'barrier': 'fbfetch barrier'}]))
+
+
 def main():
 """Main function."""
 
@@ -179,7 +193,7 @@ def main():
 {
 color = gl_LastFragData[0];
 }
-""", product(common_defs,
+""", product(all_defs,
  [{'name': 'negative-gl_LastFragData-gles3',
'shader_stage': 'frag'}]))
 
@@ -203,7 +217,7 @@ def main():
 {
 gl_LastFragData[0] = vec4(1.0);
 }
-""", product(common_defs,
+""", product(all_defs,
  [{'name': 'negative-gl_LastFragData-write-gles2',
'shader_stage': 'frag'}]))
 
@@ -228,7 +242,7 @@ def main():
 {
 color += vec4(0.5);
 }
-""", product(common_defs,
+""", product(all_defs,
  [{'name': 'negative-inout-fragment-output-gles2',
'shader_stage': 'frag'}]))
 
@@ -253,7 +267,7 @@ def main():
 {
 gl_FragDepth += 0.5;
 }
-""", product(common_defs,
+""", product(all_defs,
  [{'name': 'negative-inout-gl_FragDepth-gles3',
'shader_stage': 'frag'}]))
 
@@ -277,7 +291,7 @@ def main():
 void main()
 {
 }
-""", product(common_defs,
+""", product(all_defs,
  [{'name': 'negative-inout-vertex-output-gles3',
'shader_stage': 'vert'}]))
 
@@ -299,7 +313,7 @@ def main():
 #version ${'300 es' if api_version >= 3.0 else '100'}
 #extension GL_${extension} : enable
 
-${decl_frag_data(api_version)}
+${decl_frag_data(api_version, layout)}
 
 void main()
 {
@@ -312,7 +326,9 @@ def main():
 
 clear color 0.0 0.0 1.0 0.0
 clear
+${barrier}
 draw rect -1 -1 2 2
+${barrier}
 draw rect -1 

[Piglit] [PATCH 4/7] EXT_shader_framebuffer_fetch: Pass output type and precision to decl_frag_data macro.

2018-02-14 Thread Francisco Jerez
This allows using the decl_frag_data macro in more places which were
currently using an open-coded inout declaration, in the interest of
simplifying the conversion to EXT_shader_framebuffer_fetch_non_coherent
which requires the specification of a layout qualifier in all
framebuffer fetch output declarations.
---
 .../gen_shader_framebuffer_fetch_tests.py  | 73 +++---
 1 file changed, 38 insertions(+), 35 deletions(-)

diff --git a/generated_tests/gen_shader_framebuffer_fetch_tests.py 
b/generated_tests/gen_shader_framebuffer_fetch_tests.py
index f7e148b39..201d2cec9 100644
--- a/generated_tests/gen_shader_framebuffer_fetch_tests.py
+++ b/generated_tests/gen_shader_framebuffer_fetch_tests.py
@@ -138,10 +138,11 @@ common_defs = [{'extension': 
'EXT_shader_framebuffer_fetch',
 # 'frag_data' and 'last_frag_data' macros defined
 # below to make sure the generated test is valid
 # irrespective of the GLSL version.
-'decl_frag_data': lambda api_version, n = 0:
-   '' if api_version < 3.0 else
-   'inout highp vec4 fcolor;' if n == 0 else
-   'inout highp vec4 fcolor[{0}];'.format(n),
+'decl_frag_data': lambda api_version, n = 0, t = 'vec4', p = 
'mediump':
+   '' if api_version < 3.0 and t == 'vec4' and p == 'mediump' 
else
+   p + ' ' + t + ' gl_LastFragData[gl_MaxDrawBuffers];' if 
api_version < 3.0 else
+   'inout ' + p + ' ' + t + ' fcolor;' if n == 0 else
+   'inout ' + p + ' ' + t + ' fcolor[{0}];'.format(n),
 
 'frag_data': lambda api_version, i = -1:
'gl_FragData[{0}]'.format(max(0, i)) if api_version < 3.0 
else
@@ -360,11 +361,7 @@ def main():
 #extension GL_${extension} : enable
 
 ${'in' if api_version >= 3.0 else 'varying'} highp vec4 vcolor;
-${decl_frag_data(api_version)}
-
-%if api_version < 3.0 and precision:
-${precision} vec4 gl_LastFragData[gl_MaxDrawBuffers];
-%endif
+${decl_frag_data(api_version, p=precision)}
 
 void main()
 {
@@ -404,21 +401,19 @@ def main():
 """, product(common_defs,
  [{'name': 'nonuniform-'}],
  [{'name': 'ss-gles2', 'api_version': 2.0,
-   'samples': 0, 'precision': ''},
+   'samples': 0, 'precision': 'mediump'},
   {'name': 'ss-gles2-redecl-highp', 'api_version': 2.0,
'samples': 0, 'precision': 'highp'},
-  {'name': 'ss-gles2-redecl-mediump', 'api_version': 2.0,
-   'samples': 0, 'precision': 'mediump'},
   {'name': 'ss-gles2-redecl-lowp', 'api_version': 2.0,
'samples': 0, 'precision': 'lowp'},
   {'name': 'ss-gles3', 'api_version': 3.0,
-   'samples': 0, 'precision': ''},
+   'samples': 0, 'precision': 'mediump'},
   {'name': 'ms2-gles3', 'api_version': 3.0,
-   'samples': 2, 'precision': ''},
+   'samples': 2, 'precision': 'mediump'},
   {'name': 'ms8-gles3', 'api_version': 3.0,
-   'samples': 8, 'precision': ''},
+   'samples': 8, 'precision': 'mediump'},
   {'name': 'ms16-gles3', 'api_version': 3.0,
-   'samples': 16, 'precision': ''}]))
+   'samples': 16, 'precision': 'mediump'}]))
 
 #
 # Test basic framebuffer fetch functionality in combination with
@@ -437,11 +432,12 @@ def main():
 #extension GL_${extension} : enable
 
 uniform sampler2D s;
-inout highp vec4 fcolor;
+${decl_frag_data(api_version)}
 
 void main()
 {
-fcolor += texelFetch(s, ivec2(gl_FragCoord), 0) / 4.0;
+${frag_data(api_version)} = ${last_frag_data(api_version)} +
+texelFetch(s, ivec2(gl_FragCoord), 0) 
/ 4.0;
 }
 
 [test]
@@ -501,16 +497,19 @@ def main():
 #extension GL_${extension} : enable
 
 in highp vec4 vcolor;
-inout highp vec4 fcolor;
+${decl_frag_data(api_version)}
 
 void main()
 {
 // The condition makes sure that the discard branch is
 // taken for the top and right quadrants during the second
 // overdraw.
-if (fcolor.x <= 0.45 && fcolor.y < 0.45)
-fcolor += vec4(vcolor.x >= 0.5 ? 0.5 : 0.1,
-   vcolor.y >= 0.5 ? 0.5 : 0.1, 0.0, 0.0);
+if (${last_frag_data(api_version)}.x <= 0.45 &&
+${last_frag_data(api_version)}.y < 0.45)
+${frag_data(api_version)} = ${last_frag_data(api_version)} +
+vec4(vcolor.x >= 0.5 ? 0.5 : 0.1,
+   

Re: [Piglit] [PATCH] AMD_performance_monitor: add VC4 specific tests

2018-02-14 Thread Boris Brezillon
On Fri, 09 Feb 2018 21:12:20 +
Eric Anholt  wrote:

> Boris Brezillon  writes:
> 
> > From: Boris Brezillon 
> >
> > This adds a specific test for the VC4 GPU.
> > Right now, it only checks that FEP-valid-quads and
> > QPU-total-clk-cycles-waiting-TMU are consistent after executing well
> > know operations (draw a rectangle or a texture).
> >
> > More tests will be added over time.  
> 
> I'd still like to put together some tests of state management (to catch
> things like the flushing bugs we had in the first revs), but this seems
> like a good start.
> 
> > +#define FEP_VALID_QUADS_REF_VAL6440
> > +
> > +static void draw_rect(const struct perfmon_test *test)
> > +{
> > +   piglit_draw_rect(-1, -1, 3, 3);
> > +}
> > +
> > +static void draw_tex(const struct perfmon_test *test)
> > +{
> > +   GLuint tex;
> > +
> > +   tex = piglit_rgbw_texture(GL_RGBA, 64, 64, false, true,
> > + GL_UNSIGNED_BYTE);
> > +   verify(piglit_check_gl_error(GL_NO_ERROR));
> > +
> > +   glEnable(GL_TEXTURE_2D);
> > +   glBindTexture(GL_TEXTURE_2D, tex);
> > +   piglit_draw_rect_tex(-1, -1, 2, 2, 0, 0, 1, 1);
> > +   glDisable(GL_TEXTURE_2D);
> > +   glDeleteTextures(1, );
> > +}
> > +
> > +static bool fep_valid_quads_check_res(uint64_t res)
> > +{
> > +   return res == FEP_VALID_QUADS_REF_VAL;  
> 
> We should probably have the number of valid quads either be some math
> based on the config.window_width/height, or explicitly set the
> window_width/height so it's not dependent on whatever defaults the
> framework chooses.
> 
> The valid quads is a pretty magic value because we're drawing this:
> 
> +---+
> |  /|
> | / |
> |/  |
> +---+
> 
> so some of the 2x2 quads get drawn twice along the middle edge between
> the tris.  If we drew the triangle outside of the window:
> 
> +---+---+
> |   |  /
> |   | /
> |   |/
> +---/
> |  /
> | /
> |/
> +
> 
> with piglit_draw_rect(-1, -2, 4, 4), then I don't think any of the quads
> would be drawn twice, and the magic REF_VAL would become
> align(window_width, 2) * align(window_height, 2) / 4.

So I picked win.height=width=64 and I have a mismatch. According to
your formula I should have fep_valid_quads=1024, but I get 1040.


-- 
Boris Brezillon, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
http://bootlin.com
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] gl-4.3-get_glsl_versions: new tests of GL_NUM_SHADING_LANGUAGE_VERSIONS

2018-02-14 Thread Andriy Khulap
Tested-by: Andriy.Khulap 

With the corresponding mesa patch (a553c54abf "mesa: add glsl version query
(v4)") the test passes.
Without that patch fails with error message:
Unexpected GL error: GL_INVALID_ENUM 0x500
(Error at  ***/piglit/tests/spec/gl-4.3/get_glsl_versions.c:43)

On Tue, Feb 13, 2018 at 10:26 PM, Brian Paul  wrote:

> and glGetStringi(GL_SHADING_LANGUAGE_VERSION, i) queries in GL 4.3.
> Until recently, these queries were not implemented in Mesa.
> ---
>  tests/all.py  |  5 +++
>  tests/spec/CMakeLists.txt |  1 +
>  tests/spec/gl-4.3/CMakeLists.gl.txt   | 13 ++
>  tests/spec/gl-4.3/CMakeLists.txt  |  1 +
>  tests/spec/gl-4.3/get_glsl_versions.c | 76 ++
> +
>  5 files changed, 96 insertions(+)
>  create mode 100644 tests/spec/gl-4.3/CMakeLists.gl.txt
>  create mode 100644 tests/spec/gl-4.3/CMakeLists.txt
>  create mode 100644 tests/spec/gl-4.3/get_glsl_versions.c
>
> diff --git a/tests/all.py b/tests/all.py
> index 310161a..8236d5a 100644
> --- a/tests/all.py
> +++ b/tests/all.py
> @@ -1208,6 +1208,11 @@ 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'])
> +
> +with profile.test_list.group_manager(
> +PiglitGLTest,
>  grouptools.join('spec', '!opengl 4.4')) as g:
>  g(['tex-errors'])
>
> diff --git a/tests/spec/CMakeLists.txt b/tests/spec/CMakeLists.txt
> index 1f9d810..e57e8d7 100644
> --- a/tests/spec/CMakeLists.txt
> +++ b/tests/spec/CMakeLists.txt
> @@ -134,6 +134,7 @@ add_subdirectory (gl-3.0)
>  add_subdirectory (gl-3.1)
>  add_subdirectory (gl-3.2)
>  add_subdirectory (gl-3.3)
> +add_subdirectory (gl-4.3)
>  add_subdirectory (gl-4.4)
>  add_subdirectory (gl-4.5)
>  add_subdirectory (gles-2.0)
> diff --git a/tests/spec/gl-4.3/CMakeLists.gl.txt b/tests/spec/gl-4.3/
> CMakeLists.gl.txt
> new file mode 100644
> index 000..4d81c84
> --- /dev/null
> +++ b/tests/spec/gl-4.3/CMakeLists.gl.txt
> @@ -0,0 +1,13 @@
> +include_directories(
> +   ${GLEXT_INCLUDE_DIR}
> +   ${OPENGL_INCLUDE_PATH}
> +)
> +
> +link_libraries (
> +   piglitutil_${piglit_target_api}
> +   ${OPENGL_gl_LIBRARY}
> +)
> +
> +piglit_add_executable (gl-4.3-get_glsl_versions get_glsl_versions.c)
> +
> +# vim: ft=cmake:
> diff --git a/tests/spec/gl-4.3/CMakeLists.txt b/tests/spec/gl-4.3/
> CMakeLists.txt
> new file mode 100644
> index 000..144a306
> --- /dev/null
> +++ b/tests/spec/gl-4.3/CMakeLists.txt
> @@ -0,0 +1 @@
> +piglit_include_target_api()
> diff --git a/tests/spec/gl-4.3/get_glsl_versions.c
> b/tests/spec/gl-4.3/get_glsl_versions.c
> new file mode 100644
> index 000..4a6d42d
> --- /dev/null
> +++ b/tests/spec/gl-4.3/get_glsl_versions.c
> @@ -0,0 +1,76 @@
> +/*
> + * Copyright 2017 VMware, Inc.
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining a
> + * copy of this software and associated documentation files (the
> "Software"),
> + * to deal in the Software without restriction, including without
> limitation
> + * on the rights to use, copy, modify, merge, publish, distribute, sub
> + * license, 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
> + * NON-INFRINGEMENT.  IN NO EVENT SHALL AUTHORS AND/OR THEIR SUPPLIERS
> + * 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.
> + */
> +
> +
> +#include "piglit-util-gl.h"
> +#include "minmax-test.h"
> +
> +
> +PIGLIT_GL_TEST_CONFIG_BEGIN
> +   config.supports_gl_core_version = 43;
> +   config.khr_no_error_support = PIGLIT_NO_ERRORS;
> +PIGLIT_GL_TEST_CONFIG_END
> +
> +
> +void
> +piglit_init(int argc, char *argv[])
> +{
> +   GLint num = -1;
> +   GLint i;
> +
> +   glGetIntegerv(GL_NUM_SHADING_LANGUAGE_VERSIONS, );
> +   if (!piglit_check_gl_error(GL_NO_ERROR)) {
> +   piglit_report_result(PIGLIT_FAIL);
> +   }
> +   if (num < 1) {
> +   printf("Invalid number of shading language versions\n");
> +   piglit_report_result(PIGLIT_FAIL);
> +   }
> +
> +   for (i = 0; i < num; i++) {
> +   const GLubyte *v = glGetStringi(GL_SHADING_LANGUAGE_VERSION,
> i);
> +   if (!v) {
> +