355 DWORD CallBackFlags[3];
365 DD_GETDDIVERSIONDATA DdiVersion;
366 DD_GETFORMATCOUNTDATA FormatCountData;
367 DD_GETEXTENDEDMODECOUNTDATA ExModeCountData;
368 DD_GETD3DQUERYCOUNTDATA D3dQueryCountData;
371 *pNumTextureFormats = 0;
372 *pNumZStencilFormats = 0;
373 *pNumExtendedFormats = 0;
380 ValueSize =
sizeof(dwDXVersion);
406 puD3dTextureFormats !=
NULL)
443 DD_DXVERSION DxVersion;
446 DxVersion.dwDXVersion = dwDXVersion;
463 ValueSize =
sizeof(ForceDDIOn);
478 if (DdiVersion.dwDDIVersion == 0)
480 DPRINT1(
"Driver claims to be DX9 driver, but didn't report DX9 DDI version - reverting to DX8 mode");
484 DPRINT1(
"Driver claims to be DX9 driver, but was built with an old DDI version - reverting to DX8 mode");
498 DPRINT1(
"Driver returned an invalid D3DCAPS8 structure - aborting");
510 if (
FALSE == bDX8Mode)
521 DPRINT1(
"Driver returned an invalid D3DCAPS9 structure - aborting");
535 FormatCountData.dwFormatCount =
UINT_MAX;
536 FormatCountData.dwReserved = dwDXVersion;
542 DPRINT1(
"Driver claimed to be DX9 driver, but didn't support D3DGDI_TYPE_GETFORMATCOUNT in GetDriverInfo call");
545 else if (DrvInfo.
dwActualSize !=
sizeof(DD_GETFORMATCOUNTDATA))
547 DPRINT1(
"Driver returned an invalid DD_GETFORMATCOUNTDATA structure - aborting");
550 else if (FormatCountData.dwFormatCount ==
UINT_MAX)
552 DPRINT1(
"Driver didn't set DD_GETFORMATCOUNTDATA.dwFormatCount - aborting");
556 *pNumTextureFormats = FormatCountData.dwFormatCount;
561 if (puD3dTextureFormats !=
NULL)
564 DD_GETFORMATDATA FormatData;
566 for (FormatIndex = 0; FormatIndex < FormatCountData.dwFormatCount; FormatIndex++)
570 FormatData.dwFormatIndex = FormatIndex;
576 DPRINT1(
"Driver claimed to be DX9 driver, but didn't support D3DGDI_TYPE_GETFORMAT in GetDriverInfo call");
579 else if (DrvInfo.
dwActualSize !=
sizeof(DD_GETFORMATDATA))
581 DPRINT1(
"Driver returned an invalid DD_GETFORMATDATA structure - aborting");
586 DPRINT1(
"Driver didn't set DD_GETFORMATDATA.format - aborting");
597 FormatData.format.dwPrivateFormatBitCount > 0)
602 ++puD3dTextureFormats;
609 ResetGetDriverInfo2Data(&ExModeCountData.gdi2, D3DGDI2_TYPE_GETEXTENDEDMODECOUNT,
sizeof(DD_GETEXTENDEDMODECOUNTDATA));
611 ExModeCountData.dwModeCount =
UINT_MAX;
612 ExModeCountData.dwReserved = dwDXVersion;
618 if (DrvInfo.
dwActualSize !=
sizeof(DD_GETEXTENDEDMODECOUNTDATA))
620 DPRINT1(
"Driver returned an invalid DD_GETEXTENDEDFORMATCOUNTDATA structure - aborting");
623 else if (ExModeCountData.dwModeCount ==
UINT_MAX)
625 DPRINT1(
"Driver didn't set DD_GETEXTENDEDMODECOUNTDATA.dwModeCount - aborting");
629 *pNumExtendedFormats = ExModeCountData.dwModeCount;
633 ExModeCountData.dwModeCount = 0;
639 if (pD3dDisplayModeList !=
NULL)
642 DD_GETEXTENDEDMODEDATA ExModeData;
644 for (ModeIndex = 0; ModeIndex < ExModeCountData.dwModeCount; ModeIndex++)
648 ExModeData.dwModeIndex = ModeIndex;
655 DPRINT1(
"Driver claimed to be DX9 driver, but didn't support D3DGDI2_TYPE_GETEXTENDEDMODE in GetDriverInfo call");
658 else if (DrvInfo.
dwActualSize !=
sizeof(DD_GETEXTENDEDMODEDATA))
660 DPRINT1(
"Driver returned an invalid DD_GETEXTENDEDMODEDATA structure - aborting");
663 else if (ExModeData.mode.Width !=
UINT_MAX)
665 DPRINT1(
"Driver didn't set DD_GETEXTENDEDMODEDATA.mode - aborting");
670 ++pD3dDisplayModeList;
677 DD_GETADAPTERGROUPDATA AdapterGroupData;
680 AdapterGroupData.ulUniqueAdapterGroupId =
UINT_MAX;
686 DPRINT1(
"Driver claimed to be DX9 driver, but didn't support D3DGDI2_TYPE_GETADAPTERGROUP in GetDriverInfo call");
689 else if (DrvInfo.
dwActualSize !=
sizeof(DD_GETADAPTERGROUPDATA))
691 DPRINT1(
"Driver returned an invalid DD_GETADAPTERGROUPDATA structure - aborting");
694 else if (AdapterGroupData.ulUniqueAdapterGroupId ==
UINT_MAX)
696 DPRINT1(
"Driver didn't set DD_GETADAPTERGROUPDATA.ulUniqueAdapterGroupId - aborting");
706 ResetGetDriverInfo2Data(&D3dQueryCountData.gdi2, D3DGDI2_TYPE_GETD3DQUERYCOUNT,
sizeof(DD_GETD3DQUERYCOUNTDATA));
708 D3dQueryCountData.dwNumQueries =
UINT_MAX;
714 DPRINT1(
"Driver claimed to be DX9 driver, but didn't support D3DGDI2_TYPE_GETD3DQUERYCOUNT in GetDriverInfo call");
717 else if (DrvInfo.
dwActualSize !=
sizeof(DD_GETD3DQUERYCOUNTDATA))
719 DPRINT1(
"Driver returned an invalid DD_GETD3DQUERYCOUNTDATA structure - aborting");
722 else if (D3dQueryCountData.dwNumQueries ==
UINT_MAX)
724 DPRINT1(
"Driver didn't set DD_GETD3DQUERYCOUNTDATA.dwNumQueries - aborting");
728 *pNumQueries = D3dQueryCountData.dwNumQueries;
733 if (pD3dQueryList !=
NULL)
736 DD_GETD3DQUERYDATA D3dQueryData;
738 for (QueryIndex = 0; QueryIndex < D3dQueryCountData.dwNumQueries; QueryIndex++)
742 D3dQueryData.dwQueryIndex = QueryIndex;
748 DPRINT1(
"Driver claimed to be DX9 driver, but didn't support D3DGDI2_TYPE_GETD3DQUERY in GetDriverInfo call");
751 else if (DrvInfo.
dwActualSize !=
sizeof(DD_GETD3DQUERYDATA))
753 DPRINT1(
"Driver returned an invalid DD_GETD3DQUERYDATA structure - aborting");
757 *pD3dQueryList = D3dQueryData.QueryType;
772 DrvInfo.
guidInfo = GUID_D3DExtendedCaps;
774 DrvInfo.
lpvData = pD3dExtendedCaps;
779 DPRINT1(
"Driver failed call to GetDriverInfo() with: GUID_D3DExtendedCaps");
789 DrvInfo.
guidInfo = GUID_ZPixelFormats;
791 DrvInfo.
lpvData = pZPixelFormats;
796 DPRINT1(
"Driver failed call to GetDriverInfo() with: GUID_ZPixelFormats");
801 *pNumZStencilFormats = FormatCountData.dwFormatCount;
803 if (pD3dZStencilFormatList !=
NULL)
804 memcpy(pD3dZStencilFormatList, pZPixelFormats, FormatCountData.dwFormatCount *
sizeof(
DDPIXELFORMAT));
853 DPRINT1(
"Could not get monitor information");
860 if (
FALSE == bDX8Mode)
866 DPRINT1(
"Driver claimed to be DX9 driver, but used depricated D3DCAPS9.VertexProcessingCaps: D3DVTXPCAPS_NO_VSDT_UBYTE4 instead of not setting D3DCAPS9.DeclTypes: D3DDTCAPS_UBYTE4.");
#define DDHALINFO_GETDRIVERINFO2
BOOL WINAPI OsThunkDdQueryDirectDrawObject(HANDLE hDirectDrawLocal, DD_HALINFO *pHalInfo, DWORD *pCallBackFlags, LPD3DNTHAL_CALLBACKS puD3dCallbacks, LPD3DNTHAL_GLOBALDRIVERDATA puD3dDriverData, PDD_D3DBUFCALLBACKS puD3dBufferCallbacks, LPDDSURFACEDESC puD3dTextureFormats, DWORD *puNumHeaps, VIDEOMEMORY *puvmList, DWORD *puNumFourCC, DWORD *puFourCC)
HMONITOR GetAdapterMonitor(LPCSTR lpszDeviceName)
#define D3DVTXPCAPS_NO_VSDT_UBYTE4
ULONG ulUniqueAdapterGroupId
struct _DDPIXELFORMAT DDPIXELFORMAT
#define D3D9_INT_D3DCAPS8_VALID
struct _DD_GETDRIVERINFODATA DD_GETDRIVERINFODATA
static void ResetGetDriverInfo2Data(DD_GETDRIVERINFO2DATA *DrvInfo2, DWORD dwType, DWORD dwExpectedSize)
DWORD WINAPI OsThunkDdGetDriverInfo(HANDLE hDirectDraw, PDD_GETDRIVERINFODATA puGetDriverInfoData)
D3DFORMAT RawDisplayFormat
DWORD VertexProcessingCaps
DWORD WINAPI D3d9GetAvailDriverMemory(LPD3D9_GETAVAILDRIVERMEMORYDATA pData)
D3DFORMAT RawDisplayFormat
static void PrepareDriverInfoData(DD_GETDRIVERINFODATA *DrvInfo, LPVOID pData, DWORD dwExpectedSize)
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define D3D9_INT_D3DCAPS9_VALID
BOOL ReadRegistryValue(IN DWORD ValueType, IN LPCSTR ValueName, OUT LPBYTE DataBuffer, IN OUT LPDWORD DataBufferSize)
#define memcpy(s1, s2, n)
D3DNTHALDEVICEDESC_V1 hwCaps
#define DDCAPS2_AUTOFLIPOVERLAY
BOOL GetAdapterMode(LPCSTR lpszDeviceName, D3DDISPLAYMODE *pMode)
LPD3D9_GETAVAILDRIVERMEMORY DdGetAvailDriverMemory
struct tagMONITORINFO MONITORINFO
BOOL WINAPI GetMonitorInfoA(_In_ HMONITOR, _Inout_ LPMONITORINFO)
HLOCAL swDDICreateDirectDrawObject
#define DD_RUNTIME_VERSION
struct _D3DHAL_D3DEXTENDEDCAPS D3DHAL_D3DEXTENDEDCAPS
#define D3DFORMAT_OP_PIXELSIZE
DDPIXELFORMAT ddpfDisplay
DWORD dwNumTextureFormats
#define HeapFree(x, y, z)