From 2b8a7dca3857496bd6a1500cc6dd5800257d8fa3 Mon Sep 17 00:00:00 2001 From: Oliver Stieber Date: Tue, 27 Sep 2005 09:32:29 +0000 Subject: [PATCH] Correct a problem with locking nonpower 2 back and front buffers. --- dlls/wined3d/surface.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c index b9c0be9bc09..b0efbaaa36d 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c @@ -285,7 +285,8 @@ HRESULT WINAPI IWineD3DSurfaceImpl_LockRect(IWineD3DSurface *iface, D3DLOCKED_RE This->resource.format == WINED3DFMT_DXT4 || This->resource.format == WINED3DFMT_DXT5) /* DXT2/3/4/5 is 16 bytes per block */ pLockedRect->Pitch = (This->currentDesc.Width >> 2) << 4; else { - if (NP2_REPACK == wined3d_settings.nonpower2_mode) { + if (NP2_REPACK == wined3d_settings.nonpower2_mode || This->resource.usage & D3DUSAGE_RENDERTARGET) { + /* Front and back buffers are always lockes/unlocked on currentDesc.Width */ pLockedRect->Pitch = This->bytesPerPixel * This->currentDesc.Width; /* Bytes / row */ } else { pLockedRect->Pitch = This->bytesPerPixel * This->pow2Width;