Re: [Piglit] [PATCH] arb_compute_variable_group_size: Fix require section.

2016-10-18 Thread Nicolai Hähnle

On 17.10.2016 22:33, Matt Turner wrote:

On Mon, Oct 17, 2016 at 12:54 PM, Samuel Pitoiset
 wrote:



On 10/17/2016 09:45 PM, Samuel Pitoiset wrote:


Thanks for fixing this.

Reviewed-by: Samuel Pitoiset 



Actually, we need to check for both ARB_compute_shader and
ARB_compute_variable_group_size since
https://cgit.freedesktop.org/mesa/mesa/commit/?id=8785a8ff8948385a913e9bd75e8cdd1092bd750f.


Strange. Shouldn't a [compute shader] section (or requiring
GL_ARB_compute_variable_group_size) be sufficient?

I'll make the change regardless.


They're slightly different things. Your patch made sure that the test is 
skipped when ARB_compute_variable_group_size isn't available. And it's 
true that for the [require] section, you actually don't need to 
explicitly check for ARB_compute_shader on top of that, because a driver 
that advertises ARB_compute_variable_group_size must also advertise 
ARB_compute_shader.


My patch was mostly about adding the `#extension GL_ARB_compute_shader: 
enable` to the shaders themselves. I've pushed that now as well.


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


[Piglit] [PATCH 6/8] shader_runner: Migrate lookup_enum_string() to new parser library.

2016-10-18 Thread Francisco Jerez
---
 tests/shaders/parser_utils.c  | 25 ++
 tests/shaders/parser_utils.h  | 14 
 tests/shaders/shader_runner.c | 78 +++
 3 files changed, 66 insertions(+), 51 deletions(-)

diff --git a/tests/shaders/parser_utils.c b/tests/shaders/parser_utils.c
index 1bd9a69..d180842 100644
--- a/tests/shaders/parser_utils.c
+++ b/tests/shaders/parser_utils.c
@@ -197,6 +197,31 @@ parse_enum_gl(const char *s, GLenum *e, const char **rest)
 }
 
 bool
+parse_enum_tab(const struct string_to_enum *tab,
+  const char *s, unsigned *e, const char **rest)
+{
+   const char *end = s;
+   bool ret = parse_word(s, &s, &end);
+   unsigned i = 0;
+
+   if (ret) {
+   for (i = 0; tab[i].name; i++) {
+   if (!strncmp(tab[i].name, s, end - s) &&
+   !tab[i].name[end - s])
+   break;
+   }
+
+   *e = tab[i].value;
+   ret = tab[i].name;
+   }
+
+   if (rest)
+   *rest = (ret ? end : s);
+
+   return ret;
+}
+
+bool
 parse_comparison_op(const char *s, enum comparison *t, const char **rest)
 {
if (parse_str(s, "==", rest)) {
diff --git a/tests/shaders/parser_utils.h b/tests/shaders/parser_utils.h
index 8fbfac4..6907a69 100644
--- a/tests/shaders/parser_utils.h
+++ b/tests/shaders/parser_utils.h
@@ -170,6 +170,20 @@ parse_word_copy(const char *s, char *t, unsigned n, const 
char **rest);
 bool
 parse_enum_gl(const char *s, GLenum *e, const char **rest);
 
+struct string_to_enum {
+   const char *name;
+   unsigned value;
+};
+
+/**
+ * Parse a whitespace-delimited symbolic constant from the set
+ * specified in the \p tab argument pointing to a zero-terminated
+ * array of string-value pairs.
+ */
+bool
+parse_enum_tab(const struct string_to_enum *tab,
+  const char *s, unsigned *e, const char **rest);
+
 const char *eat_whitespace(const char *src);
 const char *eat_text(const char *src);
 bool string_match(const char *string, const char *line);
diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index 148371c..9aa988d 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -82,11 +82,6 @@ struct component_version {
 
 #define ENUM_STRING(e) { #e, e }
 
-struct string_to_enum {
-   const char *name;
-   GLenum token;
-};
-
 extern float piglit_tolerance[4];
 
 static int test_num = 1;
@@ -255,25 +250,6 @@ static const struct string_to_enum all_types[] = {
{ NULL, 0 }
 };
 
-static GLenum
-lookup_enum_string(const struct string_to_enum *table, const char **line,
-  const char *error_desc)
-{
-   int i;
-   *line = eat_whitespace(*line);
-   for (i = 0; table[i].name; i++) {
-   size_t len = strlen(table[i].name);
-   if (strncmp(table[i].name, *line, len) == 0 &&
-   ((*line)[len] == '\0' || isspace((*line)[len]))) {
-   *line = eat_whitespace(*line + len);
-   return table[i].token;
-   }
-   }
-   fprintf(stderr, "Bad %s at: %s\n", error_desc, *line);
-   piglit_report_result(PIGLIT_FAIL);
-   return 0;
-}
-
 static bool
 compare(float ref, float value, enum comparison cmp);
 
@@ -2043,8 +2019,7 @@ active_uniform(const char *line)
const char *rest = line;
char name[512];
char name_buf[512];
-   char pname_string[512];
-   GLenum pname;
+   unsigned pname;
int expected;
int i;
int num_active_uniforms;
@@ -2052,13 +2027,12 @@ active_uniform(const char *line)
REQUIRE(parse_word_copy(rest, name, sizeof(name), &rest),
"Bad uniform name at: %s\n", line);
 
-   strcpy_to_space(pname_string, eat_whitespace(rest));
-   pname = lookup_enum_string(all_pnames, &rest, "glGetUniformsiv pname");
+   REQUIRE(parse_enum_tab(all_pnames, rest, &pname, &rest),
+   "Bad glGetUniformsiv pname at: %s\n", line);
 
-   if (!parse_int(rest, &expected, &rest)) {
-   rest = eat_whitespace(rest);
-   expected = lookup_enum_string(all_types, &rest, "type enum");
-   }
+   REQUIRE(parse_enum_tab(all_types, rest, (unsigned *)&expected, &rest) ||
+   parse_int(rest, &expected, &rest),
+   "Bad expected value at: %s\n", line);
 
glGetProgramiv(prog, GL_ACTIVE_UNIFORMS, &num_active_uniforms);
for (i = 0; i < num_active_uniforms; i++) {
@@ -2230,19 +2204,16 @@ active_program_interface(const char *line)
return;
}
 
-   interface_type = lookup_enum_string(all_program_interface, &line,
-   "glGetProgramResourceiv "
-   "programInterface");
+   REQUIRE(parse_enum_tab(all_program_interface, line,
+  &interface_t

[Piglit] [PATCH 5/8] shader_runner: Migrate process_comparison() to new parser library.

2016-10-18 Thread Francisco Jerez
---
 tests/shaders/parser_utils.c  | 26 ++
 tests/shaders/parser_utils.h  | 14 
 tests/shaders/shader_runner.c | 79 ++-
 3 files changed, 50 insertions(+), 69 deletions(-)

diff --git a/tests/shaders/parser_utils.c b/tests/shaders/parser_utils.c
index 2eb7da1..1bd9a69 100644
--- a/tests/shaders/parser_utils.c
+++ b/tests/shaders/parser_utils.c
@@ -196,6 +196,32 @@ parse_enum_gl(const char *s, GLenum *e, const char **rest)
return ret;
 }
 
+bool
+parse_comparison_op(const char *s, enum comparison *t, const char **rest)
+{
+   if (parse_str(s, "==", rest)) {
+   *t = equal;
+   return true;
+   } else if (parse_str(s, "!=", rest)) {
+   *t = greater;
+   return true;
+   } else if (parse_str(s, "<=", rest)) {
+   *t = less_equal;
+   return true;
+   } else  if (parse_str(s, "<", rest)) {
+   *t = less;
+   return true;
+   } else if (parse_str(s, ">=", rest)) {
+   *t = greater_equal;
+   return true;
+   } else if (parse_str(s, ">", rest)) {
+   *t = greater;
+   return true;
+   } else {
+   return false;
+   }
+}
+
 /**
  * Skip over whitespace upto the end of line
  */
diff --git a/tests/shaders/parser_utils.h b/tests/shaders/parser_utils.h
index 3579bee..8fbfac4 100644
--- a/tests/shaders/parser_utils.h
+++ b/tests/shaders/parser_utils.h
@@ -175,6 +175,20 @@ const char *eat_text(const char *src);
 bool string_match(const char *string, const char *line);
 const char *strcpy_to_space(char *dst, const char *src);
 
+enum comparison {
+   equal = 0,
+   not_equal,
+   less,
+   greater_equal,
+   greater,
+   less_equal
+};
+
+/**
+ * Parse a binary comparison operator.
+ */
+bool parse_comparison_op(const char *s, enum comparison *t, const char **rest);
+
 /**
  * Abort the Piglit test with failure status if the boolean expression
  * (typically the result of a chain of parse function calls) evaluates
diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index 79ffdad..148371c 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -169,16 +169,6 @@ enum states {
test,
 };
 
-
-enum comparison {
-   equal = 0,
-   not_equal,
-   less,
-   greater_equal,
-   greater,
-   less_equal
-};
-
 static const struct string_to_enum all_types[] = {
ENUM_STRING(GL_FLOAT),
ENUM_STRING(GL_FLOAT_VEC2),
@@ -631,56 +621,6 @@ comparison_string(enum comparison cmp)
return false;
 }
 
-
-/**
- * Parse a binary comparison operator and return the matching token
- */
-static const char *
-process_comparison(const char *src, enum comparison *cmp)
-{
-   char buf[32];
-
-   switch (src[0]) {
-   case '=':
-   if (src[1] == '=') {
-   *cmp = equal;
-   return src + 2;
-   }
-   break;
-   case '<':
-   if (src[1] == '=') {
-   *cmp = less_equal;
-   return src + 2;
-   } else {
-   *cmp = less;
-   return src + 1;
-   }
-   case '>':
-   if (src[1] == '=') {
-   *cmp = greater_equal;
-   return src + 2;
-   } else {
-   *cmp = greater;
-   return src + 1;
-   }
-   case '!':
-   if (src[1] == '=') {
-   *cmp = not_equal;
-   return src + 2;
-   }
-   break;
-   }
-
-   strncpy(buf, src, sizeof(buf));
-   buf[sizeof(buf) - 1] = '\0';
-   printf("invalid comparison in test script:\n%s\n", buf);
-   piglit_report_result(PIGLIT_FAIL);
-
-   /* Won't get here. */
-   return NULL;
-}
-
-
 /**
  * " ES" before the comparison operator indicates the version
  * pertains to GL ES.
@@ -695,8 +635,8 @@ parse_version_comparison(const char *line, enum comparison 
*cmp,
const bool core = parse_str(line, "CORE", &line);
const bool es = parse_str(line, "ES", &line);
 
-   line = eat_whitespace(line);
-   line = process_comparison(line, cmp);
+   REQUIRE(parse_comparison_op(line, cmp, &line),
+   "Invalid comparison operation at: %s\n", line);
 
REQUIRE(parse_uint(line, &major, &line) &&
parse_str(line, ".", &line) &&
@@ -774,9 +714,8 @@ process_requirement(const char *line)
 
REQUIRE(parse_enum_gl(line, &int_enum, &line),
"Invalid comparison enum at: %s\n", line);
-
-   line = process_comparison(eat_whitespace(line), &cmp);
-
+   REQUIRE(parse_comparison_op(line, &cmp, &line),
+   "Invalid compariso

[Piglit] [PATCH 8/8] shader_runner: Remove unused parser utils.

2016-10-18 Thread Francisco Jerez
---
 tests/shaders/parser_utils.c | 48 +---
 tests/shaders/parser_utils.h |  7 +--
 2 files changed, 2 insertions(+), 53 deletions(-)

diff --git a/tests/shaders/parser_utils.c b/tests/shaders/parser_utils.c
index ba59671..3b1400c 100644
--- a/tests/shaders/parser_utils.c
+++ b/tests/shaders/parser_utils.c
@@ -1,5 +1,5 @@
 /*
- * Copyright © 2010-2016 Intel Corporation
+ * Copyright © 2016 Intel Corporation
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
@@ -263,49 +263,3 @@ parse_comparison_op(const char *s, enum comparison *t, 
const char **rest)
return false;
}
 }
-
-/**
- * Skip over whitespace upto the end of line
- */
-const char *
-eat_whitespace(const char *src)
-{
-   while (isspace((int) *src) && (*src != '\n'))
-   src++;
-
-   return src;
-}
-
-
-/**
- * Skip over non-whitespace upto the end of line
- */
-const char *
-eat_text(const char *src)
-{
-   while (!isspace((int) *src) && (*src != '\0'))
-   src++;
-
-   return src;
-}
-
-
-bool
-string_match(const char *string, const char *line)
-{
-   return (strncmp(string, line, strlen(string)) == 0);
-}
-
-
-/**
- * Copy a string until either whitespace or the end of the string
- */
-const char *
-strcpy_to_space(char *dst, const char *src)
-{
-   while (!isspace((int) *src) && (*src != '\0'))
-   *(dst++) = *(src++);
-
-   *dst = '\0';
-   return src;
-}
diff --git a/tests/shaders/parser_utils.h b/tests/shaders/parser_utils.h
index 28e0630..0768b27 100644
--- a/tests/shaders/parser_utils.h
+++ b/tests/shaders/parser_utils.h
@@ -1,5 +1,5 @@
 /*
- * Copyright © 2010-2016 Intel Corporation
+ * Copyright © 2016 Intel Corporation
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
@@ -190,11 +190,6 @@ parse_enum_tab(const struct string_to_enum *tab,
 bool
 parse_tex_target(const char *s, GLenum *t, const char **rest);
 
-const char *eat_whitespace(const char *src);
-const char *eat_text(const char *src);
-bool string_match(const char *string, const char *line);
-const char *strcpy_to_space(char *dst, const char *src);
-
 enum comparison {
equal = 0,
not_equal,
-- 
2.9.0

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


[Piglit] [PATCH 4/8] built-in-constants: Switch to new parser library.

2016-10-18 Thread Francisco Jerez
---
 tests/shaders/built-in-constants.c | 34 +++---
 1 file changed, 15 insertions(+), 19 deletions(-)

diff --git a/tests/shaders/built-in-constants.c 
b/tests/shaders/built-in-constants.c
index 5791c7c..d470fe1 100644
--- a/tests/shaders/built-in-constants.c
+++ b/tests/shaders/built-in-constants.c
@@ -230,7 +230,7 @@ parse_file(const char *filename)
required_glsl_version_string[len] = '\0';
 
required_glsl_version = strtol(line, &endptr, 10);
-   line = (char *) eat_whitespace(endptr);
+   parse_whitespace(endptr, (const char **)&line);
es_shader = strncmp("es\n", line, 3) == 0;
 
if (required_glsl_version <= 0 ||
@@ -289,13 +289,13 @@ parse_file(const char *filename)
}
 
while (line[0] != '\0') {
-   line = (char *) eat_whitespace(line);
+   if (!(parse_word(line, (const char **)&line,
+(const char **)&endptr) &&
+ (parse_str(line, "gl_Max", NULL) ||
+  parse_str(line, "gl_Min", NULL {
+   char bad_name[80] = "";
+   parse_word_copy(line, bad_name, sizeof(bad_name), NULL);
 
-   if (string_match("gl_Max", line) != 0
-   && string_match("gl_Min", line) != 0) {
-   char bad_name[80];
-
-   strcpy_to_space(bad_name, line);
fprintf(stderr,
"Invalid built-in constant name \"%s\".\n",
bad_name);
@@ -303,18 +303,14 @@ parse_file(const char *filename)
}
 
tests[num_tests].name = line;
+   *endptr = 0;
+   line = endptr + 1;
 
-   line = (char *) eat_text(line);
-   line[0] = '\0';
-   line++;
-
-   line = (char *) eat_whitespace(line);
-
-   tests[num_tests].minimum = strtol(line, &endptr, 0);
-   if (endptr == line) {
-   char bad_number[80];
-
-   strcpy_to_space(bad_number, line);
+   if (!parse_int(line, &tests[num_tests].minimum,
+  (const char **)&endptr)) {
+   char bad_number[80] = "";
+   parse_word_copy(line, bad_number, sizeof(bad_number),
+   NULL);
 
fprintf(stderr,
"Invalid built-in constant value \"%s\".\n",
@@ -553,7 +549,7 @@ piglit_init(int argc, char **argv)
for (i = 0; i < num_tests; i++) {
bool subtest_pass = true;
const char *comparitor =
-   string_match("gl_Min", tests[i].name) ? "<=" : ">=";
+   parse_str(tests[i].name, "gl_Min", NULL) ? "<=" : ">=";
 
/* Generate the uniform declaration for the test.  This will
 * be shared by all shader stages.
-- 
2.9.0

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


[Piglit] [PATCH 2/8] shader_runner: Switch to the recently introduced parser primitives.

2016-10-18 Thread Francisco Jerez
This is just an initial pass changing shader_runner to use the most
basic parser primitives defined in a previous commit.  Additional
primitives for parsing numeric constants, comparison operators and
various enumerations will be introduced later on.
---
 tests/shaders/shader_runner.c | 446 +++---
 1 file changed, 203 insertions(+), 243 deletions(-)

diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index b0bde2c..92fab38 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -695,17 +695,9 @@ parse_version_comparison(const char *line, enum comparison 
*cmp,
unsigned major;
unsigned minor;
unsigned full_num;
-   bool es = false;
-   bool core = false;
+   const bool core = parse_str(line, "CORE", &line);
+   const bool es = parse_str(line, "ES", &line);
 
-   if (string_match(" CORE", line)) {
-   core = true;
-   line += 5;
-   }
-   if (string_match(" ES", line)) {
-   es = true;
-   line += 3;
-   }
line = eat_whitespace(line);
line = process_comparison(line, cmp);
 
@@ -713,7 +705,7 @@ parse_version_comparison(const char *line, enum comparison 
*cmp,
sscanf(line, "%u.%u", &major, &minor);
line = eat_text(line);
 
-   line = eat_whitespace(line);
+   parse_whitespace(line, &line);
if (*line != '\n') {
printf("Unexpected characters following version comparison\n");
piglit_report_result(PIGLIT_FAIL);
@@ -777,30 +769,28 @@ process_requirement(const char *line)
 * shader_runner to read the specified integer value and
 * processes the given requirement.
 */
-   if (string_match("INT ", line)) {
+   if (parse_str(line, "INT ", &line)) {
enum comparison cmp;
-   const char *enum_name = eat_whitespace(line+3);
-   const char *int_string;
int comparison_value, gl_int_value;
-   GLenum int_enum;
+   unsigned int_enum;
 
-   strcpy_to_space(buffer, enum_name);
+   REQUIRE(parse_enum_gl(line, &int_enum, &line),
+   "Invalid comparison enum at: %s\n", line);
 
-   int_enum = piglit_get_gl_enum_from_name(buffer);
-
-   int_string = process_comparison(eat_whitespace(enum_name + 
strlen(buffer)), &cmp);
-   comparison_value = atoi(int_string);
+   line = process_comparison(eat_whitespace(line), &cmp);
+   comparison_value = atoi(line);
 
glGetIntegerv(int_enum, &gl_int_value);
if (!piglit_check_gl_error(GL_NO_ERROR)) {
-   fprintf(stderr, "Error reading %s\n", buffer);
+   fprintf(stderr, "Error reading %s\n",
+   piglit_get_gl_enum_name(int_enum));
return PIGLIT_FAIL;
}
 
if (!compare(comparison_value, gl_int_value, cmp)) {
printf("Test requires %s %s %i.  "
   "The driver supports %i.\n",
-  buffer,
+  piglit_get_gl_enum_name(int_enum),
   comparison_string(cmp),
   comparison_value,
   gl_int_value);
@@ -828,11 +818,10 @@ process_requirement(const char *line)
enum comparison cmp;
int maxcomp;
 
-   if (!string_match(getint_limits[i].name, line))
+   if (!parse_str(line, getint_limits[i].name, &line))
continue;
 
-   line = eat_whitespace(line + strlen(getint_limits[i].name));
-
+   line = eat_whitespace(line);
line = process_comparison(line, &cmp);
 
maxcomp = atoi(line);
@@ -848,23 +837,19 @@ process_requirement(const char *line)
return PIGLIT_PASS;
}
 
-   /* Consume any leading whitespace before requirements. This is
-* important for generated test files that may have odd whitespace
-*/
-   line = eat_whitespace(line);
-
-   if (string_match("GL_", line)) {
-   strcpy_to_space(buffer, line);
+   if (parse_str(line, "GL_", NULL) &&
+   parse_word_copy(line, buffer, sizeof(buffer), &line)) {
if (!piglit_is_extension_supported(buffer))
return PIGLIT_SKIP;
-   } else if (string_match("!GL_", line)) {
-   strcpy_to_space(buffer, line + 1);
+   } else if (parse_str(line, "!", &line) &&
+  parse_str(line, "GL_", NULL) &&
+  parse_word_copy(line, buffer, sizeof(buffer), &line)) {
if (piglit_is_extension_supported(buffer))
return PIGLIT_SKIP;
-   } else if (str

[Piglit] [PATCH 1/8] shader_runner: Rework script parser utils.

2016-10-18 Thread Francisco Jerez
This introduces a collection of text parsing primitives meant to
replace the current helper functions from parser_utils.h and other
manual string manipulation done in shader_runner.c.  The design
principles are:

 - Make things easier for the caller to handle failure.  Some of the
   current parser code doesn't handle failure at all (e.g. the whole
   get_* helpers), which will cause the script to misbehave silently
   in presence of a syntax error.  Other parser functions
   (e.g. lookup_enum_string or process_comparison) kill the piglit
   test with failure status when the input cannot be parsed, which
   prevents the caller from handling parse errors gracefully in cases
   where failure is expected (e.g. because a symbol has multiple
   alternative production rules).

   All parser primitives introduced here return a boolean result that
   represents whether the symbol could be parsed from the input
   string.  The REQUIRE() macro is provided to encourage printing
   informative diagnostic messages in error conditions.

 - Allow composition of parser primitives to form more complex parsers
   with similar high-level behavior.  Chained parsers can be
   represented easily using the '&&' operator.  E.g.:

   | return parse_str(line, "foo", &rest) &&
   |parse_bar(rest, &bar, &rest);

   will parse "foo" followed by a 'bar' value and leave 'rest'
   pointing at the following text to allow subsequent composition [the
   parser utils currently in use would require hard-coding the
   character length of the first symbol, which is error-prone and can
   get hairy if the length of the symbol is not known beforehand].

   Look-ahead can be achieved by passing NULL as last argument which
   will simply check whether the symbol can be parsed without updating
   the current parse location.  E.g. to check whether a symbol starts
   with 'GL_' and then parse it as a GL enum:

   | return parse_str(line, "GL_", NULL) &&
   |parse_enum_gl(line, &e, &rest);

 - Allow parsing of slightly more complex grammars where a single
   non-terminal symbol can have multiple alternative production rules.

   Selection of one of the alternatives can be represented succinctly
   by combining multiple parsers with the '||' operator (the result
   will be left-biased in presence of ambiguity due to the
   short-circuit rule of C boolean operators).  E.g. to parse a string
   of the form '  ' you
   can do something along the lines of:

   | return parse_word_copy(line, name, sizeof(name), &rest) &&
   |parse_enum_tab(all_pnames, rest, &pname, &rest) &&
   |(parse_enum_tab(all_types, rest, &expected, &rest) ||
   | parse_int(rest, &expected, &rest));

See the doxygen documentation below for more details.
---
 tests/shaders/parser_utils.c | 66 ++-
 tests/shaders/parser_utils.h | 83 +++-
 2 files changed, 147 insertions(+), 2 deletions(-)

diff --git a/tests/shaders/parser_utils.c b/tests/shaders/parser_utils.c
index e534a4c..470144e 100644
--- a/tests/shaders/parser_utils.c
+++ b/tests/shaders/parser_utils.c
@@ -1,5 +1,5 @@
 /*
- * Copyright © 2010 Intel Corporation
+ * Copyright © 2010-2016 Intel Corporation
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
@@ -24,6 +24,70 @@
 #include 
 #include "parser_utils.h"
 
+bool
+parse_whitespace(const char *s, const char **rest)
+{
+   const char *end = s;
+   for (; *end && *end != '\n' && isspace(*end); end++);
+
+   if (rest)
+   *rest = end;
+
+   return end != s;
+}
+
+bool
+parse_str(const char *s, const char *lit, const char **rest)
+{
+   const char *t;
+   parse_whitespace(s, &t);
+   const bool ret = strncmp(t, lit, strlen(lit)) == 0;
+
+   if (rest)
+   *rest = (ret ? t + strlen(lit) : s);
+
+   return ret;
+}
+
+bool
+parse_word(const char *s, const char **t, const char **rest)
+{
+   parse_whitespace(s, t);
+
+   const char *end = *t;
+   for (; *end && !isspace(*end); end++);
+
+   if (rest)
+   *rest = (*t != end ? end : s);
+
+   return *t != end;
+}
+
+bool
+parse_word_copy(const char *s, char *t, unsigned n, const char **rest)
+{
+   const char *start, *end;
+   const bool ret = parse_word(s, &start, &end) && end - start < n;
+
+   if (ret) {
+   memcpy(t, start, end - start);
+   t[end - start] = 0;
+   }
+   if (rest)
+   *rest = (ret ? end : s);
+
+   return ret;
+}
+
+bool
+parse_enum_gl(const char *s, GLenum *e, const char **rest)
+{
+   char name[512];
+   const bool ret = parse_word_copy(s, name, sizeof(name), rest);
+   *e = (ret ? piglit_get_gl_enum_from_name(name) : GL_NONE);
+   return ret;
+}
+
 /**
  * Skip over whitespace upto the end of line
  */
diff --git a/tests/shaders/parser

[Piglit] [PATCH 3/8] shader_runner: Migrate numeric parser utils to parser library.

2016-10-18 Thread Francisco Jerez
Rework the get_* parser helpers used in shader_runner.c to follow the
same principle as the recently introduced parser helpers.  This gives
callers the possibility to handle failure and compose numeric parsers
with other parser primitives.
---
 tests/shaders/parser_utils.c  | 108 +++
 tests/shaders/parser_utils.h  |  80 ++
 tests/shaders/shader_runner.c | 246 --
 3 files changed, 279 insertions(+), 155 deletions(-)

diff --git a/tests/shaders/parser_utils.c b/tests/shaders/parser_utils.c
index 470144e..2eb7da1 100644
--- a/tests/shaders/parser_utils.c
+++ b/tests/shaders/parser_utils.c
@@ -49,6 +49,114 @@ parse_str(const char *s, const char *lit, const char **rest)
return ret;
 }
 
+unsigned
+parse_ints(const char *s, int *i, unsigned n, const char **rest)
+{
+   const char *end = s;
+   unsigned j;
+
+   for (j = 0; j < n; j++) {
+   i[j] = strtoll(s = end, (char **)&end, 0);
+   if (s == end)
+   break;
+   }
+
+   if (rest)
+   *rest = end;
+
+   return j;
+}
+
+unsigned
+parse_uints(const char *s, unsigned *u, unsigned n, const char **rest)
+{
+   const char *end = s;
+   unsigned j;
+
+   for (j = 0; j < n; j++) {
+   u[j] = strtoul(s = end, (char **)&end, 0);
+   if (s == end)
+   break;
+   }
+
+   if (rest)
+   *rest = end;
+
+   return j;
+}
+
+unsigned
+parse_int64s(const char *s, int64_t *i, unsigned n, const char **rest)
+{
+   const char *end = s;
+   unsigned j;
+
+   for (j = 0; j < n; j++) {
+   i[j] = strtoll(s = end, (char **)&end, 0);
+   if (s == end)
+   break;
+   }
+
+   if (rest)
+   *rest = end;
+
+   return j;
+}
+
+unsigned
+parse_uint64s(const char *s, uint64_t *u, unsigned n, const char **rest)
+{
+   const char *end = s;
+   unsigned j;
+
+   for (j = 0; j < n; j++) {
+   u[j] = strtoull(s = end, (char **)&end, 0);
+   if (s == end)
+   break;
+   }
+
+   if (rest)
+   *rest = end;
+
+   return j;
+}
+
+unsigned
+parse_floats(const char *s, float *f, unsigned n, const char **rest)
+{
+   const char *end = s;
+   unsigned j;
+
+   for (j = 0; j < n; j++) {
+   f[j] = strtof_hex(s = end, (char **)&end);
+   if (s == end)
+   break;
+   }
+
+   if (rest)
+   *rest = end;
+
+   return j;
+}
+
+unsigned
+parse_doubles(const char *s, double *d, unsigned n, const char **rest)
+{
+   const char *end = s;
+   unsigned j;
+
+   for (j = 0; j < n; j++) {
+   d[j] = strtod_hex(s = end, (char **)&end);
+   if (s == end)
+   break;
+   }
+
+   if (rest)
+   *rest = end;
+
+   return j;
+}
+
 bool
 parse_word(const char *s, const char **t, const char **rest)
 {
diff --git a/tests/shaders/parser_utils.h b/tests/shaders/parser_utils.h
index 8b766bc..3579bee 100644
--- a/tests/shaders/parser_utils.h
+++ b/tests/shaders/parser_utils.h
@@ -65,6 +65,86 @@ bool
 parse_str(const char *s, const char *lit, const char **rest);
 
 /**
+ * Parse up to \p n whitespace-separated signed integer values.  The
+ * number of values actually parsed is returned as result.
+ */
+unsigned
+parse_ints(const char *s, int *i, unsigned n, const char **rest);
+
+static inline bool
+parse_int(const char *s, int *i, const char **rest)
+{
+   return parse_ints(s, i, 1, rest);
+}
+
+/**
+ * Parse up to \p n whitespace-separated unsigned integer values.  The
+ * number of values actually parsed is returned as result.
+ */
+unsigned
+parse_uints(const char *s, unsigned *u, unsigned n, const char **rest);
+
+static inline bool
+parse_uint(const char *s, unsigned *u, const char **rest)
+{
+   return parse_uints(s, u, 1, rest);
+}
+
+/**
+ * Parse up to \p n whitespace-separated signed 64-bit integer values.
+ * The number of values actually parsed is returned as result.
+ */
+unsigned
+parse_int64s(const char *s, int64_t *i, unsigned n, const char **rest);
+
+static inline bool
+parse_int64(const char *s, int64_t *i, const char **rest)
+{
+   return parse_int64s(s, i, 1, rest);
+}
+
+/**
+ * Parse up to \p n whitespace-separated unsigned 64-bit integer
+ * values.  The number of values actually parsed is returned as
+ * result.
+ */
+unsigned
+parse_uint64s(const char *s, uint64_t *u, unsigned n, const char **rest);
+
+static inline bool
+parse_uint64(const char *s, uint64_t *u, const char **rest)
+{
+   return parse_uint64s(s, u, 1, rest);
+}
+
+/**
+ * Parse up to \p n whitespace-separated floating point values.  The
+ * number of values actually parsed is returned as result.
+ */
+unsigned
+parse_floats(const char *s, float *f, unsigned n, const char **rest);
+
+s

[Piglit] [PATCH 7/8] shader_runner: Factor out open-coded texture target parsing as parser primitive.

2016-10-18 Thread Francisco Jerez
This will be re-used later on.
---
 tests/shaders/parser_utils.c  | 17 +
 tests/shaders/parser_utils.h  |  6 ++
 tests/shaders/shader_runner.c | 14 +-
 3 files changed, 24 insertions(+), 13 deletions(-)

diff --git a/tests/shaders/parser_utils.c b/tests/shaders/parser_utils.c
index d180842..ba59671 100644
--- a/tests/shaders/parser_utils.c
+++ b/tests/shaders/parser_utils.c
@@ -222,6 +222,23 @@ parse_enum_tab(const struct string_to_enum *tab,
 }
 
 bool
+parse_tex_target(const char *s, unsigned *t, const char **rest)
+{
+   static const struct string_to_enum tab[] = {
+   { "1D", GL_TEXTURE_1D },
+   { "2D", GL_TEXTURE_2D },
+   { "3D", GL_TEXTURE_3D },
+   { "Rect", GL_TEXTURE_RECTANGLE },
+   { "Cube", GL_TEXTURE_CUBE_MAP },
+   { "1DArray", GL_TEXTURE_1D_ARRAY },
+   { "2DArray", GL_TEXTURE_2D_ARRAY },
+   { "CubeArray", GL_TEXTURE_CUBE_MAP_ARRAY },
+   { NULL, 0 }
+   };
+   return parse_enum_tab(tab, s, t, rest);
+}
+
+bool
 parse_comparison_op(const char *s, enum comparison *t, const char **rest)
 {
if (parse_str(s, "==", rest)) {
diff --git a/tests/shaders/parser_utils.h b/tests/shaders/parser_utils.h
index 6907a69..28e0630 100644
--- a/tests/shaders/parser_utils.h
+++ b/tests/shaders/parser_utils.h
@@ -184,6 +184,12 @@ bool
 parse_enum_tab(const struct string_to_enum *tab,
   const char *s, unsigned *e, const char **rest);
 
+/**
+ * Parse a texture target symbolic constant.
+ */
+bool
+parse_tex_target(const char *s, GLenum *t, const char **rest);
+
 const char *eat_whitespace(const char *src);
 const char *eat_text(const char *src);
 bool string_match(const char *string, const char *line);
diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index 9aa988d..6d2f7f4 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -2469,18 +2469,6 @@ decode_drawing_mode(const char *mode_str)
 static void
 handle_texparameter(const char *line)
 {
-   static const struct string_to_enum texture_target[] = {
-   { "1D",GL_TEXTURE_1D },
-   { "2D",GL_TEXTURE_2D },
-   { "3D",GL_TEXTURE_3D },
-   { "Rect",  GL_TEXTURE_RECTANGLE  },
-   { "Cube",  GL_TEXTURE_CUBE_MAP   },
-   { "1DArray",   GL_TEXTURE_1D_ARRAY   },
-   { "2DArray",   GL_TEXTURE_2D_ARRAY   },
-   { "CubeArray", GL_TEXTURE_CUBE_MAP_ARRAY },
-   { NULL, 0 }
-   };
-
static const struct string_to_enum compare_funcs[] = {
{ "greater", GL_GREATER },
{ "gequal", GL_GEQUAL },
@@ -2532,7 +2520,7 @@ handle_texparameter(const char *line)
const struct string_to_enum *strings = NULL;
unsigned value;
 
-   REQUIRE(parse_enum_tab(texture_target, line, &value, NULL),
+   REQUIRE(parse_tex_target(line, &target, &line),
"Bad texture target at: %s\n", line);
 
if (parse_str(line, "compare_func ", &line)) {
-- 
2.9.0

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


[Piglit] [PATCH] shader_runner: report PIGLIT_FAIL if linking unexpectedly fails

2016-10-18 Thread Brian Paul
We were previously reporting 'pass' if linking failed.
---
 tests/shaders/shader_runner.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index b0bde2c..94865b7 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -3529,6 +3529,7 @@ piglit_display(void)
 
if (!link_ok && !link_error_expected) {
program_must_be_in_use();
+   full_result = PIGLIT_FAIL;
}
 
piglit_present_results();
-- 
1.9.1

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


[Piglit] [PATCH] glsl-1.20: test declaring gl_Position with the invariant qualifier.

2016-10-18 Thread Brian Paul
To exercise a Mesa GLSL regression.
---
 .../linker/invariant-position.shader_test  | 26 ++
 1 file changed, 26 insertions(+)
 create mode 100644 tests/spec/glsl-1.20/linker/invariant-position.shader_test

diff --git a/tests/spec/glsl-1.20/linker/invariant-position.shader_test 
b/tests/spec/glsl-1.20/linker/invariant-position.shader_test
new file mode 100644
index 000..4bbed5b
--- /dev/null
+++ b/tests/spec/glsl-1.20/linker/invariant-position.shader_test
@@ -0,0 +1,26 @@
+[require]
+GLSL >= 1.20
+
+# This test exercises a Mesa GLSL regression where declaring a pre-defined
+# VS input as 'invariant' cause a linker failure.
+
+[vertex shader]
+#version 120
+invariant gl_Position;
+void main()
+{
+  gl_Position = ftransform();
+}
+
+
+[fragment shader]
+#version 120
+void main()
+{
+   gl_FragColor = vec4(1.0);
+}
+
+
+[test]
+draw rect -1 -1 2 2
+probe rgba 0 0  1 1 1 1
-- 
1.9.1

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


Re: [Piglit] [PATCH] shader_runner: report PIGLIT_FAIL if linking unexpectedly fails

2016-10-18 Thread Dylan Baker
Quoting Brian Paul (2016-10-18 16:28:53)
> We were previously reporting 'pass' if linking failed.
> ---
>  tests/shaders/shader_runner.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
> index b0bde2c..94865b7 100644
> --- a/tests/shaders/shader_runner.c
> +++ b/tests/shaders/shader_runner.c
> @@ -3529,6 +3529,7 @@ piglit_display(void)
>  
> if (!link_ok && !link_error_expected) {
> program_must_be_in_use();
> +   full_result = PIGLIT_FAIL;

That's not quite correct. program_must_be_in_use() was changed to return a
piglit_result (I assume when we did the shader_runner multiple shaders stuff)

Anyway, I think this should be:
full_result = program_must_be_in_use();

Dylan

> }
>  
> piglit_present_results();
> -- 
> 1.9.1
> 
> ___
> Piglit mailing list
> Piglit@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/piglit


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


[Piglit] shader_runner churn and framebuffer fetch test generator.

2016-10-18 Thread Francisco Jerez
The first 17 patches of this series add new functionality to
shader_runner and fix various bugs so EXT_shader_framebuffer_fetch can
get sufficient run-time test coverage by using shader_runner test
scripts alone.  Patch 18 does the actual testing of the framebuffer
fetch extension from a single mako-based generator.  The generator was
originally intended to generate tests for MESA_shader_framebuffer_fetch
and MESA_shader_framebuffer_fetch_non_coherent, but because the
extension text is unfortunately not public yet I've stripped out
everything specific to the MESA extensions for the moment -- If you're
curious about the MESA_shader_framebuffer_fetch tests feel free to
have a look at my piglit repository:

 https://cgit.freedesktop.org/~currojerez/piglit/log/?h=fb-fetch

This depends on the shader_runner parser util rework from this other
series:

 https://lists.freedesktop.org/archives/piglit/2016-October/021061.html

[PATCH 01/18] shader_runner: Don't attempt non-existing GL_TEXTURE_2D enable on 
GLES2+.
[PATCH 02/18] shader_runner: Rework tracking of texture bindings.
[PATCH 03/18] shader_runner: Take advantage of texture binding book-keeping in 
image binding command.
[PATCH 04/18] shader_runner: Drop unnecessary texture target argument from fb 
tex layered command.
[PATCH 05/18] shader_runner: Take advantage of texture binding book-keeping in 
fb command handling.
[PATCH 06/18] shader_runner: Refactor handling of fb commands.
[PATCH 07/18] shader_runner: Reindent code handling fb commands.
[PATCH 08/18] shader_runner: Allow definition of separate draw and read 
framebuffers.
[PATCH 09/18] shader_runner: Extend fb tex 2d command to support binding 
multiple render targets.
[PATCH 10/18] shader_runner: Add fb tex slice binding command.
[PATCH 11/18] shader_runner: Add multisample framebuffer binding command.
[PATCH 12/18] shader_runner: Add winsys framebuffer binding command.
[PATCH 13/18] shader_runner: Add framebuffer blit command.
[PATCH 14/18] shader_runner: Add texture storage command.
[PATCH 15/18] shader_runner: Add blend barrier command.
[PATCH 16/18] shader_runner: Add integer relative probe rect rgba command.
[PATCH 17/18] shader_runner: Fix texture rgbw on GLES.
[PATCH 18/18] Add test generator for EXT_shader_framebuffer_fetch.
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 17/18] shader_runner: Fix texture rgbw on GLES.

2016-10-18 Thread Francisco Jerez
GLES2 (and potentially also GLES3 depending on the internal format)
doesn't allow the specification of a texture image with base format
GL_RGBA and type GL_FLOAT, as piglit_rgbw_texture() would attempt to
do when the specified basetype argument is GL_UNSIGNED_NORMALIZED.
GL_UNSIGNED_BYTE should be okay though according to table 3.4 of the
GLES2 specification.
---
 tests/shaders/shader_runner.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index 7ae08ed..93dfd10 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -3367,7 +3367,8 @@ piglit_display(void)
glActiveTexture(GL_TEXTURE0 + tex);
int handle = piglit_rgbw_texture(
int_fmt, w, h, GL_FALSE, GL_FALSE,
-   GL_UNSIGNED_NORMALIZED);
+   (piglit_is_gles() ? GL_UNSIGNED_BYTE :
+GL_UNSIGNED_NORMALIZED));
set_texture_binding(tex, handle, w, h, 1);
 
if (!piglit_is_core_profile &&
-- 
2.9.0

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


[Piglit] [PATCH 09/18] shader_runner: Extend fb tex 2d command to support binding multiple render targets.

2016-10-18 Thread Francisco Jerez
fb tex 2d now takes a variable number of texture indices that are
bound sequentially as texture attachments of the framebuffer object.
---
 tests/shaders/shader_runner.c | 33 +
 1 file changed, 21 insertions(+), 12 deletions(-)

diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index c315676..7151fd2 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -2968,23 +2968,32 @@ piglit_display(void)
GLuint fbo = 0;
 
if (parse_str(rest, "tex 2d ", &rest)) {
+   GLenum attachments[32];
+   unsigned num_attachments = 0;
+
glGenFramebuffers(1, &fbo);
glBindFramebuffer(target, fbo);
 
-   REQUIRE(parse_int(rest, &tex, &rest),
-   "Framebuffer binding command not "
-   "understood at: %s\n", rest);
-
-   glFramebufferTexture2D(
-   target, GL_COLOR_ATTACHMENT0,
-   GL_TEXTURE_2D,
-   get_texture_binding(tex)->obj, 0);
-   if (!piglit_check_gl_error(GL_NO_ERROR)) {
-   fprintf(stderr,
-   "glFramebufferTexture2D 
error\n");
-   piglit_report_result(PIGLIT_FAIL);
+   while (parse_int(rest, &tex, &rest)) {
+   attachments[num_attachments] =
+   GL_COLOR_ATTACHMENT0 + 
num_attachments;
+   glFramebufferTexture2D(
+   target, 
attachments[num_attachments],
+   GL_TEXTURE_2D,
+   get_texture_binding(tex)->obj, 
0);
+
+   if 
(!piglit_check_gl_error(GL_NO_ERROR)) {
+   fprintf(stderr,
+   "glFramebufferTexture2D 
error\n");
+   
piglit_report_result(PIGLIT_FAIL);
+   }
+
+   num_attachments++;
}
 
+   if (target != GL_READ_FRAMEBUFFER)
+   glDrawBuffers(num_attachments, 
attachments);
+
w = get_texture_binding(tex)->width;
h = get_texture_binding(tex)->height;
 
-- 
2.9.0

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


[Piglit] [PATCH 04/18] shader_runner: Drop unnecessary texture target argument from fb tex layered command.

2016-10-18 Thread Francisco Jerez
The texture target argument of the 'fb tex layered' command is
somewhat redundant because the glFramebufferTexture() GL API it's
implemented in terms of doesn't care what the target is.  Right now
the implementation of 'fb tex layered' requires the texture to be a 2D
array due to the way it uses the GL API to query the bound texture
object and dimensions, but that limitation will be removed shortly.
---
 tests/shaders/shader_runner.c   | 2 +-
 .../arb_fragment_layer_viewport/layer-gs-writes-in-range.shader_test| 2 +-
 .../layer-gs-writes-out-of-range.shader_test| 2 +-
 .../arb_fragment_layer_viewport/viewport-gs-writes-in-range.shader_test | 2 +-
 .../viewport-gs-writes-out-of-range.shader_test | 2 +-
 tests/spec/oes_viewport_array/viewport-gs-writes-in-range.shader_test   | 2 +-
 .../spec/oes_viewport_array/viewport-gs-writes-out-of-range.shader_test | 2 +-
 7 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index 2a37b56..91bc793 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -2987,7 +2987,7 @@ piglit_display(void)
 
glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, 
GL_TEXTURE_WIDTH, &render_width);
glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, 
GL_TEXTURE_HEIGHT, &render_height);
-   } else if (sscanf(line, "fb tex layered 2DArray %d", &tex) == 
1) {
+   } else if (sscanf(line, "fb tex layered %d", &tex) == 1) {
GLenum status;
GLint tex_num;
 
diff --git 
a/tests/spec/arb_fragment_layer_viewport/layer-gs-writes-in-range.shader_test 
b/tests/spec/arb_fragment_layer_viewport/layer-gs-writes-in-range.shader_test
index 0e899bb..1c20f76 100644
--- 
a/tests/spec/arb_fragment_layer_viewport/layer-gs-writes-in-range.shader_test
+++ 
b/tests/spec/arb_fragment_layer_viewport/layer-gs-writes-in-range.shader_test
@@ -64,7 +64,7 @@ void main()
 
 [test]
 texture junk 2DArray 0 ( 64 , 64 , 4 )
-fb tex layered 2DArray 0
+fb tex layered 0
 
 atomic counters 2
 
diff --git 
a/tests/spec/arb_fragment_layer_viewport/layer-gs-writes-out-of-range.shader_test
 
b/tests/spec/arb_fragment_layer_viewport/layer-gs-writes-out-of-range.shader_test
index ad1bfa8..06a859b 100644
--- 
a/tests/spec/arb_fragment_layer_viewport/layer-gs-writes-out-of-range.shader_test
+++ 
b/tests/spec/arb_fragment_layer_viewport/layer-gs-writes-out-of-range.shader_test
@@ -62,7 +62,7 @@ void main()
 
 [test]
 texture junk 2DArray 0 ( 64 , 64 , 4 )
-fb tex layered 2DArray 0
+fb tex layered 0
 
 atomic counters 1
 
diff --git 
a/tests/spec/arb_fragment_layer_viewport/viewport-gs-writes-in-range.shader_test
 
b/tests/spec/arb_fragment_layer_viewport/viewport-gs-writes-in-range.shader_test
index fdac3e3..3d3c7df 100644
--- 
a/tests/spec/arb_fragment_layer_viewport/viewport-gs-writes-in-range.shader_test
+++ 
b/tests/spec/arb_fragment_layer_viewport/viewport-gs-writes-in-range.shader_test
@@ -65,7 +65,7 @@ void main()
 
 [test]
 texture junk 2DArray 0 ( 64 , 64 , 1 )
-fb tex layered 2DArray 0
+fb tex layered 0
 
 atomic counters 2
 
diff --git 
a/tests/spec/arb_fragment_layer_viewport/viewport-gs-writes-out-of-range.shader_test
 
b/tests/spec/arb_fragment_layer_viewport/viewport-gs-writes-out-of-range.shader_test
index ca852f6..9418e16 100644
--- 
a/tests/spec/arb_fragment_layer_viewport/viewport-gs-writes-out-of-range.shader_test
+++ 
b/tests/spec/arb_fragment_layer_viewport/viewport-gs-writes-out-of-range.shader_test
@@ -63,7 +63,7 @@ void main()
 
 [test]
 texture junk 2DArray 0 ( 64 , 64 , 1 )
-fb tex layered 2DArray 0
+fb tex layered 0
 
 atomic counters 1
 
diff --git 
a/tests/spec/oes_viewport_array/viewport-gs-writes-in-range.shader_test 
b/tests/spec/oes_viewport_array/viewport-gs-writes-in-range.shader_test
index 8a942c2..98508b8 100644
--- a/tests/spec/oes_viewport_array/viewport-gs-writes-in-range.shader_test
+++ b/tests/spec/oes_viewport_array/viewport-gs-writes-in-range.shader_test
@@ -63,7 +63,7 @@ void main()
 
 [test]
 texture junk 2DArray 0 ( 64 , 64 , 1 )
-fb tex layered 2DArray 0
+fb tex layered 0
 
 atomic counters 2
 
diff --git 
a/tests/spec/oes_viewport_array/viewport-gs-writes-out-of-range.shader_test 
b/tests/spec/oes_viewport_array/viewport-gs-writes-out-of-range.shader_test
index f6a6163..ea00b3f 100644
--- a/tests/spec/oes_viewport_array/viewport-gs-writes-out-of-range.shader_test
+++ b/tests/spec/oes_viewport_array/viewport-gs-writes-out-of-range.shader_test
@@ -61,7 +61,7 @@ void main()
 
 [test]
 texture junk 2DArray 0 ( 64 , 64 , 1 )
-fb tex layered 2DArray 0
+fb tex layered 0
 
 atomic counters 1
 
-- 
2.9.0

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


[Piglit] [PATCH 08/18] shader_runner: Allow definition of separate draw and read framebuffers.

2016-10-18 Thread Francisco Jerez
---
 tests/shaders/shader_runner.c | 100 ++
 1 file changed, 62 insertions(+), 38 deletions(-)

diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index 2cde9b3..c315676 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -140,8 +140,9 @@ static bool prog_in_use = false;
 static bool sso_in_use = false;
 static GLchar *prog_err_info = NULL;
 static GLuint vao = 0;
-static GLuint draw_fbo = 0;
+static GLuint draw_fbo, read_fbo;
 static GLint render_width, render_height;
+static GLint read_width, read_height;
 
 static bool report_subtests = false;
 
@@ -2960,18 +2961,22 @@ piglit_display(void)
} else if (sscanf(line, "depthfunc %31s", s) == 1) {
glDepthFunc(piglit_get_gl_enum_from_name(s));
} else if (parse_str(line, "fb ", &rest)) {
+   const GLenum target =
+   parse_str(rest, "draw ", &rest) ? 
GL_DRAW_FRAMEBUFFER :
+   parse_str(rest, "read ", &rest) ? 
GL_READ_FRAMEBUFFER :
+   GL_FRAMEBUFFER;
GLuint fbo = 0;
 
if (parse_str(rest, "tex 2d ", &rest)) {
glGenFramebuffers(1, &fbo);
-   glBindFramebuffer(GL_FRAMEBUFFER, fbo);
+   glBindFramebuffer(target, fbo);
 
REQUIRE(parse_int(rest, &tex, &rest),
"Framebuffer binding command not "
"understood at: %s\n", rest);
 
glFramebufferTexture2D(
-   GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
+   target, GL_COLOR_ATTACHMENT0,
GL_TEXTURE_2D,
get_texture_binding(tex)->obj, 0);
if (!piglit_check_gl_error(GL_NO_ERROR)) {
@@ -2985,10 +2990,10 @@ piglit_display(void)
 
} else if (sscanf(rest, "tex layered %d", &tex) == 1) {
glGenFramebuffers(1, &fbo);
-   glBindFramebuffer(GL_FRAMEBUFFER, fbo);
+   glBindFramebuffer(target, fbo);
 
glFramebufferTexture(
-   GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
+   target, GL_COLOR_ATTACHMENT0,
get_texture_binding(tex)->obj, 0);
if (!piglit_check_gl_error(GL_NO_ERROR)) {
fprintf(stderr,
@@ -3005,23 +3010,42 @@ piglit_display(void)
piglit_report_result(PIGLIT_FAIL);
}
 
-   const GLenum status = 
glCheckFramebufferStatus(GL_FRAMEBUFFER);
+   const GLenum status = glCheckFramebufferStatus(target);
if (status != GL_FRAMEBUFFER_COMPLETE) {
fprintf(stderr, "incomplete fbo (status 
0x%x)\n",
status);
piglit_report_result(PIGLIT_FAIL);
}
 
-   render_width = w;
-   render_height = h;
+   if (target != GL_READ_FRAMEBUFFER) {
+   render_width = w;
+   render_height = h;
 
-   /* Delete the previous draw FB in case
-* it's no longer reachable.
-*/
-   if (draw_fbo != 0)
-   glDeleteFramebuffers(1, &draw_fbo);
+   /* Delete the previous draw FB in case
+* it's no longer reachable.
+*/
+   if (draw_fbo != 0 &&
+   draw_fbo != (target == GL_DRAW_FRAMEBUFFER ?
+read_fbo : 0))
+   glDeleteFramebuffers(1, &draw_fbo);
+
+   draw_fbo = fbo;
+   }
 
-   draw_fbo = fbo;
+   if (target != GL_DRAW_FRAMEBUFFER) {
+   read_width = w;
+   read_height = h;
+
+   /* Delete the previous read FB in case
+* it's no longer reachable.
+*/
+   if (read_fbo != 0 &&
+   read_fbo != (target == GL_READ_FRAMEBUFFER ?
+  

[Piglit] [PATCH 16/18] shader_runner: Add integer relative probe rect rgba command.

2016-10-18 Thread Francisco Jerez
Similar to the exsiting "relative probe rect rgb" command but suitable
for integer framebuffer formats.
---
 tests/shaders/shader_runner.c | 14 ++
 1 file changed, 14 insertions(+)

diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index 65521f8..7ae08ed 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -3300,6 +3300,20 @@ piglit_display(void)
if (!piglit_probe_rect_rgb(x, y, w, h, &c[4])) {
result = PIGLIT_FAIL;
}
+
+   } else if (sscanf(line, "relative probe rect rgba int "
+ "( %f , %f , %f , %f ) "
+ "( %d , %d , %d , %d )",
+ c + 0, c + 1, c + 2, c + 3,
+ &x, &y, &z, &w) == 8) {
+   const int expected[] = { x, y, z, w };
+   if (!piglit_probe_rect_rgba_int(c[0] * read_width,
+   c[1] * read_height,
+   c[2] * read_width,
+   c[3] * read_height,
+   expected))
+   result = PIGLIT_FAIL;
+
} else if (parse_str(line, "probe all rgba ", &rest)) {
parse_floats(rest, c, 4, NULL);
if (result != PIGLIT_FAIL &&
-- 
2.9.0

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


[Piglit] [PATCH 14/18] shader_runner: Add texture storage command.

2016-10-18 Thread Francisco Jerez
"texture storage(
 ...)" calls the corresponding glTexStorageND command on a
newly allocated texture object, where N is determined based on the
number of dimensions passed as argument.
---
 tests/shaders/shader_runner.c | 35 +++
 1 file changed, 35 insertions(+)

diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index efb9dcf..c7a4294 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -3430,6 +3430,41 @@ piglit_display(void)
 w, h, l, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
set_texture_binding(tex, texobj, w, h, l);
 
+   } else if (parse_str(line, "texture storage ", &rest)) {
+   GLenum target, format;
+   GLuint tex_obj;
+   int d = h = w = 1;
+
+   REQUIRE(parse_int(rest, &tex, &rest) &&
+   parse_tex_target(rest, &target, &rest) &&
+   parse_enum_gl(rest, &format, &rest) &&
+   parse_str(rest, "(", &rest) &&
+   parse_int(rest, &l, &rest) &&
+   parse_int(rest, &w, &rest),
+   "Texture storage command not understood "
+   "at: %s\n", rest);
+
+   glActiveTexture(GL_TEXTURE0 + tex);
+   glGenTextures(1, &tex_obj);
+   glBindTexture(target, tex_obj);
+
+   if (!parse_int(rest, &h, &rest))
+   glTexStorage1D(target, l, format, w);
+   else if (!parse_int(rest, &d, &rest))
+   glTexStorage2D(target, l, format, w, h);
+   else
+   glTexStorage3D(target, l, format, w, h, d);
+
+   if (!piglit_check_gl_error(GL_NO_ERROR)) {
+   fprintf(stderr, "glTexStorage error\n");
+   piglit_report_result(PIGLIT_FAIL);
+   }
+
+   if (target == GL_TEXTURE_1D_ARRAY)
+   set_texture_binding(tex, tex_obj, w, 1, h);
+   else
+   set_texture_binding(tex, tex_obj, w, h, d);
+
} else if (sscanf(line,
  "texture rgbw 2DArray %d ( %d , %d , %d )",
  &tex, &w, &h, &l) == 4) {
-- 
2.9.0

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


[Piglit] [PATCH 01/18] shader_runner: Don't attempt non-existing GL_TEXTURE_2D enable on GLES2+.

2016-10-18 Thread Francisco Jerez
---
 tests/shaders/shader_runner.c | 15 ++-
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index 6d2f7f4..56c4ff7 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -3137,7 +3137,8 @@ piglit_display(void)
GL_UNSIGNED_NORMALIZED);
textures[num_textures] = handle;
num_textures++;
-   if (!piglit_is_core_profile)
+   if (!piglit_is_core_profile &&
+   !(piglit_is_gles() && piglit_get_gl_version() >= 
20))
glEnable(GL_TEXTURE_2D);
 
} else if (parse_str(line, "texture integer ", &rest)) {
@@ -3159,7 +3160,8 @@ piglit_display(void)
} else if (sscanf(line, "texture miptree %d", &tex) == 1) {
glActiveTexture(GL_TEXTURE0 + tex);
piglit_miptree_texture();
-   if (!piglit_is_core_profile)
+   if (!piglit_is_core_profile &&
+   !(piglit_is_gles() && piglit_get_gl_version() >= 
20))
glEnable(GL_TEXTURE_2D);
} else if (sscanf(line,
  "texture checkerboard %d %d ( %d , %d ) "
@@ -3173,7 +3175,8 @@ piglit_display(void)
w, h,
w / 2, h / 2,
c + 0, c + 4);
-   if (!piglit_is_core_profile)
+   if (!piglit_is_core_profile &&
+   !(piglit_is_gles() && piglit_get_gl_version() >= 
20))
glEnable(GL_TEXTURE_2D);
} else if (sscanf(line,
  "texture quads %d %d ( %d , %d ) ( %d , %d ) "
@@ -3189,7 +3192,8 @@ piglit_display(void)
glActiveTexture(GL_TEXTURE0 + tex);
piglit_quads_texture(0, level, w, h, x, y,
 c + 0, c + 4, c + 8, c + 12);
-   if (!piglit_is_core_profile)
+   if (!piglit_is_core_profile &&
+   !(piglit_is_gles() && piglit_get_gl_version() >= 
20))
glEnable(GL_TEXTURE_2D);
} else if (sscanf(line,
  "texture junk 2DArray %d ( %d , %d , %d )",
@@ -3228,7 +3232,8 @@ piglit_display(void)
GL_TEXTURE_COMPARE_FUNC,
GL_GREATER);
 
-   if (!piglit_is_core_profile)
+   if (!piglit_is_core_profile &&
+   !(piglit_is_gles() && piglit_get_gl_version() >= 
20))
glEnable(GL_TEXTURE_2D);
} else if (sscanf(line,
  "texture shadowRect %d ( %d , %d )",
-- 
2.9.0

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


[Piglit] [PATCH 05/18] shader_runner: Take advantage of texture binding book-keeping in fb command handling.

2016-10-18 Thread Francisco Jerez
---
 tests/shaders/shader_runner.c | 17 +
 1 file changed, 5 insertions(+), 12 deletions(-)

diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index 91bc793..ab2b907 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -2961,10 +2961,6 @@ piglit_display(void)
glDepthFunc(piglit_get_gl_enum_from_name(s));
} else if (sscanf(line, "fb tex 2d %d", &tex) == 1) {
GLenum status;
-   GLint tex_num;
-
-   glActiveTexture(GL_TEXTURE0 + tex);
-   glGetIntegerv(GL_TEXTURE_BINDING_2D, &tex_num);
 
if (fbo == 0) {
glGenFramebuffers(1, &fbo);
@@ -2973,7 +2969,8 @@ piglit_display(void)
 
glFramebufferTexture2D(GL_FRAMEBUFFER,
   GL_COLOR_ATTACHMENT0,
-  GL_TEXTURE_2D, tex_num, 0);
+  GL_TEXTURE_2D,
+  get_texture_binding(tex)->obj, 
0);
if (!piglit_check_gl_error(GL_NO_ERROR)) {
fprintf(stderr, "glFramebufferTexture2D 
error\n");
piglit_report_result(PIGLIT_FAIL);
@@ -2985,14 +2982,10 @@ piglit_display(void)
piglit_report_result(PIGLIT_FAIL);
}
 
-   glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, 
GL_TEXTURE_WIDTH, &render_width);
-   glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, 
GL_TEXTURE_HEIGHT, &render_height);
+   render_width = get_texture_binding(tex)->width;
+   render_height = get_texture_binding(tex)->height;
} else if (sscanf(line, "fb tex layered %d", &tex) == 1) {
GLenum status;
-   GLint tex_num;
-
-   glActiveTexture(GL_TEXTURE0 + tex);
-   glGetIntegerv(GL_TEXTURE_BINDING_2D_ARRAY, &tex_num);
 
if (fbo == 0) {
glGenFramebuffers(1, &fbo);
@@ -3001,7 +2994,7 @@ piglit_display(void)
 
glFramebufferTexture(GL_FRAMEBUFFER,
 GL_COLOR_ATTACHMENT0,
-tex_num, 0);
+get_texture_binding(tex)->obj, 0);
if (!piglit_check_gl_error(GL_NO_ERROR)) {
fprintf(stderr, "glFramebufferTexture error\n");
piglit_report_result(PIGLIT_FAIL);
-- 
2.9.0

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


[Piglit] [PATCH 07/18] shader_runner: Reindent code handling fb commands.

2016-10-18 Thread Francisco Jerez
---
 tests/shaders/shader_runner.c | 103 ++
 1 file changed, 53 insertions(+), 50 deletions(-)

diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index 4a2c807..2cde9b3 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -2960,65 +2960,68 @@ piglit_display(void)
} else if (sscanf(line, "depthfunc %31s", s) == 1) {
glDepthFunc(piglit_get_gl_enum_from_name(s));
} else if (parse_str(line, "fb ", &rest)) {
-   GLuint fbo = 0;
-
-   if (parse_str(rest, "tex 2d ", &rest)) {
-   glGenFramebuffers(1, &fbo);
-   glBindFramebuffer(GL_FRAMEBUFFER, fbo);
-
-   REQUIRE(parse_int(rest, &tex, &rest),
-   "Framebuffer binding command not "
-   "understood at: %s\n", rest);
-
-   glFramebufferTexture2D(GL_FRAMEBUFFER,
-  GL_COLOR_ATTACHMENT0,
-  GL_TEXTURE_2D,
-  get_texture_binding(tex)->obj, 
0);
-   if (!piglit_check_gl_error(GL_NO_ERROR)) {
-   fprintf(stderr, "glFramebufferTexture2D 
error\n");
-   piglit_report_result(PIGLIT_FAIL);
-   }
+   GLuint fbo = 0;
+
+   if (parse_str(rest, "tex 2d ", &rest)) {
+   glGenFramebuffers(1, &fbo);
+   glBindFramebuffer(GL_FRAMEBUFFER, fbo);
+
+   REQUIRE(parse_int(rest, &tex, &rest),
+   "Framebuffer binding command not "
+   "understood at: %s\n", rest);
+
+   glFramebufferTexture2D(
+   GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
+   GL_TEXTURE_2D,
+   get_texture_binding(tex)->obj, 0);
+   if (!piglit_check_gl_error(GL_NO_ERROR)) {
+   fprintf(stderr,
+   "glFramebufferTexture2D 
error\n");
+   piglit_report_result(PIGLIT_FAIL);
+   }
 
-   w = get_texture_binding(tex)->width;
-   h = get_texture_binding(tex)->height;
+   w = get_texture_binding(tex)->width;
+   h = get_texture_binding(tex)->height;
 
-   } else if (sscanf(rest, "tex layered %d", &tex) == 1) {
-   glGenFramebuffers(1, &fbo);
-   glBindFramebuffer(GL_FRAMEBUFFER, fbo);
+   } else if (sscanf(rest, "tex layered %d", &tex) == 1) {
+   glGenFramebuffers(1, &fbo);
+   glBindFramebuffer(GL_FRAMEBUFFER, fbo);
 
-   glFramebufferTexture(GL_FRAMEBUFFER,
-GL_COLOR_ATTACHMENT0,
-get_texture_binding(tex)->obj, 0);
-   if (!piglit_check_gl_error(GL_NO_ERROR)) {
-   fprintf(stderr, "glFramebufferTexture error\n");
-   piglit_report_result(PIGLIT_FAIL);
-   }
+   glFramebufferTexture(
+   GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
+   get_texture_binding(tex)->obj, 0);
+   if (!piglit_check_gl_error(GL_NO_ERROR)) {
+   fprintf(stderr,
+   "glFramebufferTexture error\n");
+   piglit_report_result(PIGLIT_FAIL);
+   }
 
-   w = get_texture_binding(tex)->width;
-   h = get_texture_binding(tex)->height;
+   w = get_texture_binding(tex)->width;
+   h = get_texture_binding(tex)->height;
 
-   } else {
-   fprintf(stderr, "Unknown fb bind subcommand "
-   "\"%s\"\n", rest);
-   piglit_report_result(PIGLIT_FAIL);
-   }
+   } else {
+   fprintf(stderr, "Unknown fb bind subcommand "
+   "\"%s\"\n", rest);
+   piglit_report_result(PIGLIT_FAIL);
+   }
 
-   const GLenum status = glCheckFramebufferStatus(GL_FRAMEBUF

[Piglit] [PATCH 15/18] shader_runner: Add blend barrier command.

2016-10-18 Thread Francisco Jerez
---
 tests/shaders/shader_runner.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index c7a4294..65521f8 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -3208,6 +3208,8 @@ piglit_display(void)
   GL_FALSE, 0, GL_READ_WRITE, img_fmt);
} else if (sscanf(line, "memory barrier %s", s) == 1) {

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

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


[Piglit] [PATCH 13/18] shader_runner: Add framebuffer blit command.

2016-10-18 Thread Francisco Jerez
"blit  " blits the specified buffer of the current
read framebuffer into the current draw framebuffer.  The blitting
rectangles are currently hard-coded to be the whole read and draw
framebuffer respectively, but it could be changed to take them as
argument if it seems useful.
---
 tests/shaders/shader_runner.c | 28 
 1 file changed, 28 insertions(+)

diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index 975603c..efb9dcf 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -3166,6 +3166,34 @@ piglit_display(void)
read_fbo = fbo;
}
 
+   } else if (parse_str(line, "blit ", &rest)) {
+   static const struct string_to_enum buffers[] = {
+   { "color", GL_COLOR_BUFFER_BIT },
+   { "depth", GL_DEPTH_BUFFER_BIT },
+   { "stencil", GL_STENCIL_BUFFER_BIT },
+   { NULL }
+   };
+   static const struct string_to_enum filters[] = {
+   { "linear", GL_LINEAR },
+   { "nearest", GL_NEAREST },
+   { NULL }
+   };
+   unsigned buffer, filter;
+
+   REQUIRE(parse_enum_tab(buffers, rest, &buffer, &rest) &&
+   parse_enum_tab(filters, rest, &filter, &rest),
+   "FB blit command not understood at: %s\n",
+   rest);
+
+   glBlitFramebuffer(0, 0, read_width, read_height,
+ 0, 0, render_width, render_height,
+ buffer, filter);
+
+   if (!piglit_check_gl_error(GL_NO_ERROR)) {
+   fprintf(stderr, "glBlitFramebuffer error\n");
+   piglit_report_result(PIGLIT_FAIL);
+   }
+
} else if (parse_str(line, "frustum", &rest)) {
parse_floats(rest, c, 6, NULL);
piglit_frustum_projection(false, c[0], c[1], c[2],
-- 
2.9.0

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


[Piglit] [PATCH 02/18] shader_runner: Rework tracking of texture bindings.

2016-10-18 Thread Francisco Jerez
The most significant differences with respect to the current approach
are:

 - We keep track of a single texture object per texture unit (which is
   deallocated as soon as a new texture is bound to the same unit)
   instead of trying to keep track of all texture objects allocated
   during the lifetime of the program (which are deallocated once the
   test runs to completion).  This makes indexing the texture binding
   array easier and should reduce memory usage in cases where multiple
   textures are bound to the same unit one after the other.

 - We keep track of additional metadata for each texture.  This will
   allow us to stop using glGetTexLevelParameteriv() to query the
   dimensions of a texture after it's bound to a texture unit, which
   is broken on GLES 3.0 and earlier because the
   glGetTexLevelParameteriv() command doesn't exist.

 - There are helper functions to bind, unbind and query textures,
   which simplifies the code and allows some common error checking to
   happen (e.g. fail if a texture unit is used before it's bound).

Also fix a bunch of cases where we were creating textures without
updating the textures[] array, which would likely have led to texture
memory leaks across test runs.
---
 tests/shaders/shader_runner.c | 125 +++---
 1 file changed, 94 insertions(+), 31 deletions(-)

diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index 56c4ff7..50025b8 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -110,8 +110,6 @@ static GLuint fragment_shaders[256];
 static unsigned num_fragment_shaders = 0;
 static GLuint compute_shaders[256];
 static unsigned num_compute_shaders = 0;
-static GLuint textures[256];
-static unsigned num_textures = 0;
 static int num_uniform_blocks;
 static GLuint *uniform_block_bos;
 static GLenum geometry_layout_input_type = GL_TRIANGLES;
@@ -147,6 +145,48 @@ static GLint render_width, render_height;
 
 static bool report_subtests = false;
 
+static struct texture_binding {
+   GLuint obj;
+   unsigned width;
+   unsigned height;
+   unsigned layers;
+} texture_bindings[32];
+
+static void
+clear_texture_binding(unsigned idx)
+{
+   REQUIRE(idx < ARRAY_SIZE(texture_bindings),
+   "Invalid texture index %d\n", idx);
+
+   if (texture_bindings[idx].obj) {
+   glDeleteTextures(1, &texture_bindings[idx].obj);
+   texture_bindings[idx].obj = 0;
+   }
+}
+
+static void
+set_texture_binding(unsigned idx, GLuint obj, unsigned w, unsigned h, unsigned 
l)
+{
+   clear_texture_binding(idx);
+
+   REQUIRE(idx < ARRAY_SIZE(texture_bindings),
+   "Invalid texture index %d\n", idx);
+   texture_bindings[idx].obj = obj;
+   texture_bindings[idx].width = w;
+   texture_bindings[idx].height = h;
+   texture_bindings[idx].layers = l;
+}
+
+static const struct texture_binding *
+get_texture_binding(unsigned idx)
+{
+   REQUIRE(idx < ARRAY_SIZE(texture_bindings),
+   "Invalid texture index %d\n", idx);
+   REQUIRE(texture_bindings[idx].obj,
+   "No texture bound at %d\n", idx);
+   return &texture_bindings[idx];
+}
+
 enum states {
none = 0,
requirements,
@@ -3135,8 +3175,8 @@ piglit_display(void)
int handle = piglit_rgbw_texture(
int_fmt, w, h, GL_FALSE, GL_FALSE,
GL_UNSIGNED_NORMALIZED);
-   textures[num_textures] = handle;
-   num_textures++;
+   set_texture_binding(tex, handle, w, h, 1);
+
if (!piglit_is_core_profile &&
!(piglit_is_gles() && piglit_get_gl_version() >= 
20))
glEnable(GL_TEXTURE_2D);
@@ -3156,10 +3196,15 @@ piglit_display(void)
int_fmt = piglit_get_gl_enum_from_name(s);
 
glActiveTexture(GL_TEXTURE0 + tex);
-   (void)piglit_integer_texture(int_fmt, w, h, b, a);
+   const GLuint handle =
+   piglit_integer_texture(int_fmt, w, h, b, a);
+   set_texture_binding(tex, handle, w, h, 1);
+
} else if (sscanf(line, "texture miptree %d", &tex) == 1) {
glActiveTexture(GL_TEXTURE0 + tex);
-   piglit_miptree_texture();
+   const GLuint handle = piglit_miptree_texture();
+   set_texture_binding(tex, handle, 8, 8, 1);
+
if (!piglit_is_core_profile &&
!(piglit_is_gles() && piglit_get_gl_version() >= 
20))
glEnable(GL_TEXTURE_2D);
@@ -3171,10 +3216,10 @@ piglit_display(void)
  c + 0, c + 1, c + 2, c + 3,
  c + 4, c + 5, c + 6, c 

[Piglit] [PATCH 06/18] shader_runner: Refactor handling of fb commands.

2016-10-18 Thread Francisco Jerez
This refactors the implementation of the various "fb" commands to be
part of a single 'if (parse_str(line, "fb ", ...)) {}' block in order
to make code-sharing easier among fb subcommands.  Will be more useful
when we start introducing additional fb subcommands.
---
 tests/shaders/shader_runner.c | 67 ++-
 1 file changed, 40 insertions(+), 27 deletions(-)

diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index ab2b907..4a2c807 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -140,7 +140,7 @@ static bool prog_in_use = false;
 static bool sso_in_use = false;
 static GLchar *prog_err_info = NULL;
 static GLuint vao = 0;
-static GLuint fbo = 0;
+static GLuint draw_fbo = 0;
 static GLint render_width, render_height;
 
 static bool report_subtests = false;
@@ -2959,13 +2959,16 @@ piglit_display(void)
do_enable_disable(rest, true);
} else if (sscanf(line, "depthfunc %31s", s) == 1) {
glDepthFunc(piglit_get_gl_enum_from_name(s));
-   } else if (sscanf(line, "fb tex 2d %d", &tex) == 1) {
-   GLenum status;
+   } else if (parse_str(line, "fb ", &rest)) {
+   GLuint fbo = 0;
 
-   if (fbo == 0) {
-   glGenFramebuffers(1, &fbo);
-   glBindFramebuffer(GL_FRAMEBUFFER, fbo);
-   }
+   if (parse_str(rest, "tex 2d ", &rest)) {
+   glGenFramebuffers(1, &fbo);
+   glBindFramebuffer(GL_FRAMEBUFFER, fbo);
+
+   REQUIRE(parse_int(rest, &tex, &rest),
+   "Framebuffer binding command not "
+   "understood at: %s\n", rest);
 
glFramebufferTexture2D(GL_FRAMEBUFFER,
   GL_COLOR_ATTACHMENT0,
@@ -2976,21 +2979,12 @@ piglit_display(void)
piglit_report_result(PIGLIT_FAIL);
}
 
-   status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
-   if (status != GL_FRAMEBUFFER_COMPLETE) {
-   fprintf(stderr, "incomplete fbo (status 
0x%x)\n", status);
-   piglit_report_result(PIGLIT_FAIL);
-   }
-
-   render_width = get_texture_binding(tex)->width;
-   render_height = get_texture_binding(tex)->height;
-   } else if (sscanf(line, "fb tex layered %d", &tex) == 1) {
-   GLenum status;
+   w = get_texture_binding(tex)->width;
+   h = get_texture_binding(tex)->height;
 
-   if (fbo == 0) {
-   glGenFramebuffers(1, &fbo);
-   glBindFramebuffer(GL_FRAMEBUFFER, fbo);
-   }
+   } else if (sscanf(rest, "tex layered %d", &tex) == 1) {
+   glGenFramebuffers(1, &fbo);
+   glBindFramebuffer(GL_FRAMEBUFFER, fbo);
 
glFramebufferTexture(GL_FRAMEBUFFER,
 GL_COLOR_ATTACHMENT0,
@@ -3000,11 +2994,31 @@ piglit_display(void)
piglit_report_result(PIGLIT_FAIL);
}
 
-   status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
-   if (status != GL_FRAMEBUFFER_COMPLETE) {
-   fprintf(stderr, "incomplete fbo (status 
0x%x)\n", status);
-   piglit_report_result(PIGLIT_FAIL);
-   }
+   w = get_texture_binding(tex)->width;
+   h = get_texture_binding(tex)->height;
+
+   } else {
+   fprintf(stderr, "Unknown fb bind subcommand "
+   "\"%s\"\n", rest);
+   piglit_report_result(PIGLIT_FAIL);
+   }
+
+   const GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
+   if (status != GL_FRAMEBUFFER_COMPLETE) {
+   fprintf(stderr, "incomplete fbo (status 0x%x)\n", 
status);
+   piglit_report_result(PIGLIT_FAIL);
+   }
+
+   render_width = w;
+   render_height = h;
+
+   /* Delete the previous draw FB in case
+* it's no longer reachable.
+*/
+   if (draw_fbo != 0)
+   glDeleteFramebuffers(1, &draw_fbo);
+
+   draw_fbo = fbo;
 
} else if (parse_str(line, "frustum", &rest)) {
parse_floats(rest, c, 6, NULL);
@@ -3622,7 +3636,6 @@ piglit_init(int argc, char **argv)
 

[Piglit] [PATCH 10/18] shader_runner: Add fb tex slice binding command.

2016-10-18 Thread Francisco Jerez
"fb tex slice" can be
used to bind an arbitrary layer of the specified texture as color
attachment of the current framebuffer object.
---
 tests/shaders/shader_runner.c | 67 +++
 1 file changed, 67 insertions(+)

diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index 7151fd2..7123c1a 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -2997,6 +2997,73 @@ piglit_display(void)
w = get_texture_binding(tex)->width;
h = get_texture_binding(tex)->height;
 
+   } else if (parse_str(rest, "tex slice ", &rest)) {
+   GLenum tex_target;
+
+   REQUIRE(parse_tex_target(rest, &tex_target, 
&rest) &&
+   parse_int(rest, &tex, &rest) &&
+   parse_int(rest, &l, &rest) &&
+   parse_int(rest, &z, &rest),
+   "Framebuffer binding command not "
+   "understood at: %s\n", rest);
+
+   const GLuint tex_obj = 
get_texture_binding(tex)->obj;
+
+   glGenFramebuffers(1, &fbo);
+   glBindFramebuffer(target, fbo);
+
+   if (tex_target == GL_TEXTURE_1D) {
+   REQUIRE(z == 0,
+   "Invalid layer index provided "
+   "in command: %s\n", line);
+   glFramebufferTexture1D(
+   target, GL_COLOR_ATTACHMENT0,
+   tex_target, tex_obj, l);
+
+   } else if (tex_target == GL_TEXTURE_2D ||
+  tex_target == GL_TEXTURE_RECTANGLE ||
+  tex_target == 
GL_TEXTURE_2D_MULTISAMPLE) {
+   REQUIRE(z == 0,
+   "Invalid layer index provided "
+   "in command: %s\n", line);
+   glFramebufferTexture2D(
+   target, GL_COLOR_ATTACHMENT0,
+   tex_target, tex_obj, l);
+
+   } else if (tex_target == GL_TEXTURE_CUBE_MAP) {
+   static const GLenum cubemap_targets[] = 
{
+   GL_TEXTURE_CUBE_MAP_POSITIVE_X,
+   GL_TEXTURE_CUBE_MAP_NEGATIVE_X,
+   GL_TEXTURE_CUBE_MAP_POSITIVE_Y,
+   GL_TEXTURE_CUBE_MAP_NEGATIVE_Y,
+   GL_TEXTURE_CUBE_MAP_POSITIVE_Z,
+   GL_TEXTURE_CUBE_MAP_NEGATIVE_Z
+   };
+   REQUIRE(z < ARRAY_SIZE(cubemap_targets),
+   "Invalid layer index provided "
+   "in command: %s\n", line);
+   tex_target = cubemap_targets[z];
+
+   glFramebufferTexture2D(
+   target, GL_COLOR_ATTACHMENT0,
+   tex_target, tex_obj, l);
+
+   } else {
+   glFramebufferTextureLayer(
+   target, GL_COLOR_ATTACHMENT0,
+   tex_obj, l, z);
+   }
+
+   if (!piglit_check_gl_error(GL_NO_ERROR)) {
+   fprintf(stderr, "Error binding texture "
+   "attachment for command: %s\n",
+   line);
+   piglit_report_result(PIGLIT_FAIL);
+   }
+
+   w = MAX2(1, get_texture_binding(tex)->width >> 
l);
+   h = MAX2(1, get_texture_binding(tex)->height >> 
l);
+
} else if (sscanf(rest, "tex layered %d", &tex) == 1) {
glGenFramebuffers(1, &fbo);
glBindFramebuffer(target, fbo);
-- 
2.9.0

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

[Piglit] [PATCH 18/18] Add test generator for EXT_shader_framebuffer_fetch.

2016-10-18 Thread Francisco Jerez
---
 generated_tests/CMakeLists.txt |   4 +
 .../gen_shader_framebuffer_fetch_tests.py  | 796 +
 2 files changed, 800 insertions(+)
 create mode 100644 generated_tests/gen_shader_framebuffer_fetch_tests.py

diff --git a/generated_tests/CMakeLists.txt b/generated_tests/CMakeLists.txt
index ff43af5..6059569 100644
--- a/generated_tests/CMakeLists.txt
+++ b/generated_tests/CMakeLists.txt
@@ -193,6 +193,9 @@ piglit_make_generated_tests(
gen_vs_in_fp64.py
templates/gen_vs_in_fp64/columns.shader_test.mako
templates/gen_vs_in_fp64/regular.shader_test.mako)
+piglit_make_generated_tests(
+   shader_framebuffer_fetch_tests.list
+   gen_shader_framebuffer_fetch_tests.py)
 
 # OpenCL Test generators
 piglit_make_generated_tests(
@@ -241,6 +244,7 @@ add_custom_target(gen-gl-tests
flat_interpolation_qualifier.list
conversion_fp64.list
shader_precision_tests.list
+   shader_framebuffer_fetch_tests.list
shader_image_load_store_tests.list
variable_index_read_tests.list
gen_extensions_defined.list
diff --git a/generated_tests/gen_shader_framebuffer_fetch_tests.py 
b/generated_tests/gen_shader_framebuffer_fetch_tests.py
new file mode 100644
index 000..9131742
--- /dev/null
+++ b/generated_tests/gen_shader_framebuffer_fetch_tests.py
@@ -0,0 +1,796 @@
+# coding=utf-8
+#
+# Copyright (C) 2014-2016 Intel Corporation
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+# IN THE SOFTWARE.
+
+from __future__ import print_function, division, absolute_import
+import os.path
+from mako.template import Template
+from textwrap import dedent
+from modules import utils
+
+
+def product(ps, *qss):
+"""
+Generate the cartesian product of a number of lists of dictionaries.
+
+Generate a sequence with every possible combination of elements of
+the specified lists of dictionaries.  Each element of the result
+will be the union of some combination of dictionaries from the
+lists given as argument.  The 'name' attribute of each dictionary
+given as input is concatenated with the names of other
+dictionaries part of the same combination to give the 'name'
+attribute of the result.
+"""
+for q in (product(*qss) if qss else [{}]):
+for p in ps:
+r = dict(p, **q)
+r['name'] = ''.join(s['name'] for s in (p, q) if s.get('name'))
+yield r
+
+
+def gen(src, tests):
+"""
+Expand a source template for the provided list of test definitions.
+
+Generate a test script for each element of the 'tests' iterable,
+each of them should be a dictionary of definitions that will be
+used as environment to render the source template.
+
+The 'path' attribute of each dictionary gives the filename each
+test will be written to.
+"""
+template = Template(dedent(src))
+
+for t in tests:
+print(t['path'])
+utils.safe_makedirs(os.path.dirname(t['path']))
+with open(t['path'], 'w') as f:
+f.write(template.render(**t))
+
+
+def gen_execution(src, tests):
+"""
+Generate a shader runner test for each element of the 'tests'
+iterable.
+"""
+return gen(src,
+   (dict(t, path = os.path.join(
+   'spec', t['extension'], 'execution',
+   t['name'] + '.shader_test')) for t in tests))
+
+
+def gen_compiler(src, tests):
+"""
+Generate a GLSL parser test for each element of the 'tests'
+iterable.
+"""
+return gen(src,
+   (dict(t, path = os.path.join(
+   'spec', t['extension'], 'compiler',
+   t['name'] + '.' + t['shader_stage'])) for t in tests))
+
+
+#
+# Common definitions for framebuffer fetch tests.
+#
+common_defs = [{'extension': 'E

[Piglit] [PATCH 12/18] shader_runner: Add winsys framebuffer binding command.

2016-10-18 Thread Francisco Jerez
"fb winsys" binds the original window system framebuffer.  Useful for
displaying the contents rendered into an offscreen framebuffer at the
end of the test.
---
 tests/shaders/shader_runner.c | 13 +
 1 file changed, 13 insertions(+)

diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index fcf77d1..975603c 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -3110,6 +3110,17 @@ piglit_display(void)
piglit_report_result(PIGLIT_FAIL);
}
 
+   } else if (parse_str(rest, "winsys", &rest)) {
+   fbo = piglit_winsys_fbo;
+   glBindFramebuffer(target, fbo);
+   if (!piglit_check_gl_error(GL_NO_ERROR)) {
+   fprintf(stderr, "glBindFramebuffer 
error\n");
+   piglit_report_result(PIGLIT_FAIL);
+   }
+
+   w = piglit_width;
+   h = piglit_height;
+
} else {
fprintf(stderr, "Unknown fb bind subcommand "
"\"%s\"\n", rest);
@@ -3131,6 +3142,7 @@ piglit_display(void)
 * it's no longer reachable.
 */
if (draw_fbo != 0 &&
+   draw_fbo != piglit_winsys_fbo &&
draw_fbo != (target == GL_DRAW_FRAMEBUFFER ?
 read_fbo : 0))
glDeleteFramebuffers(1, &draw_fbo);
@@ -3146,6 +3158,7 @@ piglit_display(void)
 * it's no longer reachable.
 */
if (read_fbo != 0 &&
+   read_fbo != piglit_winsys_fbo &&
read_fbo != (target == GL_READ_FRAMEBUFFER ?
 draw_fbo : 0))
glDeleteFramebuffers(1, &read_fbo);
-- 
2.9.0

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


[Piglit] [PATCH 03/18] shader_runner: Take advantage of texture binding book-keeping in image binding command.

2016-10-18 Thread Francisco Jerez
No need to do the glActiveTexture + glGetIntegerv dance to find out
which texture object is bound to a texture unit.
---
 tests/shaders/shader_runner.c | 8 ++--
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index 50025b8..2a37b56 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -3023,12 +3023,8 @@ piglit_display(void)
  "image texture %d %31s",
  &tex, s) == 2) {
const GLenum img_fmt = piglit_get_gl_enum_from_name(s);
-   GLint tex_num;
-
-   glActiveTexture(GL_TEXTURE0 + tex);
-   glGetIntegerv(GL_TEXTURE_BINDING_2D, &tex_num);
-   glBindImageTexture(tex, tex_num, 0, GL_FALSE, 0,
-  GL_READ_WRITE, img_fmt);
+   glBindImageTexture(tex, get_texture_binding(tex)->obj, 
0,
+  GL_FALSE, 0, GL_READ_WRITE, img_fmt);
} else if (sscanf(line, "memory barrier %s", s) == 1) {

glMemoryBarrier(piglit_get_gl_memory_barrier_enum_from_name(s));
} else if (sscanf(line, "ortho %f %f %f %f",
-- 
2.9.0

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


[Piglit] [PATCH 11/18] shader_runner: Add multisample framebuffer binding command.

2016-10-18 Thread Francisco Jerez
"fb ms" binds a fresh multisample
framebuffer object with the given format and dimensions.
---
 tests/shaders/shader_runner.c | 30 ++
 1 file changed, 30 insertions(+)

diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index 7123c1a..fcf77d1 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -3080,6 +3080,36 @@ piglit_display(void)
w = get_texture_binding(tex)->width;
h = get_texture_binding(tex)->height;
 
+   } else if (parse_str(rest, "ms ", &rest)) {
+   GLuint rb;
+   GLenum format;
+   int samples;
+
+   REQUIRE(parse_enum_gl(rest, &format, &rest) &&
+   parse_int(rest, &w, &rest) &&
+   parse_int(rest, &h, &rest) &&
+   parse_int(rest, &samples, &rest),
+   "Framebuffer binding command not "
+   "understood at: %s\n", rest);
+
+   glGenFramebuffers(1, &fbo);
+   glBindFramebuffer(target, fbo);
+
+   glGenRenderbuffers(1, &rb);
+   glBindRenderbuffer(GL_RENDERBUFFER, rb);
+
+   
glRenderbufferStorageMultisample(GL_RENDERBUFFER, samples,
+format, w, h);
+
+   glFramebufferRenderbuffer(target,
+ GL_COLOR_ATTACHMENT0,
+ GL_RENDERBUFFER, rb);
+
+   if (!piglit_check_gl_error(GL_NO_ERROR)) {
+   fprintf(stderr, 
"glFramebufferRenderbuffer error\n");
+   piglit_report_result(PIGLIT_FAIL);
+   }
+
} else {
fprintf(stderr, "Unknown fb bind subcommand "
"\"%s\"\n", rest);
-- 
2.9.0

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


Re: [Piglit] [PATCH] shader_runner: report PIGLIT_FAIL if linking unexpectedly fails

2016-10-18 Thread Dylan Baker
Quoting Brian Paul (2016-10-18 16:28:53)
> We were previously reporting 'pass' if linking failed.
> ---
>  tests/shaders/shader_runner.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
> index b0bde2c..94865b7 100644
> --- a/tests/shaders/shader_runner.c
> +++ b/tests/shaders/shader_runner.c
> @@ -3529,6 +3529,7 @@ piglit_display(void)
>  
> if (!link_ok && !link_error_expected) {
> program_must_be_in_use();
> +   full_result = PIGLIT_FAIL;
> }
>  
> piglit_present_results();
> -- 
> 1.9.1
> 
> ___
> Piglit mailing list
> Piglit@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/piglit

And, after looking some more, there's a lot of cases where we need to handle
this.

Dylan


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


Re: [Piglit] [PATCH] shader_runner: report PIGLIT_FAIL if linking unexpectedly fails

2016-10-18 Thread Brian Paul

On 10/18/2016 05:43 PM, Dylan Baker wrote:

Quoting Brian Paul (2016-10-18 16:28:53)

We were previously reporting 'pass' if linking failed.
---
  tests/shaders/shader_runner.c | 1 +
  1 file changed, 1 insertion(+)

diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index b0bde2c..94865b7 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -3529,6 +3529,7 @@ piglit_display(void)

 if (!link_ok && !link_error_expected) {
 program_must_be_in_use();
+   full_result = PIGLIT_FAIL;
 }

 piglit_present_results();
--
1.9.1

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


And, after looking some more, there's a lot of cases where we need to handle
this.


Yeah, I saw that and wasn't sure what was intended.  My take was 
regardless of what program_must_be_in_use() returns, the fact that if 
link_ok==false and link_error_expected==false it means the test failed.


Changing it to full_result = program_must_be_in_use() works too.  I'll 
update the patch.


-Brian

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


[Piglit] [PATCH] shader_runner: report PIGLIT_FAIL if linking unexpectedly fails

2016-10-18 Thread Brian Paul
We were previously reporting 'pass' if linking failed.

v2: return the result of program_must_be_in_use(), per Dylan.
---
 tests/shaders/shader_runner.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index b0bde2c..598a859 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -3528,7 +3528,7 @@ piglit_display(void)
}
 
if (!link_ok && !link_error_expected) {
-   program_must_be_in_use();
+   full_result = program_must_be_in_use();
}
 
piglit_present_results();
-- 
1.9.1

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