Module: wine
Branch: master
Commit: 1219e3d4a752a1e5e6d9a4025d180f0c9da280f0
URL: http://source.winehq.org/git/wine.git/?a=commit;h=1219e3d4a752a1e5e6d9a4025…
Author: Stefan Dösinger <stefan(a)codeweavers.com>
Date: Mon Jul 21 09:22:22 2008 -0500
wined3d: Use less strict pixel format matching if the match fails.
Some drivers(the open source ones most notably) cannot satisfy all
possible D3D formats. This doesn't mean we should fall back to the
emergency fallback instantly. Instead, try to loosen the requirements
step by step.
---
dlls/wined3d/context.c | 163 +++++++++++++++++++++++++++++-------------------
1 files changed, 98 insertions(+), 65 deletions(-)
diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index efa1006..ca81f3a 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -113,10 +113,28 @@ static WineD3DContext *AddContextToArray(IWineD3DDeviceImpl *This, HWND win_hand
/* This function takes care of WineD3D pixel format selection. */
static int WineD3D_ChoosePixelFormat(IWineD3DDeviceImpl *This, HDC hdc, WINED3DFORMAT ColorFormat, WINED3DFORMAT DepthStencilFormat, BOOL auxBuffers, int numSamples, BOOL pbuffer, BOOL findCompatible)
{
- int iPixelFormat=0;
+ int iPixelFormat=0, matchtry;
short redBits, greenBits, blueBits, alphaBits, colorBits;
short depthBits=0, stencilBits=0;
+ struct match_type {
+ BOOL require_aux;
+ BOOL exact_alpha;
+ BOOL exact_color;
+ } matches[] = {
+ /* First, try without aux buffers - this is the most common cause
+ * for not finding a pixel format. Also some drivers(the open source ones)
+ * only offer 32 bit ARB pixel formats. First try without an exact alpha
+ * match, then try without an exact alpha and color match.
+ */
+ { TRUE, TRUE, TRUE },
+ { FALSE, TRUE, TRUE },
+ { TRUE, FALSE, TRUE },
+ { TRUE, FALSE, FALSE },
+ { FALSE, FALSE, TRUE },
+ { FALSE, FALSE, FALSE },
+ };
+
int i = 0;
int nCfgs = This->adapter->nCfgs;
WineD3D_PixelFormat *cfgs = This->adapter->cfgs;
@@ -149,70 +167,85 @@ static int WineD3D_ChoosePixelFormat(IWineD3DDeviceImpl *This, HDC hdc, WINED3DF
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;
- 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;
-
- /* In window mode (!pbuffer) we need a window drawable format and double buffering. */
- if(!pbuffer && !(cfgs->windowDrawable && cfgs->doubleBuffer))
- continue;
-
- /* We like to have aux buffers in backbuffer mode */
- if(auxBuffers && !cfgs->auxBuffers)
- continue;
-
- /* In pbuffer-mode we need a pbuffer-capable format but we don't want double buffering */
- if(pbuffer && (!cfgs->pbufferDrawable || cfgs->doubleBuffer))
- 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;
-
- /* 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;
-
- /* Check multisampling support */
- if(cfgs->numSamples != numSamples)
- 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.
- */
+ for(matchtry = 0; matchtry < (sizeof(matches) / sizeof(matches[0])); matchtry++) {
+ for(i=0; i<nCfgs; i++) {
+ BOOL exactDepthMatch = TRUE;
+ 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;
+
+ /* In window mode (!pbuffer) we need a window drawable format and double buffering. */
+ if(!pbuffer && !(cfgs->windowDrawable && cfgs->doubleBuffer))
+ continue;
+
+ /* We like to have aux buffers in backbuffer mode */
+ if(auxBuffers && !cfgs->auxBuffers && matches[matchtry].require_aux)
+ continue;
+
+ /* In pbuffer-mode we need a pbuffer-capable format but we don't want double buffering */
+ if(pbuffer && (!cfgs->pbufferDrawable || cfgs->doubleBuffer))
+ continue;
+
+ if(matches[matchtry].exact_color) {
+ if(cfgs->redSize != redBits)
+ continue;
+ if(cfgs->greenSize != greenBits)
+ continue;
+ if(cfgs->blueSize != blueBits)
+ continue;
+ } else {
+ if(cfgs->redSize < redBits)
+ continue;
+ if(cfgs->greenSize < greenBits)
+ continue;
+ if(cfgs->blueSize < blueBits)
+ continue;
+ }
+ if(matches[matchtry].exact_alpha) {
+ if(cfgs->alphaSize != alphaBits)
+ continue;
+ } else {
+ if(cfgs->alphaSize < alphaBits)
+ continue;
+ }
- /* Exit the loop as we have found a format :) */
- if(exactDepthMatch) {
- iPixelFormat = cfgs->iPixelFormat;
- break;
- } else 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. */
- iPixelFormat = cfgs->iPixelFormat;
+ /* 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;
+
+ /* 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;
+
+ /* Check multisampling support */
+ if(cfgs->numSamples != numSamples)
+ 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.
+ */
+
+ /* Exit the loop as we have found a format :) */
+ if(exactDepthMatch) {
+ iPixelFormat = cfgs->iPixelFormat;
+ break;
+ } else 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. */
+ iPixelFormat = cfgs->iPixelFormat;
+ }
}
}
Module: wine
Branch: master
Commit: 21fd0a0460d218ed2c25037a80e7c38b5235dbed
URL: http://source.winehq.org/git/wine.git/?a=commit;h=21fd0a0460d218ed2c25037a8…
Author: Roy Shea <royshea(a)gmail.com>
Date: Thu Jul 17 16:52:02 2008 -0700
mstask: Generate C file with GUID definitions from mstask.idl.
---
.gitignore | 2 ++
dlls/mstask/Makefile.in | 2 ++
dlls/mstask/mstask_local.idl | 19 +++++++++++++++++++
3 files changed, 23 insertions(+), 0 deletions(-)
diff --git a/.gitignore b/.gitignore
index ab49a43..a60cefd 100644
--- a/.gitignore
+++ b/.gitignore
@@ -57,6 +57,8 @@ dlls/msi/msiserver.tlb
dlls/msi/msiserver_i.c
dlls/msi/sql.tab.c
dlls/msi/sql.tab.h
+dlls/mstask/mstask_local.h
+dlls/mstask/mstask_local_i.c
dlls/msvideo.dll16
dlls/msxml3/msxml3_v1.tlb
dlls/ole2.dll16
diff --git a/dlls/mstask/Makefile.in b/dlls/mstask/Makefile.in
index 2fd0a66..f05d63f 100644
--- a/dlls/mstask/Makefile.in
+++ b/dlls/mstask/Makefile.in
@@ -8,6 +8,8 @@ IMPORTS = kernel32
C_SRCS = \
mstask_main.c
+IDL_I_SRCS = mstask_local.idl
+
@MAKE_DLL_RULES@
@DEPENDENCIES@ # everything below this line is overwritten by make depend
diff --git a/dlls/mstask/mstask_local.idl b/dlls/mstask/mstask_local.idl
new file mode 100644
index 0000000..b1a044a
--- /dev/null
+++ b/dlls/mstask/mstask_local.idl
@@ -0,0 +1,19 @@
+/*
+ * Copyright (C) 2008 Google (Roy Shea)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include "mstask.idl"