wined3d: Request a pixel format with alpha support in case of P8 render targets.
authorRoderick Colenbrander <thunderbird2k@gmx.net>
Sun, 30 Mar 2008 21:36:03 +0000 (21:36 +0000)
committerAlexandre Julliard <julliard@winehq.org>
Mon, 31 Mar 2008 11:01:24 +0000 (13:01 +0200)
dlls/wined3d/context.c

index 90828d654426d084862468329852994049bb1ac2..a3a7222219b6c9056f4368430b54c400c8f63ce9 100644 (file)
@@ -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;