[Piglit] [PATCH 11/16] namespace-pollution: Add framebuffer as an object to test
Ian Romanick
idr at freedesktop.org
Wed Jan 6 16:53:11 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:
framebuffer with glgeneratemipmap
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 | 89 ++++++++++++++++++++++++++++++
2 files changed, 90 insertions(+), 1 deletion(-)
diff --git a/tests/all.py b/tests/all.py
index 129c2f7..9e7f324 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", "texture"):
+ for object_type in ("buffer", "framebuffer", "texture"):
for operation in ("glBitmap", "glBlitFramebuffer", "glClear", "glClearTexSubImage", "glCopyImageSubData", "glCopyPixels", "glCopyTexSubImage2D", "glDrawPixels", "glGenerateMipmap", "glGetTexImage", "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 f8ca49d..6ec9b08 100644
--- a/tests/general/object-namespace-pollution.c
+++ b/tests/general/object-namespace-pollution.c
@@ -284,6 +284,75 @@ validate_buffer(unsigned name)
}
/*@}*/
+/** \name Methods for operating on framebuffer objects */
+/*@{*/
+static bool
+create_framebuffer(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 (glIsFramebufferEXT(name)) {
+ printf("\t%s,%d: %u is already a framebuffer\n",
+ __func__, __LINE__, name);
+ return false;
+ }
+
+ glBindFramebufferEXT(GL_FRAMEBUFFER, name);
+ glBindFramebufferEXT(GL_FRAMEBUFFER, piglit_winsys_fbo);
+
+ return piglit_check_gl_error(GL_NO_ERROR);
+}
+
+static bool
+validate_framebuffer(unsigned name)
+{
+ static const struct enum_value_pair test_vectors[] = {
+ { GL_COLOR_ATTACHMENT0, 0 },
+ { GL_DEPTH_ATTACHMENT, 0 },
+ { GL_STENCIL_ATTACHMENT, 0 },
+ };
+ bool pass = true;
+
+ if (!piglit_is_extension_supported("GL_EXT_framebuffer_object"))
+ return true;
+
+ if (!glIsFramebufferEXT(name)) {
+ printf("\t%s,%d: %u is not a framebuffer\n",
+ __func__, __LINE__, name);
+ return false;
+ }
+
+ glBindFramebufferEXT(GL_FRAMEBUFFER, name);
+
+ for (unsigned i = 0; i < ARRAY_SIZE(test_vectors); i++) {
+ GLint got;
+
+ glGetFramebufferAttachmentParameterivEXT(GL_FRAMEBUFFER,
+ test_vectors[i].value,
+ GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE,
+ &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;
+ }
+ }
+
+ glBindFramebufferEXT(GL_FRAMEBUFFER, piglit_winsys_fbo);
+
+ return piglit_check_gl_error(GL_NO_ERROR) && pass;
+}
+/*@}*/
+
/** \name Methods for operating on texture objects */
/*@{*/
#define TEXTURE_DATA_SIZE (16 * 16 * sizeof(GLuint))
@@ -836,6 +905,7 @@ static const struct {
bool (*validate)(unsigned name);
} object_types[] = {
{ "buffer", create_buffer, validate_buffer },
+ { "framebuffer", create_framebuffer, validate_framebuffer },
{ "texture", create_texture, validate_texture },
};
@@ -871,6 +941,7 @@ piglit_init(int argc, char **argv)
unsigned last_operation = ARRAY_SIZE(operations) - 1;
bool silent = true;
unsigned first_unused_texture;
+ unsigned first_unused_framebuffer;
/* The test is either invoked with no command line parameters (in
* which case all test combinations are run) or with an operation name
@@ -930,6 +1001,16 @@ piglit_init(int argc, char **argv)
if (first_unused_texture >= 16)
piglit_report_result(PIGLIT_FAIL);
+ for (first_unused_framebuffer = 1;
+ first_unused_framebuffer < 16;
+ first_unused_framebuffer++) {
+ if (!glIsFramebufferEXT(first_unused_framebuffer))
+ break;
+ }
+
+ if (first_unused_framebuffer >= 16)
+ piglit_report_result(PIGLIT_FAIL);
+
for (i = first_operation; i <= last_operation; i++)
pass = operations[i].func(silent) && pass;
@@ -941,6 +1022,10 @@ piglit_init(int argc, char **argv)
name < first_unused_texture)
continue;
+ if (strcmp("framebuffer", object_types[i].name) == 0 &&
+ name < first_unused_framebuffer)
+ continue;
+
pass = object_types[i].create(name, silent) && pass;
}
}
@@ -958,6 +1043,10 @@ piglit_init(int argc, char **argv)
name < first_unused_texture)
continue;
+ if (strcmp("framebuffer", object_types[i].name) == 0 &&
+ name < first_unused_framebuffer)
+ continue;
+
pass = object_types[i].validate(name) && pass;
}
}
--
2.5.0
More information about the Piglit
mailing list