Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
96a8417a
Commit
96a8417a
authored
Mar 17, 2011
by
Henri Verbeet
Committed by
Alexandre Julliard
Mar 18, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Merge the texture cleanup functions.
parent
d30d9d5e
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
58 additions
and
87 deletions
+58
-87
basetexture.c
dlls/wined3d/basetexture.c
+13
-0
cubetexture.c
dlls/wined3d/cubetexture.c
+16
-29
texture.c
dlls/wined3d/texture.c
+16
-30
volumetexture.c
dlls/wined3d/volumetexture.c
+12
-28
wined3d_private.h
dlls/wined3d/wined3d_private.h
+1
-0
No files found.
dlls/wined3d/basetexture.c
View file @
96a8417a
...
...
@@ -78,6 +78,19 @@ HRESULT basetexture_init(IWineD3DBaseTextureImpl *texture, const struct wined3d_
void
basetexture_cleanup
(
IWineD3DBaseTextureImpl
*
texture
)
{
UINT
sub_count
=
texture
->
baseTexture
.
level_count
*
texture
->
baseTexture
.
layer_count
;
UINT
i
;
TRACE
(
"texture %p.
\n
"
,
texture
);
for
(
i
=
0
;
i
<
sub_count
;
++
i
)
{
struct
wined3d_resource
*
sub_resource
=
texture
->
baseTexture
.
sub_resources
[
i
];
if
(
sub_resource
)
texture
->
baseTexture
.
texture_ops
->
texture_sub_resource_cleanup
(
sub_resource
);
}
basetexture_unload
(
texture
);
HeapFree
(
GetProcessHeap
(),
0
,
texture
->
baseTexture
.
sub_resources
);
resource_cleanup
(
&
texture
->
resource
);
...
...
dlls/wined3d/cubetexture.c
View file @
96a8417a
...
...
@@ -141,6 +141,19 @@ static void cubetexture_sub_resource_add_dirty_region(struct wined3d_resource *s
surface_add_dirty_rect
(
surface_from_resource
(
sub_resource
),
dirty_region
);
}
static
void
cubetexture_sub_resource_cleanup
(
struct
wined3d_resource
*
sub_resource
)
{
IWineD3DSurfaceImpl
*
surface
=
surface_from_resource
(
sub_resource
);
/* Clean out the texture name we gave to the surface so that the
* surface doesn't try and release it. */
surface_set_texture_name
(
surface
,
0
,
TRUE
);
surface_set_texture_name
(
surface
,
0
,
FALSE
);
surface_set_texture_target
(
surface
,
0
);
surface_set_container
(
surface
,
WINED3D_CONTAINER_NONE
,
NULL
);
IWineD3DSurface_Release
((
IWineD3DSurface
*
)
surface
);
}
/* Do not call while under the GL lock. */
static
void
cubetexture_unload
(
struct
wined3d_resource
*
resource
)
{
...
...
@@ -168,6 +181,7 @@ static const struct wined3d_texture_ops cubetexture_ops =
cubetexture_bind
,
cubetexture_preload
,
cubetexture_sub_resource_add_dirty_region
,
cubetexture_sub_resource_cleanup
,
};
static
const
struct
wined3d_resource_ops
cubetexture_resource_ops
=
...
...
@@ -175,33 +189,6 @@ static const struct wined3d_resource_ops cubetexture_resource_ops =
cubetexture_unload
,
};
static
void
cubetexture_cleanup
(
IWineD3DBaseTextureImpl
*
This
)
{
UINT
sub_count
=
This
->
baseTexture
.
level_count
*
This
->
baseTexture
.
layer_count
;
UINT
i
;
TRACE
(
"(%p) : Cleaning up.
\n
"
,
This
);
for
(
i
=
0
;
i
<
sub_count
;
++
i
)
{
struct
wined3d_resource
*
sub_resource
=
This
->
baseTexture
.
sub_resources
[
i
];
if
(
sub_resource
)
{
IWineD3DSurfaceImpl
*
surface
=
surface_from_resource
(
sub_resource
);
/* Clean out the texture name we gave to the surface so that the
* surface doesn't try and release it. */
surface_set_texture_name
(
surface
,
0
,
TRUE
);
surface_set_texture_name
(
surface
,
0
,
FALSE
);
surface_set_texture_target
(
surface
,
0
);
surface_set_container
(
surface
,
WINED3D_CONTAINER_NONE
,
NULL
);
IWineD3DSurface_Release
((
IWineD3DSurface
*
)
surface
);
}
}
basetexture_cleanup
((
IWineD3DBaseTextureImpl
*
)
This
);
}
static
HRESULT
WINAPI
IWineD3DCubeTextureImpl_QueryInterface
(
IWineD3DBaseTexture
*
iface
,
REFIID
riid
,
LPVOID
*
ppobj
)
{
IWineD3DBaseTextureImpl
*
This
=
(
IWineD3DBaseTextureImpl
*
)
iface
;
...
...
@@ -235,7 +222,7 @@ static ULONG WINAPI IWineD3DCubeTextureImpl_Release(IWineD3DBaseTexture *iface)
ref
=
InterlockedDecrement
(
&
This
->
resource
.
ref
);
if
(
!
ref
)
{
cub
etexture_cleanup
(
This
);
bas
etexture_cleanup
(
This
);
This
->
resource
.
parent_ops
->
wined3d_object_destroyed
(
This
->
resource
.
parent
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
}
...
...
@@ -466,7 +453,7 @@ HRESULT cubetexture_init(IWineD3DBaseTextureImpl *texture, UINT edge_length, UIN
if
(
FAILED
(
hr
))
{
FIXME
(
"(%p) Failed to create surface, hr %#x.
\n
"
,
texture
,
hr
);
cub
etexture_cleanup
(
texture
);
bas
etexture_cleanup
(
texture
);
return
hr
;
}
...
...
dlls/wined3d/texture.c
View file @
96a8417a
...
...
@@ -165,6 +165,19 @@ static void texture_sub_resource_add_dirty_region(struct wined3d_resource *sub_r
surface_add_dirty_rect
(
surface_from_resource
(
sub_resource
),
dirty_region
);
}
static
void
texture_sub_resource_cleanup
(
struct
wined3d_resource
*
sub_resource
)
{
IWineD3DSurfaceImpl
*
surface
=
surface_from_resource
(
sub_resource
);
/* Clean out the texture name we gave to the surface so that the
* surface doesn't try and release it */
surface_set_texture_name
(
surface
,
0
,
TRUE
);
surface_set_texture_name
(
surface
,
0
,
FALSE
);
surface_set_texture_target
(
surface
,
0
);
surface_set_container
(
surface
,
WINED3D_CONTAINER_NONE
,
NULL
);
IWineD3DSurface_Release
((
IWineD3DSurface
*
)
surface
);
}
/* Do not call while under the GL lock. */
static
void
texture_unload
(
struct
wined3d_resource
*
resource
)
{
...
...
@@ -191,6 +204,7 @@ static const struct wined3d_texture_ops texture_ops =
texture_bind
,
texture_preload
,
texture_sub_resource_add_dirty_region
,
texture_sub_resource_cleanup
,
};
static
const
struct
wined3d_resource_ops
texture_resource_ops
=
...
...
@@ -198,34 +212,6 @@ static const struct wined3d_resource_ops texture_resource_ops =
texture_unload
,
};
static
void
texture_cleanup
(
IWineD3DBaseTextureImpl
*
This
)
{
unsigned
int
i
;
TRACE
(
"(%p) : Cleaning up
\n
"
,
This
);
for
(
i
=
0
;
i
<
This
->
baseTexture
.
level_count
;
++
i
)
{
struct
wined3d_resource
*
sub_resource
=
This
->
baseTexture
.
sub_resources
[
i
];
if
(
sub_resource
)
{
IWineD3DSurfaceImpl
*
surface
=
surface_from_resource
(
sub_resource
);
/* Clean out the texture name we gave to the surface so that the
* surface doesn't try and release it */
surface_set_texture_name
(
surface
,
0
,
TRUE
);
surface_set_texture_name
(
surface
,
0
,
FALSE
);
surface_set_texture_target
(
surface
,
0
);
surface_set_container
(
surface
,
WINED3D_CONTAINER_NONE
,
NULL
);
IWineD3DSurface_Release
((
IWineD3DSurface
*
)
surface
);
}
}
TRACE
(
"(%p) : Cleaning up base texture
\n
"
,
This
);
basetexture_cleanup
((
IWineD3DBaseTextureImpl
*
)
This
);
}
static
HRESULT
WINAPI
IWineD3DTextureImpl_QueryInterface
(
IWineD3DBaseTexture
*
iface
,
REFIID
riid
,
LPVOID
*
ppobj
)
{
IWineD3DBaseTextureImpl
*
This
=
(
IWineD3DBaseTextureImpl
*
)
iface
;
...
...
@@ -259,7 +245,7 @@ static ULONG WINAPI IWineD3DTextureImpl_Release(IWineD3DBaseTexture *iface)
ref
=
InterlockedDecrement
(
&
This
->
resource
.
ref
);
if
(
!
ref
)
{
texture_cleanup
(
This
);
base
texture_cleanup
(
This
);
This
->
resource
.
parent_ops
->
wined3d_object_destroyed
(
This
->
resource
.
parent
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
}
...
...
@@ -531,7 +517,7 @@ HRESULT texture_init(IWineD3DBaseTextureImpl *texture, UINT width, UINT height,
if
(
FAILED
(
hr
))
{
FIXME
(
"Failed to create surface %p, hr %#x
\n
"
,
texture
,
hr
);
texture_cleanup
(
texture
);
base
texture_cleanup
(
texture
);
return
hr
;
}
...
...
dlls/wined3d/volumetexture.c
View file @
96a8417a
...
...
@@ -89,6 +89,15 @@ static void volumetexture_sub_resource_add_dirty_region(struct wined3d_resource
volume_add_dirty_box
(
volume_from_resource
(
sub_resource
),
dirty_region
);
}
static
void
volumetexture_sub_resource_cleanup
(
struct
wined3d_resource
*
sub_resource
)
{
IWineD3DVolumeImpl
*
volume
=
volume_from_resource
(
sub_resource
);
/* Cleanup the container. */
volume_set_container
(
volume
,
NULL
);
IWineD3DVolume_Release
((
IWineD3DVolume
*
)
volume
);
}
/* Do not call while under the GL lock. */
static
void
volumetexture_unload
(
struct
wined3d_resource
*
resource
)
{
...
...
@@ -111,6 +120,7 @@ static const struct wined3d_texture_ops volumetexture_ops =
volumetexture_bind
,
volumetexture_preload
,
volumetexture_sub_resource_add_dirty_region
,
volumetexture_sub_resource_cleanup
,
};
static
const
struct
wined3d_resource_ops
volumetexture_resource_ops
=
...
...
@@ -118,32 +128,6 @@ static const struct wined3d_resource_ops volumetexture_resource_ops =
volumetexture_unload
,
};
static
void
volumetexture_cleanup
(
IWineD3DBaseTextureImpl
*
This
)
{
unsigned
int
i
;
TRACE
(
"(%p) : Cleaning up.
\n
"
,
This
);
for
(
i
=
0
;
i
<
This
->
baseTexture
.
level_count
;
++
i
)
{
struct
wined3d_resource
*
sub_resource
=
This
->
baseTexture
.
sub_resources
[
i
];
if
(
sub_resource
)
{
IWineD3DVolumeImpl
*
volume
=
volume_from_resource
(
sub_resource
);
/* Cleanup the container. */
volume_set_container
(
volume
,
NULL
);
IWineD3DVolume_Release
((
IWineD3DVolume
*
)
volume
);
}
}
basetexture_cleanup
((
IWineD3DBaseTextureImpl
*
)
This
);
}
/* *******************************************
IWineD3DTexture IUnknown parts follow
******************************************* */
static
HRESULT
WINAPI
IWineD3DVolumeTextureImpl_QueryInterface
(
IWineD3DBaseTexture
*
iface
,
REFIID
riid
,
LPVOID
*
ppobj
)
{
IWineD3DBaseTextureImpl
*
This
=
(
IWineD3DBaseTextureImpl
*
)
iface
;
...
...
@@ -177,7 +161,7 @@ static ULONG WINAPI IWineD3DVolumeTextureImpl_Release(IWineD3DBaseTexture *iface
ref
=
InterlockedDecrement
(
&
This
->
resource
.
ref
);
if
(
!
ref
)
{
volum
etexture_cleanup
(
This
);
bas
etexture_cleanup
(
This
);
This
->
resource
.
parent_ops
->
wined3d_object_destroyed
(
This
->
resource
.
parent
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
}
...
...
@@ -381,7 +365,7 @@ HRESULT volumetexture_init(IWineD3DBaseTextureImpl *texture, UINT width, UINT he
if
(
FAILED
(
hr
))
{
ERR
(
"Creating a volume for the volume texture failed, hr %#x.
\n
"
,
hr
);
volum
etexture_cleanup
(
texture
);
bas
etexture_cleanup
(
texture
);
return
hr
;
}
...
...
dlls/wined3d/wined3d_private.h
View file @
96a8417a
...
...
@@ -1890,6 +1890,7 @@ struct wined3d_texture_ops
void
(
*
texture_preload
)(
struct
IWineD3DBaseTextureImpl
*
texture
,
enum
WINED3DSRGB
srgb
);
void
(
*
texture_sub_resource_add_dirty_region
)(
struct
wined3d_resource
*
sub_resource
,
const
WINED3DBOX
*
dirty_region
);
void
(
*
texture_sub_resource_cleanup
)(
struct
wined3d_resource
*
sub_resource
);
};
typedef
struct
IWineD3DBaseTextureClass
...
...
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