[Type] Bug fix.
[Module] qemu / opengl-es
[Priority]
[CQ#]
[Redmine#]
[Problem]
[Cause]
[Solution]
[TestCase]
extern int glo_initialised(void);
/* Initialise gloffscreen */
-extern void glo_init(void);
+extern int glo_init(void);
/* Uninitialise gloffscreen */
extern void glo_kill(void);
}
/* Initialise gloffscreen */
-void glo_init(void) {
+int glo_init(void) {
if (glo_inited) {
printf( "gloffscreen already inited\n" );
- exit( EXIT_FAILURE );
+ //exit( EXIT_FAILURE );
+ return 1;
}
/* Open a connection to the X server */
glo.dpy = XOpenDisplay( NULL );
if ( glo.dpy == NULL ) {
printf( "Unable to open a connection to the X server\n" );
- exit( EXIT_FAILURE );
+ //exit( EXIT_FAILURE );
+ return 1;
}
glo_inited = 1;
glo_test_readback_methods();
+
+ return 0;
}
/* Uninitialise gloffscreen */
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;
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...
}
/* Initialise gloffscreen */
-void glo_init(void) {
+int glo_init(void) {
WNDCLASSEX wcx;
PIXELFORMATDESCRIPTOR pfd;
if (glo_inited) {
printf( "gloffscreen already inited\n" );
- exit( EXIT_FAILURE );
+ //exit( EXIT_FAILURE );
+ return 1;
}
glo.hInstance = GetModuleHandle(NULL); // Grab An Instance For Our Window
if (!glo.hWnd) {
printf( "Unable to create window\n" );
- exit( EXIT_FAILURE );
+ //exit( EXIT_FAILURE );
+ return 1;
}
glo.hDC = GetDC(glo.hWnd);
unsigned int pixelFormat = ChoosePixelFormat(glo.hDC, &pfd);
DescribePixelFormat(glo.hDC, pixelFormat, sizeof(PIXELFORMATDESCRIPTOR), &pfd);
if (!SetPixelFormat(glo.hDC, pixelFormat, &pfd))
- return;
+ return 1;
glo.hContext = wglCreateContext(glo.hDC);
if (glo.hContext == NULL) {
printf( "Unable to create GL context\n" );
- exit( EXIT_FAILURE );
+ //exit( EXIT_FAILURE );
+ return 1;
}
wglMakeCurrent(glo.hDC, glo.hContext);
!wglCreatePbufferARB ||
!wglDestroyPbufferARB) {
printf( "Unable to load the required WGL extensions\n" );
- exit( EXIT_FAILURE );
+ //exit( EXIT_FAILURE );
+ return 1;
}
glo_inited = 1;
+
+ return 0
}
/* Uninitialise gloffscreen */
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) {
+int glo_init(void) {
if (glo_inited) {
printf( "gloffscreen already inited\n" );
- exit( EXIT_FAILURE );
+ //exit( EXIT_FAILURE );
+ return 1;
}
/* Open a connection to the X server */
glo.dpy = XOpenDisplay( NULL );
if ( glo.dpy == NULL ) {
printf( "Unable to open a connection to the X server\n" );
- exit( EXIT_FAILURE );
+ //exit( EXIT_FAILURE );
+ return 1;
}
glo_inited = 1; // safe because we are single threaded. Otherwise we cause
// set the X error handler.
XErrorHandler old_handler = XSetErrorHandler (x_errhandler);
glo_test_readback_methods();
+ return 0;
}
/* Uninitialise gloffscreen */
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;
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);