https://git.reactos.org/?p=reactos.git;a=commitdiff;h=d2eac4cdbf8342eea0f0c1...
commit d2eac4cdbf8342eea0f0c1770fbbdd56d0dc7ada Author: winesync ros-dev@reactos.org AuthorDate: Mon Sep 21 23:00:51 2020 +0200 Commit: Jérôme Gardou jerome.gardou@reactos.org CommitDate: Thu Feb 4 16:37:04 2021 +0100
[WINESYNC] d3dx9: Fix pitch passed to DXTn [de]compression functions.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47862 Signed-off-by: Matteo Bruni mbruni@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
wine commit id 9069913dbba0914b80544ce4afb9e7285efad2a5 by Matteo Bruni mbruni@codeweavers.com --- dll/directx/wine/d3dx9_36/surface.c | 8 +++++--- sdk/tools/winesync/d3dx9.cfg | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/dll/directx/wine/d3dx9_36/surface.c b/dll/directx/wine/d3dx9_36/surface.c index df4c5a725bb..eaaca8ca252 100644 --- a/dll/directx/wine/d3dx9_36/surface.c +++ b/dll/directx/wine/d3dx9_36/surface.c @@ -1976,6 +1976,8 @@ HRESULT WINAPI D3DXLoadSurfaceFromMemory(IDirect3DSurface9 *dst_surface, int i, int j, void *texel); unsigned int x, y;
+ src_pitch = src_pitch * srcformatdesc->block_width / srcformatdesc->block_byte_count; + src_uncompressed = heap_alloc(src_size.width * src_size.height * sizeof(DWORD)); if (!src_uncompressed) { @@ -2007,8 +2009,7 @@ HRESULT WINAPI D3DXLoadSurfaceFromMemory(IDirect3DSurface9 *dst_surface, DWORD *ptr = &src_uncompressed[y * src_size.width]; for (x = 0; x < src_size.width; ++x) { - fetch_dxt_texel(src_pitch / sizeof(DWORD), src_memory, - x + src_rect->left, y + src_rect->top, ptr); + fetch_dxt_texel(src_pitch, src_memory, x + src_rect->left, y + src_rect->top, ptr); ++ptr; } } @@ -2084,7 +2085,8 @@ HRESULT WINAPI D3DXLoadSurfaceFromMemory(IDirect3DSurface9 *dst_surface, ERR("Unexpected destination compressed format %u.\n", surfdesc.Format); } tx_compress_dxtn(4, dst_size_aligned.width, dst_size_aligned.height, - dst_uncompressed, gl_format, lockrect.pBits, lockrect.Pitch); + dst_uncompressed, gl_format, lockrect.pBits, + lockrect.Pitch * destformatdesc->block_width / destformatdesc->block_byte_count); heap_free(dst_uncompressed); } } diff --git a/sdk/tools/winesync/d3dx9.cfg b/sdk/tools/winesync/d3dx9.cfg index cd12df31d7f..e3f20fc947c 100644 --- a/sdk/tools/winesync/d3dx9.cfg +++ b/sdk/tools/winesync/d3dx9.cfg @@ -15,4 +15,4 @@ files: {include/d3dx9.h: sdk/include/dxsdk/d3dx9.h, include/d3dx9anim.h: sdk/inc include/d3dx9mesh.h: sdk/include/dxsdk/d3dx9mesh.h, include/d3dx9of.h: sdk/include/dxsdk/d3dx9of.h, include/d3dx9shader.h: sdk/include/dxsdk/d3dx9shader.h, include/d3dx9shape.h: sdk/include/dxsdk/d3dx9shape.h, include/d3dx9tex.h: sdk/include/dxsdk/d3dx9tex.h, include/d3dx9xof.h: sdk/include/dxsdk/d3dx9xof.h} -tags: {wine: a172aead8d542b92709545d8bcd992f03ee19d82} +tags: {wine: 9069913dbba0914b80544ce4afb9e7285efad2a5}