wgl: Fail gracefully whenever 3D could not be enabled for some reason.

This commit is contained in:
José Fonseca 2010-02-11 16:32:23 +00:00
parent ea8f7bd2e4
commit e6b66210de
4 changed files with 30 additions and 1 deletions

View file

@ -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 );

View file

@ -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;

View file

@ -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)

View file

@ -302,6 +302,9 @@ DrvDescribePixelFormat(
(void) hdc;
if (!stw_dev)
return 0;
count = stw_pixelformat_get_extended_count();
index = (uint) iPixelFormat - 1;