[Piglit] [PATCH] Add a test to reproduce a crash when running gzdoom on Ironlake.
Kenneth Graunke
kenneth at whitecape.org
Tue Apr 24 00:32:27 PDT 2012
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=48218
---
tests/all.tests | 1 +
tests/shaders/CMakeLists.gl.txt | 1 +
tests/shaders/depth-test-and-write.c | 75 ++++++++++++++++++++++++++++++++++
3 files changed, 77 insertions(+)
create mode 100644 tests/shaders/depth-test-and-write.c
diff --git a/tests/all.tests b/tests/all.tests
index dd61b5a..3a4d16c 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -356,6 +356,7 @@ add_plain_test(shaders, 'ati-fs-bad-delete')
add_plain_test(shaders, 'attribute0')
add_plain_test(shaders, 'createshaderprogram-bad-type')
add_plain_test(shaders, 'createshaderprogram-attached-shaders')
+add_plain_test(shaders, 'depth-test-and-write')
add_plain_test(shaders, 'fp-abs-01')
add_plain_test(shaders, 'fp-abs-02')
add_plain_test(shaders, 'fp-condition_codes-01')
diff --git a/tests/shaders/CMakeLists.gl.txt b/tests/shaders/CMakeLists.gl.txt
index 9efc26a..712733f 100644
--- a/tests/shaders/CMakeLists.gl.txt
+++ b/tests/shaders/CMakeLists.gl.txt
@@ -20,6 +20,7 @@ piglit_add_executable (ati-fs-bad-delete ati-fs-bad-delete.c)
piglit_add_executable (attribute0 attribute0.c)
piglit_add_executable (createshaderprogram-bad-type createshaderprogram-bad-type.c)
piglit_add_executable (createshaderprogram-attached-shaders createshaderprogram-attached-shaders.c)
+piglit_add_executable (depth-test-and-write depth-test-and-write.c)
piglit_add_executable (trinity-fp1 trinity-fp1.c)
piglit_add_executable (fp-abs-01 fp-abs-01.c)
piglit_add_executable (fp-abs-02 fp-abs-02.c)
diff --git a/tests/shaders/depth-test-and-write.c b/tests/shaders/depth-test-and-write.c
new file mode 100644
index 0000000..af59b37
--- /dev/null
+++ b/tests/shaders/depth-test-and-write.c
@@ -0,0 +1,75 @@
+/*
+ * 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 depth-test-and-write.c
+ *
+ * Draw a rectangle using a shader that writes depth while also using
+ * depth testing. This reproduces freedesktop.org bug #48218, where
+ * the i965 driver used invalid registers.
+ */
+#include "piglit-util.h"
+
+int piglit_width = 20, piglit_height = 20;
+int piglit_window_mode = GLUT_RGB | GLUT_DOUBLE;
+
+static GLuint vs, fs, prog;
+
+enum piglit_result
+piglit_display(void)
+{
+ static const float green[4] = {0.0, 1.0, 0.0, 0.0};
+
+ bool pass = true;
+
+ glEnable(GL_DEPTH_TEST);
+ glDepthFunc(GL_ALWAYS);
+
+ piglit_UseProgram(prog);
+ piglit_draw_rect(-1, -1, 2, 2);
+
+ pass &= piglit_probe_pixel_rgb(10, 10, green);
+
+ piglit_present_results();
+
+ return pass ? PIGLIT_PASS : PIGLIT_FAIL;
+}
+
+void
+piglit_init(int argc, char **argv)
+{
+ const char *vs_source = "void main() { gl_Position = gl_Vertex; }";
+ const char *fs_source =
+ "void main()"
+ "{"
+ " gl_FragColor = vec4(0.0, 1.0, 0.0, 0.0);"
+ " gl_FragDepth = gl_FragCoord.z;"
+ "}";
+
+ piglit_require_extension("GL_EXT_framebuffer_object");
+ piglit_require_GLSL();
+
+ vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vs_source);
+ fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, fs_source);
+ prog = piglit_link_simple_program(vs, fs);
+}
--
1.7.9.5
More information about the Piglit
mailing list