summaryrefslogtreecommitdiff
path: root/tests/general
diff options
context:
space:
mode:
Diffstat (limited to 'tests/general')
-rw-r--r--tests/general/object_purgeable-api-pbo.c79
-rw-r--r--tests/general/object_purgeable-api-texture.c52
-rw-r--r--tests/general/object_purgeable-api-vbo.c79
3 files changed, 43 insertions, 167 deletions
diff --git a/tests/general/object_purgeable-api-pbo.c b/tests/general/object_purgeable-api-pbo.c
index 4865019a5..e825e6058 100644
--- a/tests/general/object_purgeable-api-pbo.c
+++ b/tests/general/object_purgeable-api-pbo.c
@@ -32,57 +32,34 @@
#include "piglit-util.h"
#include "object_purgeable.h"
-// GL_ARB_vertex_buffer_object GL_ARB_pixel_buffer_object
-static PFNGLBINDBUFFERARBPROC pglBindBufferARB = NULL;
-static PFNGLDELETEBUFFERSARBPROC pglDeleteBuffersARB = NULL;
-static PFNGLGENBUFFERSARBPROC pglGenBuffersARB = NULL;
-static PFNGLBUFFERDATAARBPROC pglBufferDataARB = NULL;
+int piglit_width = 100, piglit_height = 100;
+int piglit_window_mode = GLUT_RGB;
-
-static GLboolean Automatic = GL_FALSE;
-
-static void
-init(void)
+void
+piglit_init(int argc, char **argv)
{
+ (void) argc;
+ (void) argv;
+
init_ObjectPurgeableAPI();
+ piglit_automatic = GL_TRUE;
piglit_require_extension("GL_ARB_pixel_buffer_object");
-
- pglGenBuffersARB = (PFNGLGENBUFFERSARBPROC) piglit_get_proc_address("glGenBuffersARB");
- pglBindBufferARB = (PFNGLBINDBUFFERARBPROC) piglit_get_proc_address("glBindBufferARB");
- pglDeleteBuffersARB = (PFNGLDELETEBUFFERSARBPROC) piglit_get_proc_address("glDeleteBuffersARB");
- pglBufferDataARB = (PFNGLBUFFERDATAARBPROC) piglit_get_proc_address("glBufferDataARB");
-
- glClearColor(0.1, 0.1, 0.3, 0.0);
}
-static void
-reshape(int width, int height)
-{
- glViewport(0, 0, (GLint) width, (GLint) height);
-
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
- glMatrixMode(GL_MODELVIEW);
-}
-
-
-static void
-display(void)
+enum piglit_result
+piglit_display(void)
{
GLuint pbo;
GLboolean pass = GL_TRUE;
- glClear(GL_COLOR_BUFFER_BIT);
-
glGetError();
- (*pglGenBuffersARB)(1, &pbo);
- (*pglBindBufferARB)(GL_PIXEL_PACK_BUFFER_ARB, pbo);
- (*pglBufferDataARB)(GL_PIXEL_PACK_BUFFER_ARB, 100*100, NULL, GL_STATIC_DRAW_ARB);
- (*pglBindBufferARB)(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);
if (test_GetObjectParameterivAPPLE(GL_BUFFER_OBJECT_APPLE, pbo, GL_FALSE) != GL_TRUE) {
@@ -131,30 +108,6 @@ display(void)
}
- (*pglDeleteBuffersARB)(1, &pbo);
-
-
- if (Automatic)
- piglit_report_result(pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE);
-}
-
-
-int main(int argc, char **argv)
-{
- glutInit(&argc, argv);
-
- if (argc == 2 && !strcmp(argv[1], "-auto"))
- Automatic = GL_TRUE;
-
- glutInitWindowSize(400, 300);
- glutInitDisplayMode(GLUT_RGB);
- glutCreateWindow("GL_APPLE_object_purgeable API test with GL_ARB_pixel_buffer_object");
- glutReshapeFunc(reshape);
- glutKeyboardFunc(piglit_escape_exit_key);
- glutDisplayFunc(display);
-
- init();
-
- glutMainLoop();
- return 0;
+ 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 a01814a83..34b3dcff2 100644
--- a/tests/general/object_purgeable-api-texture.c
+++ b/tests/general/object_purgeable-api-texture.c
@@ -32,34 +32,26 @@
#include "piglit-util.h"
#include "object_purgeable.h"
-static GLboolean Automatic = GL_FALSE;
+int piglit_width = 100, piglit_height = 100;
+int piglit_window_mode = GLUT_RGB;
-static void
-init(void)
+void
+piglit_init(int argc, char **argv)
{
- init_ObjectPurgeableAPI();
-}
+ (void) argc;
+ (void) argv;
-
-static void
-reshape(int width, int height)
-{
- glViewport(0, 0, (GLint) width, (GLint) height);
-
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
- glMatrixMode(GL_MODELVIEW);
+ init_ObjectPurgeableAPI();
+ piglit_automatic = GL_TRUE;
}
-static void
-display(void)
+enum piglit_result
+piglit_display(void)
{
GLuint texture;
GLboolean pass = GL_TRUE;
- glClear(GL_COLOR_BUFFER_BIT);
glGenTextures(1, &texture);
glBindTexture(GL_TEXTURE_2D, texture);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 100, 100, 0, GL_RGB, GL_INT, NULL);
@@ -113,27 +105,5 @@ display(void)
glDeleteTextures(1, &texture);
- if (Automatic)
- piglit_report_result(pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE);
-}
-
-
-int main(int argc, char **argv)
-{
- glutInit(&argc, argv);
-
- if (argc == 2 && !strcmp(argv[1], "-auto"))
- Automatic = GL_TRUE;
-
- glutInitWindowSize(400, 300);
- glutInitDisplayMode(GLUT_RGB);
- glutCreateWindow("GL_APPLE_object_purgeable API test with texture object");
- glutReshapeFunc(reshape);
- glutKeyboardFunc(piglit_escape_exit_key);
- glutDisplayFunc(display);
-
- init();
-
- glutMainLoop();
- return 0;
+ 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 10af569ca..e300b9d0b 100644
--- a/tests/general/object_purgeable-api-vbo.c
+++ b/tests/general/object_purgeable-api-vbo.c
@@ -32,57 +32,34 @@
#include "piglit-util.h"
#include "object_purgeable.h"
-// GL_ARB_vertex_buffer_object GL_ARB_pixel_buffer_object
-static PFNGLBINDBUFFERARBPROC pglBindBufferARB = NULL;
-static PFNGLDELETEBUFFERSARBPROC pglDeleteBuffersARB = NULL;
-static PFNGLGENBUFFERSARBPROC pglGenBuffersARB = NULL;
-static PFNGLBUFFERDATAARBPROC pglBufferDataARB = NULL;
+int piglit_width = 100, piglit_height = 100;
+int piglit_window_mode = GLUT_RGB;
-
-static GLboolean Automatic = GL_FALSE;
-
-static void
-init(void)
+void
+piglit_init(int argc, char **argv)
{
+ (void) argc;
+ (void) argv;
+
init_ObjectPurgeableAPI();
+ piglit_automatic = GL_TRUE;
piglit_require_extension("GL_ARB_vertex_buffer_object");
-
- pglGenBuffersARB = (PFNGLGENBUFFERSARBPROC) piglit_get_proc_address("glGenBuffersARB");
- pglBindBufferARB = (PFNGLBINDBUFFERARBPROC) piglit_get_proc_address("glBindBufferARB");
- pglDeleteBuffersARB = (PFNGLDELETEBUFFERSARBPROC) piglit_get_proc_address("glDeleteBuffersARB");
- pglBufferDataARB = (PFNGLBUFFERDATAARBPROC) piglit_get_proc_address("glBufferDataARB");
-
- glClearColor(0.1, 0.1, 0.3, 0.0);
}
-static void
-reshape(int width, int height)
-{
- glViewport(0, 0, (GLint) width, (GLint) height);
-
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
- glMatrixMode(GL_MODELVIEW);
-}
-
-
-static void
-display(void)
+enum piglit_result
+piglit_display(void)
{
GLuint vbo;
GLboolean pass = GL_TRUE;
- glClear(GL_COLOR_BUFFER_BIT);
-
glGetError();
- (*pglGenBuffersARB)(1, &vbo);
- (*pglBindBufferARB)(GL_ARRAY_BUFFER_ARB, vbo);
- (*pglBufferDataARB)(GL_ARRAY_BUFFER_ARB, 100*100, NULL, GL_STATIC_DRAW_ARB);
- (*pglBindBufferARB)(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);
if (test_GetObjectParameterivAPPLE(GL_BUFFER_OBJECT_APPLE, vbo, GL_FALSE) != GL_TRUE) {
@@ -131,30 +108,6 @@ display(void)
}
- (*pglDeleteBuffersARB)(1, &vbo);
-
-
- if (Automatic)
- piglit_report_result(pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE);
-}
-
-
-int main(int argc, char **argv)
-{
- glutInit(&argc, argv);
-
- if (argc == 2 && !strcmp(argv[1], "-auto"))
- Automatic = GL_TRUE;
-
- glutInitWindowSize(400, 300);
- glutInitDisplayMode(GLUT_RGB);
- glutCreateWindow("GL_APPLE_object_purgeable API test with GL_ARB_vertex_buffer_object");
- glutReshapeFunc(reshape);
- glutKeyboardFunc(piglit_escape_exit_key);
- glutDisplayFunc(display);
-
- init();
-
- glutMainLoop();
- return 0;
+ glDeleteBuffersARB(1, &vbo);
+ return pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE;
}