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
cde32172
Commit
cde32172
authored
Dec 15, 2009
by
Stefan Dösinger
Committed by
Alexandre Julliard
Dec 15, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Properly release client storage memory.
parent
896af790
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
13 deletions
+37
-13
surface.c
dlls/wined3d/surface.c
+37
-13
No files found.
dlls/wined3d/surface.c
View file @
cde32172
...
...
@@ -1624,6 +1624,37 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_UnlockRect(IWineD3DSurface *iface) {
return
WINED3D_OK
;
}
static
void
surface_release_client_storage
(
IWineD3DSurface
*
iface
)
{
IWineD3DSurfaceImpl
*
This
=
(
IWineD3DSurfaceImpl
*
)
iface
;
struct
wined3d_context
*
context
;
context
=
context_acquire
(
This
->
resource
.
device
,
NULL
,
CTXUSAGE_RESOURCELOAD
);
ENTER_GL
();
glPixelStorei
(
GL_UNPACK_CLIENT_STORAGE_APPLE
,
GL_FALSE
);
if
(
This
->
texture_name
)
{
surface_bind_and_dirtify
(
This
,
FALSE
);
glTexImage2D
(
This
->
texture_target
,
This
->
texture_level
,
GL_RGB
,
1
,
1
,
0
,
GL_RGB
,
GL_UNSIGNED_BYTE
,
NULL
);
}
if
(
This
->
texture_name_srgb
)
{
surface_bind_and_dirtify
(
This
,
TRUE
);
glTexImage2D
(
This
->
texture_target
,
This
->
texture_level
,
GL_RGB
,
1
,
1
,
0
,
GL_RGB
,
GL_UNSIGNED_BYTE
,
NULL
);
}
glPixelStorei
(
GL_UNPACK_CLIENT_STORAGE_APPLE
,
GL_TRUE
);
LEAVE_GL
();
context_release
(
context
);
IWineD3DSurface_ModifyLocation
(
iface
,
SFLAG_INSRGBTEX
,
FALSE
);
IWineD3DSurface_ModifyLocation
(
iface
,
SFLAG_INTEXTURE
,
FALSE
);
surface_force_reload
(
iface
);
}
static
HRESULT
WINAPI
IWineD3DSurfaceImpl_GetDC
(
IWineD3DSurface
*
iface
,
HDC
*
pHDC
)
{
IWineD3DSurfaceImpl
*
This
=
(
IWineD3DSurfaceImpl
*
)
iface
;
...
...
@@ -1650,11 +1681,12 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_GetDC(IWineD3DSurface *iface, HDC *pHD
/* Create a DIB section if there isn't a hdc yet */
if
(
!
This
->
hDC
)
{
hr
=
IWineD3DBaseSurfaceImpl_CreateDIBSection
(
iface
);
if
(
FAILED
(
hr
))
return
WINED3DERR_INVALIDCALL
;
if
(
This
->
Flags
&
SFLAG_CLIENT
)
{
surface_internal_preload
(
iface
,
SRGB_RGB
);
IWineD3DSurface_LoadLocation
(
iface
,
SFLAG_INSYSMEM
,
NULL
);
surface_release_client_storage
(
iface
);
}
hr
=
IWineD3DBaseSurfaceImpl_CreateDIBSection
(
iface
);
if
(
FAILED
(
hr
))
return
WINED3DERR_INVALIDCALL
;
/* Use the dib section from now on if we are not using a PBO */
if
(
!
(
This
->
Flags
&
SFLAG_PBO
))
...
...
@@ -2911,11 +2943,7 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_SetMem(IWineD3DSurface *iface, void *M
/* For client textures opengl has to be notified */
if
(
This
->
Flags
&
SFLAG_CLIENT
)
{
DWORD
oldFlags
=
This
->
Flags
;
This
->
Flags
&=
~
(
SFLAG_ALLOCATED
|
SFLAG_SRGBALLOCATED
);
if
(
oldFlags
&
SFLAG_ALLOCATED
)
surface_internal_preload
(
iface
,
SRGB_RGB
);
if
(
oldFlags
&
SFLAG_SRGBALLOCATED
)
surface_internal_preload
(
iface
,
SRGB_SRGB
);
/* And hope that the app behaves correctly and did not free the old surface memory before setting a new pointer */
surface_release_client_storage
(
iface
);
}
/* Now free the old memory if any */
...
...
@@ -2928,11 +2956,7 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_SetMem(IWineD3DSurface *iface, void *M
This
->
Flags
&=
~
SFLAG_USERPTR
;
if
(
This
->
Flags
&
SFLAG_CLIENT
)
{
DWORD
oldFlags
=
This
->
Flags
;
This
->
Flags
&=
~
(
SFLAG_ALLOCATED
|
SFLAG_SRGBALLOCATED
);
/* This respecifies an empty texture and opengl knows that the old memory is gone */
if
(
oldFlags
&
SFLAG_ALLOCATED
)
surface_internal_preload
(
iface
,
SRGB_RGB
);
if
(
oldFlags
&
SFLAG_SRGBALLOCATED
)
surface_internal_preload
(
iface
,
SRGB_SRGB
);
surface_release_client_storage
(
iface
);
}
}
return
WINED3D_OK
;
...
...
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