Re: [Piglit] [PATCH] glsl-1.50: add linker test for unused in out blocks

2017-07-18 Thread Timothy Arceri

On 15/07/17 06:21, Józef Kucia wrote:

On Tue, May 30, 2017 at 4:23 PM, Józef Kucia  wrote:

This test exposes a Mesa GLSL linker bug. The test fails with the
following error message:

   error: Input block `blk' is not an output of the previous stage

Section 4.3.4 (Inputs) of the GLSL 1.50 spec says:

 "Only the input variables that are actually read need to be written
 by the previous stage; it is allowed to have superfluous
 declarations of input variables."
---
  .../interstage-multiple-shader-objects.shader_test | 38 ++
  1 file changed, 38 insertions(+)
  create mode 100644 
tests/spec/glsl-1.50/linker/interstage-multiple-shader-objects.shader_test


Ping. Could someone take a look?


I've push this patch. Thanks for the test :)


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


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


[Piglit] [PATCH] arb_provoking_vertex: test OpenGL profile too

2017-07-18 Thread Brian Paul
The GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION query is legal with
compat profile or GL 3.2.

Ideally, I guess we should have several variants of this test which
exercise different GL versions and profiles.  I hand-edited the test and
ran it with those variations.  Both NVIDIA and Mesa (with recent patch)
all pass.
---
 .../arb_provoking_vertex/quads-follow-provoking-vertex.c| 13 ++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/tests/spec/arb_provoking_vertex/quads-follow-provoking-vertex.c 
b/tests/spec/arb_provoking_vertex/quads-follow-provoking-vertex.c
index 91a18ce..57d2b11 100644
--- a/tests/spec/arb_provoking_vertex/quads-follow-provoking-vertex.c
+++ b/tests/spec/arb_provoking_vertex/quads-follow-provoking-vertex.c
@@ -45,15 +45,22 @@ piglit_init(int argc, char **argv)
 {
bool pass = true;
GLboolean followsProvoking = false;
-   GLint major, minor;
+   GLint major, minor, profile;
GLenum expected_error;
 
glGetIntegerv(GL_MAJOR_VERSION, );
glGetIntegerv(GL_MINOR_VERSION, );
printf("GL version: %d.%d\n", major, minor);
 
-   expected_error =
-   (major * 10 + minor > 32) ? GL_INVALID_ENUM : GL_NO_ERROR;
+   glGetIntegerv(GL_CONTEXT_PROFILE_MASK, );
+   printf("GL profile: 0x%x\n", profile);
+
+   if ((profile & GL_CONTEXT_COMPATIBILITY_PROFILE_BIT) ||
+   major * 10 + minor == 32) {
+   expected_error = GL_NO_ERROR;
+   } else {
+   expected_error = GL_INVALID_ENUM;
+   }
 
glGetBooleanv(GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION,
  );
-- 
1.9.1

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


[Piglit] [PATCH 14/17] ext_framebuffer_multisample: clip-and-scissor also against RGBA16F/32F

2017-07-18 Thread Topi Pohjolainen
Signed-off-by: Topi Pohjolainen 
---
 tests/all.py| 10 ++
 .../clip-and-scissor-blit.cpp   | 17 ++---
 2 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/tests/all.py b/tests/all.py
index 78de273c1..589259ea5 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -3064,10 +3064,12 @@ with profile.test_list.group_manager(
sample_count],
   '{} {}'.format(test, sample_count))
 
-for blit_type in ('msaa', 'upsample', 'downsample', 'normal'):
-g(['ext_framebuffer_multisample-clip-and-scissor-blit',
-   sample_count, blit_type],
-  'clip-and-scissor-blit {} {}'.format(sample_count, blit_type))
+for fmt in ('GL_RGBA', 'GL_RGBA16F', 'GL_RGBA32F'):
+for blit_type in ('msaa', 'upsample', 'downsample', 'normal'):
+g(['ext_framebuffer_multisample-clip-and-scissor-blit',
+   sample_count, fmt, blit_type],
+  'clip-and-scissor-blit {} {} {}'.format(
+  sample_count, fmt, blit_type))
 
 for flip_direction in ('x', 'y'):
 for fmt in ('GL_RGBA', 'GL_RGBA16F', 'GL_RGBA32F'):
diff --git a/tests/spec/ext_framebuffer_multisample/clip-and-scissor-blit.cpp 
b/tests/spec/ext_framebuffer_multisample/clip-and-scissor-blit.cpp
index 1b17e9b38..5c29982da 100644
--- a/tests/spec/ext_framebuffer_multisample/clip-and-scissor-blit.cpp
+++ b/tests/spec/ext_framebuffer_multisample/clip-and-scissor-blit.cpp
@@ -315,7 +315,7 @@ do_test(int coord, bool clip_low, test_type_enum test_type,
 NORETURN void
 print_usage_and_exit(char *prog_name)
 {
-   printf("Usage: %s  \n"
+   printf("Usage: %s   \n"
   "  where  is one of:\n"
   "msaa\n"
   "upsample\n"
@@ -349,26 +349,29 @@ piglit_init(int argc, char **argv)
if (num_samples > max_samples)
piglit_report_result(PIGLIT_SKIP);
 
+   const GLenum color_internal_format =
+   piglit_get_gl_enum_from_name(argv[2]);
+
int src_samples;
int dst_samples;
-   if (strcmp(argv[2], "msaa") == 0) {
+   if (strcmp(argv[3], "msaa") == 0) {
src_samples = dst_samples = num_samples;
-   } else if (strcmp(argv[2], "upsample") == 0) {
+   } else if (strcmp(argv[3], "upsample") == 0) {
src_samples = 0;
dst_samples = num_samples;
-   } else if (strcmp(argv[2], "downsample") == 0) {
+   } else if (strcmp(argv[3], "downsample") == 0) {
src_samples = num_samples;
dst_samples = 0;
-   } else if (strcmp(argv[2], "normal") == 0) {
+   } else if (strcmp(argv[3], "normal") == 0) {
src_samples = dst_samples = 0;
test_mirrored_blits = true;
} else {
print_usage_and_exit(argv[0]);
}
 
-   src_fbo.setup(FboConfig(GL_RGBA, src_samples,
+   src_fbo.setup(FboConfig(color_internal_format, src_samples,
src_size[0], src_size[1]));
-   dst_fbo.setup(FboConfig(GL_RGBA, dst_samples,
+   dst_fbo.setup(FboConfig(color_internal_format, dst_samples,
dst_size[0], dst_size[1]));
 }
 
-- 
2.11.0

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


[Piglit] [PATCH 06/17] ext_framebuffer_multisample: blit-flipped also against RGBA16F/32F

2017-07-18 Thread Topi Pohjolainen
Signed-off-by: Topi Pohjolainen 
---
 tests/all.py|  8 +---
 tests/spec/ext_framebuffer_multisample/blit-flipped.cpp | 16 +---
 2 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/tests/all.py b/tests/all.py
index 98b78ea89..1411a87b5 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -3072,9 +3072,11 @@ with profile.test_list.group_manager(
   'clip-and-scissor-blit {} {}'.format(sample_count, blit_type))
 
 for flip_direction in ('x', 'y'):
-g(['ext_framebuffer_multisample-blit-flipped', sample_count,
-   flip_direction],
-  'blit-flipped {} {}'.format(sample_count, flip_direction))
+for fmt in ('GL_RGBA', 'GL_RGBA16F', 'GL_RGBA32F'):
+g(['ext_framebuffer_multisample-blit-flipped', sample_count,
+   fmt, flip_direction],
+  'blit-flipped {} {} {}'.format(
+  sample_count, fmt, flip_direction))
 
 for buffer_type in ('color', 'depth', 'stencil'):
 g(['ext_framebuffer_multisample-clear', sample_count, buffer_type],
diff --git a/tests/spec/ext_framebuffer_multisample/blit-flipped.cpp 
b/tests/spec/ext_framebuffer_multisample/blit-flipped.cpp
index 5380d0542..016ea8e58 100644
--- a/tests/spec/ext_framebuffer_multisample/blit-flipped.cpp
+++ b/tests/spec/ext_framebuffer_multisample/blit-flipped.cpp
@@ -72,7 +72,7 @@ static GLint srcX0, srcY0, srcX1, srcY1;
 static void
 print_usage_and_exit(char *prog_name)
 {
-   printf("Usage: %s  \n"
+   printf("Usage: %s   \n"
   "  where  is either x or y\n",
   prog_name);
piglit_report_result(PIGLIT_FAIL);
@@ -81,7 +81,7 @@ print_usage_and_exit(char *prog_name)
 void
 piglit_init(int argc, char **argv)
 {
-   if (argc != 3)
+   if (argc != 4)
print_usage_and_exit(argv[0]);
 
/* 1st arg: num_samples */
@@ -90,13 +90,15 @@ piglit_init(int argc, char **argv)
if (endptr != argv[1] + strlen(argv[1]))
print_usage_and_exit(argv[0]);
 
-   /* 2nd arg: flip_direction */
-   if (strcmp(argv[2], "x") == 0) {
+   GLenum color_internal_format = piglit_get_gl_enum_from_name(argv[2]);
+
+   /* 3rd arg: flip_direction */
+   if (strcmp(argv[3], "x") == 0) {
srcX0 = pattern_width;
srcX1 = 0;
srcY0 = 0;
srcY1 = pattern_height;
-   } else if (strcmp(argv[2], "y") == 0) {
+   } else if (strcmp(argv[3], "y") == 0) {
srcX0 = 0;
srcX1 = pattern_width;
srcY0 = pattern_height;
@@ -115,11 +117,11 @@ piglit_init(int argc, char **argv)
if (num_samples > max_samples)
piglit_report_result(PIGLIT_SKIP);
 
-   singlesampled_fbo.setup(FboConfig(GL_RGBA, 0,
+   singlesampled_fbo.setup(FboConfig(color_internal_format, 0,
  pattern_width,
  pattern_height));
 
-   multisampled_fbo.setup(FboConfig(GL_RGBA, num_samples,
+   multisampled_fbo.setup(FboConfig(color_internal_format, num_samples,
 pattern_width,
 pattern_height));
 
-- 
2.11.0

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


[Piglit] [PATCH 09/17] ext_framebuffer_multisample: color clear also against RGBA16F/32F

2017-07-18 Thread Topi Pohjolainen
Signed-off-by: Topi Pohjolainen 
---
 tests/spec/ext_framebuffer_multisample/clear.cpp | 31 ++--
 1 file changed, 23 insertions(+), 8 deletions(-)

diff --git a/tests/spec/ext_framebuffer_multisample/clear.cpp 
b/tests/spec/ext_framebuffer_multisample/clear.cpp
index cb6c2e1a6..cb3231928 100644
--- a/tests/spec/ext_framebuffer_multisample/clear.cpp
+++ b/tests/spec/ext_framebuffer_multisample/clear.cpp
@@ -77,9 +77,9 @@ namespace {
 
 const int pattern_width = 256; const int pattern_height = 256;
 
-Fbo multisampled_fbo;
 ManifestProgram *manifest_program = NULL;
 GLbitfield buffer_to_test;
+int num_samples;
 
 
 void
@@ -103,7 +103,7 @@ piglit_init(int argc, char **argv)
 
/* 1st arg: num_samples */
char *endptr = NULL;
-   int num_samples = strtol(argv[1], , 0);
+   num_samples = strtol(argv[1], , 0);
if (endptr != argv[1] + strlen(argv[1]))
print_usage_and_exit(argv[0]);
 
@@ -130,8 +130,6 @@ piglit_init(int argc, char **argv)
if (num_samples > max_samples)
piglit_report_result(PIGLIT_SKIP);
 
-   multisampled_fbo.setup(FboConfig(GL_RGBA, num_samples, pattern_width,
-pattern_height));
if (manifest_program)
manifest_program->compile();
 
@@ -142,10 +140,15 @@ piglit_init(int argc, char **argv)
 
 bool
 test_clear(const float r, const float g, const float b,
-  const float a, const bool fast_clear_compatible)
+  const float a, const bool fast_clear_compatible,
+  GLenum color_internal_format)
 {
bool pass = true;
 
+   Fbo multisampled_fbo;
+   multisampled_fbo.setup(FboConfig(color_internal_format, num_samples,
+pattern_width, pattern_height));
+
/* Clear all buffers of the multisampled fbo to default values
 * (color={0,0,0,0}, depth=1, stencil=0), with no special
 * coverage settings set.
@@ -257,16 +260,28 @@ test_clear(const float r, const float g, const float b,
 extern "C" enum piglit_result
 piglit_display()
 {
-   bool pass =true;
+   bool pass;
 
/* Non 'fast clear' path. */
-   pass = test_clear(1.0, 1.0, 1.0, 0.5, false) && pass;
+   if (buffer_to_test == GL_COLOR_BUFFER_BIT) {
+   pass = test_clear(1.0, 1.0, 1.0, 0.5, false, GL_RGBA);
+   pass &= test_clear(1.0, 1.0, 1.0, 0.5, false, GL_RGBA16F);
+   pass &= test_clear(1.0, 1.0, 1.0, 0.5, false, GL_RGBA32F);
+   } else {
+   pass = test_clear(1.0, 1.0, 1.0, 0.5, false, GL_RGBA);
+   }
 
/* Test with color values compatible with Intel's i965 driver's
 * 'fast clear' constraints. It varifies the 'fast clear' path
 * if supported by the implementation.
 */
-   pass = test_clear(1.0, 1.0, 1.0, 0.0, true) && pass;
+   if (buffer_to_test == GL_COLOR_BUFFER_BIT) {
+   pass &= test_clear(1.0, 1.0, 1.0, 0.0, true, GL_RGBA);
+   pass &= test_clear(1.0, 1.0, 1.0, 0.0, true, GL_RGBA16F);
+   pass &= test_clear(1.0, 1.0, 1.0, 0.0, true, GL_RGBA32F);
+   } else {
+   pass &= test_clear(1.0, 1.0, 1.0, 0.0, true, GL_RGBA);
+   }
 
return pass ? PIGLIT_PASS : PIGLIT_FAIL;
 }
-- 
2.11.0

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


[Piglit] [PATCH 08/17] ext_framebuffer_multisample: blit-multiple-rt also against RGBA16F/32F

2017-07-18 Thread Topi Pohjolainen
Signed-off-by: Topi Pohjolainen 
---
 tests/all.py   |  5 +
 .../blit-multiple-render-targets.cpp   | 10 +++---
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/tests/all.py b/tests/all.py
index 7e45a81c3..78de273c1 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -2996,10 +2996,6 @@ with profile.test_list.group_manager(
 # non-multisampled framebuffers, so go ahead and test them with
 # num_samples==0 as well.
 for num_samples in ['0'] + MSAA_SAMPLE_COUNTS:
-g(['ext_framebuffer_multisample-blit-multiple-render-targets',
-   num_samples],
-  'blit-multiple-render-targets {}'.format(num_samples))
-
 for test_type in ('non-centroid-disabled', 'centroid-disabled',
   'centroid-edges', 'non-centroid-deriv',
   'non-centroid-deriv-disabled', 'centroid-deriv',
@@ -3053,6 +3049,7 @@ with profile.test_list.group_manager(
  'alpha-to-coverage-no-draw-buffer-zero-write',
  'alpha-to-one-dual-src-blend',
  'alpha-to-one-msaa-disabled',
+ 'blit-multiple-render-targets',
  'bitmap', 'polygon-stipple']:
 for fmt in ('GL_RGBA', 'GL_RGBA16F', 'GL_RGBA32F'):
g(['ext_framebuffer_multisample-{}'.format(test),
diff --git 
a/tests/spec/ext_framebuffer_multisample/blit-multiple-render-targets.cpp 
b/tests/spec/ext_framebuffer_multisample/blit-multiple-render-targets.cpp
index 4afb84cfe..c429b12f6 100644
--- a/tests/spec/ext_framebuffer_multisample/blit-multiple-render-targets.cpp
+++ b/tests/spec/ext_framebuffer_multisample/blit-multiple-render-targets.cpp
@@ -48,7 +48,7 @@ static Fbo multisample_fbo;
 void
 print_usage_and_exit(char *prog_name)
 {
-   printf("Usage: %s \n", prog_name);
+   printf("Usage: %s  \n", prog_name);
piglit_report_result(PIGLIT_FAIL);
 }
 
@@ -56,7 +56,7 @@ print_usage_and_exit(char *prog_name)
 extern "C" void
 piglit_init(int argc, char **argv)
 {
-   if (argc != 2)
+   if (argc != 3)
print_usage_and_exit(argv[0]);
 
/* 1st arg: num_samples */
@@ -65,6 +65,9 @@ piglit_init(int argc, char **argv)
if (endptr != argv[1] + strlen(argv[1]))
print_usage_and_exit(argv[0]);
 
+   const GLenum color_internal_format =
+   piglit_get_gl_enum_from_name(argv[2]);
+
piglit_require_extension("GL_ARB_framebuffer_object");
 
/* Skip the test if num_samples > GL_MAX_SAMPLES */
@@ -73,7 +76,8 @@ piglit_init(int argc, char **argv)
if (num_samples > max_samples)
piglit_report_result(PIGLIT_SKIP);
 
-   FboConfig Config(GL_RGBA, num_samples, piglit_width, piglit_height);
+   FboConfig Config(color_internal_format, num_samples,
+piglit_width, piglit_height);
 
/* Setup fbo with renderbuffer and texture attachments */
Config.num_rb_attachments = 2;
-- 
2.11.0

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


[Piglit] [PATCH 11/17] ext_framebuffer_multisample: sample-alpha- also against RGBA16F/32F

2017-07-18 Thread Topi Pohjolainen
Signed-off-by: Topi Pohjolainen 
---
 .../sample-alpha-to-coverage.cpp   | 41 +++---
 1 file changed, 28 insertions(+), 13 deletions(-)

diff --git 
a/tests/spec/ext_framebuffer_multisample/sample-alpha-to-coverage.cpp 
b/tests/spec/ext_framebuffer_multisample/sample-alpha-to-coverage.cpp
index 7b756ba83..2b4b3f735 100644
--- a/tests/spec/ext_framebuffer_multisample/sample-alpha-to-coverage.cpp
+++ b/tests/spec/ext_framebuffer_multisample/sample-alpha-to-coverage.cpp
@@ -53,7 +53,10 @@ PIGLIT_GL_TEST_CONFIG_BEGIN
 
 PIGLIT_GL_TEST_CONFIG_END
 
+const unsigned num_attachments = 1;
+static int samples;
 static GLenum buffer_to_test;
+static unsigned pattern_width, pattern_height;
 
 void
 print_usage_and_exit(char *prog_name)
@@ -69,9 +72,6 @@ print_usage_and_exit(char *prog_name)
 void
 piglit_init(int argc, char **argv)
 {
-   const int num_attachments = 1;
-   int samples;
-
piglit_require_gl_version(21);
piglit_require_extension("GL_ARB_framebuffer_object");
piglit_require_extension("GL_ARB_vertex_array_object");
@@ -93,8 +93,8 @@ piglit_init(int argc, char **argv)
} else
print_usage_and_exit(argv[0]);
 
-   int pattern_width = piglit_width / 2;
-   int pattern_height = piglit_height / num_attachments;
+   pattern_width = piglit_width / 2;
+   pattern_height = piglit_height / num_attachments;
 
piglit_ortho_projection(pattern_width,
pattern_height,
@@ -107,21 +107,23 @@ piglit_init(int argc, char **argv)
if (samples > max_samples)
piglit_report_result(PIGLIT_SKIP);
 
-   ms_fbo_and_draw_buffers_setup(samples,
- pattern_width,
- pattern_height,
- num_attachments,
- buffer_to_test,
- GL_RGBA);
shader_compile(true /* sample_alpha_to_coverage */,
   false /* dual_src_blend */,
   true /* frag_out_zero_write */);
 }
 
-enum piglit_result
-piglit_display()
+static bool
+test_format(GLenum color_internal_format)
 {
bool pass = true;
+
+   ms_fbo_and_draw_buffers_setup(samples,
+ pattern_width,
+ pattern_height,
+ num_attachments,
+ buffer_to_test,
+ color_internal_format);
+
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, piglit_winsys_fbo);
glClearColor(0.0, 0.0, 0.0, 1.0);
glClear(GL_COLOR_BUFFER_BIT);
@@ -155,6 +157,19 @@ piglit_display()
/* Free the memory allocated for data arrays */
free_data_arrays();
 
+   return pass;
+}
+
+enum piglit_result
+piglit_display()
+{
+   bool pass = test_format(GL_RGBA);
+
+   if (buffer_to_test == GL_COLOR_BUFFER_BIT) {
+  pass &= test_format(GL_RGBA16F);
+  pass &= test_format(GL_RGBA32F);
+   }
+
if (!piglit_automatic && buffer_to_test == GL_COLOR_BUFFER_BIT)
piglit_present_results();
 
-- 
2.11.0

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


[Piglit] [PATCH 15/17] ext_framebuffer_multisample: sample-coverage also against RGBA16F/32F

2017-07-18 Thread Topi Pohjolainen
Signed-off-by: Topi Pohjolainen 
---
 tests/all.py   | 10 ++
 tests/spec/ext_framebuffer_multisample/sample-coverage.cpp | 14 +-
 2 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/tests/all.py b/tests/all.py
index 589259ea5..37399c737 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -3030,10 +3030,12 @@ with profile.test_list.group_manager(
   'unaligned-blit {} {} {}'.format(
   sample_count, buffer_type, blit_type))
 
-for test_mode in ('inverted', 'non-inverted'):
-g(['ext_framebuffer_multisample-sample-coverage', sample_count,
-   test_mode],
-  'sample-coverage {} {}'.format(sample_count, test_mode))
+for fmt in ('GL_RGBA', 'GL_RGBA16F', 'GL_RGBA32F'):
+for test_mode in ('inverted', 'non-inverted'):
+g(['ext_framebuffer_multisample-sample-coverage', sample_count,
+   fmt, test_mode],
+  'sample-coverage {} {} {}'.format(
+  sample_count, fmt, test_mode))
 
 for buffer_type in ('color', 'depth'):
 g(['ext_framebuffer_multisample-sample-alpha-to-coverage',
diff --git a/tests/spec/ext_framebuffer_multisample/sample-coverage.cpp 
b/tests/spec/ext_framebuffer_multisample/sample-coverage.cpp
index 6261d5cea..655e01636 100644
--- a/tests/spec/ext_framebuffer_multisample/sample-coverage.cpp
+++ b/tests/spec/ext_framebuffer_multisample/sample-coverage.cpp
@@ -176,7 +176,7 @@ draw_pattern(bool sample_coverage)
 void
 print_usage_and_exit(char *prog_name)
 {
-   printf("Usage: %s   \n"
+   printf("Usage: %s\n"
   "  where  is one of:\n"
   "inverted\n"
   "non-inverted\n",
@@ -356,7 +356,7 @@ void
 piglit_init(int argc, char **argv)
 {
int samples;
-   if (argc < 3)
+   if (argc < 4)
print_usage_and_exit(argv[0]);
{
char *endptr = NULL;
@@ -365,7 +365,10 @@ piglit_init(int argc, char **argv)
print_usage_and_exit(argv[0]);
}
 
-   for (int i = 2; i < argc; ++i) {
+   const GLenum color_internal_format =
+   piglit_get_gl_enum_from_name(argv[2]);
+
+   for (int i = 3; i < argc; ++i) {
if (strcmp(argv[i], "inverted") == 0)
coverage_invert = true;
else if (strcmp(argv[i], "non-inverted") == 0)
@@ -386,9 +389,10 @@ piglit_init(int argc, char **argv)
piglit_report_result(PIGLIT_SKIP);
 
/* Setup frame buffer objects with required configuration */
-   ms_fbo.setup(FboConfig(GL_RGBA, samples,
+   ms_fbo.setup(FboConfig(color_internal_format, samples,
   pattern_width, pattern_height));
-   resolve_fbo.setup(FboConfig(GL_RGBA, 0, pattern_width, pattern_height));
+   resolve_fbo.setup(FboConfig(color_internal_format, 0,
+   pattern_width, pattern_height));
 
if (!piglit_check_gl_error(GL_NO_ERROR)) {
printf("Error setting up frame buffer objects\n");
-- 
2.11.0

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


[Piglit] [PATCH 16/17] ext_framebuffer_multisample: int-draw-buffers also against 8/16/32/UI

2017-07-18 Thread Topi Pohjolainen
Signed-off-by: Topi Pohjolainen 
---
 tests/all.py   |  8 +---
 tests/spec/ext_framebuffer_multisample/draw-buffers-common.cpp |  7 ++-
 .../int-draw-buffers-alpha-to-coverage.cpp | 10 ++
 .../int-draw-buffers-alpha-to-one.cpp  | 10 ++
 4 files changed, 23 insertions(+), 12 deletions(-)

diff --git a/tests/all.py b/tests/all.py
index 37399c737..a3de040c4 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -3062,9 +3062,11 @@ with profile.test_list.group_manager(
  'int-draw-buffers-alpha-to-one',
  'int-draw-buffers-alpha-to-coverage',
  'alpha-to-one-single-sample-buffer']:
-g(['ext_framebuffer_multisample-{}'.format(test),
-   sample_count],
-  '{} {}'.format(test, sample_count))
+for fmt in ('GL_RGBA8I', 'GL_RGBA8UI', 'GL_RGBA16I', 'GL_RGBA16UI',
+'GL_RGBA32I', 'GL_RGBA32UI'):
+g(['ext_framebuffer_multisample-{}'.format(test),
+   sample_count, fmt],
+  '{} {} {}'.format(test, sample_count, fmt))
 
 for fmt in ('GL_RGBA', 'GL_RGBA16F', 'GL_RGBA32F'):
 for blit_type in ('msaa', 'upsample', 'downsample', 'normal'):
diff --git a/tests/spec/ext_framebuffer_multisample/draw-buffers-common.cpp 
b/tests/spec/ext_framebuffer_multisample/draw-buffers-common.cpp
index 877b74a17..7ca2e1d22 100644
--- a/tests/spec/ext_framebuffer_multisample/draw-buffers-common.cpp
+++ b/tests/spec/ext_framebuffer_multisample/draw-buffers-common.cpp
@@ -927,7 +927,12 @@ ms_fbo_and_draw_buffers_setup(int samples,
 * formatted attachments and therefore the default GL_RGBA resolve
 * framebuffer is needed in addition to the integer based.
 */
-   if (color_buffer_zero_format == GL_RGBA8I) {
+   if (color_buffer_zero_format == GL_RGBA8I ||
+   color_buffer_zero_format == GL_RGBA8UI ||
+   color_buffer_zero_format == GL_RGBA16I ||
+   color_buffer_zero_format == GL_RGBA16UI ||
+   color_buffer_zero_format == GL_RGBA32I ||
+   color_buffer_zero_format == GL_RGBA32UI) {
/* Assuming single integer buffer */
resolve_int_fbo.setup(FboConfig(
color_buffer_zero_format, 0,
diff --git 
a/tests/spec/ext_framebuffer_multisample/int-draw-buffers-alpha-to-coverage.cpp 
b/tests/spec/ext_framebuffer_multisample/int-draw-buffers-alpha-to-coverage.cpp
index 509d7a665..18b9cec20 100644
--- 
a/tests/spec/ext_framebuffer_multisample/int-draw-buffers-alpha-to-coverage.cpp
+++ 
b/tests/spec/ext_framebuffer_multisample/int-draw-buffers-alpha-to-coverage.cpp
@@ -62,15 +62,14 @@ static int samples;
 void
 print_usage_and_exit(char *prog_name)
 {
-printf("Usage: %s \n", prog_name);
+printf("Usage: %s  \n", prog_name);
piglit_report_result(PIGLIT_FAIL);
 }
 
 void
 piglit_init(int argc, char **argv)
 {
-
-   if (argc < 2)
+   if (argc < 3)
print_usage_and_exit(argv[0]);
{
char *endptr = NULL;
@@ -79,6 +78,9 @@ piglit_init(int argc, char **argv)
print_usage_and_exit(argv[0]);
}
 
+   const GLenum color_internal_format =
+   piglit_get_gl_enum_from_name(argv[2]);
+
piglit_require_gl_version(30);
 
int pattern_width = piglit_width / 2;
@@ -101,7 +103,7 @@ piglit_init(int argc, char **argv)
  pattern_height,
  num_attachments,
  GL_COLOR_BUFFER_BIT,
- GL_RGBA8I);
+ color_internal_format);
shader_compile(true /* sample_alpha_to_coverage */,
   false /* dual_src_blend */,
   true /* frag_out_zero_write */);
diff --git 
a/tests/spec/ext_framebuffer_multisample/int-draw-buffers-alpha-to-one.cpp 
b/tests/spec/ext_framebuffer_multisample/int-draw-buffers-alpha-to-one.cpp
index 608455d2f..e89651256 100644
--- a/tests/spec/ext_framebuffer_multisample/int-draw-buffers-alpha-to-one.cpp
+++ b/tests/spec/ext_framebuffer_multisample/int-draw-buffers-alpha-to-one.cpp
@@ -59,15 +59,14 @@ static int samples;
 void
 print_usage_and_exit(char *prog_name)
 {
-printf("Usage: %s \n", prog_name);
+printf("Usage: %s  \n", prog_name);
piglit_report_result(PIGLIT_FAIL);
 }
 
 void
 piglit_init(int argc, char **argv)
 {
-
-   if (argc < 2)
+   if (argc < 3)
print_usage_and_exit(argv[0]);
{
char *endptr = NULL;
@@ -76,6 +75,9 @@ piglit_init(int argc, char **argv)
print_usage_and_exit(argv[0]);
}
 
+   const GLenum color_internal_format =
+   

[Piglit] [PATCH 07/17] ext_framebuffer_multisample: blit-mismatched also against RGBA16F/32F

2017-07-18 Thread Topi Pohjolainen
Signed-off-by: Topi Pohjolainen 
---
 tests/all.py   | 13 ++-
 .../blit-mismatched-formats.cpp| 27 +++---
 .../blit-mismatched-samples.cpp| 16 +++--
 .../blit-mismatched-sizes.cpp  | 17 --
 4 files changed, 55 insertions(+), 18 deletions(-)

diff --git a/tests/all.py b/tests/all.py
index 1411a87b5..7e45a81c3 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -2943,12 +2943,6 @@ with profile.test_list.group_manager(
 with profile.test_list.group_manager(
 PiglitGLTest,
 grouptools.join('spec', 'ext_framebuffer_multisample')) as g:
-g(['ext_framebuffer_multisample-blit-mismatched-samples'],
-  'blit-mismatched-samples')
-g(['ext_framebuffer_multisample-blit-mismatched-sizes'],
-  'blit-mismatched-sizes')
-g(['ext_framebuffer_multisample-blit-mismatched-formats'],
-  'blit-mismatched-formats')
 g(['ext_framebuffer_multisample-dlist'], 'dlist')
 g(['ext_framebuffer_multisample-enable-flag'], 'enable-flag')
 g(['ext_framebuffer_multisample-minmax'], 'minmax')
@@ -2972,6 +2966,13 @@ with profile.test_list.group_manager(
   'alpha-blending slow_cc')
 g(['ext_framebuffer_multisample-fast-clear'], 'fast-clear')
 
+for test in ('blit-mismatched-formats', 'blit-mismatched-samples',
+ 'blit-mismatched-sizes'):
+for fmt in ('GL_RGBA', 'GL_RGBA16F', 'GL_RGBA32F'):
+g(['ext_framebuffer_multisample-{}'.format(test),
+   fmt],
+  '{} {}'.format(test, fmt))
+
 for sample_count in MSAA_SAMPLE_COUNTS:
 g(['ext_framebuffer_multisample-alpha-blending-after-rendering',
sample_count],
diff --git a/tests/spec/ext_framebuffer_multisample/blit-mismatched-formats.cpp 
b/tests/spec/ext_framebuffer_multisample/blit-mismatched-formats.cpp
index 3cfa5165d..30ed8f302 100644
--- a/tests/spec/ext_framebuffer_multisample/blit-mismatched-formats.cpp
+++ b/tests/spec/ext_framebuffer_multisample/blit-mismatched-formats.cpp
@@ -113,15 +113,14 @@ piglit_display()
GLfloat *expected_image;
GLuint i;
 
-   FboConfig config_ms(GL_RGBA, 1, pattern_width, pattern_height);
-
-   for(i = 0; i < ARRAY_SIZE(color_formats); i++) {
+   for (i = 0; i < ARRAY_SIZE(color_formats); i++) {
expected_image =
generate_expected_image(reference_image,
pattern_width, pattern_height,
color_formats[i].components);
 
-   config_ms.color_internalformat = color_formats[i].name;
+   FboConfig config_ms(color_formats[i].name, 1,
+   pattern_width, pattern_height);
src_fbo.setup(config_ms);
 
if (!piglit_check_gl_error(GL_NO_ERROR)) {
@@ -198,12 +197,24 @@ piglit_display()
free(expected_image);
}
 
-   return (pass ? PIGLIT_PASS : PIGLIT_FAIL);
+   return pass ? PIGLIT_PASS : PIGLIT_FAIL;
+}
+
+void
+print_usage_and_exit(char *prog_name)
+{
+   printf("Usage: %s \n", prog_name);
+   piglit_report_result(PIGLIT_FAIL);
 }
 
 void
 piglit_init(int argc, char **argv)
 {
+   if (argc < 2)
+   print_usage_and_exit(argv[0]);
+
+   GLenum color_internal_format = piglit_get_gl_enum_from_name(argv[1]);
+
piglit_require_gl_version(21);
piglit_require_extension("GL_ARB_framebuffer_object");
piglit_require_extension("GL_ARB_vertex_array_object");
@@ -211,18 +222,18 @@ piglit_init(int argc, char **argv)
/* Passing sample count = 1 will create the FBOs with minimum supported
 * sample count. Both FBOs are created with GL_RGBA format by default.
 */
-   src_fbo.setup(FboConfig(GL_RGBA, 1 /* sample count */,
+   src_fbo.setup(FboConfig(color_internal_format, 1 /* sample count */,
pattern_width,
pattern_height));
 
-   dst_fbo.setup(FboConfig(GL_RGBA, 1 /* sample count */,
+   dst_fbo.setup(FboConfig(color_internal_format, 1 /* sample count */,
pattern_width,
pattern_height));
 
/* Single-sampled FBO used so that we can call glReadPixels to
 * examine the results.
 */
-   ss_fbo.setup(FboConfig(GL_RGBA, 0 /* sample count */,
+   ss_fbo.setup(FboConfig(color_internal_format, 0 /* sample count */,
   pattern_width,
   pattern_height));
 
diff --git a/tests/spec/ext_framebuffer_multisample/blit-mismatched-samples.cpp 
b/tests/spec/ext_framebuffer_multisample/blit-mismatched-samples.cpp
index 09e82d60f..867c19bd9 100644
--- a/tests/spec/ext_framebuffer_multisample/blit-mismatched-samples.cpp
+++ 

[Piglit] [PATCH 17/17] ext_framebuffer_multisample: Use full value range for integer formats

2017-07-18 Thread Topi Pohjolainen
Signed-off-by: Topi Pohjolainen 
---
 .../draw-buffers-common.cpp| 39 --
 tests/util/sized-internalformats.h |  8 +
 2 files changed, 36 insertions(+), 11 deletions(-)

diff --git a/tests/spec/ext_framebuffer_multisample/draw-buffers-common.cpp 
b/tests/spec/ext_framebuffer_multisample/draw-buffers-common.cpp
index 7ca2e1d22..9c95af8a1 100644
--- a/tests/spec/ext_framebuffer_multisample/draw-buffers-common.cpp
+++ b/tests/spec/ext_framebuffer_multisample/draw-buffers-common.cpp
@@ -22,6 +22,7 @@
  */
 
 #include "draw-buffers-common.h"
+#include "sized-internalformats.h"
 using namespace piglit_util_fbo;
 
 /**
@@ -93,7 +94,6 @@ static bool is_dual_src_blending = false;
 static GLenum draw_buffer_zero_format;
 
 static const int num_components = 4; /* for RGBA formats */
-static const int num_color_bits = 8; /* for GL_RGBA & GL_RGBA8I formats */
 
 static const float bg_depth = 0.8;
 static const float bg_color[4] = {
@@ -303,11 +303,17 @@ free_data_arrays(void)
expected_color = NULL;
 }
 
-void
-float_color_to_int_color(int *dst, float *src)
+static void
+float_color_to_int_color(int *dst, const float *src)
 {
-   float offset = 1 - (1 << (num_color_bits - 1));
-   float scale = -2.0 * offset;
+   assert(is_buffer_zero_integer_format);
+
+   const GLenum format = resolve_int_fbo.config.color_internalformat;
+   const struct sized_internalformat *sized_fmt =
+get_sized_internalformat(format);
+   const unsigned num_color_bits = get_channel_size(sized_fmt, R);
+   const float offset = 1 - (1 << (num_color_bits - 1));
+   const float scale = -2.0 * offset;
 
for (int j = 0; j < num_rects; ++j) {
for (int k = 0; k < num_components; ++k) {
@@ -317,6 +323,22 @@ float_color_to_int_color(int *dst, float *src)
}
 }
 
+static void
+int_color_to_float_color(float *image, unsigned size)
+{
+   assert(is_buffer_zero_integer_format);
+
+   const GLenum format = resolve_int_fbo.config.color_internalformat;
+   const struct sized_internalformat *sized_fmt =
+get_sized_internalformat(format);
+   const unsigned num_color_bits = get_channel_size(sized_fmt, R);
+   const float color_offset = 1.0 - (1 << (num_color_bits - 1));
+   const float color_scale = -2.0 * color_offset;
+
+   for (unsigned i = 0; i < size; ++i)
+   image[i] = (image[i] - color_offset) / color_scale;
+}
+
 void
 draw_pattern(bool sample_alpha_to_coverage,
 bool sample_alpha_to_one,
@@ -732,13 +754,8 @@ draw_image_to_window_system_fb(int draw_buffer_count, bool 
rhs)
image[i] = tmp[i];
}
 
-   /* Convert integer color data to float color data */
-   float color_offset = 1.0 - (1 << (num_color_bits - 1));
-   float color_scale = -2.0 * color_offset;
+   int_color_to_float_color(image, array_size);
 
-   for (unsigned i = 0; i < array_size; ++i) {
-   image[i] = (image[i] - color_offset) / color_scale;
-   }
free(tmp);
}
else{
diff --git a/tests/util/sized-internalformats.h 
b/tests/util/sized-internalformats.h
index e71abf564..9416c29b5 100644
--- a/tests/util/sized-internalformats.h
+++ b/tests/util/sized-internalformats.h
@@ -20,6 +20,10 @@
  * IN THE SOFTWARE.
  */
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* F=float, UN=unsigned normalized, SN=signed normalized, I=int,
  * U=uint.
  *
@@ -116,3 +120,7 @@ valid_for_gl_version(const struct required_format *format, 
int target_version);
 void
 setup_required_size_test(int argc, char **argv,
 struct piglit_gl_test_config *config);
+
+#ifdef __cplusplus
+} /* end extern "C" */
+#endif
-- 
2.11.0

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


[Piglit] [PATCH 05/17] ext_framebuffer_multisample: more tests against GL_RGBA16F/32F

2017-07-18 Thread Topi Pohjolainen
Currently these are run only against GL_RGBA.

Two integer formattted tests:

int-draw-buffers-alpha-to-one and
int-draw-buffers-alpha-to-coverage

will be addressed in another patch while

alpha-to-coverage-no-draw-buffer-zero and
alpha-to-one-single-sample-buffer

are not that meaningful to run against multiple formats.

Signed-off-by: Topi Pohjolainen 
---
 tests/all.py| 13 +
 .../alpha-to-coverage-dual-src-blend.cpp|  9 ++---
 .../alpha-to-coverage-no-draw-buffer-zero-write.cpp |  9 ++---
 .../alpha-to-one-dual-src-blend.cpp |  9 ++---
 .../alpha-to-one-msaa-disabled.cpp  |  9 ++---
 tests/spec/ext_framebuffer_multisample/bitmap.cpp   | 10 +++---
 .../draw-buffers-alpha-to-coverage.cpp  |  9 ++---
 .../draw-buffers-alpha-to-one.cpp   |  9 ++---
 .../ext_framebuffer_multisample/draw-buffers-common.cpp |  4 +++-
 tests/spec/ext_framebuffer_multisample/line-smooth.cpp  |  9 ++---
 tests/spec/ext_framebuffer_multisample/point-smooth.cpp |  9 ++---
 tests/spec/ext_framebuffer_multisample/polygon-smooth.cpp   |  9 ++---
 tests/spec/ext_framebuffer_multisample/polygon-stipple.cpp  | 12 
 .../ext_framebuffer_multisample/sample-alpha-to-one.cpp |  9 ++---
 14 files changed, 87 insertions(+), 42 deletions(-)

diff --git a/tests/all.py b/tests/all.py
index e08cee978..98b78ea89 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -3049,14 +3049,19 @@ with profile.test_list.group_manager(
  'draw-buffers-alpha-to-one',
  'draw-buffers-alpha-to-coverage',
  'alpha-to-coverage-dual-src-blend',
- 'alpha-to-coverage-no-draw-buffer-zero',
  'alpha-to-coverage-no-draw-buffer-zero-write',
  'alpha-to-one-dual-src-blend',
- 'int-draw-buffers-alpha-to-one',
- 'int-draw-buffers-alpha-to-coverage',
  'alpha-to-one-msaa-disabled',
- 'alpha-to-one-single-sample-buffer',
  'bitmap', 'polygon-stipple']:
+for fmt in ('GL_RGBA', 'GL_RGBA16F', 'GL_RGBA32F'):
+   g(['ext_framebuffer_multisample-{}'.format(test),
+  sample_count, fmt],
+ '{} {} {}'.format(test, sample_count, fmt))
+
+for test in ['alpha-to-coverage-no-draw-buffer-zero',
+ 'int-draw-buffers-alpha-to-one',
+ 'int-draw-buffers-alpha-to-coverage',
+ 'alpha-to-one-single-sample-buffer']:
 g(['ext_framebuffer_multisample-{}'.format(test),
sample_count],
   '{} {}'.format(test, sample_count))
diff --git 
a/tests/spec/ext_framebuffer_multisample/alpha-to-coverage-dual-src-blend.cpp 
b/tests/spec/ext_framebuffer_multisample/alpha-to-coverage-dual-src-blend.cpp
index 777af0cc8..c363535f9 100644
--- 
a/tests/spec/ext_framebuffer_multisample/alpha-to-coverage-dual-src-blend.cpp
+++ 
b/tests/spec/ext_framebuffer_multisample/alpha-to-coverage-dual-src-blend.cpp
@@ -50,7 +50,7 @@ PIGLIT_GL_TEST_CONFIG_END
 void
 print_usage_and_exit(char *prog_name)
 {
-printf("Usage: %s \n", prog_name);
+printf("Usage: %s  \n", prog_name);
piglit_report_result(PIGLIT_FAIL);
 }
 
@@ -60,7 +60,7 @@ piglit_init(int argc, char **argv)
int samples;
const int num_attachments = 1;
 
-   if (argc < 2)
+   if (argc < 3)
print_usage_and_exit(argv[0]);
{
char *endptr = NULL;
@@ -69,6 +69,9 @@ piglit_init(int argc, char **argv)
print_usage_and_exit(argv[0]);
}
 
+   const GLenum color_internal_format =
+piglit_get_gl_enum_from_name(argv[2]);
+
piglit_require_gl_version(30);
 
int pattern_width = piglit_width / 2;
@@ -90,7 +93,7 @@ piglit_init(int argc, char **argv)
  pattern_height,
  num_attachments,
  GL_COLOR_BUFFER_BIT,
- GL_RGBA);
+ color_internal_format);
 
shader_compile(true /* sample_alpha_to_coverage */,
   true /* dual_src_blend */,
diff --git 
a/tests/spec/ext_framebuffer_multisample/alpha-to-coverage-no-draw-buffer-zero-write.cpp
 
b/tests/spec/ext_framebuffer_multisample/alpha-to-coverage-no-draw-buffer-zero-write.cpp
index 21c842eff..021b45e55 100644
--- 
a/tests/spec/ext_framebuffer_multisample/alpha-to-coverage-no-draw-buffer-zero-write.cpp
+++ 
b/tests/spec/ext_framebuffer_multisample/alpha-to-coverage-no-draw-buffer-zero-write.cpp
@@ -55,7 +55,7 @@ PIGLIT_GL_TEST_CONFIG_END
 void

[Piglit] [PATCH 13/17] ext_framebuffer_multisample: upsample also against RGBA16F/32F

2017-07-18 Thread Topi Pohjolainen
Signed-off-by: Topi Pohjolainen 
---
 .../spec/ext_framebuffer_multisample/upsample.cpp  | 35 ++
 1 file changed, 23 insertions(+), 12 deletions(-)

diff --git a/tests/spec/ext_framebuffer_multisample/upsample.cpp 
b/tests/spec/ext_framebuffer_multisample/upsample.cpp
index 5f1dc635f..16d7f3233 100644
--- a/tests/spec/ext_framebuffer_multisample/upsample.cpp
+++ b/tests/spec/ext_framebuffer_multisample/upsample.cpp
@@ -67,11 +67,11 @@ PIGLIT_GL_TEST_CONFIG_END
 
 const int pattern_width = 256; const int pattern_height = 256;
 
-Fbo multisample_fbo;
-TestPattern *test_pattern = NULL;
-ManifestProgram *manifest_program = NULL;
-GLbitfield buffer_to_test;
-GLenum filter_mode = GL_NEAREST;
+static TestPattern *test_pattern = NULL;
+static ManifestProgram *manifest_program = NULL;
+static GLbitfield buffer_to_test;
+static GLenum filter_mode = GL_NEAREST;
+static int num_samples;
 
 void
 print_usage_and_exit(char *prog_name)
@@ -90,7 +90,6 @@ print_usage_and_exit(char *prog_name)
 void
 piglit_init(int argc, char **argv)
 {
-   int num_samples;
if (argc < 3)
print_usage_and_exit(argv[0]);
{
@@ -135,15 +134,16 @@ piglit_init(int argc, char **argv)
test_pattern->compile();
if (manifest_program)
manifest_program->compile();
-
-   multisample_fbo.setup(FboConfig(GL_RGBA, num_samples, pattern_width,
-   pattern_height));
 }
 
-enum piglit_result
-piglit_display()
+static bool
+test_format(GLenum color_internal_format)
 {
bool pass = true;
+   Fbo multisample_fbo;
+
+   multisample_fbo.setup(FboConfig(color_internal_format, num_samples,
+   pattern_width, pattern_height));
 
/* Draw the full test pattern on the right half of the piglit
 * window, as a reference image.
@@ -204,7 +204,18 @@ piglit_display()
pass = piglit_probe_rect_halves_equal_rgba(0, 0, piglit_width,
   piglit_height) && pass;
 
-   pass = piglit_check_gl_error(GL_NO_ERROR) && pass;
+   return piglit_check_gl_error(GL_NO_ERROR) && pass;
+}
+
+enum piglit_result
+piglit_display()
+{
+   bool pass = test_format(GL_RGBA);
+
+   if (buffer_to_test == GL_COLOR_BUFFER_BIT) {
+pass &= test_format(GL_RGBA16F);
+pass &= test_format(GL_RGBA32F);
+   }
 
piglit_present_results();
 
-- 
2.11.0

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


[Piglit] [PATCH 10/17] ext_framebuffer_multisample: multiple-blit also against RGBA16F/32F

2017-07-18 Thread Topi Pohjolainen
Signed-off-by: Topi Pohjolainen 
---
 .../multisample-blit.cpp   | 32 ++
 1 file changed, 21 insertions(+), 11 deletions(-)

diff --git a/tests/spec/ext_framebuffer_multisample/multisample-blit.cpp 
b/tests/spec/ext_framebuffer_multisample/multisample-blit.cpp
index a9b58bf64..527e64ea6 100644
--- a/tests/spec/ext_framebuffer_multisample/multisample-blit.cpp
+++ b/tests/spec/ext_framebuffer_multisample/multisample-blit.cpp
@@ -51,12 +51,11 @@ PIGLIT_GL_TEST_CONFIG_END
 
 const int pattern_width = 256; const int pattern_height = 256;
 
-Fbo src_fbo;
-Fbo dst_fbo;
 TestPattern *test_pattern = NULL;
 ManifestProgram *manifest_program = NULL;
 GLbitfield buffer_to_test;
 GLenum filter_mode = GL_NEAREST;
+int num_samples;
 
 void
 print_usage_and_exit(char *prog_name)
@@ -75,7 +74,6 @@ print_usage_and_exit(char *prog_name)
 void
 piglit_init(int argc, char **argv)
 {
-   int num_samples;
if (argc < 3)
print_usage_and_exit(argv[0]);
{
@@ -120,17 +118,18 @@ piglit_init(int argc, char **argv)
test_pattern->compile();
if (manifest_program)
manifest_program->compile();
-
-   src_fbo.setup(FboConfig(GL_RGBA, num_samples,
-   pattern_width, pattern_height));
-   dst_fbo.setup(FboConfig(GL_RGBA, num_samples,
-   pattern_width, pattern_height));
 }
 
-enum piglit_result
-piglit_display()
+static bool
+test_format(GLenum color_internal_format)
 {
bool pass = true;
+   Fbo src_fbo, dst_fbo;
+
+   src_fbo.setup(FboConfig(color_internal_format, num_samples,
+   pattern_width, pattern_height));
+   dst_fbo.setup(FboConfig(color_internal_format, num_samples,
+   pattern_width, pattern_height));
 
/* Draw the test pattern in src_fbo. */
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, src_fbo.handle);
@@ -183,7 +182,18 @@ piglit_display()
pass = piglit_probe_rect_halves_equal_rgba(0, 0, piglit_width,
   piglit_height) && pass;
 
-   pass = piglit_check_gl_error(GL_NO_ERROR) && pass;
+   return piglit_check_gl_error(GL_NO_ERROR) && pass;
+}
+
+enum piglit_result
+piglit_display()
+{
+   bool pass = test_format(GL_RGBA);
+   
+   if (buffer_to_test == GL_COLOR_BUFFER_BIT) {
+   pass &= test_format(GL_RGBA16F);
+   pass &= test_format(GL_RGBA32F);
+}
 
piglit_present_results();
 
-- 
2.11.0

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


[Piglit] [PATCH 12/17] ext_framebuffer_multisample: unaligned-blit also against RGBA16F/32F

2017-07-18 Thread Topi Pohjolainen
Signed-off-by: Topi Pohjolainen 
---
 .../ext_framebuffer_multisample/unaligned-blit.cpp | 38 ++
 1 file changed, 24 insertions(+), 14 deletions(-)

diff --git a/tests/spec/ext_framebuffer_multisample/unaligned-blit.cpp 
b/tests/spec/ext_framebuffer_multisample/unaligned-blit.cpp
index 299eab097..57cac3b80 100644
--- a/tests/spec/ext_framebuffer_multisample/unaligned-blit.cpp
+++ b/tests/spec/ext_framebuffer_multisample/unaligned-blit.cpp
@@ -76,11 +76,10 @@ const int inverse_permutation[num_tiles] = {
3, 13, 19, 20, 7, 18, 10, 9
 };
 
-Fbo src_fbo;
-Fbo dst_fbo;
-TestPattern *test_pattern = NULL;
-ManifestProgram *manifest_program = NULL;
-GLbitfield buffer_to_test;
+static TestPattern *test_pattern = NULL;
+static ManifestProgram *manifest_program = NULL;
+static GLbitfield buffer_to_test;
+static unsigned src_samples, dst_samples;
 
 void
 scrambling_blit(const int *permutation)
@@ -118,8 +117,6 @@ void
 piglit_init(int argc, char **argv)
 {
int num_samples;
-   int src_samples;
-   int dst_samples;
if (argc < 4)
print_usage_and_exit(argv[0]);
 
@@ -168,16 +165,18 @@ piglit_init(int argc, char **argv)
test_pattern->compile();
if (manifest_program)
manifest_program->compile();
-   src_fbo.setup(FboConfig(GL_RGBA, src_samples,
-   pattern_size, pattern_size));
-   dst_fbo.setup(FboConfig(GL_RGBA, dst_samples,
-   pattern_size, pattern_size));
 }
 
-enum piglit_result
-piglit_display()
+static bool
+test_format(GLenum color_internal_format)
 {
bool pass = true;
+   Fbo src_fbo, dst_fbo;
+
+   src_fbo.setup(FboConfig(color_internal_format, src_samples,
+   pattern_size, pattern_size));
+   dst_fbo.setup(FboConfig(color_internal_format, dst_samples,
+   pattern_size, pattern_size));
 
/* Draw the test pattern in src_fbo. */
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, src_fbo.handle);
@@ -224,7 +223,18 @@ piglit_display()
pass = piglit_probe_rect_halves_equal_rgba(0, 0, piglit_width,
   piglit_height) && pass;
 
-   pass = piglit_check_gl_error(GL_NO_ERROR) && pass;
+   return piglit_check_gl_error(GL_NO_ERROR) && pass;
+}
+
+enum piglit_result
+piglit_display()
+{
+   bool pass = test_format(GL_RGBA);
+
+   if (buffer_to_test == GL_COLOR_BUFFER_BIT) {
+ pass &= test_format(GL_RGBA16F);
+ pass &= test_format(GL_RGBA32F);
+   }
 
piglit_present_results();
 
-- 
2.11.0

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


[Piglit] [PATCH 03/17] ext_framebuffer_multisample: Allow resolve fbos with different formats

2017-07-18 Thread Topi Pohjolainen
Signed-off-by: Topi Pohjolainen 
---
 .../draw-buffers-common.cpp| 22 ++
 1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/tests/spec/ext_framebuffer_multisample/draw-buffers-common.cpp 
b/tests/spec/ext_framebuffer_multisample/draw-buffers-common.cpp
index 8f0088c97..694931b6d 100644
--- a/tests/spec/ext_framebuffer_multisample/draw-buffers-common.cpp
+++ b/tests/spec/ext_framebuffer_multisample/draw-buffers-common.cpp
@@ -921,23 +921,29 @@ ms_fbo_and_draw_buffers_setup(int samples,
 */
FboConfig resolve_config(GL_RGBA, 0, pattern_width,
 num_draw_buffers * pattern_height);
-   resolve_fbo.setup(resolve_config);
 
-   /* Create resolve_int_fbo to store downsampled integer draw buffer */
+   /* Create resolve_int_fbo to store downsampled integer draw buffer.
+* It should be noted that integer formatted tests also write float
+* formatted attachments and therefore the default GL_RGBA resolve
+* framebuffer is needed in addition to the integer based.
+*/
if (color_buffer_zero_format == GL_RGBA8I) {
-   resolve_config.color_internalformat = GL_RGBA8I;
/* Assuming single integer buffer */
-   resolve_config.height = pattern_height;
-   resolve_int_fbo.setup(resolve_config);
+   resolve_int_fbo.setup(FboConfig(
+   color_buffer_zero_format, 0,
+   pattern_width, pattern_height));
is_buffer_zero_integer_format = true;
-   }
-   else if (color_buffer_zero_format != GL_RGBA &&
-color_buffer_zero_format != GL_NONE) {
+   } else if (color_buffer_zero_format == GL_RGBA) {
+   resolve_config.color_internalformat =
+   color_buffer_zero_format;
+   } else if (color_buffer_zero_format != GL_NONE) {
printf("Draw buffer zero format is not"
   " supported by test functions.\n");
piglit_report_result(PIGLIT_FAIL);
}
 
+   resolve_fbo.setup(resolve_config);
+
 if (!piglit_check_gl_error(GL_NO_ERROR)) {
printf("Error setting up frame buffer objects\n");
piglit_report_result(PIGLIT_FAIL);
-- 
2.11.0

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


[Piglit] [PATCH 04/17] ext_framebuffer_multisample: accuracy also against RGBA16F/32F

2017-07-18 Thread Topi Pohjolainen
Signed-off-by: Topi Pohjolainen 
---
 .../spec/ext_framebuffer_multisample/accuracy.cpp  | 29 +-
 tests/spec/ext_framebuffer_multisample/common.cpp  | 10 +---
 tests/spec/ext_framebuffer_multisample/common.h|  6 +++--
 .../ext_framebuffer_multisample/turn-on-off.cpp|  2 +-
 4 files changed, 35 insertions(+), 12 deletions(-)

diff --git a/tests/spec/ext_framebuffer_multisample/accuracy.cpp 
b/tests/spec/ext_framebuffer_multisample/accuracy.cpp
index c571771cb..7ad7281a7 100644
--- a/tests/spec/ext_framebuffer_multisample/accuracy.cpp
+++ b/tests/spec/ext_framebuffer_multisample/accuracy.cpp
@@ -62,7 +62,6 @@ bool small = false, combine_depth_stencil = false;
 bool all_samples = false;
 GLenum filter_mode = GL_NEAREST;
 test_type_enum test_type;
-Test *test = NULL;
 
 NORETURN void
 print_usage_and_exit(char *prog_name)
@@ -145,11 +144,29 @@ piglit_init(int argc, char **argv)
 bool
 test_create_and_execute()
 {
-   test = create_test(test_type, num_samples, small,
-  combine_depth_stencil,
-  pattern_width, pattern_height, supersample_factor,
-  filter_mode);
-   return test->run();
+   Test *test = create_test(test_type, num_samples, small,
+combine_depth_stencil,
+pattern_width, pattern_height,
+supersample_factor, filter_mode, GL_RGBA);
+   bool result = test->run();
+
+   if (test_type == TEST_TYPE_COLOR) {
+   test = create_test(test_type, num_samples, small,
+  combine_depth_stencil,
+  pattern_width, pattern_height,
+  supersample_factor,
+  filter_mode, GL_RGBA16F);
+   result &= test->run();
+
+   test = create_test(test_type, num_samples, small,
+  combine_depth_stencil,
+  pattern_width, pattern_height,
+  supersample_factor,
+  filter_mode, GL_RGBA32F);
+   result &= test->run();
+   }
+
+   return result;
 }
 
 enum piglit_result
diff --git a/tests/spec/ext_framebuffer_multisample/common.cpp 
b/tests/spec/ext_framebuffer_multisample/common.cpp
index f6e2d7421..93beb57a3 100644
--- a/tests/spec/ext_framebuffer_multisample/common.cpp
+++ b/tests/spec/ext_framebuffer_multisample/common.cpp
@@ -271,7 +271,7 @@ Test::Test(TestPattern *pattern, ManifestProgram 
*manifest_program,
 void
 Test::init(int num_samples, bool small, bool combine_depth_stencil,
   int pattern_width, int pattern_height, int supersample_factor,
-  GLenum filter_mode)
+  GLenum filter_mode, GLenum color_internal_format)
 {
this->num_samples = num_samples;
this->pattern_width = pattern_width;
@@ -284,6 +284,8 @@ Test::init(int num_samples, bool small, bool 
combine_depth_stencil,
  small ? 16 : pattern_height);
if (srgb)
test_fbo_config.color_internalformat = GL_SRGB8_ALPHA8;
+   else
+   test_fbo_config.color_internalformat = color_internal_format;
test_fbo_config.combine_depth_stencil = combine_depth_stencil;
test_fbo.setup(test_fbo_config);
 
@@ -603,7 +605,8 @@ Test::run()
 Test *
 create_test(test_type_enum test_type, int n_samples, bool small,
bool combine_depth_stencil, int pattern_width, int pattern_height,
-   int supersample_factor, GLenum filter_mode)
+   int supersample_factor, GLenum filter_mode,
+   GLenum color_internal_format)
 {
Test *test = NULL;
switch (test_type) {
@@ -642,6 +645,7 @@ create_test(test_type_enum test_type, int n_samples, bool 
small,
}
 
test->init(n_samples, small, combine_depth_stencil, pattern_width,
-  pattern_height, supersample_factor, filter_mode);
+  pattern_height, supersample_factor, filter_mode,
+  color_internal_format);
return test;
 }
diff --git a/tests/spec/ext_framebuffer_multisample/common.h 
b/tests/spec/ext_framebuffer_multisample/common.h
index 948a1d4a8..d4a0686e0 100644
--- a/tests/spec/ext_framebuffer_multisample/common.h
+++ b/tests/spec/ext_framebuffer_multisample/common.h
@@ -101,7 +101,8 @@ public:
 bool test_resolve, GLbitfield blit_type, bool srgb);
void init(int num_samples, bool small, bool combine_depth_stencil,
  int pattern_width, int pattern_height,
- int supersample_factor, GLenum filter_mode);
+ int supersample_factor, GLenum filter_mode,
+ GLenum color_internal_format);
bool run();
void draw_test_image(piglit_util_fbo::Fbo *fbo);
void 

[Piglit] [PATCH 02/17] ext_framebuffer_multisample: Clamp UNORM only to [0, 1.0]

2017-07-18 Thread Topi Pohjolainen
preparing for source blending with GL_RGBA16F and GL_RGBA32F.

Signed-off-by: Topi Pohjolainen 
---
 .../draw-buffers-common.cpp  | 20 +---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/tests/spec/ext_framebuffer_multisample/draw-buffers-common.cpp 
b/tests/spec/ext_framebuffer_multisample/draw-buffers-common.cpp
index 9f92abdd1..8f0088c97 100644
--- a/tests/spec/ext_framebuffer_multisample/draw-buffers-common.cpp
+++ b/tests/spec/ext_framebuffer_multisample/draw-buffers-common.cpp
@@ -443,8 +443,14 @@ compute_blend_color(float *frag_color, int rect_count,
bg_color[j] *
dst_blend_factor;
 
-   frag_color[rect_count * num_components + j] =
-   (blend_color > 1) ? 1.0 : blend_color;
+   /* Clamp to [0, 1.0] for UNORM */
+   if (resolve_fbo.config.color_internalformat == GL_RGBA) {
+   frag_color[rect_count * num_components + j] =
+   (blend_color > 1) ? 1.0 : blend_color;
+   } else {
+   frag_color[rect_count * num_components + j] =
+   blend_color;
+   }
}
 }
 
@@ -573,7 +579,15 @@ compute_expected(bool sample_alpha_to_coverage,
 * the fragment alpha values of draw buffer zero
 */
float frag_alpha = color[i * num_components + 3];
-   coverage[i] = (frag_alpha < 1.0) ? frag_alpha : 1.0;
+
+   /* Clamp to [0, 1.0] for UNORM */
+   if (resolve_fbo.config.color_internalformat ==
+   GL_RGBA) {
+   coverage[i] = (frag_alpha < 1.0) ?
+ frag_alpha : 1.0;
+   } else {
+   coverage[i] = frag_alpha;
+   }
}
}
else {
-- 
2.11.0

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


[Piglit] [PATCH 01/17] util/fbo: Provide color format to config constructor

2017-07-18 Thread Topi Pohjolainen
Signed-off-by: Topi Pohjolainen 
---
 .../arb_framebuffer_object/attachments-blit-scaled-linear.cpp | 2 +-
 tests/spec/arb_framebuffer_object/blit-scaled-linear.cpp  | 2 +-
 .../spec/arb_sample_shading/execution/builtin-gl-num-samples.cpp  | 5 +++--
 tests/spec/arb_sample_shading/execution/builtin-gl-sample-id.cpp  | 2 +-
 .../execution/builtin-gl-sample-mask-mrt-alpha.cpp| 2 +-
 .../execution/builtin-gl-sample-mask-simple.cpp   | 2 +-
 .../spec/arb_sample_shading/execution/builtin-gl-sample-mask.cpp  | 2 +-
 .../arb_sample_shading/execution/builtin-gl-sample-position.cpp   | 2 +-
 .../arb_sample_shading/execution/ignore-centroid-qualifier.cpp| 2 +-
 .../execution/interpolate-at-sample-position.cpp  | 2 +-
 tests/spec/ext_framebuffer_multisample/bitmap.cpp | 5 +++--
 tests/spec/ext_framebuffer_multisample/blit-flipped.cpp   | 4 ++--
 .../spec/ext_framebuffer_multisample/blit-mismatched-formats.cpp  | 8 
 .../spec/ext_framebuffer_multisample/blit-mismatched-samples.cpp  | 5 +++--
 tests/spec/ext_framebuffer_multisample/blit-mismatched-sizes.cpp  | 4 ++--
 .../ext_framebuffer_multisample/blit-multiple-render-targets.cpp  | 2 +-
 tests/spec/ext_framebuffer_multisample/clear.cpp  | 2 +-
 tests/spec/ext_framebuffer_multisample/clip-and-scissor-blit.cpp  | 6 --
 tests/spec/ext_framebuffer_multisample/common.cpp | 2 +-
 tests/spec/ext_framebuffer_multisample/draw-buffers-common.cpp| 7 +++
 tests/spec/ext_framebuffer_multisample/enable-flag.cpp| 4 ++--
 tests/spec/ext_framebuffer_multisample/formats.cpp| 7 ---
 tests/spec/ext_framebuffer_multisample/interpolation.cpp  | 4 ++--
 tests/spec/ext_framebuffer_multisample/line-smooth.cpp| 3 ++-
 tests/spec/ext_framebuffer_multisample/multisample-blit.cpp   | 6 --
 tests/spec/ext_framebuffer_multisample/no-color.cpp   | 5 +++--
 tests/spec/ext_framebuffer_multisample/point-smooth.cpp   | 3 ++-
 tests/spec/ext_framebuffer_multisample/polygon-smooth.cpp | 3 ++-
 tests/spec/ext_framebuffer_multisample/polygon-stipple.cpp| 5 +++--
 tests/spec/ext_framebuffer_multisample/sample-coverage.cpp| 5 +++--
 tests/spec/ext_framebuffer_multisample/unaligned-blit.cpp | 6 --
 tests/spec/ext_framebuffer_multisample/upsample.cpp   | 2 +-
 .../spec/ext_framebuffer_multisample_blit_scaled/blit-scaled.cpp  | 4 ++--
 .../negative-blit-scaled.cpp  | 2 +-
 tests/util/piglit-fbo.cpp | 7 ---
 tests/util/piglit-fbo.h   | 3 ++-
 36 files changed, 77 insertions(+), 60 deletions(-)

diff --git 
a/tests/spec/arb_framebuffer_object/attachments-blit-scaled-linear.cpp 
b/tests/spec/arb_framebuffer_object/attachments-blit-scaled-linear.cpp
index 23e1f60cc..fb2fc1f1d 100644
--- a/tests/spec/arb_framebuffer_object/attachments-blit-scaled-linear.cpp
+++ b/tests/spec/arb_framebuffer_object/attachments-blit-scaled-linear.cpp
@@ -61,7 +61,7 @@ piglit_init(int argc, char **argv)
/* Create two singlesample FBOs with same format and dimensions but
 * different color attachment types.
 */
-   FboConfig Config(0, pattern_width, pattern_height);
+   FboConfig Config(GL_RGBA, 0, pattern_width, pattern_height);
fbo_rb.setup(Config);
Config.num_rb_attachments = 0;
Config.num_tex_attachments = 1;
diff --git a/tests/spec/arb_framebuffer_object/blit-scaled-linear.cpp 
b/tests/spec/arb_framebuffer_object/blit-scaled-linear.cpp
index 5cf6a4906..81678bbf4 100644
--- a/tests/spec/arb_framebuffer_object/blit-scaled-linear.cpp
+++ b/tests/spec/arb_framebuffer_object/blit-scaled-linear.cpp
@@ -187,7 +187,7 @@ piglit_init(int argc, char **argv)
/* Create two singlesample FBOs with same format and dimensions but
 * different color attachment types.
 */
-   FboConfig Config(0, pattern_width / 2, pattern_height / 2);
+   FboConfig Config(GL_RGBA, 0, pattern_width / 2, pattern_height / 2);
fbo_rb.setup(Config);
Config.num_rb_attachments = 0;
Config.num_tex_attachments = 1;
diff --git a/tests/spec/arb_sample_shading/execution/builtin-gl-num-samples.cpp 
b/tests/spec/arb_sample_shading/execution/builtin-gl-num-samples.cpp
index 52965bf47..02ceae18d 100644
--- a/tests/spec/arb_sample_shading/execution/builtin-gl-num-samples.cpp
+++ b/tests/spec/arb_sample_shading/execution/builtin-gl-num-samples.cpp
@@ -106,11 +106,12 @@ piglit_init(int argc, char **argv)
if (num_samples > max_samples)
piglit_report_result(PIGLIT_SKIP);
 
-   singlesampled_fbo.setup(FboConfig(0,
+   singlesampled_fbo.setup(FboConfig(GL_RGBA, 0,
  pattern_width,
 

Re: [Piglit] [PATCH] tests/util: remove unneeded cmake code for WGL

2017-07-18 Thread Jose Fonseca

On 18/07/17 16:18, Brian Paul wrote:

GLPROTO_INCLUDE_DIRS are not needed for WGL.  Spotted by Jose.
---
  tests/util/CMakeLists.gl.txt | 6 --
  1 file changed, 6 deletions(-)

diff --git a/tests/util/CMakeLists.gl.txt b/tests/util/CMakeLists.gl.txt
index e11213a..4a9cb67 100644
--- a/tests/util/CMakeLists.gl.txt
+++ b/tests/util/CMakeLists.gl.txt
@@ -34,12 +34,6 @@ IF(PIGLIT_BUILD_GLX_TESTS)
  ENDIF(PIGLIT_BUILD_GLX_TESTS)
  
  IF(PIGLIT_BUILD_WGL_TESTS)

-   # XXX: This is currently duplicated wherever tests
-   # include "piglit-wgl-util.h". Is it possible to refactor it?
-   include_directories(
-   ${GLPROTO_INCLUDE_DIRS}
-   )
-
add_definitions ( -DPIGLIT_USE_WGL )
piglit_add_library (piglitwglutil
piglit-shader.c



Reviewed-by: Jose Fonseca 
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH] tests/util: remove unneeded cmake code for WGL

2017-07-18 Thread Brian Paul
GLPROTO_INCLUDE_DIRS are not needed for WGL.  Spotted by Jose.
---
 tests/util/CMakeLists.gl.txt | 6 --
 1 file changed, 6 deletions(-)

diff --git a/tests/util/CMakeLists.gl.txt b/tests/util/CMakeLists.gl.txt
index e11213a..4a9cb67 100644
--- a/tests/util/CMakeLists.gl.txt
+++ b/tests/util/CMakeLists.gl.txt
@@ -34,12 +34,6 @@ IF(PIGLIT_BUILD_GLX_TESTS)
 ENDIF(PIGLIT_BUILD_GLX_TESTS)
 
 IF(PIGLIT_BUILD_WGL_TESTS)
-   # XXX: This is currently duplicated wherever tests
-   # include "piglit-wgl-util.h". Is it possible to refactor it?
-   include_directories(
-   ${GLPROTO_INCLUDE_DIRS}
-   )
-
add_definitions ( -DPIGLIT_USE_WGL )
piglit_add_library (piglitwglutil
piglit-shader.c
-- 
1.9.1

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


Re: [Piglit] [PATCH] wgl: initial check-in of wgl utility code and wgl sanity check program

2017-07-18 Thread Brian Paul

On 07/18/2017 01:06 AM, Jose Fonseca wrote:

On 11/07/17 17:06, Brian Paul wrote:

Like the glx tests/utility code, but for wgl.

Note, one must set the PIGLIT_PLATFORM env var to "wgl" before running
Piglit.  It looks like there's some Waffle work to look at before this
can be made automatic.
---
  CMakeLists.txt   |   7 ++
  framework/core.py|   2 +-
  tests/CMakeLists.txt |   1 +
  tests/all.py |   5 ++
  tests/util/CMakeLists.gl.txt |  25 ++
  tests/util/piglit-wgl-util.c | 190
+++
  tests/util/piglit-wgl-util.h |  41 ++
  tests/wgl/CMakeLists.gl.txt  |  27 ++
  tests/wgl/CMakeLists.txt |   1 +
  tests/wgl/wgl-sanity.c   |  88 
  10 files changed, 386 insertions(+), 1 deletion(-)
  create mode 100644 tests/util/piglit-wgl-util.c
  create mode 100644 tests/util/piglit-wgl-util.h
  create mode 100644 tests/wgl/CMakeLists.gl.txt
  create mode 100644 tests/wgl/CMakeLists.txt
  create mode 100644 tests/wgl/wgl-sanity.c

diff --git a/CMakeLists.txt b/CMakeLists.txt
index cc26fa8..d560bcc 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -179,6 +179,13 @@ ELSE()
  option(PIGLIT_BUILD_GLX_TESTS "Build tests that require GLX" OFF)
  ENDIF()
+IF(PIGLIT_HAS_WGL)
+option(PIGLIT_BUILD_WGL_TESTS "Build tests that require WGL" ON)
+ELSE()
+option(PIGLIT_BUILD_WGL_TESTS "Build tests that require WGL" OFF)
+ENDIF()
+
+
  # Choose to build tests that use dma_buf.
  #
  # Piglit's dma_buf utilities require xcb-dri2 to gain DRM
authentication.
diff --git a/framework/core.py b/framework/core.py
index c2de5d0..9abc128 100644
--- a/framework/core.py
+++ b/framework/core.py
@@ -44,7 +44,7 @@ __all__ = [
  'parse_listfile',
  ]
-PLATFORMS = ["glx", "x11_egl", "wayland", "gbm", "mixed_glx_egl"]
+PLATFORMS = ["glx", "x11_egl", "wayland", "gbm", "mixed_glx_egl", "wgl"]
  class PiglitConfig(configparser.SafeConfigParser):
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 7aab33f..ae50d0a 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -17,6 +17,7 @@ add_subdirectory (texturing)
  add_subdirectory (spec)
  add_subdirectory (fast_color_clear)
  add_subdirectory (perf)
+add_subdirectory (wgl)
  if (NOT APPLE)
  # glean relies on AGL which is deprecated/broken on recent Mac OS X
diff --git a/tests/all.py b/tests/all.py
index 4959789..f98b703 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -835,6 +835,11 @@ with profile.test_list.group_manager(
  g(['glx-query-renderer-coverage'], 'coverage')
  with profile.test_list.group_manager(
+PiglitGLTest, 'wgl',
+require_platforms=['wgl']) as g:
+g(['wgl-sanity'])
+
+with profile.test_list.group_manager(
  PiglitGLTest,
  grouptools.join('spec', '!opengl 1.1')) as g:
  g(['copyteximage', '1D'], run_concurrent=False)
diff --git a/tests/util/CMakeLists.gl.txt b/tests/util/CMakeLists.gl.txt
index a01fce3..e11213a 100644
--- a/tests/util/CMakeLists.gl.txt
+++ b/tests/util/CMakeLists.gl.txt
@@ -33,6 +33,31 @@ IF(PIGLIT_BUILD_GLX_TESTS)
  )
  ENDIF(PIGLIT_BUILD_GLX_TESTS)
+IF(PIGLIT_BUILD_WGL_TESTS)
+# XXX: This is currently duplicated wherever tests
+# include "piglit-wgl-util.h". Is it possible to refactor it?
+include_directories(
+${GLPROTO_INCLUDE_DIRS}
+)


There are two possible solutions: -

- add GLPROTO_INCLUDE_DIRS include dir globally, assuming it doesn't
cause interference

- use target_include_directories(piglitwglutil ${GLPROTO_INCLUDE_DIRS})
instead of include_directories(), which in theory should make any
dependent target that links against piglitwglutil automatically include
this include.

But is this really needed for WGL?  Aren't these X11 proto headers?


It looks like I can remove that part entirely.  I copied and pasted too 
much.  Patch coming...


-Brian

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


Re: [Piglit] [PATCH] wgl: initial check-in of wgl utility code and wgl sanity check program

2017-07-18 Thread Jose Fonseca

On 11/07/17 17:06, Brian Paul wrote:

Like the glx tests/utility code, but for wgl.

Note, one must set the PIGLIT_PLATFORM env var to "wgl" before running
Piglit.  It looks like there's some Waffle work to look at before this
can be made automatic.
---
  CMakeLists.txt   |   7 ++
  framework/core.py|   2 +-
  tests/CMakeLists.txt |   1 +
  tests/all.py |   5 ++
  tests/util/CMakeLists.gl.txt |  25 ++
  tests/util/piglit-wgl-util.c | 190 +++
  tests/util/piglit-wgl-util.h |  41 ++
  tests/wgl/CMakeLists.gl.txt  |  27 ++
  tests/wgl/CMakeLists.txt |   1 +
  tests/wgl/wgl-sanity.c   |  88 
  10 files changed, 386 insertions(+), 1 deletion(-)
  create mode 100644 tests/util/piglit-wgl-util.c
  create mode 100644 tests/util/piglit-wgl-util.h
  create mode 100644 tests/wgl/CMakeLists.gl.txt
  create mode 100644 tests/wgl/CMakeLists.txt
  create mode 100644 tests/wgl/wgl-sanity.c

diff --git a/CMakeLists.txt b/CMakeLists.txt
index cc26fa8..d560bcc 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -179,6 +179,13 @@ ELSE()
option(PIGLIT_BUILD_GLX_TESTS "Build tests that require GLX" OFF)
  ENDIF()
  
+IF(PIGLIT_HAS_WGL)

+   option(PIGLIT_BUILD_WGL_TESTS "Build tests that require WGL" ON)
+ELSE()
+   option(PIGLIT_BUILD_WGL_TESTS "Build tests that require WGL" OFF)
+ENDIF()
+
+
  # Choose to build tests that use dma_buf.
  #
  # Piglit's dma_buf utilities require xcb-dri2 to gain DRM authentication.
diff --git a/framework/core.py b/framework/core.py
index c2de5d0..9abc128 100644
--- a/framework/core.py
+++ b/framework/core.py
@@ -44,7 +44,7 @@ __all__ = [
  'parse_listfile',
  ]
  
-PLATFORMS = ["glx", "x11_egl", "wayland", "gbm", "mixed_glx_egl"]

+PLATFORMS = ["glx", "x11_egl", "wayland", "gbm", "mixed_glx_egl", "wgl"]
  
  
  class PiglitConfig(configparser.SafeConfigParser):

diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 7aab33f..ae50d0a 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -17,6 +17,7 @@ add_subdirectory (texturing)
  add_subdirectory (spec)
  add_subdirectory (fast_color_clear)
  add_subdirectory (perf)
+add_subdirectory (wgl)
  
  if (NOT APPLE)

# glean relies on AGL which is deprecated/broken on recent Mac OS X
diff --git a/tests/all.py b/tests/all.py
index 4959789..f98b703 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -835,6 +835,11 @@ with profile.test_list.group_manager(
  g(['glx-query-renderer-coverage'], 'coverage')
  
  with profile.test_list.group_manager(

+PiglitGLTest, 'wgl',
+require_platforms=['wgl']) as g:
+g(['wgl-sanity'])
+
+with profile.test_list.group_manager(
  PiglitGLTest,
  grouptools.join('spec', '!opengl 1.1')) as g:
  g(['copyteximage', '1D'], run_concurrent=False)
diff --git a/tests/util/CMakeLists.gl.txt b/tests/util/CMakeLists.gl.txt
index a01fce3..e11213a 100644
--- a/tests/util/CMakeLists.gl.txt
+++ b/tests/util/CMakeLists.gl.txt
@@ -33,6 +33,31 @@ IF(PIGLIT_BUILD_GLX_TESTS)
)
  ENDIF(PIGLIT_BUILD_GLX_TESTS)
  
+IF(PIGLIT_BUILD_WGL_TESTS)

+   # XXX: This is currently duplicated wherever tests
+   # include "piglit-wgl-util.h". Is it possible to refactor it?
+   include_directories(
+   ${GLPROTO_INCLUDE_DIRS}
+   )


There are two possible solutions: -

- add GLPROTO_INCLUDE_DIRS include dir globally, assuming it doesn't 
cause interference


- use target_include_directories(piglitwglutil ${GLPROTO_INCLUDE_DIRS}) 
instead of include_directories(), which in theory should make any 
dependent target that links against piglitwglutil automatically include 
this include.


But is this really needed for WGL?  Aren't these X11 proto headers?



+
+   add_definitions ( -DPIGLIT_USE_WGL )
+   piglit_add_library (piglitwglutil
+   piglit-shader.c
+   piglit-util-gl.c
+   piglit-wgl-util.c
+   piglit-dispatch.c
+   piglit-dispatch-init.c
+   ${piglit_dispatch_gen_output_dir}/piglit-util-gl-enum-gen.c
+   )
+   target_link_libraries(piglitwglutil
+   piglitutil_${piglit_target_api}
+   )
+   set (UTIL_GL_SOURCES
+   ${UTIL_GL_SOURCES}
+   piglit-wgl-util.c
+   )
+ENDIF(PIGLIT_BUILD_WGL_TESTS)
+
  piglit_add_library (piglitutil_${piglit_target_api}
${UTIL_GL_SOURCES}
  )
diff --git a/tests/util/piglit-wgl-util.c b/tests/util/piglit-wgl-util.c
new file mode 100644
index 000..80f0f52
--- /dev/null
+++ b/tests/util/piglit-wgl-util.c
@@ -0,0 +1,190 @@
+/*
+ * Copyright © 2017 VMware, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the