summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaura Ekstrand <laura@jlekstrand.net>2015-02-25 11:32:51 -0800
committerLaura Ekstrand <laura@jlekstrand.net>2015-04-02 17:57:42 -0700
commit66fbb89e612fdbb5bd9386bbcbc074afd3263afa (patch)
treef6149ecacdf88ec3675c1203e50c751a3cca22ee
parent377271d56d8733d931b3e136ca0173536d6cacb4 (diff)
arb_direct_state_access: Test errors thrown by CompressedTex[ture]SubImage*D.
-rw-r--r--tests/spec/arb_direct_state_access/texture-errors.c80
1 files changed, 80 insertions, 0 deletions
diff --git a/tests/spec/arb_direct_state_access/texture-errors.c b/tests/spec/arb_direct_state_access/texture-errors.c
index c79fbc4af..438d5c328 100644
--- a/tests/spec/arb_direct_state_access/texture-errors.c
+++ b/tests/spec/arb_direct_state_access/texture-errors.c
@@ -447,6 +447,84 @@ test_texture_level_negative(void)
return pass;
}
+static bool
+test_compressed_tex_subimage(void)
+{
+ bool pass_tex = true;
+ bool pass_texture_rect = true;
+ bool pass_texture_bad_target = true;
+ GLuint tex_rect, tex_3D, tex_2D;
+
+ /* Call glCompressedTexSubImage*D with target = 0.
+ * In Mesa Bug 89311, a dEQP test made similar calls and failed to
+ * receive GL_INVALID_ENUM. This checks to see if the situation was
+ * remedied properly.
+ */
+ glCompressedTexSubImage1D(0, 0, 0, 32, GL_RGBA8, 128, NULL);
+ pass_tex = piglit_check_gl_error(GL_INVALID_ENUM) && pass_tex;
+
+ glCompressedTexSubImage2D(0, 0, 0, 0, 32, 32, GL_RGBA8, 4096, NULL);
+ pass_tex = piglit_check_gl_error(GL_INVALID_ENUM) && pass_tex;
+
+ glCompressedTexSubImage3D(0, 0, 0, 0, 0, 32, 32, 3, GL_RGBA8, 12288,
+ NULL);
+ pass_tex = piglit_check_gl_error(GL_INVALID_ENUM) && pass_tex;
+
+ piglit_report_subtest_result(pass_tex ? PIGLIT_PASS : PIGLIT_FAIL,
+ "glCompressedTexSubImage*D: GL_INVALID_ENUM for target = 0");
+
+ /* Check to make sure that the behavior of
+ * glCompressedTextureSubImage*D is also correct.
+ */
+ glCreateTextures(GL_TEXTURE_2D, 1, &tex_2D);
+ glCreateTextures(GL_TEXTURE_RECTANGLE, 1, &tex_rect);
+ glCreateTextures(GL_TEXTURE_3D, 1, &tex_3D);
+
+ /* Rectangle checks: look for invalid operation */
+ glCompressedTextureSubImage1D(tex_rect, 0, 0, 32, GL_RGBA8, 128,
+ NULL);
+ pass_texture_rect = piglit_check_gl_error(GL_INVALID_OPERATION) &&
+ pass_texture_rect;
+
+ glCompressedTextureSubImage2D(tex_rect, 0, 0, 0, 32, 32, GL_RGBA8,
+ 4096, NULL);
+ pass_texture_rect = piglit_check_gl_error(GL_INVALID_OPERATION) &&
+ pass_texture_rect;
+
+ glCompressedTextureSubImage3D(tex_rect, 0, 0, 0, 0, 32, 32, 3,
+ GL_RGBA8, 12288, NULL);
+ pass_texture_rect = piglit_check_gl_error(GL_INVALID_OPERATION) &&
+ pass_texture_rect;
+
+ piglit_report_subtest_result(pass_texture_rect ? PIGLIT_PASS :
+ PIGLIT_FAIL,
+ "glCompressedTextureSubImage*D: GL_INVALID_OPERATION "
+ "for target = TEXTURE_RECTANGLE");
+
+ /* Other texture checks: look for invalid enum */
+ glCompressedTextureSubImage1D(tex_2D, 0, 0, 32, GL_RGBA8, 128,
+ NULL);
+ pass_texture_bad_target = piglit_check_gl_error(GL_INVALID_ENUM) &&
+ pass_texture_bad_target;
+
+ glCompressedTextureSubImage2D(tex_3D, 0, 0, 0, 32, 32, GL_RGBA8,
+ 4096, NULL);
+ pass_texture_bad_target = piglit_check_gl_error(GL_INVALID_ENUM) &&
+ pass_texture_bad_target;
+
+ glCompressedTextureSubImage3D(tex_2D, 0, 0, 0, 0, 32, 32, 3,
+ GL_RGBA8, 12288, NULL);
+ pass_texture_bad_target = piglit_check_gl_error(GL_INVALID_ENUM) &&
+ pass_texture_bad_target;
+
+ piglit_report_subtest_result(pass_texture_bad_target ? PIGLIT_PASS :
+ PIGLIT_FAIL,
+ "glCompressedTextureSubImage*D: GL_INVALID_ENUM for "
+ "bad targets");
+
+ return pass_tex && pass_texture_rect && pass_texture_bad_target;
+}
+
enum piglit_result
piglit_display(void)
{
@@ -468,6 +546,8 @@ piglit_display(void)
pass &= test_texture_rec_texture_base();
}
+ pass = test_compressed_tex_subimage() && pass;
+
return pass ? PIGLIT_PASS : PIGLIT_FAIL;
}