349{
353
355 DWORD CallBackFlags[3];
361
363
365 DD_GETDDIVERSIONDATA DdiVersion;
366 DD_GETFORMATCOUNTDATA FormatCountData;
367 DD_GETEXTENDEDMODECOUNTDATA ExModeCountData;
368 DD_GETD3DQUERYCOUNTDATA D3dQueryCountData;
369
370
371 *pNumTextureFormats = 0;
372 *pNumZStencilFormats = 0;
373 *pNumExtendedFormats = 0;
374 *pNumQueries = 0;
378
379
380 ValueSize = sizeof(dwDXVersion);
383
384
387 &HalInfo,
388 CallBackFlags,
389 &D3dCallbacks,
390 &D3dDriverData,
391 &D3dBufferCallbacks,
393 &NumHeaps,
395 &NumFourCC,
397 );
398
400 {
401
403 }
404
406 puD3dTextureFormats !=
NULL)
407 {
410 &HalInfo,
411 CallBackFlags,
412 &D3dCallbacks,
413 &D3dDriverData,
414 &D3dBufferCallbacks,
415 puD3dTextureFormats,
416 &NumHeaps,
418 &NumFourCC,
420 );
421
424 }
425
427 {
429 }
430
438
440 {
441
442 {
443 DD_DXVERSION DxVersion;
444
446 DxVersion.dwDXVersion = dwDXVersion;
447
450 }
451
452
453
454 {
458
460 {
462
463 ValueSize = sizeof(ForceDDIOn);
465 0 != ForceDDIOn)
466 {
468 }
469 }
470 }
471
472
473
475 {
477
478 if (DdiVersion.dwDDIVersion == 0)
479 {
480 DPRINT1(
"Driver claims to be DX9 driver, but didn't report DX9 DDI version - reverting to DX8 mode");
481 }
482 else
483 {
484 DPRINT1(
"Driver claims to be DX9 driver, but was built with an old DDI version - reverting to DX8 mode");
485 }
486
487
488 {
490
493
497 {
498 DPRINT1(
"Driver returned an invalid D3DCAPS8 structure - aborting");
500 }
501
505 }
506 }
507
508
509
510 if (
FALSE == bDX8Mode)
511 {
513
516
520 {
521 DPRINT1(
"Driver returned an invalid D3DCAPS9 structure - aborting");
523 }
524
528 }
529
530
531
532 {
535 FormatCountData.dwFormatCount =
UINT_MAX;
536 FormatCountData.dwReserved = dwDXVersion;
537
539 {
541 {
542 DPRINT1(
"Driver claimed to be DX9 driver, but didn't support D3DGDI_TYPE_GETFORMATCOUNT in GetDriverInfo call");
544 }
545 else if (DrvInfo.
dwActualSize !=
sizeof(DD_GETFORMATCOUNTDATA))
546 {
547 DPRINT1(
"Driver returned an invalid DD_GETFORMATCOUNTDATA structure - aborting");
549 }
550 else if (FormatCountData.dwFormatCount ==
UINT_MAX)
551 {
552 DPRINT1(
"Driver didn't set DD_GETFORMATCOUNTDATA.dwFormatCount - aborting");
554 }
555
556 *pNumTextureFormats = FormatCountData.dwFormatCount;
557 }
558 }
559
560
561 if (puD3dTextureFormats !=
NULL)
562 {
564 DD_GETFORMATDATA FormatData;
565
566 for (FormatIndex = 0; FormatIndex < FormatCountData.dwFormatCount; FormatIndex++)
567 {
570 FormatData.dwFormatIndex = FormatIndex;
571
573 {
575 {
576 DPRINT1(
"Driver claimed to be DX9 driver, but didn't support D3DGDI_TYPE_GETFORMAT in GetDriverInfo call");
578 }
579 else if (DrvInfo.
dwActualSize !=
sizeof(DD_GETFORMATDATA))
580 {
581 DPRINT1(
"Driver returned an invalid DD_GETFORMATDATA structure - aborting");
583 }
585 {
586 DPRINT1(
"Driver didn't set DD_GETFORMATDATA.format - aborting");
588 }
589
590
595
597 FormatData.format.dwPrivateFormatBitCount > 0)
598 {
599
600 }
601
602 ++puD3dTextureFormats;
603 }
604 }
605 }
606
607
608 {
609 ResetGetDriverInfo2Data(&ExModeCountData.gdi2, D3DGDI2_TYPE_GETEXTENDEDMODECOUNT,
sizeof(DD_GETEXTENDEDMODECOUNTDATA));
611 ExModeCountData.dwModeCount =
UINT_MAX;
612 ExModeCountData.dwReserved = dwDXVersion;
613
615 {
617 {
618 if (DrvInfo.
dwActualSize !=
sizeof(DD_GETEXTENDEDMODECOUNTDATA))
619 {
620 DPRINT1(
"Driver returned an invalid DD_GETEXTENDEDFORMATCOUNTDATA structure - aborting");
622 }
623 else if (ExModeCountData.dwModeCount ==
UINT_MAX)
624 {
625 DPRINT1(
"Driver didn't set DD_GETEXTENDEDMODECOUNTDATA.dwModeCount - aborting");
627 }
628
629 *pNumExtendedFormats = ExModeCountData.dwModeCount;
630 }
631 else
632 {
633 ExModeCountData.dwModeCount = 0;
634 }
635 }
636 }
637
638
639 if (pD3dDisplayModeList !=
NULL)
640 {
642 DD_GETEXTENDEDMODEDATA ExModeData;
643
644 for (ModeIndex = 0; ModeIndex < ExModeCountData.dwModeCount; ModeIndex++)
645 {
648 ExModeData.dwModeIndex = ModeIndex;
650
652 {
654 {
655 DPRINT1(
"Driver claimed to be DX9 driver, but didn't support D3DGDI2_TYPE_GETEXTENDEDMODE in GetDriverInfo call");
657 }
658 else if (DrvInfo.
dwActualSize !=
sizeof(DD_GETEXTENDEDMODEDATA))
659 {
660 DPRINT1(
"Driver returned an invalid DD_GETEXTENDEDMODEDATA structure - aborting");
662 }
663 else if (ExModeData.mode.Width !=
UINT_MAX)
664 {
665 DPRINT1(
"Driver didn't set DD_GETEXTENDEDMODEDATA.mode - aborting");
667 }
668
670 ++pD3dDisplayModeList;
671 }
672 }
673 }
674
675
676 {
677 DD_GETADAPTERGROUPDATA AdapterGroupData;
680 AdapterGroupData.ulUniqueAdapterGroupId =
UINT_MAX;
681
683 {
685 {
686 DPRINT1(
"Driver claimed to be DX9 driver, but didn't support D3DGDI2_TYPE_GETADAPTERGROUP in GetDriverInfo call");
688 }
689 else if (DrvInfo.
dwActualSize !=
sizeof(DD_GETADAPTERGROUPDATA))
690 {
691 DPRINT1(
"Driver returned an invalid DD_GETADAPTERGROUPDATA structure - aborting");
693 }
694 else if (AdapterGroupData.ulUniqueAdapterGroupId ==
UINT_MAX)
695 {
696 DPRINT1(
"Driver didn't set DD_GETADAPTERGROUPDATA.ulUniqueAdapterGroupId - aborting");
698 }
699
701 }
702 }
703
704
705 {
706 ResetGetDriverInfo2Data(&D3dQueryCountData.gdi2, D3DGDI2_TYPE_GETD3DQUERYCOUNT,
sizeof(DD_GETD3DQUERYCOUNTDATA));
708 D3dQueryCountData.dwNumQueries =
UINT_MAX;
709
711 {
713 {
714 DPRINT1(
"Driver claimed to be DX9 driver, but didn't support D3DGDI2_TYPE_GETD3DQUERYCOUNT in GetDriverInfo call");
716 }
717 else if (DrvInfo.
dwActualSize !=
sizeof(DD_GETD3DQUERYCOUNTDATA))
718 {
719 DPRINT1(
"Driver returned an invalid DD_GETD3DQUERYCOUNTDATA structure - aborting");
721 }
722 else if (D3dQueryCountData.dwNumQueries ==
UINT_MAX)
723 {
724 DPRINT1(
"Driver didn't set DD_GETD3DQUERYCOUNTDATA.dwNumQueries - aborting");
726 }
727
728 *pNumQueries = D3dQueryCountData.dwNumQueries;
729 }
730 }
731
732
733 if (pD3dQueryList !=
NULL)
734 {
736 DD_GETD3DQUERYDATA D3dQueryData;
737
738 for (QueryIndex = 0; QueryIndex < D3dQueryCountData.dwNumQueries; QueryIndex++)
739 {
742 D3dQueryData.dwQueryIndex = QueryIndex;
743
745 {
747 {
748 DPRINT1(
"Driver claimed to be DX9 driver, but didn't support D3DGDI2_TYPE_GETD3DQUERY in GetDriverInfo call");
750 }
751 else if (DrvInfo.
dwActualSize !=
sizeof(DD_GETD3DQUERYDATA))
752 {
753 DPRINT1(
"Driver returned an invalid DD_GETD3DQUERYDATA structure - aborting");
755 }
756
757 *pD3dQueryList = D3dQueryData.QueryType;
758 ++pD3dQueryList;
759 }
760 }
761 }
762 }
763
764
768
769
770 {
772 DrvInfo.
guidInfo = GUID_D3DExtendedCaps;
774 DrvInfo.
lpvData = pD3dExtendedCaps;
776
778 {
779 DPRINT1(
"Driver failed call to GetDriverInfo() with: GUID_D3DExtendedCaps");
781 }
782 }
783
784
785 {
787
789 DrvInfo.
guidInfo = GUID_ZPixelFormats;
791 DrvInfo.
lpvData = pZPixelFormats;
793
795 {
796 DPRINT1(
"Driver failed call to GetDriverInfo() with: GUID_ZPixelFormats");
799 }
800
801 *pNumZStencilFormats = FormatCountData.dwFormatCount;
802
803 if (pD3dZStencilFormatList !=
NULL)
804 memcpy(pD3dZStencilFormatList, pZPixelFormats, FormatCountData.dwFormatCount *
sizeof(
DDPIXELFORMAT));
805
807 }
808
809
810 {
815
817 {
819 {
821 }
823 {
825 }
826 }
827
833 }
834
835
837
838
839 {
842
845
848 {
850 }
851 else
852 {
853 DPRINT1(
"Could not get monitor information");
854 }
855 }
856
859
860 if (
FALSE == bDX8Mode)
861 {
863
865 {
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.");
868 }
869 }
870 else
871 {
873
875 {
878 }
879 }
880
882}
#define D3DVTXPCAPS_NO_VSDT_UBYTE4
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)
DWORD WINAPI OsThunkDdGetDriverInfo(HANDLE hDirectDraw, PDD_GETDRIVERINFODATA puGetDriverInfoData)
#define D3D9_INT_D3DCAPS9_VALID
#define D3D9_INT_D3DCAPS8_VALID
DWORD WINAPI D3d9GetAvailDriverMemory(LPD3D9_GETAVAILDRIVERMEMORYDATA pData)
static void PrepareDriverInfoData(DD_GETDRIVERINFODATA *DrvInfo, LPVOID pData, DWORD dwExpectedSize)
static void ResetGetDriverInfo2Data(DD_GETDRIVERINFO2DATA *DrvInfo2, DWORD dwType, DWORD dwExpectedSize)
struct _D3DHAL_D3DEXTENDEDCAPS D3DHAL_D3DEXTENDEDCAPS
#define DD_RUNTIME_VERSION
#define DDHALINFO_GETDRIVERINFO2
#define D3DFORMAT_OP_PIXELSIZE
BOOL GetAdapterMode(LPCSTR lpszDeviceName, D3DDISPLAYMODE *pMode)
HMONITOR GetAdapterMonitor(LPCSTR lpszDeviceName)
#define memcpy(s1, s2, n)
struct _DD_GETDRIVERINFODATA DD_GETDRIVERINFODATA
struct _DDPIXELFORMAT DDPIXELFORMAT
#define DDCAPS2_AUTOFLIPOVERLAY
D3DFORMAT RawDisplayFormat
ULONG ulUniqueAdapterGroupId
HLOCAL swDDICreateDirectDrawObject
D3DFORMAT RawDisplayFormat
DWORD VertexProcessingCaps
DWORD dwNumTextureFormats
D3DNTHALDEVICEDESC_V1 hwCaps
DDPIXELFORMAT ddpfDisplay
LPD3D9_GETAVAILDRIVERMEMORY DdGetAvailDriverMemory
BOOL WINAPI GetMonitorInfoA(_In_ HMONITOR, _Inout_ LPMONITORINFO)
struct tagMONITORINFO MONITORINFO