Commit 7b5561cb authored by Roderick Colenbrander's avatar Roderick Colenbrander Committed by Alexandre Julliard

wined3d: Allow stencil support when it wasn't requested on broken drivers.

parent a789375f
......@@ -169,8 +169,10 @@ static int WineD3D_ChoosePixelFormat(IWineD3DDeviceImpl *This, HDC hdc, WINED3DF
exactDepthMatch = FALSE;
/* 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 */
if(!(cfgs->stencilSize == stencilBits))
* 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;
/* Check multisampling support */
......
......@@ -1706,7 +1706,9 @@ static BOOL IWineD3DImpl_IsPixelFormatCompatibleWithDepthFmt(const WineD3D_Pixel
if(!(cfg->depthSize == depthSize || (!lockable && cfg->depthSize > depthSize)))
return FALSE;
if(cfg->stencilSize != stencilSize)
/* Some cards like Intel i915 ones only offer D24S8 but lots of games also need a format without stencil, so
* allow more stencil bits than requested. */
if(cfg->stencilSize < stencilSize)
return FALSE;
return TRUE;
......@@ -3839,6 +3841,7 @@ BOOL InitAdapters(void) {
int values[10];
int nAttribs = 0;
int res;
int i;
WineD3D_PixelFormat *cfgs;
int attribute;
DISPLAY_DEVICEW DisplayDevice;
......@@ -3953,6 +3956,24 @@ BOOL InitAdapters(void) {
cfgs++;
}
/* D16, D24X8 and D24S8 are common depth / depth+stencil formats. All drivers support them though this doesn't
* mean that the format is offered in hardware. For instance Geforce8 cards don't have offer D16 in hardware
* but just fake it using D24(X8?) which is fine. D3D also allows that.
* Some display drivers (i915 on Linux) only report mixed depth+stencil formats like D24S8. MSDN clearly mentions
* that only on lockable formats (e.g. D16_locked) the bit order is guaranteed and that on other formats the
* driver is allowed to consume more bits EXCEPT for stencil bits.
*
* Mark an adapter with this broken stencil behavior.
*/
Adapters[0].brokenStencil = TRUE;
for(i=0, cfgs=Adapters[0].cfgs; i<Adapters[0].nCfgs; i++) {
/* Nearly all drivers offer depth formats without stencil, only on i915 this if-statement won't be entered. */
if(cfgs[i].depthSize && !cfgs[i].stencilSize) {
Adapters[0].brokenStencil = FALSE;
break;
}
}
fixup_extensions(&Adapters[0].gl_info);
WineD3D_ReleaseFakeGLContext();
......
......@@ -702,6 +702,7 @@ struct WineD3DAdapter
WCHAR DeviceName[CCHDEVICENAME]; /* DeviceName for use with e.g. ChangeDisplaySettings */
int nCfgs;
WineD3D_PixelFormat *cfgs;
BOOL brokenStencil; /* Set on cards which only offer mixed depth+stencil */
unsigned int TextureRam; /* Amount of texture memory both video ram + AGP/TurboCache/HyperMemory/.. */
unsigned int UsedTextureRam;
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment