2008-05-04 11:48:06 +00:00
|
|
|
/*
|
|
|
|
* COPYRIGHT: See COPYING in the top level directory
|
|
|
|
* PROJECT: ReactOS ReactX
|
|
|
|
* FILE: dll/directx/d3d9/d3d9_device.c
|
|
|
|
* PURPOSE: d3d9.dll internal device methods
|
|
|
|
* PROGRAMERS: Gregor Brunmar <gregor (dot) brunmar (at) home (dot) se>
|
|
|
|
*/
|
|
|
|
#include "d3d9_device.h"
|
|
|
|
#include "d3d9_helpers.h"
|
2008-05-05 15:58:23 +00:00
|
|
|
#include "adapter.h"
|
2008-08-23 17:24:27 +00:00
|
|
|
#include <debug.h>
|
|
|
|
#include "d3d9_create.h"
|
2008-09-16 19:21:02 +00:00
|
|
|
#include "d3d9_mipmap.h"
|
2008-05-04 11:48:06 +00:00
|
|
|
|
2008-05-04 15:02:01 +00:00
|
|
|
#define LOCK_D3DDEVICE9() if (This->bLockDevice) EnterCriticalSection(&This->CriticalSection);
|
|
|
|
#define UNLOCK_D3DDEVICE9() if (This->bLockDevice) LeaveCriticalSection(&This->CriticalSection);
|
2008-05-04 11:48:06 +00:00
|
|
|
|
|
|
|
/* Convert a IDirect3D9 pointer safely to the internal implementation struct */
|
2008-09-01 18:32:57 +00:00
|
|
|
LPDIRECT3DDEVICE9_INT IDirect3DDevice9ToImpl(LPDIRECT3DDEVICE9 iface)
|
2008-05-04 11:48:06 +00:00
|
|
|
{
|
2008-08-31 11:36:55 +00:00
|
|
|
if (NULL == iface)
|
2008-05-04 11:48:06 +00:00
|
|
|
return NULL;
|
|
|
|
|
|
|
|
return (LPDIRECT3DDEVICE9_INT)((ULONG_PTR)iface - FIELD_OFFSET(DIRECT3DDEVICE9_INT, lpVtbl));
|
|
|
|
}
|
|
|
|
|
2008-09-16 19:21:02 +00:00
|
|
|
static HRESULT InvalidCall(LPDIRECT3DDEVICE9_INT This, LPSTR ErrorMsg)
|
|
|
|
{
|
|
|
|
DPRINT1(ErrorMsg);
|
|
|
|
UNLOCK_D3DDEVICE9();
|
|
|
|
return D3DERR_INVALIDCALL;
|
|
|
|
}
|
|
|
|
|
2008-05-04 11:48:06 +00:00
|
|
|
/* IDirect3DDevice9: IUnknown implementation */
|
2008-08-31 11:36:55 +00:00
|
|
|
HRESULT WINAPI IDirect3DDevice9Base_QueryInterface(LPDIRECT3DDEVICE9 iface, REFIID riid, void** ppvObject)
|
2008-05-04 11:48:06 +00:00
|
|
|
{
|
2008-08-31 11:36:55 +00:00
|
|
|
LPDIRECT3DDEVICE9_INT This = IDirect3DDevice9ToImpl(iface);
|
2008-05-04 11:48:06 +00:00
|
|
|
|
|
|
|
if (IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IDirect3DDevice9))
|
|
|
|
{
|
|
|
|
IUnknown_AddRef(iface);
|
|
|
|
*ppvObject = &This->lpVtbl;
|
2008-05-04 12:47:57 +00:00
|
|
|
return D3D_OK;
|
2008-05-04 11:48:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
*ppvObject = NULL;
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
2008-08-31 11:36:55 +00:00
|
|
|
ULONG WINAPI IDirect3DDevice9Base_AddRef(LPDIRECT3DDEVICE9 iface)
|
2008-05-04 11:48:06 +00:00
|
|
|
{
|
2008-08-31 11:36:55 +00:00
|
|
|
LPDIRECT3DDEVICE9_INT This = IDirect3DDevice9ToImpl(iface);
|
2008-05-04 11:48:06 +00:00
|
|
|
ULONG ref = InterlockedIncrement(&This->lRefCnt);
|
|
|
|
|
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
2008-08-31 11:36:55 +00:00
|
|
|
ULONG WINAPI IDirect3DDevice9Base_Release(LPDIRECT3DDEVICE9 iface)
|
2008-05-04 11:48:06 +00:00
|
|
|
{
|
2008-08-31 11:36:55 +00:00
|
|
|
LPDIRECT3DDEVICE9_INT This = IDirect3DDevice9ToImpl(iface);
|
2008-05-04 11:48:06 +00:00
|
|
|
ULONG ref = InterlockedDecrement(&This->lRefCnt);
|
|
|
|
|
|
|
|
if (ref == 0)
|
|
|
|
{
|
2008-08-23 17:24:27 +00:00
|
|
|
DWORD iAdapter;
|
|
|
|
|
2008-05-04 11:48:06 +00:00
|
|
|
EnterCriticalSection(&This->CriticalSection);
|
2008-08-23 17:24:27 +00:00
|
|
|
|
2008-05-04 11:48:06 +00:00
|
|
|
/* TODO: Free resources here */
|
2008-08-23 17:24:27 +00:00
|
|
|
for (iAdapter = 0; iAdapter < This->NumAdaptersInDevice; iAdapter++)
|
|
|
|
{
|
|
|
|
DestroyD3D9DeviceData(&This->DeviceData[iAdapter]);
|
|
|
|
}
|
2008-09-01 18:32:57 +00:00
|
|
|
This->lpVtbl->VirtualDestructor(iface);
|
2008-08-23 17:24:27 +00:00
|
|
|
|
2008-05-04 11:48:06 +00:00
|
|
|
LeaveCriticalSection(&This->CriticalSection);
|
|
|
|
AlignedFree(This);
|
|
|
|
}
|
|
|
|
|
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
2008-09-01 18:32:57 +00:00
|
|
|
/* IDirect3DDevice9 public interface */
|
2008-08-31 11:36:55 +00:00
|
|
|
HRESULT WINAPI IDirect3DDevice9Base_TestCooperativeLevel(LPDIRECT3DDEVICE9 iface)
|
2008-05-04 11:48:06 +00:00
|
|
|
{
|
|
|
|
UNIMPLEMENTED
|
|
|
|
|
2008-05-04 12:47:57 +00:00
|
|
|
return D3D_OK;
|
2008-05-04 11:48:06 +00:00
|
|
|
}
|
|
|
|
|
2008-05-05 16:49:13 +00:00
|
|
|
/*++
|
|
|
|
* @name IDirect3DDevice9::GetAvailableTextureMem
|
|
|
|
* @implemented
|
|
|
|
*
|
2008-08-31 11:36:55 +00:00
|
|
|
* The function IDirect3DDevice9Base_GetAvailableTextureMem returns a pointer to the IDirect3D9 object
|
2008-05-05 16:49:13 +00:00
|
|
|
* that created this device.
|
|
|
|
*
|
|
|
|
* @param LPDIRECT3D iface
|
|
|
|
* Pointer to the IDirect3DDevice9 object returned from IDirect3D9::CreateDevice()
|
|
|
|
*
|
|
|
|
* @return UINT
|
|
|
|
* The method returns an estimated the currently available texture memory in bytes rounded
|
|
|
|
* to the nearest MB. Applications should NOT use this as an exact number.
|
|
|
|
*
|
|
|
|
*/
|
2008-08-31 11:36:55 +00:00
|
|
|
UINT WINAPI IDirect3DDevice9Base_GetAvailableTextureMem(LPDIRECT3DDEVICE9 iface)
|
2008-05-04 11:48:06 +00:00
|
|
|
{
|
2008-05-05 16:49:13 +00:00
|
|
|
UINT AvailableTextureMemory = 0;
|
2008-05-07 18:00:50 +00:00
|
|
|
D3D9_GETAVAILDRIVERMEMORYDATA d3d9GetAvailDriverMemoryData;
|
2008-05-04 11:48:06 +00:00
|
|
|
|
2008-08-31 11:36:55 +00:00
|
|
|
LPDIRECT3DDEVICE9_INT This = IDirect3DDevice9ToImpl(iface);
|
2008-05-05 16:49:13 +00:00
|
|
|
LOCK_D3DDEVICE9();
|
|
|
|
|
2008-05-07 18:00:50 +00:00
|
|
|
memset(&d3d9GetAvailDriverMemoryData, 0, sizeof(d3d9GetAvailDriverMemoryData));
|
|
|
|
d3d9GetAvailDriverMemoryData.pUnknown6BC = This->DeviceData[0].pUnknown6BC;
|
|
|
|
d3d9GetAvailDriverMemoryData.dwMemoryType = D3D9_GETAVAILDRIVERMEMORY_TYPE_ALL;
|
2008-05-05 16:49:13 +00:00
|
|
|
|
2008-05-07 18:00:50 +00:00
|
|
|
if (TRUE == (*This->DeviceData[0].D3D9Callbacks.DdGetAvailDriverMemory)(&d3d9GetAvailDriverMemoryData))
|
2008-05-05 16:49:13 +00:00
|
|
|
{
|
2008-05-07 18:00:50 +00:00
|
|
|
/* Round it up to the nearest MB */
|
|
|
|
AvailableTextureMemory = (d3d9GetAvailDriverMemoryData.dwFree + 0x80000) & 0xFFF00000;
|
2008-05-05 16:49:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
UNLOCK_D3DDEVICE9();
|
|
|
|
return AvailableTextureMemory;
|
2008-05-04 11:48:06 +00:00
|
|
|
}
|
|
|
|
|
2008-08-31 11:36:55 +00:00
|
|
|
HRESULT WINAPI IDirect3DDevice9Base_EvictManagedResources(LPDIRECT3DDEVICE9 iface)
|
2008-05-04 11:48:06 +00:00
|
|
|
{
|
|
|
|
UNIMPLEMENTED
|
|
|
|
|
2008-05-04 12:47:57 +00:00
|
|
|
return D3D_OK;
|
2008-05-04 11:48:06 +00:00
|
|
|
}
|
|
|
|
|
2008-05-05 15:58:23 +00:00
|
|
|
/*++
|
|
|
|
* @name IDirect3DDevice9::GetDirect3D
|
|
|
|
* @implemented
|
|
|
|
*
|
2008-08-31 11:36:55 +00:00
|
|
|
* The function IDirect3DDevice9Base_GetDirect3D returns a pointer to the IDirect3D9 object
|
2008-05-05 15:58:23 +00:00
|
|
|
* that created this device.
|
|
|
|
*
|
|
|
|
* @param LPDIRECT3D iface
|
|
|
|
* Pointer to the IDirect3DDevice9 object returned from IDirect3D9::CreateDevice()
|
|
|
|
*
|
|
|
|
* @param IDirect3D9** ppD3D9
|
|
|
|
* Pointer to a IDirect3D9* to receive the IDirect3D9 object pointer.
|
|
|
|
*
|
|
|
|
* @return HRESULT
|
|
|
|
* If the method successfully fills the ppD3D9 structure, the return value is D3D_OK.
|
|
|
|
* If ppD3D9 is a bad pointer, the return value will be D3DERR_INVALIDCALL.
|
|
|
|
*
|
|
|
|
*/
|
2008-08-31 11:36:55 +00:00
|
|
|
HRESULT WINAPI IDirect3DDevice9Base_GetDirect3D(LPDIRECT3DDEVICE9 iface, IDirect3D9** ppD3D9)
|
2008-05-04 11:48:06 +00:00
|
|
|
{
|
2008-05-05 15:58:23 +00:00
|
|
|
IDirect3D9* pDirect3D9;
|
2008-08-31 11:36:55 +00:00
|
|
|
LPDIRECT3DDEVICE9_INT This = IDirect3DDevice9ToImpl(iface);
|
2008-05-05 15:58:23 +00:00
|
|
|
LOCK_D3DDEVICE9();
|
|
|
|
|
2008-08-31 11:36:55 +00:00
|
|
|
if (NULL == ppD3D9)
|
2008-05-05 15:58:23 +00:00
|
|
|
{
|
|
|
|
DPRINT1("Invalid ppD3D9 parameter specified");
|
|
|
|
UNLOCK_D3DDEVICE9();
|
|
|
|
return D3DERR_INVALIDCALL;
|
|
|
|
}
|
|
|
|
|
|
|
|
pDirect3D9 = (IDirect3D9*)&This->pDirect3D9->lpVtbl;
|
|
|
|
IDirect3D9_AddRef(pDirect3D9);
|
|
|
|
*ppD3D9 = pDirect3D9;
|
2008-05-04 11:48:06 +00:00
|
|
|
|
2008-05-05 15:58:23 +00:00
|
|
|
UNLOCK_D3DDEVICE9();
|
2008-05-04 12:47:57 +00:00
|
|
|
return D3D_OK;
|
2008-05-04 11:48:06 +00:00
|
|
|
}
|
|
|
|
|
2008-05-05 15:58:23 +00:00
|
|
|
/*++
|
|
|
|
* @name IDirect3DDevice9::GetDeviceCaps
|
|
|
|
* @implemented
|
|
|
|
*
|
2008-08-31 11:36:55 +00:00
|
|
|
* The function IDirect3DDevice9Base_GetDeviceCaps fills the pCaps argument with the
|
2008-05-05 15:58:23 +00:00
|
|
|
* capabilities of the device.
|
|
|
|
*
|
|
|
|
* @param LPDIRECT3D iface
|
|
|
|
* Pointer to the IDirect3D9 object returned from Direct3DCreate9()
|
|
|
|
*
|
|
|
|
* @param D3DCAPS9* pCaps
|
|
|
|
* Pointer to a D3DCAPS9 structure to be filled with the device's capabilities.
|
|
|
|
*
|
|
|
|
* @return HRESULT
|
|
|
|
* If the method successfully fills the pCaps structure, the return value is D3D_OK.
|
|
|
|
* If pCaps is a bad pointer the return value will be D3DERR_INVALIDCALL.
|
|
|
|
*
|
|
|
|
*/
|
2008-08-31 11:36:55 +00:00
|
|
|
HRESULT WINAPI IDirect3DDevice9Base_GetDeviceCaps(LPDIRECT3DDEVICE9 iface, D3DCAPS9* pCaps)
|
2008-05-04 11:48:06 +00:00
|
|
|
{
|
2008-08-31 11:36:55 +00:00
|
|
|
LPDIRECT3DDEVICE9_INT This = IDirect3DDevice9ToImpl(iface);
|
2008-05-05 15:58:23 +00:00
|
|
|
LOCK_D3DDEVICE9();
|
|
|
|
|
2008-08-31 11:36:55 +00:00
|
|
|
if (NULL == pCaps)
|
2008-05-05 15:58:23 +00:00
|
|
|
{
|
|
|
|
DPRINT1("Invalid pCaps parameter specified");
|
|
|
|
UNLOCK_D3DDEVICE9();
|
|
|
|
return D3DERR_INVALIDCALL;
|
|
|
|
}
|
|
|
|
|
|
|
|
GetAdapterCaps(&This->pDirect3D9->DisplayAdapters[0], This->DeviceData[0].DeviceType, pCaps);
|
2008-05-04 11:48:06 +00:00
|
|
|
|
2008-05-05 15:58:23 +00:00
|
|
|
UNLOCK_D3DDEVICE9();
|
2008-05-04 12:47:57 +00:00
|
|
|
return D3D_OK;
|
2008-05-04 11:48:06 +00:00
|
|
|
}
|
|
|
|
|
2008-05-06 16:15:33 +00:00
|
|
|
/*++
|
|
|
|
* @name IDirect3DDevice9::GetDisplayMode
|
|
|
|
* @implemented
|
|
|
|
*
|
2008-08-31 11:36:55 +00:00
|
|
|
* The function IDirect3DDevice9Base_GetDisplayMode fills the pMode argument with the
|
2008-05-06 16:15:33 +00:00
|
|
|
* display mode for the specified swap chain.
|
|
|
|
*
|
|
|
|
* @param LPDIRECT3D iface
|
|
|
|
* Pointer to the IDirect3D9 object returned from Direct3DCreate9()
|
|
|
|
*
|
|
|
|
* @param UINT iSwapChain
|
|
|
|
* Swap chain index to get object for.
|
|
|
|
* The maximum value for this is the value returned by IDirect3DDevice9::GetNumberOfSwapChains() - 1.
|
|
|
|
*
|
|
|
|
* @param D3DDISPLAYMODE* pMode
|
|
|
|
* Pointer to a D3DDISPLAYMODE structure to be filled with the current swap chain's display mode information.
|
|
|
|
*
|
|
|
|
* @return HRESULT
|
|
|
|
* If the method successfully fills the pMode structure, the return value is D3D_OK.
|
|
|
|
* If iSwapChain is out of range or pMode is a bad pointer, the return value will be D3DERR_INVALIDCALL.
|
|
|
|
*
|
|
|
|
*/
|
2008-08-31 11:36:55 +00:00
|
|
|
HRESULT WINAPI IDirect3DDevice9Base_GetDisplayMode(LPDIRECT3DDEVICE9 iface, UINT iSwapChain, D3DDISPLAYMODE* pMode)
|
2008-05-04 11:48:06 +00:00
|
|
|
{
|
2008-08-31 11:36:55 +00:00
|
|
|
LPDIRECT3DDEVICE9_INT This = IDirect3DDevice9ToImpl(iface);
|
2008-05-06 16:15:33 +00:00
|
|
|
LOCK_D3DDEVICE9();
|
2008-05-04 11:48:06 +00:00
|
|
|
|
2008-05-06 16:15:33 +00:00
|
|
|
if (iSwapChain >= IDirect3DDevice9_GetNumberOfSwapChains(iface))
|
|
|
|
{
|
|
|
|
DPRINT1("Invalid iSwapChain parameter specified");
|
|
|
|
UNLOCK_D3DDEVICE9();
|
|
|
|
return D3DERR_INVALIDCALL;
|
|
|
|
}
|
|
|
|
|
2008-08-31 11:36:55 +00:00
|
|
|
if (NULL == pMode)
|
2008-05-06 16:15:33 +00:00
|
|
|
{
|
|
|
|
DPRINT1("Invalid pMode parameter specified");
|
|
|
|
UNLOCK_D3DDEVICE9();
|
|
|
|
return D3DERR_INVALIDCALL;
|
|
|
|
}
|
|
|
|
|
|
|
|
pMode->Width = This->DeviceData[iSwapChain].DriverCaps.dwDisplayWidth;
|
|
|
|
pMode->Height = This->DeviceData[iSwapChain].DriverCaps.dwDisplayHeight;
|
|
|
|
pMode->Format = This->DeviceData[iSwapChain].DriverCaps.RawDisplayFormat;
|
|
|
|
pMode->RefreshRate = This->DeviceData[iSwapChain].DriverCaps.dwRefreshRate;
|
|
|
|
|
|
|
|
UNLOCK_D3DDEVICE9();
|
2008-05-04 12:47:57 +00:00
|
|
|
return D3D_OK;
|
2008-05-04 11:48:06 +00:00
|
|
|
}
|
|
|
|
|
2008-05-07 18:23:46 +00:00
|
|
|
/*++
|
|
|
|
* @name IDirect3DDevice9::GetCreationParameters
|
|
|
|
* @implemented
|
|
|
|
*
|
2008-08-31 11:36:55 +00:00
|
|
|
* The function IDirect3DDevice9Base_GetCreationParameters fills the pParameters argument with the
|
2008-05-07 18:23:46 +00:00
|
|
|
* parameters the device was created with.
|
|
|
|
*
|
|
|
|
* @param LPDIRECT3D iface
|
|
|
|
* Pointer to the IDirect3D9 object returned from Direct3DCreate9()
|
|
|
|
*
|
|
|
|
* @param D3DDEVICE_CREATION_PARAMETERS* pParameters
|
|
|
|
* Pointer to a D3DDEVICE_CREATION_PARAMETERS structure to be filled with the creation parameter
|
|
|
|
* information for this device.
|
|
|
|
*
|
|
|
|
* @return HRESULT
|
|
|
|
* If the method successfully fills the pParameters structure, the return value is D3D_OK.
|
|
|
|
* If pParameters is a bad pointer, the return value will be D3DERR_INVALIDCALL.
|
|
|
|
*
|
|
|
|
*/
|
2008-08-31 11:36:55 +00:00
|
|
|
HRESULT WINAPI IDirect3DDevice9Base_GetCreationParameters(LPDIRECT3DDEVICE9 iface, D3DDEVICE_CREATION_PARAMETERS* pParameters)
|
2008-05-04 11:48:06 +00:00
|
|
|
{
|
2008-08-31 11:36:55 +00:00
|
|
|
LPDIRECT3DDEVICE9_INT This = IDirect3DDevice9ToImpl(iface);
|
2008-05-07 18:23:46 +00:00
|
|
|
LOCK_D3DDEVICE9();
|
|
|
|
|
2008-08-31 11:36:55 +00:00
|
|
|
if (NULL == pParameters)
|
2008-05-07 18:23:46 +00:00
|
|
|
{
|
|
|
|
DPRINT1("Invalid pParameters parameter specified");
|
|
|
|
UNLOCK_D3DDEVICE9();
|
|
|
|
return D3DERR_INVALIDCALL;
|
|
|
|
}
|
2008-05-04 11:48:06 +00:00
|
|
|
|
2008-05-07 18:23:46 +00:00
|
|
|
pParameters->AdapterOrdinal = This->AdapterIndexInGroup[0];
|
|
|
|
pParameters->DeviceType = This->DeviceType;
|
|
|
|
pParameters->hFocusWindow = This->hWnd;
|
|
|
|
pParameters->BehaviorFlags = This->BehaviourFlags;
|
|
|
|
|
|
|
|
UNLOCK_D3DDEVICE9();
|
2008-05-04 12:47:57 +00:00
|
|
|
return D3D_OK;
|
2008-05-04 11:48:06 +00:00
|
|
|
}
|
|
|
|
|
2008-08-31 11:36:55 +00:00
|
|
|
HRESULT WINAPI IDirect3DDevice9Base_SetCursorProperties(LPDIRECT3DDEVICE9 iface, UINT XHotSpot, UINT YHotSpot, IDirect3DSurface9* pCursorBitmap)
|
2008-05-04 11:48:06 +00:00
|
|
|
{
|
|
|
|
UNIMPLEMENTED
|
|
|
|
|
2008-05-04 12:47:57 +00:00
|
|
|
return D3D_OK;
|
2008-05-04 11:48:06 +00:00
|
|
|
}
|
|
|
|
|
2008-08-31 11:36:55 +00:00
|
|
|
VOID WINAPI IDirect3DDevice9Base_SetCursorPosition(LPDIRECT3DDEVICE9 iface, int X, int Y, DWORD Flags)
|
2008-05-04 11:48:06 +00:00
|
|
|
{
|
|
|
|
UNIMPLEMENTED
|
|
|
|
}
|
|
|
|
|
2008-08-31 11:36:55 +00:00
|
|
|
BOOL WINAPI IDirect3DDevice9Base_ShowCursor(LPDIRECT3DDEVICE9 iface, BOOL bShow)
|
2008-05-04 11:48:06 +00:00
|
|
|
{
|
|
|
|
UNIMPLEMENTED
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2008-08-31 11:36:55 +00:00
|
|
|
HRESULT WINAPI IDirect3DDevice9Base_CreateAdditionalSwapChain(LPDIRECT3DDEVICE9 iface, D3DPRESENT_PARAMETERS* pPresentationParameters, IDirect3DSwapChain9** ppSwapChain)
|
2008-05-04 11:48:06 +00:00
|
|
|
{
|
|
|
|
UNIMPLEMENTED
|
|
|
|
|
2008-05-04 12:47:57 +00:00
|
|
|
return D3D_OK;
|
2008-05-04 11:48:06 +00:00
|
|
|
}
|
|
|
|
|
2008-05-04 12:47:57 +00:00
|
|
|
/*++
|
|
|
|
* @name IDirect3DDevice9::GetSwapChain
|
|
|
|
* @implemented
|
|
|
|
*
|
2008-08-31 11:36:55 +00:00
|
|
|
* The function IDirect3DDevice9Base_GetSwapChain returns a pointer to a swap chain object.
|
2008-05-04 12:47:57 +00:00
|
|
|
*
|
|
|
|
* @param LPDIRECT3D iface
|
2008-05-04 15:02:01 +00:00
|
|
|
* Pointer to the IDirect3DDevice9 object returned from IDirect3D9::CreateDevice()
|
2008-05-04 12:47:57 +00:00
|
|
|
*
|
|
|
|
* @param UINT iSwapChain
|
2008-05-04 15:02:01 +00:00
|
|
|
* Swap chain index to get object for.
|
2008-05-04 12:47:57 +00:00
|
|
|
* The maximum value for this is the value returned by IDirect3DDevice9::GetNumberOfSwapChains() - 1.
|
|
|
|
*
|
|
|
|
* @param IDirect3DSwapChain9** ppSwapChain
|
|
|
|
* Pointer to a IDirect3DSwapChain9* to receive the swap chain object pointer.
|
|
|
|
*
|
|
|
|
* @return HRESULT
|
|
|
|
* If the method successfully fills the ppSwapChain structure, the return value is D3D_OK.
|
|
|
|
* If iSwapChain is out of range or ppSwapChain is a bad pointer, the return value
|
|
|
|
* will be D3DERR_INVALIDCALL.
|
|
|
|
*
|
|
|
|
*/
|
2008-08-31 11:36:55 +00:00
|
|
|
HRESULT WINAPI IDirect3DDevice9Base_GetSwapChain(LPDIRECT3DDEVICE9 iface, UINT iSwapChain, IDirect3DSwapChain9** ppSwapChain)
|
2008-05-04 11:48:06 +00:00
|
|
|
{
|
2008-08-31 11:36:55 +00:00
|
|
|
LPDIRECT3DDEVICE9_INT This = IDirect3DDevice9ToImpl(iface);
|
2008-05-04 12:47:57 +00:00
|
|
|
LOCK_D3DDEVICE9();
|
|
|
|
|
2008-08-31 11:36:55 +00:00
|
|
|
if (NULL == ppSwapChain)
|
2008-05-04 12:47:57 +00:00
|
|
|
{
|
2008-08-24 11:18:30 +00:00
|
|
|
DPRINT1("Invalid ppSwapChain parameter specified");
|
2008-05-04 12:47:57 +00:00
|
|
|
UNLOCK_D3DDEVICE9();
|
|
|
|
return D3DERR_INVALIDCALL;
|
|
|
|
}
|
|
|
|
|
2008-08-24 11:18:30 +00:00
|
|
|
*ppSwapChain = NULL;
|
|
|
|
|
|
|
|
if (iSwapChain >= IDirect3DDevice9_GetNumberOfSwapChains(iface))
|
2008-05-04 12:47:57 +00:00
|
|
|
{
|
2008-08-24 11:18:30 +00:00
|
|
|
DPRINT1("Invalid iSwapChain parameter specified");
|
2008-05-04 12:47:57 +00:00
|
|
|
UNLOCK_D3DDEVICE9();
|
|
|
|
return D3DERR_INVALIDCALL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (This->pSwapChains[iSwapChain] != NULL)
|
|
|
|
{
|
2008-05-04 15:02:01 +00:00
|
|
|
IDirect3DSwapChain9* pSwapChain = (IDirect3DSwapChain9*)&This->pSwapChains[iSwapChain]->lpVtbl;
|
2008-05-04 12:47:57 +00:00
|
|
|
IDirect3DSwapChain9_AddRef(pSwapChain);
|
|
|
|
*ppSwapChain = pSwapChain;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
*ppSwapChain = NULL;
|
|
|
|
}
|
2008-05-04 11:48:06 +00:00
|
|
|
|
2008-05-04 12:47:57 +00:00
|
|
|
UNLOCK_D3DDEVICE9();
|
|
|
|
return D3D_OK;
|
2008-05-04 11:48:06 +00:00
|
|
|
}
|
|
|
|
|
2008-05-04 15:02:01 +00:00
|
|
|
/*++
|
|
|
|
* @name IDirect3DDevice9::GetNumberOfSwapChains
|
|
|
|
* @implemented
|
|
|
|
*
|
2008-08-31 11:36:55 +00:00
|
|
|
* The function IDirect3DDevice9Base_GetNumberOfSwapChains returns the number of swap chains
|
2008-05-04 15:02:01 +00:00
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
*/
|
2008-08-31 11:36:55 +00:00
|
|
|
UINT WINAPI IDirect3DDevice9Base_GetNumberOfSwapChains(LPDIRECT3DDEVICE9 iface)
|
2008-05-04 11:48:06 +00:00
|
|
|
{
|
2008-05-04 15:02:01 +00:00
|
|
|
UINT NumSwapChains;
|
2008-05-04 11:48:06 +00:00
|
|
|
|
2008-08-31 11:36:55 +00:00
|
|
|
LPDIRECT3DDEVICE9_INT This = IDirect3DDevice9ToImpl(iface);
|
2008-05-04 15:02:01 +00:00
|
|
|
LOCK_D3DDEVICE9();
|
|
|
|
|
|
|
|
NumSwapChains = This->NumAdaptersInDevice;
|
|
|
|
|
|
|
|
UNLOCK_D3DDEVICE9();
|
|
|
|
return NumSwapChains;
|
2008-05-04 11:48:06 +00:00
|
|
|
}
|
|
|
|
|
2008-08-31 11:36:55 +00:00
|
|
|
HRESULT WINAPI IDirect3DDevice9Base_Reset(LPDIRECT3DDEVICE9 iface, D3DPRESENT_PARAMETERS* pPresentationParameters)
|
2008-05-04 11:48:06 +00:00
|
|
|
{
|
|
|
|
UNIMPLEMENTED
|
|
|
|
|
2008-05-04 12:47:57 +00:00
|
|
|
return D3D_OK;
|
2008-05-04 11:48:06 +00:00
|
|
|
}
|
|
|
|
|
2008-08-31 11:36:55 +00:00
|
|
|
HRESULT WINAPI IDirect3DDevice9Base_Present(LPDIRECT3DDEVICE9 iface, CONST RECT* pSourceRect, CONST RECT* pDestRect, HWND hDestWindowOverride, CONST RGNDATA* pDirtyRegion)
|
2008-05-04 11:48:06 +00:00
|
|
|
{
|
|
|
|
UNIMPLEMENTED
|
|
|
|
|
2008-05-04 12:47:57 +00:00
|
|
|
return D3D_OK;
|
2008-05-04 11:48:06 +00:00
|
|
|
}
|
|
|
|
|
2008-08-31 11:36:55 +00:00
|
|
|
HRESULT WINAPI IDirect3DDevice9Base_GetBackBuffer(LPDIRECT3DDEVICE9 iface, UINT iSwapChain, UINT iBackBuffer, D3DBACKBUFFER_TYPE Type, IDirect3DSurface9** ppBackBuffer)
|
2008-05-04 11:48:06 +00:00
|
|
|
{
|
|
|
|
UNIMPLEMENTED
|
|
|
|
|
2008-05-04 12:47:57 +00:00
|
|
|
return D3D_OK;
|
2008-05-04 11:48:06 +00:00
|
|
|
}
|
|
|
|
|
2008-08-31 11:36:55 +00:00
|
|
|
HRESULT WINAPI IDirect3DDevice9Base_GetRasterStatus(LPDIRECT3DDEVICE9 iface, UINT iSwapChain, D3DRASTER_STATUS* pRasterStatus)
|
2008-05-04 11:48:06 +00:00
|
|
|
{
|
|
|
|
UNIMPLEMENTED
|
|
|
|
|
2008-05-04 12:47:57 +00:00
|
|
|
return D3D_OK;
|
2008-05-04 11:48:06 +00:00
|
|
|
}
|
|
|
|
|
2008-08-31 11:36:55 +00:00
|
|
|
HRESULT WINAPI IDirect3DDevice9Base_SetDialogBoxMode(LPDIRECT3DDEVICE9 iface, BOOL bEnableDialogs)
|
2008-05-04 11:48:06 +00:00
|
|
|
{
|
|
|
|
UNIMPLEMENTED
|
|
|
|
|
2008-05-04 12:47:57 +00:00
|
|
|
return D3D_OK;
|
2008-05-04 11:48:06 +00:00
|
|
|
}
|
|
|
|
|
2008-08-31 11:36:55 +00:00
|
|
|
VOID WINAPI IDirect3DDevice9Base_SetGammaRamp(LPDIRECT3DDEVICE9 iface, UINT iSwapChain, DWORD Flags, CONST D3DGAMMARAMP* pRamp)
|
2008-05-04 11:48:06 +00:00
|
|
|
{
|
|
|
|
UNIMPLEMENTED
|
|
|
|
}
|
|
|
|
|
2008-08-31 11:36:55 +00:00
|
|
|
VOID WINAPI IDirect3DDevice9Base_GetGammaRamp(LPDIRECT3DDEVICE9 iface, UINT iSwapChain, D3DGAMMARAMP* pRamp)
|
2008-05-04 11:48:06 +00:00
|
|
|
{
|
|
|
|
UNIMPLEMENTED
|
|
|
|
}
|
|
|
|
|
2008-09-16 19:21:02 +00:00
|
|
|
/*++
|
|
|
|
* @name IDirect3DDevice9::CreateTexture
|
|
|
|
* @implemented
|
|
|
|
*
|
|
|
|
* The function IDirect3DDevice9Base_CreateTexture creates a D3D9 texture.
|
|
|
|
*
|
|
|
|
* @param LPDIRECT3D iface
|
|
|
|
* Pointer to the IDirect3DDevice9 object returned from IDirect3D9::CreateDevice()
|
|
|
|
*
|
|
|
|
* @param UINT Width
|
|
|
|
* Desired width of the texture
|
|
|
|
*
|
|
|
|
* @param UINT Height
|
|
|
|
* Desired height of the texture
|
|
|
|
*
|
|
|
|
* @param UINT Levels
|
|
|
|
* Number of mip-maps. If Levels are zero, mip-maps down to size 1x1 will be generated.
|
|
|
|
*
|
|
|
|
* @param DWORD Usage
|
|
|
|
* Valid combinations of the D3DUSAGE constants.
|
|
|
|
*
|
|
|
|
* @param D3DFORMAT Format
|
|
|
|
* One of the D3DFORMAT enum members for the surface format.
|
|
|
|
*
|
|
|
|
* @param D3DPOOL Pool
|
|
|
|
* One of the D3DPOOL enum members for where the texture should be placed.
|
|
|
|
*
|
|
|
|
* @param IDirect3DTexture9** ppTexture
|
|
|
|
* Return parameter for the created texture
|
|
|
|
*
|
|
|
|
* @param HANDLE* pSharedHandle
|
|
|
|
* Set to NULL, shared resources are not implemented yet
|
|
|
|
*
|
|
|
|
* @return HRESULT
|
|
|
|
* Returns D3D_OK if everything went well.
|
|
|
|
*
|
|
|
|
*/
|
2008-08-31 11:36:55 +00:00
|
|
|
HRESULT WINAPI IDirect3DDevice9Base_CreateTexture(LPDIRECT3DDEVICE9 iface, UINT Width, UINT Height, UINT Levels, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IDirect3DTexture9** ppTexture, HANDLE* pSharedHandle)
|
2008-05-04 11:48:06 +00:00
|
|
|
{
|
2008-09-16 19:21:02 +00:00
|
|
|
HRESULT hResult;
|
|
|
|
LPDIRECT3DDEVICE9_INT This = IDirect3DDevice9ToImpl(iface);
|
|
|
|
LOCK_D3DDEVICE9();
|
2008-05-04 11:48:06 +00:00
|
|
|
|
2008-09-16 19:21:02 +00:00
|
|
|
if (NULL == This)
|
|
|
|
return InvalidCall(This, "Invalid 'this' parameter specified");
|
|
|
|
|
|
|
|
if (NULL == ppTexture)
|
|
|
|
return InvalidCall(This, "Invalid ppTexture parameter specified");
|
|
|
|
|
|
|
|
*ppTexture = NULL;
|
|
|
|
|
|
|
|
if (D3DFMT_UNKNOWN == Format)
|
|
|
|
return InvalidCall(This, "Invalid Format parameter specified, D3DFMT_UNKNOWN is not a valid Format");
|
|
|
|
|
|
|
|
if (NULL == pSharedHandle)
|
|
|
|
{
|
|
|
|
UNIMPLEMENTED;
|
|
|
|
return InvalidCall(This, "Invalid pSharedHandle parameter specified, only NULL is supported at the moment");
|
|
|
|
}
|
|
|
|
|
|
|
|
hResult = CreateD3D9MipMap(This, Width, Height, Levels, Usage, Format, Pool, ppTexture);
|
|
|
|
if (FAILED(hResult))
|
|
|
|
DPRINT1("Failed to create texture");
|
|
|
|
|
|
|
|
UNLOCK_D3DDEVICE9();
|
|
|
|
return hResult;
|
2008-05-04 11:48:06 +00:00
|
|
|
}
|
|
|
|
|
2008-08-31 11:36:55 +00:00
|
|
|
HRESULT WINAPI IDirect3DDevice9Base_CreateVolumeTexture(LPDIRECT3DDEVICE9 iface, UINT Width, UINT Height, UINT Depth, UINT Levels, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IDirect3DVolumeTexture9** ppVolumeTexture, HANDLE* pSharedHandle)
|
2008-05-04 11:48:06 +00:00
|
|
|
{
|
|
|
|
UNIMPLEMENTED
|
|
|
|
|
2008-05-04 12:47:57 +00:00
|
|
|
return D3D_OK;
|
2008-05-04 11:48:06 +00:00
|
|
|
}
|
|
|
|
|
2008-08-31 11:36:55 +00:00
|
|
|
HRESULT WINAPI IDirect3DDevice9Base_CreateCubeTexture(LPDIRECT3DDEVICE9 iface, UINT EdgeLength, UINT Levels, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IDirect3DCubeTexture9** ppCubeTexture, HANDLE* pSharedHandle)
|
2008-05-04 11:48:06 +00:00
|
|
|
{
|
|
|
|
UNIMPLEMENTED
|
|
|
|
|
2008-05-04 12:47:57 +00:00
|
|
|
return D3D_OK;
|
2008-05-04 11:48:06 +00:00
|
|
|
}
|
|
|
|
|
2008-08-31 11:36:55 +00:00
|
|
|
HRESULT WINAPI IDirect3DDevice9Base_CreateVertexBuffer(LPDIRECT3DDEVICE9 iface, UINT Length, DWORD Usage, DWORD FVF, D3DPOOL Pool, IDirect3DVertexBuffer9** ppVertexBuffer, HANDLE* pSharedHandle)
|
2008-05-04 11:48:06 +00:00
|
|
|
{
|
|
|
|
UNIMPLEMENTED
|
|
|
|
|
2008-05-04 12:47:57 +00:00
|
|
|
return D3D_OK;
|
2008-05-04 11:48:06 +00:00
|
|
|
}
|
|
|
|
|
2008-08-31 11:36:55 +00:00
|
|
|
HRESULT WINAPI IDirect3DDevice9Base_CreateIndexBuffer(LPDIRECT3DDEVICE9 iface, UINT Length, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IDirect3DIndexBuffer9** ppIndexBuffer, HANDLE* pSharedHandle)
|
2008-05-04 11:48:06 +00:00
|
|
|
{
|
|
|
|
UNIMPLEMENTED
|
|
|
|
|
2008-05-04 12:47:57 +00:00
|
|
|
return D3D_OK;
|
2008-05-04 11:48:06 +00:00
|
|
|
}
|
|
|
|
|
2008-08-31 11:36:55 +00:00
|
|
|
HRESULT WINAPI IDirect3DDevice9Base_CreateRenderTarget(LPDIRECT3DDEVICE9 iface, UINT Width, UINT Height, D3DFORMAT Format, D3DMULTISAMPLE_TYPE MultiSample, DWORD MultisampleQuality, BOOL Lockable, IDirect3DSurface9** ppSurface, HANDLE* pSharedHandle)
|
2008-05-04 11:48:06 +00:00
|
|
|
{
|
|
|
|
UNIMPLEMENTED
|
|
|
|
|
2008-05-04 12:47:57 +00:00
|
|
|
return D3D_OK;
|
2008-05-04 11:48:06 +00:00
|
|
|
}
|
|
|
|
|
2008-08-31 11:36:55 +00:00
|
|
|
HRESULT WINAPI IDirect3DDevice9Base_CreateDepthStencilSurface(LPDIRECT3DDEVICE9 iface, UINT Width, UINT Height, D3DFORMAT Format, D3DMULTISAMPLE_TYPE MultiSample, DWORD MultisampleQuality, BOOL Discard, IDirect3DSurface9** ppSurface, HANDLE* pSharedHandle)
|
2008-05-04 11:48:06 +00:00
|
|
|
{
|
|
|
|
UNIMPLEMENTED
|
|
|
|
|
2008-05-04 12:47:57 +00:00
|
|
|
return D3D_OK;
|
2008-05-04 11:48:06 +00:00
|
|
|
}
|
|
|
|
|
2008-08-31 11:36:55 +00:00
|
|
|
HRESULT WINAPI IDirect3DDevice9Base_UpdateSurface(LPDIRECT3DDEVICE9 iface, IDirect3DSurface9* pSourceSurface, CONST RECT* pSourceRect, IDirect3DSurface9* pDestinationSurface, CONST POINT* pDestPoint)
|
2008-05-04 11:48:06 +00:00
|
|
|
{
|
|
|
|
UNIMPLEMENTED
|
|
|
|
|
2008-05-04 12:47:57 +00:00
|
|
|
return D3D_OK;
|
2008-05-04 11:48:06 +00:00
|
|
|
}
|
|
|
|
|
2008-08-31 11:36:55 +00:00
|
|
|
HRESULT WINAPI IDirect3DDevice9Base_UpdateTexture(LPDIRECT3DDEVICE9 iface, IDirect3DBaseTexture9* pSourceTexture, IDirect3DBaseTexture9* pDestinationTexture)
|
2008-05-04 11:48:06 +00:00
|
|
|
{
|
|
|
|
UNIMPLEMENTED
|
|
|
|
|
2008-05-04 12:47:57 +00:00
|
|
|
return D3D_OK;
|
2008-05-04 11:48:06 +00:00
|
|
|
}
|
|
|
|
|
2008-08-31 11:36:55 +00:00
|
|
|
HRESULT WINAPI IDirect3DDevice9Base_GetRenderTargetData(LPDIRECT3DDEVICE9 iface, IDirect3DSurface9* pRenderTarget, IDirect3DSurface9* pDestSurface)
|
2008-05-04 11:48:06 +00:00
|
|
|
{
|
|
|
|
UNIMPLEMENTED
|
|
|
|
|
2008-05-04 12:47:57 +00:00
|
|
|
return D3D_OK;
|
2008-05-04 11:48:06 +00:00
|
|
|
}
|
|
|
|
|
2008-08-31 11:36:55 +00:00
|
|
|
HRESULT WINAPI IDirect3DDevice9Base_GetFrontBufferData(LPDIRECT3DDEVICE9 iface, UINT iSwapChain, IDirect3DSurface9* pDestSurface)
|
2008-05-04 11:48:06 +00:00
|
|
|
{
|
|
|
|
UNIMPLEMENTED
|
|
|
|
|
2008-05-04 12:47:57 +00:00
|
|
|
return D3D_OK;
|
2008-05-04 11:48:06 +00:00
|
|
|
}
|
|
|
|
|
2008-08-31 11:36:55 +00:00
|
|
|
HRESULT WINAPI IDirect3DDevice9Base_StretchRect(LPDIRECT3DDEVICE9 iface, IDirect3DSurface9* pSourceSurface, CONST RECT* pSourceRect, IDirect3DSurface9* pDestSurface, CONST RECT* pDestRect, D3DTEXTUREFILTERTYPE Filter)
|
2008-05-04 11:48:06 +00:00
|
|
|
{
|
|
|
|
UNIMPLEMENTED
|
|
|
|
|
2008-05-04 12:47:57 +00:00
|
|
|
return D3D_OK;
|
2008-05-04 11:48:06 +00:00
|
|
|
}
|
|
|
|
|
2008-08-31 11:36:55 +00:00
|
|
|
HRESULT WINAPI IDirect3DDevice9Base_ColorFill(LPDIRECT3DDEVICE9 iface, IDirect3DSurface9* pSurface, CONST RECT* pRect, D3DCOLOR color)
|
2008-05-04 11:48:06 +00:00
|
|
|
{
|
|
|
|
UNIMPLEMENTED
|
|
|
|
|
2008-05-04 12:47:57 +00:00
|
|
|
return D3D_OK;
|
2008-05-04 11:48:06 +00:00
|
|
|
}
|
|
|
|
|
2008-08-31 11:36:55 +00:00
|
|
|
HRESULT WINAPI IDirect3DDevice9Base_CreateOffscreenPlainSurface(LPDIRECT3DDEVICE9 iface, UINT Width, UINT Height, D3DFORMAT Format, D3DPOOL Pool, IDirect3DSurface9** ppSurface, HANDLE* pSharedHandle)
|
2008-05-04 11:48:06 +00:00
|
|
|
{
|
|
|
|
UNIMPLEMENTED
|
|
|
|
|
2008-05-04 12:47:57 +00:00
|
|
|
return D3D_OK;
|
2008-05-04 11:48:06 +00:00
|
|
|
}
|
2008-09-01 18:32:57 +00:00
|
|
|
|
|
|
|
/* IDirect3DDevice9 private interface */
|
|
|
|
VOID WINAPI IDirect3DDevice9Base_Destroy(LPDIRECT3DDEVICE9 iface)
|
|
|
|
{
|
|
|
|
UNIMPLEMENTED
|
|
|
|
}
|
|
|
|
|
|
|
|
VOID WINAPI IDirect3DDevice9Base_VirtualDestructor(LPDIRECT3DDEVICE9 iface)
|
|
|
|
{
|
|
|
|
UNIMPLEMENTED
|
|
|
|
}
|