Module: wine Branch: master Commit: 7cdaece711e696447b10ea9c0ab00b7ced799165 URL: http://source.winehq.org/git/wine.git/?a=commit;h=7cdaece711e696447b10ea9c0a...
Author: Henri Verbeet hverbeet@codeweavers.com Date: Mon Aug 18 08:26:20 2014 +0200
wined3d: Store the amount of video memory as a UINT64.
---
dlls/wined3d/device.c | 9 +++++---- dlls/wined3d/directx.c | 28 +++++++++++++++------------- dlls/wined3d/wined3d_private.h | 8 ++++---- 3 files changed, 24 insertions(+), 21 deletions(-)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 54273cd..b7d02bf 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -1138,11 +1138,12 @@ UINT CDECL wined3d_device_get_available_texture_mem(const struct wined3d_device { TRACE("device %p.\n", device);
- TRACE("Emulating %d MB, returning %d MB left.\n", - device->adapter->TextureRam / (1024 * 1024), - (device->adapter->TextureRam - device->adapter->UsedTextureRam) / (1024 * 1024)); + TRACE("Emulating 0x%s bytes. 0x%s used, returning 0x%s left.\n", + wine_dbgstr_longlong(device->adapter->vram_bytes), + wine_dbgstr_longlong(device->adapter->vram_bytes_used), + wine_dbgstr_longlong(device->adapter->vram_bytes - device->adapter->vram_bytes_used));
- return device->adapter->TextureRam - device->adapter->UsedTextureRam; + return min(UINT_MAX, device->adapter->vram_bytes - device->adapter->vram_bytes_used); }
void CDECL wined3d_device_set_stream_output(struct wined3d_device *device, UINT idx, diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index d1eeee8..f1ba7b5 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -409,11 +409,13 @@ fail: }
/* Adjust the amount of used texture memory */ -unsigned int adapter_adjust_memory(struct wined3d_adapter *adapter, int amount) +UINT64 adapter_adjust_memory(struct wined3d_adapter *adapter, INT64 amount) { - adapter->UsedTextureRam += amount; - TRACE("Adjusted adapter memory by %d to %d.\n", amount, adapter->UsedTextureRam); - return adapter->UsedTextureRam; + adapter->vram_bytes_used += amount; + TRACE("Adjusted used adapter memory by 0x%s to 0x%s.\n", + wine_dbgstr_longlong(amount), + wine_dbgstr_longlong(adapter->vram_bytes_used)); + return adapter->vram_bytes_used; }
static void wined3d_adapter_cleanup(struct wined3d_adapter *adapter) @@ -1498,21 +1500,21 @@ static void init_driver_info(struct wined3d_driver_info *driver_info, if ((gpu_desc = get_gpu_description(driver_info->vendor, driver_info->device))) { driver_info->description = gpu_desc->description; - driver_info->vidmem = gpu_desc->vidmem * 1024 * 1024; + driver_info->vram_bytes = (UINT64)gpu_desc->vidmem * 1024 * 1024; driver = gpu_desc->driver; } else { ERR("Card %04x:%04x not found in driver DB.\n", vendor, device); driver_info->description = "Direct3D HAL"; - driver_info->vidmem = WINE_DEFAULT_VIDMEM; + driver_info->vram_bytes = WINE_DEFAULT_VIDMEM; driver = DRIVER_UNKNOWN; }
if (wined3d_settings.emulated_textureram) { TRACE("Overriding amount of video memory with %u bytes.\n", wined3d_settings.emulated_textureram); - driver_info->vidmem = wined3d_settings.emulated_textureram; + driver_info->vram_bytes = wined3d_settings.emulated_textureram; }
/* Try to obtain driver version information for the current Windows version. This fails in @@ -3401,7 +3403,7 @@ HRESULT CDECL wined3d_get_adapter_identifier(const struct wined3d *wined3d, memcpy(&identifier->device_identifier, &IID_D3DDEVICE_D3DUID, sizeof(identifier->device_identifier)); identifier->whql_level = (flags & WINED3DENUM_NO_WHQL_LEVEL) ? 0 : 1; memcpy(&identifier->adapter_luid, &adapter->luid, sizeof(identifier->adapter_luid)); - identifier->video_memory = adapter->TextureRam; + identifier->video_memory = min(~(SIZE_T)0, adapter->vram_bytes);
return WINED3D_OK; } @@ -5104,9 +5106,9 @@ static BOOL wined3d_adapter_init(struct wined3d_adapter *adapter, UINT ordinal) return FALSE; }
- adapter->TextureRam = adapter->driver_info.vidmem; - adapter->UsedTextureRam = 0; - TRACE("Emulating %u MB of texture ram.\n", adapter->TextureRam / (1024 * 1024)); + adapter->vram_bytes = adapter->driver_info.vram_bytes; + adapter->vram_bytes_used = 0; + TRACE("Emulating 0x%s bytes of video ram.\n", wine_dbgstr_longlong(adapter->vram_bytes));
display_device.cb = sizeof(display_device); EnumDisplayDevicesW(NULL, ordinal, &display_device, 0); @@ -5132,9 +5134,9 @@ static void wined3d_adapter_init_nogl(struct wined3d_adapter *adapter, UINT ordi adapter->driver_info.name = "Display"; adapter->driver_info.description = "WineD3D DirectDraw Emulation"; if (wined3d_settings.emulated_textureram) - adapter->TextureRam = wined3d_settings.emulated_textureram; + adapter->vram_bytes = wined3d_settings.emulated_textureram; else - adapter->TextureRam = 128 * 1024 * 1024; + adapter->vram_bytes = 128 * 1024 * 1024;
initPixelFormatsNoGL(&adapter->gl_info);
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index a9d81a5c..ebe0bf8 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -1634,7 +1634,7 @@ struct wined3d_driver_info enum wined3d_pci_device device; const char *name; const char *description; - unsigned int vidmem; + UINT64 vram_bytes; DWORD version_high; DWORD version_low; }; @@ -1683,8 +1683,8 @@ struct wined3d_adapter WCHAR DeviceName[CCHDEVICENAME]; /* DeviceName for use with e.g. ChangeDisplaySettings */ unsigned int cfg_count; struct wined3d_pixel_format *cfgs; - unsigned int TextureRam; /* Amount of texture memory both video ram + AGP/TurboCache/HyperMemory/.. */ - unsigned int UsedTextureRam; + UINT64 vram_bytes; + UINT64 vram_bytes_used; LUID luid;
const struct wined3d_vertex_pipe_ops *vertex_pipe; @@ -1694,7 +1694,7 @@ struct wined3d_adapter };
BOOL wined3d_adapter_init_format_info(struct wined3d_adapter *adapter) DECLSPEC_HIDDEN; -unsigned int adapter_adjust_memory(struct wined3d_adapter *adapter, int amount) DECLSPEC_HIDDEN; +UINT64 adapter_adjust_memory(struct wined3d_adapter *adapter, INT64 amount) DECLSPEC_HIDDEN;
BOOL initPixelFormatsNoGL(struct wined3d_gl_info *gl_info) DECLSPEC_HIDDEN; extern void add_gl_compat_wrappers(struct wined3d_gl_info *gl_info) DECLSPEC_HIDDEN;