ReactOS  0.4.15-dev-1171-gab82533
d3d9_callbacks.c
Go to the documentation of this file.
1 /*
2  * COPYRIGHT: See COPYING in the top level directory
3  * PROJECT: ReactOS ReactX
4  * FILE: dll/directx/d3d9/d3d9_callbacks.c
5  * PURPOSE: Direct3D9's callback functions
6  * PROGRAMERS: Gregor Gullwi <gbrunmar (dot) ros (at) gmail (dot) com>
7  */
8 #include "d3d9_common.h"
9 #include "d3d9_callbacks.h"
10 #include <d3d9.h>
11 #include <dll/directx/d3d8thk.h>
12 #include "d3d9_private.h"
13 #include "ddrawi.h"
14 
16 {
17  DWORD Ret = FALSE;
19  ZeroMemory(&Data, sizeof(Data));
20 
21  if (D3D9_GETAVAILDRIVERMEMORY_TYPE_ALL == pData->dwMemoryType)
22  {
23  Data.DDSCaps.dwCaps = DDSCAPS_VIDEOMEMORY;
24  }
25  else if (D3D9_GETAVAILDRIVERMEMORY_TYPE_LOCAL == pData->dwMemoryType)
26  {
27  Data.DDSCaps.dwCaps = DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM;
28  }
29  else if (D3D9_GETAVAILDRIVERMEMORY_TYPE_NONLOCAL == pData->dwMemoryType)
30  {
32  }
33 
34  if (Data.DDSCaps.dwCaps != 0)
35  {
36  if (0 == pData->dwTextureType)
37  Data.DDSCaps.dwCaps |= DDSCAPS_TEXTURE;
38 
39  if (pData->dwTextureType & D3D9_TEXTURETYPE_HALSURFACE)
40  Data.DDSCaps.dwCaps |= DDSCAPS_TEXTURE | DDSCAPS_3DDEVICE;
41 
42  if (pData->dwTextureType & D3D9_TEXTURETYPE_BACKBUFFER)
43  Data.DDSCaps.dwCaps |= DDSCAPS_ZBUFFER;
44 
45  Ret = OsThunkDdGetAvailDriverMemory(pData->pUnknown6BC->hDirectDrawLocal, (DD_GETAVAILDRIVERMEMORYDATA*)&Data);
46  pData->dwFree = Data.dwFree;
47  }
48 
49  return Ret;
50 }
#define DDSCAPS_3DDEVICE
Definition: ddraw.h:263
#define DDSCAPS_TEXTURE
Definition: ddraw.h:262
#define DDSCAPS_NONLOCALVIDMEM
Definition: ddraw.h:277
#define ZeroMemory
Definition: winbase.h:1648
#define FALSE
Definition: types.h:117
#define D3D9_TEXTURETYPE_HALSURFACE
#define DDSCAPS_ZBUFFER
Definition: ddraw.h:267
#define DDSCAPS_VIDEOMEMORY
Definition: ddraw.h:264
DWORD WINAPI D3d9GetAvailDriverMemory(LPD3D9_GETAVAILDRIVERMEMORYDATA pData)
DWORD WINAPI OsThunkDdGetAvailDriverMemory(HANDLE hDirectDraw, PDD_GETAVAILDRIVERMEMORYDATA puGetAvailDriverMemoryData)
#define WINAPI
Definition: msvc.h:6
unsigned long DWORD
Definition: ntddk_ex.h:95
#define DDSCAPS_LOCALVIDMEM
Definition: ddraw.h:276
#define D3D9_TEXTURETYPE_BACKBUFFER
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
Definition: twain.h:1827
_In_ ULONG_PTR Data
Definition: cdrom.h:947