On 08/23/2012 05:00 PM, Paul Berry wrote:
This test provokes a bug in Mesa as of 8/23/12 (commit 1cb07bd): when
fast depth clears are performed on multiple layers of a multilayer
depth texture (such as a 2D array or a cubemap texture), the
implementation doesn't properly track the need for depth resolves,
resulting in incorrect data when the texture is later used for
texturing. See https://bugs.freedesktop.org/show_bug.cgi?id=50270.
Although the bug was initially discovered using cubemap textures, this
test provokes it using a 2D array texture, so that we don't have to
reason about the coordinate transformations involved in cube map
texture lookup.
Sorry for the lag...
Reviewed-by: Ian Romanick ian.d.roman...@intel.com
---
tests/all.tests |1 +
tests/texturing/CMakeLists.gl.txt |1 +
tests/texturing/array-depth-roundtrip.c | 203 +++
3 files changed, 205 insertions(+), 0 deletions(-)
create mode 100644 tests/texturing/array-depth-roundtrip.c
diff --git a/tests/all.tests b/tests/all.tests
index eb32225..c6c12ae 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -700,6 +700,7 @@ create_context_es2_profile['invalid OpenGL ES version'] =
PlainExecTest(['glx-cr
texturing = Group()
add_concurrent_test(texturing, '1-1-linear-texture')
+add_plain_test(texturing, 'array-depth-roundtrip')
add_plain_test(texturing, 'array-texture')
add_plain_test(texturing, 'copytexsubimage')
add_plain_test(texturing, 'copyteximage-border')
diff --git a/tests/texturing/CMakeLists.gl.txt
b/tests/texturing/CMakeLists.gl.txt
index e161ece..ca30e4e 100644
--- a/tests/texturing/CMakeLists.gl.txt
+++ b/tests/texturing/CMakeLists.gl.txt
@@ -18,6 +18,7 @@ if(NOT USE_WAFFLE)
endif(NOT USE_WAFFLE)
piglit_add_executable (1-1-linear-texture 1-1-linear-texture.c)
+piglit_add_executable (array-depth-roundtrip array-depth-roundtrip.c)
piglit_add_executable (array-texture array-texture.c)
piglit_add_executable (compressedteximage compressedteximage.c)
piglit_add_executable (copytexsubimage copytexsubimage.c)
diff --git a/tests/texturing/array-depth-roundtrip.c
b/tests/texturing/array-depth-roundtrip.c
new file mode 100644
index 000..3eb71f3
--- /dev/null
+++ b/tests/texturing/array-depth-roundtrip.c
@@ -0,0 +1,203 @@
+/*
+ * Copyright © 2012 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 array-depth-roundtrip.c
+ *
+ * Test that an array texture containing depth data works properly
+ * when making a full roundtrip through both the GPU's rendering
+ * pipeline and texturing operations.
+ *
+ * The test performs the following steps:
+ *
+ * - Create an array texture containing depth data.
+ *
+ * - Bind each slice of the array texture to a framebuffer, clear it,
+ * and render a quad to it. A different depth value is used for
+ * each slice of the array.
+ *
+ * - Use a shader to read from each slice of the array texture and
+ * render to the window system framebuffer.
+ *
+ * - Verify that correct data was rendered to the window system
+ * framebuffer.
+ */
+
+#include piglit-util-gl-common.h
+
+
+#define TEX_WIDTH 56
+#define TEX_HEIGHT 56
+#define NUM_TILES_ACROSS 4
+#define NUM_TILES_DOWN 4
+#define TEX_DEPTH (NUM_TILES_ACROSS * NUM_TILES_DOWN)
+
+
+PIGLIT_GL_TEST_MAIN(
+TEX_WIDTH * NUM_TILES_ACROSS,
+TEX_HEIGHT * NUM_TILES_DOWN,
+GLUT_DOUBLE | GLUT_RGB)
+
+
+GLuint tex;
+GLuint fb;
+GLuint prog;
+GLint samp_loc;
+GLint proj_loc;
+GLint tex_depth_loc;
+
+
+const char *vs_text = \
+ #version 130\n
+ uniform mat4 proj;\n
+ uniform float tex_depth;\n
+ out vec3 tex_coord;\n
+ void main()\n
+ {\n
+ gl_Position = proj * gl_Vertex;\n
+ tex_coord = vec3(gl_Vertex.xy, tex_depth);\n
+ }\n;
+
+
+const char *fs_text = \
+ #version 130\n
+ uniform sampler2DArray