Roderick Colenbrander : wgl:
Make sure onscreen pixelformats are on top in wglChoosePixelFormatARB.
Alexandre Julliard
julliard at wine.codeweavers.com
Fri Aug 10 10:06:39 CDT 2007
Module: wine
Branch: master
Commit: f879f69f9801be463ab3c160e991ae50c738fc58
URL: http://source.winehq.org/git/wine.git/?a=commit;h=f879f69f9801be463ab3c160e991ae50c738fc58
Author: Roderick Colenbrander <thunderbird2k at gmx.net>
Date: Fri Aug 10 15:35:02 2007 +0200
wgl: Make sure onscreen pixelformats are on top in wglChoosePixelFormatARB.
---
dlls/winex11.drv/opengl.c | 44 ++++++++++++++++++++++++++------------------
1 files changed, 26 insertions(+), 18 deletions(-)
diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c
index 7ee99b1..ca379d0 100644
--- a/dlls/winex11.drv/opengl.c
+++ b/dlls/winex11.drv/opengl.c
@@ -984,7 +984,7 @@ static WineGLPixelFormat* ConvertPixelFormatWGLtoGLX(Display *display, int iPixe
}
/* Search our internal pixelformat list for the WGL format corresponding to the given fbconfig */
-static int ConvertPixelFormatGLXtoWGL(Display *display, int fmt_id)
+static WineGLPixelFormat* ConvertPixelFormatGLXtoWGL(Display *display, int fmt_id)
{
int i;
@@ -995,11 +995,11 @@ static int ConvertPixelFormatGLXtoWGL(Display *display, int fmt_id)
for(i=0; i<WineGLPixelFormatListSize; i++) {
if(WineGLPixelFormatList[i].fmt_id == fmt_id) {
TRACE("Returning iPixelFormat %d for fmt_id 0x%x\n", WineGLPixelFormatList[i].iPixelFormat, fmt_id);
- return WineGLPixelFormatList[i].iPixelFormat;
+ return &WineGLPixelFormatList[i];
}
}
TRACE("No compatible format found for fmt_id 0x%x\n", fmt_id);
- return 0;
+ return NULL;
}
/**
@@ -2513,8 +2513,9 @@ static GLboolean WINAPI X11DRV_wglChoosePixelFormatARB(HDC hdc, const int *piAtt
int nCfgs = 0;
UINT it;
int fmt_id;
- int fmt = 0;
+ WineGLPixelFormat *fmt;
int pfmt_it = 0;
+ int run;
TRACE("(%p, %p, %p, %d, %p, %p): hackish\n", hdc, piAttribIList, pfAttribFList, nMaxFormats, piFormats, nNumFormats);
if (NULL != pfAttribFList) {
@@ -2537,23 +2538,30 @@ static GLboolean WINAPI X11DRV_wglChoosePixelFormatARB(HDC hdc, const int *piAtt
/* Loop through all matching formats and check if they are suitable.
* Note that this function should at max return nMaxFormats different formats */
- for (it = 0; it < nCfgs; ++it) {
- gl_test = pglXGetFBConfigAttrib(gdi_display, cfgs[it], GLX_FBCONFIG_ID, &fmt_id);
- if (gl_test) {
- ERR("Failed to retrieve FBCONFIG_ID from GLXFBConfig, expect problems.\n");
- continue;
- }
+ for(run=0; run < 2; run++)
+ {
+ for (it = 0; it < nCfgs; ++it) {
+ gl_test = pglXGetFBConfigAttrib(gdi_display, cfgs[it], GLX_FBCONFIG_ID, &fmt_id);
+ if (gl_test) {
+ ERR("Failed to retrieve FBCONFIG_ID from GLXFBConfig, expect problems.\n");
+ continue;
+ }
- /* Search for the format in our list of compatible formats */
- fmt = ConvertPixelFormatGLXtoWGL(gdi_display, fmt_id);
- if(!fmt)
- continue;
+ /* Search for the format in our list of compatible formats */
+ fmt = ConvertPixelFormatGLXtoWGL(gdi_display, fmt_id);
+ if(!fmt)
+ continue;
- if(pfmt_it < nMaxFormats) {
- piFormats[pfmt_it] = fmt;
- TRACE("at %d/%d found FBCONFIG_ID 0x%x (%d)\n", it + 1, nCfgs, fmt_id, piFormats[pfmt_it]);
+ /* During the first run we only want onscreen formats and during the second only offscreen 'XOR' */
+ if( ((run == 0) && fmt->offscreenOnly) || ((run == 1) && !fmt->offscreenOnly) )
+ continue;
+
+ if(pfmt_it < nMaxFormats) {
+ piFormats[pfmt_it] = fmt->iPixelFormat;
+ TRACE("at %d/%d found FBCONFIG_ID 0x%x (%d)\n", it + 1, nCfgs, fmt_id, piFormats[pfmt_it]);
+ }
+ pfmt_it++;
}
- pfmt_it++;
}
*nNumFormats = pfmt_it;
More information about the wine-cvs
mailing list