/* Initialise gloffscreen */
void glo_init(void) {
+ fprintf(stdout, "[rla1957]glo_init() in gloffscreen_glx.c\n");
if (glo_inited) {
printf( "gloffscreen already inited\n" );
exit( EXIT_FAILURE );
bufferAttributes, &numReturned );
if (numReturned==0) {
printf( "No matching configs found.\n" );
- exit( EXIT_FAILURE );
+ //exit( EXIT_FAILURE );
+ return NULL;
}
context = (GloContext*)qemu_malloc(sizeof(GloContext));
memset(context, 0, sizeof(GloContext));
if (!context->context) {
printf( "glXCreateNewContext failed\n" );
- exit( EXIT_FAILURE );
+ //exit( EXIT_FAILURE );
+ return NULL;
}
return context;
GloSurface *glo_surface_create(int width, int height, GloContext *context) {
GloSurface *surface;
- if (!context) return 0;
+ if (!context)
+ return NULL;
surface = (GloSurface*)qemu_malloc(sizeof(GloSurface));
memset(surface, 0, sizeof(GloSurface));
if (!surface->xPixmap) {
printf( "XCreatePixmap failed\n" );
- exit( EXIT_FAILURE );
+ //exit( EXIT_FAILURE );
+ return NULL;
}
/* Create a GLX window to associate the frame buffer configuration
surface->glxPixmap = glXCreatePixmap( glo.dpy, context->fbConfig, surface->xPixmap, NULL );
if (!surface->glxPixmap) {
printf( "glXCreatePixmap failed\n" );
- exit( EXIT_FAILURE );
+ //exit( EXIT_FAILURE );
+ return NULL;
}
// If we're using XImages to pull the data from the graphics card...
int glFormat, glType;
if (glo_sanity_test () != 0) {
- // test failed.
- return 1;
+ printf ("glo_sanity_test() failed.\n");
+ test_failure = 1;
+ goto TEST_END;
}
memset(datain_flip, 0, TX*TY*4);
memcpy(&datain_flip[((TY-1)-y)*bpp*TX], &datain[y*bpp*TX], bpp*TX);
}
- glo_init();
+ if (glo_init() != 0) {
+ printf ("glo_init() failed.\n");
+ test_failure = 1;
+ goto TEST_END;
+ }
+
// new surface
context = glo_context_create(bufferFlags, 0);
+ if (context == NULL) {
+ printf ("glo_context_create() failed.\n");
+ test_failure = 1;
+ goto TEST_END;
+ }
+
surface = glo_surface_create(TX, TY, context);
- glo_surface_makecurrent(surface);
+ if (surface == NULL) {
+ printf ("glo_surface_create() failed.\n");
+ test_failure = 1;
+ goto TEST_END;
+ }
+
+ if (!glo_surface_makecurrent(surface)) {
+ printf ("glo_surface_makecurrent() failed.\n");
+ test_failure = 1;
+ goto TEST_END;
+ }
+
printf("GL VENDOR %s\n", glGetString(GL_VENDOR));
printf("GL RENDERER %s\n", glGetString(GL_RENDERER));
printf("GL VERSION %s\n", glGetString(GL_VERSION));
wglChoosePixelFormatARB( glo.hDC, pf_attri, pf_attrf, 1, &context->wglPixelFormat, &numReturned);
if( numReturned == 0 ) {
printf( "No matching configs found.\n" );
- exit( EXIT_FAILURE );
+ //exit( EXIT_FAILURE );
+ return NULL;
}
// We create a tiny pbuffer - just so we can make a context of the right pixel format
16, 16, pb_attr );
if( !context->hPBuffer ) {
printf( "Couldn't create the PBuffer\n" );
- exit( EXIT_FAILURE );
+ //exit( EXIT_FAILURE );
+ return NULL;
}
context->hDC = wglGetPbufferDCARB( context->hPBuffer );
if( !context->hDC ) {
printf( "Couldn't create the DC\n" );
- exit( EXIT_FAILURE );
+ //exit( EXIT_FAILURE );
+ return NULL;
}
context->hContext = wglCreateContext(context->hDC);
if (context->hContext == NULL) {
printf( "Unable to create GL context\n" );
- exit( EXIT_FAILURE );
+ //exit( EXIT_FAILURE );
+ return NULL;
}
if (shareLists) {
surface->width, surface->height, pb_attr );
if( !surface->hPBuffer ) {
printf( "Couldn't create the PBuffer\n" );
- exit( EXIT_FAILURE );
+ //exit( EXIT_FAILURE );
+ return NULL;
}
surface->hDC = wglGetPbufferDCARB( surface->hPBuffer );
if( !surface->hDC ) {
printf( "Couldn't create the DC\n" );
- exit( EXIT_FAILURE );
+ //exit( EXIT_FAILURE );
+ return NULL;
}
return surface;
/* Initialise gloffscreen */
void glo_init(void) {
+ fprintf(stdout, "[rla1957]glo_init() in gloffscreen_xcomposite.c\n");
if (glo_inited) {
printf( "gloffscreen already inited\n" );
exit( EXIT_FAILURE );
bufferAttributes, &numReturned );
if (numReturned==0) {
printf( "No matching configs found.\n" );
- exit( EXIT_FAILURE );
+ //exit( EXIT_FAILURE );
+ return NULL;
}
context = (GloContext*)g_malloc(sizeof(GloContext));
memset(context, 0, sizeof(GloContext));
if (!context->context) {
printf( "glXCreateNewContext failed\n" );
- exit( EXIT_FAILURE );
+ //exit( EXIT_FAILURE );
+ return NULL;
}
return context;
XVisualInfo *vis;
if (!context)
- return 0;
+ return NULL;
surface = (GloSurface*)g_malloc(sizeof(GloSurface));
memset(surface, 0, sizeof(GloSurface));
surface->context = context;
vis = glXGetVisualFromFBConfig(glo.dpy, ((struct _GloContext*)context)->fbConfig);
+ if (vis == NULL)
+ return NULL;
attr.background_pixel = 0xff000000;
attr.border_pixel = 0;
if (!surface->window) {
printf( "XCreateWindow failed\n" );
- exit( EXIT_FAILURE );
+ //exit( EXIT_FAILURE );
+ return NULL;
}
XMapWindow(glo.dpy, surface->window);
if(surface->pixmap == 0) {
fprintf(stderr, "Failed to allocate pixmap!\n");
- exit(EXIT_FAILURE);
+ //exit(EXIT_FAILURE);
+ return NULL;
}
XSync(glo.dpy, 0);
CASE_OUT_POINTERS:
{
- /* It seems that we never experience NULL out pointers!!! */
- if (args_size == 0 && func_number != 4) // FIXMEIM - hack for now
- return 0;
-
- if(*(int*)argptr) {
+ /* NULL pointer is used as output pointer
+ since the argument size is zero. */
+ if (args_size == 0) {
+ *(int*)r_buffer = 0;
+ r_buffer += 4;
+ args[i] = NULL;
+ } else if(*(int*)argptr) {
*(int*)r_buffer = args_size;
r_buffer+=4;
args[i] = (host_ptr)r_buffer;