summaryrefslogtreecommitdiff
path: root/src/gallium/state_trackers/python/tests
diff options
context:
space:
mode:
authorJosé Fonseca <jrfonseca@tungstengraphics.com>2008-07-17 10:27:10 +0900
committerJosé Fonseca <jrfonseca@tungstengraphics.com>2008-07-18 01:20:44 +0900
commitd398e1360d5c1c0f44a4ba9cd167c39a29ce8254 (patch)
tree9f3a2c163d6b8479cb3217741b6cc56b819bee57 /src/gallium/state_trackers/python/tests
parent457bb10cee6a2f6f7b7e320f066a26e24e13c550 (diff)
python: Reimplement tile comparison in C to speed up tests.
Diffstat (limited to 'src/gallium/state_trackers/python/tests')
-rw-r--r--src/gallium/state_trackers/python/tests/texture.py20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/gallium/state_trackers/python/tests/texture.py b/src/gallium/state_trackers/python/tests/texture.py
index edaa2b8b26..3d76953126 100644
--- a/src/gallium/state_trackers/python/tests/texture.py
+++ b/src/gallium/state_trackers/python/tests/texture.py
@@ -304,15 +304,21 @@ class TextureTest(TestCase):
ctx.flush()
- rgba = FloatArray(h*w*4)
-
- cbuf_tex.get_surface(usage = PIPE_BUFFER_USAGE_CPU_READ).get_tile_rgba(x, y, w, h, rgba)
+ cbuf = cbuf_tex.get_surface(usage = PIPE_BUFFER_USAGE_CPU_READ)
+
+ total = h*w
+ different = cbuf.compare_tile_rgba(x, y, w, h, expected_rgba, tol=4.0/256)
+ if different:
+ sys.stderr.write("%u out of %u pixels differ\n" % (different, total))
- if not compare_rgba(w, h, rgba, expected_rgba):
+ if float(total - different)/float(total) < 0.85:
- #show_image(w, h, Result=rgba, Expected=expected_rgba)
- #save_image(w, h, rgba, "result.png")
- #save_image(w, h, expected_rgba, "expected.png")
+ if 0:
+ rgba = FloatArray(h*w*4)
+ cbuf.get_tile_rgba(x, y, w, h, rgba)
+ show_image(w, h, Result=rgba, Expected=expected_rgba)
+ save_image(w, h, rgba, "result.png")
+ save_image(w, h, expected_rgba, "expected.png")
#sys.exit(0)
raise TestFailure