Roderick Colenbrander : wined3d: Request a pixel format with alpha support in case of P8 render targets.

Alexandre Julliard julliard at winehq.org
Mon Mar 31 09:15:35 CDT 2008


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

Author: Roderick Colenbrander <thunderbird2k at gmx.net>
Date:   Sun Mar 30 21:36:03 2008 +0000

wined3d: Request a pixel format with alpha support in case of P8 render targets.

---

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

diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index 90828d6..a3a7222 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -237,6 +237,13 @@ WineD3DContext *CreateContext(IWineD3DDeviceImpl *This, IWineD3DSurfaceImpl *tar
             PUSH2(WGL_AUX_BUFFERS_ARB, 2);
         }
 
+        /* DirectDraw supports 8bit paletted render targets and these are used by old games like Starcraft and C&C.
+         * Most modern hardware doesn't support 8bit natively so we perform some form of 8bit -> 32bit conversion.
+         * The conversion (ab)uses the alpha component for storing the palette index. For this reason we require
+         * a format with 8bit alpha, so request A8R8G8B8. */
+        if(fmt == WINED3DFMT_P8)
+            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