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
f7356a34
Commit
f7356a34
authored
Mar 06, 2006
by
H. Verbeet
Committed by
Alexandre Julliard
Mar 06, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Fix the relation between surfaces and their container.
parent
fd2739b0
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
86 additions
and
6 deletions
+86
-6
surface.c
dlls/d3d8/surface.c
+25
-3
surface.c
dlls/d3d9/surface.c
+26
-2
cubetexture.c
dlls/wined3d/cubetexture.c
+3
-0
device.c
dlls/wined3d/device.c
+1
-1
surface.c
dlls/wined3d/surface.c
+24
-0
swapchain.c
dlls/wined3d/swapchain.c
+2
-0
texture.c
dlls/wined3d/texture.c
+3
-0
wined3d_interface.h
include/wine/wined3d_interface.h
+2
-0
No files found.
dlls/d3d8/surface.c
View file @
f7356a34
...
...
@@ -41,24 +41,46 @@ HRESULT WINAPI IDirect3DSurface8Impl_QueryInterface(LPDIRECT3DSURFACE8 iface, RE
ULONG
WINAPI
IDirect3DSurface8Impl_AddRef
(
LPDIRECT3DSURFACE8
iface
)
{
IDirect3DSurface8Impl
*
This
=
(
IDirect3DSurface8Impl
*
)
iface
;
ULONG
ref
=
InterlockedIncrement
(
&
This
->
ref
)
;
IUnknown
*
containerParent
=
NULL
;
TRACE
(
"(%p)
: AddRef from %ld
\n
"
,
This
,
ref
-
1
);
TRACE
(
"(%p)
\n
"
,
This
);
IWineD3DSurface_GetContainerParent
(
This
->
wineD3DSurface
,
&
containerParent
);
if
(
containerParent
)
{
/* Forward to the containerParent */
TRACE
(
"(%p) : Forwarding to %p
\n
"
,
This
,
containerParent
);
return
IUnknown_AddRef
(
containerParent
);
}
else
{
/* No container, handle our own refcounting */
ULONG
ref
=
InterlockedIncrement
(
&
This
->
ref
);
TRACE
(
"(%p) : AddRef from %ld
\n
"
,
This
,
ref
-
1
);
return
ref
;
}
}
ULONG
WINAPI
IDirect3DSurface8Impl_Release
(
LPDIRECT3DSURFACE8
iface
)
{
IDirect3DSurface8Impl
*
This
=
(
IDirect3DSurface8Impl
*
)
iface
;
ULONG
ref
=
InterlockedDecrement
(
&
This
->
ref
);
IUnknown
*
containerParent
=
NULL
;
TRACE
(
"(%p)
\n
"
,
This
);
IWineD3DSurface_GetContainerParent
(
This
->
wineD3DSurface
,
&
containerParent
);
if
(
containerParent
)
{
/* Forward to the containerParent */
TRACE
(
"(%p) : Forwarding to %p
\n
"
,
This
,
containerParent
);
return
IUnknown_Release
(
containerParent
);
}
else
{
/* No container, handle our own refcounting */
ULONG
ref
=
InterlockedDecrement
(
&
This
->
ref
);
TRACE
(
"(%p) : ReleaseRef to %ld
\n
"
,
This
,
ref
);
if
(
ref
==
0
)
{
IWineD3DSurface_Release
(
This
->
wineD3DSurface
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
}
return
ref
;
}
}
/* IDirect3DSurface8 IDirect3DResource8 Interface follow: */
...
...
dlls/d3d9/surface.c
View file @
f7356a34
...
...
@@ -42,24 +42,48 @@ HRESULT WINAPI IDirect3DSurface9Impl_QueryInterface(LPDIRECT3DSURFACE9 iface, RE
ULONG
WINAPI
IDirect3DSurface9Impl_AddRef
(
LPDIRECT3DSURFACE9
iface
)
{
IDirect3DSurface9Impl
*
This
=
(
IDirect3DSurface9Impl
*
)
iface
;
ULONG
ref
=
InterlockedIncrement
(
&
This
->
ref
);
IUnknown
*
containerParent
=
NULL
;
TRACE
(
"(%p)
\n
"
,
This
);
IWineD3DSurface_GetContainerParent
(
This
->
wineD3DSurface
,
&
containerParent
);
if
(
containerParent
)
{
/* Forward to the containerParent */
TRACE
(
"(%p) : Forwarding to %p
\n
"
,
This
,
containerParent
);
return
IUnknown_AddRef
(
containerParent
);
}
else
{
/* No container, handle our own refcounting */
ULONG
ref
=
InterlockedIncrement
(
&
This
->
ref
);
TRACE
(
"(%p) : AddRef from %ld
\n
"
,
This
,
ref
-
1
);
return
ref
;
}
}
ULONG
WINAPI
IDirect3DSurface9Impl_Release
(
LPDIRECT3DSURFACE9
iface
)
{
IDirect3DSurface9Impl
*
This
=
(
IDirect3DSurface9Impl
*
)
iface
;
ULONG
ref
=
InterlockedDecrement
(
&
This
->
ref
);
IUnknown
*
containerParent
=
NULL
;
TRACE
(
"(%p)
\n
"
,
This
);
IWineD3DSurface_GetContainerParent
(
This
->
wineD3DSurface
,
&
containerParent
);
if
(
containerParent
)
{
/* Forward to the containerParent */
TRACE
(
"(%p) : Forwarding to %p
\n
"
,
This
,
containerParent
);
return
IUnknown_Release
(
containerParent
);
}
else
{
/* No container, handle our own refcounting */
ULONG
ref
=
InterlockedDecrement
(
&
This
->
ref
);
TRACE
(
"(%p) : ReleaseRef to %ld
\n
"
,
This
,
ref
);
if
(
ref
==
0
)
{
IWineD3DSurface_Release
(
This
->
wineD3DSurface
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
}
return
ref
;
}
}
/* IDirect3DSurface9 IDirect3DResource9 Interface follow: */
...
...
dlls/wined3d/cubetexture.c
View file @
f7356a34
...
...
@@ -84,6 +84,9 @@ ULONG WINAPI IWineD3DCubeTextureImpl_Release(IWineD3DCubeTexture *iface) {
IUnknown
*
surfaceParent
;
/* Clean out the texture name we gave to the suface so that the surface doesn't try and release it */
IWineD3DSurface_SetGlTextureDesc
(
This
->
surfaces
[
j
][
i
],
0
,
0
);
/* Cleanup the container */
IWineD3DSurface_SetContainer
(
This
->
surfaces
[
j
][
i
],
0
);
/* Now, release the parent, which will take care of cleaning up the surface for us */
TRACE
(
"(%p) : Releasing surface%d %d %p
\n
"
,
This
,
j
,
i
,
This
->
surfaces
[
j
][
i
]);
IWineD3DSurface_GetParent
(
This
->
surfaces
[
j
][
i
],
&
surfaceParent
);
IUnknown_Release
(
surfaceParent
);
...
...
dlls/wined3d/device.c
View file @
f7356a34
...
...
@@ -1433,7 +1433,7 @@ HRESULT WINAPI IWineD3DDeviceImpl_CreateAdditionalSwapChain(IWineD3DDevice* ifac
&
This
->
depthStencilBuffer
,
NULL
/* pShared (always null)*/
);
if
(
This
->
depthStencilBuffer
!=
NULL
)
IWineD3DSurface_SetContainer
(
This
->
depthStencilBuffer
,
(
IWineD3DBase
*
)
iface
);
IWineD3DSurface_SetContainer
(
This
->
depthStencilBuffer
,
0
);
}
/** TODO: A check on width, height and multisample types
...
...
dlls/wined3d/surface.c
View file @
f7356a34
...
...
@@ -173,6 +173,29 @@ HRESULT WINAPI IWineD3DSurfaceImpl_GetParent(IWineD3DSurface *iface, IUnknown **
IWineD3DSurface IWineD3DSurface parts follow
****************************************************** */
HRESULT
WINAPI
IWineD3DSurfaceImpl_GetContainerParent
(
IWineD3DSurface
*
iface
,
IUnknown
**
ppContainerParent
)
{
IWineD3DSurfaceImpl
*
This
=
(
IWineD3DSurfaceImpl
*
)
iface
;
TRACE
(
"(%p) : ppContainerParent %p)
\n
"
,
This
,
ppContainerParent
);
if
(
!
ppContainerParent
)
{
ERR
(
"(%p) : Called without a valid ppContainerParent.
\n
"
,
This
);
}
if
(
This
->
container
)
{
IWineD3DBase_GetParent
(
This
->
container
,
ppContainerParent
);
if
(
!
ppContainerParent
)
{
/* WineD3D objects should always have a parent */
ERR
(
"(%p) : GetParent returned NULL
\n
"
,
This
);
}
IUnknown_Release
(
*
ppContainerParent
);
/* GetParent adds a reference; we want just the pointer */
}
else
{
*
ppContainerParent
=
NULL
;
}
return
D3D_OK
;
}
HRESULT
WINAPI
IWineD3DSurfaceImpl_GetContainer
(
IWineD3DSurface
*
iface
,
REFIID
riid
,
void
**
ppContainer
)
{
IWineD3DSurfaceImpl
*
This
=
(
IWineD3DSurfaceImpl
*
)
iface
;
IWineD3DBase
*
container
=
0
;
...
...
@@ -1439,6 +1462,7 @@ const IWineD3DSurfaceVtbl IWineD3DSurface_Vtbl =
IWineD3DSurfaceImpl_PreLoad
,
IWineD3DSurfaceImpl_GetType
,
/* IWineD3DSurface */
IWineD3DSurfaceImpl_GetContainerParent
,
IWineD3DSurfaceImpl_GetContainer
,
IWineD3DSurfaceImpl_GetDesc
,
IWineD3DSurfaceImpl_LockRect
,
...
...
dlls/wined3d/swapchain.c
View file @
f7356a34
...
...
@@ -93,12 +93,14 @@ ULONG WINAPI IWineD3DSwapChainImpl_Release(IWineD3DSwapChain *iface) {
IWineD3DDevice_SwapChainReleased
((
IWineD3DDevice
*
)
This
->
wineD3DDevice
,
iface
);
/* release the ref to the front and back buffer parents */
IWineD3DSurface_SetContainer
(
This
->
frontBuffer
,
0
);
IWineD3DSurface_GetParent
(
This
->
frontBuffer
,
&
bufferParent
);
IUnknown_Release
(
bufferParent
);
/* once for the get parent */
if
(
IUnknown_Release
(
bufferParent
)
>
0
){
FIXME
(
"(%p) Something's still holding the front buffer
\n
"
,
This
);
}
IWineD3DSurface_SetContainer
(
This
->
backBuffer
,
0
);
IWineD3DSurface_GetParent
(
This
->
backBuffer
,
&
bufferParent
);
IUnknown_Release
(
bufferParent
);
/* once for the get parent */
if
(
IUnknown_Release
(
bufferParent
)
>
0
){
...
...
dlls/wined3d/texture.c
View file @
f7356a34
...
...
@@ -66,6 +66,9 @@ ULONG WINAPI IWineD3DTextureImpl_Release(IWineD3DTexture *iface) {
IUnknown
*
surfaceParent
;
/* Clean out the texture name we gave to the suface so that the surface doesn't try and release it */
IWineD3DSurface_SetGlTextureDesc
(
This
->
surfaces
[
i
],
0
,
0
);
/* Cleanup the container */
IWineD3DSurface_SetContainer
(
This
->
surfaces
[
i
],
0
);
/* Now, release the parent, which will take care of cleaning up the surface for us */
IWineD3DSurface_GetParent
(
This
->
surfaces
[
i
],
&
surfaceParent
);
IUnknown_Release
(
surfaceParent
);
IUnknown_Release
(
surfaceParent
);
...
...
include/wine/wined3d_interface.h
View file @
f7356a34
...
...
@@ -1045,6 +1045,7 @@ DECLARE_INTERFACE_(IWineD3DSurface,IWineD3DResource)
STDMETHOD_
(
void
,
PreLoad
)(
THIS
)
PURE
;
STDMETHOD_
(
D3DRESOURCETYPE
,
GetType
)(
THIS
)
PURE
;
/*** IWineD3DSurface methods ***/
STDMETHOD
(
GetContainerParent
)(
THIS_
IUnknown
**
ppContainerParent
)
PURE
;
STDMETHOD
(
GetContainer
)(
THIS_
REFIID
riid
,
void
**
ppContainer
)
PURE
;
STDMETHOD
(
GetDesc
)(
THIS_
WINED3DSURFACE_DESC
*
pDesc
)
PURE
;
STDMETHOD
(
LockRect
)(
THIS_
D3DLOCKED_RECT
*
pLockedRect
,
CONST
RECT
*
pRect
,
DWORD
Flags
)
PURE
;
...
...
@@ -1082,6 +1083,7 @@ DECLARE_INTERFACE_(IWineD3DSurface,IWineD3DResource)
#define IWineD3DSurface_PreLoad(p) (p)->lpVtbl->PreLoad(p)
#define IWineD3DSurface_GetType(p) (p)->lpVtbl->GetType(p)
/*** IWineD3DSurface methods ***/
#define IWineD3DSurface_GetContainerParent(p,a) (p)->lpVtbl->GetContainerParent(p,a)
#define IWineD3DSurface_GetContainer(p,a,b) (p)->lpVtbl->GetContainer(p,a,b)
#define IWineD3DSurface_GetDesc(p,a) (p)->lpVtbl->GetDesc(p,a)
#define IWineD3DSurface_LockRect(p,a,b,c) (p)->lpVtbl->LockRect(p,a,b,c)
...
...
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