xref: /reactos/dll/directx/d3d9/d3d9_baseobject.h (revision c2c66aff)
1 /*
2  * COPYRIGHT:       See COPYING in the top level directory
3  * PROJECT:         ReactOS ReactX
4  * FILE:            dll/directx/d3d9/d3d9_baseobject.h
5  * PURPOSE:         Direct3D9's base object
6  * PROGRAMERS:      Gregor Gullwi <gbrunmar (dot) ros (at) gmail (dot) com>
7  */
8 #ifndef _D3D9_BASEOBJECT_H_
9 #define _D3D9_BASEOBJECT_H_
10 
11 #include "d3d9_common.h"
12 #include <d3d9.h>
13 
14 struct _D3D9BaseObject;
15 struct _Direct3DDevice9_INT;
16 
17 enum REF_TYPE
18 {
19     RT_EXTERNAL,
20     RT_BUILTIN,
21     RT_INTERNAL,
22 };
23 
24 typedef struct _D3D9BaseObjectVtbl
25 {
26     VOID (*Destroy)(struct _D3D9BaseObject* pBaseObject, BOOL bFreeThis);
27 } ID3D9BaseObjectVtbl;
28 
29 typedef struct _D3D9BaseObject
30 {
31 /* 0x0000 */    ID3D9BaseObjectVtbl* lpVtbl;
32 /* 0x0004 */    LONG lRefCnt;
33 /* 0x0008 */    DWORD dwNumUsed;
34 /* 0x000c */    IUnknown* pUnknown;
35 /* 0x0010 */    DWORD dwUnknown0010;    // Index? Unique id?
36 /* 0x0014 */    HANDLE hKernelHandle;
37 /* 0x0018 */    LPDWORD dwUnknown0018;
38 /* 0x001c */    enum REF_TYPE RefType;
39 } D3D9BaseObject;
40 
41 VOID InitD3D9BaseObject(D3D9BaseObject* pBaseObject, enum REF_TYPE RefType, IUnknown* pUnknown);
42 
43 ULONG D3D9BaseObject_AddRef(D3D9BaseObject* pBaseObject);
44 ULONG D3D9BaseObject_Release(D3D9BaseObject* pBaseObject);
45 HRESULT D3D9BaseObject_GetDevice(D3D9BaseObject* pBaseObject, IDirect3DDevice9** ppDevice);
46 HRESULT D3D9BaseObject_GetDeviceInt(D3D9BaseObject* pBaseObject, struct _Direct3DDevice9_INT** ppDevice);
47 VOID D3D9BaseObject_LockDevice(D3D9BaseObject* pBaseObject);
48 VOID D3D9BaseObject_UnlockDevice(D3D9BaseObject* pBaseObject);
49 
50 #endif // _D3D9_BASEOBJECT_H_
51