Module: wine Branch: master Commit: b23809868a2dc06373cd9f9fcbc1e56a497301d1 URL: http://source.winehq.org/git/wine.git/?a=commit;h=b23809868a2dc06373cd9f9fcb...
Author: Henri Verbeet hverbeet@codeweavers.com Date: Sun Sep 11 22:25:40 2011 +0200
ddraw: Get the total amount of video memory from wined3d.
Instead of hoping that what's available at ddraw_init() time is the total.
---
dlls/ddraw/ddraw.c | 15 +++++++++------ dlls/ddraw/ddraw_private.h | 1 - 2 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c index e9aefd9..d48aa01 100644 --- a/dlls/ddraw/ddraw.c +++ b/dlls/ddraw/ddraw.c @@ -1593,6 +1593,7 @@ static HRESULT WINAPI ddraw7_GetAvailableVidMem(IDirectDraw7 *iface, DDSCAPS2 *C DWORD *free) { IDirectDrawImpl *This = impl_from_IDirectDraw7(iface); + HRESULT hr = DD_OK;
TRACE("iface %p, caps %p, total %p, free %p.\n", iface, Caps, total, free);
@@ -1614,13 +1615,18 @@ static HRESULT WINAPI ddraw7_GetAvailableVidMem(IDirectDraw7 *iface, DDSCAPS2 *C return DDERR_INVALIDPARAMS; }
- if (total) - *total = This->total_vidmem; if (free) *free = wined3d_device_get_available_texture_mem(This->wined3d_device); + if (total) + { + WINED3DADAPTER_IDENTIFIER desc = {0}; + + hr = wined3d_get_adapter_identifier(This->wineD3D, WINED3DADAPTER_DEFAULT, 0, &desc); + *total = desc.video_memory; + }
LeaveCriticalSection(&ddraw_cs); - return DD_OK; + return hr; }
static HRESULT WINAPI ddraw4_GetAvailableVidMem(IDirectDraw4 *iface, @@ -5841,9 +5847,6 @@ HRESULT ddraw_init(IDirectDrawImpl *ddraw, WINED3DDEVTYPE device_type) return hr; }
- /* Get the amount of video memory */ - ddraw->total_vidmem = wined3d_device_get_available_texture_mem(ddraw->wined3d_device); - list_init(&ddraw->surface_list);
return DD_OK; diff --git a/dlls/ddraw/ddraw_private.h b/dlls/ddraw/ddraw_private.h index 065ef8a..1daefbc 100644 --- a/dlls/ddraw/ddraw_private.h +++ b/dlls/ddraw/ddraw_private.h @@ -89,7 +89,6 @@ struct IDirectDrawImpl BOOL d3d_initialized;
/* Misc ddraw fields */ - UINT total_vidmem; DWORD cur_scanline; BOOL fake_vblank; BOOL initialized;