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
32613eb6
Commit
32613eb6
authored
Jun 15, 2009
by
Henri Verbeet
Committed by
Alexandre Julliard
Jun 15, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Introduce surface_cleanup().
parent
36685b07
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
63 additions
and
49 deletions
+63
-49
surface.c
dlls/wined3d/surface.c
+63
-49
No files found.
dlls/wined3d/surface.c
View file @
32613eb6
...
@@ -34,6 +34,64 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d_surface);
...
@@ -34,6 +34,64 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d_surface);
WINE_DECLARE_DEBUG_CHANNEL
(
d3d
);
WINE_DECLARE_DEBUG_CHANNEL
(
d3d
);
#define GLINFO_LOCATION This->resource.wineD3DDevice->adapter->gl_info
#define GLINFO_LOCATION This->resource.wineD3DDevice->adapter->gl_info
static
void
surface_cleanup
(
IWineD3DSurfaceImpl
*
This
)
{
IWineD3DDeviceImpl
*
device
=
This
->
resource
.
wineD3DDevice
;
renderbuffer_entry_t
*
entry
,
*
entry2
;
TRACE
(
"(%p) : Cleaning up.
\n
"
,
This
);
/* Need a context to destroy the texture. Use the currently active render
* target, but only if the primary render target exists. Otherwise
* lastActiveRenderTarget is garbage. When destroying the primary render
* target, Uninit3D() will activate a context before doing anything. */
if
(
device
->
render_targets
&&
device
->
render_targets
[
0
])
{
ActivateContext
(
device
,
device
->
lastActiveRenderTarget
,
CTXUSAGE_RESOURCELOAD
);
}
ENTER_GL
();
if
(
This
->
glDescription
.
textureName
)
{
/* Release the OpenGL texture. */
TRACE
(
"Deleting texture %u.
\n
"
,
This
->
glDescription
.
textureName
);
glDeleteTextures
(
1
,
&
This
->
glDescription
.
textureName
);
}
if
(
This
->
Flags
&
SFLAG_PBO
)
{
/* Delete the PBO. */
GL_EXTCALL
(
glDeleteBuffersARB
(
1
,
&
This
->
pbo
));
}
LIST_FOR_EACH_ENTRY_SAFE
(
entry
,
entry2
,
&
This
->
renderbuffers
,
renderbuffer_entry_t
,
entry
)
{
GL_EXTCALL
(
glDeleteRenderbuffersEXT
(
1
,
&
entry
->
id
));
HeapFree
(
GetProcessHeap
(),
0
,
entry
);
}
LEAVE_GL
();
if
(
This
->
Flags
&
SFLAG_DIBSECTION
)
{
/* Release the DC. */
SelectObject
(
This
->
hDC
,
This
->
dib
.
holdbitmap
);
DeleteDC
(
This
->
hDC
);
/* Release the DIB section. */
DeleteObject
(
This
->
dib
.
DIBsection
);
This
->
dib
.
bitmap_data
=
NULL
;
This
->
resource
.
allocatedMemory
=
NULL
;
}
if
(
This
->
Flags
&
SFLAG_USERPTR
)
IWineD3DSurface_SetMem
((
IWineD3DSurface
*
)
This
,
NULL
);
if
(
This
->
overlay_dest
)
list_remove
(
&
This
->
overlay_entry
);
HeapFree
(
GetProcessHeap
(),
0
,
This
->
palette9
);
resource_cleanup
((
IWineD3DResource
*
)
This
);
}
static
void
surface_force_reload
(
IWineD3DSurface
*
iface
)
static
void
surface_force_reload
(
IWineD3DSurface
*
iface
)
{
{
IWineD3DSurfaceImpl
*
This
=
(
IWineD3DSurfaceImpl
*
)
iface
;
IWineD3DSurfaceImpl
*
This
=
(
IWineD3DSurfaceImpl
*
)
iface
;
...
@@ -540,59 +598,15 @@ static ULONG WINAPI IWineD3DSurfaceImpl_Release(IWineD3DSurface *iface)
...
@@ -540,59 +598,15 @@ static ULONG WINAPI IWineD3DSurfaceImpl_Release(IWineD3DSurface *iface)
IWineD3DSurfaceImpl
*
This
=
(
IWineD3DSurfaceImpl
*
)
iface
;
IWineD3DSurfaceImpl
*
This
=
(
IWineD3DSurfaceImpl
*
)
iface
;
ULONG
ref
=
InterlockedDecrement
(
&
This
->
resource
.
ref
);
ULONG
ref
=
InterlockedDecrement
(
&
This
->
resource
.
ref
);
TRACE
(
"(%p) : Releasing from %d
\n
"
,
This
,
ref
+
1
);
TRACE
(
"(%p) : Releasing from %d
\n
"
,
This
,
ref
+
1
);
if
(
ref
==
0
)
{
IWineD3DDeviceImpl
*
device
=
This
->
resource
.
wineD3DDevice
;
renderbuffer_entry_t
*
entry
,
*
entry2
;
TRACE
(
"(%p) : cleaning up
\n
"
,
This
);
/* Need a context to destroy the texture. Use the currently active render target, but only if
* the primary render target exists. Otherwise lastActiveRenderTarget is garbage, see above.
* When destroying the primary rt, Uninit3D will activate a context before doing anything
*/
if
(
device
->
render_targets
&&
device
->
render_targets
[
0
])
{
ActivateContext
(
device
,
device
->
lastActiveRenderTarget
,
CTXUSAGE_RESOURCELOAD
);
}
ENTER_GL
();
if
(
This
->
glDescription
.
textureName
!=
0
)
{
/* release the openGL texture.. */
TRACE
(
"Deleting texture %d
\n
"
,
This
->
glDescription
.
textureName
);
glDeleteTextures
(
1
,
&
This
->
glDescription
.
textureName
);
}
if
(
This
->
Flags
&
SFLAG_PBO
)
{
/* Delete the PBO */
GL_EXTCALL
(
glDeleteBuffersARB
(
1
,
&
This
->
pbo
));
}
LIST_FOR_EACH_ENTRY_SAFE
(
entry
,
entry2
,
&
This
->
renderbuffers
,
renderbuffer_entry_t
,
entry
)
{
if
(
!
ref
)
GL_EXTCALL
(
glDeleteRenderbuffersEXT
(
1
,
&
entry
->
id
));
{
HeapFree
(
GetProcessHeap
(),
0
,
entry
);
surface_cleanup
(
This
);
}
LEAVE_GL
();
if
(
This
->
Flags
&
SFLAG_DIBSECTION
)
{
/* Release the DC */
SelectObject
(
This
->
hDC
,
This
->
dib
.
holdbitmap
);
DeleteDC
(
This
->
hDC
);
/* Release the DIB section */
DeleteObject
(
This
->
dib
.
DIBsection
);
This
->
dib
.
bitmap_data
=
NULL
;
This
->
resource
.
allocatedMemory
=
NULL
;
}
if
(
This
->
Flags
&
SFLAG_USERPTR
)
IWineD3DSurface_SetMem
(
iface
,
NULL
);
HeapFree
(
GetProcessHeap
(),
0
,
This
->
palette9
);
resource_cleanup
((
IWineD3DResource
*
)
iface
);
if
(
This
->
overlay_dest
)
{
list_remove
(
&
This
->
overlay_entry
);
}
TRACE
(
"(%p) Released
\n
"
,
This
);
TRACE
(
"(%p) Released
.
\n
"
,
This
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
}
}
return
ref
;
return
ref
;
}
}
...
...
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