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
520daf86
Commit
520daf86
authored
Jul 30, 2022
by
Zebediah Figura
Committed by
Alexandre Julliard
Oct 10, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3d8: Add reference counting helpers for textures.
parent
99cee90c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
54 additions
and
105 deletions
+54
-105
texture.c
dlls/d3d8/texture.c
+54
-105
No files found.
dlls/d3d8/texture.c
View file @
520daf86
...
...
@@ -20,6 +20,54 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
d3d8
);
static
ULONG
d3d8_texture_incref
(
struct
d3d8_texture
*
texture
)
{
ULONG
ref
=
InterlockedIncrement
(
&
texture
->
resource
.
refcount
);
TRACE
(
"%p increasing refcount to %u.
\n
"
,
texture
,
ref
);
if
(
ref
==
1
)
{
struct
d3d8_surface
*
surface
;
IDirect3DDevice8_AddRef
(
texture
->
parent_device
);
wined3d_mutex_lock
();
LIST_FOR_EACH_ENTRY
(
surface
,
&
texture
->
rtv_list
,
struct
d3d8_surface
,
rtv_entry
)
{
wined3d_rendertarget_view_incref
(
surface
->
wined3d_rtv
);
}
wined3d_texture_incref
(
texture
->
wined3d_texture
);
wined3d_mutex_unlock
();
}
return
ref
;
}
static
ULONG
d3d8_texture_decref
(
struct
d3d8_texture
*
texture
)
{
ULONG
ref
=
InterlockedDecrement
(
&
texture
->
resource
.
refcount
);
TRACE
(
"%p decreasing refcount to %u.
\n
"
,
texture
,
ref
);
if
(
!
ref
)
{
IDirect3DDevice8
*
parent_device
=
texture
->
parent_device
;
struct
d3d8_surface
*
surface
;
wined3d_mutex_lock
();
LIST_FOR_EACH_ENTRY
(
surface
,
&
texture
->
rtv_list
,
struct
d3d8_surface
,
rtv_entry
)
{
wined3d_rendertarget_view_decref
(
surface
->
wined3d_rtv
);
}
wined3d_texture_decref
(
texture
->
wined3d_texture
);
wined3d_mutex_unlock
();
/* Release the device last, as it may cause the device to be destroyed. */
IDirect3DDevice8_Release
(
parent_device
);
}
return
ref
;
}
static
void
d3d8_texture_preload
(
struct
d3d8_texture
*
texture
)
{
wined3d_mutex_lock
();
...
...
@@ -65,51 +113,15 @@ static HRESULT WINAPI d3d8_texture_2d_QueryInterface(IDirect3DTexture8 *iface, R
static
ULONG
WINAPI
d3d8_texture_2d_AddRef
(
IDirect3DTexture8
*
iface
)
{
struct
d3d8_texture
*
texture
=
impl_from_IDirect3DTexture8
(
iface
);
ULONG
ref
=
InterlockedIncrement
(
&
texture
->
resource
.
refcount
);
TRACE
(
"%p increasing refcount to %u.
\n
"
,
iface
,
ref
);
if
(
ref
==
1
)
{
struct
d3d8_surface
*
surface
;
IDirect3DDevice8_AddRef
(
texture
->
parent_device
);
wined3d_mutex_lock
();
LIST_FOR_EACH_ENTRY
(
surface
,
&
texture
->
rtv_list
,
struct
d3d8_surface
,
rtv_entry
)
{
wined3d_rendertarget_view_incref
(
surface
->
wined3d_rtv
);
}
wined3d_texture_incref
(
texture
->
wined3d_texture
);
wined3d_mutex_unlock
();
}
return
ref
;
return
d3d8_texture_incref
(
texture
);
}
static
ULONG
WINAPI
d3d8_texture_2d_Release
(
IDirect3DTexture8
*
iface
)
{
struct
d3d8_texture
*
texture
=
impl_from_IDirect3DTexture8
(
iface
);
ULONG
ref
=
InterlockedDecrement
(
&
texture
->
resource
.
refcount
);
TRACE
(
"%p decreasing refcount to %u.
\n
"
,
iface
,
ref
);
if
(
!
ref
)
{
IDirect3DDevice8
*
parent_device
=
texture
->
parent_device
;
struct
d3d8_surface
*
surface
;
wined3d_mutex_lock
();
LIST_FOR_EACH_ENTRY
(
surface
,
&
texture
->
rtv_list
,
struct
d3d8_surface
,
rtv_entry
)
{
wined3d_rendertarget_view_decref
(
surface
->
wined3d_rtv
);
}
wined3d_texture_decref
(
texture
->
wined3d_texture
);
wined3d_mutex_unlock
();
/* Release the device last, as it may cause the device to be destroyed. */
IDirect3DDevice8_Release
(
parent_device
);
}
return
ref
;
return
d3d8_texture_decref
(
texture
);
}
static
HRESULT
WINAPI
d3d8_texture_2d_GetDevice
(
IDirect3DTexture8
*
iface
,
IDirect3DDevice8
**
device
)
...
...
@@ -402,53 +414,15 @@ static HRESULT WINAPI d3d8_texture_cube_QueryInterface(IDirect3DCubeTexture8 *if
static
ULONG
WINAPI
d3d8_texture_cube_AddRef
(
IDirect3DCubeTexture8
*
iface
)
{
struct
d3d8_texture
*
texture
=
impl_from_IDirect3DCubeTexture8
(
iface
);
ULONG
ref
=
InterlockedIncrement
(
&
texture
->
resource
.
refcount
);
TRACE
(
"%p increasing refcount to %u.
\n
"
,
iface
,
ref
);
if
(
ref
==
1
)
{
struct
d3d8_surface
*
surface
;
IDirect3DDevice8_AddRef
(
texture
->
parent_device
);
wined3d_mutex_lock
();
LIST_FOR_EACH_ENTRY
(
surface
,
&
texture
->
rtv_list
,
struct
d3d8_surface
,
rtv_entry
)
{
wined3d_rendertarget_view_incref
(
surface
->
wined3d_rtv
);
}
wined3d_texture_incref
(
texture
->
wined3d_texture
);
wined3d_mutex_unlock
();
}
return
ref
;
return
d3d8_texture_incref
(
texture
)
;
}
static
ULONG
WINAPI
d3d8_texture_cube_Release
(
IDirect3DCubeTexture8
*
iface
)
{
struct
d3d8_texture
*
texture
=
impl_from_IDirect3DCubeTexture8
(
iface
);
ULONG
ref
=
InterlockedDecrement
(
&
texture
->
resource
.
refcount
);
TRACE
(
"%p decreasing refcount to %u.
\n
"
,
iface
,
ref
);
if
(
!
ref
)
{
IDirect3DDevice8
*
parent_device
=
texture
->
parent_device
;
struct
d3d8_surface
*
surface
;
TRACE
(
"Releasing child %p.
\n
"
,
texture
->
wined3d_texture
);
wined3d_mutex_lock
();
LIST_FOR_EACH_ENTRY
(
surface
,
&
texture
->
rtv_list
,
struct
d3d8_surface
,
rtv_entry
)
{
wined3d_rendertarget_view_decref
(
surface
->
wined3d_rtv
);
}
wined3d_texture_decref
(
texture
->
wined3d_texture
);
wined3d_mutex_unlock
();
/* Release the device last, as it may cause the device to be destroyed. */
IDirect3DDevice8_Release
(
parent_device
);
}
return
ref
;
return
d3d8_texture_decref
(
texture
);
}
static
HRESULT
WINAPI
d3d8_texture_cube_GetDevice
(
IDirect3DCubeTexture8
*
iface
,
IDirect3DDevice8
**
device
)
...
...
@@ -764,40 +738,15 @@ static HRESULT WINAPI d3d8_texture_3d_QueryInterface(IDirect3DVolumeTexture8 *if
static
ULONG
WINAPI
d3d8_texture_3d_AddRef
(
IDirect3DVolumeTexture8
*
iface
)
{
struct
d3d8_texture
*
texture
=
impl_from_IDirect3DVolumeTexture8
(
iface
);
ULONG
ref
=
InterlockedIncrement
(
&
texture
->
resource
.
refcount
);
TRACE
(
"%p increasing refcount to %u.
\n
"
,
iface
,
ref
);
if
(
ref
==
1
)
{
IDirect3DDevice8_AddRef
(
texture
->
parent_device
);
wined3d_mutex_lock
();
wined3d_texture_incref
(
texture
->
wined3d_texture
);
wined3d_mutex_unlock
();
}
return
ref
;
return
d3d8_texture_incref
(
texture
);
}
static
ULONG
WINAPI
d3d8_texture_3d_Release
(
IDirect3DVolumeTexture8
*
iface
)
{
struct
d3d8_texture
*
texture
=
impl_from_IDirect3DVolumeTexture8
(
iface
);
ULONG
ref
=
InterlockedDecrement
(
&
texture
->
resource
.
refcount
);
TRACE
(
"%p decreasing refcount to %u.
\n
"
,
iface
,
ref
);
if
(
!
ref
)
{
IDirect3DDevice8
*
parent_device
=
texture
->
parent_device
;
wined3d_mutex_lock
();
wined3d_texture_decref
(
texture
->
wined3d_texture
);
wined3d_mutex_unlock
();
/* Release the device last, as it may cause the device to be destroyed. */
IDirect3DDevice8_Release
(
parent_device
);
}
return
ref
;
return
d3d8_texture_decref
(
texture
);
}
static
HRESULT
WINAPI
d3d8_texture_3d_GetDevice
(
IDirect3DVolumeTexture8
*
iface
,
IDirect3DDevice8
**
device
)
...
...
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