Author: gbrunmar Date: Mon May 5 11:49:13 2008 New Revision: 33299
URL: http://svn.reactos.org/svn/reactos?rev=33299&view=rev Log: Implemented IDirect3DDevice9::GetAvailableTextureMem()
Modified: trunk/reactos/dll/directx/d3d9/d3d9_device.c trunk/reactos/dll/directx/d3d9/d3d9_private.h
Modified: trunk/reactos/dll/directx/d3d9/d3d9_device.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/d3d9/d3d9_devic... ============================================================================== --- trunk/reactos/dll/directx/d3d9/d3d9_device.c [iso-8859-1] (original) +++ trunk/reactos/dll/directx/d3d9/d3d9_device.c [iso-8859-1] Mon May 5 11:49:13 2008 @@ -70,11 +70,43 @@ return D3D_OK; }
+/*++ +* @name IDirect3DDevice9::GetAvailableTextureMem +* @implemented +* +* The function IDirect3DDevice9Impl_GetAvailableTextureMem returns a pointer to the IDirect3D9 object +* that created this device. +* +* @param LPDIRECT3D iface +* Pointer to the IDirect3DDevice9 object returned from IDirect3D9::CreateDevice() +* +* @return UINT +* The method returns an estimated the currently available texture memory in bytes rounded +* to the nearest MB. Applications should NOT use this as an exact number. +* +*/ static UINT WINAPI IDirect3DDevice9Impl_GetAvailableTextureMem(LPDIRECT3DDEVICE9 iface) { - UNIMPLEMENTED - - return D3D_OK; + UINT AvailableTextureMemory = 0; + DD_GETAVAILDRIVERMEMORYDATA ddGetAvailDriverMemoryData; + + LPDIRECT3DDEVICE9_INT This = impl_from_IDirect3DDevice9(iface); + LOCK_D3DDEVICE9(); + + memset(&ddGetAvailDriverMemoryData, 0, sizeof(ddGetAvailDriverMemoryData)); + ddGetAvailDriverMemoryData.lpDD = (PDD_DIRECTDRAW_GLOBAL)&This->DeviceData[0].pUnknown6BC->hDD; + + if (DDHAL_DRIVER_HANDLED == (*This->DeviceData[0].D3D9Callbacks.DdGetAvailDriverMemory)(&ddGetAvailDriverMemoryData)) + { + if (DD_OK == ddGetAvailDriverMemoryData.ddRVal) + { + /* Round it up to the nearest MB */ + AvailableTextureMemory = (ddGetAvailDriverMemoryData.dwFree + 0x80000) & 0xFFF00000; + } + } + + UNLOCK_D3DDEVICE9(); + return AvailableTextureMemory; }
static HRESULT WINAPI IDirect3DDevice9Impl_EvictManagedResources(LPDIRECT3DDEVICE9 iface)
Modified: trunk/reactos/dll/directx/d3d9/d3d9_private.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/d3d9/d3d9_priva... ============================================================================== --- trunk/reactos/dll/directx/d3d9/d3d9_private.h [iso-8859-1] (original) +++ trunk/reactos/dll/directx/d3d9/d3d9_private.h [iso-8859-1] Mon May 5 11:49:13 2008 @@ -10,6 +10,7 @@
#include <windows.h> #include <ddraw.h> +#include <ddrawint.h>
#define D3D9_INT_MAX_NUM_ADAPTERS 12
@@ -107,7 +108,7 @@ /* 0x0044 */ DWORD DdFlip; /* 0x0048 */ DWORD DdGetBltStatus; /* 0x004c */ DWORD DdGetFlipStatus; -/* 0x0050 */ DWORD DdGetAvailDriverMemory; +/* 0x0050 */ PDD_GETAVAILDRIVERMEMORY DdGetAvailDriverMemory; /* 0x0054 */ DWORD unknown0115; /* 0x0058 */ DWORD DdSetMode; /* 0x005c */ DWORD DdSetExclusiveMode;