<font face="Arial, Helvetica, sans-serif">the code is in :<br>
<br>
wine-1.0/dlls/wined3d/context.c<br>
<br>
<br>
here is the changed code :<br>
<br>
<br>
<br>
/* This function takes care of WineD3D pixel format selection. */<br>
<br>
static int WineD3D_ChoosePixelFormat(IWineD3DDeviceImpl *This, HDC hdc, WINED3DFORMAT ColorFormat, WINED3DFORMAT DepthStencilFormat, BOOL auxBuffers, int numSamples, BOOL pbuffer, BOOL findCompatible)<br>
{<br>
int iPixelFormat=0;<br>
short redBits, greenBits, blueBits, alphaBits, colorBits;<br>
short depthBits=0, stencilBits=0;<br>
int i = 0;<br>
int nCfgs = This->adapter->nCfgs;<br>
<br>
WineD3D_PixelFormat *cfgs = This->adapter->cfgs;<br>
BOOL exactDepthMatch = FALSE; /*Changed june 23,08 */ <br>
PIXELFORMATDESCRIPTOR pfd; /*Changed june 23,08 */<br>
<br>
<br>
TRACE("ColorFormat=%s, DepthStencilFormat=%s, auxBuffers=%d, numSamples=%d, pbuffer=%d, findCompatible=%d\n",<br>
debug_d3dformat(ColorFormat), debug_d3dformat(DepthStencilFormat), auxBuffers, numSamples, pbuffer, findCompatible);<br>
<br>
if (!getColorBits(ColorFormat, &redBits, &greenBits, &blueBits, &alphaBits, &colorBits)) <br>
{<br>
ERR("Unable to get color bits for format %s (%#x)!\n", debug_d3dformat(ColorFormat), ColorFormat);<br>
return 0;<br>
}<br>
<br>
/* In WGL both color, depth and stencil are features of a pixel format. In case of D3D they are separate.<br>
* You are able to add a depth + stencil surface at a later stage when you need it.<br>
* In order to support this properly in WineD3D we need the ability to recreate the opengl context and<br>
* drawable when this is required. This is very tricky as we need to reapply ALL opengl states for the new<br>
* context, need torecreate shaders, textures and other resources.<br>
*<br>
* The context manager already takes care of the state problem and for the other tasks code from Reset<br>
* can be used. These changes are way to risky during the 1.0 code freeze which is taking place right now.<br>
* Likely a lot of other new bugs will be exposed. For that reason request a depth stencil surface all the<br>
* time. It can cause a slight performance hit but fixes a lot of regressions. A fixme reminds of that this<br>
* issue needs to be fixed. */<br>
if (DepthStencilFormat != WINED3DFMT_D24S8)<br>
FIXME("Add OpenGL context recreation support to SetDepthStencilSurface\n");<br>
<br>
DepthStencilFormat = WINED3DFMT_D24S8;<br>
<br>
/* <b>Changed Section June 24,08</b> */<br>
<br>
/* if(DepthStencilFormat) { Changed June 19,08*/<br>
getDepthStencilBits(DepthStencilFormat, &depthBits, &stencilBits);<br>
/* } <b>This if will always be true because of the above so just call getDepthStencilBits</b> */<br>
<br>
/* Find a pixel format which EXACTLY matches our requirements (except for depth) */<br>
for(i=0; i<nCfgs; i++) <br>
{<br>
cfgs = &This->adapter->cfgs[i];<br>
<br>
/* For now only accept RGBA formats. Perhaps some day we will<br>
* allow floating point formats for pbuffers. */<br>
if (cfgs->iPixelType != WGL_TYPE_RGBA_ARB)<br>
continue;<br>
<br>
/* In window mode (!pbuffer) we need a window drawable format and double buffering. */<br>
if (!pbuffer && !(cfgs->windowDrawable && cfgs->doubleBuffer))<br>
continue;<br>
<br>
/* We like to have aux buffers in backbuffer mode */<br>
if (auxBuffers && !cfgs->auxBuffers)<br>
continue;<br>
<br>
/* In pbuffer-mode we need a pbuffer-capable format but we don't want double buffering */<br>
if (pbuffer && (!cfgs->pbufferDrawable || cfgs->doubleBuffer))<br>
continue;<br>
<br>
/* <b>This is faster and more efficient code wise since they are all related so evaluate them together Changed June 19,08 </b>*/<br>
<br>
if ((cfgs->redSize != redBits) || (cfgs->greenSize != greenBits) || (cfgs->blueSize != blueBits) || (cfgs->alphaSize != alphaBits))<br>
continue;<br>
<br>
/* In all cases make sure the number of stencil bits matches our requirements<br>
* even when we don't need stencil because it could affect performance EXCEPT<br>
* on cards which don't offer depth formats without stencil like the i915 drivers<br>
* on Linux. */<br>
if ((stencilBits != cfgs->stencilSize) && !((This->adapter->brokenStencil && stencilBits) <= cfgs->stencilSize))<br>
continue;<br>
<br>
/* Check multisampling support */<br>
if (cfgs->numSamples != numSamples)<br>
continue;<br>
<br>
/* We try to locate a format which matches our requirements exactly. In case of<br>
* depth it is no problem to emulate 16-bit using e.g. 24-bit, so accept that. */<br>
if (cfgs->depthSize != depthBits) /* Changed June 24,08 */<br>
continue;<br>
<br>
/* Exit the loop as we have found a format :) */<br>
if (exactDepthMatch) <br>
{<br>
TRACE("Exact Depth Match\n");<br>
iPixelFormat = cfgs->iPixelFormat;<br>
break;<br>
} <br>
<br>
if (!iPixelFormat) <br>
{<br>
/* In the end we might end up with a format which doesn't exactly match our depth<br>
* requirements. Accept the first format we found because formats with higher iPixelFormat<br>
* values tend to have more extended capabilities (e.g. multisampling) which we don't need. */<br>
TRACE("Emulating %d\n",cfgs->iPixelFormat);<br>
iPixelFormat = cfgs->iPixelFormat;<br>
break; /* Added June 24,08 */<br>
}<br>
}<br>
<br>
/* When findCompatible is set and no suitable format was found, let ChoosePixelFormat choose a pixel format in order not to crash. */<br>
<br>
/* if (!iPixelFormat && !findCompatible) <br>
{<br>
ERR("Can't find a suitable iPixelFormat\n");<br>
return FALSE;<br>
} <br>
<b>Remarked this out. Yes it will cycle through the 3 adapters (I am running dual head and for some reason it thinks I have 3 adapters not just the 2 for dual head)</b> <br>
<b>Why would findCompatible not be set for all adapters this is what the DX 9c specs say it should do then the application picks the best of all </b>*/<br>
<br>
if (!iPixelFormat) <br>
{<br>
TRACE("iPixelFormat = %d FindCompatible=%d\n",iPixelFormat, findCompatible);<br>
<br>
TRACE("Falling back to ChoosePixelFormat as we weren't able to find an exactly matching pixel format\n");<br>
/* PixelFormat selection */<br>
ZeroMemory(&pfd, sizeof(pfd));<br>
pfd.nSize = sizeof(pfd);<br>
pfd.nVersion = 1; /* <b>Should this be hard Coded or put into a #DEFINE so it can be changed later if needed</b> */<br>
pfd.dwFlags = PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER | PFD_DRAW_TO_WINDOW;/*PFD_GENERIC_ACCELERATED*/<br>
pfd.iPixelType = PFD_TYPE_RGBA;<br>
pfd.cAlphaBits = alphaBits;<br>
pfd.cColorBits = colorBits;<br>
pfd.cDepthBits = depthBits;<br>
pfd.cStencilBits = stencilBits;<br>
pfd.iLayerType = PFD_MAIN_PLANE;<br>
<br>
iPixelFormat = ChoosePixelFormat(hdc, &pfd);<br>
<br>
if (!iPixelFormat) <br>
{<br>
/* If this happens something is very wrong as ChoosePixelFormat barely fails */<br>
ERR("Can't find a suitable iPixelFormat\n");<br>
return FALSE;<br>
}<br>
}<br>
<br>
TRACE("Found iPixelFormat\n");<br>
return iPixelFormat;<br>
}<br>
<br>
<br>
<br>
<br>
Chris</font><div id='u8CAA47C3D4CC3F1-8F8-3F94' class='aol_ad_footer'><FONT style="color: black; font: normal 10pt ARIAL, SAN-SERIF;"><HR style="MARGIN-TOP: 10px"><A title="http://toolbar.aol.com/moviefone/download.html?ncid=aolcmp00050000000011" href="http://toolbar.aol.com/moviefone/download.html?ncid=aolcmp00050000000011" target="_blank">Get the Moviefone Toolbar</A>. Showtimes, theaters, movie news, & more!</FONT> </div>