Author: gbrunmar
Date: Sun May 4 10:02:01 2008
New Revision: 33271
URL:
http://svn.reactos.org/svn/reactos?rev=33271&view=rev
Log:
* Implemented IDirect3D9::GetNumberOfSwapChains()
Modified:
trunk/reactos/dll/directx/d3d9/d3d9_device.c
trunk/reactos/dll/directx/d3d9/d3d9_device.h
Modified: trunk/reactos/dll/directx/d3d9/d3d9_device.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/d3d9/d3d9_devi…
==============================================================================
--- trunk/reactos/dll/directx/d3d9/d3d9_device.c [iso-8859-1] (original)
+++ trunk/reactos/dll/directx/d3d9/d3d9_device.c [iso-8859-1] Sun May 4 10:02:01 2008
@@ -9,8 +9,8 @@
#include "d3d9_helpers.h"
#include "debug.h"
-#define LOCK_D3DDEVICE9() EnterCriticalSection(&This->CriticalSection);
-#define UNLOCK_D3DDEVICE9() LeaveCriticalSection(&This->CriticalSection);
+#define LOCK_D3DDEVICE9() if (This->bLockDevice)
EnterCriticalSection(&This->CriticalSection);
+#define UNLOCK_D3DDEVICE9() if (This->bLockDevice)
LeaveCriticalSection(&This->CriticalSection);
/* Convert a IDirect3D9 pointer safely to the internal implementation struct */
LPDIRECT3DDEVICE9_INT impl_from_IDirect3DDevice9(LPDIRECT3DDEVICE9 iface)
@@ -144,10 +144,10 @@
* The function IDirect3DDevice9Impl_GetSwapChain returns a pointer to a swap chain
object.
*
* @param LPDIRECT3D iface
-* Pointer to the IDirect3DDevice9 object returned from IDirect3D9->CreateDevice()
+* Pointer to the IDirect3DDevice9 object returned from IDirect3D9::CreateDevice()
*
* @param UINT iSwapChain
-* Swap chain index to get.
+* Swap chain index to get object for.
* The maximum value for this is the value returned by
IDirect3DDevice9::GetNumberOfSwapChains() - 1.
*
* @param IDirect3DSwapChain9** ppSwapChain
@@ -180,7 +180,7 @@
if (This->pSwapChains[iSwapChain] != NULL)
{
- IDirect3DSwapChain9* pSwapChain =
(IDirect3DSwapChain9*)This->pSwapChains[iSwapChain]->lpVtbl;
+ IDirect3DSwapChain9* pSwapChain =
(IDirect3DSwapChain9*)&This->pSwapChains[iSwapChain]->lpVtbl;
IDirect3DSwapChain9_AddRef(pSwapChain);
*ppSwapChain = pSwapChain;
}
@@ -193,11 +193,34 @@
return D3D_OK;
}
+/*++
+* @name IDirect3DDevice9::GetNumberOfSwapChains
+* @implemented
+*
+* The function IDirect3DDevice9Impl_GetNumberOfSwapChains returns the number of swap
chains
+* created by IDirect3D9::CreateDevice().
+*
+* @param LPDIRECT3D iface
+* Pointer to the IDirect3DDevice9 object returned from IDirect3D9::CreateDevice().
+*
+* @return UINT
+* Returns the number of swap chains created by IDirect3D9::CreateDevice().
+*
+* NOTE: An application can create additional swap chains using the
+* IDirect3DDevice9::CreateAdditionalSwapChain() method.
+*
+*/
static UINT WINAPI IDirect3DDevice9Impl_GetNumberOfSwapChains(LPDIRECT3DDEVICE9 iface)
{
- UNIMPLEMENTED
-
- return D3D_OK;
+ UINT NumSwapChains;
+
+ LPDIRECT3DDEVICE9_INT This = impl_from_IDirect3DDevice9(iface);
+ LOCK_D3DDEVICE9();
+
+ NumSwapChains = This->NumAdaptersInDevice;
+
+ UNLOCK_D3DDEVICE9();
+ return NumSwapChains;
}
static HRESULT WINAPI IDirect3DDevice9Impl_Reset(LPDIRECT3DDEVICE9 iface,
D3DPRESENT_PARAMETERS* pPresentationParameters)
Modified: trunk/reactos/dll/directx/d3d9/d3d9_device.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/d3d9/d3d9_devi…
==============================================================================
--- trunk/reactos/dll/directx/d3d9/d3d9_device.h [iso-8859-1] (original)
+++ trunk/reactos/dll/directx/d3d9/d3d9_device.h [iso-8859-1] Sun May 4 10:02:01 2008
@@ -12,6 +12,8 @@
#include <d3d9.h>
#include "d3d9_private.h"
+extern struct IDirect3DDevice9Vtbl Direct3DDevice9_Vtbl;
+
enum REF_TYPE
{
RT_EXTERNAL,
@@ -24,7 +26,7 @@
/* 0x0000 */ LPDWORD lpVtbl;
/* 0x0004 */ DWORD dwUnknown0004;
/* 0x0008 */ DWORD dwUnknown0008;
-/* 0x000c */ struct _tagD3D9BaseDevice_* pBaseDevice;
+/* 0x000c */ struct _tagDirect3DDevice9_INT_* pBaseDevice;
/* 0x0010 */ DWORD dwUnknown0010; // Index? Unique id?
/* 0x0014 */ HANDLE hKernelHandle;
/* 0x0018 */ LPDWORD dwUnknown0018;
@@ -77,7 +79,7 @@
#ifdef D3D_DEBUG_INFO
/* N/A - 0x0000 */ DDSURFACEDESC SurfaceDesc[8];
#endif
-/* 0x0000 - 0x0160 */ struct _tagD3D9BaseDevice_* pBaseDevice;
+/* 0x0000 - 0x0160 */ struct _tagDirect3DDevice9_INT_* pBaseDevice;
/* 0x0004 - 0x0164 */ DWORD dwUnknown0004;
/* 0x0008 - 0x0168 */ DWORD dwUnknown0008;
/* 0x000c - 0x016c */ DWORD MaxSimultaneousTextures;
@@ -144,7 +146,7 @@
/* 0x00ec */ DWORD dwUnknown00ec;
/* 0x00f0 */ DWORD dwUnknown00f0[27];
-/* 0x015c */ LPDWORD pUnknown0174; // points to 0x0174
+/* 0x015c */ LPDWORD pUnknown015c;
/* 0x0160 */ DWORD dwUnknown0160[4];
/* 0x0170 */ HRESULT hResult;
@@ -162,7 +164,7 @@
typedef struct _tagDirect3DDevice9_INT_
{
-/* 0x0000 */ struct IDirect3D9DeviceVtbl* lpVtbl;
+/* 0x0000 */ struct IDirect3DDevice9Vtbl* lpVtbl;
/* 0x0004 */ CRITICAL_SECTION CriticalSection;
#ifdef D3D_DEBUG_INFO
/* N/A - 0x001c */ DWORD dbg0004;
@@ -180,7 +182,7 @@
/* N/A - 0x004c */ DWORD dbg0034;
/* N/A - 0x0050 */ DWORD dbg0038;
#endif
-/* 0x001c - 0x0054 */ DWORD unknown000007;
+/* 0x001c - 0x0054 */ BOOL bLockDevice;
/* 0x0020 - 0x0058 */ DWORD dwProcessId;
/* 0x0024 - 0x005c */ struct _tagD3D9PUREDEVICE_* lpThis;
/* 0x0028 - 0x0060 */ DWORD dwDXVersion;