[PATCH] Add more accurate WGL pixel format compatibility checks as we aren't pixel format limited anymore.
Roderick Colenbrander
thunderbird2k at gmx.net
Mon Mar 3 13:42:23 CST 2008
---
dlls/wined3d/directx.c | 50 ++++++++++++++++++++++++++++++++++++-----------
1 files changed, 38 insertions(+), 12 deletions(-)
diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c
index 4941bb1..991baaa 100644
--- a/dlls/wined3d/directx.c
+++ b/dlls/wined3d/directx.c
@@ -1604,24 +1604,50 @@ static BOOL IWineD3DImpl_IsPixelFormatCompatibleWithRenderFmt(const WineD3D_Pixe
if(!cfg)
return FALSE;
- if(!getColorBits(Format, &redSize, &greenSize, &blueSize, &alphaSize, &colorBits)) {
- ERR("Unable to check compatibility for Format=%s\n", debug_d3dformat(Format));
- return FALSE;
- }
+ if(cfg->iPixelType == WGL_TYPE_RGBA_ARB) { /* Integer RGBA formats */
- if(cfg->redSize < redSize)
- return FALSE;
+ /* Even if R5G6B5 isn't backed by WGL, advertise it. We will emulate it as lots of older games need it.
+ * This is basically an X problem as it doesn't offer depth switching. */
+ if(Format == WINED3DFMT_R5G6B5)
+ return TRUE;
- if(cfg->greenSize < greenSize)
- return FALSE;
+ if(!getColorBits(Format, &redSize, &greenSize, &blueSize, &alphaSize, &colorBits)) {
+ ERR("Unable to check compatibility for Format=%s\n", debug_d3dformat(Format));
+ return FALSE;
+ }
- if(cfg->blueSize < blueSize)
- return FALSE;
+ if(cfg->redSize != redSize)
+ return FALSE;
+
+ if(cfg->greenSize != greenSize)
+ return FALSE;
+
+ if(cfg->blueSize != blueSize)
+ return FALSE;
+
+ if(cfg->alphaSize != alphaSize)
+ return FALSE;
- if(cfg->alphaSize < alphaSize)
+ return TRUE;
+ } else if(cfg->iPixelType == WGL_TYPE_RGBA_FLOAT_ARB) { /* Float RGBA formats; TODO: WGL_NV_float_buffer */
+ if(Format == WINED3DFMT_R16F)
+ return (cfg->redSize == 16 && cfg->greenSize == 0 && cfg->blueSize == 0 && cfg->alphaSize == 0);
+ if(Format == WINED3DFMT_G16R16F)
+ return (cfg->redSize == 16 && cfg->greenSize == 16 && cfg->blueSize == 0 && cfg->alphaSize == 0);
+ if(Format == WINED3DFMT_A16B16G16R16F)
+ return (cfg->redSize == 16 && cfg->greenSize == 16 && cfg->blueSize == 16 && cfg->alphaSize == 16);
+ if(Format == WINED3DFMT_R32F)
+ return (cfg->redSize == 32 && cfg->greenSize == 0 && cfg->blueSize == 0 && cfg->alphaSize == 0);
+ if(Format == WINED3DFMT_G32R32F)
+ return (cfg->redSize == 32 && cfg->greenSize == 32 && cfg->blueSize == 0 && cfg->alphaSize == 0);
+ if(Format == WINED3DFMT_A32B32G32R32F)
+ return (cfg->redSize == 32 && cfg->greenSize == 32 && cfg->blueSize == 32 && cfg->alphaSize == 32);
+ } else {
+ /* Probably a color index mode */
return FALSE;
+ }
- return TRUE;
+ return FALSE;
}
static BOOL IWineD3DImpl_IsPixelFormatCompatibleWithDepthFmt(const WineD3D_PixelFormat *cfg, WINED3DFORMAT Format) {
--
1.5.3.4
--========GMX643312045861608899--
More information about the wine-patches
mailing list