diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c index 33415551aa..14d8fce0e1 100644 --- a/dlls/wined3d/context.c +++ b/dlls/wined3d/context.c @@ -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 */ diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index 8ac6473773..32f7323624 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -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