Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47862 Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- dlls/d3dx9_36/surface.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/dlls/d3dx9_36/surface.c b/dlls/d3dx9_36/surface.c index b47509aa38a..29325d5c0a2 100644 --- a/dlls/d3dx9_36/surface.c +++ b/dlls/d3dx9_36/surface.c @@ -1972,6 +1972,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) { @@ -2003,8 +2005,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; } } @@ -2080,7 +2081,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); } }
From: Christian Costa titan.costa@gmail.com
Signed-off-by: Matteo Bruni mbruni@codeweavers.com ---
From staging. Do we know of any application affected by this?
dlls/d3dx9_36/tests/texture.c | 9 +++++++++ dlls/d3dx9_36/texture.c | 15 +++++++-------- 2 files changed, 16 insertions(+), 8 deletions(-)
diff --git a/dlls/d3dx9_36/tests/texture.c b/dlls/d3dx9_36/tests/texture.c index 229c857ac2e..3416a3318b2 100644 --- a/dlls/d3dx9_36/tests/texture.c +++ b/dlls/d3dx9_36/tests/texture.c @@ -448,6 +448,15 @@ static void test_D3DXCheckTextureRequirements(IDirect3DDevice9 *device) ok(width == 4, "Got unexpected width %d.\n", width); ok(height == 4, "Got unexpected height %d.\n", height); ok(format == D3DFMT_DXT5, "Got unexpected format %u.\n", format); + + width = 9; + height = 9; + hr = D3DXCheckTextureRequirements(device, &width, &height, &mipmaps, 0, &format, D3DPOOL_DEFAULT); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + ok(width == 12, "Got unexpected width %u.\n", width); + ok(height == 12, "Got unexpected height %u.\n", height); + ok(mipmaps == 1, "Got unexpected level count %u.\n", mipmaps); + ok(format == D3DFMT_DXT5, "Got unexpected format %u.\n", format); } else { diff --git a/dlls/d3dx9_36/texture.c b/dlls/d3dx9_36/texture.c index 8708ed702fd..6ee7d72e38e 100644 --- a/dlls/d3dx9_36/texture.c +++ b/dlls/d3dx9_36/texture.c @@ -19,7 +19,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */
- +#include <assert.h> #include "d3dx9_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3dx); @@ -337,13 +337,12 @@ HRESULT WINAPI D3DXCheckTextureRequirements(struct IDirect3DDevice9 *device, UIN else if (h == D3DX_DEFAULT) h = (width ? w : 256);
- if (fmt->block_width != 1 || fmt->block_height != 1) - { - if (w < fmt->block_width) - w = fmt->block_width; - if (h < fmt->block_height) - h = fmt->block_height; - } + assert(!(fmt->block_width & (fmt->block_width - 1))); + assert(!(fmt->block_height & (fmt->block_height - 1))); + if (w & (fmt->block_width - 1)) + w = (w + fmt->block_width) & ~(fmt->block_width - 1); + if (h & (fmt->block_height - 1)) + h = (h + fmt->block_height) & ~(fmt->block_height - 1);
if ((caps.TextureCaps & D3DPTEXTURECAPS_POW2) && (!is_pow2(w))) w = make_pow2(w);
Le 02/10/2019 à 20:22, Matteo Bruni a écrit :
From: Christian Costa titan.costa@gmail.com
Signed-off-by: Matteo Bruni mbruni@codeweavers.com
From staging. Do we know of any application affected by this?
Hi,
Yeah one of the few game demos I used to test my staging d3dx dxtn patch. I think it's Avencast : Rise of a mage demo but I'm not completely sure it's the very one.
Chris
On Wed, Oct 2, 2019 at 8:48 PM Christian Costa titan.costa@gmail.com wrote:
Le 02/10/2019 à 20:22, Matteo Bruni a écrit :
From: Christian Costa titan.costa@gmail.com
Signed-off-by: Matteo Bruni mbruni@codeweavers.com
From staging. Do we know of any application affected by this?
Hi,
Yeah one of the few game demos I used to test my staging d3dx dxtn patch. I think it's Avencast : Rise of a mage demo but I'm not completely sure it's the very one.
Chris
Good to know, thank you. I'll probably give it a spin at some point.
Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- I wrote this probably a couple of years ago when I noticed that one patch was assigned to Sebastian for review (my notes say 146709, to be specific). Then it happened again with 163168.
MAINTAINERS | 12 ------------ 1 file changed, 12 deletions(-)
diff --git a/MAINTAINERS b/MAINTAINERS index 344282727fc..3ed66f91123 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -205,10 +205,6 @@ P: Andrew Eikum aeikum@codeweavers.com P: Huw Davies huw@codeweavers.com F: dlls/oleaut32/typelib.c
-OpenMP -M: Sebastian Lackner sebastian@fds-team.de -F: dlls/vcomp*/ - Postscript Driver M: Huw Davies huw@codeweavers.com F: dlls/wineps.drv/ @@ -229,14 +225,6 @@ P: Huw Davies huw@codeweavers.com F: dlls/rpcrt4 F: tools/widl
-Threadpool -M: Sebastian Lackner sebastian@fds-team.de -F: dlls/ntdll/threadpool.c - -Timezone database -M: Sebastian Lackner sebastian@fds-team.de -F: loader/wine.inf.in - TWAIN P: Vincent Povirk vincent@codeweavers.com F: dlls/twain_32/