mirror of
https://github.com/reactos/reactos.git
synced 2025-07-27 20:22:05 +00:00
D3D9:
* Implemented DdGetAvailDriverMemory callback svn path=/trunk/; revision=36651
This commit is contained in:
parent
dc649db4d4
commit
23bb9ae68f
5 changed files with 88 additions and 16 deletions
|
@ -14,6 +14,7 @@
|
||||||
|
|
||||||
<file>d3d9.c</file>
|
<file>d3d9.c</file>
|
||||||
<file>d3d9_baseobject.c</file>
|
<file>d3d9_baseobject.c</file>
|
||||||
|
<file>d3d9_callbacks.c</file>
|
||||||
<file>d3d9_caps.c</file>
|
<file>d3d9_caps.c</file>
|
||||||
<file>d3d9_create.c</file>
|
<file>d3d9_create.c</file>
|
||||||
<file>d3d9_cursor.c</file>
|
<file>d3d9_cursor.c</file>
|
||||||
|
|
51
reactos/dll/directx/d3d9/d3d9_callbacks.c
Normal file
51
reactos/dll/directx/d3d9/d3d9_callbacks.c
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
/*
|
||||||
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
|
* PROJECT: ReactOS ReactX
|
||||||
|
* FILE: dll/directx/d3d9/d3d9_callbacks.c
|
||||||
|
* PURPOSE: Direct3D9's callback functions
|
||||||
|
* PROGRAMERS: Gregor Gullwi <gbrunmar (dot) ros (at) gmail (dot) com>
|
||||||
|
*/
|
||||||
|
#include "d3d9_common.h"
|
||||||
|
#include "d3d9_callbacks.h"
|
||||||
|
#define STDCALL __stdcall
|
||||||
|
#include <d3d9.h>
|
||||||
|
#include <dll/directx/d3d8thk.h>
|
||||||
|
#include "d3d9_private.h"
|
||||||
|
#include "ddrawi.h"
|
||||||
|
|
||||||
|
DWORD WINAPI D3d9GetAvailDriverMemory(LPD3D9_GETAVAILDRIVERMEMORYDATA pData)
|
||||||
|
{
|
||||||
|
DWORD Ret = FALSE;
|
||||||
|
DDHAL_GETAVAILDRIVERMEMORYDATA Data;
|
||||||
|
ZeroMemory(&Data, sizeof(Data));
|
||||||
|
|
||||||
|
if (D3D9_GETAVAILDRIVERMEMORY_TYPE_ALL == pData->dwMemoryType)
|
||||||
|
{
|
||||||
|
Data.DDSCaps.dwCaps = DDSCAPS_VIDEOMEMORY;
|
||||||
|
}
|
||||||
|
else if (D3D9_GETAVAILDRIVERMEMORY_TYPE_LOCAL == pData->dwMemoryType)
|
||||||
|
{
|
||||||
|
Data.DDSCaps.dwCaps = DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM;
|
||||||
|
}
|
||||||
|
else if (D3D9_GETAVAILDRIVERMEMORY_TYPE_NONLOCAL == pData->dwMemoryType)
|
||||||
|
{
|
||||||
|
Data.DDSCaps.dwCaps = DDSCAPS_VIDEOMEMORY | DDSCAPS_NONLOCALVIDMEM;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Data.DDSCaps.dwCaps != 0)
|
||||||
|
{
|
||||||
|
if (0 == pData->dwTextureType)
|
||||||
|
Data.DDSCaps.dwCaps |= DDSCAPS_TEXTURE;
|
||||||
|
|
||||||
|
if (pData->dwTextureType & D3D9_TEXTURETYPE_HALSURFACE)
|
||||||
|
Data.DDSCaps.dwCaps |= DDSCAPS_TEXTURE | DDSCAPS_3DDEVICE;
|
||||||
|
|
||||||
|
if (pData->dwTextureType & D3D9_TEXTURETYPE_BACKBUFFER)
|
||||||
|
Data.DDSCaps.dwCaps |= DDSCAPS_ZBUFFER;
|
||||||
|
|
||||||
|
Ret = OsThunkDdGetAvailDriverMemory(pData->pUnknown6BC->hDirectDrawLocal, (DD_GETAVAILDRIVERMEMORYDATA*)&Data);
|
||||||
|
pData->dwFree = Data.dwFree;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Ret;
|
||||||
|
}
|
33
reactos/dll/directx/d3d9/d3d9_callbacks.h
Normal file
33
reactos/dll/directx/d3d9/d3d9_callbacks.h
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
/*
|
||||||
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
|
* PROJECT: ReactOS ReactX
|
||||||
|
* FILE: dll/directx/d3d9/d3d9_callbacks.h
|
||||||
|
* PURPOSE: Direct3D9's callback structs and constants
|
||||||
|
* PROGRAMERS: Gregor Gullwi <gbrunmar (dot) ros (at) gmail (dot) com>
|
||||||
|
*/
|
||||||
|
#ifndef _D3D9_CALLBACKS_H_
|
||||||
|
#define _D3D9_CALLBACKS_H_
|
||||||
|
|
||||||
|
typedef enum _D3D9_GETAVAILDRIVERMEMORY_TYPE
|
||||||
|
{
|
||||||
|
D3D9_GETAVAILDRIVERMEMORY_TYPE_ALL = 0,
|
||||||
|
D3D9_GETAVAILDRIVERMEMORY_TYPE_LOCAL = 4,
|
||||||
|
D3D9_GETAVAILDRIVERMEMORY_TYPE_NONLOCAL = 5,
|
||||||
|
} D3D9_GETAVAILDRIVERMEMORY_TYPE;
|
||||||
|
|
||||||
|
#define D3D9_TEXTURETYPE_HALSURFACE 1
|
||||||
|
#define D3D9_TEXTURETYPE_BACKBUFFER 2
|
||||||
|
|
||||||
|
typedef struct _D3D9_GETAVAILDRIVERMEMORYDATA
|
||||||
|
{
|
||||||
|
/* 0x0000 */ struct _D3D9_Unknown6BC* pUnknown6BC;
|
||||||
|
/* 0x0004 */ D3D9_GETAVAILDRIVERMEMORY_TYPE dwMemoryType;
|
||||||
|
/* 0x0008 */ DWORD dwTextureType;
|
||||||
|
/* 0x000c */ DWORD dwFree;
|
||||||
|
} D3D9_GETAVAILDRIVERMEMORYDATA, FAR* LPD3D9_GETAVAILDRIVERMEMORYDATA;
|
||||||
|
|
||||||
|
typedef DWORD (WINAPI FAR* LPD3D9_GETAVAILDRIVERMEMORY)(LPD3D9_GETAVAILDRIVERMEMORYDATA);
|
||||||
|
|
||||||
|
DWORD WINAPI D3d9GetAvailDriverMemory(LPD3D9_GETAVAILDRIVERMEMORYDATA pData);
|
||||||
|
|
||||||
|
#endif // _D3D9_CALLBACKS_H_
|
|
@ -11,6 +11,7 @@
|
||||||
#include "d3d9_helpers.h"
|
#include "d3d9_helpers.h"
|
||||||
#include "d3d9_caps.h"
|
#include "d3d9_caps.h"
|
||||||
#include "adapter.h"
|
#include "adapter.h"
|
||||||
|
#include "d3d9_callbacks.h"
|
||||||
|
|
||||||
static INT g_NumDevices = 0;
|
static INT g_NumDevices = 0;
|
||||||
|
|
||||||
|
@ -833,6 +834,7 @@ BOOL GetD3D9DriverInfo( D3D9_Unknown6BC* pUnknown6BC,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO: Set all internal function pointers to create surface, etc. */
|
/* TODO: Set all internal function pointers to create surface, etc. */
|
||||||
|
pD3D9Callbacks->DdGetAvailDriverMemory = &D3d9GetAvailDriverMemory;
|
||||||
|
|
||||||
/* Set device rect */
|
/* Set device rect */
|
||||||
{
|
{
|
||||||
|
|
|
@ -10,28 +10,13 @@
|
||||||
|
|
||||||
#include "d3d9_common.h"
|
#include "d3d9_common.h"
|
||||||
#include <ddraw.h>
|
#include <ddraw.h>
|
||||||
|
#include "d3d9_callbacks.h"
|
||||||
|
|
||||||
#define D3D9_INT_MAX_NUM_ADAPTERS 12
|
#define D3D9_INT_MAX_NUM_ADAPTERS 12
|
||||||
|
|
||||||
#define D3D9_INT_D3DCAPS8_VALID 1
|
#define D3D9_INT_D3DCAPS8_VALID 1
|
||||||
#define D3D9_INT_D3DCAPS9_VALID 2
|
#define D3D9_INT_D3DCAPS9_VALID 2
|
||||||
|
|
||||||
typedef enum _D3D9_GETAVAILDRIVERMEMORY_TYPE
|
|
||||||
{
|
|
||||||
D3D9_GETAVAILDRIVERMEMORY_TYPE_ALL = 0,
|
|
||||||
D3D9_GETAVAILDRIVERMEMORY_TYPE_LOCAL = 4,
|
|
||||||
D3D9_GETAVAILDRIVERMEMORY_TYPE_NONLOCAL = 5,
|
|
||||||
} D3D9_GETAVAILDRIVERMEMORY_TYPE;
|
|
||||||
|
|
||||||
typedef struct _D3D9_GETAVAILDRIVERMEMORYDATA
|
|
||||||
{
|
|
||||||
/* 0x0000 */ struct _D3D9_Unknown6BC* pUnknown6BC;
|
|
||||||
/* 0x0004 */ D3D9_GETAVAILDRIVERMEMORY_TYPE dwMemoryType;
|
|
||||||
/* 0x0008 */ DWORD dwTextureType;
|
|
||||||
/* 0x000c */ DWORD dwFree;
|
|
||||||
} D3D9_GETAVAILDRIVERMEMORYDATA, FAR* LPD3D9_GETAVAILDRIVERMEMORYDATA;
|
|
||||||
typedef BOOL (WINAPI FAR* LPD3D9_GETAVAILDRIVERMEMORY)(LPD3D9_GETAVAILDRIVERMEMORYDATA);
|
|
||||||
|
|
||||||
typedef struct _D3D9_Unknown6BC
|
typedef struct _D3D9_Unknown6BC
|
||||||
{
|
{
|
||||||
/* 0x0000 */ HANDLE hDirectDrawLocal;
|
/* 0x0000 */ HANDLE hDirectDrawLocal;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue