Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
73b5fb05
Commit
73b5fb05
authored
Dec 18, 2006
by
Markus Amsler
Committed by
Alexandre Julliard
Dec 18, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3d9: Fix implicit swap chain refcounting.
parent
5e0fc621
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
40 additions
and
31 deletions
+40
-31
d3d9_private.h
dlls/d3d9/d3d9_private.h
+3
-0
directx.c
dlls/d3d9/directx.c
+8
-6
swapchain.c
dlls/d3d9/swapchain.c
+6
-2
device.c
dlls/d3d9/tests/device.c
+23
-23
No files found.
dlls/d3d9/d3d9_private.h
View file @
73b5fb05
...
...
@@ -261,6 +261,9 @@ typedef struct IDirect3DSwapChain9Impl
/* Parent reference */
LPDIRECT3DDEVICE9
parentDevice
;
/* Flags an implicit swap chain */
BOOL
isImplicit
;
}
IDirect3DSwapChain9Impl
;
/* ------------------ */
...
...
dlls/d3d9/directx.c
View file @
73b5fb05
...
...
@@ -236,8 +236,9 @@ HRESULT WINAPI D3D9CB_CreateAdditionalSwapChain(IUnknown *device,
if
(
SUCCEEDED
(
res
))
{
*
ppSwapChain
=
d3dSwapChain
->
wineD3DSwapChain
;
IUnknown_Release
(
d3dSwapChain
->
parentDevice
);
d3dSwapChain
->
parentDevice
=
NULL
;
d3dSwapChain
->
isImplicit
=
TRUE
;
/* Implicit swap chains are created with an refcount of 0 */
IUnknown_Release
((
IUnknown
*
)
d3dSwapChain
);
}
else
{
*
ppSwapChain
=
NULL
;
}
...
...
@@ -261,12 +262,13 @@ HRESULT WINAPI D3D9CB_CreateAdditionalSwapChain(IUnknown *device,
}
ULONG
WINAPI
D3D9CB_DestroySwapChain
(
IWineD3DSwapChain
*
pSwapChain
)
{
I
Unknown
*
swapChainParent
;
I
Direct3DSwapChain9Impl
*
swapChainParent
;
TRACE
(
"(%p) call back
\n
"
,
pSwapChain
);
IWineD3DSwapChain_GetParent
(
pSwapChain
,
&
swapChainParent
);
IUnknown_Release
(
swapChainParent
);
return
IUnknown_Release
(
swapChainParent
);
IWineD3DSwapChain_GetParent
(
pSwapChain
,(
IUnknown
**
)
&
swapChainParent
);
swapChainParent
->
isImplicit
=
FALSE
;
/* Swap chain had refcount of 0 GetParent addrefed to 1, so 1 Release is enough */
return
IDirect3DSwapChain9_Release
((
IDirect3DSwapChain9
*
)
swapChainParent
);
}
/* Internal function called back during the CreateDevice to create a render target */
...
...
dlls/d3d9/swapchain.c
View file @
73b5fb05
...
...
@@ -48,6 +48,8 @@ static ULONG WINAPI IDirect3DSwapChain9Impl_AddRef(LPDIRECT3DSWAPCHAIN9 iface) {
TRACE
(
"(%p) : AddRef from %d
\n
"
,
This
,
ref
-
1
);
if
(
ref
==
1
&&
This
->
parentDevice
)
IUnknown_AddRef
(
This
->
parentDevice
);
return
ref
;
}
...
...
@@ -58,9 +60,11 @@ static ULONG WINAPI IDirect3DSwapChain9Impl_Release(LPDIRECT3DSWAPCHAIN9 iface)
TRACE
(
"(%p) : ReleaseRef to %d
\n
"
,
This
,
ref
);
if
(
ref
==
0
)
{
IWineD3DSwapChain_Destroy
(
This
->
wineD3DSwapChain
,
D3D9CB_DestroyRenderTarget
);
if
(
This
->
parentDevice
)
IUnknown_Release
(
This
->
parentDevice
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
if
(
!
This
->
isImplicit
)
{
IWineD3DSwapChain_Destroy
(
This
->
wineD3DSwapChain
,
D3D9CB_DestroyRenderTarget
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
}
}
return
ref
;
}
...
...
dlls/d3d9/tests/device.c
View file @
73b5fb05
...
...
@@ -358,41 +358,41 @@ static void test_refcount(void)
* - the refcount is not forwarded to the container.
*/
hr
=
IDirect3DDevice9_GetSwapChain
(
pDevice
,
0
,
&
pSwapChain
);
todo_wine
CHECK_CALL
(
hr
,
"GetSwapChain"
,
pDevice
,
++
refcount
);
CHECK_CALL
(
hr
,
"GetSwapChain"
,
pDevice
,
++
refcount
);
if
(
pSwapChain
)
{
todo_wine
CHECK_REFCOUNT
(
pSwapChain
,
1
);
CHECK_REFCOUNT
(
pSwapChain
,
1
);
hr
=
IDirect3DDevice9_GetRenderTarget
(
pDevice
,
0
,
&
pRenderTarget
);
todo_wine
CHECK_CALL
(
hr
,
"GetRenderTarget"
,
pDevice
,
++
refcount
);
todo_wine
CHECK_REFCOUNT
(
pSwapChain
,
1
);
CHECK_CALL
(
hr
,
"GetRenderTarget"
,
pDevice
,
++
refcount
);
CHECK_REFCOUNT
(
pSwapChain
,
1
);
if
(
pRenderTarget
)
{
CHECK_SURFACE_CONTAINER
(
pRenderTarget
,
IID_IDirect3DSwapChain9
,
pSwapChain
);
CHECK_REFCOUNT
(
pRenderTarget
,
1
);
CHECK_ADDREF_REFCOUNT
(
pRenderTarget
,
2
);
todo_wine
CHECK_REFCOUNT
(
pDevice
,
refcount
);
CHECK_REFCOUNT
(
pDevice
,
refcount
);
CHECK_RELEASE_REFCOUNT
(
pRenderTarget
,
1
);
todo_wine
CHECK_REFCOUNT
(
pDevice
,
refcount
);
CHECK_REFCOUNT
(
pDevice
,
refcount
);
hr
=
IDirect3DDevice9_GetRenderTarget
(
pDevice
,
0
,
&
pRenderTarget
);
todo_wine
CHECK_CALL
(
hr
,
"GetRenderTarget"
,
pDevice
,
refcount
);
CHECK_CALL
(
hr
,
"GetRenderTarget"
,
pDevice
,
refcount
);
CHECK_REFCOUNT
(
pRenderTarget
,
2
);
CHECK_RELEASE_REFCOUNT
(
pRenderTarget
,
1
);
CHECK_RELEASE_REFCOUNT
(
pRenderTarget
,
0
);
todo_wine
CHECK_REFCOUNT
(
pDevice
,
--
refcount
);
CHECK_REFCOUNT
(
pDevice
,
--
refcount
);
/* The render target is released with the device, so AddRef with refcount=0 is fine here. */
CHECK_ADDREF_REFCOUNT
(
pRenderTarget
,
1
);
todo_wine
CHECK_REFCOUNT
(
pDevice
,
++
refcount
);
CHECK_REFCOUNT
(
pDevice
,
++
refcount
);
CHECK_RELEASE_REFCOUNT
(
pRenderTarget
,
0
);
todo_wine
CHECK_REFCOUNT
(
pDevice
,
--
refcount
);
CHECK_REFCOUNT
(
pDevice
,
--
refcount
);
}
/* Render target and back buffer are identical. */
hr
=
IDirect3DDevice9_GetBackBuffer
(
pDevice
,
0
,
0
,
0
,
&
pBackBuffer
);
todo_wine
CHECK_CALL
(
hr
,
"GetBackBuffer"
,
pDevice
,
++
refcount
);
CHECK_CALL
(
hr
,
"GetBackBuffer"
,
pDevice
,
++
refcount
);
if
(
pBackBuffer
)
{
CHECK_RELEASE_REFCOUNT
(
pBackBuffer
,
0
);
...
...
@@ -400,39 +400,39 @@ static void test_refcount(void)
pRenderTarget
,
pBackBuffer
);
pBackBuffer
=
NULL
;
}
todo_wine
CHECK_REFCOUNT
(
pDevice
,
--
refcount
);
CHECK_REFCOUNT
(
pDevice
,
--
refcount
);
hr
=
IDirect3DDevice9_GetDepthStencilSurface
(
pDevice
,
&
pStencilSurface
);
todo_wine
CHECK_CALL
(
hr
,
"GetDepthStencilSurface"
,
pDevice
,
++
refcount
);
todo_wine
CHECK_REFCOUNT
(
pSwapChain
,
1
);
CHECK_CALL
(
hr
,
"GetDepthStencilSurface"
,
pDevice
,
++
refcount
);
CHECK_REFCOUNT
(
pSwapChain
,
1
);
if
(
pStencilSurface
)
{
CHECK_SURFACE_CONTAINER
(
pStencilSurface
,
IID_IDirect3DDevice9
,
pDevice
);
CHECK_REFCOUNT
(
pStencilSurface
,
1
);
CHECK_ADDREF_REFCOUNT
(
pStencilSurface
,
2
);
todo_wine
CHECK_REFCOUNT
(
pDevice
,
refcount
);
CHECK_REFCOUNT
(
pDevice
,
refcount
);
CHECK_RELEASE_REFCOUNT
(
pStencilSurface
,
1
);
todo_wine
CHECK_REFCOUNT
(
pDevice
,
refcount
);
CHECK_REFCOUNT
(
pDevice
,
refcount
);
CHECK_RELEASE_REFCOUNT
(
pStencilSurface
,
0
);
todo_wine
CHECK_REFCOUNT
(
pDevice
,
--
refcount
);
CHECK_REFCOUNT
(
pDevice
,
--
refcount
);
/* The stencil surface is released with the device, so AddRef with refcount=0 is fine here. */
CHECK_ADDREF_REFCOUNT
(
pStencilSurface
,
1
);
todo_wine
CHECK_REFCOUNT
(
pDevice
,
++
refcount
);
CHECK_REFCOUNT
(
pDevice
,
++
refcount
);
CHECK_RELEASE_REFCOUNT
(
pStencilSurface
,
0
);
todo_wine
CHECK_REFCOUNT
(
pDevice
,
--
refcount
);
CHECK_REFCOUNT
(
pDevice
,
--
refcount
);
pStencilSurface
=
NULL
;
}
todo_wine
CHECK_RELEASE_REFCOUNT
(
pSwapChain
,
0
);
CHECK_RELEASE_REFCOUNT
(
pSwapChain
,
0
);
CHECK_REFCOUNT
(
pDevice
,
--
refcount
);
/* The implicit swapchwin is released with the device, so AddRef with refcount=0 is fine here. */
todo_wine
CHECK_ADDREF_REFCOUNT
(
pSwapChain
,
1
);
todo_wine
CHECK_REFCOUNT
(
pDevice
,
++
refcount
);
todo_wine
CHECK_RELEASE_REFCOUNT
(
pSwapChain
,
0
);
CHECK_ADDREF_REFCOUNT
(
pSwapChain
,
1
);
CHECK_REFCOUNT
(
pDevice
,
++
refcount
);
CHECK_RELEASE_REFCOUNT
(
pSwapChain
,
0
);
CHECK_REFCOUNT
(
pDevice
,
--
refcount
);
pSwapChain
=
NULL
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment