Added stubs and vtable for IDirect3D9 implementation
authorGregor Brunmar <gbrunmar.ros@gmail.com>
Wed, 19 Dec 2007 17:41:05 +0000 (17:41 +0000)
committerGregor Brunmar <gbrunmar.ros@gmail.com>
Wed, 19 Dec 2007 17:41:05 +0000 (17:41 +0000)
svn path=/trunk/; revision=31330

reactos/dll/directx/d3d9/d3d9.rbuild
reactos/dll/directx/d3d9/d3d9_impl.c [new file with mode: 0644]
reactos/dll/directx/d3d9/d3d9_private.h

index 25cc713..a456871 100644 (file)
@@ -8,5 +8,6 @@
 \r
        <file>d3d9.c</file>\r
        <file>d3d9_helpers.c</file>\r
+       <file>d3d9_impl.c</file>\r
        <file>d3d9.rc</file>\r
 </module>\r
diff --git a/reactos/dll/directx/d3d9/d3d9_impl.c b/reactos/dll/directx/d3d9/d3d9_impl.c
new file mode 100644 (file)
index 0000000..b15d196
--- /dev/null
@@ -0,0 +1,178 @@
+/*
+ * COPYRIGHT:       See COPYING in the top level directory
+ * PROJECT:         ReactOS ReactX
+ * FILE:            dll/directx/d3d9/d3d9_impl.c
+ * PURPOSE:         IDirect3D9 implementation
+ * PROGRAMERS:      Gregor Brunmar <gregor (dot) brunmar (at) home (dot) se>
+ */
+#include "d3d9_private.h"
+
+#include <debug.h>
+
+/* IDirect3D9: IUnknown implementation */
+static HRESULT WINAPI IDirect3D9Impl_QueryInterface(LPDIRECT3D9 iface, REFIID riid, LPVOID* ppobj)
+{
+    UNIMPLEMENTED
+
+    return E_NOINTERFACE;
+}
+
+static ULONG WINAPI IDirect3D9Impl_AddRef(LPDIRECT3D9 iface)
+{
+    LPDIRECTD3D9_INT This = (LPDIRECTD3D9_INT)iface;
+    ULONG ref = InterlockedIncrement(&This->dwRefCnt);
+
+    return ref;
+}
+
+static ULONG WINAPI IDirect3D9Impl_Release(LPDIRECT3D9 iface)
+{
+    LPDIRECTD3D9_INT This = (LPDIRECTD3D9_INT)iface;
+    ULONG ref = InterlockedDecrement(&This->dwRefCnt);
+
+    if (ref == 0)
+    {
+        EnterCriticalSection(&This->d3d9_cs);
+        /* TODO: Free resources here */
+        LeaveCriticalSection(&This->d3d9_cs);
+        HeapFree(GetProcessHeap(), 0, This);
+    }
+
+    return ref;
+}
+
+/* IDirect3D9 interface */
+static HRESULT WINAPI IDirect3D9Impl_RegisterSoftwareDevice(LPDIRECT3D9 iface, void* pInitializeFunction)
+{
+    UNIMPLEMENTED
+
+    return D3D_OK;
+}
+
+static UINT WINAPI IDirect3D9Impl_GetAdapterCount(LPDIRECT3D9 iface)
+{
+    UNIMPLEMENTED
+
+    return D3D_OK;
+}
+
+static HRESULT WINAPI IDirect3D9Impl_GetAdapterIdentifier(LPDIRECT3D9 iface, UINT Adapter, DWORD Flags,
+                                                          D3DADAPTER_IDENTIFIER9* pIdentifier)
+{
+    UNIMPLEMENTED
+
+    return D3D_OK;
+}
+
+static UINT WINAPI IDirect3D9Impl_GetAdapterModeCount(LPDIRECT3D9 iface, UINT Adapter, D3DFORMAT Format)
+{
+    UNIMPLEMENTED
+
+    return D3D_OK;
+}
+
+static HRESULT WINAPI IDirect3D9Impl_EnumAdapterModes(LPDIRECT3D9 iface, UINT Adapter, D3DFORMAT Format,
+                                                      UINT Mode, D3DDISPLAYMODE* pMode)
+{
+    UNIMPLEMENTED
+
+    return D3D_OK;
+}
+
+static HRESULT WINAPI IDirect3D9Impl_GetAdapterDisplayMode(LPDIRECT3D9 iface, UINT Adapter, D3DDISPLAYMODE* pMode)
+{
+    UNIMPLEMENTED
+
+    return D3D_OK;
+}
+
+static HRESULT WINAPI IDirect3D9Impl_CheckDeviceType(LPDIRECT3D9 iface, UINT Adapter, D3DDEVTYPE CheckType,
+                                                     D3DFORMAT DisplayFormat, D3DFORMAT BackBufferFormat, BOOL Windowed)
+{
+    UNIMPLEMENTED
+
+    return D3D_OK;
+}
+
+static HRESULT WINAPI IDirect3D9Impl_CheckDeviceFormat(LPDIRECT3D9 iface, UINT Adapter, D3DDEVTYPE DeviceType,
+                                                       D3DFORMAT AdapterFormat, DWORD Usage, D3DRESOURCETYPE RType,
+                                                       D3DFORMAT CheckFormat)
+{
+    UNIMPLEMENTED
+
+    return D3D_OK;
+}
+
+static HRESULT WINAPI IDirect3D9Impl_CheckDeviceMultiSampleType(LPDIRECT3D9 iface, UINT Adapter, D3DDEVTYPE DeviceType,
+                                                                D3DFORMAT SurfaceFormat, BOOL Windowed,
+                                                                D3DMULTISAMPLE_TYPE MultiSampleType, DWORD* pQualityLevels)
+{
+    UNIMPLEMENTED
+
+    return D3D_OK;
+}
+
+static HRESULT WINAPI IDirect3D9Impl_CheckDepthStencilMatch(LPDIRECT3D9 iface, UINT Adapter, D3DDEVTYPE DeviceType,
+                                                            D3DFORMAT AdapterFormat, D3DFORMAT RenderTargetFormat,
+                                                            D3DFORMAT DepthStencilFormat)
+{
+    UNIMPLEMENTED
+
+    return D3D_OK;
+}
+
+static HRESULT WINAPI IDirect3D9Impl_CheckDeviceFormatConversion(LPDIRECT3D9 iface, UINT Adapter, D3DDEVTYPE DeviceType,
+                                                                 D3DFORMAT SourceFormat, D3DFORMAT TargetFormat)
+{
+    UNIMPLEMENTED
+
+    return D3D_OK;
+}
+
+static HRESULT WINAPI IDirect3D9Impl_GetDeviceCaps(LPDIRECT3D9 iface, UINT Adapter, D3DDEVTYPE DeviceType, D3DCAPS9* pCaps)
+{
+    UNIMPLEMENTED
+
+    return D3D_OK;
+}
+
+static HMONITOR WINAPI IDirect3D9Impl_GetAdapterMonitor(LPDIRECT3D9 iface, UINT Adapter)
+{
+    UNIMPLEMENTED
+
+    return D3D_OK;
+}
+
+static HRESULT WINAPI IDirect3D9Impl_CreateDevice(LPDIRECT3D9 iface, UINT Adapter, D3DDEVTYPE DeviceType,
+                                                  HWND hFocusWindow, DWORD BehaviourFlags,
+                                                  D3DPRESENT_PARAMETERS* pPresentationParameters,
+                                                  IDirect3DDevice9** ppReturnedDeviceInterface)
+{
+    UNIMPLEMENTED
+
+    return D3D_OK;
+}
+
+const IDirect3D9Vtbl Direct3D9_Vtbl =
+{
+    /* IUnknown */
+    IDirect3D9Impl_QueryInterface,
+    IDirect3D9Impl_AddRef,
+    IDirect3D9Impl_Release,
+
+    /* IDirect3D9 */
+    IDirect3D9Impl_RegisterSoftwareDevice,
+    IDirect3D9Impl_GetAdapterCount,
+    IDirect3D9Impl_GetAdapterIdentifier,
+    IDirect3D9Impl_GetAdapterModeCount,
+    IDirect3D9Impl_EnumAdapterModes,
+    IDirect3D9Impl_GetAdapterDisplayMode,
+    IDirect3D9Impl_CheckDeviceType,
+    IDirect3D9Impl_CheckDeviceFormat,
+    IDirect3D9Impl_CheckDeviceMultiSampleType,
+    IDirect3D9Impl_CheckDepthStencilMatch,
+    IDirect3D9Impl_CheckDeviceFormatConversion,
+    IDirect3D9Impl_GetDeviceCaps,
+    IDirect3D9Impl_GetAdapterMonitor,
+    IDirect3D9Impl_CreateDevice
+};
index 06b5c3e..24789de 100644 (file)
@@ -20,7 +20,7 @@ typedef struct _tagDIRECTD3D9_INT_
 /* 0x001c */    DWORD unknown000007;  /* 0x00000001 */
 /* 0x0020 */    DWORD dwProcessId; 
 /* 0x0024 */    struct _tagDIRECTD3D9_INT_ * lpInt; 
-/* 0x0028 */    DWORD dwIntRefCnt;      /* Increases and decreases by AddRef() and Release() */
+/* 0x0028 */    volatile LONG dwRefCnt; /* Increases and decreases by AddRef() and Release() */
 /* 0x002c */    DWORD unknown000011;    /* 0x00000001 - Probably AdapterIndex */
 /* 0x0030 */    GUID DisplayGuid;       /*? Always {67685559-3106-11D0-B971-00AA00342F9F} ? */
 /* 0x0040 */    CHAR DeviceName[16];