wined3d: Store the amount of video memory as a UINT64.

This commit is contained in:
Henri Verbeet 2014-08-18 08:26:20 +02:00 committed by Alexandre Julliard
parent 888b278096
commit 7cdaece711
3 changed files with 24 additions and 21 deletions

View File

@ -1138,11 +1138,12 @@ UINT CDECL wined3d_device_get_available_texture_mem(const struct wined3d_device
{ {
TRACE("device %p.\n", device); TRACE("device %p.\n", device);
TRACE("Emulating %d MB, returning %d MB left.\n", TRACE("Emulating 0x%s bytes. 0x%s used, returning 0x%s left.\n",
device->adapter->TextureRam / (1024 * 1024), wine_dbgstr_longlong(device->adapter->vram_bytes),
(device->adapter->TextureRam - device->adapter->UsedTextureRam) / (1024 * 1024)); 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, void CDECL wined3d_device_set_stream_output(struct wined3d_device *device, UINT idx,

View File

@ -409,11 +409,13 @@ fail:
} }
/* Adjust the amount of used texture memory */ /* 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; adapter->vram_bytes_used += amount;
TRACE("Adjusted adapter memory by %d to %d.\n", amount, adapter->UsedTextureRam); TRACE("Adjusted used adapter memory by 0x%s to 0x%s.\n",
return adapter->UsedTextureRam; 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) 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))) if ((gpu_desc = get_gpu_description(driver_info->vendor, driver_info->device)))
{ {
driver_info->description = gpu_desc->description; 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; driver = gpu_desc->driver;
} }
else else
{ {
ERR("Card %04x:%04x not found in driver DB.\n", vendor, device); ERR("Card %04x:%04x not found in driver DB.\n", vendor, device);
driver_info->description = "Direct3D HAL"; driver_info->description = "Direct3D HAL";
driver_info->vidmem = WINE_DEFAULT_VIDMEM; driver_info->vram_bytes = WINE_DEFAULT_VIDMEM;
driver = DRIVER_UNKNOWN; driver = DRIVER_UNKNOWN;
} }
if (wined3d_settings.emulated_textureram) if (wined3d_settings.emulated_textureram)
{ {
TRACE("Overriding amount of video memory with %u bytes.\n", 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 /* 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)); memcpy(&identifier->device_identifier, &IID_D3DDEVICE_D3DUID, sizeof(identifier->device_identifier));
identifier->whql_level = (flags & WINED3DENUM_NO_WHQL_LEVEL) ? 0 : 1; identifier->whql_level = (flags & WINED3DENUM_NO_WHQL_LEVEL) ? 0 : 1;
memcpy(&identifier->adapter_luid, &adapter->luid, sizeof(identifier->adapter_luid)); 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; return WINED3D_OK;
} }
@ -5104,9 +5106,9 @@ static BOOL wined3d_adapter_init(struct wined3d_adapter *adapter, UINT ordinal)
return FALSE; return FALSE;
} }
adapter->TextureRam = adapter->driver_info.vidmem; adapter->vram_bytes = adapter->driver_info.vram_bytes;
adapter->UsedTextureRam = 0; adapter->vram_bytes_used = 0;
TRACE("Emulating %u MB of texture ram.\n", adapter->TextureRam / (1024 * 1024)); TRACE("Emulating 0x%s bytes of video ram.\n", wine_dbgstr_longlong(adapter->vram_bytes));
display_device.cb = sizeof(display_device); display_device.cb = sizeof(display_device);
EnumDisplayDevicesW(NULL, ordinal, &display_device, 0); 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.name = "Display";
adapter->driver_info.description = "WineD3D DirectDraw Emulation"; adapter->driver_info.description = "WineD3D DirectDraw Emulation";
if (wined3d_settings.emulated_textureram) if (wined3d_settings.emulated_textureram)
adapter->TextureRam = wined3d_settings.emulated_textureram; adapter->vram_bytes = wined3d_settings.emulated_textureram;
else else
adapter->TextureRam = 128 * 1024 * 1024; adapter->vram_bytes = 128 * 1024 * 1024;
initPixelFormatsNoGL(&adapter->gl_info); initPixelFormatsNoGL(&adapter->gl_info);

View File

@ -1634,7 +1634,7 @@ struct wined3d_driver_info
enum wined3d_pci_device device; enum wined3d_pci_device device;
const char *name; const char *name;
const char *description; const char *description;
unsigned int vidmem; UINT64 vram_bytes;
DWORD version_high; DWORD version_high;
DWORD version_low; DWORD version_low;
}; };
@ -1683,8 +1683,8 @@ struct wined3d_adapter
WCHAR DeviceName[CCHDEVICENAME]; /* DeviceName for use with e.g. ChangeDisplaySettings */ WCHAR DeviceName[CCHDEVICENAME]; /* DeviceName for use with e.g. ChangeDisplaySettings */
unsigned int cfg_count; unsigned int cfg_count;
struct wined3d_pixel_format *cfgs; struct wined3d_pixel_format *cfgs;
unsigned int TextureRam; /* Amount of texture memory both video ram + AGP/TurboCache/HyperMemory/.. */ UINT64 vram_bytes;
unsigned int UsedTextureRam; UINT64 vram_bytes_used;
LUID luid; LUID luid;
const struct wined3d_vertex_pipe_ops *vertex_pipe; 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; 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; BOOL initPixelFormatsNoGL(struct wined3d_gl_info *gl_info) DECLSPEC_HIDDEN;
extern void add_gl_compat_wrappers(struct wined3d_gl_info *gl_info) DECLSPEC_HIDDEN; extern void add_gl_compat_wrappers(struct wined3d_gl_info *gl_info) DECLSPEC_HIDDEN;