Roderick Colenbrander : wined3d: Request alpha in backbuffer mode, to work correctly with multiple opengl pixel formats.

Alexandre Julliard julliard at winehq.org
Mon Feb 25 06:51:00 CST 2008


Module: wine
Branch: master
Commit: 68467cf344e51f0ee0773d7e876916a4f8998e68
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=68467cf344e51f0ee0773d7e876916a4f8998e68

Author: Roderick Colenbrander <thunderbird2k at gmx.net>
Date:   Fri Feb 22 23:27:38 2008 +0000

wined3d: Request alpha in backbuffer mode, to work correctly with multiple opengl pixel formats.

---

 dlls/wined3d/context.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index 19d2f30..769949a 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -210,6 +210,7 @@ WineD3DContext *CreateContext(IWineD3DDeviceImpl *This, IWineD3DSurfaceImpl *tar
         int attribs[256];
         int nAttribs = 0;
         unsigned int nFormats;
+        WINED3DFORMAT fmt = target->resource.format;
 
         hdc = GetDC(win_handle);
         if(hdc == NULL) {
@@ -224,7 +225,15 @@ WineD3DContext *CreateContext(IWineD3DDeviceImpl *This, IWineD3DSurfaceImpl *tar
         PUSH2(WGL_SUPPORT_OPENGL_ARB, GL_TRUE);
         PUSH2(WGL_ACCELERATION_ARB, WGL_FULL_ACCELERATION_ARB); /* Make sure we receive an accelerated format. On windows (at least on ATI) this is not always the case */
 
-        if(!getColorBits(target->resource.format, &redBits, &greenBits, &blueBits, &alphaBits, &colorBits)) {
+        /* In case of ORM_BACKBUFFER, make sure to request an alpha component for X4R4G4B4/X8R8G8B8 as we might need it for the backbuffer. */
+        if(wined3d_settings.offscreen_rendering_mode == ORM_BACKBUFFER) {
+            if(target->resource.format == WINED3DFMT_X4R4G4B4)
+                fmt = WINED3DFMT_A4R4G4B4;
+            else if(target->resource.format == WINED3DFMT_X8R8G8B8)
+                fmt = WINED3DFMT_A8R8G8B8;
+        }
+
+        if(!getColorBits(fmt, &redBits, &greenBits, &blueBits, &alphaBits, &colorBits)) {
             ERR("Unable to get color bits for format %#x!\n", target->resource.format);
             return FALSE;
         }




More information about the wine-cvs mailing list