[Piglit] [PATCH 2/4] fbo: Verify attaching an invalid slice of a 3D texture
Ian Romanick
idr at freedesktop.org
Sat Jul 27 16:10:37 PDT 2013
From: Ian Romanick <ian.d.romanick at intel.com>
Also verify attaching an invalid layer of an array texture. Each of
these should result in GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT, but in the
i965 driver it results in:
intel_mipmap_tree.h:554: intel_miptree_check_level_layer: Assertion `layer < mt->level[level].depth' failed.
Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
tests/fbo/fbo-incomplete.cpp | 62 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 62 insertions(+)
diff --git a/tests/fbo/fbo-incomplete.cpp b/tests/fbo/fbo-incomplete.cpp
index a13da89..13c27b4 100644
--- a/tests/fbo/fbo-incomplete.cpp
+++ b/tests/fbo/fbo-incomplete.cpp
@@ -200,6 +200,66 @@ incomplete_0_by_0_renderbuffer(void)
return t.pass();
}
+/**
+ * Verify that attaching an invalid slice of a 3D texture results in
+ * incompleteness.
+ */
+bool
+invalid_3d_slice(void)
+{
+ incomplete_fbo_test t("invalid slice of 3D texture", GL_TEXTURE_3D);
+
+ /* Create a texture with only 8 slices, but try to attach slice 9 to
+ * the FBO.
+ */
+ glTexImage3D(GL_TEXTURE_3D, 0, GL_RGBA, 8, 8, 8, 0, GL_RGBA,
+ GL_UNSIGNED_BYTE, NULL);
+ glFramebufferTexture3D(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
+ GL_TEXTURE_3D, t.tex, 0, 9);
+
+ if (!piglit_check_gl_error(GL_NO_ERROR))
+ return t.fail();
+
+ if (!t.check_fbo_status(GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT))
+ return t.fail();
+
+ return t.pass();
+}
+
+/**
+ * Verify that attaching an invalid layer of an array texture results in
+ * incompleteness.
+ */
+bool
+invalid_array_layer(void)
+{
+ static const char subtest_name[] = "invalid layer of an array texture";
+
+ if (!piglit_is_extension_supported("GL_EXT_texture_array")
+ && piglit_get_gl_version() < 30) {
+ piglit_report_subtest_result(PIGLIT_SKIP, subtest_name);
+ return true;
+ }
+
+ incomplete_fbo_test t(subtest_name, GL_TEXTURE_2D_ARRAY);
+
+ /* Create a texture with only 8 layers but try to attach layer 9 to
+ * the FBO.
+ */
+ glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_RGBA, 8, 8, 8, 0, GL_RGBA,
+ GL_UNSIGNED_BYTE, NULL);
+ glFramebufferTextureLayer(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
+ t.tex, 0, 9);
+
+ if (!piglit_check_gl_error(GL_NO_ERROR))
+ return t.fail();
+
+ if (!t.check_fbo_status(GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT))
+ return t.fail();
+
+ return t.pass();
+}
+
enum piglit_result
piglit_display(void)
{
@@ -215,6 +275,8 @@ piglit_init(int argc, char **argv)
pass = incomplete_0_by_0_texture() && pass;
pass = incomplete_0_by_0_renderbuffer() && pass;
+ pass = invalid_3d_slice() && pass;
+ pass = invalid_array_layer() && pass;
piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
}
--
1.8.1.4
More information about the Piglit
mailing list