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
243ac3ed
Commit
243ac3ed
authored
Sep 23, 2007
by
Roderick Colenbrander
Committed by
Alexandre Julliard
Sep 24, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Move video memory tracking to the adapter.
parent
5ab977e2
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
31 additions
and
64 deletions
+31
-64
device.c
dlls/wined3d/device.c
+5
-16
directx.c
dlls/wined3d/directx.c
+21
-10
resource.c
dlls/wined3d/resource.c
+1
-1
wined3d_main.c
dlls/wined3d/wined3d_main.c
+0
-20
wined3d_private.h
dlls/wined3d/wined3d_private.h
+3
-17
wined3d_gl.h
include/wine/wined3d_gl.h
+1
-0
No files found.
dlls/wined3d/device.c
View file @
243ac3ed
...
@@ -99,7 +99,7 @@ static void WINAPI IWineD3DDeviceImpl_AddResource(IWineD3DDevice *iface, IWineD3
...
@@ -99,7 +99,7 @@ static void WINAPI IWineD3DDeviceImpl_AddResource(IWineD3DDevice *iface, IWineD3
*pp##type = NULL; \
*pp##type = NULL; \
return WINED3DERR_OUTOFVIDEOMEMORY; \
return WINED3DERR_OUTOFVIDEOMEMORY; \
} \
} \
globalChangeGlRam(
_size); \
WineD3DAdapterChangeGLRam(This,
_size); \
} \
} \
object->resource.allocatedMemory = (0 == _size ? NULL : Pool == WINED3DPOOL_DEFAULT ? NULL : HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, _size)); \
object->resource.allocatedMemory = (0 == _size ? NULL : Pool == WINED3DPOOL_DEFAULT ? NULL : HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, _size)); \
if (object->resource.allocatedMemory == NULL && _size != 0 && Pool != WINED3DPOOL_DEFAULT) { \
if (object->resource.allocatedMemory == NULL && _size != 0 && Pool != WINED3DPOOL_DEFAULT) { \
...
@@ -2295,24 +2295,13 @@ static HRESULT WINAPI IWineD3DDeviceImpl_GetDirect3D(IWineD3DDevice *iface, IWin
...
@@ -2295,24 +2295,13 @@ static HRESULT WINAPI IWineD3DDeviceImpl_GetDirect3D(IWineD3DDevice *iface, IWin
}
}
static
UINT
WINAPI
IWineD3DDeviceImpl_GetAvailableTextureMem
(
IWineD3DDevice
*
iface
)
{
static
UINT
WINAPI
IWineD3DDeviceImpl_GetAvailableTextureMem
(
IWineD3DDevice
*
iface
)
{
/** NOTE: There's a probably a hack-around for this one by putting as many pbuffers, VBOs (or whatever)
* into the video ram as possible and seeing how many fit
* you can also get the correct initial value from nvidia and ATI's driver via X
* texture memory is video memory + AGP memory
*******************/
IWineD3DDeviceImpl
*
This
=
(
IWineD3DDeviceImpl
*
)
iface
;
IWineD3DDeviceImpl
*
This
=
(
IWineD3DDeviceImpl
*
)
iface
;
static
BOOL
showfixmes
=
TRUE
;
if
(
showfixmes
)
{
FIXME
(
"(%p) : stub, simulating %dMB for now, returning %dMB left
\n
"
,
This
,
(
wined3d_settings
.
emulated_textureram
/
(
1024
*
1024
)),
((
wined3d_settings
.
emulated_textureram
-
wineD3DGlobalStatistics
->
glsurfaceram
)
/
(
1024
*
1024
)));
showfixmes
=
FALSE
;
}
TRACE
(
"(%p) : simulating %dMB, returning %dMB left
\n
"
,
This
,
TRACE
(
"(%p) : simulating %dMB, returning %dMB left
\n
"
,
This
,
(
wined3d_settings
.
emulated_texturer
am
/
(
1024
*
1024
)),
(
This
->
adapter
->
TextureR
am
/
(
1024
*
1024
)),
((
wined3d_settings
.
emulated_textureram
-
wineD3DGlobalStatistics
->
glsurfacer
am
)
/
(
1024
*
1024
)));
((
This
->
adapter
->
TextureRam
-
This
->
adapter
->
UsedTextureR
am
)
/
(
1024
*
1024
)));
/* return simulated texture memory left */
/* return simulated texture memory left */
return
(
wined3d_settings
.
emulated_textureram
-
wineD3DGlobalStatistics
->
glsurfacer
am
);
return
(
This
->
adapter
->
TextureRam
-
This
->
adapter
->
UsedTextureR
am
);
}
}
...
...
dlls/wined3d/directx.c
View file @
243ac3ed
...
@@ -277,6 +277,14 @@ static BOOL WineD3D_CreateFakeGLContext(void) {
...
@@ -277,6 +277,14 @@ static BOOL WineD3D_CreateFakeGLContext(void) {
return
FALSE
;
return
FALSE
;
}
}
/* Adjust the amount of used texture memory */
long
WineD3DAdapterChangeGLRam
(
IWineD3DDeviceImpl
*
D3DDevice
,
long
glram
){
UINT
Adapter
=
D3DDevice
->
adapterNo
;
Adapters
[
Adapter
].
UsedTextureRam
+=
glram
;
TRACE
(
"Adjusted gl ram by %ld to %d
\n
"
,
glram
,
Adapters
[
Adapter
].
UsedTextureRam
);
return
Adapters
[
Adapter
].
UsedTextureRam
;
}
/**********************************************************
/**********************************************************
* IUnknown parts follows
* IUnknown parts follows
...
@@ -1034,16 +1042,11 @@ BOOL IWineD3DImpl_FillGLCaps(WineD3D_GL_Info *gl_info) {
...
@@ -1034,16 +1042,11 @@ BOOL IWineD3DImpl_FillGLCaps(WineD3D_GL_Info *gl_info) {
}
}
TRACE
(
"FOUND (fake) card: 0x%x (vendor id), 0x%x (device id)
\n
"
,
gl_info
->
gl_vendor
,
gl_info
->
gl_card
);
TRACE
(
"FOUND (fake) card: 0x%x (vendor id), 0x%x (device id)
\n
"
,
gl_info
->
gl_vendor
,
gl_info
->
gl_card
);
/* Unless VideoMemorySize is set in the registry, the default is 0
/* If we have an estimate use it, else default to 64MB; */
* TODO: put emulated_textureram in the device */
if
(
vidmem
)
if
(
wined3d_settings
.
emulated_textureram
==
0
)
{
gl_info
->
vidmem
=
vidmem
*
1024
*
1024
;
/* convert from MBs to bytes */
/* If we have an estimate use it, else default to 64MB */
else
if
(
vidmem
)
gl_info
->
vidmem
=
WINE_DEFAULT_VIDMEM
;
wined3d_settings
.
emulated_textureram
=
vidmem
*
1024
*
1024
;
/* convert from MBs to bytes */
else
wined3d_settings
.
emulated_textureram
=
WINE_DEFAULT_VIDMEM
;
TRACE
(
"Emulating %d MB of texture memory
\n
"
,
wined3d_settings
.
emulated_textureram
);
}
/* Load all the lookup tables
/* Load all the lookup tables
TODO: It may be a good idea to make minLookup and maxLookup const and populate them in wined3d_private.h where they are declared */
TODO: It may be a good idea to make minLookup and maxLookup const and populate them in wined3d_private.h where they are declared */
...
@@ -2743,6 +2746,14 @@ BOOL InitAdapters(void) {
...
@@ -2743,6 +2746,14 @@ BOOL InitAdapters(void) {
Adapters
[
0
].
driver
=
"Display"
;
Adapters
[
0
].
driver
=
"Display"
;
Adapters
[
0
].
description
=
"Direct3D HAL"
;
Adapters
[
0
].
description
=
"Direct3D HAL"
;
/* Use the VideoRamSize registry setting when set */
if
(
wined3d_settings
.
emulated_textureram
)
Adapters
[
0
].
TextureRam
=
wined3d_settings
.
emulated_textureram
;
else
Adapters
[
0
].
TextureRam
=
Adapters
[
0
].
gl_info
.
vidmem
;
Adapters
[
0
].
UsedTextureRam
=
0
;
TRACE
(
"Emulating %dMB of texture ram
\n
"
,
Adapters
[
0
].
TextureRam
);
/* Initialize the Adapter's DeviceName which is required for ChangeDisplaySettings and friends */
/* Initialize the Adapter's DeviceName which is required for ChangeDisplaySettings and friends */
DisplayDevice
.
cb
=
sizeof
(
DisplayDevice
);
DisplayDevice
.
cb
=
sizeof
(
DisplayDevice
);
EnumDisplayDevicesW
(
NULL
,
0
/* Adapter 0 = iDevNum 0 */
,
&
DisplayDevice
,
0
);
EnumDisplayDevicesW
(
NULL
,
0
/* Adapter 0 = iDevNum 0 */
,
&
DisplayDevice
,
0
);
...
...
dlls/wined3d/resource.c
View file @
243ac3ed
...
@@ -71,7 +71,7 @@ void IWineD3DResourceImpl_CleanUp(IWineD3DResource *iface){
...
@@ -71,7 +71,7 @@ void IWineD3DResourceImpl_CleanUp(IWineD3DResource *iface){
TRACE
(
"(%p) Cleaning up resource
\n
"
,
This
);
TRACE
(
"(%p) Cleaning up resource
\n
"
,
This
);
if
(
This
->
resource
.
pool
==
WINED3DPOOL_DEFAULT
)
{
if
(
This
->
resource
.
pool
==
WINED3DPOOL_DEFAULT
)
{
TRACE
(
"Decrementing device memory pool by %u
\n
"
,
This
->
resource
.
size
);
TRACE
(
"Decrementing device memory pool by %u
\n
"
,
This
->
resource
.
size
);
globalChangeGlRam
(
-
This
->
resource
.
size
);
WineD3DAdapterChangeGLRam
(
This
->
resource
.
wineD3DDevice
,
-
This
->
resource
.
size
);
}
}
LIST_FOR_EACH_SAFE
(
e1
,
e2
,
&
This
->
resource
.
privateData
)
{
LIST_FOR_EACH_SAFE
(
e1
,
e2
,
&
This
->
resource
.
privateData
)
{
...
...
dlls/wined3d/wined3d_main.c
View file @
243ac3ed
...
@@ -46,19 +46,6 @@ wined3d_settings_t wined3d_settings =
...
@@ -46,19 +46,6 @@ wined3d_settings_t wined3d_settings =
NULL
/* No wine logo by default */
NULL
/* No wine logo by default */
};
};
WineD3DGlobalStatistics
*
wineD3DGlobalStatistics
=
NULL
;
long
globalChangeGlRam
(
long
glram
){
/* FIXME: replace this function with object tracking */
int
result
;
wineD3DGlobalStatistics
->
glsurfaceram
+=
glram
;
TRACE
(
"Adjusted gl ram by %ld to %d
\n
"
,
glram
,
wineD3DGlobalStatistics
->
glsurfaceram
);
result
=
wineD3DGlobalStatistics
->
glsurfaceram
;
return
result
;
}
IWineD3D
*
WINAPI
WineDirect3DCreate
(
UINT
SDKVersion
,
UINT
dxVersion
,
IUnknown
*
parent
)
{
IWineD3D
*
WINAPI
WineDirect3DCreate
(
UINT
SDKVersion
,
UINT
dxVersion
,
IUnknown
*
parent
)
{
IWineD3DImpl
*
object
;
IWineD3DImpl
*
object
;
...
@@ -76,13 +63,6 @@ IWineD3D* WINAPI WineDirect3DCreate(UINT SDKVersion, UINT dxVersion, IUnknown *p
...
@@ -76,13 +63,6 @@ IWineD3D* WINAPI WineDirect3DCreate(UINT SDKVersion, UINT dxVersion, IUnknown *p
object
->
ref
=
1
;
object
->
ref
=
1
;
object
->
parent
=
parent
;
object
->
parent
=
parent
;
/*Create a structure for storing global data in*/
if
(
wineD3DGlobalStatistics
==
NULL
){
TRACE
(
"Creating global statistics store
\n
"
);
wineD3DGlobalStatistics
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
*
wineD3DGlobalStatistics
));
}
TRACE
(
"Created WineD3D object @ %p for d3d%d support
\n
"
,
object
,
dxVersion
);
TRACE
(
"Created WineD3D object @ %p for d3d%d support
\n
"
,
object
,
dxVersion
);
return
(
IWineD3D
*
)
object
;
return
(
IWineD3D
*
)
object
;
...
...
dlls/wined3d/wined3d_private.h
View file @
243ac3ed
...
@@ -326,23 +326,6 @@ typedef struct IWineD3DSurfaceImpl IWineD3DSurfaceImpl;
...
@@ -326,23 +326,6 @@ typedef struct IWineD3DSurfaceImpl IWineD3DSurfaceImpl;
typedef
struct
IWineD3DPaletteImpl
IWineD3DPaletteImpl
;
typedef
struct
IWineD3DPaletteImpl
IWineD3DPaletteImpl
;
typedef
struct
IWineD3DDeviceImpl
IWineD3DDeviceImpl
;
typedef
struct
IWineD3DDeviceImpl
IWineD3DDeviceImpl
;
/* Tracking */
/* TODO: Move some of this to the device */
long
globalChangeGlRam
(
long
glram
);
/* Memory and object tracking */
/*Structure for holding information on all direct3d objects
useful for making sure tracking is ok and when release is called on a device!
and probably quite handy for debugging and dumping states out
*/
typedef
struct
WineD3DGlobalStatistics
{
int
glsurfaceram
;
/* The aproximate amount of glTexture memory allocated for textures */
}
WineD3DGlobalStatistics
;
extern
WineD3DGlobalStatistics
*
wineD3DGlobalStatistics
;
/* Global variables */
/* Global variables */
extern
const
float
identity
[
16
];
extern
const
float
identity
[
16
];
...
@@ -597,10 +580,13 @@ struct WineD3DAdapter
...
@@ -597,10 +580,13 @@ struct WineD3DAdapter
WCHAR
DeviceName
[
CCHDEVICENAME
];
/* DeviceName for use with e.g. ChangeDisplaySettings */
WCHAR
DeviceName
[
CCHDEVICENAME
];
/* DeviceName for use with e.g. ChangeDisplaySettings */
int
nCfgs
;
int
nCfgs
;
WineD3D_PixelFormat
*
cfgs
;
WineD3D_PixelFormat
*
cfgs
;
unsigned
int
TextureRam
;
/* Amount of texture memory both video ram + AGP/TurboCache/HyperMemory/.. */
unsigned
int
UsedTextureRam
;
};
};
extern
BOOL
InitAdapters
(
void
);
extern
BOOL
InitAdapters
(
void
);
extern
BOOL
initPixelFormats
(
WineD3D_GL_Info
*
gl_info
);
extern
BOOL
initPixelFormats
(
WineD3D_GL_Info
*
gl_info
);
extern
long
WineD3DAdapterChangeGLRam
(
IWineD3DDeviceImpl
*
D3DDevice
,
long
glram
);
/*****************************************************************************
/*****************************************************************************
* High order patch management
* High order patch management
...
...
include/wine/wined3d_gl.h
View file @
243ac3ed
...
@@ -3702,6 +3702,7 @@ typedef struct _WineD3D_GL_Info {
...
@@ -3702,6 +3702,7 @@ typedef struct _WineD3D_GL_Info {
GL_Vendors
gl_vendor
;
GL_Vendors
gl_vendor
;
GL_Cards
gl_card
;
GL_Cards
gl_card
;
UINT
vidmem
;
DWORD
gl_driver_version
;
DWORD
gl_driver_version
;
CHAR
gl_renderer
[
255
];
CHAR
gl_renderer
[
255
];
/**
/**
...
...
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