diff options
author | José Fonseca <jfonseca@vmware.com> | 2010-02-11 16:32:23 +0000 |
---|---|---|
committer | José Fonseca <jfonseca@vmware.com> | 2010-02-11 16:38:13 +0000 |
commit | 7fec5f88a50ffa95a818f730c4ff91a6adf4a79e (patch) | |
tree | 3ac91deaf0d1058f36269bfa62ba71200d3f776a | |
parent | 67007670bb0fec76ea9a69839c4caf337fb8bf1e (diff) |
wgl: Fail gracefully whenever 3D could not be enabled for some reason.
-rw-r--r-- | src/gallium/state_trackers/wgl/stw_context.c | 6 | ||||
-rw-r--r-- | src/gallium/state_trackers/wgl/stw_framebuffer.c | 17 | ||||
-rw-r--r-- | src/gallium/state_trackers/wgl/stw_getprocaddress.c | 5 | ||||
-rw-r--r-- | src/gallium/state_trackers/wgl/stw_pixelformat.c | 3 |
4 files changed, 30 insertions, 1 deletions
diff --git a/src/gallium/state_trackers/wgl/stw_context.c b/src/gallium/state_trackers/wgl/stw_context.c index f2f0264844..6f74204163 100644 --- a/src/gallium/state_trackers/wgl/stw_context.c +++ b/src/gallium/state_trackers/wgl/stw_context.c @@ -80,6 +80,9 @@ DrvCopyContext( struct stw_context *dst; BOOL ret = FALSE; + if (!stw_dev) + return FALSE; + pipe_mutex_lock( stw_dev->ctx_mutex ); src = stw_lookup_context_locked( dhrcSource ); @@ -107,6 +110,9 @@ DrvShareLists( struct stw_context *ctx2; BOOL ret = FALSE; + if (!stw_dev) + return FALSE; + pipe_mutex_lock( stw_dev->ctx_mutex ); ctx1 = stw_lookup_context_locked( dhglrc1 ); diff --git a/src/gallium/state_trackers/wgl/stw_framebuffer.c b/src/gallium/state_trackers/wgl/stw_framebuffer.c index 6d09501981..162f827648 100644 --- a/src/gallium/state_trackers/wgl/stw_framebuffer.c +++ b/src/gallium/state_trackers/wgl/stw_framebuffer.c @@ -178,7 +178,7 @@ stw_call_window_proc( if(!tls_data) return 0; - if (nCode < 0) + if (nCode < 0 || !stw_dev) return CallNextHookEx(tls_data->hCallWndProcHook, nCode, wParam, lParam); if (pParams->message == WM_WINDOWPOSCHANGED) { @@ -333,6 +333,9 @@ stw_framebuffer_cleanup( void ) struct stw_framebuffer *fb; struct stw_framebuffer *next; + if (!stw_dev) + return; + pipe_mutex_lock( stw_dev->fb_mutex ); fb = stw_dev->fb_head; @@ -388,6 +391,9 @@ stw_framebuffer_from_hdc( { struct stw_framebuffer *fb; + if (!stw_dev) + return NULL; + pipe_mutex_lock( stw_dev->fb_mutex ); fb = stw_framebuffer_from_hdc_locked(hdc); pipe_mutex_unlock( stw_dev->fb_mutex ); @@ -422,6 +428,9 @@ DrvSetPixelFormat( uint index; struct stw_framebuffer *fb; + if (!stw_dev) + return FALSE; + index = (uint) iPixelFormat - 1; count = stw_pixelformat_get_extended_count(); if (index >= count) @@ -476,6 +485,9 @@ DrvPresentBuffers(HDC hdc, PGLPRESENTBUFFERSDATA data) struct pipe_screen *screen; struct pipe_surface *surface; + if (!stw_dev) + return FALSE; + fb = stw_framebuffer_from_hdc( hdc ); if (fb == NULL) return FALSE; @@ -577,6 +589,9 @@ DrvSwapBuffers( struct stw_framebuffer *fb; struct pipe_surface *surface = NULL; + if (!stw_dev) + return FALSE; + fb = stw_framebuffer_from_hdc( hdc ); if (fb == NULL) return FALSE; diff --git a/src/gallium/state_trackers/wgl/stw_getprocaddress.c b/src/gallium/state_trackers/wgl/stw_getprocaddress.c index 8875dc22f3..d43a55fa9e 100644 --- a/src/gallium/state_trackers/wgl/stw_getprocaddress.c +++ b/src/gallium/state_trackers/wgl/stw_getprocaddress.c @@ -34,6 +34,8 @@ #include "glapi/glapi.h" #include "stw_ext_gallium.h" +#include "stw_device.h" +#include "stw_icd.h" struct stw_extension_entry { @@ -73,6 +75,9 @@ DrvGetProcAddress( { const struct stw_extension_entry *entry; + if (!stw_dev) + return NULL; + if (lpszProc[0] == 'w' && lpszProc[1] == 'g' && lpszProc[2] == 'l') for (entry = stw_extension_entries; entry->name; entry++) if (strcmp( lpszProc, entry->name ) == 0) diff --git a/src/gallium/state_trackers/wgl/stw_pixelformat.c b/src/gallium/state_trackers/wgl/stw_pixelformat.c index 95e1957e07..b88f936aec 100644 --- a/src/gallium/state_trackers/wgl/stw_pixelformat.c +++ b/src/gallium/state_trackers/wgl/stw_pixelformat.c @@ -303,6 +303,9 @@ DrvDescribePixelFormat( (void) hdc; + if (!stw_dev) + return 0; + count = stw_pixelformat_get_extended_count(); index = (uint) iPixelFormat - 1; |