Re: [Piglit] [PATCH 2/2] glx: add test for GLX_ARB_create_context_no_error

2019-02-08 Thread Eric Anholt
Adam Jackson  writes:

> On Thu, 2019-02-07 at 14:53 -0800, Eric Anholt wrote:
>> Adam Jackson  writes:
>> 
>> > +static void
>> > +fold_results(enum piglit_result *a, enum piglit_result b)
>> > +{
>> > +  if (*a == PIGLIT_FAIL || b == PIGLIT_FAIL)
>> > +  *a = PIGLIT_FAIL;
>> > +  else if (*a == PIGLIT_PASS || b == PIGLIT_PASS)
>> > +  *a = PIGLIT_PASS;
>> > +  else
>> > +  *a = PIGLIT_SKIP;
>> > +}
>> 
>> This is just piglit_merge_result()
>
> Indeed.
>
>> > +static enum piglit_result check_no_error(bool flag, bool debug, bool 
>> > robust)
>> > +{
>> > +  int ctx_flags = 0;
>> > +  ctx_flags |= debug ? GLX_CONTEXT_DEBUG_BIT_ARB : 0;
>> > +  ctx_flags |= robust ? GLX_CONTEXT_ROBUST_ACCESS_BIT_ARB : 0;
>> > +  const int attribs[] = {
>> > +  GLX_CONTEXT_MAJOR_VERSION_ARB, 2,
>> > +  GLX_CONTEXT_MINOR_VERSION_ARB, 0,
>> > +  GLX_CONTEXT_OPENGL_NO_ERROR_ARB, flag,
>> > +  GLX_CONTEXT_FLAGS_ARB, ctx_flags,
>> > +  None
>> > +  };
>> > +  static bool is_dispatch_init = false;
>> > +  GLXContext ctx;
>> > +  enum piglit_result pass = PIGLIT_SKIP;
>> > +
>> > +  printf("info: no_error=%s, debug=%s, robustness=%s\n",
>> > + BOOLSTR(flag), BOOLSTR(debug), BOOLSTR(robust));
>> > +
>> > +  ctx = glXCreateContextAttribsARB(dpy, fbconfig, NULL, True, attribs);
>> > +  XSync(dpy, 0);
>> 
>> Needs to check that we have robusness or debug and skip if they're
>> missing.
>
> There's not a separate extension string for debug, it's part of
> GLX_ARB_create_context. And asking for a debug context is allowed to be
> a no-op, so you can't even query the context bit afterward. True enough
> about robustness though.
>
>> > +  /* The number of texture units is a small, unsigned number. Craft an
>> > +   * illegal call by using a very large number that should fail on any
>> > +   * OpenGL implementation in practice.
>> > +   */
>> > +  glActiveTexture(-1);
>> > +  if (glGetError() != 0 && flag) {
>> > +  printf("error: error observed with KHR_no_error enabled\n");
>> > +  pass = PIGLIT_FAIL;
>> > +  goto done;
>> > +  }
>> 
>> I'm a reluctant to trigger undefined behavior that allows anything
>> including application termination in a testcase.
>
> Yeah, this seems like a mistake. Removed.
>
>> > +int main(int argc, char **argv)
>> > +{
>> > +  enum piglit_result pass = PIGLIT_SKIP;
>> > +
>> > +  GLX_ARB_create_context_setup();
>> > +  piglit_require_glx_extension(dpy, "GLX_ARB_create_context_no_error");
>> > +
>> > +  /* "Control group": Check that errors are indeed generated without
>> > +   * KHR_no_error enabled. */
>> > +  fold_results(, check_no_error(false, false, false));
>> > +  fold_results(, check_no_error(false, false, false));
>> > +  fold_results(, check_no_error(false, true, false));
>> > +  fold_results(, check_no_error(false, true, false));
>> 
>> We don't actually verify that errors are generated without KHR_no_error
>> -- the checks are under if (flag).  However, the rest of piglit covers
>> that, so let's just delete these cases and drop the first arg to
>> check_no_error.
>
> Will do.
>
>> > +
>> > +  /* Check that KHR_no_error gets enabled and its interaction with debug 
>> > and
>> > +   * robustness context flags. */
>> > +  fold_results(, check_no_error(true, false, false));
>> > +  fold_results(, check_no_error(true, false, false));
>> > +  fold_results(, check_no_error(true, true, false));
>> > +  fold_results(, check_no_error(true, true, false));
>> > +  fold_results(, check_no_error(true, false, true));
>> > +  fold_results(, check_no_error(true, true, true));
>> 
>> Looks like there are 2 duplicated cases here.
>
> Will do this too.
>
> The above review seems to apply equally to the EGL test (which also has
> at least one logic error). Will resubmit both with the above feedback
> addressed.

Sounds good!


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


[Piglit] [PATCH 2/2] glx: add test for GLX_ARB_create_context_no_error

2019-02-08 Thread Adam Jackson
From: Grigori Goronzy 

Same as the EGL test, but without testing GLES contexts.
---
 .../glx_arb_create_context/CMakeLists.gl.txt  |   1 +
 tests/spec/glx_arb_create_context/common.h|   1 +
 tests/spec/glx_arb_create_context/no-error.c  | 133 ++
 3 files changed, 135 insertions(+)
 create mode 100644 tests/spec/glx_arb_create_context/no-error.c

diff --git a/tests/spec/glx_arb_create_context/CMakeLists.gl.txt 
b/tests/spec/glx_arb_create_context/CMakeLists.gl.txt
index f5c5e7cbc..91a87f95d 100644
--- a/tests/spec/glx_arb_create_context/CMakeLists.gl.txt
+++ b/tests/spec/glx_arb_create_context/CMakeLists.gl.txt
@@ -41,6 +41,7 @@ IF(PIGLIT_BUILD_GLX_TESTS)
piglit_add_executable (glx-create-context-valid-attribute-empty 
valid-attribute-empty.c common.c)
piglit_add_executable (glx-create-context-valid-attribute-null 
valid-attribute-null.c common.c)
piglit_add_executable (glx-create-context-valid-flag-forward-compatible 
valid-flag-forward-compatible.c common.c)
+   piglit_add_executable (glx-create-context-no-error no-error.c common.c)
 ENDIF(PIGLIT_BUILD_GLX_TESTS)
 
 # vim: ft=cmake:
diff --git a/tests/spec/glx_arb_create_context/common.h 
b/tests/spec/glx_arb_create_context/common.h
index 2e58b16db..e1ac28e6f 100644
--- a/tests/spec/glx_arb_create_context/common.h
+++ b/tests/spec/glx_arb_create_context/common.h
@@ -30,6 +30,7 @@ extern GLXFBConfig fbconfig;
 extern XVisualInfo *visinfo;
 extern Window win;
 extern GLXWindow glxWin;
+extern int glx_error_code;
 
 extern bool parse_version_string(const char *string, int *major, int *minor);
 
diff --git a/tests/spec/glx_arb_create_context/no-error.c 
b/tests/spec/glx_arb_create_context/no-error.c
new file mode 100644
index 0..56cd0f0be
--- /dev/null
+++ b/tests/spec/glx_arb_create_context/no-error.c
@@ -0,0 +1,133 @@
+/* Copyright 2017 Grigori Goronzy 
+ *
+ * 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.
+ */
+#include "piglit-util.h"
+#include "piglit-util-gl.h"
+#include "piglit-glx-util.h"
+#include "common.h"
+
+#define BOOLSTR(x) ((x) ? "yes" : "no")
+
+static enum piglit_result check_no_error(bool debug, bool robust)
+{
+   int ctx_flags = 0;
+   ctx_flags |= debug ? GLX_CONTEXT_DEBUG_BIT_ARB : 0;
+   ctx_flags |= robust ? GLX_CONTEXT_ROBUST_ACCESS_BIT_ARB : 0;
+   const int attribs[] = {
+   GLX_CONTEXT_MAJOR_VERSION_ARB, 2,
+   GLX_CONTEXT_MINOR_VERSION_ARB, 0,
+   GLX_CONTEXT_OPENGL_NO_ERROR_ARB, 1,
+   GLX_CONTEXT_FLAGS_ARB, ctx_flags,
+   None
+   };
+   static bool is_dispatch_init = false;
+   GLXContext ctx;
+   enum piglit_result pass = PIGLIT_SKIP;
+
+   printf("info: debug=%s, robustness=%s\n", BOOLSTR(debug), 
BOOLSTR(robust));
+
+   if (robust && !piglit_is_glx_extension_supported(dpy, 
"GLX_ARB_create_context_robustness")) {
+   printf("info: GLX_ARB_create_context_robustness not 
supported\n");
+   pass = PIGLIT_SKIP;
+   goto done;
+   }
+
+   ctx = glXCreateContextAttribsARB(dpy, fbconfig, NULL, True, attribs);
+   XSync(dpy, 0);
+
+   if (ctx == NULL) {
+   if (glx_error_code != 0) {
+   if (debug || robust) {
+   /* KHR_no_error doesn't allow the no error mode 
to be enabled
+* with KHR_debug or ARB_robustness, so context 
creation is
+* expected to fail in these cases.
+*/
+   printf("info: context creation failed 
(expected)\n");
+   pass = PIGLIT_PASS;
+   goto done;
+   }
+
+   /* Most likely the API/version is not supported. */
+   pass = PIGLIT_SKIP;
+

[Piglit] [PATCH 1/2] egl: Add test for EGL_KHR_create_context_no_error

2019-02-08 Thread Adam Jackson
From: Grigori Goronzy 

This test verifies context creation with the
EGL_KHR_create_context_no_error extension, which includes interaction
with debug and robustness flags. The test also verifies that the
KHR_no_error mode is successfully enabled with a check of context
flags. Both GL 2.0 and GLES2 are tested.
---
 .../CMakeLists.gles2.txt  |   3 +
 .../spec/egl_khr_create_context/no-error.c| 186 ++
 2 files changed, 189 insertions(+)
 create mode 100644 tests/egl/spec/egl_khr_create_context/no-error.c

diff --git a/tests/egl/spec/egl_khr_create_context/CMakeLists.gles2.txt 
b/tests/egl/spec/egl_khr_create_context/CMakeLists.gles2.txt
index 23bf145f2..a27ef2da2 100644
--- a/tests/egl/spec/egl_khr_create_context/CMakeLists.gles2.txt
+++ b/tests/egl/spec/egl_khr_create_context/CMakeLists.gles2.txt
@@ -19,4 +19,7 @@ piglit_add_executable (egl-create-context-invalid-gl-version 
invalid-gl-version.
 piglit_add_executable (egl-create-context-verify-gl-flavor verify-gl-flavor.c 
common.c)
 piglit_add_executable (egl-create-context-valid-flag-debug-gles 
valid-flag-debug.c common.c)
 
+# Tests that use ES 2 and Desktop GL.
+piglit_add_executable (egl-create-context-no-error no-error.c common.c)
+
 # vim: ft=cmake:
diff --git a/tests/egl/spec/egl_khr_create_context/no-error.c 
b/tests/egl/spec/egl_khr_create_context/no-error.c
new file mode 100644
index 0..a9c884eee
--- /dev/null
+++ b/tests/egl/spec/egl_khr_create_context/no-error.c
@@ -0,0 +1,186 @@
+/* Copyright 2017 Grigori Goronzy 
+ *
+ * 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.
+ */
+
+#include 
+#include 
+
+#include "piglit-util-gl.h"
+#include "piglit-util-egl.h"
+#include "common.h"
+
+#define BOOLSTR(x) ((x) ? "yes" : "no")
+
+static void
+check_extension(EGLint mask)
+{
+   if (!EGL_KHR_create_context_setup(mask))
+   piglit_report_result(PIGLIT_SKIP);
+
+   piglit_require_egl_extension(egl_dpy, 
"EGL_KHR_create_context_no_error");
+
+   EGL_KHR_create_context_teardown();
+}
+
+static enum piglit_result
+check_no_error(EGLenum api, bool debug, bool robust)
+{
+   static bool is_dispatch_init = false;
+   enum piglit_result pass = PIGLIT_SKIP;
+   EGLContext ctx;
+   EGLint attribs[11];
+   size_t ai = 0;
+   GLint context_flags = 0;
+   EGLint mask = (api == EGL_OPENGL_API) ? EGL_OPENGL_BIT : 
EGL_OPENGL_ES2_BIT;
+
+   printf("info: %s debug=%s robustness=%s\n",
+  (api == EGL_OPENGL_API) ? "OpenGL" : "OpenGL ES",
+  BOOLSTR(debug), BOOLSTR(robust));
+
+   if (!EGL_KHR_create_context_setup(mask))
+   goto out;
+
+   if (eglBindAPI(api) != EGL_TRUE)
+   goto out;
+
+   if (robust &&
+   !piglit_is_egl_extension_supported(egl_dpy,
+  
"EGL_EXT_create_context_robustness")) {
+   printf("info: EGL_EXT_create_context_robustness not 
supported\n");
+   goto out;
+   }
+
+   if (api == EGL_OPENGL_ES_API) {
+   attribs[ai++] = EGL_CONTEXT_CLIENT_VERSION;
+   attribs[ai++] = 2;
+   }
+   if (debug || robust) {
+   EGLint flags = 0;
+   flags |= debug ? EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR : 0;
+   flags |= robust ? EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR : 0;
+   attribs[ai++] = EGL_CONTEXT_FLAGS_KHR;
+   attribs[ai++] = flags;
+   }
+   /* Always use OpenGL 2.0 or OpenGL ES 2.0 to keep this test reasonably
+* simple; there are enough variants as-is.
+*/
+   attribs[ai++] = EGL_CONTEXT_MAJOR_VERSION_KHR;
+   attribs[ai++] = 2;
+   attribs[ai++] = EGL_CONTEXT_MINOR_VERSION_KHR;
+   attribs[ai++] = 0;
+   attribs[ai++] = EGL_CONTEXT_OPENGL_NO_ERROR_KHR;
+   attribs[ai++] = EGL_TRUE;
+   attribs[ai++] = EGL_NONE;
+
+   

Re: [Piglit] [PATCH 2/2] glx: add test for GLX_ARB_create_context_no_error

2019-02-08 Thread Adam Jackson
On Thu, 2019-02-07 at 14:53 -0800, Eric Anholt wrote:
> Adam Jackson  writes:
> 
> > +static void
> > +fold_results(enum piglit_result *a, enum piglit_result b)
> > +{
> > +   if (*a == PIGLIT_FAIL || b == PIGLIT_FAIL)
> > +   *a = PIGLIT_FAIL;
> > +   else if (*a == PIGLIT_PASS || b == PIGLIT_PASS)
> > +   *a = PIGLIT_PASS;
> > +   else
> > +   *a = PIGLIT_SKIP;
> > +}
> 
> This is just piglit_merge_result()

Indeed.

> > +static enum piglit_result check_no_error(bool flag, bool debug, bool 
> > robust)
> > +{
> > +   int ctx_flags = 0;
> > +   ctx_flags |= debug ? GLX_CONTEXT_DEBUG_BIT_ARB : 0;
> > +   ctx_flags |= robust ? GLX_CONTEXT_ROBUST_ACCESS_BIT_ARB : 0;
> > +   const int attribs[] = {
> > +   GLX_CONTEXT_MAJOR_VERSION_ARB, 2,
> > +   GLX_CONTEXT_MINOR_VERSION_ARB, 0,
> > +   GLX_CONTEXT_OPENGL_NO_ERROR_ARB, flag,
> > +   GLX_CONTEXT_FLAGS_ARB, ctx_flags,
> > +   None
> > +   };
> > +   static bool is_dispatch_init = false;
> > +   GLXContext ctx;
> > +   enum piglit_result pass = PIGLIT_SKIP;
> > +
> > +   printf("info: no_error=%s, debug=%s, robustness=%s\n",
> > +  BOOLSTR(flag), BOOLSTR(debug), BOOLSTR(robust));
> > +
> > +   ctx = glXCreateContextAttribsARB(dpy, fbconfig, NULL, True, attribs);
> > +   XSync(dpy, 0);
> 
> Needs to check that we have robusness or debug and skip if they're
> missing.

There's not a separate extension string for debug, it's part of
GLX_ARB_create_context. And asking for a debug context is allowed to be
a no-op, so you can't even query the context bit afterward. True enough
about robustness though.

> > +   /* The number of texture units is a small, unsigned number. Craft an
> > +* illegal call by using a very large number that should fail on any
> > +* OpenGL implementation in practice.
> > +*/
> > +   glActiveTexture(-1);
> > +   if (glGetError() != 0 && flag) {
> > +   printf("error: error observed with KHR_no_error enabled\n");
> > +   pass = PIGLIT_FAIL;
> > +   goto done;
> > +   }
> 
> I'm a reluctant to trigger undefined behavior that allows anything
> including application termination in a testcase.

Yeah, this seems like a mistake. Removed.

> > +int main(int argc, char **argv)
> > +{
> > +   enum piglit_result pass = PIGLIT_SKIP;
> > +
> > +   GLX_ARB_create_context_setup();
> > +   piglit_require_glx_extension(dpy, "GLX_ARB_create_context_no_error");
> > +
> > +   /* "Control group": Check that errors are indeed generated without
> > +* KHR_no_error enabled. */
> > +   fold_results(, check_no_error(false, false, false));
> > +   fold_results(, check_no_error(false, false, false));
> > +   fold_results(, check_no_error(false, true, false));
> > +   fold_results(, check_no_error(false, true, false));
> 
> We don't actually verify that errors are generated without KHR_no_error
> -- the checks are under if (flag).  However, the rest of piglit covers
> that, so let's just delete these cases and drop the first arg to
> check_no_error.

Will do.

> > +
> > +   /* Check that KHR_no_error gets enabled and its interaction with debug 
> > and
> > +* robustness context flags. */
> > +   fold_results(, check_no_error(true, false, false));
> > +   fold_results(, check_no_error(true, false, false));
> > +   fold_results(, check_no_error(true, true, false));
> > +   fold_results(, check_no_error(true, true, false));
> > +   fold_results(, check_no_error(true, false, true));
> > +   fold_results(, check_no_error(true, true, true));
> 
> Looks like there are 2 duplicated cases here.

Will do this too.

The above review seems to apply equally to the EGL test (which also has
at least one logic error). Will resubmit both with the above feedback
addressed.

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


[Piglit] [PATCH] arb_program_interface_query: corrected AoA's index variable expectation

2019-02-08 Thread Andres Gomez
Naming conventions, from the GL_ARB_program_interface_query extension:

 "   * For an active variable declared as an array of an aggregate
   data type (structures or arrays), a separate entry will be
   generated for each active array element, unless noted
   immediately below.  The name of each entry is formed by
   concatenating the name of the array, the "[" character, an
   integer identifying the element number, and the "]" character.
   These enumeration rules are applied recursively, treating each
   enumerated array element as a separate active variable."

Cc: Timothy Arceri 
Cc: Martin Peres 
Signed-off-by: Andres Gomez 
---
 .../spec/arb_program_interface_query/getprogramresourceindex.c  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/spec/arb_program_interface_query/getprogramresourceindex.c 
b/tests/spec/arb_program_interface_query/getprogramresourceindex.c
index 16b38e2d5..2afc9eeb9 100755
--- a/tests/spec/arb_program_interface_query/getprogramresourceindex.c
+++ b/tests/spec/arb_program_interface_query/getprogramresourceindex.c
@@ -167,7 +167,7 @@ static const struct subtest_index_t index_subtests[] = {
{   vs_aofa,  GL_PROGRAM_INPUT,  "vs_input2", 
false, -1, GL_NO_ERROR },
{   vs_aofa,  GL_PROGRAM_INPUT,   "vs_input2[0]",  
true, -1, GL_NO_ERROR },
{   vs_aofa,  GL_PROGRAM_INPUT,"vs_input2[0][0]",  
true, -1, GL_NO_ERROR },
-   {   vs_aofa,  GL_PROGRAM_INPUT,"vs_input2[1][0]", 
false, -1, GL_NO_ERROR },
+   {   vs_aofa,  GL_PROGRAM_INPUT,"vs_input2[1][0]",  
true, -1, GL_NO_ERROR },
{   vs_aofa,  GL_PROGRAM_INPUT,"vs_input2[0][1]", 
false, -1, GL_NO_ERROR },
{vs_sub,  GL_VERTEX_SUBROUTINE,"vss",  
true, -1, GL_NO_ERROR },
{vs_sub,  GL_VERTEX_SUBROUTINE,   "vss2",  
true, -1, GL_NO_ERROR },
-- 
2.20.1

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


[Piglit] [PATCH 2/2] arb_program_interface_query: correct rendez-vous by name matching

2019-02-08 Thread Andres Gomez
Previuosly, this was overlooked asuming that, since they were SSOs, no
inner interface matching check was needed.

From the ARB_separate_shader_objects spec v.25:

  " With separable program objects, interfaces between shader stages
may involve the outputs from one program object and the inputs
from a second program object.  For such interfaces, it is not
possible to detect mismatches at link time, because the programs
are linked separately.  When each such program is linked, all
inputs or outputs interfacing with another program stage are
treated as active.  The linker will generate an executable that
assumes the presence of a compatible program on the other side of
the interface.  If a mismatch between programs occurs, no GL error
will be generated, but some or all of the inputs on the interface
will be undefined."

Cc: Timothy Arceri 
Cc: Tapani Pälli 
Cc: Ilia Mirkin 
Cc: Martin Peres 
Signed-off-by: Andres Gomez 
---
 .../spec/arb_program_interface_query/common.h | 61 ---
 .../getprogramresourceiv.c|  8 +--
 .../resource-query.c  | 48 +++
 3 files changed, 79 insertions(+), 38 deletions(-)

diff --git a/tests/spec/arb_program_interface_query/common.h 
b/tests/spec/arb_program_interface_query/common.h
index 371b0338b..c0a99ea64 100755
--- a/tests/spec/arb_program_interface_query/common.h
+++ b/tests/spec/arb_program_interface_query/common.h
@@ -74,9 +74,11 @@ static const char vs_std[] =
"uniform vs_struct sa[2];\n"
"in vec4 vs_input0;\n"
"in vec4 vs_input1;\n"
+   "out vec4 vs_output1;\n"
"void main() {\n"
"   gl_Position = vs_input0 * vs_test * vs_input1 + sa[0].a[1] +"
" sa[1].a[1];\n"
+   "   vs_output1 = vs_input0;\n"
"}";
 
 const char gs_std[] =
@@ -86,18 +88,38 @@ const char gs_std[] =
"uniform gs_uniform_block {\n"
"   vec4 gs_test;\n"
"};\n"
-   "in vec4 gs_input[3];\n"
-   "out vec4 gs_output0;\n"
+   "in vec4 vs_output1[3];\n"
+   "out vec4 fs_input1;\n"
"void main() {\n"
"   for (int i = 0; i < 6; i++) {\n"
-   "   gl_Position = gs_input[i % 3] *"
+   "   gl_Position = vs_output1[i % 3] *"
" gl_in[i % 3].gl_Position * gs_test;\n"
-   "   gs_output0 = gs_input[0];\n"
+   "   fs_input1 = vs_output1[0];\n"
"   EmitVertex();\n"
"   }\n"
"}\n";
 
 static const char fs_std[] =
+   "#version 150\n"
+   "uniform fs_uniform_block {"
+   "   vec4 fs_color;\n"
+   "   float fs_array[4];\n"
+   "};\n"
+   "uniform fs_array_uniform_block {\n"
+   "   vec4 fs_color;\n"
+   "   float fs_array[4];\n"
+   "} faub[4];\n"
+   "in vec4 vs_output1;\n"
+   "out vec4 fs_output0;\n"
+   "out vec4 fs_output1;\n"
+   "void main() {\n"
+   "fs_output0 = fs_color * vs_output1 * fs_array[2] * \n"
+   " faub[0].fs_array[2] * faub[2].fs_array[2];\n"
+   "fs_output1 = fs_color * vs_output1 * fs_array[3] * \n"
+   " faub[1].fs_array[3] * faub[3].fs_array[3];\n"
+   "}";
+
+static const char fs_in[] =
"#version 150\n"
"uniform fs_uniform_block {"
"   vec4 fs_color;\n"
@@ -296,8 +318,8 @@ static const char tcs_sub[] =
"uniform tcs_uniform_block {\n"
"   vec4 tcs_test;\n"
"};\n"
-   "out vec4 tcs_output[3];\n"
-   "in vec4 tcs_input[gl_MaxPatchVertices];\n"
+   "out vec4 tes_input1[3];\n"
+   "in vec4 vs_output1[gl_MaxPatchVertices];\n"
"patch out vec4 tcs_patch;\n"
"subroutine vec4 tcs_offset();\n"
"subroutine uniform tcs_offset TESS_CONTROL;\n"
@@ -306,7 +328,7 @@ static const char tcs_sub[] =
"   gl_out[gl_InvocationID].gl_Position = tcs_test +"
" gl_in[0].gl_Position *"
" TESS_CONTROL();\n"
-   "   tcs_output[gl_InvocationID] = tcs_input[0] + TESS_CONTROL();\n"
+   "   tes_input1[gl_InvocationID] = vs_output1[0] + TESS_CONTROL();\n"
"}";
 
 static const char tes_sub[] =
@@ -317,15 +339,34 @@ static const char tes_sub[] =
"uniform tes_uniform_block {\n"
"   vec4 tes_test;\n"
"};\n"
-   "out vec4 tes_output[1];\n"
-   "in vec4 tes_input[gl_MaxPatchVertices];\n"
+   "out vec4 tes_output1;\n"
+   "in vec4 vs_output1[gl_MaxPatchVertices];\n"
+   "subroutine vec4 tes_offset();\n"
+   "subroutine uniform tes_offset TESS_EVALUATION;\n"
+   "subroutine (tes_offset) vec4 tess() { return vec4(1, 0, 0, 0); }\n"
+   "void main() {\n"
+   "   gl_Position = tes_test + gl_in[0].gl_Position +"
+   

[Piglit] [PATCH 1/2] arb_program_interface_query: correct tests table indentation

2019-02-08 Thread Andres Gomez
Cc: Timothy Arceri 
Cc: Martin Peres 
Signed-off-by: Andres Gomez 
---
 tests/spec/arb_program_interface_query/resource-query.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/spec/arb_program_interface_query/resource-query.c 
b/tests/spec/arb_program_interface_query/resource-query.c
index a0bc3b700..bf60dde93 100755
--- a/tests/spec/arb_program_interface_query/resource-query.c
+++ b/tests/spec/arb_program_interface_query/resource-query.c
@@ -391,12 +391,12 @@ static const struct subtest_t subtests[] = {
  ST( 1,  4, -1, -1,  vs_sub,NULL,NULL,  gs_sub,NULL,   NULL, 
GL_GEOMETRY_SUBROUTINE, "", st_r_gs_sub),
  ST( 1,  4, -1, -1,  vs_sub,NULL,NULL,  gs_sub,  fs_sub,   NULL, 
GL_FRAGMENT_SUBROUTINE, "", st_r_fs_sub),
  ST( 1,  4, -1, -1,NULL,NULL,NULL,NULL,NULL, cs_sub, 
GL_COMPUTE_SUBROUTINE, "", st_r_cs_sub),
- ST( 1,  5, -1, -1,  vs_sub,tcs_sub, NULL,NULL,NULL,   NULL, 
GL_TESS_CONTROL_SUBROUTINE, "", st_r_tcs_sub),
+ ST( 1,  5, -1, -1,  vs_sub, tcs_sub,NULL,NULL,NULL,   NULL, 
GL_TESS_CONTROL_SUBROUTINE, "", st_r_tcs_sub),
  ST( 1,  5, -1, -1,  vs_sub,NULL, tes_sub,NULL,NULL,   NULL, 
GL_TESS_EVALUATION_SUBROUTINE, "", st_r_tes_sub),
  ST( 1,  7, -1,  2,  vs_sub,NULL,NULL,NULL,NULL,   NULL, 
GL_VERTEX_SUBROUTINE_UNIFORM, "", st_r_vs_sub_uni),
  ST( 1,  9, -1,  1,  vs_sub,NULL,NULL,  gs_sub,NULL,   NULL, 
GL_GEOMETRY_SUBROUTINE_UNIFORM, "", st_r_gs_sub_uni),
  ST( 1,  9, -1,  1,  vs_sub,NULL,NULL,  gs_sub,  fs_sub,   NULL, 
GL_FRAGMENT_SUBROUTINE_UNIFORM, "", st_r_fs_sub_uni),
- ST( 1, 13, -1,  1,  vs_sub,tcs_sub, NULL,NULL,NULL,   NULL, 
GL_TESS_CONTROL_SUBROUTINE_UNIFORM, "", st_r_tcs_sub_uni),
+ ST( 1, 13, -1,  1,  vs_sub, tcs_sub,NULL,NULL,NULL,   NULL, 
GL_TESS_CONTROL_SUBROUTINE_UNIFORM, "", st_r_tcs_sub_uni),
  ST( 1, 16, -1,  1,  vs_sub,NULL, tes_sub,NULL,NULL,   NULL, 
GL_TESS_EVALUATION_SUBROUTINE_UNIFORM, "", st_r_tes_sub_uni),
  ST( 1,  8, -1,  1,NULL,NULL,NULL,NULL,NULL, cs_sub, 
GL_COMPUTE_SUBROUTINE_UNIFORM, "", st_r_cs_sub_uni),
 };
-- 
2.20.1

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


[Piglit] [PATCH 0/2] arb_program_interface_query: series correcting existing tests

2019-02-08 Thread Andres Gomez
This addresses, basically, problems due to interface mismatching with
separable program objects.

Andres Gomez (2):
  arb_program_interface_query: correct tests table indentation
  arb_program_interface_query: correct rendez-vous by name matching

 .../spec/arb_program_interface_query/common.h | 61 ---
 .../getprogramresourceiv.c|  8 +--
 .../resource-query.c  | 52 
 3 files changed, 81 insertions(+), 40 deletions(-)

-- 
2.20.1

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


[Piglit] [PATCH] arb_separate_shader_objects: add rendez-vous-by mismatch tests

2019-02-08 Thread Andres Gomez
New tests to check that, with separable program objects, interface
matching by name or location are still checked at link time between
the inner interfaces existing inside the program.

From the ARB_separate_shader_objects spec v.25:

  " With separable program objects, interfaces between shader stages
may involve the outputs from one program object and the inputs
from a second program object.  For such interfaces, it is not
possible to detect mismatches at link time, because the programs
are linked separately.  When each such program is linked, all
inputs or outputs interfacing with another program stage are
treated as active.  The linker will generate an executable that
assumes the presence of a compatible program on the other side of
the interface.  If a mismatch between programs occurs, no GL error
will be generated, but some or all of the inputs on the interface
will be undefined."

Cc: Timothy Arceri 
Cc: Iago Toral Quiroga 
Cc: Samuel Iglesias Gonsálvez 
Cc: Tapani Pälli 
Cc: Ian Romanick 
Cc: Ilia Mirkin 
Signed-off-by: Andres Gomez 
---
 .../CMakeLists.gl.txt |   2 +
 .../rendezvous_by_location-invalid.c  | 106 ++
 .../rendezvous_by_name-invalid.c  | 103 +
 3 files changed, 211 insertions(+)
 create mode 100644 
tests/spec/arb_separate_shader_objects/rendezvous_by_location-invalid.c
 create mode 100644 
tests/spec/arb_separate_shader_objects/rendezvous_by_name-invalid.c

diff --git a/tests/spec/arb_separate_shader_objects/CMakeLists.gl.txt 
b/tests/spec/arb_separate_shader_objects/CMakeLists.gl.txt
index 1b61f3312..ce257ca2e 100644
--- a/tests/spec/arb_separate_shader_objects/CMakeLists.gl.txt
+++ b/tests/spec/arb_separate_shader_objects/CMakeLists.gl.txt
@@ -20,9 +20,11 @@ piglit_add_executable 
(arb_separate_shader_object-mixed_explicit_and_non_explici
 piglit_add_executable (arb_separate_shader_object-mix-and-match-tcs-tes 
mix-and-match-tcs-tes.c)
 piglit_add_executable (arb_separate_shader_object-ProgramUniform-coverage 
ProgramUniform-coverage.c)
 piglit_add_executable (arb_separate_shader_object-rendezvous_by_location 
rendezvous_by_location.c sso-common.c)
+piglit_add_executable 
(arb_separate_shader_object-rendezvous_by_location-invalid 
rendezvous_by_location-invalid.c)
 piglit_add_executable 
(arb_separate_shader_object-rendezvous_by_location-3-stages 
rendezvous_by_location-3-stages.c)
 piglit_add_executable 
(arb_separate_shader_object-rendezvous_by_location-5-stages 
rendezvous_by_location-5-stages.c)
 piglit_add_executable (arb_separate_shader_object-rendezvous_by_name 
rendezvous_by_name.c sso-common.c)
+piglit_add_executable (arb_separate_shader_object-rendezvous_by_name-invalid 
rendezvous_by_name-invalid.c)
 piglit_add_executable 
(arb_separate_shader_object-rendezvous_by_name_interpolation 
rendezvous_by_name_interpolation.c sso-common.c)
 piglit_add_executable (arb_separate_shader_object-uniform-namespace 
uniform-namespace.c sso-common.c)
 piglit_add_executable 
(arb_separate_shader_object-UseProgramStages-non-separable 
UseProgramStages-non-separable.c)
diff --git 
a/tests/spec/arb_separate_shader_objects/rendezvous_by_location-invalid.c 
b/tests/spec/arb_separate_shader_objects/rendezvous_by_location-invalid.c
new file mode 100644
index 0..7fd7af86d
--- /dev/null
+++ b/tests/spec/arb_separate_shader_objects/rendezvous_by_location-invalid.c
@@ -0,0 +1,106 @@
+/*
+ * Copyright © 2013, 2019 Intel Corporation
+ * Copyright © 2015 Advanced Micro Devices, 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
+ * 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.
+ */
+
+/**
+ * This test uses separable program objects with 2 shaders (VS, GS)
+ * and tests that the same interface matching rules by location apply
+ * in between the VS -> GS interface as if it would not be separable.
+ */
+
+#include "piglit-util-gl.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+