summaryrefslogtreecommitdiff
path: root/tests/general
diff options
context:
space:
mode:
authorIan Romanick <ian.d.romanick@intel.com>2015-12-21 18:02:54 -0800
committerIan Romanick <ian.d.romanick@intel.com>2016-01-12 09:49:26 -0800
commit0e427fceb00a9d4cec6ad6f001276136076559a6 (patch)
treea4d16afc7f7fcf5a57cdf71c626ae1d9193d757b /tests/general
parentf059844f90550612ddd52cf899e0d45abeb73dbf (diff)
namespace-pollution: Add renderbuffer as an object to test
NOTE: The following tests fail on i965 (and presumably other drivers that use meta) on Mesa master and 11.1: renderbuffer with glgetteximage-compressed v2: See v6 comment in first namespace-pollution commit. Also move changes to do_GetTexImage_compressed to the previous patch. Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92363 Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu> Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Diffstat (limited to 'tests/general')
-rw-r--r--tests/general/object-namespace-pollution.c68
1 files changed, 68 insertions, 0 deletions
diff --git a/tests/general/object-namespace-pollution.c b/tests/general/object-namespace-pollution.c
index 27f6a425d..457b60e0d 100644
--- a/tests/general/object-namespace-pollution.c
+++ b/tests/general/object-namespace-pollution.c
@@ -340,6 +340,73 @@ validate_framebuffer(unsigned name)
}
/*@}*/
+/** \name Methods for operating on renderbuffer objects */
+/*@{*/
+static bool
+create_renderbuffer(unsigned name)
+{
+ if (!piglit_is_extension_supported("GL_EXT_framebuffer_object")) {
+ 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 (!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))
@@ -918,6 +985,7 @@ static const struct object_type {
} object_type_table[] = {
{ "buffer", create_buffer, validate_buffer },
{ "framebuffer", create_framebuffer, validate_framebuffer },
+ { "renderbuffer", create_renderbuffer, validate_renderbuffer },
{ "texture", create_texture, validate_texture },
};