[dx86] DXTn stride support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Implementing proper dxt1/3/5 patch broke UT2003 support and I finally have worked out why. At dx8+, the stride for a dxtn texture is block based not row based, and this patch now makes the main menu look correct (ie high res as well). Phew!

Changelog

DXTn stride is to the next block, which is the equivalent to 4 rows worth of bytes.

Jason

? dlls/d3d8/directx.dx76
? dlls/d3d8/dx81
? dlls/d3d8/dx82
? dlls/d3d8/dx83
? dlls/d3d8/dx84
? dlls/d3d8/dx85
? dlls/d3d8/lightsdebug
? dlls/d3d8/lockfix
? dlls/d3d8/manual_viewprojworld
? dlls/d3d8/wip-08092003
? dlls/d3d8/wip-3dmark
Index: dlls/d3d8/drawprim.c
===================================================================
RCS file: /home/wine/wine/dlls/d3d8/drawprim.c,v
retrieving revision 1.12
diff -u -r1.12 drawprim.c
--- dlls/d3d8/drawprim.c	3 Oct 2003 03:35:53 -0000	1.12
+++ dlls/d3d8/drawprim.c	6 Oct 2003 20:48:58 -0000
@@ -1487,7 +1487,7 @@
                     TRACE("Saving texture %s (Format:%s)\n", buffer, debug_d3dformat(((IDirect3DBaseTexture8Impl *)This->StateBlock->textures[textureNo])->format));
                     IDirect3DTexture8Impl_GetSurfaceLevel((LPDIRECT3DTEXTURE8) This->StateBlock->textures[textureNo], 0, &pSur);
                     IDirect3DSurface8Impl_SaveSnapshot(pSur, buffer);
-                    IDirect3DSurface8Impl_ReleaseRef(pSur);
+                    IDirect3DSurface8Impl_Release(pSur);
                 }
             }
            }
Index: dlls/d3d8/surface.c
===================================================================
RCS file: /home/wine/wine/dlls/d3d8/surface.c,v
retrieving revision 1.24
diff -u -r1.24 surface.c
--- dlls/d3d8/surface.c	30 Sep 2003 00:20:08 -0000	1.24
+++ dlls/d3d8/surface.c	6 Oct 2003 20:49:01 -0000
@@ -152,10 +152,16 @@
       TRACE("(%p) : rect@%p flags(%08lx), output lockedRect@%p, memory@%p\n", This, pRect, Flags, pLockedRect, This->allocatedMemory);
     }
 
-    pLockedRect->Pitch = This->bytesPerPixel * This->myDesc.Width;  /* Bytes / row */    
-    if (This->myDesc.Format == D3DFMT_DXT1) /* DXT1 is half byte per pixel */
-        pLockedRect->Pitch = pLockedRect->Pitch/2;
-    
+    /* DXTn formats dont have exact pitches as they are to the newt row of blocks, 
+         where each block is 4x4 pixels, 8 bytes (dxt1) and 16 bytes (dxt3/5)      
+          ie pitch = (width/4) * bytes per block                                  */
+    if (This->myDesc.Format == D3DFMT_DXT1) /* DXT1 is 8 bytes per block */
+        pLockedRect->Pitch = (This->myDesc.Width/4) * 8;
+    else if (This->myDesc.Format == D3DFMT_DXT3 || This->myDesc.Format == D3DFMT_DXT5) /* DXT3/5 is 16 bytes per block */
+        pLockedRect->Pitch = (This->myDesc.Width/4) * 16;
+    else
+        pLockedRect->Pitch = This->bytesPerPixel * This->myDesc.Width;  /* Bytes / row */    
+
     if (NULL == pRect) {
       pLockedRect->pBits = This->allocatedMemory;
       This->lockedRect.left   = 0;

[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux