---
 .../spec/arb_direct_state_access/texture-errors.c  | 80 ++++++++++++++++++++++
 1 file changed, 80 insertions(+)

diff --git a/tests/spec/arb_direct_state_access/texture-errors.c 
b/tests/spec/arb_direct_state_access/texture-errors.c
index c79fbc4..438d5c3 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;
 }
 
-- 
2.1.0

_______________________________________________
Piglit mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/piglit

Reply via email to