I am sorry everyone for the spam =) been awhile since I developed stuff, been so used to designing things? =)
here in all its glorry is the diff -u context.c context.c.new > diff.txt file
I couldnt get the -c option to work so here is just the -u
--- context.c??? 2008-06-26 13:52:57.000000000 -0400 +++ context.c.change??? 2008-06-26 14:32:48.000000000 -0400 @@ -116,13 +116,12 @@ ???? int iPixelFormat=0; ???? short redBits, greenBits, blueBits, alphaBits, colorBits; ???? short depthBits=0, stencilBits=0; - ???? int i = 0; ???? int nCfgs = This->adapter->nCfgs; -??? WineD3D_PixelFormat *cfgs = This->adapter->cfgs; ? -??? TRACE("ColorFormat=%s, DepthStencilFormat=%s, auxBuffers=%d, numSamples=%d, pbuffer=%d, findCompatible=%d\n", -????????? debug_d3dformat(ColorFormat), debug_d3dformat(DepthStencilFormat), auxBuffers, numSamples, pbuffer, findCompatible); +??? WineD3D_PixelFormat *cfgs = This->adapter->cfgs; +??? BOOL exactDepthMatch = FALSE;? /*Changed june 23,08 */?? +??? PIXELFORMATDESCRIPTOR pfd;???? /*Changed june 23,08 */ ? ???? if(!getColorBits(ColorFormat, &redBits, &greenBits, &blueBits, &alphaBits, &colorBits)) { ???????? ERR("Unable to get color bits for format %s (%#x)!\n", debug_d3dformat(ColorFormat), ColorFormat); @@ -145,84 +144,91 @@ ? ???? DepthStencilFormat = WINED3DFMT_D24S8; ? -??? if(DepthStencilFormat) { -??????? getDepthStencilBits(DepthStencilFormat, &depthBits, &stencilBits); -??? } +/* Changed Section June 24,08 */ + +#if 0 +??? if(DepthStencilFormat) +????? {???????????????????? +??? getDepthStencilBits(DepthStencilFormat, &depthBits, &stencilBits); +??? } +#endif + +/* Just call getDepthStencilBits as the above IF will always in this case be true */ + +??? getDepthStencilBits(DepthStencilFormat, &depthBits, &stencilBits); ? ???? /* Find a pixel format which EXACTLY matches our requirements (except for depth) */ -??? for(i=0; i<nCfgs; i++) { -??????? BOOL exactDepthMatch = TRUE; +??? for(i=0; i<nCfgs; i++) +????? { ???????? cfgs = &This->adapter->cfgs[i]; - +??????????????????? ???????? /* For now only accept RGBA formats. Perhaps some day we will ????????? * allow floating point formats for pbuffers. */ ???????? if(cfgs->iPixelType != WGL_TYPE_RGBA_ARB) -??????????? continue; +?????????? continue; ? ???????? /* In window mode (!pbuffer) we need a window drawable format and double buffering. */ ???????? if(!pbuffer && !(cfgs->windowDrawable && cfgs->doubleBuffer)) -??????????? continue; +?????????? continue; ? -??????? /* We like to have aux buffers in backbuffer mode */ +?????? /* We like to have aux buffers in backbuffer mode */ ???????? if(auxBuffers && !cfgs->auxBuffers) -??????????? continue; +?????????? continue; ? ???????? /* In pbuffer-mode we need a pbuffer-capable format but we don't want double buffering */ ???????? if(pbuffer && (!cfgs->pbufferDrawable || cfgs->doubleBuffer)) -??????????? continue; +???????????? continue; ? -??????? if(cfgs->redSize != redBits) -??????????? continue; -??????? if(cfgs->greenSize != greenBits) -??????????? continue; -??????? if(cfgs->blueSize != blueBits) -??????????? continue; -??????? if(cfgs->alphaSize != alphaBits) -??????????? continue; - -??????? /* We try to locate a format which matches our requirements exactly. In case of -???????? * depth it is no problem to emulate 16-bit using e.g. 24-bit, so accept that. */ -??????? if(cfgs->depthSize < depthBits) -??????????? continue; -??????? else if(cfgs->depthSize > depthBits) -??????????? exactDepthMatch = FALSE; +??????? if ((cfgs->redSize != redBits) || (cfgs->greenSize != greenBits) || (cfgs->blueSize != blueBits) || (cfgs->alphaSize != alphaBits)) +???????????? continue; ? ???????? /* In all cases make sure the number of stencil bits matches our requirements ????????? * even when we don't need stencil because it could affect performance EXCEPT ????????? * on cards which don't offer depth formats without stencil like the i915 drivers ????????? * on Linux. */ -??????? if(stencilBits != cfgs->stencilSize && !(This->adapter->brokenStencil && stencilBits <= cfgs->stencilSize)) -??????????? continue; +??????? if((stencilBits != cfgs->stencilSize) && !((This->adapter->brokenStencil && stencilBits) <= cfgs->stencilSize)) +???????????? continue; ? ???????? /* Check multisampling support */ ???????? if(cfgs->numSamples != numSamples) -??????????? continue; +???????????? continue; ? -??????? /* When we have passed all the checks then we have found a format which matches our -???????? * requirements. Note that we only check for a limit number of capabilities right now, -???????? * so there can easily be a dozen of pixel formats which appear to be the 'same' but -???????? * can still differ in things like multisampling, stereo, SRGB and other flags. -???????? */ +??????? /* We try to locate a format which matches our requirements exactly. In case of +???????? * depth it is no problem to emulate 16-bit using e.g. 24-bit, so accept that. */ +???????? if (cfgs->depthSize !=? depthBits) +??????????? continue; ? ???????? /* Exit the loop as we have found a format :) */ -??????? if(exactDepthMatch) { +??????? if (exactDepthMatch) +?????????? { +??????????? TRACE("Exact Depth Match\n"); ???????????? iPixelFormat = cfgs->iPixelFormat; ???????????? break; -??????? } else if(!iPixelFormat) { +?????????? } +??????? if (!iPixelFormat) +????????? { ???????????? /* In the end we might end up with a format which doesn't exactly match our depth ????????????? * requirements. Accept the first format we found because formats with higher iPixelFormat ????????????? * values tend to have more extended capabilities (e.g. multisampling) which we don't need. */ + +??????????? TRACE("Emulating %d\n",cfgs->iPixelFormat); ???????????? iPixelFormat = cfgs->iPixelFormat; -??????? } +??????????? break; /* Added June 24,08 */ +????????? } ???? } ? ???? /* When findCompatible is set and no suitable format was found, let ChoosePixelFormat choose a pixel format in order not to crash. */ -??? if(!iPixelFormat && !findCompatible) { + +#if 0??? +if (!iPixelFormat && !findCompatible) +????? { ???????? ERR("Can't find a suitable iPixelFormat\n"); ???????? return FALSE; -??? } else if(!iPixelFormat) { -??????? PIXELFORMATDESCRIPTOR pfd; - +????? } +#endif +????? +??? if (!iPixelFormat) +????? { ???????? TRACE("Falling back to ChoosePixelFormat as we weren't able to find an exactly matching pixel format\n"); ???????? /* PixelFormat selection */ ???????? ZeroMemory(&pfd, sizeof(pfd)); @@ -235,16 +241,17 @@ ???????? pfd.cDepthBits = depthBits; ???????? pfd.cStencilBits = stencilBits; ???????? pfd.iLayerType = PFD_MAIN_PLANE; - +??????? ???????? iPixelFormat = ChoosePixelFormat(hdc, &pfd); -??????? if(!iPixelFormat) { -??????????? /* If this happens something is very wrong as ChoosePixelFormat barely fails */ -??????????? ERR("Can't find a suitable iPixelFormat\n"); -??????????? return FALSE; -??????? } -??? } +??????? if (!iPixelFormat) +????????? { +?????????? /* If this happens something is very wrong as ChoosePixelFormat barely fails */ +?????????? ERR("Can't find a suitable iPixelFormat\n"); +?????????? return FALSE; +????????? } +????? } ? -??? TRACE("Found iPixelFormat=%d for ColorFormat=%s, DepthStencilFormat=%s\n", iPixelFormat, debug_d3dformat(ColorFormat), debug_d3dformat(DepthStencilFormat)); +??? TRACE("Found iPixelFormat\n"); ???? return iPixelFormat; ?} ? @@ -372,6 +379,7 @@ ? ???????? /* If we still don't have a pixel format, something is very wrong as ChoosePixelFormat barely fails */ ???????? if(!iPixelFormat) { +??????????? TRACE("Choose Pixel Format Failed\n"); ???????????? ERR("Can't find a suitable iPixelFormat\n"); ???????????? return FALSE; ???????? }
Better?
Chris