[Piglit] [PATCH v2 02/19] nv_image_formats/copy-image-formats: Convert to use subtests

2018-12-03 Thread Dylan Baker
This allows the framework to know what tests will be run, and doesn't
actually make the implementation much more complicated.
---
 .../nv_image_formats/copy-image-formats.c | 66 +++
 1 file changed, 37 insertions(+), 29 deletions(-)

diff --git a/tests/spec/nv_image_formats/copy-image-formats.c 
b/tests/spec/nv_image_formats/copy-image-formats.c
index 8cfaf2a55..c15f23eae 100644
--- a/tests/spec/nv_image_formats/copy-image-formats.c
+++ b/tests/spec/nv_image_formats/copy-image-formats.c
@@ -31,15 +31,6 @@
 
 #include "piglit-util-gl.h"
 
-PIGLIT_GL_TEST_CONFIG_BEGIN
-
-config.supports_gl_es_version = 31;
-
-PIGLIT_GL_TEST_CONFIG_END
-
-#define WIDTH 16
-#define HEIGHT 16
-
 const struct image_format {
/** Format name as specified by GLSL. */
const char *name;
@@ -81,6 +72,32 @@ const struct image_format {
{ "r8_snorm", GL_R8_SNORM, GL_RED, GL_BYTE },
 };
 
+static struct piglit_subtest tests[ARRAY_SIZE(image_formats) + 1];
+static struct piglit_gl_test_config * piglit_config;
+static enum piglit_result run_test(void *);
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+piglit_config = 
+
+for (unsigned i = 0; i < ARRAY_SIZE(image_formats); ++i) {
+
+   char * name[64];
+   asprintf(name, "copy-%s", image_formats[i].name);
+   tests[i].name = *name;
+   tests[i].option = image_formats[i].name;
+   tests[i].subtest_func = run_test;
+   tests[i].data = (void *)_formats[i];
+}
+config.subtests = tests;
+
+config.supports_gl_es_version = 31;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+#define WIDTH 16
+#define HEIGHT 16
+
 static const char *
 glsl_image_type_name(GLenum format)
 {
@@ -190,9 +207,10 @@ format_is_norm16(GLenum format)
}
 }
 
-static bool
-run_test(const struct image_format *image_format)
+static enum piglit_result
+run_test(void * data)
 {
+   struct image_format * image_format = (struct image_format *)data;
GLuint src, dst, prog;
char *fs_source;
 
@@ -205,7 +223,7 @@ run_test(const struct image_format *image_format)
if (format_is_norm16(image_format->format)) {
if (!piglit_is_extension_supported("GL_EXT_texture_norm16")) {
piglit_check_gl_error(GL_INVALID_VALUE);
-   return true;
+   return PIGLIT_PASS;
}
}
piglit_check_gl_error(GL_NO_ERROR);
@@ -234,7 +252,7 @@ run_test(const struct image_format *image_format)
 image_format->name,
 glsl_image_type_name(image_format->format),
 glsl_type_name(image_format->format)) < 0)
-   return false;
+   return PIGLIT_FAIL;
 
prog = piglit_build_simple_program(
"#version 310 es\n"
@@ -250,31 +268,21 @@ run_test(const struct image_format *image_format)
 
piglit_draw_rect(-1, -1, 1, 1);
 
-   return true;
+   return PIGLIT_PASS;
 }
 
-#define subtest(status, result, ...) do {  \
-   enum piglit_result _status = ((result) ? PIGLIT_PASS :  \
- PIGLIT_FAIL); \
-   \
-   piglit_report_subtest_result(_status, __VA_ARGS__); \
-   \
-   if (_status == PIGLIT_FAIL) \
-   *status = PIGLIT_FAIL;  \
-   } while (0)
-
 void
 piglit_init(int argc, char **argv)
 {
enum piglit_result status = PIGLIT_PASS;
-   unsigned i;
 
piglit_require_extension("GL_NV_image_formats");
 
-   for (i = 0 ; i < ARRAY_SIZE(image_formats); ++i) {
-   subtest(, run_test(_formats[i]),
-   "copy-%s", image_formats[i].name);
-   }
+   status = piglit_run_selected_subtests(
+   tests,
+   piglit_config->selected_subtests,
+   piglit_config->num_selected_subtests,
+   status);
 
piglit_report_result(status);
 }
-- 
2.19.2

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


[Piglit] [PATCH v2 06/19] tests: Use a helper function in gl-1.0-rendermode-feedback

2018-12-03 Thread Dylan Baker
This is ground work for using proper subtest handling, it's a big enough
change it makes sense to me to split it into a separate commit.
---
 tests/spec/gl-1.0/rendermode-feedback.c | 77 +
 1 file changed, 40 insertions(+), 37 deletions(-)

diff --git a/tests/spec/gl-1.0/rendermode-feedback.c 
b/tests/spec/gl-1.0/rendermode-feedback.c
index 880f04167..532c55914 100644
--- a/tests/spec/gl-1.0/rendermode-feedback.c
+++ b/tests/spec/gl-1.0/rendermode-feedback.c
@@ -120,15 +120,49 @@ report_failure(struct type *type, float *buffer, int 
count)
 
 }
 
-enum piglit_result
-piglit_display(void)
-{
-   bool pass = true;
+static bool
+run_subtest(struct type * type) {
+   bool case_pass = true;
+   int returned_count, j;
+   const char *name = piglit_get_gl_enum_name(type->type);
float buffer[2 +
 ARRAY_SIZE(vertex_array) +
 ARRAY_SIZE(color_array) +
 ARRAY_SIZE(texcoord_array)];
-   int i, j;
+
+   printf("Testing %s\n", name);
+
+   for (j = 0; j < ARRAY_SIZE(buffer); j++)
+   buffer[j] = -1.0;
+
+   glFeedbackBuffer(ARRAY_SIZE(buffer), type->type, buffer);
+   glRenderMode(GL_FEEDBACK);
+   glDrawArrays(GL_TRIANGLES, 0, 4);
+   returned_count = glRenderMode(GL_RENDER);
+
+   if (returned_count != type->count) {
+   case_pass = false;
+   } else {
+   for (j = 0; j < type->count; j++) {
+   if (fabs(buffer[j] - type->values[j]) > .01)
+   case_pass = false;
+   }
+   }
+
+   if (!case_pass) {
+   report_failure(type, buffer, returned_count);
+   piglit_report_subtest_result(PIGLIT_FAIL, "%s", name);
+   } else {
+   piglit_report_subtest_result(PIGLIT_PASS, "%s", name);
+   }
+   return case_pass;
+}
+
+enum piglit_result
+piglit_display(void)
+{
+   bool pass = true;
+   int i;
 
piglit_ortho_projection(piglit_width, piglit_height, false);
 
@@ -143,38 +177,7 @@ piglit_display(void)
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
 
for (i = 0; i < ARRAY_SIZE(types); i++) {
-   bool case_pass = true;
-   int returned_count;
-   const char *name = piglit_get_gl_enum_name(types[i].type);
-
-   printf("Testing %s\n", name);
-
-   for (j = 0; j < ARRAY_SIZE(buffer); j++)
-   buffer[j] = -1.0;
-
-   glFeedbackBuffer(ARRAY_SIZE(buffer), types[i].type, buffer);
-   glRenderMode(GL_FEEDBACK);
-   glDrawArrays(GL_TRIANGLES, 0, 4);
-   returned_count = glRenderMode(GL_RENDER);
-
-   if (returned_count != types[i].count) {
-   case_pass = false;
-   } else {
-   for (j = 0; j < types[i].count; j++) {
-   if (fabs(buffer[j] - types[i].values[j]) > .01)
-   case_pass = false;
-   }
-   }
-
-   if (!case_pass) {
-   pass = false;
-   report_failure([i], buffer, returned_count);
-   piglit_report_subtest_result(PIGLIT_FAIL,
-"%s", name);
-   } else {
-   piglit_report_subtest_result(PIGLIT_PASS,
-"%s", name);
-   }
+   run_subtest([i]);
}
 
piglit_present_results();
-- 
2.19.2

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


[Piglit] [PATCH v2 12/19] tests/ext_transform_feedback-max-varyings: Always report subtests

2018-12-03 Thread Dylan Baker
---
 tests/spec/ext_transform_feedback/max-varyings.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tests/spec/ext_transform_feedback/max-varyings.c 
b/tests/spec/ext_transform_feedback/max-varyings.c
index 1f83b60aa..b8c98a5d5 100644
--- a/tests/spec/ext_transform_feedback/max-varyings.c
+++ b/tests/spec/ext_transform_feedback/max-varyings.c
@@ -435,6 +435,9 @@ piglit_display(void)
}
piglit_report_subtest_result(status,
 "max-varying-arrays-of-arrays");
+   } else {
+   piglit_report_subtest_result(PIGLIT_SKIP,
+"max-varying-arrays-of-arrays");
}
piglit_present_results();
 
-- 
2.19.2

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


[Piglit] [PATCH v2 19/19] tests/ext_polygon_offset_clamp-draw: use subtest framework

2018-12-03 Thread Dylan Baker
v2: - don't put config inside #ifdef opengl
- de-duplicate comment
---
 tests/spec/ext_polygon_offset_clamp/draw.c | 124 +
 1 file changed, 78 insertions(+), 46 deletions(-)

diff --git a/tests/spec/ext_polygon_offset_clamp/draw.c 
b/tests/spec/ext_polygon_offset_clamp/draw.c
index 5c7382556..632a7ebad 100644
--- a/tests/spec/ext_polygon_offset_clamp/draw.c
+++ b/tests/spec/ext_polygon_offset_clamp/draw.c
@@ -39,47 +39,22 @@
 
 #include "piglit-util-gl.h"
 
-PIGLIT_GL_TEST_CONFIG_BEGIN
-#if PIGLIT_USE_OPENGL
-   config.supports_gl_compat_version = 21;
-#else
-   config.supports_gl_es_version = 20;
-#endif
-   config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DEPTH | 
PIGLIT_GL_VISUAL_DOUBLE;
-
-PIGLIT_GL_TEST_CONFIG_END
-
 GLint prog, color, zflip;
 
-enum piglit_result
-piglit_display(void)
-{
-   static const float blue[4] = {0, 0, 1, 1};
-   static const float red[4] = {1, 0, 0, 1};
-   static const float green[4] = {0, 1, 0, 1};
-
-   bool passa = true, passb = true;
-
-   glUseProgram(prog);
-
-   glViewport(0, 0, piglit_width, piglit_height);
-   glEnable(GL_DEPTH_TEST);
-   glEnable(GL_POLYGON_OFFSET_FILL);
+static const struct piglit_gl_test_config * piglit_config;
+static const float blue[4] = {0, 0, 1, 1};
+static const float red[4] = {1, 0, 0, 1};
+static const float green[4] = {0, 1, 0, 1};
 
-   glUniform1f(zflip, 1.0);
-   glClearColor(0, 0, 1, 1);
-#ifdef PIGLIT_USE_OPENGL
-   glClearDepth(0.5);
-#else
-   glClearDepthf(0.5);
-#endif
-   glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+/* NOTE: It appears that at least nvidia hw will end up wrapping around if the
+ * final z value goes below 0 (or something). This can come up when testing
+ * without the clamp.
+ */
 
-   /* NOTE: It appears that at least nvidia hw will end up
-* wrapping around if the final z value goes below 0 (or
-* something). This can come up when testing without the
-* clamp.
-*/
+static enum piglit_result
+test_negative_clamp(void * unused)
+{
+   bool pass = true;
 
/* Draw red rectangle that slopes between 1 and 0.1. Use a
 * polygon offset with a high factor but small clamp
@@ -89,7 +64,7 @@ piglit_display(void)
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
if (!piglit_probe_rect_rgba(0, 0, piglit_width, piglit_height, blue)) {
printf("  FAIL: red rect peeks over blue rect\n");
-   passa = false;
+   pass = false;
}
 
/* And now set the clamp such that all parts of the polygon
@@ -100,11 +75,16 @@ piglit_display(void)
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
if (!piglit_probe_rect_rgba(0, 0, piglit_width, piglit_height, green)) {
printf("  FAIL: green rect does not cover blue rect\n");
-   passa = false;
+   pass = false;
}
 
-   piglit_report_subtest_result(passa ? PIGLIT_PASS : PIGLIT_FAIL,
-"negative clamp");
+   return pass ? PIGLIT_PASS : PIGLIT_FAIL;
+}
+
+static enum piglit_result
+test_positive_clamp(void * unused)
+{
+   bool pass = true;
 
/* Now try this again with the inverse approach and a positive
 * clamp value. The polygon will now slope between -1 and
@@ -121,7 +101,7 @@ piglit_display(void)
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
if (!piglit_probe_rect_rgba(0, 0, piglit_width, piglit_height, blue)) {
printf("  FAIL: red rect peeks over blue rect\n");
-   passb = false;
+   pass = false;
}
 
/* And now set the clamp so that all parts of the polygon pass
@@ -132,15 +112,67 @@ piglit_display(void)
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
if (!piglit_probe_rect_rgba(0, 0, piglit_width, piglit_height, green)) {
printf("  FAIL: green rect does not cover blue rect\n");
-   passb = false;
+   pass = false;
}
 
-   piglit_report_subtest_result(passb ? PIGLIT_PASS : PIGLIT_FAIL,
-"positive clamp");
+   return pass ? PIGLIT_PASS : PIGLIT_FAIL;
+}
+
+static const struct piglit_subtest tests[] = {
+   {
+   "negative clamp",
+   "neg_clamp",
+   test_negative_clamp,
+   NULL
+   },
+   {
+   "positive clamp",
+   "pos_clamp",
+   test_positive_clamp,
+   NULL
+   },
+   { NULL }
+};
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+   piglit_config = 
+   config.subtests = tests;
+#if PIGLIT_USE_OPENGL
+   config.supports_gl_compat_version = 21;
+#else
+   config.supports_gl_es_version = 20;
+#endif
+   config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DEPTH | 
PIGLIT_GL_VISUAL_DOUBLE;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+enum piglit_result
+piglit_display(void)
+{
+ 

[Piglit] [PATCH v2 17/19] tests/ext_semaphore-api-errors: Use subtest mechanism

2018-12-03 Thread Dylan Baker
---
 tests/spec/ext_semaphore/api-errors.c | 110 +++---
 1 file changed, 63 insertions(+), 47 deletions(-)

diff --git a/tests/spec/ext_semaphore/api-errors.c 
b/tests/spec/ext_semaphore/api-errors.c
index a7fd93ade..be8a0c7cf 100644
--- a/tests/spec/ext_semaphore/api-errors.c
+++ b/tests/spec/ext_semaphore/api-errors.c
@@ -28,36 +28,32 @@
 
 #include "piglit-util-gl.h"
 
-PIGLIT_GL_TEST_CONFIG_BEGIN
-
-   config.supports_gl_compat_version = 10;
-   config.window_visual = PIGLIT_GL_VISUAL_RGBA | PIGLIT_GL_VISUAL_DOUBLE;
-   config.khr_no_error_support = PIGLIT_HAS_ERRORS;
+static const struct piglit_gl_test_config * piglit_config;
 
-PIGLIT_GL_TEST_CONFIG_END
+#define RESULT(error) piglit_check_gl_error(error) ? PIGLIT_PASS : PIGLIT_FAIL
 
-static bool
-test_get_unsigned_byte_v_enum_errors()
+static enum piglit_result
+test_get_unsigned_byte_v_enum_errors(void * unused)
 {
GLubyte data[GL_UUID_SIZE_EXT];
 
glGetUnsignedBytevEXT(UINT32_MAX, data);
 
-   return piglit_check_gl_error(GL_INVALID_ENUM);
+   return RESULT(GL_INVALID_ENUM);
 }
 
-static bool
-test_get_unsigned_byte_i_v_enum_errors()
+static enum piglit_result
+test_get_unsigned_byte_i_v_enum_errors(void * unused)
 {
GLubyte data[GL_UUID_SIZE_EXT];
 
glGetUnsignedBytei_vEXT(UINT32_MAX, 0, data);
 
-   return piglit_check_gl_error(GL_INVALID_ENUM);
+   return RESULT(GL_INVALID_ENUM);
 }
 
-static bool
-test_get_unsigned_byte_i_v_value_errors()
+static enum piglit_result
+test_get_unsigned_byte_i_v_value_errors(void * unused)
 {
GLubyte data[GL_UUID_SIZE_EXT];
GLint numDevices;
@@ -66,31 +62,31 @@ test_get_unsigned_byte_i_v_value_errors()
 
glGetUnsignedBytei_vEXT(GL_DEVICE_UUID_EXT, numDevices + 1, data);
 
-   return piglit_check_gl_error(GL_INVALID_VALUE);
+   return RESULT(GL_INVALID_VALUE);
 }
 
-static bool
-test_gen_semaphores_value_errors()
+static enum piglit_result
+test_gen_semaphores_value_errors(void * unused)
 {
GLuint sem;
 
glGenSemaphoresEXT(-1, );
 
-   return piglit_check_gl_error(GL_INVALID_VALUE);
+   return RESULT(GL_INVALID_VALUE);
 }
 
-static bool
-test_delete_semaphores_value_errors()
+static enum piglit_result
+test_delete_semaphores_value_errors(void * unused)
 {
GLuint sem;
 
glDeleteSemaphoresEXT(-1, );
 
-   return piglit_check_gl_error(GL_INVALID_VALUE);
+   return RESULT(GL_INVALID_VALUE);
 }
 
-static bool
-test_semaphore_parameter_enum_errors()
+static enum piglit_result
+test_semaphore_parameter_enum_errors(void * unused)
 {
GLuint sem;
GLuint64 param;
@@ -103,11 +99,11 @@ test_semaphore_parameter_enum_errors()
 */
glSemaphoreParameterui64vEXT(0, sem, );
 
-   return piglit_check_gl_error(GL_INVALID_ENUM);
+   return RESULT(GL_INVALID_ENUM);
 }
 
-static bool
-test_get_semaphore_parameter_enum_errors()
+static enum piglit_result
+test_get_semaphore_parameter_enum_errors(void * unused)
 {
GLuint sem;
GLuint64 param;
@@ -115,35 +111,55 @@ test_get_semaphore_parameter_enum_errors()
glGenSemaphoresEXT(1, );
glGetSemaphoreParameterui64vEXT(0, sem, );
 
-   return piglit_check_gl_error(GL_INVALID_ENUM);
+   return RESULT(GL_INVALID_ENUM);
 }
 
-#define X(f, desc) \
-   do {\
-   const bool subtest_pass = (f);  \
-   piglit_report_subtest_result(subtest_pass   \
-? 
PIGLIT_PASS : PIGLIT_FAIL, \
-
(desc));   \
-   pass = pass && subtest_pass;\
-   } while (0)
+#undef RESULT
+
+#define ADD_TEST(func, name) \
+   {\
+   name,\
+   name,\
+   func,\
+   NULL \
+   }
+static const struct piglit_subtest tests[] = {
+   ADD_TEST(test_get_unsigned_byte_v_enum_errors, 
"usigned-byte-v-bad-enum"),
+   ADD_TEST(test_get_unsigned_byte_i_v_enum_errors, 
"usigned-byte-i-v-bad-enum"),
+   ADD_TEST(test_get_unsigned_byte_i_v_value_errors, 
"usigned-byte-i-v-bad-value"),
+
+   ADD_TEST(test_gen_semaphores_value_errors, "gen-semaphores-bad-value"),
+   ADD_TEST(test_delete_semaphores_value_errors, 
"gen-semaphores-bad-value"),
+   ADD_TEST(test_delete_semaphores_value_errors, 
"gen-semaphores-bad-value"),
+
+   ADD_TEST(test_semaphore_parameter_enum_errors, 
"semaphore-parameter-bad-enum"),
+   ADD_TEST(test_get_semaphore_parameter_enum_errors, 
"get-semaphore-parameter-bad-enum"),
+   { NULL },
+};
+#undef ADD_TEST
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+   piglit_config = 
+   config.subtests = tests;
+   

[Piglit] [PATCH v2 10/19] tests/gl-1.0-beginend-coverage: enumerate subtests

2018-12-03 Thread Dylan Baker
This doesn't add support for running specific subtests, but it does
enumerate the ones that exist.
---
 tests/spec/gl-1.0/beginend-coverage.c | 26 ++
 1 file changed, 26 insertions(+)

diff --git a/tests/spec/gl-1.0/beginend-coverage.c 
b/tests/spec/gl-1.0/beginend-coverage.c
index 67792296a..40ff69a8b 100644
--- a/tests/spec/gl-1.0/beginend-coverage.c
+++ b/tests/spec/gl-1.0/beginend-coverage.c
@@ -895,11 +895,37 @@ test_endlist()
return true;
 }
 
+static void
+enumerate_subtests(void) {
+   const char * subtests[ARRAY_SIZE(ok_tests) + ARRAY_SIZE(error_tests) +
+ ARRAY_SIZE(error_only_tests) +
+ ARRAY_SIZE(nondlist_error_tests) + 2];
+   unsigned i = 0;
+   for (unsigned j = 0; j < ARRAY_SIZE(ok_tests); ++j, ++i) {
+   subtests[i] = ok_tests[j].name;
+   }
+   for (unsigned j = 0; j < ARRAY_SIZE(error_tests); ++j, ++i) {
+   subtests[i] = error_tests[j].name;
+   }
+   for (unsigned j = 0; j < ARRAY_SIZE(error_only_tests); ++j, ++i) {
+   subtests[i] = error_only_tests[j].name;
+   }
+   for (unsigned j = 0; j < ARRAY_SIZE(nondlist_error_tests); ++j, ++i) {
+   subtests[i] = nondlist_error_tests[j].name;
+   }
+   subtests[i++] = "glEndList";
+   subtests[i] = NULL;
+
+   piglit_register_subtests(subtests);
+}
+
 void
 piglit_init(int argc, char **argv)
 {
bool pass;
 
+   enumerate_subtests();
+
/* Set up some state to be used by our various test
 * functions
 */
-- 
2.19.2

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


[Piglit] [PATCH v2 18/19] tests/ext_semaphore-api-errors: Fix typo "usigned" -> "unsigned"

2018-12-03 Thread Dylan Baker
---
 tests/spec/ext_semaphore/api-errors.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tests/spec/ext_semaphore/api-errors.c 
b/tests/spec/ext_semaphore/api-errors.c
index be8a0c7cf..b1c426cc5 100644
--- a/tests/spec/ext_semaphore/api-errors.c
+++ b/tests/spec/ext_semaphore/api-errors.c
@@ -124,9 +124,9 @@ test_get_semaphore_parameter_enum_errors(void * unused)
NULL \
}
 static const struct piglit_subtest tests[] = {
-   ADD_TEST(test_get_unsigned_byte_v_enum_errors, 
"usigned-byte-v-bad-enum"),
-   ADD_TEST(test_get_unsigned_byte_i_v_enum_errors, 
"usigned-byte-i-v-bad-enum"),
-   ADD_TEST(test_get_unsigned_byte_i_v_value_errors, 
"usigned-byte-i-v-bad-value"),
+   ADD_TEST(test_get_unsigned_byte_v_enum_errors, 
"unsigned-byte-v-bad-enum"),
+   ADD_TEST(test_get_unsigned_byte_i_v_enum_errors, 
"unsigned-byte-i-v-bad-enum"),
+   ADD_TEST(test_get_unsigned_byte_i_v_value_errors, 
"unsigned-byte-i-v-bad-value"),
 
ADD_TEST(test_gen_semaphores_value_errors, "gen-semaphores-bad-value"),
ADD_TEST(test_delete_semaphores_value_errors, 
"gen-semaphores-bad-value"),
-- 
2.19.2

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


[Piglit] [PATCH v2 14/19] tests/ext_transform_feedback-max-varyings: remove duplicate configs

2018-12-03 Thread Dylan Baker
This has config.supports_gl_compat_version = 10, then calls
piglit_require_GL_version(20), so just set the value in the config to 20
and remove the other.
---
 tests/spec/ext_transform_feedback/max-varyings.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/tests/spec/ext_transform_feedback/max-varyings.c 
b/tests/spec/ext_transform_feedback/max-varyings.c
index 0d368cac7..3f034deac 100644
--- a/tests/spec/ext_transform_feedback/max-varyings.c
+++ b/tests/spec/ext_transform_feedback/max-varyings.c
@@ -46,7 +46,7 @@
 
 PIGLIT_GL_TEST_CONFIG_BEGIN
 
-   config.supports_gl_compat_version = 10;
+   config.supports_gl_compat_version = 20;
 
config.window_width = (2+MAX_VARYING*12);
config.window_height = (2+MAX_VARYING*12);
@@ -440,7 +440,6 @@ piglit_display(void)
 
 void piglit_init(int argc, char **argv)
 {
-   piglit_require_gl_version(20);
piglit_require_GLSL_version(120);
piglit_require_transform_feedback();
glGenBuffers(1, _buf);
-- 
2.19.2

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


[Piglit] [PATCH v2 13/19] tests/ext_transform_feedback-max-varyings: fix result reporting

2018-12-03 Thread Dylan Baker
Currently if the first subtest failed then the second subtest (AoA)
would always report fail, this is bad. Instead we want to report fail,
but leave status (which is set to warn in the implementation doesn't
meet certain assumptions by the test), so that the second test can
report accurately.
---
 tests/spec/ext_transform_feedback/max-varyings.c | 14 --
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/tests/spec/ext_transform_feedback/max-varyings.c 
b/tests/spec/ext_transform_feedback/max-varyings.c
index b8c98a5d5..0d368cac7 100644
--- a/tests/spec/ext_transform_feedback/max-varyings.c
+++ b/tests/spec/ext_transform_feedback/max-varyings.c
@@ -416,10 +416,7 @@ piglit_display(void)
fs = get_fs(max_varyings);
pass = run_subtest(vs, fs, max_xfb_varyings,
   max_varyings, xfb_varying_array);
-   if (!pass) {
-   status = PIGLIT_FAIL;
-   }
-   piglit_report_subtest_result(status,
+   piglit_report_subtest_result(pass ? status : PIGLIT_FAIL,
 "max-varying-single-dimension-array");
 
/* Test arrays of arrays */
@@ -429,11 +426,8 @@ piglit_display(void)
fs = get_fs_aoa(max_varyings);
subtest_result = run_subtest(vs, fs, max_xfb_varyings,
 max_varyings, xfb_varying_aoa);
-   if (!subtest_result) {
-   status = PIGLIT_FAIL;
-   pass = false;
-   }
-   piglit_report_subtest_result(status,
+   pass &= subtest_result;
+   piglit_report_subtest_result(subtest_result ? status : 
PIGLIT_FAIL,
 "max-varying-arrays-of-arrays");
} else {
piglit_report_subtest_result(PIGLIT_SKIP,
@@ -441,7 +435,7 @@ piglit_display(void)
}
piglit_present_results();
 
-   return status;
+   return pass ? PIGLIT_PASS : PIGLIT_FAIL;
 }
 
 void piglit_init(int argc, char **argv)
-- 
2.19.2

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


[Piglit] [PATCH v2 15/19] tests/ext_transform_feedback-max-varyings: use subtest framework

2018-12-03 Thread Dylan Baker
This allows each test to be selected at runtime.
---
 .../ext_transform_feedback/max-varyings.c | 147 +++---
 1 file changed, 94 insertions(+), 53 deletions(-)

diff --git a/tests/spec/ext_transform_feedback/max-varyings.c 
b/tests/spec/ext_transform_feedback/max-varyings.c
index 3f034deac..bbce09cce 100644
--- a/tests/spec/ext_transform_feedback/max-varyings.c
+++ b/tests/spec/ext_transform_feedback/max-varyings.c
@@ -42,19 +42,7 @@
 #define MAX_VARYING 32
 #define AOA_OUTER_DIM 2
 
-/* 10x10 rectangles with 2 pixels of pad.  Deal with up to 32 varyings. */
-
-PIGLIT_GL_TEST_CONFIG_BEGIN
-
-   config.supports_gl_compat_version = 20;
-
-   config.window_width = (2+MAX_VARYING*12);
-   config.window_height = (2+MAX_VARYING*12);
-   config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE;
-   config.khr_no_error_support = PIGLIT_NO_ERRORS;
-
-PIGLIT_GL_TEST_CONFIG_END
-
+static const struct piglit_gl_test_config * piglit_config;
 static const char *xfb_varying_array[MAX_VARYING];
 static const char *xfb_varying_aoa[MAX_VARYING];
 static GLuint xfb_buf;
@@ -377,65 +365,118 @@ end:
return pass;
 }
 
+struct common_data {
+   int max_varyings;
+   GLint max_components;
+   int max_xfb_varyings;
+   GLint max_xfb_components;
+};
+
+static enum piglit_result
+test_1d_array(void * data) {
+   struct common_data * test_data = (struct common_data *)data;
+
+   GLuint vs = get_vs(test_data->max_varyings);
+   GLuint fs = get_fs(test_data->max_varyings);
+   bool pass = run_subtest(
+   vs, fs,
+   test_data->max_xfb_varyings,
+   test_data->max_varyings,
+   xfb_varying_array);
+
+   return pass ? PIGLIT_PASS : PIGLIT_FAIL;
+}
+
+static enum piglit_result
+test_aoa(void * data) {
+   if (!piglit_is_extension_supported("GL_ARB_arrays_of_arrays")) {
+   return PIGLIT_SKIP;
+   }
+
+   struct common_data * test_data = (struct common_data *)data;
+
+   GLuint vs = get_vs_aoa(test_data->max_varyings);
+   GLuint fs = get_fs_aoa(test_data->max_varyings);
+   bool pass = run_subtest(
+   vs,
+   fs,
+   test_data->max_xfb_varyings,
+   test_data->max_varyings, xfb_varying_aoa);
+
+   return pass ? PIGLIT_PASS : PIGLIT_FAIL;
+}
+
+static struct piglit_subtest tests[] = {
+   {
+   "max-varying-single-dimension-array",
+   "1d-array",
+   test_1d_array,
+   NULL,
+   },
+   {
+   "max-varying-arrays-of-arrays",
+   "aoa",
+   test_aoa,
+   NULL,
+   },
+   { NULL }
+};
+
+/* 10x10 rectangles with 2 pixels of pad.  Deal with up to 32 varyings. */
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+   piglit_config = 
+   config.subtests = tests;
+   config.supports_gl_compat_version = 20;
+
+   config.window_width = (2+MAX_VARYING*12);
+   config.window_height = (2+MAX_VARYING*12);
+   config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE;
+   config.khr_no_error_support = PIGLIT_NO_ERRORS;
+
+PIGLIT_GL_TEST_CONFIG_END
+
 enum piglit_result
 piglit_display(void)
 {
-   GLint max_components;
-   int max_varyings;
-   int max_xfb_varyings = 0;
-   GLint max_xfb_components;
-   GLboolean pass;
+   struct common_data data = { 0, 0, 0, 0 };
enum piglit_result status = PIGLIT_PASS;
-   GLuint vs, fs;
 
piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
 
-   glGetIntegerv(GL_MAX_VARYING_FLOATS, _components);
-   max_varyings = max_components / 4;
-   init_xfb_varyings(max_varyings);
+   glGetIntegerv(GL_MAX_VARYING_FLOATS, _components);
+   data.max_varyings = data.max_components / 4;
+   init_xfb_varyings(data.max_varyings);
 
-   printf("GL_MAX_VARYING_FLOATS = %i\n", max_components);
+   printf("GL_MAX_VARYING_FLOATS = %i\n", data.max_components);
 
-   if (max_varyings > MAX_VARYING) {
+   if (data.max_varyings > MAX_VARYING) {
printf("test not designed to handle >%d varying vec4s.\n"
   "(implementation reports %d components)\n",
-  max_components, MAX_VARYING);
-   max_varyings = MAX_VARYING;
+  data.max_components, MAX_VARYING);
+   data.max_varyings = MAX_VARYING;
status = PIGLIT_WARN;
}
 
glGetIntegerv(GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS,
- _xfb_components);
-   max_xfb_varyings = MIN2(max_xfb_components / 4, max_varyings);
+ _xfb_components);
+   data.max_xfb_varyings = MIN2(data.max_xfb_components / 4, 
data.max_varyings);
 
printf("GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS = %i\n",
-  max_xfb_components);
-
-   /* Test single dimension 

[Piglit] [PATCH v2 16/19] tests/ext_semaphore_fd-api-errors: Enumerate subtests

2018-12-03 Thread Dylan Baker
---
 tests/spec/ext_semaphore_fd/api-errors.c | 52 ++--
 1 file changed, 31 insertions(+), 21 deletions(-)

diff --git a/tests/spec/ext_semaphore_fd/api-errors.c 
b/tests/spec/ext_semaphore_fd/api-errors.c
index b0e14b636..2a1414e50 100644
--- a/tests/spec/ext_semaphore_fd/api-errors.c
+++ b/tests/spec/ext_semaphore_fd/api-errors.c
@@ -28,16 +28,10 @@
 
 #include "piglit-util-gl.h"
 
-PIGLIT_GL_TEST_CONFIG_BEGIN
-
-   config.supports_gl_compat_version = 10;
-   config.window_visual = PIGLIT_GL_VISUAL_RGBA | PIGLIT_GL_VISUAL_DOUBLE;
-   config.khr_no_error_support = PIGLIT_HAS_ERRORS;
-
-PIGLIT_GL_TEST_CONFIG_END
+static const struct piglit_gl_test_config * piglit_config;
 
-static bool
-test_import_semaphore_fd_enum_errors()
+static enum piglit_result
+test_import_semaphore_fd_enum_errors(void * unused)
 {
GLuint sem;
int fd = -1;
@@ -50,26 +44,42 @@ test_import_semaphore_fd_enum_errors()
 */
glImportSemaphoreFdEXT(sem, GL_NONE, fd);
 
-   return piglit_check_gl_error(GL_INVALID_ENUM);
+   return piglit_check_gl_error(GL_INVALID_ENUM) ? PIGLIT_PASS : 
PIGLIT_FAIL;
 }
 
-#define X(f, desc) \
-   do {\
-   const bool subtest_pass = (f);  \
-   piglit_report_subtest_result(subtest_pass   \
-? 
PIGLIT_PASS : PIGLIT_FAIL, \
-
(desc));   \
-   pass = pass && subtest_pass;\
-   } while (0)
+static const struct piglit_subtest tests[] = {
+   {
+   "import-semaphore-fd-bad-enum",
+   "bad-enum",
+   test_import_semaphore_fd_enum_errors,
+   NULL,
+   },
+   { NULL },
+
+};
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+   piglit_config = 
+   config.subtests = tests;
+   config.supports_gl_compat_version = 10;
+   config.window_visual = PIGLIT_GL_VISUAL_RGBA | PIGLIT_GL_VISUAL_DOUBLE;
+   config.khr_no_error_support = PIGLIT_HAS_ERRORS;
+
+PIGLIT_GL_TEST_CONFIG_END
 
 enum piglit_result
 piglit_display(void)
 {
-   bool pass = true;
+   enum piglit_result result = PIGLIT_PASS;
 
-   X(test_import_semaphore_fd_enum_errors(), 
"import-semaphore-fd-bad-enum");
+   result = piglit_run_selected_subtests(
+   tests,
+   piglit_config->selected_subtests,
+   piglit_config->num_selected_subtests,
+   result);
 
-   return pass ? PIGLIT_PASS : PIGLIT_FAIL;
+   return result;
 }
 
 
-- 
2.19.2

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


[Piglit] [PATCH v2 03/19] mesa_pack_invert/readpixels: enumerate subtests

2018-12-03 Thread Dylan Baker
It's not immediately obvious whether this test is suitable for
piglit_run_selected_subtests, so just enumerate the subtests it has so
that the framework can catch crashes.
---
 tests/spec/mesa_pack_invert/readpixels.c | 9 +
 1 file changed, 9 insertions(+)

diff --git a/tests/spec/mesa_pack_invert/readpixels.c 
b/tests/spec/mesa_pack_invert/readpixels.c
index e7194d0e2..5aec9cc95 100644
--- a/tests/spec/mesa_pack_invert/readpixels.c
+++ b/tests/spec/mesa_pack_invert/readpixels.c
@@ -207,4 +207,13 @@ void piglit_init(int argc, char **argv)
piglit_require_extension("GL_ARB_pixel_buffer_object");
piglit_require_extension("GL_MESA_pack_invert");
piglit_require_extension("GL_EXT_bgra");
+
+   const char * names[] = {
+   "non-PBO unorm BGRA",
+   "PBO unorm BGRA",
+   "non-PBO float RGBA",
+   "PBO float RGBA",
+   NULL,
+   };
+   piglit_register_subtests(names);
 }
-- 
2.19.2

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


[Piglit] [PATCH v2 07/19] tests: use subtest framework for gl-1.0-rendermode-feedback

2018-12-03 Thread Dylan Baker
---
 tests/spec/gl-1.0/rendermode-feedback.c | 57 +++--
 1 file changed, 35 insertions(+), 22 deletions(-)

diff --git a/tests/spec/gl-1.0/rendermode-feedback.c 
b/tests/spec/gl-1.0/rendermode-feedback.c
index 532c55914..2260370a3 100644
--- a/tests/spec/gl-1.0/rendermode-feedback.c
+++ b/tests/spec/gl-1.0/rendermode-feedback.c
@@ -28,15 +28,6 @@
  * Tests that glRenderMode(GL_FEEDBACK) rendering trivially works.
  */
 
-PIGLIT_GL_TEST_CONFIG_BEGIN
-
-   config.supports_gl_compat_version = 10;
-
-   config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA;
-   config.khr_no_error_support = PIGLIT_NO_ERRORS;
-
-PIGLIT_GL_TEST_CONFIG_END
-
 static float vertex_array[] = {
1.0, 2.0, 0.4, 1.0,
3.0, 4.0, 0.6, 1.0,
@@ -103,6 +94,30 @@ struct type {
  ARRAY_SIZE(gl_4d_color_texture_values) },
 };
 
+static enum piglit_result run_subtest(void * data);
+static const struct piglit_gl_test_config * piglit_config;
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+   piglit_config = 
+
+   struct piglit_subtest tests[ARRAY_SIZE(types) + 1];
+   for (unsigned i = 0; i < ARRAY_SIZE(types); ++i) {
+   tests[i].name = piglit_get_gl_enum_name(types[i].type);
+   tests[i].option = tests[i].name;
+   tests[i].subtest_func = run_subtest;
+   tests[i].data = (void *)[i];
+   }
+   tests[ARRAY_SIZE(types)] = (struct piglit_subtest){ 0 };
+   config.subtests = tests;
+
+   config.supports_gl_compat_version = 10;
+
+   config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA;
+   config.khr_no_error_support = PIGLIT_NO_ERRORS;
+
+PIGLIT_GL_TEST_CONFIG_END
+
 static void
 report_failure(struct type *type, float *buffer, int count)
 {
@@ -117,11 +132,11 @@ report_failure(struct type *type, float *buffer, int 
count)
fprintf(stderr, "  %9f%9f\n", type->values[i], buffer[i]);
}
fprintf(stderr, "\n");
-
 }
 
-static bool
-run_subtest(struct type * type) {
+static enum piglit_result
+run_subtest(void * data) {
+   struct type * type = (struct type *)data;
bool case_pass = true;
int returned_count, j;
const char *name = piglit_get_gl_enum_name(type->type);
@@ -151,18 +166,14 @@ run_subtest(struct type * type) {
 
if (!case_pass) {
report_failure(type, buffer, returned_count);
-   piglit_report_subtest_result(PIGLIT_FAIL, "%s", name);
-   } else {
-   piglit_report_subtest_result(PIGLIT_PASS, "%s", name);
}
-   return case_pass;
+   return case_pass ? PIGLIT_PASS : PIGLIT_FAIL;
 }
 
 enum piglit_result
 piglit_display(void)
 {
-   bool pass = true;
-   int i;
+   enum piglit_result result = PIGLIT_PASS;
 
piglit_ortho_projection(piglit_width, piglit_height, false);
 
@@ -176,13 +187,15 @@ piglit_display(void)
glEnableClientState(GL_COLOR_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
 
-   for (i = 0; i < ARRAY_SIZE(types); i++) {
-   run_subtest([i]);
-   }
+   result = piglit_run_selected_subtests(
+   piglit_config->subtests,
+   piglit_config->selected_subtests,
+   piglit_config->num_selected_subtests,
+   result);
 
piglit_present_results();
 
-   return pass ? PIGLIT_PASS : PIGLIT_FAIL;
+   return result;
 }
 
 void
-- 
2.19.2

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


[Piglit] [PATCH v2 08/19] tests: use subtest frameowrk in gl-1.0-dlist-beginend

2018-12-03 Thread Dylan Baker
---
 tests/spec/gl-1.0/dlist-beginend.c | 138 ++---
 1 file changed, 85 insertions(+), 53 deletions(-)

diff --git a/tests/spec/gl-1.0/dlist-beginend.c 
b/tests/spec/gl-1.0/dlist-beginend.c
index 644b84cce..eca32c1f3 100644
--- a/tests/spec/gl-1.0/dlist-beginend.c
+++ b/tests/spec/gl-1.0/dlist-beginend.c
@@ -27,21 +27,13 @@
 
 #include "piglit-util-gl.h"
 
-
-PIGLIT_GL_TEST_CONFIG_BEGIN
-   config.supports_gl_compat_version = 11;
-   config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA;
-   config.khr_no_error_support = PIGLIT_HAS_ERRORS;
-PIGLIT_GL_TEST_CONFIG_END
-
-
 static const GLfloat red[] = {1.0, 0.0, 0.0, 1.0};
 static const GLfloat green[] = {0.0, 1.0, 0.0, 1.0};
 static const GLfloat black[] = {0.0, 0.0, 0.0, 0.0};
+static const struct piglit_gl_test_config * piglit_config;
 
-
-static bool
-test_call_list_inside_begin_end(void)
+static enum piglit_result
+test_call_list_inside_begin_end(void * unused)
 {
GLuint list;
bool pass;
@@ -68,15 +60,13 @@ test_call_list_inside_begin_end(void)
&& pass;
 
piglit_present_results();
-   piglit_report_subtest_result(pass ? PIGLIT_PASS : PIGLIT_FAIL,
-"glCallList inside glBegin-glEnd");
 
-   return pass;
+   return pass ? PIGLIT_PASS : PIGLIT_FAIL;
 }
 
 
-static bool
-test_call_list_inside_nested_begin_end(void)
+static enum piglit_result
+test_call_list_inside_nested_begin_end(void * unused)
 {
GLuint inner, outer;
bool pass;
@@ -114,15 +104,13 @@ test_call_list_inside_nested_begin_end(void)
glDeleteLists(outer, 1);
 
piglit_present_results();
-   piglit_report_subtest_result(pass ? PIGLIT_PASS : PIGLIT_FAIL,
-"nested glCallList inside glBegin-glEnd");
 
-   return pass;
+   return pass ? PIGLIT_PASS : PIGLIT_FAIL;
 }
 
 
-static bool
-test_illegal_rect_list_inside_begin_end(void)
+static enum piglit_result
+test_illegal_rect_list_inside_begin_end(void * unused)
 {
GLuint list;
bool pass;
@@ -154,15 +142,13 @@ test_illegal_rect_list_inside_begin_end(void)
&& pass;
 
piglit_present_results();
-   piglit_report_subtest_result(pass ? PIGLIT_PASS : PIGLIT_FAIL,
-"illegal glRect inside glBegin-glEnd");
 
-   return pass;
+   return pass ? PIGLIT_PASS : PIGLIT_FAIL;
 }
 
 
-static bool
-test_illegal_drawarrays_list_inside_begin_end(void)
+static enum piglit_result
+test_illegal_drawarrays_list_inside_begin_end(void * unused)
 {
GLuint list;
bool pass;
@@ -200,10 +186,8 @@ test_illegal_drawarrays_list_inside_begin_end(void)
&& pass;
 
piglit_present_results();
-   piglit_report_subtest_result(pass ? PIGLIT_PASS : PIGLIT_FAIL,
-   "illegal glDrawArrays inside glBegin-glEnd");
 
-   return pass;
+   return pass ? PIGLIT_PASS : PIGLIT_FAIL;
 }
 
 
@@ -211,8 +195,8 @@ test_illegal_drawarrays_list_inside_begin_end(void)
  * As above, but don't actually enable the vertex arrays.
  * This catches another Mesa bug.
  */
-static bool
-test_illegal_drawarrays_list_inside_begin_end2(void)
+static enum piglit_result
+test_illegal_drawarrays_list_inside_begin_end2(void * unused)
 {
GLuint list;
bool pass;
@@ -239,15 +223,13 @@ test_illegal_drawarrays_list_inside_begin_end2(void)
&& pass;
 
piglit_present_results();
-   piglit_report_subtest_result(pass ? PIGLIT_PASS : PIGLIT_FAIL,
-   "illegal glDrawArrays inside glBegin-glEnd (2)");
 
-   return pass;
+   return pass ? PIGLIT_PASS : PIGLIT_FAIL;
 }
 
 
-static bool
-test_separate_begin_vertex_end_lists(void)
+static enum piglit_result
+test_separate_begin_vertex_end_lists(void * unused)
 {
GLuint begin, vertex, end;
bool pass;
@@ -289,15 +271,13 @@ test_separate_begin_vertex_end_lists(void)
glDeleteLists(end, 1);
 
piglit_present_results();
-   piglit_report_subtest_result(pass ? PIGLIT_PASS : PIGLIT_FAIL,
-"separate glBegin-glVertex-glEnd lists");
 
-   return pass;
+   return pass ? PIGLIT_PASS : PIGLIT_FAIL;
 }
 
 
-static bool
-test_illegal_begin_mode(void)
+static enum piglit_result
+test_illegal_begin_mode(void * unused)
 {
GLuint list;
bool pass;
@@ -328,27 +308,79 @@ test_illegal_begin_mode(void)
&& pass;
 
piglit_present_results();
-   piglit_report_subtest_result(pass ? PIGLIT_PASS : PIGLIT_FAIL,
-"illegal glBegin mode in display list");
 
-   return pass;
+   return pass ? PIGLIT_PASS : PIGLIT_FAIL;
 }
 
 
+static const struct piglit_subtest tests[] = {
+   {
+   "glCallList inside glBegin-glEnd",
+   "calllist-in-begin-end",
+   test_call_list_inside_begin_end,
+   NULL

[Piglit] [PATCH v2 04/19] tests: Use piglit_run_selected_subtest in gl-3.0-render-integer

2018-12-03 Thread Dylan Baker
---
 tests/spec/gl-3.0/render-integer.c | 100 -
 1 file changed, 55 insertions(+), 45 deletions(-)

diff --git a/tests/spec/gl-3.0/render-integer.c 
b/tests/spec/gl-3.0/render-integer.c
index 2937ec50c..ca2e1fe40 100644
--- a/tests/spec/gl-3.0/render-integer.c
+++ b/tests/spec/gl-3.0/render-integer.c
@@ -29,10 +29,53 @@
 
 #include "piglit-util-gl.h"
 
+static struct piglit_gl_test_config * piglit_config;
+static enum piglit_result test_format(void * data);
+
+#define CREATE_TEST(name)  \
+   {  \
+   #name, \
+   #name, \
+   test_format,   \
+   (void *)(intptr_t)name \
+   }
+static struct piglit_subtest tests[] = {
+   CREATE_TEST(GL_RGBA32I),
+   CREATE_TEST(GL_RGB32I),
+   CREATE_TEST(GL_RG32I),
+   CREATE_TEST(GL_R32I),
+   CREATE_TEST(GL_RGBA16I),
+   CREATE_TEST(GL_RGB16I),
+   CREATE_TEST(GL_RG16I),
+   CREATE_TEST(GL_R16I),
+   CREATE_TEST(GL_RGBA8I),
+   CREATE_TEST(GL_RGB8I),
+   CREATE_TEST(GL_RG8I),
+   CREATE_TEST(GL_R8I),
+
+   CREATE_TEST(GL_RGBA32UI),
+   CREATE_TEST(GL_RGB32UI),
+   CREATE_TEST(GL_RG32UI),
+   CREATE_TEST(GL_R32UI),
+   CREATE_TEST(GL_RGBA16UI),
+   CREATE_TEST(GL_RGB16UI),
+   CREATE_TEST(GL_RG16UI),
+   CREATE_TEST(GL_R16UI),
+   CREATE_TEST(GL_RGBA8UI),
+   CREATE_TEST(GL_RGB8UI),
+   CREATE_TEST(GL_RG8UI),
+   CREATE_TEST(GL_R8UI),
+   { 0 },
+};
+#undef CREATE_TEST
+
 PIGLIT_GL_TEST_CONFIG_BEGIN
+   piglit_config = 
+   config.subtests = tests;
config.supports_gl_compat_version = 30;
config.window_visual = PIGLIT_GL_VISUAL_RGBA | PIGLIT_GL_VISUAL_DOUBLE;
config.khr_no_error_support = PIGLIT_NO_ERRORS;
+
 PIGLIT_GL_TEST_CONFIG_END
 
 
@@ -197,9 +240,10 @@ setup_fbo(GLenum intFormat)
 
 
 
-static bool
-test_format(GLenum intFormat)
+static enum piglit_result
+test_format(void * data)
 {
+   GLenum intFormat = (GLenum)(intptr_t)data;
static const GLint red[4] = {1000, 0, 0, 0};
static const GLint green[4] = {2000, 0, 0, 0};
static const GLint blue[4] = {0, 0, 3000, 0};
@@ -209,11 +253,9 @@ test_format(GLenum intFormat)
int x1 = TexSize * 3 / 4;
int y1 = TexSize * 3 / 4;
bool pass = true;
-   enum piglit_result result;
 
if (!setup_fbo(intFormat)) {
-   result = PIGLIT_SKIP;
-   goto end;
+   return PIGLIT_SKIP;
}
 
/* Draw different value into each texture quadrant */
@@ -234,54 +276,22 @@ test_format(GLenum intFormat)
pass = probe_int(x0, y1, blue, intFormat) && pass;
pass = probe_int(x1, y1, alpha, intFormat) && pass;
 
-   result = pass ? PIGLIT_PASS : PIGLIT_FAIL;
-
-end:
-   piglit_report_subtest_result(result,
-"Format %s",
-piglit_get_gl_enum_name(intFormat));
-   return pass;
+   return pass ? PIGLIT_PASS : PIGLIT_FAIL;
 }
 
 
 enum piglit_result
 piglit_display(void)
 {
-   static const GLenum formats[] = {
-   GL_RGBA32I,
-   GL_RGB32I,
-   GL_RG32I,
-   GL_R32I,
-   GL_RGBA16I,
-   GL_RGB16I,
-   GL_RG16I,
-   GL_R16I,
-   GL_RGBA8I,
-   GL_RGB8I,
-   GL_RG8I,
-   GL_R8I,
-
-   GL_RGBA32UI,
-   GL_RGB32UI,
-   GL_RG32UI,
-   GL_R32UI,
-   GL_RGBA16UI,
-   GL_RGB16UI,
-   GL_RG16UI,
-   GL_R16UI,
-   GL_RGBA8UI,
-   GL_RGB8UI,
-   GL_RG8UI,
-   GL_R8UI,
-   };
-   bool pass = true;
-   int i;
+   enum piglit_result result = PIGLIT_PASS;
 
-   for (i = 0; i < ARRAY_SIZE(formats); i++) {
-   pass = test_format(formats[i]) && pass;
-   }
+   result = piglit_run_selected_subtests(
+   tests,
+   piglit_config->selected_subtests,
+   piglit_config->num_selected_subtests,
+   result);
 
-   return pass ? PIGLIT_PASS : PIGLIT_FAIL;
+   return result;
 }
 
 
-- 
2.19.2

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


[Piglit] [PATCH v2 09/19] tests/gl-1.0/beginend-coverage: Run nondlist tests

2018-12-03 Thread Dylan Baker
Which have never been run, though the array has been present since the
test was added.
---
 tests/spec/gl-1.0/beginend-coverage.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tests/spec/gl-1.0/beginend-coverage.c 
b/tests/spec/gl-1.0/beginend-coverage.c
index d36cc11c4..67792296a 100644
--- a/tests/spec/gl-1.0/beginend-coverage.c
+++ b/tests/spec/gl-1.0/beginend-coverage.c
@@ -925,6 +925,8 @@ piglit_init(int argc, char **argv)
 GL_INVALID_OPERATION) && pass;
pass = run_tests(error_only_tests, ARRAY_SIZE(error_only_tests),
 GL_INVALID_OPERATION) && pass;
+   pass = run_tests(nondlist_error_tests, ARRAY_SIZE(nondlist_error_tests),
+GL_INVALID_OPERATION) && pass;
 
if (test_endlist()) {
piglit_report_subtest_result(PIGLIT_PASS, "glEndList");
-- 
2.19.2

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


[Piglit] [PATCH v2 11/19] tests/ext_window_rectangles-dlist: enumerate subtests

2018-12-03 Thread Dylan Baker
I can't really test that this works, so just enumerating will have to be
enough.
---
 tests/spec/ext_window_rectangles/dlist.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tests/spec/ext_window_rectangles/dlist.c 
b/tests/spec/ext_window_rectangles/dlist.c
index 59836544f..3f1eb9d73 100644
--- a/tests/spec/ext_window_rectangles/dlist.c
+++ b/tests/spec/ext_window_rectangles/dlist.c
@@ -133,6 +133,9 @@ piglit_display(void)
 void
 piglit_init(int argc, char **argv)
 {
+   const char * subtests[] = { "compile and execute", "call", NULL };
+   piglit_register_subtests(subtests);
+
static const float verts[4][4] = {
/* x   y   z   w */
{ -1, -1, 1.0, 1 },
-- 
2.19.2

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


[Piglit] [PATCH v2 05/19] tests: Fix indent in gl-1.0/vertex-program-two-side

2018-12-03 Thread Dylan Baker
It's just cosmetic.
---
 tests/spec/gl-2.0/vertex-program-two-side.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tests/spec/gl-2.0/vertex-program-two-side.c 
b/tests/spec/gl-2.0/vertex-program-two-side.c
index 4623c70a6..65e6b7650 100644
--- a/tests/spec/gl-2.0/vertex-program-two-side.c
+++ b/tests/spec/gl-2.0/vertex-program-two-side.c
@@ -367,9 +367,9 @@ piglit_display(void)
free(tcs_source);
free(tes_source);
} else {
-   piglit_report_subtest_result(PIGLIT_SKIP, "%s", tests[3]);
-   piglit_report_subtest_result(PIGLIT_SKIP, "%s", tests[4]);
-   piglit_report_subtest_result(PIGLIT_SKIP, "%s", tests[5]);
+   piglit_report_subtest_result(PIGLIT_SKIP, "%s", 
tests[3]);
+   piglit_report_subtest_result(PIGLIT_SKIP, "%s", 
tests[4]);
+   piglit_report_subtest_result(PIGLIT_SKIP, "%s", 
tests[5]);
}
} else {
piglit_report_subtest_result(PIGLIT_SKIP, "%s", tests[1]);
-- 
2.19.2

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


[Piglit] [PATCH v2 01/19] test/logicop: Use piglit_subtest mechanism

2018-12-03 Thread Dylan Baker
This coverts the test to use the piglit_run_selected_subtests function,
which provides a nicer mechanism for running selected subtests, and
enumerates all subtests ahead of time.
---
 tests/spec/gl-1.0/logicop.c | 97 -
 1 file changed, 41 insertions(+), 56 deletions(-)

diff --git a/tests/spec/gl-1.0/logicop.c b/tests/spec/gl-1.0/logicop.c
index 377cd7dca..967e567a9 100644
--- a/tests/spec/gl-1.0/logicop.c
+++ b/tests/spec/gl-1.0/logicop.c
@@ -44,8 +44,42 @@
 #define img_width drawing_size
 #define img_height drawing_size
 
+static struct piglit_gl_test_config *piglit_config;
+
+static enum piglit_result test_logicop(void * data);
+
+#define TEST_ELEMENT(mode)  \
+   {   \
+   #mode,  \
+   #mode,  \
+   test_logicop,   \
+   (void *)(intptr_t)mode  \
+   }
+static struct piglit_subtest tests[] = {
+   TEST_ELEMENT(GL_CLEAR),
+   TEST_ELEMENT(GL_SET),
+   TEST_ELEMENT(GL_COPY),
+   TEST_ELEMENT(GL_COPY_INVERTED),
+   TEST_ELEMENT(GL_NOOP),
+   TEST_ELEMENT(GL_INVERT),
+   TEST_ELEMENT(GL_AND),
+   TEST_ELEMENT(GL_NAND),
+   TEST_ELEMENT(GL_OR),
+   TEST_ELEMENT(GL_NOR),
+   TEST_ELEMENT(GL_XOR),
+   TEST_ELEMENT(GL_EQUIV),
+   TEST_ELEMENT(GL_AND_REVERSE),
+   TEST_ELEMENT(GL_AND_INVERTED),
+   TEST_ELEMENT(GL_OR_REVERSE),
+   TEST_ELEMENT(GL_OR_INVERTED),
+   { 0 }
+};
+#undef TEST_ELEMENT
+
 PIGLIT_GL_TEST_CONFIG_BEGIN
 
+   piglit_config = 
+   config.subtests = tests;
config.supports_gl_compat_version = 11;
 
config.window_visual = PIGLIT_GL_VISUAL_RGBA |
@@ -54,29 +88,6 @@ PIGLIT_GL_TEST_CONFIG_BEGIN
 
 PIGLIT_GL_TEST_CONFIG_END
 
-
-static const GLenum logicop_modes[] = {
-   GL_CLEAR,
-   GL_SET,
-   GL_COPY,
-   GL_COPY_INVERTED,
-   GL_NOOP,
-   GL_INVERT,
-   GL_AND,
-   GL_NAND,
-   GL_OR,
-   GL_NOR,
-   GL_XOR,
-   GL_EQUIV,
-   GL_AND_REVERSE,
-   GL_AND_INVERTED,
-   GL_OR_REVERSE,
-   GL_OR_INVERTED
-};
-
-static GLenum test_single = 0;  /* 0 = test all logicop modes */
-
-
 static GLubyte*
 random_image_data(void)
 {
@@ -211,8 +222,9 @@ make_image(GLuint *name, GLubyte *data)
 }
 
 static enum piglit_result
-test_logicop(GLenum logicop)
+test_logicop(void * data)
 {
+   GLenum logicop = (GLenum)(intptr_t)data;
bool pass = true;
int x, y;
GLuint dst_name;
@@ -297,45 +309,18 @@ enum piglit_result
 piglit_display(void)
 {
enum piglit_result result = PIGLIT_PASS;
-   enum piglit_result subtest;
-   unsigned int op;
-
-   for (op = 0; op < ARRAY_SIZE(logicop_modes); ++op) {
-   if (test_single == 0 || test_single == logicop_modes[op]) {
-   subtest = test_logicop(logicop_modes[op]);
-   piglit_report_subtest_result(subtest, "%s",
-   piglit_get_gl_enum_name(logicop_modes[op]));
-   if (subtest == PIGLIT_FAIL)
-   result = PIGLIT_FAIL;
-   }
-   }
+   result = piglit_run_selected_subtests(
+   tests,
+   piglit_config->selected_subtests,
+   piglit_config->num_selected_subtests,
+   result);
 
return result;
 }
 
-
 void
 piglit_init(int argc, char **argv)
 {
srand(0);
piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
-
-   if (argc > 1) {
-   /* argv[1] may be one of the logic op modes, like "GL_XOR" */
-   int i;
-
-   for (i = 0; i < ARRAY_SIZE(logicop_modes); i++) {
-   const char * mode =
-   piglit_get_gl_enum_name(logicop_modes[i]);
-   if (strcmp(argv[1], mode) == 0) {
-   test_single = logicop_modes[i];
-   break;
-   }
-   }
-   if (test_single == 0) {
-   printf("Invalid glLogicOp mode %s\n", argv[1]);
-   piglit_report_result(PIGLIT_SKIP);
-   }
-   }
-
 }
-- 
2.19.2

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


Re: [Piglit] [PATCH v2] miptree: test ability to use upside down miptree

2018-12-03 Thread Mark Janes
It's preferable to push piglit tests first, and produce the CI test
failure.  CI staff will track the failure, and attribute it to the
piglit patch.  When the subsequent mesa patch is pushed, we track the
resolution.  The process gives us artifacts in git that help to analyze
driver differences between stable releases.

-Mark

andrey simiklit  writes:

> Hello,
>
> If this patch is acceptable by everybody then
> I guess that we need to push the following mesa patch before this one
> to avoid errors from Intel CI because the fix for an issue which is tested
> by this test is still there.
>
> https://patchwork.freedesktop.org/patch/254397/
> One of the last comment from Kenneth Graunke :
>
>>".
>> So, back to Reviewed-by.  I think once we get a Piglit test, I'm happy
>> to land this patch.
>>
>>--Ken"
>>
>
> Thanks,
> Andrii.
>
> On Mon, Dec 3, 2018 at 5:07 PM  wrote:
>
>> From: Andrii Simiklit 
>>
>> Test that usage of upside down miptree doesn't cause assertion
>>
>> The miptree:
>>
>> level 0 = 1x1
>> level 1 = 2x2
>> level 2 = 4x4
>> ...
>> level n = NxN
>>
>> should be acceptable for case when we don't use a min filter.
>>
>> v2: - Unnecessary function calls were removed
>> - The 'glClearColor' call was moved to 'piglit_display' function
>> - The program creation was moved to 'piglit_init' function
>> - The requirements check was moved to 'piglit_init' function
>>( Erik Faye-Lund  )
>>
>> - Fixed a leak of texture which is created in 'setup_texture'
>>
>> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107987
>> Signed-off-by: Andrii Simiklit 
>> Reviewed-by: Erik Faye-Lund 
>> ---
>>  tests/opengl.py   |   1 +
>>  tests/texturing/CMakeLists.gl.txt |   1 +
>>  tests/texturing/tex-upside-down-miptree.c | 171 ++
>>  3 files changed, 173 insertions(+)
>>  create mode 100644 tests/texturing/tex-upside-down-miptree.c
>>
>> diff --git a/tests/opengl.py b/tests/opengl.py
>> index f7e408cd5..f6a38e40e 100644
>> --- a/tests/opengl.py
>> +++ b/tests/opengl.py
>> @@ -704,6 +704,7 @@ with profile.test_list.group_manager(
>>  g(['getteximage-targets', '1D'])
>>  g(['getteximage-targets', '2D'])
>>  g(['teximage-scale-bias'])
>> +g(['tex-upside-down-miptree'])
>>  add_msaa_visual_plain_tests(g, ['draw-pixels'])
>>  add_msaa_visual_plain_tests(g, ['read-front'], run_concurrent=False)
>>  add_msaa_visual_plain_tests(g, ['read-front', 'clear-front-first'],
>> diff --git a/tests/texturing/CMakeLists.gl.txt
>> b/tests/texturing/CMakeLists.gl.txt
>> index e5d41e432..02b572c79 100644
>> --- a/tests/texturing/CMakeLists.gl.txt
>> +++ b/tests/texturing/CMakeLists.gl.txt
>> @@ -98,5 +98,6 @@ piglit_add_executable (texture-al texture-al.c)
>>  piglit_add_executable (texture-rg texture-rg.c)
>>  piglit_add_executable (teximage-colors teximage-colors.c)
>>  piglit_add_executable (zero-tex-coord zero-tex-coord.c)
>> +piglit_add_executable (tex-upside-down-miptree tex-upside-down-miptree.c)
>>
>>  # vim: ft=cmake:
>> diff --git a/tests/texturing/tex-upside-down-miptree.c
>> b/tests/texturing/tex-upside-down-miptree.c
>> new file mode 100644
>> index 0..8e8f7154b
>> --- /dev/null
>> +++ b/tests/texturing/tex-upside-down-miptree.c
>> @@ -0,0 +1,171 @@
>> +/*
>> + * Copyright (c) 2018 Andrii Simiklit
>> + *
>> + * 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.
>> + *
>> + * Authors:
>> + *Andrii Simiklit 
>> + *
>> + */
>> +
>> +/**
>> + * Test what there no an assertion when we use upside down miptree and
>> + * GL_TEXTURE_MIN_FILTER is GL_LINEAR, base level is not 0
>> + * Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107987
>> + */
>> +
>> +#include "piglit-util-gl.h"
>> +#define TW 64
>> +#define TH 64
>> +
>> 

Re: [Piglit] [PATCH v2] miptree: test ability to use upside down miptree

2018-12-03 Thread andrey simiklit
Hello,

If this patch is acceptable by everybody then
I guess that we need to push the following mesa patch before this one
to avoid errors from Intel CI because the fix for an issue which is tested
by this test is still there.

https://patchwork.freedesktop.org/patch/254397/
One of the last comment from Kenneth Graunke :

>".
> So, back to Reviewed-by.  I think once we get a Piglit test, I'm happy
> to land this patch.
>
>--Ken"
>

Thanks,
Andrii.

On Mon, Dec 3, 2018 at 5:07 PM  wrote:

> From: Andrii Simiklit 
>
> Test that usage of upside down miptree doesn't cause assertion
>
> The miptree:
>
> level 0 = 1x1
> level 1 = 2x2
> level 2 = 4x4
> ...
> level n = NxN
>
> should be acceptable for case when we don't use a min filter.
>
> v2: - Unnecessary function calls were removed
> - The 'glClearColor' call was moved to 'piglit_display' function
> - The program creation was moved to 'piglit_init' function
> - The requirements check was moved to 'piglit_init' function
>( Erik Faye-Lund  )
>
> - Fixed a leak of texture which is created in 'setup_texture'
>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107987
> Signed-off-by: Andrii Simiklit 
> Reviewed-by: Erik Faye-Lund 
> ---
>  tests/opengl.py   |   1 +
>  tests/texturing/CMakeLists.gl.txt |   1 +
>  tests/texturing/tex-upside-down-miptree.c | 171 ++
>  3 files changed, 173 insertions(+)
>  create mode 100644 tests/texturing/tex-upside-down-miptree.c
>
> diff --git a/tests/opengl.py b/tests/opengl.py
> index f7e408cd5..f6a38e40e 100644
> --- a/tests/opengl.py
> +++ b/tests/opengl.py
> @@ -704,6 +704,7 @@ with profile.test_list.group_manager(
>  g(['getteximage-targets', '1D'])
>  g(['getteximage-targets', '2D'])
>  g(['teximage-scale-bias'])
> +g(['tex-upside-down-miptree'])
>  add_msaa_visual_plain_tests(g, ['draw-pixels'])
>  add_msaa_visual_plain_tests(g, ['read-front'], run_concurrent=False)
>  add_msaa_visual_plain_tests(g, ['read-front', 'clear-front-first'],
> diff --git a/tests/texturing/CMakeLists.gl.txt
> b/tests/texturing/CMakeLists.gl.txt
> index e5d41e432..02b572c79 100644
> --- a/tests/texturing/CMakeLists.gl.txt
> +++ b/tests/texturing/CMakeLists.gl.txt
> @@ -98,5 +98,6 @@ piglit_add_executable (texture-al texture-al.c)
>  piglit_add_executable (texture-rg texture-rg.c)
>  piglit_add_executable (teximage-colors teximage-colors.c)
>  piglit_add_executable (zero-tex-coord zero-tex-coord.c)
> +piglit_add_executable (tex-upside-down-miptree tex-upside-down-miptree.c)
>
>  # vim: ft=cmake:
> diff --git a/tests/texturing/tex-upside-down-miptree.c
> b/tests/texturing/tex-upside-down-miptree.c
> new file mode 100644
> index 0..8e8f7154b
> --- /dev/null
> +++ b/tests/texturing/tex-upside-down-miptree.c
> @@ -0,0 +1,171 @@
> +/*
> + * Copyright (c) 2018 Andrii Simiklit
> + *
> + * 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.
> + *
> + * Authors:
> + *Andrii Simiklit 
> + *
> + */
> +
> +/**
> + * Test what there no an assertion when we use upside down miptree and
> + * GL_TEXTURE_MIN_FILTER is GL_LINEAR, base level is not 0
> + * Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107987
> + */
> +
> +#include "piglit-util-gl.h"
> +#define TW 64
> +#define TH 64
> +
> +PIGLIT_GL_TEST_CONFIG_BEGIN
> +
> +   config.supports_gl_compat_version = 10;
> +
> +   config.window_visual = PIGLIT_GL_VISUAL_RGBA |
> PIGLIT_GL_VISUAL_DOUBLE;
> +   config.khr_no_error_support = PIGLIT_NO_ERRORS;
> +
> +PIGLIT_GL_TEST_CONFIG_END
> +
> +GLuint prog = 0;
> +GLuint texture = 0;
> +static unsigned nlevels = 0;
> +static const char *fragShaderText =
> +   "uniform sampler2D tex;\n"
> +   "void main()\n"
> +   "{\n"
> +   "   gl_FragColor = texture2D(tex, 

[Piglit] [PATCH v2] miptree: test ability to use upside down miptree

2018-12-03 Thread asimiklit . work
From: Andrii Simiklit 

Test that usage of upside down miptree doesn't cause assertion

The miptree:

level 0 = 1x1
level 1 = 2x2
level 2 = 4x4
...
level n = NxN

should be acceptable for case when we don't use a min filter.

v2: - Unnecessary function calls were removed
- The 'glClearColor' call was moved to 'piglit_display' function
- The program creation was moved to 'piglit_init' function 
- The requirements check was moved to 'piglit_init' function
   ( Erik Faye-Lund  )

- Fixed a leak of texture which is created in 'setup_texture'

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107987
Signed-off-by: Andrii Simiklit 
Reviewed-by: Erik Faye-Lund 
---
 tests/opengl.py   |   1 +
 tests/texturing/CMakeLists.gl.txt |   1 +
 tests/texturing/tex-upside-down-miptree.c | 171 ++
 3 files changed, 173 insertions(+)
 create mode 100644 tests/texturing/tex-upside-down-miptree.c

diff --git a/tests/opengl.py b/tests/opengl.py
index f7e408cd5..f6a38e40e 100644
--- a/tests/opengl.py
+++ b/tests/opengl.py
@@ -704,6 +704,7 @@ with profile.test_list.group_manager(
 g(['getteximage-targets', '1D'])
 g(['getteximage-targets', '2D'])
 g(['teximage-scale-bias'])
+g(['tex-upside-down-miptree'])
 add_msaa_visual_plain_tests(g, ['draw-pixels'])
 add_msaa_visual_plain_tests(g, ['read-front'], run_concurrent=False)
 add_msaa_visual_plain_tests(g, ['read-front', 'clear-front-first'],
diff --git a/tests/texturing/CMakeLists.gl.txt 
b/tests/texturing/CMakeLists.gl.txt
index e5d41e432..02b572c79 100644
--- a/tests/texturing/CMakeLists.gl.txt
+++ b/tests/texturing/CMakeLists.gl.txt
@@ -98,5 +98,6 @@ piglit_add_executable (texture-al texture-al.c)
 piglit_add_executable (texture-rg texture-rg.c)
 piglit_add_executable (teximage-colors teximage-colors.c)
 piglit_add_executable (zero-tex-coord zero-tex-coord.c)
+piglit_add_executable (tex-upside-down-miptree tex-upside-down-miptree.c)
 
 # vim: ft=cmake:
diff --git a/tests/texturing/tex-upside-down-miptree.c 
b/tests/texturing/tex-upside-down-miptree.c
new file mode 100644
index 0..8e8f7154b
--- /dev/null
+++ b/tests/texturing/tex-upside-down-miptree.c
@@ -0,0 +1,171 @@
+/*
+ * Copyright (c) 2018 Andrii Simiklit
+ *
+ * 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.
+ *
+ * Authors:
+ *Andrii Simiklit 
+ *
+ */
+
+/**
+ * Test what there no an assertion when we use upside down miptree and
+ * GL_TEXTURE_MIN_FILTER is GL_LINEAR, base level is not 0
+ * Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107987
+ */
+
+#include "piglit-util-gl.h"
+#define TW 64
+#define TH 64
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+   config.supports_gl_compat_version = 10;
+
+   config.window_visual = PIGLIT_GL_VISUAL_RGBA | PIGLIT_GL_VISUAL_DOUBLE;
+   config.khr_no_error_support = PIGLIT_NO_ERRORS;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+GLuint prog = 0;
+GLuint texture = 0;
+static unsigned nlevels = 0;
+static const char *fragShaderText =
+   "uniform sampler2D tex;\n"
+   "void main()\n"
+   "{\n"
+   "   gl_FragColor = texture2D(tex, gl_TexCoord[0].xy).rgba;\n"
+   "}\n";
+
+static void
+get_rect_bounds(int pos, int *x, int *y, int *w, int *h)
+{
+   *x = pos * (piglit_width / 3) + 5;
+   *y = 5;
+   *w = piglit_width / 3 - 10;
+   *h = piglit_height - 10;
+}
+
+
+static void
+draw_rect(int pos)
+{
+   int x, y, w, h;
+   get_rect_bounds(pos, , , , );
+   piglit_draw_rect_tex(x, y, w, h, 0, 0, 1, 1);
+}
+
+
+static GLboolean
+probe_pos(int pos, const GLfloat expected[4])
+{
+   int x, y, w, h;
+   get_rect_bounds(pos, , , , );
+   return piglit_probe_rect_rgba(x, y, w, h, expected);
+}
+
+
+enum piglit_result
+piglit_display(void)
+{
+   GLboolean pass = GL_TRUE;
+   unsigned level;
+   const GLfloat oneby255 = (1.0 / 255.0);
+   const 

Re: [Piglit] [PATCH] miptree: test ability to use upside down miptree

2018-12-03 Thread andrey simiklit
Hello,

I think that I found one more issue (small but anyway issue) in my patch.
The texture which is created in 'setup_texture' function is never released (
I would like to delete it at end of the 'piglit_display'.

Regards,
Andrii.

On Mon, Dec 3, 2018 at 4:14 PM andrey simiklit 
wrote:

> On Mon, Dec 3, 2018 at 1:50 PM Erik Faye-Lund <
> erik.faye-l...@collabora.com> wrote:
>
>> On Mon, 2018-12-03 at 13:31 +0200, andrey simiklit wrote:
>> > Hello,
>> >
>> > Thanks for review.
>> > I will fix all these issues and provide v2 shortly :)
>> >
>> > Thanks,
>> > Andrii.
>> >
>> > On Mon, Dec 3, 2018 at 12:37 PM Erik Faye-Lund <
>> > erik.faye-l...@collabora.com> wrote:
>> > > Just a few nits, do with them as you like. The test itself looks
>> > > good
>> > > to me :)
>> > >
>> > > Reviewed-by: Erik Faye-Lund 
>> > >
>> > > On Tue, 2018-10-23 at 16:44 +0300, asimiklit.w...@gmail.com wrote:
>> > > > From: Andrii Simiklit 
>> > > >
>> > > > Test that usage of upside down miptree doesn't cause assertion
>> > > >
>> > > > The miptree:
>> > > >
>> > > > level 0 = 1x1
>> > > > level 1 = 2x2
>> > > > level 2 = 4x4
>> > > > ...
>> > > > level n = NxN
>> > > >
>> > > > should be acceptable for case when we don't use a min filter.
>> > > >
>> > > > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107987
>> > > > Signed-off-by: Andrii Simiklit 
>> > > > ---
>> > > >  tests/opengl.py   |   1 +
>> > > >  tests/texturing/CMakeLists.gl.txt |   1 +
>> > > >  tests/texturing/tex-upside-down-miptree.c | 171
>> > > > ++
>> > > >  3 files changed, 173 insertions(+)
>> > > >  create mode 100644 tests/texturing/tex-upside-down-miptree.c
>> > > >
>> > > > diff --git a/tests/opengl.py b/tests/opengl.py
>> > > > index f7e408cd5..f6a38e40e 100644
>> > > > --- a/tests/opengl.py
>> > > > +++ b/tests/opengl.py
>> > > > @@ -704,6 +704,7 @@ with profile.test_list.group_manager(
>> > > >  g(['getteximage-targets', '1D'])
>> > > >  g(['getteximage-targets', '2D'])
>> > > >  g(['teximage-scale-bias'])
>> > > > +g(['tex-upside-down-miptree'])
>> > > >  add_msaa_visual_plain_tests(g, ['draw-pixels'])
>> > > >  add_msaa_visual_plain_tests(g, ['read-front'],
>> > > > run_concurrent=False)
>> > > >  add_msaa_visual_plain_tests(g, ['read-front', 'clear-front-
>> > > > first'],
>> > > > diff --git a/tests/texturing/CMakeLists.gl.txt
>> > > > b/tests/texturing/CMakeLists.gl.txt
>> > > > index e5d41e432..02b572c79 100644
>> > > > --- a/tests/texturing/CMakeLists.gl.txt
>> > > > +++ b/tests/texturing/CMakeLists.gl.txt
>> > > > @@ -98,5 +98,6 @@ piglit_add_executable (texture-al texture-al.c)
>> > > >  piglit_add_executable (texture-rg texture-rg.c)
>> > > >  piglit_add_executable (teximage-colors teximage-colors.c)
>> > > >  piglit_add_executable (zero-tex-coord zero-tex-coord.c)
>> > > > +piglit_add_executable (tex-upside-down-miptree tex-upside-down-
>> > > > miptree.c)
>> > > >
>> > > >  # vim: ft=cmake:
>> > > > diff --git a/tests/texturing/tex-upside-down-miptree.c
>> > > > b/tests/texturing/tex-upside-down-miptree.c
>> > > > new file mode 100644
>> > > > index 0..2d10fb49a
>> > > > --- /dev/null
>> > > > +++ b/tests/texturing/tex-upside-down-miptree.c
>> > > > @@ -0,0 +1,171 @@
>> > > > +/*
>> > > > + * Copyright (c) 2018 Andrii Simiklit
>> > > > + *
>> > > > + * 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.
>> > > > + *
>> > > > + * Authors:
>> > > > + *Andrii Simiklit 
>> > > > + *
>> > > > + */
>> > > > +
>> > > > +/**
>> > > > + * Test what there no an assertion when we use 

Re: [Piglit] [PATCH] miptree: test ability to use upside down miptree

2018-12-03 Thread andrey simiklit
On Mon, Dec 3, 2018 at 1:50 PM Erik Faye-Lund 
wrote:

> On Mon, 2018-12-03 at 13:31 +0200, andrey simiklit wrote:
> > Hello,
> >
> > Thanks for review.
> > I will fix all these issues and provide v2 shortly :)
> >
> > Thanks,
> > Andrii.
> >
> > On Mon, Dec 3, 2018 at 12:37 PM Erik Faye-Lund <
> > erik.faye-l...@collabora.com> wrote:
> > > Just a few nits, do with them as you like. The test itself looks
> > > good
> > > to me :)
> > >
> > > Reviewed-by: Erik Faye-Lund 
> > >
> > > On Tue, 2018-10-23 at 16:44 +0300, asimiklit.w...@gmail.com wrote:
> > > > From: Andrii Simiklit 
> > > >
> > > > Test that usage of upside down miptree doesn't cause assertion
> > > >
> > > > The miptree:
> > > >
> > > > level 0 = 1x1
> > > > level 1 = 2x2
> > > > level 2 = 4x4
> > > > ...
> > > > level n = NxN
> > > >
> > > > should be acceptable for case when we don't use a min filter.
> > > >
> > > > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107987
> > > > Signed-off-by: Andrii Simiklit 
> > > > ---
> > > >  tests/opengl.py   |   1 +
> > > >  tests/texturing/CMakeLists.gl.txt |   1 +
> > > >  tests/texturing/tex-upside-down-miptree.c | 171
> > > > ++
> > > >  3 files changed, 173 insertions(+)
> > > >  create mode 100644 tests/texturing/tex-upside-down-miptree.c
> > > >
> > > > diff --git a/tests/opengl.py b/tests/opengl.py
> > > > index f7e408cd5..f6a38e40e 100644
> > > > --- a/tests/opengl.py
> > > > +++ b/tests/opengl.py
> > > > @@ -704,6 +704,7 @@ with profile.test_list.group_manager(
> > > >  g(['getteximage-targets', '1D'])
> > > >  g(['getteximage-targets', '2D'])
> > > >  g(['teximage-scale-bias'])
> > > > +g(['tex-upside-down-miptree'])
> > > >  add_msaa_visual_plain_tests(g, ['draw-pixels'])
> > > >  add_msaa_visual_plain_tests(g, ['read-front'],
> > > > run_concurrent=False)
> > > >  add_msaa_visual_plain_tests(g, ['read-front', 'clear-front-
> > > > first'],
> > > > diff --git a/tests/texturing/CMakeLists.gl.txt
> > > > b/tests/texturing/CMakeLists.gl.txt
> > > > index e5d41e432..02b572c79 100644
> > > > --- a/tests/texturing/CMakeLists.gl.txt
> > > > +++ b/tests/texturing/CMakeLists.gl.txt
> > > > @@ -98,5 +98,6 @@ piglit_add_executable (texture-al texture-al.c)
> > > >  piglit_add_executable (texture-rg texture-rg.c)
> > > >  piglit_add_executable (teximage-colors teximage-colors.c)
> > > >  piglit_add_executable (zero-tex-coord zero-tex-coord.c)
> > > > +piglit_add_executable (tex-upside-down-miptree tex-upside-down-
> > > > miptree.c)
> > > >
> > > >  # vim: ft=cmake:
> > > > diff --git a/tests/texturing/tex-upside-down-miptree.c
> > > > b/tests/texturing/tex-upside-down-miptree.c
> > > > new file mode 100644
> > > > index 0..2d10fb49a
> > > > --- /dev/null
> > > > +++ b/tests/texturing/tex-upside-down-miptree.c
> > > > @@ -0,0 +1,171 @@
> > > > +/*
> > > > + * Copyright (c) 2018 Andrii Simiklit
> > > > + *
> > > > + * 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.
> > > > + *
> > > > + * Authors:
> > > > + *Andrii Simiklit 
> > > > + *
> > > > + */
> > > > +
> > > > +/**
> > > > + * Test what there no an assertion when we use upside down
> > > miptree
> > > > and
> > > > + * GL_TEXTURE_MIN_FILTER is GL_LINEAR, base level is not 0
> > > > + * Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107987
> > > > + */
> > > > +
> > > > +#include "piglit-util-gl.h"
> > > > +#define TW 64
> > > > +#define TH 64
> > > > +
> > > > +PIGLIT_GL_TEST_CONFIG_BEGIN
> > > > +
> > > > + config.supports_gl_compat_version = 10;
> > >
> > > Just a suggestion:
> > >
> > > Since you 

Re: [Piglit] [PATCH] miptree: test ability to use upside down miptree

2018-12-03 Thread Erik Faye-Lund
On Mon, 2018-12-03 at 13:31 +0200, andrey simiklit wrote:
> Hello,
> 
> Thanks for review.
> I will fix all these issues and provide v2 shortly :)
> 
> Thanks,
> Andrii.
> 
> On Mon, Dec 3, 2018 at 12:37 PM Erik Faye-Lund <
> erik.faye-l...@collabora.com> wrote:
> > Just a few nits, do with them as you like. The test itself looks
> > good
> > to me :)
> > 
> > Reviewed-by: Erik Faye-Lund 
> > 
> > On Tue, 2018-10-23 at 16:44 +0300, asimiklit.w...@gmail.com wrote:
> > > From: Andrii Simiklit 
> > > 
> > > Test that usage of upside down miptree doesn't cause assertion
> > > 
> > > The miptree:
> > > 
> > > level 0 = 1x1
> > > level 1 = 2x2
> > > level 2 = 4x4
> > > ...
> > > level n = NxN
> > > 
> > > should be acceptable for case when we don't use a min filter.
> > > 
> > > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107987
> > > Signed-off-by: Andrii Simiklit 
> > > ---
> > >  tests/opengl.py   |   1 +
> > >  tests/texturing/CMakeLists.gl.txt |   1 +
> > >  tests/texturing/tex-upside-down-miptree.c | 171
> > > ++
> > >  3 files changed, 173 insertions(+)
> > >  create mode 100644 tests/texturing/tex-upside-down-miptree.c
> > > 
> > > diff --git a/tests/opengl.py b/tests/opengl.py
> > > index f7e408cd5..f6a38e40e 100644
> > > --- a/tests/opengl.py
> > > +++ b/tests/opengl.py
> > > @@ -704,6 +704,7 @@ with profile.test_list.group_manager(
> > >  g(['getteximage-targets', '1D'])
> > >  g(['getteximage-targets', '2D'])
> > >  g(['teximage-scale-bias'])
> > > +g(['tex-upside-down-miptree'])
> > >  add_msaa_visual_plain_tests(g, ['draw-pixels'])
> > >  add_msaa_visual_plain_tests(g, ['read-front'],
> > > run_concurrent=False)
> > >  add_msaa_visual_plain_tests(g, ['read-front', 'clear-front-
> > > first'],
> > > diff --git a/tests/texturing/CMakeLists.gl.txt
> > > b/tests/texturing/CMakeLists.gl.txt
> > > index e5d41e432..02b572c79 100644
> > > --- a/tests/texturing/CMakeLists.gl.txt
> > > +++ b/tests/texturing/CMakeLists.gl.txt
> > > @@ -98,5 +98,6 @@ piglit_add_executable (texture-al texture-al.c)
> > >  piglit_add_executable (texture-rg texture-rg.c)
> > >  piglit_add_executable (teximage-colors teximage-colors.c)
> > >  piglit_add_executable (zero-tex-coord zero-tex-coord.c)
> > > +piglit_add_executable (tex-upside-down-miptree tex-upside-down-
> > > miptree.c)
> > >  
> > >  # vim: ft=cmake:
> > > diff --git a/tests/texturing/tex-upside-down-miptree.c
> > > b/tests/texturing/tex-upside-down-miptree.c
> > > new file mode 100644
> > > index 0..2d10fb49a
> > > --- /dev/null
> > > +++ b/tests/texturing/tex-upside-down-miptree.c
> > > @@ -0,0 +1,171 @@
> > > +/*
> > > + * Copyright (c) 2018 Andrii Simiklit
> > > + *
> > > + * 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.
> > > + *
> > > + * Authors:
> > > + *Andrii Simiklit 
> > > + *
> > > + */
> > > +
> > > +/**
> > > + * Test what there no an assertion when we use upside down
> > miptree
> > > and
> > > + * GL_TEXTURE_MIN_FILTER is GL_LINEAR, base level is not 0
> > > + * Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107987
> > > + */
> > > +
> > > +#include "piglit-util-gl.h"
> > > +#define TW 64
> > > +#define TH 64
> > > +
> > > +PIGLIT_GL_TEST_CONFIG_BEGIN
> > > +
> > > + config.supports_gl_compat_version = 10;
> > 
> > Just a suggestion:
> > 
> > Since you already did the hassle of using shaders, perhaps you
> > could
> > get this text to work on GLES 2?
> > 

Turning my brain back on for a second: This isn't going to work, I
think. GLES 2 doesn't support changing the base-level.

> > > +
> > > + config.window_visual = PIGLIT_GL_VISUAL_RGBA |
> > > PIGLIT_GL_VISUAL_DOUBLE;
> 

Re: [Piglit] [PATCH] miptree: test ability to use upside down miptree

2018-12-03 Thread andrey simiklit
Hello,

Thanks for review.
I will fix all these issues and provide v2 shortly :)

Thanks,
Andrii.

On Mon, Dec 3, 2018 at 12:37 PM Erik Faye-Lund 
wrote:

> Just a few nits, do with them as you like. The test itself looks good
> to me :)
>
> Reviewed-by: Erik Faye-Lund 
>
> On Tue, 2018-10-23 at 16:44 +0300, asimiklit.w...@gmail.com wrote:
> > From: Andrii Simiklit 
> >
> > Test that usage of upside down miptree doesn't cause assertion
> >
> > The miptree:
> >
> > level 0 = 1x1
> > level 1 = 2x2
> > level 2 = 4x4
> > ...
> > level n = NxN
> >
> > should be acceptable for case when we don't use a min filter.
> >
> > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107987
> > Signed-off-by: Andrii Simiklit 
> > ---
> >  tests/opengl.py   |   1 +
> >  tests/texturing/CMakeLists.gl.txt |   1 +
> >  tests/texturing/tex-upside-down-miptree.c | 171
> > ++
> >  3 files changed, 173 insertions(+)
> >  create mode 100644 tests/texturing/tex-upside-down-miptree.c
> >
> > diff --git a/tests/opengl.py b/tests/opengl.py
> > index f7e408cd5..f6a38e40e 100644
> > --- a/tests/opengl.py
> > +++ b/tests/opengl.py
> > @@ -704,6 +704,7 @@ with profile.test_list.group_manager(
> >  g(['getteximage-targets', '1D'])
> >  g(['getteximage-targets', '2D'])
> >  g(['teximage-scale-bias'])
> > +g(['tex-upside-down-miptree'])
> >  add_msaa_visual_plain_tests(g, ['draw-pixels'])
> >  add_msaa_visual_plain_tests(g, ['read-front'],
> > run_concurrent=False)
> >  add_msaa_visual_plain_tests(g, ['read-front', 'clear-front-
> > first'],
> > diff --git a/tests/texturing/CMakeLists.gl.txt
> > b/tests/texturing/CMakeLists.gl.txt
> > index e5d41e432..02b572c79 100644
> > --- a/tests/texturing/CMakeLists.gl.txt
> > +++ b/tests/texturing/CMakeLists.gl.txt
> > @@ -98,5 +98,6 @@ piglit_add_executable (texture-al texture-al.c)
> >  piglit_add_executable (texture-rg texture-rg.c)
> >  piglit_add_executable (teximage-colors teximage-colors.c)
> >  piglit_add_executable (zero-tex-coord zero-tex-coord.c)
> > +piglit_add_executable (tex-upside-down-miptree tex-upside-down-
> > miptree.c)
> >
> >  # vim: ft=cmake:
> > diff --git a/tests/texturing/tex-upside-down-miptree.c
> > b/tests/texturing/tex-upside-down-miptree.c
> > new file mode 100644
> > index 0..2d10fb49a
> > --- /dev/null
> > +++ b/tests/texturing/tex-upside-down-miptree.c
> > @@ -0,0 +1,171 @@
> > +/*
> > + * Copyright (c) 2018 Andrii Simiklit
> > + *
> > + * 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.
> > + *
> > + * Authors:
> > + *Andrii Simiklit 
> > + *
> > + */
> > +
> > +/**
> > + * Test what there no an assertion when we use upside down miptree
> > and
> > + * GL_TEXTURE_MIN_FILTER is GL_LINEAR, base level is not 0
> > + * Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107987
> > + */
> > +
> > +#include "piglit-util-gl.h"
> > +#define TW 64
> > +#define TH 64
> > +
> > +PIGLIT_GL_TEST_CONFIG_BEGIN
> > +
> > + config.supports_gl_compat_version = 10;
>
> Just a suggestion:
>
> Since you already did the hassle of using shaders, perhaps you could
> get this text to work on GLES 2?
>
> > +
> > + config.window_visual = PIGLIT_GL_VISUAL_RGBA |
> > PIGLIT_GL_VISUAL_DOUBLE;
> > + config.khr_no_error_support = PIGLIT_NO_ERRORS;
> > +
> > +PIGLIT_GL_TEST_CONFIG_END
> > +
> > +static unsigned nlevels = 0;
> > +
> > +static void
> > +get_rect_bounds(int pos, int *x, int *y, int *w, int *h)
> > +{
> > + *x = pos * (piglit_width / 3) + 5;
> > + *y = 5;
> > + *w = piglit_width / 3 - 10;
> > + *h = piglit_height - 10;
> > +}
> > +
> > +
> > +static void
> > +draw_rect(int pos)
> > +{
> > + int x, y, w, h;
> > + get_rect_bounds(pos, , , , );
> > + piglit_draw_rect_tex(x, y, w, h, 

Re: [Piglit] [PATCH] miptree: test ability to use upside down miptree

2018-12-03 Thread Erik Faye-Lund
Just a few nits, do with them as you like. The test itself looks good
to me :)

Reviewed-by: Erik Faye-Lund 

On Tue, 2018-10-23 at 16:44 +0300, asimiklit.w...@gmail.com wrote:
> From: Andrii Simiklit 
> 
> Test that usage of upside down miptree doesn't cause assertion
> 
> The miptree:
> 
> level 0 = 1x1
> level 1 = 2x2
> level 2 = 4x4
> ...
> level n = NxN
> 
> should be acceptable for case when we don't use a min filter.
> 
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107987
> Signed-off-by: Andrii Simiklit 
> ---
>  tests/opengl.py   |   1 +
>  tests/texturing/CMakeLists.gl.txt |   1 +
>  tests/texturing/tex-upside-down-miptree.c | 171
> ++
>  3 files changed, 173 insertions(+)
>  create mode 100644 tests/texturing/tex-upside-down-miptree.c
> 
> diff --git a/tests/opengl.py b/tests/opengl.py
> index f7e408cd5..f6a38e40e 100644
> --- a/tests/opengl.py
> +++ b/tests/opengl.py
> @@ -704,6 +704,7 @@ with profile.test_list.group_manager(
>  g(['getteximage-targets', '1D'])
>  g(['getteximage-targets', '2D'])
>  g(['teximage-scale-bias'])
> +g(['tex-upside-down-miptree'])
>  add_msaa_visual_plain_tests(g, ['draw-pixels'])
>  add_msaa_visual_plain_tests(g, ['read-front'],
> run_concurrent=False)
>  add_msaa_visual_plain_tests(g, ['read-front', 'clear-front-
> first'],
> diff --git a/tests/texturing/CMakeLists.gl.txt
> b/tests/texturing/CMakeLists.gl.txt
> index e5d41e432..02b572c79 100644
> --- a/tests/texturing/CMakeLists.gl.txt
> +++ b/tests/texturing/CMakeLists.gl.txt
> @@ -98,5 +98,6 @@ piglit_add_executable (texture-al texture-al.c)
>  piglit_add_executable (texture-rg texture-rg.c)
>  piglit_add_executable (teximage-colors teximage-colors.c)
>  piglit_add_executable (zero-tex-coord zero-tex-coord.c)
> +piglit_add_executable (tex-upside-down-miptree tex-upside-down-
> miptree.c)
>  
>  # vim: ft=cmake:
> diff --git a/tests/texturing/tex-upside-down-miptree.c
> b/tests/texturing/tex-upside-down-miptree.c
> new file mode 100644
> index 0..2d10fb49a
> --- /dev/null
> +++ b/tests/texturing/tex-upside-down-miptree.c
> @@ -0,0 +1,171 @@
> +/*
> + * Copyright (c) 2018 Andrii Simiklit
> + *
> + * 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.
> + *
> + * Authors:
> + *Andrii Simiklit 
> + *
> + */
> +
> +/**
> + * Test what there no an assertion when we use upside down miptree
> and
> + * GL_TEXTURE_MIN_FILTER is GL_LINEAR, base level is not 0
> + * Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107987
> + */
> +
> +#include "piglit-util-gl.h"
> +#define TW 64
> +#define TH 64
> +
> +PIGLIT_GL_TEST_CONFIG_BEGIN
> +
> + config.supports_gl_compat_version = 10;

Just a suggestion:

Since you already did the hassle of using shaders, perhaps you could
get this text to work on GLES 2?

> +
> + config.window_visual = PIGLIT_GL_VISUAL_RGBA |
> PIGLIT_GL_VISUAL_DOUBLE;
> + config.khr_no_error_support = PIGLIT_NO_ERRORS;
> +
> +PIGLIT_GL_TEST_CONFIG_END
> +
> +static unsigned nlevels = 0;
> +
> +static void
> +get_rect_bounds(int pos, int *x, int *y, int *w, int *h)
> +{
> + *x = pos * (piglit_width / 3) + 5;
> + *y = 5;
> + *w = piglit_width / 3 - 10;
> + *h = piglit_height - 10;
> +}
> +
> +
> +static void
> +draw_rect(int pos)
> +{
> + int x, y, w, h;
> + get_rect_bounds(pos, , , , );
> + piglit_draw_rect_tex(x, y, w, h, 0, 0, 1, 1);
> +}
> +
> +
> +static GLboolean
> +probe_pos(int pos, const GLfloat expected[4])
> +{
> + int x, y, w, h;
> + get_rect_bounds(pos, , , , );
> + return piglit_probe_rect_rgba(x, y, w, h, expected);
> +}
> +
> +
> +enum piglit_result
> +piglit_display(void)
> +{
> + GLboolean pass = GL_TRUE;
> + unsigned level;
> + static const char *fragShaderText =
> + "uniform sampler2D tex;\n"
> +

Re: [Piglit] [PATCH] travis: reflect new best-practice travis-ci configuration

2018-12-03 Thread Andres Gomez
This is:

Reviewed-by: Andres Gomez 

On Sun, 2018-12-02 at 11:28 -0500, Rhys Kidd wrote:
> Travis-CI has or will shortly make in early December 2018 a number of 
> beneficial
> changes to their Linux continuous integration testing infrastructure [0][1].
> An accompanying benefit of this change is that Ubuntu Xenial (16.04 LTS) is 
> now
> supported.
> 
> The benefits for piglit are primarily:
> * Testing against a more modern, supported Ubuntu Xenial (16.04 LTS). [2]
> * Removal of a corner-case for Python 3.7, makes testing more consistent.
> * Modest speed improvements from Travis-CI move to Linux infrastructure 
> combined
>   into one (virtualized), from two previously (virtualized and 
> container-based).
> 
> [0] https://blog.travis-ci.com/2018-10-04-combining-linux-infrastructures
> [1] 
> https://blog.travis-ci.com/2018-11-19-required-linux-infrastructure-migration
> [2] https://docs.travis-ci.com/user/reference/xenial/
> 
> Signed-off-by: Rhys Kidd 
> ---
>  .travis.yml | 9 ++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/.travis.yml b/.travis.yml
> index 45b23f009..3043cd4ca 100644
> --- a/.travis.yml
> +++ b/.travis.yml
> @@ -1,6 +1,10 @@
> -sudo: false
> -os: linux
>  language: python
> +
> +os: linux
> +
> +# Use Ubuntu Xenial (16.04 LTS) environment.
> +dist: xenial
> +
>  cache:
>- ccache
>- pip
> @@ -23,7 +27,6 @@ matrix:
>env: TOX_ENV="py36-{generator,noaccel,accel-nix,streams}"
>  - python: 3.7
>env: TOX_ENV="py37-{generator,noaccel,accel-nix,streams}"
> -  dist: xenial# required for Python 3.7 (travis-ci/travis-ci#9069)
>  - env: BUILD=cmake
>  
>  install:
-- 
Br,

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