Implemented IDirect3DDevice9::GetAvailableTextureMem()

svn path=/trunk/; revision=33299
This commit is contained in:
Gregor Brunmar 2008-05-05 16:49:13 +00:00
parent f71800893b
commit bc1d4f7c8c
2 changed files with 36 additions and 3 deletions

View file

@ -70,11 +70,43 @@ static HRESULT WINAPI IDirect3DDevice9Impl_TestCooperativeLevel(LPDIRECT3DDEVICE
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
UINT AvailableTextureMemory = 0;
DD_GETAVAILDRIVERMEMORYDATA ddGetAvailDriverMemoryData;
return D3D_OK;
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)

View file

@ -10,6 +10,7 @@
#include <windows.h>
#include <ddraw.h>
#include <ddrawint.h>
#define D3D9_INT_MAX_NUM_ADAPTERS 12
@ -107,7 +108,7 @@ typedef struct _tagD3D9_CALLBACKS
/* 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;