summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Romanick <ian.d.romanick@intel.com>2010-03-05 13:47:45 -0800
committerIan Romanick <ian.d.romanick@intel.com>2010-03-05 13:47:45 -0800
commit11c219002988e45f84d36fa66b4b8f30d83b192e (patch)
treeb991242a975bb146b1f7c33261386542441416a7
parent96f011b3cd44c10d94a108ebde500b43c136f46f (diff)
object_purgeable: Refactor main test body into text_Purgeable
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
-rw-r--r--tests/general/object_purgeable-api-pbo.c68
-rw-r--r--tests/general/object_purgeable-api-texture.c63
-rw-r--r--tests/general/object_purgeable-api-vbo.c67
-rw-r--r--tests/general/object_purgeable.c55
-rw-r--r--tests/general/object_purgeable.h2
5 files changed, 87 insertions, 168 deletions
diff --git a/tests/general/object_purgeable-api-pbo.c b/tests/general/object_purgeable-api-pbo.c
index e825e605..ec174280 100644
--- a/tests/general/object_purgeable-api-pbo.c
+++ b/tests/general/object_purgeable-api-pbo.c
@@ -44,70 +44,24 @@ piglit_init(int argc, char **argv)
init_ObjectPurgeableAPI();
piglit_automatic = GL_TRUE;
- piglit_require_extension("GL_ARB_pixel_buffer_object");
+ piglit_require_extension("GL_ARB_pixel_buffer_object");
}
enum piglit_result
piglit_display(void)
{
- GLuint pbo;
- GLboolean pass = GL_TRUE;
+ GLuint pbo;
+ GLboolean pass;
- glGetError();
+ glGenBuffersARB(1, &pbo);
+ glBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, pbo);
+ glBufferDataARB(GL_PIXEL_PACK_BUFFER_ARB, 100*100, NULL,
+ GL_STATIC_DRAW_ARB);
+ glBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, 0);
- glGenBuffersARB(1, &pbo);
- glBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, pbo);
- glBufferDataARB(GL_PIXEL_PACK_BUFFER_ARB, 100*100, NULL, GL_STATIC_DRAW_ARB);
- glBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, 0);
+ pass = test_Purgeable(pbo, GL_BUFFER_OBJECT_APPLE);
-
- if (test_GetObjectParameterivAPPLE(GL_BUFFER_OBJECT_APPLE, pbo, GL_FALSE) != GL_TRUE) {
- fprintf(stderr, "Default GL_PURGEABLE_APPLE state should GL_FALSE for texture object\n");
- pass = GL_FALSE;
- }
-
- if (test_ObjectpurgeableAPPLE(GL_BUFFER_OBJECT_APPLE, pbo, GL_VOLATILE_APPLE) != GL_TRUE) {
- fprintf(stderr, "Error when mark object %x to purgeable(GL_VOLATILE_APPLE)\n", pbo);
- pass = GL_FALSE;
- }
-
- if (test_GetObjectParameterivAPPLE(GL_BUFFER_OBJECT_APPLE, pbo, GL_TRUE) != GL_TRUE) {
- fprintf(stderr, "Object %x is not set to purgeable\n", pbo);
- pass = GL_FALSE;
- }
-
- if (test_ObjectunpurgeableAPPLE(GL_BUFFER_OBJECT_APPLE, pbo, GL_RETAINED_APPLE) != GL_TRUE) {
- fprintf(stderr, "Error when mark object %x to unpurgeable(GL_RETAINED_APPLE)\n", pbo);
- pass = GL_FALSE;
- }
-
- if (test_GetObjectParameterivAPPLE(GL_BUFFER_OBJECT_APPLE, pbo, GL_FALSE) != GL_TRUE) {
- fprintf(stderr, "Object %x is not set to unpurgeable\n", pbo);
- pass = GL_FALSE;
- }
-
- if (test_ObjectpurgeableAPPLE(GL_BUFFER_OBJECT_APPLE, pbo, GL_RELEASED_APPLE) != GL_TRUE) {
- fprintf(stderr, "Error when mark object %x to purgeable(GL_RELEASED_APPLE)\n", pbo);
- pass = GL_FALSE;
- }
-
- if (test_GetObjectParameterivAPPLE(GL_BUFFER_OBJECT_APPLE, pbo, GL_TRUE) != GL_TRUE) {
- fprintf(stderr, "Object %x is not set to purgeable\n", pbo);
- pass = GL_FALSE;
- }
-
- if (test_ObjectunpurgeableAPPLE(GL_BUFFER_OBJECT_APPLE, pbo, GL_UNDEFINED_APPLE) != GL_TRUE) {
- fprintf(stderr, "Error when mark object %x to unpurgeable(GL_UNDEFINED_APPLE)\n", pbo);
- pass = GL_FALSE;
- }
-
- if (test_GetObjectParameterivAPPLE(GL_BUFFER_OBJECT_APPLE, pbo, GL_FALSE) != GL_TRUE) {
- fprintf(stderr, "Object %x is not set to unpurgeable\n", pbo);
- pass = GL_FALSE;
- }
-
-
- glDeleteBuffersARB(1, &pbo);
- return pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE;
+ glDeleteBuffersARB(1, &pbo);
+ return pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE;
}
diff --git a/tests/general/object_purgeable-api-texture.c b/tests/general/object_purgeable-api-texture.c
index 34b3dcff..a7ea5dc4 100644
--- a/tests/general/object_purgeable-api-texture.c
+++ b/tests/general/object_purgeable-api-texture.c
@@ -49,61 +49,16 @@ piglit_init(int argc, char **argv)
enum piglit_result
piglit_display(void)
{
- GLuint texture;
- GLboolean pass = GL_TRUE;
+ GLuint texture;
+ GLboolean pass;
- glGenTextures(1, &texture);
- glBindTexture(GL_TEXTURE_2D, texture);
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 100, 100, 0, GL_RGB, GL_INT, NULL);
+ glGenTextures(1, &texture);
+ glBindTexture(GL_TEXTURE_2D, texture);
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 100, 100, 0, GL_RGB, GL_INT,
+ NULL);
- glGetError();
+ pass = test_Purgeable(texture, GL_TEXTURE);
- if (test_GetObjectParameterivAPPLE(GL_TEXTURE, texture, GL_FALSE) != GL_TRUE) {
- fprintf(stderr, "Default GL_PURGEABLE_APPLE state should GL_FALSE for texture object\n");
- pass = GL_FALSE;
- }
-
- if (test_ObjectpurgeableAPPLE(GL_TEXTURE, texture, GL_VOLATILE_APPLE) != GL_TRUE) {
- fprintf(stderr, "Error when mark object %x to purgeable(GL_VOLATILE_APPLE)\n", texture);
- pass = GL_FALSE;
- }
-
- if (test_GetObjectParameterivAPPLE(GL_TEXTURE, texture, GL_TRUE) != GL_TRUE) {
- fprintf(stderr, "Object %x is not set to purgeable\n", texture);
- pass = GL_FALSE;
- }
-
- if (test_ObjectunpurgeableAPPLE(GL_TEXTURE, texture, GL_RETAINED_APPLE) != GL_TRUE) {
- fprintf(stderr, "Error when mark object %x to unpurgeable(GL_RETAINED_APPLE)\n", texture);
- pass = GL_FALSE;
- }
-
- if (test_GetObjectParameterivAPPLE(GL_TEXTURE, texture, GL_FALSE) != GL_TRUE) {
- fprintf(stderr, "Object %x is not set to unpurgeable\n", texture);
- pass = GL_FALSE;
- }
-
- if (test_ObjectpurgeableAPPLE(GL_TEXTURE, texture, GL_RELEASED_APPLE) != GL_TRUE) {
- fprintf(stderr, "Error when mark object %x to purgeable(GL_RELEASED_APPLE)\n", texture);
- pass = GL_FALSE;
- }
-
- if (test_GetObjectParameterivAPPLE(GL_TEXTURE, texture, GL_TRUE) != GL_TRUE) {
- fprintf(stderr, "Object %x is not set to purgeable\n", texture);
- pass = GL_FALSE;
- }
-
- if (test_ObjectunpurgeableAPPLE(GL_TEXTURE, texture, GL_UNDEFINED_APPLE) != GL_TRUE) {
- fprintf(stderr, "Error when mark object %x to unpurgeable(GL_UNDEFINED_APPLE)\n", texture);
- pass = GL_FALSE;
- }
-
- if (test_GetObjectParameterivAPPLE(GL_TEXTURE, texture, GL_FALSE) != GL_TRUE) {
- fprintf(stderr, "Object %x is not set to unpurgeable\n", texture);
- pass = GL_FALSE;
- }
-
-
- glDeleteTextures(1, &texture);
- return pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE;
+ glDeleteTextures(1, &texture);
+ return pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE;
}
diff --git a/tests/general/object_purgeable-api-vbo.c b/tests/general/object_purgeable-api-vbo.c
index e300b9d0..215ad664 100644
--- a/tests/general/object_purgeable-api-vbo.c
+++ b/tests/general/object_purgeable-api-vbo.c
@@ -44,70 +44,23 @@ piglit_init(int argc, char **argv)
init_ObjectPurgeableAPI();
piglit_automatic = GL_TRUE;
- piglit_require_extension("GL_ARB_vertex_buffer_object");
+ piglit_require_extension("GL_ARB_vertex_buffer_object");
}
enum piglit_result
piglit_display(void)
{
- GLuint vbo;
- GLboolean pass = GL_TRUE;
+ GLuint vbo;
+ GLboolean pass;
- glGetError();
+ glGenBuffersARB(1, &vbo);
+ glBindBufferARB(GL_ARRAY_BUFFER_ARB, vbo);
+ glBufferDataARB(GL_ARRAY_BUFFER_ARB, 100*100, NULL, GL_STATIC_DRAW_ARB);
+ glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
- glGenBuffersARB(1, &vbo);
- glBindBufferARB(GL_ARRAY_BUFFER_ARB, vbo);
- glBufferDataARB(GL_ARRAY_BUFFER_ARB, 100*100, NULL, GL_STATIC_DRAW_ARB);
- glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
+ pass = test_Purgeable(vbo, GL_BUFFER_OBJECT_APPLE);
-
- if (test_GetObjectParameterivAPPLE(GL_BUFFER_OBJECT_APPLE, vbo, GL_FALSE) != GL_TRUE) {
- fprintf(stderr, "Default GL_PURGEABLE_APPLE state should GL_FALSE for texture object\n");
- pass = GL_FALSE;
- }
-
- if (test_ObjectpurgeableAPPLE(GL_BUFFER_OBJECT_APPLE, vbo, GL_VOLATILE_APPLE) != GL_TRUE) {
- fprintf(stderr, "Error when mark object %x to purgeable(GL_VOLATILE_APPLE)\n", vbo);
- pass = GL_FALSE;
- }
-
- if (test_GetObjectParameterivAPPLE(GL_BUFFER_OBJECT_APPLE, vbo, GL_TRUE) != GL_TRUE) {
- fprintf(stderr, "Object %x is not set to purgeable\n", vbo);
- pass = GL_FALSE;
- }
-
- if (test_ObjectunpurgeableAPPLE(GL_BUFFER_OBJECT_APPLE, vbo, GL_RETAINED_APPLE) != GL_TRUE) {
- fprintf(stderr, "Error when mark object %x to unpurgeable(GL_RETAINED_APPLE)\n", vbo);
- pass = GL_FALSE;
- }
-
- if (test_GetObjectParameterivAPPLE(GL_BUFFER_OBJECT_APPLE, vbo, GL_FALSE) != GL_TRUE) {
- fprintf(stderr, "Object %x is not set to unpurgeable\n", vbo);
- pass = GL_FALSE;
- }
-
- if (test_ObjectpurgeableAPPLE(GL_BUFFER_OBJECT_APPLE, vbo, GL_RELEASED_APPLE) != GL_TRUE) {
- fprintf(stderr, "Error when mark object %x to purgeable(GL_RELEASED_APPLE)\n", vbo);
- pass = GL_FALSE;
- }
-
- if (test_GetObjectParameterivAPPLE(GL_BUFFER_OBJECT_APPLE, vbo, GL_TRUE) != GL_TRUE) {
- fprintf(stderr, "Object %x is not set to purgeable\n", vbo);
- pass = GL_FALSE;
- }
-
- if (test_ObjectunpurgeableAPPLE(GL_BUFFER_OBJECT_APPLE, vbo, GL_UNDEFINED_APPLE) != GL_TRUE) {
- fprintf(stderr, "Error when mark object %x to unpurgeable(GL_UNDEFINED_APPLE)\n", vbo);
- pass = GL_FALSE;
- }
-
- if (test_GetObjectParameterivAPPLE(GL_BUFFER_OBJECT_APPLE, vbo, GL_FALSE) != GL_TRUE) {
- fprintf(stderr, "Object %x is not set to unpurgeable\n", vbo);
- pass = GL_FALSE;
- }
-
-
- glDeleteBuffersARB(1, &vbo);
- return pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE;
+ glDeleteBuffersARB(1, &vbo);
+ return pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE;
}
diff --git a/tests/general/object_purgeable.c b/tests/general/object_purgeable.c
index 36572df6..1280312f 100644
--- a/tests/general/object_purgeable.c
+++ b/tests/general/object_purgeable.c
@@ -143,3 +143,58 @@ test_GetObjectParameterivAPPLE(GLenum objectType, GLuint name, GLenum expect)
return pass;
}
+
+
+GLboolean test_Purgeable(GLuint object, GLenum type)
+{
+ GLboolean pass = GL_TRUE;
+
+ glGetError();
+
+ if (test_GetObjectParameterivAPPLE(type, object, GL_FALSE) != GL_TRUE) {
+ fprintf(stderr, "Default GL_PURGEABLE_APPLE state should GL_FALSE for texture object\n");
+ pass = GL_FALSE;
+ }
+
+ if (test_ObjectpurgeableAPPLE(type, object, GL_VOLATILE_APPLE) != GL_TRUE) {
+ fprintf(stderr, "Error when mark object %x to purgeable(GL_VOLATILE_APPLE)\n", object);
+ pass = GL_FALSE;
+ }
+
+ if (test_GetObjectParameterivAPPLE(type, object, GL_TRUE) != GL_TRUE) {
+ fprintf(stderr, "Object %x is not set to purgeable\n", object);
+ pass = GL_FALSE;
+ }
+
+ if (test_ObjectunpurgeableAPPLE(type, object, GL_RETAINED_APPLE) != GL_TRUE) {
+ fprintf(stderr, "Error when mark object %x to unpurgeable(GL_RETAINED_APPLE)\n", object);
+ pass = GL_FALSE;
+ }
+
+ if (test_GetObjectParameterivAPPLE(type, object, GL_FALSE) != GL_TRUE) {
+ fprintf(stderr, "Object %x is not set to unpurgeable\n", object);
+ pass = GL_FALSE;
+ }
+
+ if (test_ObjectpurgeableAPPLE(type, object, GL_RELEASED_APPLE) != GL_TRUE) {
+ fprintf(stderr, "Error when mark object %x to purgeable(GL_RELEASED_APPLE)\n", object);
+ pass = GL_FALSE;
+ }
+
+ if (test_GetObjectParameterivAPPLE(type, object, GL_TRUE) != GL_TRUE) {
+ fprintf(stderr, "Object %x is not set to purgeable\n", object);
+ pass = GL_FALSE;
+ }
+
+ if (test_ObjectunpurgeableAPPLE(type, object, GL_UNDEFINED_APPLE) != GL_TRUE) {
+ fprintf(stderr, "Error when mark object %x to unpurgeable(GL_UNDEFINED_APPLE)\n", object);
+ pass = GL_FALSE;
+ }
+
+ if (test_GetObjectParameterivAPPLE(type, object, GL_FALSE) != GL_TRUE) {
+ fprintf(stderr, "Object %x is not set to unpurgeable\n", object);
+ pass = GL_FALSE;
+ }
+
+ return pass;
+}
diff --git a/tests/general/object_purgeable.h b/tests/general/object_purgeable.h
index 804b6c34..8acd85e4 100644
--- a/tests/general/object_purgeable.h
+++ b/tests/general/object_purgeable.h
@@ -67,4 +67,6 @@ extern GLboolean test_ObjectunpurgeableAPPLE(GLenum objectType, GLuint name,
extern GLboolean test_GetObjectParameterivAPPLE(GLenum objectType, GLuint name,
GLenum expect);
+extern GLboolean test_Purgeable(GLuint object, GLenum type);
+
#endif /* OBJECT_PURGEABLE_H */