* Implemented IDirect3DDevice9::GetDirect3D() and GetDeviceCaps()

* Added a DevCaps filter when retrieving D3DCAPS9 from device caps

svn path=/trunk/; revision=33298
This commit is contained in:
Gregor Brunmar 2008-05-05 15:58:23 +00:00
parent 61fe294be5
commit f71800893b
2 changed files with 72 additions and 2 deletions

View file

@ -20,6 +20,13 @@
#define D3D9_PRE_XP_CAPS2 (D3DCAPS2_CANAUTOGENMIPMAP | D3DCAPS2_DYNAMICTEXTURES | D3DCAPS2_RESERVED | D3DCAPS2_FULLSCREENGAMMA)
#define D3D9_XP_OR_LATER_CAPS2 (D3D9_PRE_XP_CAPS2 | D3DCAPS2_CANMANAGERESOURCE)
#define D3D9_CAPS3 (D3DCAPS3_ALPHA_FULLSCREEN_FLIP_OR_DISCARD | D3DCAPS3_LINEAR_TO_SRGB_PRESENTATION | D3DCAPS3_COPY_TO_VIDMEM | D3DCAPS3_COPY_TO_SYSTEMMEM)
#define D3D9_DEVCAPS (D3DDEVCAPS_EXECUTESYSTEMMEMORY | D3DDEVCAPS_EXECUTEVIDEOMEMORY | D3DDEVCAPS_TLVERTEXSYSTEMMEMORY \
| D3DDEVCAPS_TLVERTEXVIDEOMEMORY | D3DDEVCAPS_TEXTURESYSTEMMEMORY | D3DDEVCAPS_TEXTUREVIDEOMEMORY \
| D3DDEVCAPS_DRAWPRIMTLVERTEX | D3DDEVCAPS_CANRENDERAFTERFLIP | D3DDEVCAPS_TEXTURENONLOCALVIDMEM \
| D3DDEVCAPS_DRAWPRIMITIVES2 | D3DDEVCAPS_SEPARATETEXTUREMEMORIES | D3DDEVCAPS_DRAWPRIMITIVES2EX \
| D3DDEVCAPS_HWTRANSFORMANDLIGHT | D3DDEVCAPS_CANBLTSYSTONONLOCAL | D3DDEVCAPS_HWRASTERIZATION \
| D3DDEVCAPS_PUREDEVICE | D3DDEVCAPS_QUINTICRTPATCHES | D3DDEVCAPS_RTPATCHES | D3DDEVCAPS_RTPATCHHANDLEZERO \
| D3DDEVCAPS_NPATCHES)
#define D3DCAPS2_PRESENT_INTERVAL_SEVERAL 0x00200000
#define D3DCAPS2_PRESENT_INTERVAL_IMMEDIATE 0x00400000
@ -211,6 +218,7 @@ static void CopyDriverCaps(const D3DCAPS9* pSrcCaps, D3DCAPS9* pDstCaps)
pDstCaps->Caps2 = pSrcCaps->Caps2 & D3D9_PRE_XP_CAPS2;
pDstCaps->Caps3 = pSrcCaps->Caps3 & D3D9_CAPS3;
pDstCaps->DevCaps = pSrcCaps->DevCaps & D3D9_DEVCAPS;
pDstCaps->PresentationIntervals = D3DPRESENT_INTERVAL_ONE;
if (pSrcCaps->Caps2 & D3DCAPS2_PRESENT_INTERVAL_SEVERAL)

View file

@ -7,6 +7,7 @@
*/
#include "d3d9_device.h"
#include "d3d9_helpers.h"
#include "adapter.h"
#include "debug.h"
#define LOCK_D3DDEVICE9() if (This->bLockDevice) EnterCriticalSection(&This->CriticalSection);
@ -83,17 +84,78 @@ static HRESULT WINAPI IDirect3DDevice9Impl_EvictManagedResources(LPDIRECT3DDEVIC
return D3D_OK;
}
/*++
* @name IDirect3DDevice9::GetDirect3D
* @implemented
*
* The function IDirect3DDevice9Impl_GetDirect3D returns a pointer to the IDirect3D9 object
* 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.
*
*/
static HRESULT WINAPI IDirect3DDevice9Impl_GetDirect3D(LPDIRECT3DDEVICE9 iface, IDirect3D9** ppD3D9)
{
UNIMPLEMENTED
IDirect3D9* pDirect3D9;
LPDIRECT3DDEVICE9_INT This = impl_from_IDirect3DDevice9(iface);
LOCK_D3DDEVICE9();
if (IsBadWritePtr(ppD3D9, sizeof(IDirect3D9*)))
{
DPRINT1("Invalid ppD3D9 parameter specified");
UNLOCK_D3DDEVICE9();
return D3DERR_INVALIDCALL;
}
pDirect3D9 = (IDirect3D9*)&This->pDirect3D9->lpVtbl;
IDirect3D9_AddRef(pDirect3D9);
*ppD3D9 = pDirect3D9;
UNLOCK_D3DDEVICE9();
return D3D_OK;
}
/*++
* @name IDirect3DDevice9::GetDeviceCaps
* @implemented
*
* The function IDirect3DDevice9Impl_GetDeviceCaps fills the pCaps argument with the
* 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.
*
*/
static HRESULT WINAPI IDirect3DDevice9Impl_GetDeviceCaps(LPDIRECT3DDEVICE9 iface, D3DCAPS9* pCaps)
{
UNIMPLEMENTED
LPDIRECT3DDEVICE9_INT This = impl_from_IDirect3DDevice9(iface);
LOCK_D3DDEVICE9();
if (IsBadWritePtr(pCaps, sizeof(D3DCAPS9)))
{
DPRINT1("Invalid pCaps parameter specified");
UNLOCK_D3DDEVICE9();
return D3DERR_INVALIDCALL;
}
GetAdapterCaps(&This->pDirect3D9->DisplayAdapters[0], This->DeviceData[0].DeviceType, pCaps);
UNLOCK_D3DDEVICE9();
return D3D_OK;
}