Re: [Piglit] [PATCH] arb_gpu_shader_int64: Test extracting individual bytes from 64-bit values

2019-02-28 Thread Matt Turner
Thanks Ian.

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

[Piglit] [PATCH] arb_gpu_shader_int64: Test extracting individual bytes from 64-bit values

2019-02-28 Thread Ian Romanick
From: Ian Romanick 

In Mesa, NIR has an optimization that will convert certain patterns into
instructions that extract an individual byte from a larger integer.
When extracting from a 64-bit value, the i965 compiler backend has some
bugs emitting these instructions.  These tests try to reproduce these
problems, but only fs-ushr-and-mask.shader_test is able to trigger the
failure.

The optimization is not (yet) able to recognize the patterns from the
other tests to generate the mishandled instructions.  With those
patterns added, all of these tests either fail or hit the assertion:

src/intel/compiler/brw_ir_fs.h:295: fs_reg subscript(fs_reg, brw_reg_type, 
unsigned int): Assertion `(i + 1) * type_sz(type) <= type_sz(reg.type)' failed.

Cc: Matt Turner 
Cc: Jason Ekstrand 
---
 .../execution/fs-ishl-then-ishr-loop.shader_test   | 55 +
 .../execution/fs-ishl-then-ishr.shader_test| 89 ++
 .../execution/fs-ishl-then-ushr-loop.shader_test   | 55 +
 .../execution/fs-ishl-then-ushr.shader_test| 89 ++
 .../execution/fs-ishr-and-mask-loop.shader_test| 55 +
 .../execution/fs-ishr-and-mask.shader_test | 89 ++
 .../execution/fs-ushr-and-mask-loop.shader_test| 56 ++
 .../execution/fs-ushr-and-mask.shader_test | 89 ++
 8 files changed, 577 insertions(+)
 create mode 100644 
tests/spec/arb_gpu_shader_int64/execution/fs-ishl-then-ishr-loop.shader_test
 create mode 100644 
tests/spec/arb_gpu_shader_int64/execution/fs-ishl-then-ishr.shader_test
 create mode 100644 
tests/spec/arb_gpu_shader_int64/execution/fs-ishl-then-ushr-loop.shader_test
 create mode 100644 
tests/spec/arb_gpu_shader_int64/execution/fs-ishl-then-ushr.shader_test
 create mode 100644 
tests/spec/arb_gpu_shader_int64/execution/fs-ishr-and-mask-loop.shader_test
 create mode 100644 
tests/spec/arb_gpu_shader_int64/execution/fs-ishr-and-mask.shader_test
 create mode 100644 
tests/spec/arb_gpu_shader_int64/execution/fs-ushr-and-mask-loop.shader_test
 create mode 100644 
tests/spec/arb_gpu_shader_int64/execution/fs-ushr-and-mask.shader_test

diff --git 
a/tests/spec/arb_gpu_shader_int64/execution/fs-ishl-then-ishr-loop.shader_test 
b/tests/spec/arb_gpu_shader_int64/execution/fs-ishl-then-ishr-loop.shader_test
new file mode 100644
index 0..4eacc615b
--- /dev/null
+++ 
b/tests/spec/arb_gpu_shader_int64/execution/fs-ishl-then-ishr-loop.shader_test
@@ -0,0 +1,55 @@
+[require]
+GL >= 4.0
+GLSL >= 4.00
+GL_ARB_gpu_shader_int64
+
+[vertex shader passthrough]
+
+[fragment shader]
+#version 400
+#extension GL_ARB_gpu_shader_int64 : require
+
+uniform int64_t ival[] = int64_t[](0xBADDC0DEDEADBEEFl,
+  0xDEADBEA7BA5EBA11l,
+  0xF0F1F2F3F4F5F6F7l,
+  0x0F1F2F3F4F5F6F7Fl,
+  0x7071727374757677l,
+  0x0717273747576777l,
+  0x1F2E3D4C5B6A7988l,
+  0xBADB100DDEADC0DEl);
+
+const int64_t expected[] = int64_t[](0xFFEFl,
+0xFFBAl,
+0xFFF5l,
+0x004Fl,
+0x0073l,
+0x0027l,
+0x002El,
+0xFFBAl);
+
+out vec4 piglit_fragcolor;
+
+void main()
+{
+   uint fail_mask = 0;
+
+   for (uint i = 0; i < uint(ival.length()); i++) {
+   uint64_t result = (ival[i] << (56u - (i * 8u))) >> 56u;
+   fail_mask |= result != expected[i] ? 1u << i : 0u;
+   }
+
+   /* Construct a clever color so that just looking at the "Observed:"
+* output from shader_runner will tell you exactly which values did
+* not match.
+*/
+   piglit_fragcolor = fail_mask == 0
+   ? vec4(0.0, 1.0, 0.0, 1.0)
+   : vec4(float(fail_mask) / 255.0, 0.0, 0.0, 1.0);
+}
+
+[test]
+clear color 0.5 0.5 0.5 0.5
+clear
+
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git 
a/tests/spec/arb_gpu_shader_int64/execution/fs-ishl-then-ishr.shader_test 
b/tests/spec/arb_gpu_shader_int64/execution/fs-ishl-then-ishr.shader_test
new file mode 100644
index 0..f6a6ba542
--- /dev/null
+++ b/tests/spec/arb_gpu_shader_int64/execution/fs-ishl-then-ishr.shader_test
@@ -0,0 +1,89 @@
+[require]
+GL >= 4.0
+GLSL >= 4.00
+GL_ARB_gpu_shader_int64
+
+[vertex shader passthrough]
+
+[fragment shader]
+#version 400
+#extension GL_ARB_gpu_shader_int64 : require
+
+uniform int64_t ival[] = int64_t[](0xBADDC0DEDEADBEEFl,
+  0xDEADBEA7BA5EBA11l,
+  

[Piglit] [PATCH v3] fbo-blit-check-limits: New test

2019-02-28 Thread Sergii Romantsov
From: Vadym Shovkoplias 

This test checks max possible blit buffers sizes

v2: copyright updated

v3: test scope extended: different bounds of blitting
are tested now.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=108088
CC: Lionel G Landwerlin 
CC: Jason Ekstrand 
Signed-off-by: Vadym Shovkoplias 
Signed-off-by: Sergii Romantsov 
---
 tests/fbo/CMakeLists.gl.txt   |   1 +
 tests/fbo/fbo-blit-check-limits.c | 309 ++
 tests/opengl.py   |   1 +
 3 files changed, 311 insertions(+)
 create mode 100644 tests/fbo/fbo-blit-check-limits.c

diff --git a/tests/fbo/CMakeLists.gl.txt b/tests/fbo/CMakeLists.gl.txt
index 1a1a607..e2c7b3a 100644
--- a/tests/fbo/CMakeLists.gl.txt
+++ b/tests/fbo/CMakeLists.gl.txt
@@ -91,6 +91,7 @@ piglit_add_executable (fbo-storage-formats 
fbo-storage-formats.c)
 piglit_add_executable (fbo-storage-completeness fbo-storage-completeness.c)
 piglit_add_executable (fbo-sys-blit fbo-sys-blit.c)
 piglit_add_executable (fbo-sys-sub-blit fbo-sys-sub-blit.c)
+piglit_add_executable (fbo-blit-check-limits fbo-blit-check-limits.c)
 piglit_add_executable (fbo-tex-rgbx fbo-tex-rgbx.c)
 piglit_add_executable (fbo-pbo-readpixels-small fbo-pbo-readpixels-small.c)
 piglit_add_executable (fbo-copyteximage fbo-copyteximage.c)
diff --git a/tests/fbo/fbo-blit-check-limits.c 
b/tests/fbo/fbo-blit-check-limits.c
new file mode 100644
index 000..b58c168
--- /dev/null
+++ b/tests/fbo/fbo-blit-check-limits.c
@@ -0,0 +1,309 @@
+/*
+ * Copyright (C) 2018 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.
+ *
+ */
+
+/** @file fbo-blit-check-limits.c
+ *
+ * Test FBO blits with MAX possible buffer sizes
+ * Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=108088
+ *
+ * \author Vadym Shovkoplias 
+ * \author Sergii Romantsov 
+ */
+
+#include "piglit-util-gl.h"
+
+#define FB_SIZE 160
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+   config.supports_gl_compat_version = 10;
+
+   config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGB;
+   config.requires_displayed_window = true;
+   config.khr_no_error_support = PIGLIT_NO_ERRORS;
+   config.window_width = FB_SIZE;
+   config.window_height = FB_SIZE;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+
+typedef struct _rgba {
+   float r;
+   float g;
+   float b;
+   float a;
+} rgba;
+
+// Yellow - back buffer left side color
+#define BACK1_R 1.0f
+#define BACK1_G 1.0f
+#define BACK1_B 0.0f
+static const rgba BACK1 = { BACK1_R, BACK1_G, BACK1_B, 1.0f };
+
+// Green - back buffer right side color
+#define BACK2_R 0.0f
+#define BACK2_G 1.0f
+#define BACK2_B 0.0f
+static const rgba BACK2 = { BACK2_R, BACK2_G, BACK2_B, 1.0f };
+
+// Red - front buffer color
+#define FRONT_R 1.0f
+#define FRONT_G 0.0f
+#define FRONT_B 0.0f
+static const rgba FRONT = { FRONT_R, FRONT_G, FRONT_B, 1.0f };
+
+// Black - blit from invalid region
+#define BLACK_R 0.0f
+#define BLACK_G 0.0f
+#define BLACK_B 0.0f
+
+typedef struct _fb_data {
+   int read;
+   int write;
+   rgba color_lb;
+   rgba color_lt;
+   rgba color_right;
+} fb_data;
+
+
+const fb_data fb_params[] = {
+   { .read = 0, .write = 0,
+   .color_lb  = { FRONT_R, FRONT_G, FRONT_B, 1.0f },
+   .color_lt  = { FRONT_R, FRONT_G, FRONT_B, 1.0f },
+   .color_right = { FRONT_R, FRONT_G, FRONT_B, 1.0f },
+   },
+   { .read = 0, .write = FB_SIZE,
+   .color_lb  = { FRONT_R, FRONT_G, FRONT_B, 1.0f },
+   .color_lt  = { FRONT_R, FRONT_G, FRONT_B, 1.0f },
+   .color_right = { FRONT_R, FRONT_G, FRONT_B, 1.0f },
+   },
+   { .read = 0, .write = FB_SIZE << 1,
+   .color_lb  = { FRONT_R, FRONT_G, FRONT_B, 1.0f },
+   .color_lt  = { FRONT_R, FRONT_G, FRONT_B, 1.0f },
+   .color_right = { FRONT_R, FRONT_G, FRONT_B, 1.0f },
+