Stefan Dösinger : wined3d: Remove the X channel fixup in render target unlocking.

Alexandre Julliard julliard at winehq.org
Fri Nov 30 07:56:21 CST 2007


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

Author: Stefan Dösinger <stefan at codeweavers.com>
Date:   Wed Nov 28 21:26:31 2007 +0100

wined3d: Remove the X channel fixup in render target unlocking.

---

 dlls/wined3d/surface.c |   59 +++++++----------------------------------------
 1 files changed, 9 insertions(+), 50 deletions(-)

diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 2030f95..0ff1bc7 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -1002,64 +1002,23 @@ static void flush_to_framebuffer_drawpixels(IWineD3DSurfaceImpl *This) {
         case WINED3DFMT_R5G6B5:
         case WINED3DFMT_A1R5G5B5:
         case WINED3DFMT_R8G8B8:
-            type = This->glDescription.glType;
-            fmt = This->glDescription.glFormat;
-            mem = This->resource.allocatedMemory;
-            bpp = This->bytesPerPixel;
-            break;
-
         case WINED3DFMT_X4R4G4B4:
-        {
-            int size;
-            unsigned short *data;
-            data = (unsigned short *)This->resource.allocatedMemory;
-            size = (This->lockedRect.bottom - This->lockedRect.top) * (This->lockedRect.right - This->lockedRect.left);
-            while(size > 0) {
-                *data |= 0xF000;
-                data++;
-                size--;
-            }
-            type = This->glDescription.glType;
-            fmt = This->glDescription.glFormat;
-            mem = This->resource.allocatedMemory;
-            bpp = This->bytesPerPixel;
-        }
-        break;
-
         case WINED3DFMT_X1R5G5B5:
-        {
-            int size;
-            unsigned short *data;
-            data = (unsigned short *)This->resource.allocatedMemory;
-            size = (This->lockedRect.bottom - This->lockedRect.top) * (This->lockedRect.right - This->lockedRect.left);
-            while(size > 0) {
-                *data |= 0x8000;
-                data++;
-                size--;
-            }
             type = This->glDescription.glType;
             fmt = This->glDescription.glFormat;
             mem = This->resource.allocatedMemory;
             bpp = This->bytesPerPixel;
-        }
-        break;
+            break;
 
+        /* In the past times we used to set the X channel of X8R8G8B8 and the above formats to
+         * 1.0 because it happened to fix the intro movie in Pirates. However, this seems wrong.
+         * If the game uses an X8R8G8B8 back buffer the GL alpha channel should not make any differences,
+         * and the bug must be somewhere else. If we really have to set the alpha channel to 1.0 in
+         * this case do it by clearing it after the draw instead of fixing it up in the CPU. Blending
+         * is disabled via CTXUSAGE_BLIT context setup, so in the glDrawPixels call it does not
+         * have any effects
+         */
         case WINED3DFMT_X8R8G8B8:
-        {
-            /* make sure the X byte is set to alpha on, since it 
-               could be any random value. This fixes the intro movie in Pirates! */
-            int size;
-            unsigned int *data;
-            data = (unsigned int *)This->resource.allocatedMemory;
-            size = (This->lockedRect.bottom - This->lockedRect.top) * (This->lockedRect.right - This->lockedRect.left);
-            while(size > 0) {
-                *data |= 0xFF000000;
-                data++;
-                size--;
-            }
-        }
-        /* Fall through */
-
         case WINED3DFMT_A8R8G8B8:
         {
             glPixelStorei(GL_PACK_SWAP_BYTES, TRUE);




More information about the wine-cvs mailing list