[Piglit] [PATCH 13/16] namespace-pollution: Add renderbuffer as an object to test
Ian Romanick
idr at freedesktop.org
Wed Jan 6 16:53:13 PST 2016
From: Ian Romanick <ian.d.romanick at intel.com>
NOTE: The following tests fail on i965 (and presumably other drivers
that use meta) on Mesa master and 11.1:
renderbuffer with glgetteximage-compressed
Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92363
---
tests/all.py | 2 +-
tests/general/object-namespace-pollution.c | 76 +++++++++++++++++++++++++++++-
2 files changed, 76 insertions(+), 2 deletions(-)
diff --git a/tests/all.py b/tests/all.py
index dee354f..e477cd8 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -4608,7 +4608,7 @@ with profile.group_manager(
with profile.group_manager(
PiglitGLTest,
grouptools.join('object namespace pollution')) as g:
- for object_type in ("buffer", "framebuffer", "texture"):
+ for object_type in ("buffer", "framebuffer", "renderbuffer", "texture"):
for operation in ("glBitmap", "glBlitFramebuffer", "glClear", "glClearTexSubImage", "glCopyImageSubData", "glCopyPixels", "glCopyTexSubImage2D", "glDrawPixels", "glGenerateMipmap", "glGetTexImage", "glGetTexImage-compressed", "glTexSubImage2D"):
g(['object-namespace-pollution', operation, object_type],
'{} with {}'.format(object_type, operation))
diff --git a/tests/general/object-namespace-pollution.c b/tests/general/object-namespace-pollution.c
index 825eb82..1073b65 100644
--- a/tests/general/object-namespace-pollution.c
+++ b/tests/general/object-namespace-pollution.c
@@ -353,6 +353,79 @@ validate_framebuffer(unsigned name)
}
/*@}*/
+/** \name Methods for operating on renderbuffer objects */
+/*@{*/
+static bool
+create_renderbuffer(unsigned name, bool silent_skip)
+{
+ if (!piglit_is_extension_supported("GL_EXT_framebuffer_object")) {
+ if (silent_skip)
+ return true;
+
+ printf("%s requires GL_EXT_framebuffer_object.\n", __func__);
+ piglit_report_result(PIGLIT_SKIP);
+ }
+
+ if (glIsRenderbufferEXT(name)) {
+ printf("\t%s,%d: %u is already a renderbuffer\n",
+ __func__, __LINE__, name);
+ return false;
+ }
+
+ glBindRenderbufferEXT(GL_RENDERBUFFER, name);
+ glRenderbufferStorageEXT(GL_RENDERBUFFER, GL_RGBA8,
+ 17 /* width */, 15 /* height */);
+
+ glBindRenderbufferEXT(GL_RENDERBUFFER, 0);
+
+ return piglit_check_gl_error(GL_NO_ERROR);
+}
+
+static bool
+validate_renderbuffer(unsigned name)
+{
+ static const struct enum_value_pair test_vectors[] = {
+ { GL_RENDERBUFFER_WIDTH, 17 },
+ { GL_RENDERBUFFER_HEIGHT, 15 },
+ { GL_RENDERBUFFER_INTERNAL_FORMAT, GL_RGBA8 },
+ { GL_RENDERBUFFER_DEPTH_SIZE, 0 },
+ { GL_RENDERBUFFER_STENCIL_SIZE, 0 },
+ };
+ bool pass = true;
+
+ if (!piglit_is_extension_supported("GL_EXT_framebuffer_object"))
+ return true;
+
+ if (!glIsRenderbufferEXT(name)) {
+ printf("\t%s,%d: %u is not a renderbuffer\n",
+ __func__, __LINE__, name);
+ return false;
+ }
+
+ glBindRenderbufferEXT(GL_RENDERBUFFER, name);
+
+ for (unsigned i = 0; i < ARRAY_SIZE(test_vectors); i++) {
+ GLint got;
+
+ glGetRenderbufferParameterivEXT(GL_RENDERBUFFER,
+ test_vectors[i].value,
+ &got);
+
+ if (got != test_vectors[i].expected) {
+ printf("\t%s,%d: %s of %u: got 0x%x, expected 0x%x\n",
+ __func__, __LINE__,
+ piglit_get_gl_enum_name(test_vectors[i].value),
+ name, got, test_vectors[i].expected);
+ pass = false;
+ }
+ }
+
+ glBindRenderbufferEXT(GL_RENDERBUFFER, 0);
+
+ return piglit_check_gl_error(GL_NO_ERROR) && pass;
+}
+/*@}*/
+
/** \name Methods for operating on texture objects */
/*@{*/
#define TEXTURE_DATA_SIZE (16 * 16 * sizeof(GLuint))
@@ -867,7 +940,7 @@ do_GetTexImage_compressed(bool silent_skip)
/* Generate the compressed texture object.
*/
- generate_random_data(data, sizeof(data), GL_PIXEL_UNPACK_BUFFER, pbo);
+ generate_random_data(data, sizeof(data), GL_TEXTURE_2D, tex);
glBindTexture(GL_TEXTURE_2D, tex);
glCompressedTexImage2D(GL_TEXTURE_2D, 0 /* level */, internal_format,
16 /* width */, 16 /* height */, 0 /* border */,
@@ -976,6 +1049,7 @@ static const struct {
} object_types[] = {
{ "buffer", create_buffer, validate_buffer },
{ "framebuffer", create_framebuffer, validate_framebuffer },
+ { "renderbuffer", create_renderbuffer, validate_renderbuffer },
{ "texture", create_texture, validate_texture },
};
--
2.5.0
More information about the Piglit
mailing list