17#define LOCK_D3D9() EnterCriticalSection(&This->d3d9_cs);
18#define UNLOCK_D3D9() LeaveCriticalSection(&This->d3d9_cs);
36 IUnknown_AddRef(iface);
92 UINT NumDisplayAdapters;
97 NumDisplayAdapters =
This->NumDisplayAdapters;
100 return NumDisplayAdapters;
136 if (Adapter >=
This->NumDisplayAdapters)
138 DPRINT1(
"Invalid Adapter number specified");
143 if (
Flags & ~D3DENUM_WHQL_LEVEL)
145 DPRINT1(
"Invalid Flags specified");
150 if (
NULL == pIdentifier)
152 DPRINT1(
"Invalid pIdentifier parameter specified");
161 DPRINT1(
"Internal error: Couldn't get the adapter info for device (%d): %s", Adapter,
This->DisplayAdapters[Adapter].szDeviceName);
194 UINT AdapterModeCount;
199 if (Adapter >=
This->NumDisplayAdapters)
201 DPRINT1(
"Invalid Adapter number specified");
210 This->DisplayAdapters[Adapter].pSupportedD3DFormats,
211 This->DisplayAdapters[Adapter].NumSupportedD3DFormats);
217 This->DisplayAdapters[Adapter].pSupportedD3DExtendedFormats,
218 This->DisplayAdapters[Adapter].NumSupportedD3DExtendedFormats);
222 return AdapterModeCount;
264 if (Adapter >=
This->NumDisplayAdapters)
266 DPRINT1(
"Invalid Adapter number specified");
273 DPRINT1(
"Invalid pMode parameter specified");
283 This->DisplayAdapters[Adapter].pSupportedD3DFormats,
284 This->DisplayAdapters[Adapter].NumSupportedD3DFormats);
291 This->DisplayAdapters[Adapter].pSupportedD3DExtendedFormats,
292 This->DisplayAdapters[Adapter].NumSupportedD3DExtendedFormats);
295 if (pMatchingDisplayFormat !=
NULL)
297 *pMode = *pMatchingDisplayFormat;
302 if (pMatchingDisplayFormat ==
NULL)
335 if (Adapter >=
This->NumDisplayAdapters)
337 DPRINT1(
"Invalid Adapter number specified");
344 DPRINT1(
"Invalid pMode parameter specified");
351 DPRINT1(
"Internal error, GetAdapterMode() failed.");
399 if (Adapter >=
This->NumDisplayAdapters)
401 DPRINT1(
"Invalid Adapter number specified");
410 DPRINT1(
"Invalid DeviceType specified");
418 BackBufferFormat = DisplayFormat;
423 DPRINT1(
"Invalid D3DFORMAT specified");
430 DPRINT1(
"Invalid D3DFORMAT specified");
437 DPRINT1(
"Extended display modes can only be used in fullscreen mode");
442 hResult =
CheckDeviceType(&
This->DisplayAdapters[Adapter].DriverCaps, DisplayFormat, BackBufferFormat, Windowed);
499 if (Adapter >=
This->NumDisplayAdapters)
501 DPRINT1(
"Invalid Adapter number specified");
510 DPRINT1(
"Invalid DeviceType specified");
518 DPRINT1(
"Invalid D3DFORMAT specified");
525 DPRINT1(
"Invalid Usage specified");
534 bIsTextureRType =
TRUE;
540 DPRINT1(
"When RType is set to D3DRTYPE_SURFACE, Usage must be 0 or have set D3DUSAGE_DEPTHSTENCIL or D3DUSAGE_RENDERTARGET");
549 DPRINT1(
"Invalid CheckFormat Z-Buffer format");
556 DPRINT1(
"Invalid Usage specified, D3DUSAGE_DEPTHSTENCIL and D3DUSAGE_AUTOGENMIPMAP can't be combined.");
562 if (
FALSE == bIsTextureRType &&
566 DPRINT1(
"Invalid RType specified");
575 DPRINT1(
"Invalid Usage specified, D3DUSAGE_AUTOGENMIPMAP, D3DUSAGE_DEPTHSTENCIL and D3DUSAGE_RENDERTARGET can't be combined with RType D3DRTYPE_VOLUME or D3DRTYPE_VOLUMETEXTURE");
581 if (
FALSE == bIsTextureRType &&
584 DPRINT1(
"Invalid Usage specified, D3DUSAGE_QUERY_VERTEXTEXTURE can only be used with a texture RType");
592 DPRINT1(
"Invalid Usage specified, D3DUSAGE_AUTOGENMIPMAP can't be used with a multi-element format");
597 pDriverCaps = &
This->DisplayAdapters[Adapter].DriverCaps;
602 DPRINT1(
"Driver doesn't support dynamic textures");
609 DPRINT1(
"Invalid Usage specified, D3DUSAGE_DEPTHSTENCIL and D3DUSAGE_RENDERTARGET can't be combined with D3DUSAGE_DYNAMIC and a texture RType");
619 DPRINT1(
"Driver doesn't support displacement mapping");
626 DPRINT1(
"Invalid Usage specified, D3DUSAGE_DMAP must be combined with RType D3DRTYPE_TEXTURE");
693 if (Adapter >=
This->NumDisplayAdapters)
695 DPRINT1(
"Invalid Adapter number specified");
704 DPRINT1(
"Invalid DeviceType specified");
713 DPRINT1(
"Invalid D3DFORMAT specified");
718 hResult =
CheckDepthStencilMatch(&
This->DisplayAdapters[Adapter].DriverCaps, AdapterFormat, RenderTargetFormat, DepthStencilFormat);
762 if (Adapter >=
This->NumDisplayAdapters)
764 DPRINT1(
"Invalid Adapter number specified");
773 DPRINT1(
"Invalid DeviceType specified");
781 DPRINT1(
"Invalid D3DFORMAT specified");
833 if (Adapter >=
This->NumDisplayAdapters)
835 DPRINT1(
"Invalid Adapter number specified");
842 DPRINT1(
"Invalid pCaps parameter specified");
879 if (Adapter < This->NumDisplayAdapters)
885 DPRINT1(
"Invalid Adapter number specified");
889 return hAdapterMonitor;
935 struct IDirect3DDevice9** ppReturnedDeviceInterface)
937 DWORD NumAdaptersToCreate;
943 if (Adapter >=
This->NumDisplayAdapters)
945 DPRINT1(
"Invalid Adapter number specified");
954 DPRINT1(
"Invalid DeviceType specified");
962 DPRINT1(
"Sorry, only D3DDEVTYPE_HAL is implemented at this time...");
968 DPRINT1(
"Invalid hFocusWindow parameter specified, expected NULL or a valid HWND");
973 if (
NULL == pPresentationParameters)
975 DPRINT1(
"Invalid pPresentationParameters parameter specified");
982 DPRINT1(
"Invalid pPresentationParameters->hDeviceWindow parameter specified, expected NULL or a valid HWND");
989 DPRINT1(
"When pPresentationParameters->Windowed is not set, hFocusWindow must be a valid HWND");
996 DPRINT1(
"Any of pPresentationParameters->Windowed and hFocusWindow must be set to a valid HWND");
1003 DPRINT1(
"Invalid pPresentationParameters->hDeviceWindow, must be set to a valid unique HWND when Adapter is greater than 0");
1008 if (
NULL == ppReturnedDeviceInterface)
1010 DPRINT1(
"Invalid ppReturnedDeviceInterface parameter specified");
1016 NumAdaptersToCreate =
This->DisplayAdapters[Adapter].NumAdaptersInGroup;
1018 NumAdaptersToCreate = 1;
1020 *ppReturnedDeviceInterface = 0;
1022 Ret =
CreateD3D9HalDevice(
This, Adapter, hFocusWindow, BehaviourFlags, pPresentationParameters, NumAdaptersToCreate, ppReturnedDeviceInterface);
#define InterlockedIncrement
#define InterlockedDecrement
#define D3DCAPS2_DYNAMICTEXTURES
#define D3DUSAGE_NPATCHES
enum _D3DRESOURCETYPE D3DRESOURCETYPE
enum _D3DDEVTYPE D3DDEVTYPE
#define D3DUSAGE_DONOTCLIP
#define D3DUSAGE_WRITEONLY
#define D3DUSAGE_RENDERTARGET
enum _D3DFORMAT D3DFORMAT
#define D3DUSAGE_RTPATCHES
#define D3DUSAGE_DEPTHSTENCIL
enum _D3DMULTISAMPLE_TYPE D3DMULTISAMPLE_TYPE
#define D3DCREATE_ADAPTERGROUP_DEVICE
struct IDirect3D9 * LPDIRECT3D9
VOID AlignedFree(IN OUT LPVOID pObject)
static HRESULT WINAPI IDirect3D9Impl_CheckDeviceType(LPDIRECT3D9 iface, UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT DisplayFormat, D3DFORMAT BackBufferFormat, BOOL Windowed)
static HRESULT WINAPI IDirect3D9Impl_CreateDevice(LPDIRECT3D9 iface, UINT Adapter, D3DDEVTYPE DeviceType, HWND hFocusWindow, DWORD BehaviourFlags, D3DPRESENT_PARAMETERS *pPresentationParameters, struct IDirect3DDevice9 **ppReturnedDeviceInterface)
HRESULT WINAPI IDirect3D9Impl_GetAdapterIdentifier(LPDIRECT3D9 iface, UINT Adapter, DWORD Flags, D3DADAPTER_IDENTIFIER9 *pIdentifier)
static HRESULT WINAPI IDirect3D9Impl_CheckDepthStencilMatch(LPDIRECT3D9 iface, UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT AdapterFormat, D3DFORMAT RenderTargetFormat, D3DFORMAT DepthStencilFormat)
static HRESULT WINAPI IDirect3D9Impl_RegisterSoftwareDevice(LPDIRECT3D9 iface, void *pInitializeFunction)
static HRESULT WINAPI IDirect3D9Impl_GetAdapterDisplayMode(LPDIRECT3D9 iface, UINT Adapter, D3DDISPLAYMODE *pMode)
static HRESULT WINAPI IDirect3D9Impl_EnumAdapterModes(LPDIRECT3D9 iface, UINT Adapter, D3DFORMAT Format, UINT Mode, D3DDISPLAYMODE *pMode)
static UINT WINAPI IDirect3D9Impl_GetAdapterCount(LPDIRECT3D9 iface)
static HRESULT WINAPI IDirect3D9Impl_CheckDeviceFormatConversion(LPDIRECT3D9 iface, UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT SourceFormat, D3DFORMAT TargetFormat)
static HRESULT WINAPI IDirect3D9Impl_QueryInterface(LPDIRECT3D9 iface, REFIID riid, LPVOID *ppvObject)
static HRESULT WINAPI IDirect3D9Impl_CheckDeviceMultiSampleType(LPDIRECT3D9 iface, UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT SurfaceFormat, BOOL Windowed, D3DMULTISAMPLE_TYPE MultiSampleType, DWORD *pQualityLevels)
static HRESULT WINAPI IDirect3D9Impl_CheckDeviceFormat(LPDIRECT3D9 iface, UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT AdapterFormat, DWORD Usage, D3DRESOURCETYPE RType, D3DFORMAT CheckFormat)
IDirect3D9Vtbl Direct3D9_Vtbl
static UINT WINAPI IDirect3D9Impl_GetAdapterModeCount(LPDIRECT3D9 iface, UINT Adapter, D3DFORMAT Format)
static ULONG WINAPI IDirect3D9Impl_Release(LPDIRECT3D9 iface)
static LPDIRECT3D9_INT IDirect3D9ToImpl(LPDIRECT3D9 iface)
static ULONG WINAPI IDirect3D9Impl_AddRef(LPDIRECT3D9 iface)
static HMONITOR WINAPI IDirect3D9Impl_GetAdapterMonitor(LPDIRECT3D9 iface, UINT Adapter)
static HRESULT WINAPI IDirect3D9Impl_GetDeviceCaps(LPDIRECT3D9 iface, UINT Adapter, D3DDEVTYPE DeviceType, D3DCAPS9 *pCaps)
#define D3DDEVCAPS2_DMAPNPATCH
#define D3DDEVCAPS2_PRESAMPLEDDMAPNPATCH
#define D3DUSAGE_AUTOGENMIPMAP
#define D3DUSAGE_QUERY_VERTEXTEXTURE
#define D3DERR_INVALIDCALL
BOOL GetAdapterInfo(LPCSTR lpszDeviceName, D3DADAPTER_IDENTIFIER9 *pIdentifier)
BOOL GetAdapterMode(LPCSTR lpszDeviceName, D3DDISPLAYMODE *pMode)
const D3DDISPLAYMODE * FindDisplayFormat(D3DFORMAT Format, UINT ModeIndex, const D3DDISPLAYMODE *pSupportedDisplayModes, UINT NumDisplayModes)
HRESULT GetAdapterCaps(const LPDIRECT3D9_DISPLAYADAPTER pDisplayAdapter, D3DDEVTYPE DeviceType, D3DCAPS9 *pDstCaps)
UINT GetDisplayFormatCount(D3DFORMAT Format, const D3DDISPLAYMODE *pSupportedDisplayModes, UINT NumDisplayModes)
HMONITOR GetAdapterMonitor(LPCSTR lpszDeviceName)
HRESULT CreateD3D9HalDevice(LPDIRECT3D9_INT pDirect3D9, UINT Adapter, HWND hFocusWindow, DWORD BehaviourFlags, D3DPRESENT_PARAMETERS *pPresentationParameters, DWORD NumAdaptersToCreate, struct IDirect3DDevice9 **ppReturnedDeviceInterface)
_Must_inspect_result_ _In_ USAGE _In_ USHORT _In_ USAGE Usage
#define IsEqualGUID(rguid1, rguid2)
#define D3DERR_NOTAVAILABLE
#define FIELD_OFFSET(t, f)
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
_In_ void _In_ PCCERT_CONTEXT _In_opt_ LPFILETIME _In_ DWORD _In_ DWORD _Outptr_opt_ void ** ppvObject
BOOL WINAPI IsWindow(_In_opt_ HWND)
_Must_inspect_result_ _In_ ULONG Flags