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
4d4fce7e
Commit
4d4fce7e
authored
Oct 22, 2007
by
Stefan Dösinger
Committed by
Alexandre Julliard
Nov 01, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Disconnect allocatedMemory and Heap allocation.
parent
f1f84a36
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
34 additions
and
12 deletions
+34
-12
device.c
dlls/wined3d/device.c
+3
-2
resource.c
dlls/wined3d/resource.c
+2
-1
surface.c
dlls/wined3d/surface.c
+12
-5
surface_base.c
dlls/wined3d/surface_base.c
+2
-2
surface_gdi.c
dlls/wined3d/surface_gdi.c
+9
-1
swapchain.c
dlls/wined3d/swapchain.c
+4
-0
wined3d_private.h
dlls/wined3d/wined3d_private.h
+2
-1
No files found.
dlls/wined3d/device.c
View file @
4d4fce7e
...
@@ -101,13 +101,14 @@ static void WINAPI IWineD3DDeviceImpl_AddResource(IWineD3DDevice *iface, IWineD3
...
@@ -101,13 +101,14 @@ static void WINAPI IWineD3DDeviceImpl_AddResource(IWineD3DDevice *iface, IWineD3
} \
} \
WineD3DAdapterChangeGLRam(This, _size); \
WineD3DAdapterChangeGLRam(This, _size); \
} \
} \
object->resource.
allocated
Memory = (0 == _size ? NULL : HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, _size + 4)); \
object->resource.
heap
Memory = (0 == _size ? NULL : HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, _size + 4)); \
if (object->resource.
allocated
Memory == NULL && _size != 0) { \
if (object->resource.
heap
Memory == NULL && _size != 0) { \
FIXME("Out of memory!\n"); \
FIXME("Out of memory!\n"); \
HeapFree(GetProcessHeap(), 0, object); \
HeapFree(GetProcessHeap(), 0, object); \
*pp##type = NULL; \
*pp##type = NULL; \
return WINED3DERR_OUTOFVIDEOMEMORY; \
return WINED3DERR_OUTOFVIDEOMEMORY; \
} \
} \
object->resource.allocatedMemory = object->resource.heapMemory; \
*pp##type = (IWineD3D##type *) object; \
*pp##type = (IWineD3D##type *) object; \
IWineD3DDeviceImpl_AddResource(iface, (IWineD3DResource *)object) ;\
IWineD3DDeviceImpl_AddResource(iface, (IWineD3DResource *)object) ;\
TRACE("(%p) : Created resource %p\n", This, object); \
TRACE("(%p) : Created resource %p\n", This, object); \
...
...
dlls/wined3d/resource.c
View file @
4d4fce7e
...
@@ -82,8 +82,9 @@ void IWineD3DResourceImpl_CleanUp(IWineD3DResource *iface){
...
@@ -82,8 +82,9 @@ void IWineD3DResourceImpl_CleanUp(IWineD3DResource *iface){
}
}
}
}
HeapFree
(
GetProcessHeap
(),
0
,
This
->
resource
.
allocated
Memory
);
HeapFree
(
GetProcessHeap
(),
0
,
This
->
resource
.
heap
Memory
);
This
->
resource
.
allocatedMemory
=
0
;
This
->
resource
.
allocatedMemory
=
0
;
This
->
resource
.
heapMemory
=
0
;
if
(
This
->
resource
.
wineD3DDevice
!=
NULL
)
{
if
(
This
->
resource
.
wineD3DDevice
!=
NULL
)
{
IWineD3DDevice_ResourceReleased
((
IWineD3DDevice
*
)
This
->
resource
.
wineD3DDevice
,
iface
);
IWineD3DDevice_ResourceReleased
((
IWineD3DDevice
*
)
This
->
resource
.
wineD3DDevice
,
iface
);
...
...
dlls/wined3d/surface.c
View file @
4d4fce7e
...
@@ -668,15 +668,17 @@ static void surface_prepare_system_memory(IWineD3DSurfaceImpl *This) {
...
@@ -668,15 +668,17 @@ static void surface_prepare_system_memory(IWineD3DSurfaceImpl *This) {
checkGLcall
(
"glBindBufferARB"
);
checkGLcall
(
"glBindBufferARB"
);
/* We don't need the system memory anymore and we can't even use it for PBOs */
/* We don't need the system memory anymore and we can't even use it for PBOs */
HeapFree
(
GetProcessHeap
(),
0
,
This
->
resource
.
allocated
Memory
);
HeapFree
(
GetProcessHeap
(),
0
,
This
->
resource
.
heap
Memory
);
This
->
resource
.
allocatedMemory
=
NULL
;
This
->
resource
.
allocatedMemory
=
NULL
;
This
->
resource
.
heapMemory
=
NULL
;
This
->
Flags
|=
SFLAG_PBO
;
This
->
Flags
|=
SFLAG_PBO
;
LEAVE_GL
();
LEAVE_GL
();
}
else
if
(
!
(
This
->
resource
.
allocatedMemory
||
This
->
Flags
&
SFLAG_PBO
))
{
}
else
if
(
!
(
This
->
resource
.
allocatedMemory
||
This
->
Flags
&
SFLAG_PBO
))
{
/* Whatever surface we have, make sure that there is memory allocated for the downloaded copy,
/* Whatever surface we have, make sure that there is memory allocated for the downloaded copy,
* or a pbo to map
* or a pbo to map
*/
*/
This
->
resource
.
allocatedMemory
=
HeapAlloc
(
GetProcessHeap
()
,
0
,
This
->
resource
.
size
+
4
);
This
->
resource
.
heapMemory
=
HeapAlloc
(
GetProcessHeap
()
,
0
,
This
->
resource
.
size
+
4
);
This
->
resource
.
allocatedMemory
=
This
->
resource
.
heapMemory
;
if
(
This
->
Flags
&
SFLAG_INSYSMEM
)
{
if
(
This
->
Flags
&
SFLAG_INSYSMEM
)
{
ERR
(
"Surface without memory or pbo has SFLAG_INSYSMEM set!
\n
"
);
ERR
(
"Surface without memory or pbo has SFLAG_INSYSMEM set!
\n
"
);
}
}
...
@@ -2024,8 +2026,9 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_LoadTexture(IWineD3DSurface *iface, BO
...
@@ -2024,8 +2026,9 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_LoadTexture(IWineD3DSurface *iface, BO
#endif
#endif
if
(
!
(
This
->
Flags
&
SFLAG_DONOTFREE
))
{
if
(
!
(
This
->
Flags
&
SFLAG_DONOTFREE
))
{
HeapFree
(
GetProcessHeap
(),
0
,
This
->
resource
.
allocated
Memory
);
HeapFree
(
GetProcessHeap
(),
0
,
This
->
resource
.
heap
Memory
);
This
->
resource
.
allocatedMemory
=
NULL
;
This
->
resource
.
allocatedMemory
=
NULL
;
This
->
resource
.
heapMemory
=
NULL
;
IWineD3DSurface_ModifyLocation
(
iface
,
SFLAG_INSYSMEM
,
FALSE
);
IWineD3DSurface_ModifyLocation
(
iface
,
SFLAG_INSYSMEM
,
FALSE
);
}
}
...
@@ -2257,7 +2260,8 @@ HRESULT WINAPI IWineD3DSurfaceImpl_SetMem(IWineD3DSurface *iface, void *Mem) {
...
@@ -2257,7 +2260,8 @@ HRESULT WINAPI IWineD3DSurfaceImpl_SetMem(IWineD3DSurface *iface, void *Mem) {
This
->
hDC
=
NULL
;
This
->
hDC
=
NULL
;
This
->
Flags
&=
~
SFLAG_DIBSECTION
;
This
->
Flags
&=
~
SFLAG_DIBSECTION
;
}
else
if
(
!
(
This
->
Flags
&
SFLAG_USERPTR
))
{
}
else
if
(
!
(
This
->
Flags
&
SFLAG_USERPTR
))
{
release
=
This
->
resource
.
allocatedMemory
;
release
=
This
->
resource
.
heapMemory
;
This
->
resource
.
heapMemory
=
NULL
;
}
}
This
->
resource
.
allocatedMemory
=
Mem
;
This
->
resource
.
allocatedMemory
=
Mem
;
This
->
Flags
|=
SFLAG_USERPTR
|
SFLAG_INSYSMEM
;
This
->
Flags
|=
SFLAG_USERPTR
|
SFLAG_INSYSMEM
;
...
@@ -2277,6 +2281,8 @@ HRESULT WINAPI IWineD3DSurfaceImpl_SetMem(IWineD3DSurface *iface, void *Mem) {
...
@@ -2277,6 +2281,8 @@ HRESULT WINAPI IWineD3DSurfaceImpl_SetMem(IWineD3DSurface *iface, void *Mem) {
}
else
if
(
This
->
Flags
&
SFLAG_USERPTR
)
{
}
else
if
(
This
->
Flags
&
SFLAG_USERPTR
)
{
/* Lockrect and GetDC will re-create the dib section and allocated memory */
/* Lockrect and GetDC will re-create the dib section and allocated memory */
This
->
resource
.
allocatedMemory
=
NULL
;
This
->
resource
.
allocatedMemory
=
NULL
;
/* HeapMemory should be NULL already */
if
(
This
->
resource
.
heapMemory
!=
NULL
)
ERR
(
"User pointer surface has heap memory allocated
\n
"
);
This
->
Flags
&=
~
SFLAG_USERPTR
;
This
->
Flags
&=
~
SFLAG_USERPTR
;
if
(
This
->
Flags
&
SFLAG_CLIENT
)
{
if
(
This
->
Flags
&
SFLAG_CLIENT
)
{
...
@@ -2839,8 +2845,9 @@ static HRESULT IWineD3DSurfaceImpl_BltOverride(IWineD3DSurfaceImpl *This, RECT *
...
@@ -2839,8 +2845,9 @@ static HRESULT IWineD3DSurfaceImpl_BltOverride(IWineD3DSurfaceImpl *This, RECT *
}
}
if
(
!
(
This
->
Flags
&
SFLAG_DONOTFREE
))
{
if
(
!
(
This
->
Flags
&
SFLAG_DONOTFREE
))
{
HeapFree
(
GetProcessHeap
(),
0
,
This
->
resource
.
allocated
Memory
);
HeapFree
(
GetProcessHeap
(),
0
,
This
->
resource
.
heap
Memory
);
This
->
resource
.
allocatedMemory
=
NULL
;
This
->
resource
.
allocatedMemory
=
NULL
;
This
->
resource
.
heapMemory
=
NULL
;
}
else
{
}
else
{
This
->
Flags
&=
~
SFLAG_INSYSMEM
;
This
->
Flags
&=
~
SFLAG_INSYSMEM
;
}
}
...
...
dlls/wined3d/surface_base.c
View file @
4d4fce7e
...
@@ -483,7 +483,6 @@ HRESULT IWineD3DBaseSurfaceImpl_CreateDIBSection(IWineD3DSurface *iface) {
...
@@ -483,7 +483,6 @@ HRESULT IWineD3DBaseSurfaceImpl_CreateDIBSection(IWineD3DSurface *iface) {
IWineD3DSurfaceImpl
*
This
=
(
IWineD3DSurfaceImpl
*
)
iface
;
IWineD3DSurfaceImpl
*
This
=
(
IWineD3DSurfaceImpl
*
)
iface
;
int
extraline
=
0
;
int
extraline
=
0
;
SYSTEM_INFO
sysInfo
;
SYSTEM_INFO
sysInfo
;
void
*
oldmem
=
This
->
resource
.
allocatedMemory
;
BITMAPINFO
*
b_info
;
BITMAPINFO
*
b_info
;
HDC
ddc
;
HDC
ddc
;
DWORD
*
masks
;
DWORD
*
masks
;
...
@@ -609,7 +608,8 @@ HRESULT IWineD3DBaseSurfaceImpl_CreateDIBSection(IWineD3DSurface *iface) {
...
@@ -609,7 +608,8 @@ HRESULT IWineD3DBaseSurfaceImpl_CreateDIBSection(IWineD3DSurface *iface) {
This
->
Flags
|=
SFLAG_DIBSECTION
;
This
->
Flags
|=
SFLAG_DIBSECTION
;
HeapFree
(
GetProcessHeap
(),
0
,
oldmem
);
HeapFree
(
GetProcessHeap
(),
0
,
This
->
resource
.
heapMemory
);
This
->
resource
.
heapMemory
=
NULL
;
return
WINED3D_OK
;
return
WINED3D_OK
;
}
}
...
...
dlls/wined3d/surface_gdi.c
View file @
4d4fce7e
...
@@ -329,6 +329,13 @@ IWineGDISurfaceImpl_Flip(IWineD3DSurface *iface,
...
@@ -329,6 +329,13 @@ IWineGDISurfaceImpl_Flip(IWineD3DSurface *iface,
tmp
=
This
->
resource
.
allocatedMemory
;
tmp
=
This
->
resource
.
allocatedMemory
;
This
->
resource
.
allocatedMemory
=
Target
->
resource
.
allocatedMemory
;
This
->
resource
.
allocatedMemory
=
Target
->
resource
.
allocatedMemory
;
Target
->
resource
.
allocatedMemory
=
tmp
;
Target
->
resource
.
allocatedMemory
=
tmp
;
if
(
This
->
resource
.
heapMemory
)
{
ERR
(
"GDI Surface %p has heap memory allocated
\n
"
,
This
);
}
if
(
Target
->
resource
.
heapMemory
)
{
ERR
(
"GDI Surface %p has heap memory allocated
\n
"
,
Target
);
}
}
}
/* client_memory should not be different, but just in case */
/* client_memory should not be different, but just in case */
...
@@ -630,8 +637,9 @@ IWineGDISurfaceImpl_PrivateSetup(IWineD3DSurface *iface)
...
@@ -630,8 +637,9 @@ IWineGDISurfaceImpl_PrivateSetup(IWineD3DSurface *iface)
/* Sysmem textures have memory already allocated -
/* Sysmem textures have memory already allocated -
* release it, this avoids an unnecessary memcpy
* release it, this avoids an unnecessary memcpy
*/
*/
HeapFree
(
GetProcessHeap
(),
0
,
This
->
resource
.
allocated
Memory
);
HeapFree
(
GetProcessHeap
(),
0
,
This
->
resource
.
heap
Memory
);
This
->
resource
.
allocatedMemory
=
NULL
;
This
->
resource
.
allocatedMemory
=
NULL
;
This
->
resource
.
heapMemory
=
NULL
;
/* We don't mind the nonpow2 stuff in GDI */
/* We don't mind the nonpow2 stuff in GDI */
This
->
pow2Width
=
This
->
currentDesc
.
Width
;
This
->
pow2Width
=
This
->
currentDesc
.
Width
;
...
...
dlls/wined3d/swapchain.c
View file @
4d4fce7e
...
@@ -322,6 +322,10 @@ static HRESULT WINAPI IWineD3DSwapChainImpl_Present(IWineD3DSwapChain *iface, CO
...
@@ -322,6 +322,10 @@ static HRESULT WINAPI IWineD3DSwapChainImpl_Present(IWineD3DSwapChain *iface, CO
tmp
=
front
->
resource
.
allocatedMemory
;
tmp
=
front
->
resource
.
allocatedMemory
;
front
->
resource
.
allocatedMemory
=
back
->
resource
.
allocatedMemory
;
front
->
resource
.
allocatedMemory
=
back
->
resource
.
allocatedMemory
;
back
->
resource
.
allocatedMemory
=
tmp
;
back
->
resource
.
allocatedMemory
=
tmp
;
tmp
=
front
->
resource
.
heapMemory
;
front
->
resource
.
heapMemory
=
back
->
resource
.
heapMemory
;
back
->
resource
.
heapMemory
=
tmp
;
}
}
/* Flip the PBO */
/* Flip the PBO */
...
...
dlls/wined3d/wined3d_private.h
View file @
4d4fce7e
...
@@ -817,7 +817,8 @@ typedef struct IWineD3DResourceClass
...
@@ -817,7 +817,8 @@ typedef struct IWineD3DResourceClass
UINT
size
;
UINT
size
;
DWORD
usage
;
DWORD
usage
;
WINED3DFORMAT
format
;
WINED3DFORMAT
format
;
BYTE
*
allocatedMemory
;
BYTE
*
allocatedMemory
;
/* Pointer to the real data location */
BYTE
*
heapMemory
;
/* Pointer to the HeapAlloced block of memory */
struct
list
privateData
;
struct
list
privateData
;
}
IWineD3DResourceClass
;
}
IWineD3DResourceClass
;
...
...
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