https://git.reactos.org/?p=reactos.git;a=commitdiff;h=31f063ffbfdfe7ee5e15f…
commit 31f063ffbfdfe7ee5e15f795cafeb6f78ca716e4
Author: winesync <ros-dev(a)reactos.org>
AuthorDate: Tue Jan 5 13:16:38 2021 +0100
Commit: Jérôme Gardou <jerome.gardou(a)reactos.org>
CommitDate: Thu Feb 4 16:37:07 2021 +0100
[WINESYNC] d3dx9: Don't release textures when D3DXSPRITE_DO_NOT_ADDREF_TEXTURE is
specified.
Signed-off-by: Sven Baars <sbaars(a)codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni(a)codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
wine commit id 9eda5c043047fd117441473651b2089b80a4ed80 by Sven Baars
<sbaars(a)codeweavers.com>
---
dll/directx/wine/d3dx9_36/sprite.c | 18 ++++++++++++------
modules/rostests/winetests/d3dx9_36/core.c | 14 ++++++++++++++
sdk/tools/winesync/d3dx9.cfg | 2 +-
3 files changed, 27 insertions(+), 7 deletions(-)
diff --git a/dll/directx/wine/d3dx9_36/sprite.c b/dll/directx/wine/d3dx9_36/sprite.c
index 277d14502fa..c47b6a12be0 100644
--- a/dll/directx/wine/d3dx9_36/sprite.c
+++ b/dll/directx/wine/d3dx9_36/sprite.c
@@ -116,10 +116,13 @@ static ULONG WINAPI d3dx9_sprite_Release(ID3DXSprite *iface)
{
int i;
- for (i = 0; i < sprite->sprite_count; ++i)
+ if (!(sprite->flags & D3DXSPRITE_DO_NOT_ADDREF_TEXTURE))
{
- if (sprite->sprites[i].texture)
- IDirect3DTexture9_Release(sprite->sprites[i].texture);
+ for (i = 0; i < sprite->sprite_count; ++i)
+ {
+ if (sprite->sprites[i].texture)
+ IDirect3DTexture9_Release(sprite->sprites[i].texture);
+ }
}
HeapFree(GetProcessHeap(), 0, sprite->sprites);
@@ -522,10 +525,13 @@ static HRESULT WINAPI d3dx9_sprite_OnResetDevice(ID3DXSprite
*iface)
TRACE("iface %p.\n", iface);
- for (i = 0; i < sprite->sprite_count; ++i)
+ if (!(sprite->flags & D3DXSPRITE_DO_NOT_ADDREF_TEXTURE))
{
- if (sprite->sprites[i].texture)
- IDirect3DTexture9_Release(sprite->sprites[i].texture);
+ for (i = 0; i < sprite->sprite_count; ++i)
+ {
+ if (sprite->sprites[i].texture)
+ IDirect3DTexture9_Release(sprite->sprites[i].texture);
+ }
}
sprite->sprite_count = 0;
diff --git a/modules/rostests/winetests/d3dx9_36/core.c
b/modules/rostests/winetests/d3dx9_36/core.c
index 020f18e622c..a8477591e87 100644
--- a/modules/rostests/winetests/d3dx9_36/core.c
+++ b/modules/rostests/winetests/d3dx9_36/core.c
@@ -306,6 +306,20 @@ static void test_ID3DXSprite(IDirect3DDevice9 *device)
hr = ID3DXSprite_End(sprite);
ok (hr == D3DERR_INVALIDCALL, "End returned %#x, expected %#x\n", hr,
D3DERR_INVALIDCALL);
+ /* Test D3DXSPRITE_DO_NOT_ADDREF_TEXTURE */
+ hr = ID3DXSprite_Begin(sprite, D3DXSPRITE_DO_NOT_ADDREF_TEXTURE);
+ ok (hr == D3D_OK, "Begin returned %#x, expected %#x\n", hr, D3D_OK);
+ hr = ID3DXSprite_Draw(sprite, tex2, &rect, ¢er, &pos,
D3DCOLOR_XRGB(255, 255, 255));
+ ok (hr == D3D_OK, "Draw returned %#x, expected %#x\n", hr, D3D_OK);
+ hr = ID3DXSprite_OnResetDevice(sprite);
+ ok (hr == D3D_OK, "OnResetDevice returned %#x, expected %#x\n", hr,
D3D_OK);
+ check_ref((IUnknown*)tex2, 1);
+
+ hr = ID3DXSprite_Begin(sprite, D3DXSPRITE_DO_NOT_ADDREF_TEXTURE);
+ ok (hr == D3D_OK, "Begin returned %#x, expected %#x\n", hr, D3D_OK);
+ hr = ID3DXSprite_Draw(sprite, tex2, &rect, ¢er, &pos,
D3DCOLOR_XRGB(255, 255, 255));
+ ok (hr == D3D_OK, "Draw returned %#x, expected %#x\n", hr, D3D_OK);
+
IDirect3DDevice9_EndScene(device);
check_release((IUnknown*)sprite, 0);
check_release((IUnknown*)tex2, 0);
diff --git a/sdk/tools/winesync/d3dx9.cfg b/sdk/tools/winesync/d3dx9.cfg
index cfedea25e50..8c7f985455c 100644
--- a/sdk/tools/winesync/d3dx9.cfg
+++ b/sdk/tools/winesync/d3dx9.cfg
@@ -34,4 +34,4 @@ files:
include/d3dx9tex.h: sdk/include/dxsdk/d3dx9tex.h
include/d3dx9xof.h: sdk/include/dxsdk/d3dx9xof.h
tags:
- wine: bffe111672972cb26c319c029ca469520742c720
+ wine: 9eda5c043047fd117441473651b2089b80a4ed80