summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorJosé Fonseca <[email protected]>2010-02-11 16:32:23 +0000
committerJosé Fonseca <[email protected]>2010-02-12 11:39:58 +0000
commite6b66210def2c10f703c2a990b9652ea5419ebbe (patch)
treeb97d5e85560ed3e967f29a5bf19d55de75237324 /src/gallium
parentea8f7bd2e40dc69dbde079a29c169c5371244aef (diff)
wgl: Fail gracefully whenever 3D could not be enabled for some reason.
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/state_trackers/wgl/stw_context.c6
-rw-r--r--src/gallium/state_trackers/wgl/stw_framebuffer.c17
-rw-r--r--src/gallium/state_trackers/wgl/stw_getprocaddress.c5
-rw-r--r--src/gallium/state_trackers/wgl/stw_pixelformat.c3
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 0785d2c6b85..c2f9c7550ed 100644
--- a/src/gallium/state_trackers/wgl/stw_context.c
+++ b/src/gallium/state_trackers/wgl/stw_context.c
@@ -75,6 +75,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 );
@@ -102,6 +105,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 129a6298a77..02de21ccb2b 100644
--- a/src/gallium/state_trackers/wgl/stw_framebuffer.c
+++ b/src/gallium/state_trackers/wgl/stw_framebuffer.c
@@ -179,7 +179,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) {
@@ -332,6 +332,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;
@@ -387,6 +390,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 );
@@ -421,6 +427,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)
@@ -475,6 +484,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;
@@ -576,6 +588,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 8875dc22f3d..d43a55fa9e6 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 7d4c2430b0c..b750b03695f 100644
--- a/src/gallium/state_trackers/wgl/stw_pixelformat.c
+++ b/src/gallium/state_trackers/wgl/stw_pixelformat.c
@@ -302,6 +302,9 @@ DrvDescribePixelFormat(
(void) hdc;
+ if (!stw_dev)
+ return 0;
+
count = stw_pixelformat_get_extended_count();
index = (uint) iPixelFormat - 1;