wgl: Get rid of glXQueryDrawable because officially it only works on GLXDrawables.

Nvidia allows it to operate on a standard Window too but Mesa and AMD
don't and this isn't needed according to the GLX specs. This prevents
crashes when creating +wgl logs.
This commit is contained in:
Roderick Colenbrander 2009-06-16 23:49:12 +02:00 committed by Alexandre Julliard
parent 85f9460a58
commit 28a2646d21
1 changed files with 14 additions and 27 deletions

View File

@ -146,6 +146,7 @@ static const WineGLExtension *WineGLExtensionList[MAX_EXTENSIONS];
static int WineGLExtensionListSize; static int WineGLExtensionListSize;
static void X11DRV_WineGL_LoadExtensions(void); static void X11DRV_WineGL_LoadExtensions(void);
static WineGLPixelFormat* ConvertPixelFormatWGLtoGLX(Display *display, int iPixelFormat, BOOL AllowOffscreen, int *fmt_count);
static BOOL glxRequireVersion(int requiredVersion); static BOOL glxRequireVersion(int requiredVersion);
static BOOL glxRequireExtension(const char *requiredExtension); static BOOL glxRequireExtension(const char *requiredExtension);
@ -582,37 +583,23 @@ static int describeContext(Wine_GLContext* ctx) {
return ctx_vis_id; return ctx_vis_id;
} }
static int describeDrawable(Wine_GLContext* ctx, Drawable drawable) { static BOOL describeDrawable(X11DRV_PDEVICE *physDev) {
int tmp; int tmp;
int nElements; WineGLPixelFormat *fmt;
int attribList[3] = { GLX_FBCONFIG_ID, 0, None }; int fmt_count = 0;
GLXFBConfig *fbCfgs;
if (pglXQueryDrawable == NULL) { fmt = ConvertPixelFormatWGLtoGLX(gdi_display, physDev->current_pf, TRUE /* Offscreen */, &fmt_count);
/** glXQueryDrawable not available so returns not supported */ if(!fmt) return FALSE;
return -1;
}
TRACE(" Drawable %p have :\n", (void*) drawable); TRACE(" HDC %p has:\n", physDev->hdc);
pglXQueryDrawable(gdi_display, drawable, GLX_WIDTH, (unsigned int*) &tmp); TRACE(" - iPixelFormat %d\n", fmt->iPixelFormat);
TRACE(" - WIDTH as %d\n", tmp); TRACE(" - Drawable %p\n", (void*) get_glxdrawable(physDev));
pglXQueryDrawable(gdi_display, drawable, GLX_HEIGHT, (unsigned int*) &tmp); TRACE(" - FBCONFIG_ID 0x%x\n", fmt->fmt_id);
TRACE(" - HEIGHT as %d\n", tmp);
pglXQueryDrawable(gdi_display, drawable, GLX_FBCONFIG_ID, (unsigned int*) &tmp);
TRACE(" - FBCONFIG_ID as 0x%x\n", tmp);
attribList[1] = tmp; pglXGetFBConfigAttrib(gdi_display, fmt->fbconfig, GLX_VISUAL_ID, &tmp);
fbCfgs = pglXChooseFBConfig(gdi_display, DefaultScreen(gdi_display), attribList, &nElements); TRACE(" - VISUAL_ID 0x%x\n", tmp);
if (fbCfgs == NULL) {
return -1;
}
pglXGetFBConfigAttrib(gdi_display, fbCfgs[0], GLX_VISUAL_ID, &tmp); return TRUE;
TRACE(" - VISUAL_ID as 0x%x\n", tmp);
XFree(fbCfgs);
return tmp;
} }
static int ConvertAttribWGLtoGLX(const int* iWGLAttr, int* oGLXAttr, Wine_GLPBuffer* pbuf) { static int ConvertAttribWGLtoGLX(const int* iWGLAttr, int* oGLXAttr, Wine_GLPBuffer* pbuf) {
@ -1842,7 +1829,7 @@ BOOL CDECL X11DRV_wglMakeCurrent(X11DRV_PDEVICE *physDev, HGLRC hglrc) {
if (ctx->ctx == NULL) { if (ctx->ctx == NULL) {
/* The describe lines below are for debugging purposes only */ /* The describe lines below are for debugging purposes only */
if (TRACE_ON(wgl)) { if (TRACE_ON(wgl)) {
describeDrawable(ctx, drawable); describeDrawable(physDev);
describeContext(ctx); describeContext(ctx);
} }