wined3d: registry setting for the amount of simulated texture memory
Jan Zerebecki
jan.wine at zerebecki.de
Mon Aug 7 17:03:06 CDT 2006
This patch is a modified version of
http://wiki.winehq.org/PatchD3dVideoMemorySize submitted because
of popular demand.
If this patch is rejected from inclusion, please tell me why, as i would have to
ask anyway.
From: Jan Zerebecki <jan.wine at zerebecki.de>
Changelog:
wined3d: registry setting for the amount of simulated texture memory
Set VideoMemorySize under HKCU\Software\Wine\Direct3D to amount
in MB as string.
---
dlls/wined3d/device.c | 20 ++++++++++----------
dlls/wined3d/wined3d_main.c | 14 ++++++++++++++
dlls/wined3d/wined3d_private.h | 2 ++
3 files changed, 26 insertions(+), 10 deletions(-)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 7429512..7af7151 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -70,9 +70,6 @@ inline static Display *get_display( HDC
return display;
}
-/* Memory tracking and object counting */
-static unsigned int emulated_textureram = 64*1024*1024;
-
/* TODO: setup some flags in the regestry to enable, disable pbuffer support */
/* enable pbuffer support for offscreen textures */
BOOL pbuffer_support = FALSE;
@@ -2264,19 +2261,22 @@ static HRESULT WINAPI IWineD3DDeviceImpl
static UINT WINAPI IWineD3DDeviceImpl_GetAvailableTextureMem(IWineD3DDevice *iface) {
/** NOTE: There's a probably a hack-around for this one by putting as many pbuffers, VBO's (or whatever)
* Into the video ram as possible and seeing how many fit
- * you can also get the correct initial value from via X and ATI's driver
+ * 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;
static BOOL showfixmes = TRUE;
if (showfixmes) {
- FIXME("(%p) : stub, emulating %dMB for now, returning %dMB\n", This, (emulated_textureram/(1024*1024)),
- ((emulated_textureram - wineD3DGlobalStatistics->glsurfaceram) / (1024*1024)));
+ 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) : emulating %dMB for now, returning %dMB\n", This, (emulated_textureram/(1024*1024)),
- ((emulated_textureram - wineD3DGlobalStatistics->glsurfaceram) / (1024*1024)));
- /* videomemory is simulated videomemory + AGP memory left */
- return (emulated_textureram - wineD3DGlobalStatistics->glsurfaceram);
+ TRACE("(%p) : simulating %dMB, returning %dMB left\n", This,
+ (wined3d_settings.emulated_textureram/(1024*1024)),
+ ((wined3d_settings.emulated_textureram - wineD3DGlobalStatistics->glsurfaceram) / (1024*1024)));
+ /* return simulated texture memory left */
+ return (wined3d_settings.emulated_textureram - wineD3DGlobalStatistics->glsurfaceram);
}
diff --git a/dlls/wined3d/wined3d_main.c b/dlls/wined3d/wined3d_main.c
index 1021932..c672623 100644
--- a/dlls/wined3d/wined3d_main.c
+++ b/dlls/wined3d/wined3d_main.c
@@ -100,6 +100,7 @@ BOOL WINAPI DllMain(HINSTANCE hInstDLL,
HKEY hkey = 0;
HKEY appkey = 0;
DWORD len;
+ wined3d_settings.emulated_textureram = 64*1024*1024;
DisableThreadLibraryCalls(hInstDLL);
@@ -225,6 +226,19 @@ BOOL WINAPI DllMain(HINSTANCE hInstDLL,
wined3d_settings.rendertargetlock_mode = RTL_TEXTEX;
}
}
+ if ( !get_config_key( hkey, appkey, "VideoMemorySize", buffer, size) )
+ {
+ int TmpVideoMemorySize = atoi(buffer);
+ if(TmpVideoMemorySize > 0)
+ {
+ wined3d_settings.emulated_textureram = (unsigned int)TmpVideoMemorySize *1024*1024;
+ TRACE("Use %iMB = %d byte for emulated_textureram\n",
+ TmpVideoMemorySize,
+ wined3d_settings.emulated_textureram);
+ }
+ else
+ ERR("VideoMemorySize is %i but must be >0\n", TmpVideoMemorySize);
+ }
}
if (wined3d_settings.vs_mode == VS_HW)
TRACE("Allow HW vertex shaders\n");
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index a87439b..0010062 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -159,6 +159,8 @@ typedef struct wined3d_settings_s {
/* nonpower 2 function */
int nonpower2_mode;
int rendertargetlock_mode;
+/* Memory tracking and object counting */
+ unsigned int emulated_textureram;
} wined3d_settings_t;
extern wined3d_settings_t wined3d_settings;
More information about the wine-patches
mailing list