[Piglit] [PATCH 06/20] Move r300-readcache test from bugs to spec dir.
Fabian Bieler
fabianbieler at fastmail.fm
Sat Dec 16 19:21:06 UTC 2017
Now it's called "read-cache-stress-test".
Moved from opengl 1.1 to opengl 1.0 profile in all.py.
---
tests/all.py | 2 +-
tests/bugs/CMakeLists.gl.txt | 1 -
tests/bugs/r300-readcache.c | 86 -----------------------
tests/spec/gl-1.0/CMakeLists.gl.txt | 1 +
tests/spec/gl-1.0/read-cache-stress-test.c | 109 +++++++++++++++++++++++++++++
5 files changed, 111 insertions(+), 88 deletions(-)
delete mode 100644 tests/bugs/r300-readcache.c
create mode 100644 tests/spec/gl-1.0/read-cache-stress-test.c
diff --git a/tests/all.py b/tests/all.py
index b7756b8..b441feb 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -734,6 +734,7 @@ with profile.test_list.group_manager(
g(['gl-1.0-fpexceptions'])
g(['gl-1.0-ortho-pos'])
g(['gl-1.0-rastercolor'])
+ g(['gl-1.0-read-cache-stress-test'])
g(['gl-1.0-readpixsanity'])
g(['gl-1.0-logicop'])
g(['gl-1.0-no-op-paths'])
@@ -763,7 +764,6 @@ with profile.test_list.group_manager(
g(['fdo23489'])
g(['fdo23670-depth_test'])
g(['fdo23670-drawpix_stencil'])
- g(['r300-readcache'])
g(['tri-tex-crash'])
g(['vbo-buffer-unmap'])
g(['array-stride'])
diff --git a/tests/bugs/CMakeLists.gl.txt b/tests/bugs/CMakeLists.gl.txt
index 5a50248..96c61b4 100644
--- a/tests/bugs/CMakeLists.gl.txt
+++ b/tests/bugs/CMakeLists.gl.txt
@@ -10,7 +10,6 @@ link_libraries (
${OPENGL_gl_LIBRARY}
)
-piglit_add_executable (r300-readcache r300-readcache.c)
piglit_add_executable (tex1d-2dborder tex1d-2dborder.c)
piglit_add_executable (fdo20701 fdo20701.c)
piglit_add_executable (point-sprite point-sprite.c)
diff --git a/tests/bugs/r300-readcache.c b/tests/bugs/r300-readcache.c
deleted file mode 100644
index 548cd51..0000000
--- a/tests/bugs/r300-readcache.c
+++ /dev/null
@@ -1,86 +0,0 @@
-/**
- * @file r300-readcache.c
- *
- * Test case for an odd problem in Radeon on-chip readcache.
- *
- * Basically, on some particular access patterns, the read cache misses the
- * fact that the framebuffer has changed, and a glReadPixels returns stale
- * data.
- *
- * The test works by repeatedly rendering a square in different colors,
- * and testing after each run that a number of pixel locations return the
- * right color.
- *
- * @note By the nature of the test, it makes no sense to have a demo mode,
- * so this test is always automatic.
- */
-
-#include "piglit-util-gl.h"
-
-PIGLIT_GL_TEST_CONFIG_BEGIN
-
- config.supports_gl_compat_version = 10;
-
- config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGB;
- config.khr_no_error_support = PIGLIT_NO_ERRORS;
-
-PIGLIT_GL_TEST_CONFIG_END
-
-static GLfloat colors[8][3] = {
- { 1.0, 1.0, 1.0 },
- { 1.0, 0.0, 0.0 },
- { 0.0, 1.0, 0.0 },
- { 0.0, 0.0, 1.0 },
- { 0.5, 0.0, 0.0 },
- { 0.0, 0.5, 0.0 },
- { 0.0, 0.0, 0.5 },
- { 0.0, 0.0, 0.0 }
-};
-
-enum piglit_result piglit_display(void)
-{
- int x, y, color, i, comp;
- /* x and y range chosen to cover a wide range of memory;
- * Actually, only the x coordinate should matter, but who knows... */
- for(y = 0; y < 8; ++y) {
- for(x = 0; x < 32; ++x) {
- for(color = 0; color < 8; ++color) {
- glColor3fv(colors[color]);
- glBegin(GL_QUADS);
- glVertex2f(-1, -1);
- glVertex2f( 1, -1);
- glVertex2f( 1, 1);
- glVertex2f(-1, 1);
- glEnd();
-
- for(i = 0; i < 2; ++i) {
- GLfloat result[3];
- glReadPixels(x + (i ^ ((color/2)&1))*10, y,
- 1, 1, GL_RGB, GL_FLOAT, result);
-
- for(comp = 0; comp < 3; ++comp) {
- if (fabs(colors[color][comp] - result[comp]) > 0.01) {
- printf("(x,y) = (%i,%i), color=%i, expected: %f %f %f got %f %f %f\n",
- x, y, color,
- colors[color][0], colors[color][1], colors[color][2],
- result[0], result[1], result[2]);
- return PIGLIT_FAIL;
- }
- }
- }
- }
- }
- }
-
- return PIGLIT_PASS;
-}
-
-void piglit_init(int argc, char **argv)
-{
- (void) argc;
- (void) argv;
-
- piglit_automatic = GL_TRUE;
-
- glViewport(0, 0, piglit_width, piglit_height);
-}
diff --git a/tests/spec/gl-1.0/CMakeLists.gl.txt b/tests/spec/gl-1.0/CMakeLists.gl.txt
index 5cc1d0b..7ece6ce 100644
--- a/tests/spec/gl-1.0/CMakeLists.gl.txt
+++ b/tests/spec/gl-1.0/CMakeLists.gl.txt
@@ -27,6 +27,7 @@ piglit_add_executable (gl-1.0-no-op-paths no-op-paths.c)
piglit_add_executable (gl-1.0-polygon-line-aa polygon-line-aa.c)
piglit_add_executable (gl-1.0-push-no-attribs push-no-attribs.c)
piglit_add_executable (gl-1.0-rastercolor rastercolor.c)
+piglit_add_executable (gl-1.0-read-cache-stress-test read-cache-stress-test.c)
piglit_add_executable (gl-1.0-readpixsanity readpix.c)
piglit_add_executable (gl-1.0-readpixels-oob readpixels-oob.c)
piglit_add_executable (gl-1.0-rendermode-feedback rendermode-feedback.c)
diff --git a/tests/spec/gl-1.0/read-cache-stress-test.c b/tests/spec/gl-1.0/read-cache-stress-test.c
new file mode 100644
index 0000000..8193a5e
--- /dev/null
+++ b/tests/spec/gl-1.0/read-cache-stress-test.c
@@ -0,0 +1,109 @@
+/*
+ * Copyright © 2008 Nicolai Hähnle
+ *
+ * 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 read-cache-stress-test.c
+ *
+ * Test case for an odd problem in Radeon R300 on-chip readcache.
+ *
+ * Basically, on some particular access patterns, the read cache misses the
+ * fact that the framebuffer has changed, and a glReadPixels returns stale
+ * data.
+ *
+ * The test works by repeatedly rendering a square in different colors,
+ * and testing after each run that a number of pixel locations return the
+ * right color.
+ *
+ * @note By the nature of the test, it makes no sense to have a demo mode,
+ * so this test is always automatic.
+ */
+
+#include "piglit-util-gl.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+ config.supports_gl_compat_version = 11;
+
+ config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGB;
+ config.khr_no_error_support = PIGLIT_NO_ERRORS;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+static GLfloat colors[8][3] = {
+ { 1.0, 1.0, 1.0 },
+ { 1.0, 0.0, 0.0 },
+ { 0.0, 1.0, 0.0 },
+ { 0.0, 0.0, 1.0 },
+ { 0.5, 0.0, 0.0 },
+ { 0.0, 0.5, 0.0 },
+ { 0.0, 0.0, 0.5 },
+ { 0.0, 0.0, 0.0 }
+};
+
+enum piglit_result piglit_display(void)
+{
+ int x, y, color, i, comp;
+ /* x and y range chosen to cover a wide range of memory;
+ * Actually, only the x coordinate should matter, but who knows... */
+ for(y = 0; y < 8; ++y) {
+ for(x = 0; x < 32; ++x) {
+ for(color = 0; color < 8; ++color) {
+ glColor3fv(colors[color]);
+ glBegin(GL_QUADS);
+ glVertex2f(-1, -1);
+ glVertex2f( 1, -1);
+ glVertex2f( 1, 1);
+ glVertex2f(-1, 1);
+ glEnd();
+
+ for(i = 0; i < 2; ++i) {
+ GLfloat result[3];
+ glReadPixels(x + (i ^ ((color/2)&1))*10, y,
+ 1, 1, GL_RGB, GL_FLOAT, result);
+
+ for(comp = 0; comp < 3; ++comp) {
+ if (fabs(colors[color][comp] - result[comp]) > 0.01) {
+ printf("(x,y) = (%i,%i), color=%i, expected: %f %f %f got %f %f %f\n",
+ x, y, color,
+ colors[color][0], colors[color][1], colors[color][2],
+ result[0], result[1], result[2]);
+ return PIGLIT_FAIL;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ return PIGLIT_PASS;
+}
+
+void piglit_init(int argc, char **argv)
+{
+ (void) argc;
+ (void) argv;
+
+ piglit_automatic = GL_TRUE;
+
+ glViewport(0, 0, piglit_width, piglit_height);
+}
--
2.7.4
More information about the Piglit
mailing list