winex11: Define an enum to manage the various types of GL device contexts.
This commit is contained in:
parent
1b76949d69
commit
a708448725
|
@ -353,13 +353,14 @@ static INT X11DRV_ExtEscape( PHYSDEV dev, INT escape, INT in_count, LPCVOID in_d
|
||||||
physDev->current_pf = pixelformat_from_fbconfig_id( data->fbconfig_id );
|
physDev->current_pf = pixelformat_from_fbconfig_id( data->fbconfig_id );
|
||||||
physDev->gl_drawable = data->gl_drawable;
|
physDev->gl_drawable = data->gl_drawable;
|
||||||
physDev->pixmap = data->pixmap;
|
physDev->pixmap = data->pixmap;
|
||||||
physDev->gl_copy = data->gl_copy;
|
physDev->gl_type = data->gl_type;
|
||||||
wine_tsx11_lock();
|
wine_tsx11_lock();
|
||||||
XSetSubwindowMode( gdi_display, physDev->gc, data->mode );
|
XSetSubwindowMode( gdi_display, physDev->gc, data->mode );
|
||||||
wine_tsx11_unlock();
|
wine_tsx11_unlock();
|
||||||
TRACE( "SET_DRAWABLE hdc %p drawable %lx gl_drawable %lx pf %u dc_rect %s drawable_rect %s\n",
|
TRACE( "SET_DRAWABLE hdc %p drawable %lx gl_drawable %lx pf %u gl %u dc_rect %s drawable_rect %s\n",
|
||||||
dev->hdc, physDev->drawable, physDev->gl_drawable, physDev->current_pf,
|
dev->hdc, physDev->drawable, physDev->gl_drawable, physDev->current_pf,
|
||||||
wine_dbgstr_rect(&physDev->dc_rect), wine_dbgstr_rect(&physDev->drawable_rect) );
|
physDev->gl_type, wine_dbgstr_rect(&physDev->dc_rect),
|
||||||
|
wine_dbgstr_rect(&physDev->drawable_rect) );
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -1624,6 +1624,7 @@ static BOOL internal_SetPixelFormat(X11DRV_PDEVICE *physDev,
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
physDev->current_pf = iPixelFormat;
|
physDev->current_pf = iPixelFormat;
|
||||||
|
physDev->gl_type = DC_GL_BITMAP;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
FIXME("called on a non-window, non-bitmap object?\n");
|
FIXME("called on a non-window, non-bitmap object?\n");
|
||||||
|
@ -1839,7 +1840,6 @@ BOOL X11DRV_wglMakeCurrent(PHYSDEV dev, HGLRC hglrc)
|
||||||
X11DRV_PDEVICE *physDev = get_x11drv_dev( dev );
|
X11DRV_PDEVICE *physDev = get_x11drv_dev( dev );
|
||||||
BOOL ret;
|
BOOL ret;
|
||||||
HDC hdc = dev->hdc;
|
HDC hdc = dev->hdc;
|
||||||
DWORD type = GetObjectType(hdc);
|
|
||||||
Wine_GLContext *ctx = (Wine_GLContext *) hglrc;
|
Wine_GLContext *ctx = (Wine_GLContext *) hglrc;
|
||||||
|
|
||||||
TRACE("(%p,%p)\n", hdc, hglrc);
|
TRACE("(%p,%p)\n", hdc, hglrc);
|
||||||
|
@ -1894,7 +1894,7 @@ BOOL X11DRV_wglMakeCurrent(PHYSDEV dev, HGLRC hglrc)
|
||||||
ctx->drawables[1] = physDev->gl_drawable;
|
ctx->drawables[1] = physDev->gl_drawable;
|
||||||
ctx->refresh_drawables = FALSE;
|
ctx->refresh_drawables = FALSE;
|
||||||
|
|
||||||
if (type == OBJ_MEMDC) pglDrawBuffer(GL_FRONT_LEFT);
|
if (physDev->gl_type == DC_GL_BITMAP) pglDrawBuffer(GL_FRONT_LEFT);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
SetLastError(ERROR_INVALID_HANDLE);
|
SetLastError(ERROR_INVALID_HANDLE);
|
||||||
|
@ -2200,19 +2200,19 @@ static void WINAPI X11DRV_wglGetIntegerv(GLenum pname, GLint* params)
|
||||||
|
|
||||||
void flush_gl_drawable(X11DRV_PDEVICE *physDev)
|
void flush_gl_drawable(X11DRV_PDEVICE *physDev)
|
||||||
{
|
{
|
||||||
int w, h;
|
|
||||||
RECT rect;
|
RECT rect;
|
||||||
|
int w = physDev->dc_rect.right - physDev->dc_rect.left;
|
||||||
|
int h = physDev->dc_rect.bottom - physDev->dc_rect.top;
|
||||||
|
Drawable src = physDev->gl_drawable;
|
||||||
|
|
||||||
if (!physDev->gl_copy || !physDev->gl_drawable)
|
if (w <= 0 || h <= 0) return;
|
||||||
return;
|
|
||||||
|
|
||||||
w = physDev->dc_rect.right - physDev->dc_rect.left;
|
|
||||||
h = physDev->dc_rect.bottom - physDev->dc_rect.top;
|
|
||||||
|
|
||||||
if(w > 0 && h > 0) {
|
|
||||||
Drawable src = physDev->pixmap;
|
|
||||||
if(!src) src = physDev->gl_drawable;
|
|
||||||
|
|
||||||
|
switch (physDev->gl_type)
|
||||||
|
{
|
||||||
|
case DC_GL_PIXMAP_WIN:
|
||||||
|
src = physDev->pixmap;
|
||||||
|
/* fall through */
|
||||||
|
case DC_GL_CHILD_WIN:
|
||||||
/* The GL drawable may be lagged behind if we don't flush first, so
|
/* The GL drawable may be lagged behind if we don't flush first, so
|
||||||
* flush the display make sure we copy up-to-date data */
|
* flush the display make sure we copy up-to-date data */
|
||||||
wine_tsx11_lock();
|
wine_tsx11_lock();
|
||||||
|
@ -2223,6 +2223,8 @@ void flush_gl_drawable(X11DRV_PDEVICE *physDev)
|
||||||
wine_tsx11_unlock();
|
wine_tsx11_unlock();
|
||||||
SetRect( &rect, 0, 0, w, h );
|
SetRect( &rect, 0, 0, w, h );
|
||||||
add_device_bounds( physDev, &rect );
|
add_device_bounds( physDev, &rect );
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2622,6 +2624,7 @@ HDC X11DRV_wglGetPbufferDCARB(PHYSDEV dev, HPBUFFERARB hPbuffer)
|
||||||
physDev->current_pf = object->fmt->iPixelFormat;
|
physDev->current_pf = object->fmt->iPixelFormat;
|
||||||
physDev->drawable = object->drawable;
|
physDev->drawable = object->drawable;
|
||||||
physDev->gl_drawable = object->drawable;
|
physDev->gl_drawable = object->drawable;
|
||||||
|
physDev->gl_type = DC_GL_PBUFFER;
|
||||||
SetRect( &physDev->drawable_rect, 0, 0, object->width, object->height );
|
SetRect( &physDev->drawable_rect, 0, 0, object->width, object->height );
|
||||||
physDev->dc_rect = physDev->drawable_rect;
|
physDev->dc_rect = physDev->drawable_rect;
|
||||||
|
|
||||||
|
@ -3756,7 +3759,9 @@ BOOL X11DRV_SwapBuffers(PHYSDEV dev)
|
||||||
|
|
||||||
wine_tsx11_lock();
|
wine_tsx11_lock();
|
||||||
sync_context(ctx);
|
sync_context(ctx);
|
||||||
if(physDev->pixmap) {
|
switch (physDev->gl_type)
|
||||||
|
{
|
||||||
|
case DC_GL_PIXMAP_WIN:
|
||||||
if(pglXCopySubBufferMESA) {
|
if(pglXCopySubBufferMESA) {
|
||||||
int w = physDev->dc_rect.right - physDev->dc_rect.left;
|
int w = physDev->dc_rect.right - physDev->dc_rect.left;
|
||||||
int h = physDev->dc_rect.bottom - physDev->dc_rect.top;
|
int h = physDev->dc_rect.bottom - physDev->dc_rect.top;
|
||||||
|
@ -3767,12 +3772,13 @@ BOOL X11DRV_SwapBuffers(PHYSDEV dev)
|
||||||
pglFlush();
|
pglFlush();
|
||||||
if(w > 0 && h > 0)
|
if(w > 0 && h > 0)
|
||||||
pglXCopySubBufferMESA(gdi_display, physDev->gl_drawable, 0, 0, w, h);
|
pglXCopySubBufferMESA(gdi_display, physDev->gl_drawable, 0, 0, w, h);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
else
|
/* fall through */
|
||||||
pglXSwapBuffers(gdi_display, physDev->gl_drawable);
|
default:
|
||||||
}
|
|
||||||
else
|
|
||||||
pglXSwapBuffers(gdi_display, physDev->gl_drawable);
|
pglXSwapBuffers(gdi_display, physDev->gl_drawable);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
flush_gl_drawable(physDev);
|
flush_gl_drawable(physDev);
|
||||||
wine_tsx11_unlock();
|
wine_tsx11_unlock();
|
||||||
|
|
|
@ -2267,7 +2267,7 @@ void CDECL X11DRV_GetDC( HDC hdc, HWND hwnd, HWND top, const RECT *win_rect,
|
||||||
escape.fbconfig_id = 0;
|
escape.fbconfig_id = 0;
|
||||||
escape.gl_drawable = 0;
|
escape.gl_drawable = 0;
|
||||||
escape.pixmap = 0;
|
escape.pixmap = 0;
|
||||||
escape.gl_copy = FALSE;
|
escape.gl_type = DC_GL_NONE;
|
||||||
|
|
||||||
escape.dc_rect.left = win_rect->left - top_rect->left;
|
escape.dc_rect.left = win_rect->left - top_rect->left;
|
||||||
escape.dc_rect.top = win_rect->top - top_rect->top;
|
escape.dc_rect.top = win_rect->top - top_rect->top;
|
||||||
|
@ -2289,6 +2289,7 @@ void CDECL X11DRV_GetDC( HDC hdc, HWND hwnd, HWND top, const RECT *win_rect,
|
||||||
else
|
else
|
||||||
escape.drawable = escape.gl_drawable;
|
escape.drawable = escape.gl_drawable;
|
||||||
|
|
||||||
|
if (escape.gl_drawable) escape.gl_type = DC_GL_WINDOW;
|
||||||
/* special case: when repainting the root window, clip out top-level windows */
|
/* special case: when repainting the root window, clip out top-level windows */
|
||||||
if (data && data->whole_window == root_window) escape.mode = ClipByChildren;
|
if (data && data->whole_window == root_window) escape.mode = ClipByChildren;
|
||||||
}
|
}
|
||||||
|
@ -2310,7 +2311,7 @@ void CDECL X11DRV_GetDC( HDC hdc, HWND hwnd, HWND top, const RECT *win_rect,
|
||||||
escape.fbconfig_id = data ? data->fbconfig_id : (XID)GetPropA( hwnd, fbconfig_id_prop );
|
escape.fbconfig_id = data ? data->fbconfig_id : (XID)GetPropA( hwnd, fbconfig_id_prop );
|
||||||
escape.gl_drawable = data ? data->gl_drawable : (Drawable)GetPropA( hwnd, gl_drawable_prop );
|
escape.gl_drawable = data ? data->gl_drawable : (Drawable)GetPropA( hwnd, gl_drawable_prop );
|
||||||
escape.pixmap = data ? data->pixmap : (Pixmap)GetPropA( hwnd, pixmap_prop );
|
escape.pixmap = data ? data->pixmap : (Pixmap)GetPropA( hwnd, pixmap_prop );
|
||||||
escape.gl_copy = (escape.gl_drawable != 0);
|
if (escape.gl_drawable) escape.gl_type = escape.pixmap ? DC_GL_PIXMAP_WIN : DC_GL_CHILD_WIN;
|
||||||
if (flags & DCX_CLIPCHILDREN) escape.mode = ClipByChildren;
|
if (flags & DCX_CLIPCHILDREN) escape.mode = ClipByChildren;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2335,6 +2336,7 @@ void CDECL X11DRV_ReleaseDC( HWND hwnd, HDC hdc )
|
||||||
escape.fbconfig_id = 0;
|
escape.fbconfig_id = 0;
|
||||||
escape.gl_drawable = 0;
|
escape.gl_drawable = 0;
|
||||||
escape.pixmap = 0;
|
escape.pixmap = 0;
|
||||||
|
escape.gl_type = DC_GL_NONE;
|
||||||
ExtEscape( hdc, X11DRV_ESCAPE, sizeof(escape), (LPSTR)&escape, 0, NULL );
|
ExtEscape( hdc, X11DRV_ESCAPE, sizeof(escape), (LPSTR)&escape, 0, NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -115,6 +115,16 @@ typedef struct
|
||||||
BOOL trueColor;
|
BOOL trueColor;
|
||||||
} X_PHYSBITMAP;
|
} X_PHYSBITMAP;
|
||||||
|
|
||||||
|
enum dc_gl_type
|
||||||
|
{
|
||||||
|
DC_GL_NONE, /* no GL support (pixel format not set yet) */
|
||||||
|
DC_GL_WINDOW, /* normal top-level window */
|
||||||
|
DC_GL_CHILD_WIN, /* child window using XComposite */
|
||||||
|
DC_GL_PIXMAP_WIN, /* child window using intermediate pixmap */
|
||||||
|
DC_GL_BITMAP, /* memory DC with a standard bitmap */
|
||||||
|
DC_GL_PBUFFER /* pseudo memory DC using a PBuffer */
|
||||||
|
};
|
||||||
|
|
||||||
/* X physical device */
|
/* X physical device */
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
|
@ -134,7 +144,7 @@ typedef struct
|
||||||
int current_pf;
|
int current_pf;
|
||||||
Drawable gl_drawable;
|
Drawable gl_drawable;
|
||||||
Pixmap pixmap; /* Pixmap for a GLXPixmap gl_drawable */
|
Pixmap pixmap; /* Pixmap for a GLXPixmap gl_drawable */
|
||||||
int gl_copy;
|
enum dc_gl_type gl_type; /* type of GL device context */
|
||||||
} X11DRV_PDEVICE;
|
} X11DRV_PDEVICE;
|
||||||
|
|
||||||
static inline X11DRV_PDEVICE *get_x11drv_dev( PHYSDEV dev )
|
static inline X11DRV_PDEVICE *get_x11drv_dev( PHYSDEV dev )
|
||||||
|
@ -345,7 +355,7 @@ struct x11drv_escape_set_drawable
|
||||||
XID fbconfig_id; /* fbconfig id used by the GL drawable */
|
XID fbconfig_id; /* fbconfig id used by the GL drawable */
|
||||||
Drawable gl_drawable; /* GL drawable */
|
Drawable gl_drawable; /* GL drawable */
|
||||||
Pixmap pixmap; /* Pixmap for a GLXPixmap gl_drawable */
|
Pixmap pixmap; /* Pixmap for a GLXPixmap gl_drawable */
|
||||||
int gl_copy; /* whether the GL contents need explicit copying */
|
enum dc_gl_type gl_type; /* type of GL device context */
|
||||||
};
|
};
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
|
|
Loading…
Reference in New Issue