-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
Hi Alex,
Your diff appears to have a huge amount of context around the changes. Is that intentional?
Stefan
Am 2015-11-04 um 06:15 schrieb Alex Henrie:
> Cc: Vincent Povirk <vincent(a)codeweavers.com>
>
> Signed-off-by: Alex Henrie <alexhenrie24(a)gmail.com>
> ---
> dlls/winex11.drv/opengl.c | 17 +++++++++--------
> 1 file changed, 9 insertions(+), 8 deletions(-)
>
> diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c
> index 7b8ba82..99befde 100644
> --- a/dlls/winex11.drv/opengl.c
> +++ b/dlls/winex11.drv/opengl.c
> @@ -947,124 +947,125 @@ static int ConvertAttribWGLtoGLX(const int* iWGLAttr, int* oGLXAttr, struct wgl_
> case WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_R_NV:
> case WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RG_NV:
> case WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGB_NV:
> case WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGBA_NV:
> pop = iWGLAttr[++cur];
> /** cannot be converted, see direct handling on
> * - wglGetPixelFormatAttribivARB
> * TODO: wglChoosePixelFormat
> */
> break ;
> case WGL_FRAMEBUFFER_SRGB_CAPABLE_EXT:
> pop = iWGLAttr[++cur];
> PUSH2(oGLXAttr, GLX_FRAMEBUFFER_SRGB_CAPABLE_EXT, pop);
> TRACE("pAttr[%d] = GLX_FRAMEBUFFER_SRGB_CAPABLE_EXT: %x\n", cur, pop);
> break ;
>
> case WGL_TYPE_RGBA_UNSIGNED_FLOAT_EXT:
> pop = iWGLAttr[++cur];
> PUSH2(oGLXAttr, GLX_RGBA_UNSIGNED_FLOAT_TYPE_EXT, pop);
> TRACE("pAttr[%d] = GLX_RGBA_UNSIGNED_FLOAT_TYPE_EXT: %x\n", cur, pop);
> break ;
> default:
> FIXME("unsupported %x WGL Attribute\n", iWGLAttr[cur]);
> cur++;
> break;
> }
> ++cur;
> }
>
> /* By default glXChooseFBConfig defaults to GLX_WINDOW_BIT. wglChoosePixelFormatARB searches through
> * all formats. Unless drawattrib is set to a non-zero value override it with GLX_DONT_CARE, so that
> * pixmap and pbuffer formats appear as well. */
> if (!drawattrib) drawattrib = GLX_DONT_CARE;
> PUSH2(oGLXAttr, GLX_DRAWABLE_TYPE, drawattrib);
> TRACE("pAttr[?] = GLX_DRAWABLE_TYPE: %#x\n", drawattrib);
>
> /* By default glXChooseFBConfig uses GLX_RGBA_BIT as the default value. Since wglChoosePixelFormatARB
> * searches in all formats we have to do the same. For this reason we set GLX_RENDER_TYPE to
> * GLX_DONT_CARE unless it is overridden. */
> PUSH2(oGLXAttr, GLX_RENDER_TYPE, pixelattrib);
> TRACE("pAttr[?] = GLX_RENDER_TYPE: %#x\n", pixelattrib);
>
> /* Set GLX_FLOAT_COMPONENTS_NV all the time */
> if (has_extension(WineGLInfo.glxExtensions, "GLX_NV_float_buffer")) {
> PUSH2(oGLXAttr, GLX_FLOAT_COMPONENTS_NV, nvfloatattrib);
> TRACE("pAttr[?] = GLX_FLOAT_COMPONENTS_NV: %#x\n", nvfloatattrib);
> }
>
> return nAttribs;
> }
>
> static int get_render_type_from_fbconfig(Display *display, GLXFBConfig fbconfig)
> {
> - int render_type=0, render_type_bit;
> + int render_type, render_type_bit;
> pglXGetFBConfigAttrib(display, fbconfig, GLX_RENDER_TYPE, &render_type_bit);
> switch(render_type_bit)
> {
> case GLX_RGBA_BIT:
> render_type = GLX_RGBA_TYPE;
> break;
> case GLX_COLOR_INDEX_BIT:
> render_type = GLX_COLOR_INDEX_TYPE;
> break;
> case GLX_RGBA_FLOAT_BIT:
> render_type = GLX_RGBA_FLOAT_TYPE;
> break;
> case GLX_RGBA_UNSIGNED_FLOAT_BIT_EXT:
> render_type = GLX_RGBA_UNSIGNED_FLOAT_TYPE_EXT;
> break;
> default:
> ERR("Unknown render_type: %x\n", render_type_bit);
> + render_type = 0;
> }
> return render_type;
> }
>
> /* Check whether a fbconfig is suitable for Windows-style bitmap rendering */
> static BOOL check_fbconfig_bitmap_capability(Display *display, GLXFBConfig fbconfig)
> {
> int dbuf, value;
> pglXGetFBConfigAttrib(display, fbconfig, GLX_DOUBLEBUFFER, &dbuf);
> pglXGetFBConfigAttrib(gdi_display, fbconfig, GLX_DRAWABLE_TYPE, &value);
>
> /* Windows only supports bitmap rendering on single buffered formats, further the fbconfig needs to have
> * the GLX_PIXMAP_BIT set. */
> return !dbuf && (value & GLX_PIXMAP_BIT);
> }
>
> static void init_pixel_formats( Display *display )
> {
> struct wgl_pixel_format *list;
> int size = 0, onscreen_size = 0;
> int fmt_id, nCfgs, i, run, bmp_formats;
> GLXFBConfig* cfgs;
> XVisualInfo *visinfo;
>
> cfgs = pglXGetFBConfigs(display, DefaultScreen(display), &nCfgs);
> if (NULL == cfgs || 0 == nCfgs) {
> if(cfgs != NULL) XFree(cfgs);
> ERR("glXChooseFBConfig returns NULL\n");
> return;
> }
>
> /* Bitmap rendering on Windows implies the use of the Microsoft GDI software renderer.
> * Further most GLX drivers only offer pixmap rendering using indirect rendering (except for modern drivers which support 'AIGLX' / composite).
> * Indirect rendering can indicate software rendering (on Nvidia it is hw accelerated)
> * Since bitmap rendering implies the use of software rendering we can safely use indirect rendering for bitmaps.
> *
> * Below we count the number of formats which are suitable for bitmap rendering. Windows restricts bitmap rendering to single buffered formats.
> */
> for(i=0, bmp_formats=0; i<nCfgs; i++)
> {
> if(check_fbconfig_bitmap_capability(display, cfgs[i]))
> bmp_formats++;
> }
> TRACE("Found %d bitmap capable fbconfigs\n", bmp_formats);
>
> list = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, (nCfgs + bmp_formats) * sizeof(*list));
>
> /* Fill the pixel format list. Put onscreen formats at the top and offscreen ones at the bottom.
> * Do this as GLX doesn't guarantee that the list is sorted */
> for(run=0; run < 2; run++)
> {
> for(i=0; i<nCfgs; i++) {
> pglXGetFBConfigAttrib(display, cfgs[i], GLX_FBCONFIG_ID, &fmt_id);
> @@ -1737,107 +1738,107 @@ static int glxdrv_wglDescribePixelFormat( HDC hdc, int iPixelFormat,
> if (TRACE_ON(wgl)) {
> dump_PIXELFORMATDESCRIPTOR(ppfd);
> }
>
> return nb_onscreen_formats;
> }
>
> /***********************************************************************
> * glxdrv_wglGetPixelFormat
> */
> static int glxdrv_wglGetPixelFormat( HDC hdc )
> {
> struct gl_drawable *gl;
> int ret = 0;
>
> if ((gl = get_gl_drawable( WindowFromDC( hdc ), hdc )))
> {
> ret = pixel_format_index( gl->format );
> /* Offscreen formats can't be used with traditional WGL calls.
> * As has been verified on Windows GetPixelFormat doesn't fail but returns iPixelFormat=1. */
> if (!is_onscreen_pixel_format( ret )) ret = 1;
> release_gl_drawable( gl );
> }
> TRACE( "%p -> %d\n", hdc, ret );
> return ret;
> }
>
> /***********************************************************************
> * glxdrv_wglSetPixelFormat
> */
> static BOOL glxdrv_wglSetPixelFormat( HDC hdc, int iPixelFormat, const PIXELFORMATDESCRIPTOR *ppfd )
> {
> return set_pixel_format(hdc, iPixelFormat, FALSE);
> }
>
> /***********************************************************************
> * glxdrv_wglCopyContext
> */
> static BOOL glxdrv_wglCopyContext(struct wgl_context *src, struct wgl_context *dst, UINT mask)
> {
> TRACE("%p -> %p mask %#x\n", src, dst, mask);
>
> pglXCopyContext(gdi_display, src->ctx, dst->ctx, mask);
>
> /* As opposed to wglCopyContext, glXCopyContext doesn't return anything, so hopefully we passed */
> return TRUE;
> }
>
> /***********************************************************************
> * glxdrv_wglCreateContext
> */
> static struct wgl_context *glxdrv_wglCreateContext( HDC hdc )
> {
> - struct wgl_context *ret = NULL;
> + struct wgl_context *ret;
> struct gl_drawable *gl;
>
> if (!(gl = get_gl_drawable( WindowFromDC( hdc ), hdc )))
> {
> SetLastError( ERROR_INVALID_PIXEL_FORMAT );
> return NULL;
> }
>
> if ((ret = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*ret))))
> {
> ret->hdc = hdc;
> ret->fmt = gl->format;
> ret->vis = pglXGetVisualFromFBConfig(gdi_display, gl->format->fbconfig);
> ret->ctx = create_glxcontext(gdi_display, ret, NULL);
> list_add_head( &context_list, &ret->entry );
> }
> release_gl_drawable( gl );
> TRACE( "%p -> %p\n", hdc, ret );
> return ret;
> }
>
> /***********************************************************************
> * glxdrv_wglDeleteContext
> */
> static void glxdrv_wglDeleteContext(struct wgl_context *ctx)
> {
> TRACE("(%p)\n", ctx);
>
> EnterCriticalSection( &context_section );
> list_remove( &ctx->entry );
> LeaveCriticalSection( &context_section );
>
> if (ctx->ctx) pglXDestroyContext( gdi_display, ctx->ctx );
> if (ctx->vis) XFree( ctx->vis );
> HeapFree( GetProcessHeap(), 0, ctx );
> }
>
> /***********************************************************************
> * glxdrv_wglGetProcAddress
> */
> static PROC glxdrv_wglGetProcAddress(LPCSTR lpszProc)
> {
> if (!strncmp(lpszProc, "wgl", 3)) return NULL;
> return pglXGetProcAddressARB((const GLubyte*)lpszProc);
> }
>
> /***********************************************************************
> * glxdrv_wglMakeCurrent
> */
> static BOOL glxdrv_wglMakeCurrent(HDC hdc, struct wgl_context *ctx)
> {
> BOOL ret = FALSE;
> struct gl_drawable *gl;
> @@ -1987,205 +1988,205 @@ static void wglFinish(void)
> {
> switch (gl->type)
> {
> case DC_GL_PIXMAP_WIN: escape.gl_drawable = gl->pixmap; break;
> case DC_GL_CHILD_WIN: escape.gl_drawable = gl->drawable; break;
> default: break;
> }
> sync_context(ctx);
> release_gl_drawable( gl );
> }
>
> pglFinish();
> if (escape.gl_drawable) ExtEscape( ctx->hdc, X11DRV_ESCAPE, sizeof(escape), (LPSTR)&escape, 0, NULL );
> }
>
> static void wglFlush(void)
> {
> struct x11drv_escape_flush_gl_drawable escape;
> struct gl_drawable *gl;
> struct wgl_context *ctx = NtCurrentTeb()->glContext;
>
> escape.code = X11DRV_FLUSH_GL_DRAWABLE;
> escape.gl_drawable = 0;
>
> if ((gl = get_gl_drawable( WindowFromDC( ctx->hdc ), 0 )))
> {
> switch (gl->type)
> {
> case DC_GL_PIXMAP_WIN: escape.gl_drawable = gl->pixmap; break;
> case DC_GL_CHILD_WIN: escape.gl_drawable = gl->drawable; break;
> default: break;
> }
> sync_context(ctx);
> release_gl_drawable( gl );
> }
>
> pglFlush();
> if (escape.gl_drawable) ExtEscape( ctx->hdc, X11DRV_ESCAPE, sizeof(escape), (LPSTR)&escape, 0, NULL );
> }
>
> static const GLubyte *wglGetString(GLenum name)
> {
> if (name == GL_EXTENSIONS && WineGLInfo.glExtensions)
> return (const GLubyte *)WineGLInfo.glExtensions;
> return pglGetString(name);
> }
>
> /***********************************************************************
> * X11DRV_wglCreateContextAttribsARB
> */
> static struct wgl_context *X11DRV_wglCreateContextAttribsARB( HDC hdc, struct wgl_context *hShareContext,
> const int* attribList )
> {
> - struct wgl_context *ret = NULL;
> + struct wgl_context *ret;
> struct gl_drawable *gl;
> int err = 0;
>
> TRACE("(%p %p %p)\n", hdc, hShareContext, attribList);
>
> if (!(gl = get_gl_drawable( WindowFromDC( hdc ), hdc )))
> {
> SetLastError( ERROR_INVALID_PIXEL_FORMAT );
> return NULL;
> }
>
> if ((ret = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*ret))))
> {
> ret->hdc = hdc;
> ret->fmt = gl->format;
> ret->vis = NULL; /* glXCreateContextAttribsARB requires a fbconfig instead of a visual */
> ret->gl3_context = TRUE;
> if (attribList)
> {
> int *pContextAttribList = &ret->attribList[0];
> /* attribList consists of pairs {token, value] terminated with 0 */
> while(attribList[0] != 0)
> {
> TRACE("%#x %#x\n", attribList[0], attribList[1]);
> switch(attribList[0])
> {
> case WGL_CONTEXT_MAJOR_VERSION_ARB:
> pContextAttribList[0] = GLX_CONTEXT_MAJOR_VERSION_ARB;
> pContextAttribList[1] = attribList[1];
> pContextAttribList += 2;
> ret->numAttribs++;
> break;
> case WGL_CONTEXT_MINOR_VERSION_ARB:
> pContextAttribList[0] = GLX_CONTEXT_MINOR_VERSION_ARB;
> pContextAttribList[1] = attribList[1];
> pContextAttribList += 2;
> ret->numAttribs++;
> break;
> case WGL_CONTEXT_LAYER_PLANE_ARB:
> break;
> case WGL_CONTEXT_FLAGS_ARB:
> pContextAttribList[0] = GLX_CONTEXT_FLAGS_ARB;
> pContextAttribList[1] = attribList[1];
> pContextAttribList += 2;
> ret->numAttribs++;
> break;
> case WGL_CONTEXT_PROFILE_MASK_ARB:
> pContextAttribList[0] = GLX_CONTEXT_PROFILE_MASK_ARB;
> pContextAttribList[1] = attribList[1];
> pContextAttribList += 2;
> ret->numAttribs++;
> break;
> default:
> ERR("Unhandled attribList pair: %#x %#x\n", attribList[0], attribList[1]);
> }
> attribList += 2;
> }
> }
>
> X11DRV_expect_error(gdi_display, GLXErrorHandler, NULL);
> ret->ctx = create_glxcontext(gdi_display, ret, hShareContext ? hShareContext->ctx : NULL);
> XSync(gdi_display, False);
> if ((err = X11DRV_check_error()) || !ret->ctx)
> {
> /* In the future we should convert the GLX error to a win32 one here if needed */
> ERR("Context creation failed (error %x)\n", err);
> HeapFree( GetProcessHeap(), 0, ret );
> ret = NULL;
> }
> else list_add_head( &context_list, &ret->entry );
> }
>
> release_gl_drawable( gl );
> TRACE( "%p -> %p\n", hdc, ret );
> return ret;
> }
>
> /**
> * X11DRV_wglGetExtensionsStringARB
> *
> * WGL_ARB_extensions_string: wglGetExtensionsStringARB
> */
> static const char *X11DRV_wglGetExtensionsStringARB(HDC hdc)
> {
> TRACE("() returning \"%s\"\n", WineGLInfo.wglExtensions);
> return WineGLInfo.wglExtensions;
> }
>
> /**
> * X11DRV_wglCreatePbufferARB
> *
> * WGL_ARB_pbuffer: wglCreatePbufferARB
> */
> static struct wgl_pbuffer *X11DRV_wglCreatePbufferARB( HDC hdc, int iPixelFormat, int iWidth, int iHeight,
> const int *piAttribList )
> {
> - struct wgl_pbuffer* object = NULL;
> - const struct wgl_pixel_format *fmt = NULL;
> + struct wgl_pbuffer* object;
> + const struct wgl_pixel_format *fmt;
> int attribs[256];
> int nAttribs = 0;
>
> TRACE("(%p, %d, %d, %d, %p)\n", hdc, iPixelFormat, iWidth, iHeight, piAttribList);
>
> /* Convert the WGL pixelformat to a GLX format, if it fails then the format is invalid */
> fmt = get_pixel_format(gdi_display, iPixelFormat, TRUE /* Offscreen */);
> if(!fmt) {
> ERR("(%p): invalid pixel format %d\n", hdc, iPixelFormat);
> SetLastError(ERROR_INVALID_PIXEL_FORMAT);
> return NULL;
> }
>
> object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
> if (NULL == object) {
> SetLastError(ERROR_NO_SYSTEM_RESOURCES);
> return NULL;
> }
> object->width = iWidth;
> object->height = iHeight;
> object->fmt = fmt;
>
> PUSH2(attribs, GLX_PBUFFER_WIDTH, iWidth);
> PUSH2(attribs, GLX_PBUFFER_HEIGHT, iHeight);
> while (piAttribList && 0 != *piAttribList) {
> int attr_v;
> switch (*piAttribList) {
> case WGL_PBUFFER_LARGEST_ARB: {
> ++piAttribList;
> attr_v = *piAttribList;
> TRACE("WGL_LARGEST_PBUFFER_ARB = %d\n", attr_v);
> PUSH2(attribs, GLX_LARGEST_PBUFFER, attr_v);
> break;
> }
>
> case WGL_TEXTURE_FORMAT_ARB: {
> ++piAttribList;
> attr_v = *piAttribList;
> TRACE("WGL_render_texture Attribute: WGL_TEXTURE_FORMAT_ARB as %x\n", attr_v);
> if (WGL_NO_TEXTURE_ARB == attr_v) {
> object->use_render_texture = 0;
> } else {
> if (!use_render_texture_emulation) {
> SetLastError(ERROR_INVALID_DATA);
> goto create_failed;
> }
> switch (attr_v) {
> case WGL_TEXTURE_RGB_ARB:
> object->use_render_texture = GL_RGB;
> object->texture_bpp = 3;
> object->texture_format = GL_RGB;
> object->texture_type = GL_UNSIGNED_BYTE;
> break;
> @@ -2457,213 +2458,213 @@ static BOOL X11DRV_wglQueryPbufferARB( struct wgl_pbuffer *object, int iAttribut
> * WGL_ARB_pbuffer: wglReleasePbufferDCARB
> */
> static int X11DRV_wglReleasePbufferDCARB( struct wgl_pbuffer *object, HDC hdc )
> {
> struct gl_drawable *gl;
>
> TRACE("(%p, %p)\n", object, hdc);
>
> EnterCriticalSection( &context_section );
>
> if (!XFindContext( gdi_display, (XID)hdc, gl_pbuffer_context, (char **)&gl ))
> {
> XDeleteContext( gdi_display, (XID)hdc, gl_pbuffer_context );
> free_gl_drawable( gl );
> }
> else hdc = 0;
>
> LeaveCriticalSection( &context_section );
>
> return hdc && DeleteDC(hdc);
> }
>
> /**
> * X11DRV_wglSetPbufferAttribARB
> *
> * WGL_ARB_pbuffer: wglSetPbufferAttribARB
> */
> static BOOL X11DRV_wglSetPbufferAttribARB( struct wgl_pbuffer *object, const int *piAttribList )
> {
> GLboolean ret = GL_FALSE;
>
> WARN("(%p, %p): alpha-testing, report any problem\n", object, piAttribList);
>
> if (!object->use_render_texture) {
> SetLastError(ERROR_INVALID_HANDLE);
> return GL_FALSE;
> }
> if (use_render_texture_emulation) {
> return GL_TRUE;
> }
> return ret;
> }
>
> /**
> * X11DRV_wglChoosePixelFormatARB
> *
> * WGL_ARB_pixel_format: wglChoosePixelFormatARB
> */
> static BOOL X11DRV_wglChoosePixelFormatARB( HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList,
> UINT nMaxFormats, int *piFormats, UINT *nNumFormats )
> {
> int attribs[256];
> int nAttribs = 0;
> - GLXFBConfig* cfgs = NULL;
> + GLXFBConfig* cfgs;
> int nCfgs = 0;
> int it;
> int fmt_id;
> int start, end;
> UINT pfmt_it = 0;
> int run;
> int i;
> DWORD dwFlags = 0;
>
> TRACE("(%p, %p, %p, %d, %p, %p): hackish\n", hdc, piAttribIList, pfAttribFList, nMaxFormats, piFormats, nNumFormats);
> if (NULL != pfAttribFList) {
> FIXME("unused pfAttribFList\n");
> }
>
> nAttribs = ConvertAttribWGLtoGLX(piAttribIList, attribs, NULL);
> if (-1 == nAttribs) {
> WARN("Cannot convert WGL to GLX attributes\n");
> return GL_FALSE;
> }
> PUSH1(attribs, None);
>
> /* There is no 1:1 mapping between GLX and WGL formats because we duplicate some GLX formats for bitmap rendering (see get_formats).
> * Flags like PFD_SUPPORT_GDI, PFD_DRAW_TO_BITMAP and others are a property of the pixel format. We don't query these attributes
> * using glXChooseFBConfig but we filter the result of glXChooseFBConfig later on.
> */
> for(i=0; piAttribIList[i] != 0; i+=2)
> {
> switch(piAttribIList[i])
> {
> case WGL_DRAW_TO_BITMAP_ARB:
> if(piAttribIList[i+1])
> dwFlags |= PFD_DRAW_TO_BITMAP;
> break;
> case WGL_ACCELERATION_ARB:
> switch(piAttribIList[i+1])
> {
> case WGL_NO_ACCELERATION_ARB:
> dwFlags |= PFD_GENERIC_FORMAT;
> break;
> case WGL_GENERIC_ACCELERATION_ARB:
> dwFlags |= PFD_GENERIC_ACCELERATED;
> break;
> case WGL_FULL_ACCELERATION_ARB:
> /* Nothing to do */
> break;
> }
> break;
> case WGL_SUPPORT_GDI_ARB:
> if(piAttribIList[i+1])
> dwFlags |= PFD_SUPPORT_GDI;
> break;
> }
> }
>
> /* Search for FB configurations matching the requirements in attribs */
> cfgs = pglXChooseFBConfig(gdi_display, DefaultScreen(gdi_display), attribs, &nCfgs);
> if (NULL == cfgs) {
> WARN("Compatible Pixel Format not found\n");
> return GL_FALSE;
> }
>
> /* Loop through all matching formats and check if they are suitable.
> * Note that this function should at max return nMaxFormats different formats */
> for(run=0; run < 2; run++)
> {
> for (it = 0; it < nCfgs && pfmt_it < nMaxFormats; ++it)
> {
> if (pglXGetFBConfigAttrib(gdi_display, cfgs[it], GLX_FBCONFIG_ID, &fmt_id))
> {
> ERR("Failed to retrieve FBCONFIG_ID from GLXFBConfig, expect problems.\n");
> continue;
> }
>
> /* During the first run we only want onscreen formats and during the second only offscreen */
> start = run == 1 ? nb_onscreen_formats : 0;
> end = run == 1 ? nb_pixel_formats : nb_onscreen_formats;
>
> for (i = start; i < end; i++)
> {
> if (pixel_formats[i].fmt_id == fmt_id && (pixel_formats[i].dwFlags & dwFlags) == dwFlags)
> {
> piFormats[pfmt_it++] = i + 1;
> TRACE("at %d/%d found FBCONFIG_ID 0x%x (%d)\n",
> it + 1, nCfgs, fmt_id, i + 1);
> break;
> }
> }
> }
> }
>
> *nNumFormats = pfmt_it;
> /** free list */
> XFree(cfgs);
> return GL_TRUE;
> }
>
> /**
> * X11DRV_wglGetPixelFormatAttribivARB
> *
> * WGL_ARB_pixel_format: wglGetPixelFormatAttribivARB
> */
> static BOOL X11DRV_wglGetPixelFormatAttribivARB( HDC hdc, int iPixelFormat, int iLayerPlane,
> UINT nAttributes, const int *piAttributes, int *piValues )
> {
> UINT i;
> - const struct wgl_pixel_format *fmt = NULL;
> + const struct wgl_pixel_format *fmt;
> int hTest;
> int tmp;
> int curGLXAttr = 0;
>
> TRACE("(%p, %d, %d, %d, %p, %p)\n", hdc, iPixelFormat, iLayerPlane, nAttributes, piAttributes, piValues);
>
> if (0 < iLayerPlane) {
> FIXME("unsupported iLayerPlane(%d) > 0, returns FALSE\n", iLayerPlane);
> return GL_FALSE;
> }
>
> /* Convert the WGL pixelformat to a GLX one, if this fails then most likely the iPixelFormat isn't supported.
> * We don't have to fail yet as a program can specify an invalid iPixelFormat (lets say 0) if it wants to query
> * the number of supported WGL formats. Whether the iPixelFormat is valid is handled in the for-loop below. */
> fmt = get_pixel_format(gdi_display, iPixelFormat, TRUE /* Offscreen */);
> if(!fmt) {
> WARN("Unable to convert iPixelFormat %d to a GLX one!\n", iPixelFormat);
> }
>
> for (i = 0; i < nAttributes; ++i) {
> const int curWGLAttr = piAttributes[i];
> TRACE("pAttr[%d] = %x\n", i, curWGLAttr);
>
> switch (curWGLAttr) {
> case WGL_NUMBER_PIXEL_FORMATS_ARB:
> piValues[i] = nb_pixel_formats;
> continue;
>
> case WGL_SUPPORT_OPENGL_ARB:
> piValues[i] = GL_TRUE;
> continue;
>
> case WGL_ACCELERATION_ARB:
> curGLXAttr = GLX_CONFIG_CAVEAT;
> if (!fmt) goto pix_error;
> if(fmt->dwFlags & PFD_GENERIC_FORMAT)
> piValues[i] = WGL_NO_ACCELERATION_ARB;
> else if(fmt->dwFlags & PFD_GENERIC_ACCELERATED)
> piValues[i] = WGL_GENERIC_ACCELERATION_ARB;
> else
> piValues[i] = WGL_FULL_ACCELERATION_ARB;
> continue;
>
> case WGL_TRANSPARENT_ARB:
> curGLXAttr = GLX_TRANSPARENT_TYPE;
> if (!fmt) goto pix_error;
> hTest = pglXGetFBConfigAttrib(gdi_display, fmt->fbconfig, curGLXAttr, &tmp);
> if (hTest) goto get_error;
> piValues[i] = GL_FALSE;
> if (GLX_NONE != tmp) piValues[i] = GL_TRUE;
> continue;
>
> case WGL_PIXEL_TYPE_ARB:
> @@ -2979,107 +2980,107 @@ static BOOL X11DRV_wglReleaseTexImageARB( struct wgl_pbuffer *object, int iBuffe
> return GL_TRUE;
> }
> return ret;
> }
>
> /**
> * X11DRV_wglGetExtensionsStringEXT
> *
> * WGL_EXT_extensions_string: wglGetExtensionsStringEXT
> */
> static const char *X11DRV_wglGetExtensionsStringEXT(void)
> {
> TRACE("() returning \"%s\"\n", WineGLInfo.wglExtensions);
> return WineGLInfo.wglExtensions;
> }
>
> /**
> * X11DRV_wglGetSwapIntervalEXT
> *
> * WGL_EXT_swap_control: wglGetSwapIntervalEXT
> */
> static int X11DRV_wglGetSwapIntervalEXT(void)
> {
> struct wgl_context *ctx = NtCurrentTeb()->glContext;
> struct gl_drawable *gl;
> int swap_interval;
>
> TRACE("()\n");
>
> if (!(gl = get_gl_drawable( WindowFromDC( ctx->hdc ), ctx->hdc )))
> {
> /* This can't happen because a current WGL context is required to get
> * here. Likely the application is buggy.
> */
> WARN("No GL drawable found, returning swap interval 0\n");
> return 0;
> }
>
> swap_interval = gl->swap_interval;
> release_gl_drawable(gl);
>
> return swap_interval;
> }
>
> /**
> * X11DRV_wglSwapIntervalEXT
> *
> * WGL_EXT_swap_control: wglSwapIntervalEXT
> */
> static BOOL X11DRV_wglSwapIntervalEXT(int interval)
> {
> struct wgl_context *ctx = NtCurrentTeb()->glContext;
> struct gl_drawable *gl;
> - BOOL ret = TRUE;
> + BOOL ret;
>
> TRACE("(%d)\n", interval);
>
> /* Without WGL/GLX_EXT_swap_control_tear a negative interval
> * is invalid.
> */
> if (interval < 0 && !has_swap_control_tear)
> {
> SetLastError(ERROR_INVALID_DATA);
> return FALSE;
> }
>
> if (!(gl = get_gl_drawable( WindowFromDC( ctx->hdc ), ctx->hdc )))
> {
> SetLastError(ERROR_DC_NOT_FOUND);
> return FALSE;
> }
>
> ret = set_swap_interval(gl->drawable, interval);
> gl->refresh_swap_interval = FALSE;
> if (ret)
> gl->swap_interval = interval;
> else
> SetLastError(ERROR_DC_NOT_FOUND);
>
> release_gl_drawable(gl);
>
> return ret;
> }
>
> /**
> * X11DRV_wglSetPixelFormatWINE
> *
> * WGL_WINE_pixel_format_passthrough: wglSetPixelFormatWINE
> * This is a WINE-specific wglSetPixelFormat which can set the pixel format multiple times.
> */
> static BOOL X11DRV_wglSetPixelFormatWINE(HDC hdc, int format)
> {
> return set_pixel_format(hdc, format, TRUE);
> }
>
> /**
> * glxRequireVersion (internal)
> *
> * Check if the supported GLX version matches requiredVersion.
> */
> static BOOL glxRequireVersion(int requiredVersion)
> {
> /* Both requiredVersion and glXVersion[1] contains the minor GLX version */
> if(requiredVersion <= WineGLInfo.glxVersion[1])
> return TRUE;
>
> return FALSE;
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
iQIcBAEBCAAGBQJWOdT4AAoJEN0/YqbEcdMwrKMP/3A3YDS+Z8D9DryqO0M+uGFb
dpXvi5pCXIir7VK12bO57tj3NTZ0i9R+COfmwFTb883e6MdcIDsMd3+w8o0A/vj0
7U5yZuxE0gWkFL2veP2L7q+nx7NInYEaWuKmm/Ilu0vDQV0Azr3oyETyih2VZdxE
WqXvh/V90JeFBXf6QtyrPRczXdjcP5BMlI3LW7xLTg4lrxGv3E6r/2wOFl87Ezo1
zHQ8ZF+BWtK2m5vz6OZBoyvPD0XMB+3NJaxfqZ5JI37bJfnO8nu5WyyZEx/6ilxN
TuFacVAewVth53Uo9svNOodvZ3hsIP1JILQ4KAOBUbo6/31GIufxGjHdXfzEpRmX
Xf3+rBdVPtZO/fwbIJnoMMBZbUB3ysOf+WSsH341fa4XmUgppG0enyLve19HcnUV
ZV1yyX+veAdjEjF/bu72XMowPH9yQNR72buwqdxfbVOckeUuIOuyeRjT+VloGQCv
Y3FrstuvoCEJCedSGm96zSHhN2sRNeHvCxoRECuivdoo2e8iCXhC+otkKyoH4zN1
cGXVraN+oabyiwe+K2ItWGeiNKp0Es+eQtckYbna7SmbpslkFjhWjju7NaDbJJgS
wZq+Na9hYC/zN5Ae921DSegHEuTtjbFBA4JmD54oVYGAK0cA5V88qsEFbkBgH+fp
WfiGk1hZGePFQvXm7kiN
=H5zR
-----END PGP SIGNATURE-----