44#pragma warning (disable : 4201)
50#define DXLOG(n) CapsWorkString.Format n ; CapsLog+=CapsWorkString;
51#define COMPACTLOG(n) CapsWorkString.Format n ; CompactLog+=CapsWorkString;
53static const char* VendorNames[]={
88static const char* DeviceNamesNVidia[]={
89 "Unknown NVidia device",
118 "GeForce4 Go 420 32M",
119 "GeForce4 Go 440 64M",
123 "GeForce2 Integrated",
125 "Quadro2 MXR//EX//GO",
126 "GeFORCE2_MX 100//200",
131static const char* DeviceNamesATI[]={
132 "Unknown ATI Device",
138 "Rage 128 Mobility M3",
139 "Rage 128 Mobility M4",
140 "Rage 128 PRO ULTRA",
149 "Mobility Radeon VE(M6)",
158static const char* DeviceNames3DLabs[]={
159 "Unknown 3DLabs Device",
177static const char* DeviceNames3Dfx[]={
178 "Unknown 3Dfx Device",
187static const char* DeviceNamesMatrox[]={
188 "Unknown Matrox Device",
203static const char* DeviceNamesPowerVR[]={
204 "Unknown PowerVR Device",
208static const char* DeviceNamesS3[]={
215static const char* DeviceNamesIntel[]={
216 "Unknown Intel Device",
467 IDirect3D8* direct3d,
468 IDirect3DDevice8* D3DDevice,
470 const D3DADAPTER_IDENTIFIER8& adapter_id)
476 Init_Caps(D3DDevice);
481 IDirect3D8* direct3d,
482 const D3DCAPS8& caps,
484 const D3DADAPTER_IDENTIFIER8& adapter_id)
491 if ((Caps.DevCaps&D3DDEVCAPS_HWTRANSFORMANDLIGHT)==D3DDEVCAPS_HWTRANSFORMANDLIGHT) {
504 CapsWorkString.Release_Resources();
513void DX8Caps::Init_Caps(IDirect3DDevice8* D3DDevice)
515 D3DDevice->SetRenderState(D3DRS_SOFTWAREVERTEXPROCESSING,
TRUE);
518 if ((Caps.DevCaps&D3DDEVCAPS_HWTRANSFORMANDLIGHT)==D3DDEVCAPS_HWTRANSFORMANDLIGHT) {
521 D3DDevice->SetRenderState(D3DRS_SOFTWAREVERTEXPROCESSING,
FALSE);
542 DXLOG((
"Video Card: %s\r\n",adapter_id.Description));
543 DXLOG((
"Driver: %s\r\n",adapter_id.Driver));
545 DriverDLL=adapter_id.Driver;
546 int Product = HIWORD(adapter_id.DriverVersion.HighPart);
547 int Version = LOWORD(adapter_id.DriverVersion.HighPart);
548 int SubVersion = HIWORD(adapter_id.DriverVersion.LowPart);
549 DriverBuildVersion = LOWORD(adapter_id.DriverVersion.LowPart);
551 DXLOG((
"Product=%d, Version=%d, SubVersion=%d, Build=%d\r\n",Product,
Version, SubVersion, DriverBuildVersion));
553 VendorId=Define_Vendor(adapter_id.VendorId);
559 DXLOG((
"Video Card Chip Vendor: %s\r\n",VendorNames[VendorId]));
560 DXLOG((
"Type of chip: "));
569 DeviceId=(unsigned)Get_NVidia_Device(adapter_id.DeviceId);
570 DXLOG((DeviceNamesNVidia[DeviceId]));
574 DeviceId=(unsigned)Get_ATI_Device(adapter_id.DeviceId);
575 DXLOG((DeviceNamesATI[DeviceId]));
579 DeviceId=(unsigned)Get_Intel_Device(adapter_id.DeviceId);
580 DXLOG((DeviceNamesIntel[DeviceId]));
584 DeviceId=(unsigned)Get_S3_Device(adapter_id.DeviceId);
585 DXLOG((DeviceNamesS3[DeviceId]));
589 DeviceId=(unsigned)Get_PowerVR_Device(adapter_id.DeviceId);
590 DXLOG((DeviceNamesPowerVR[DeviceId]));
594 DeviceId=(unsigned)Get_Matrox_Device(adapter_id.DeviceId);
595 DXLOG((DeviceNamesMatrox[DeviceId]));
599 DeviceId=(unsigned)Get_3Dfx_Device(adapter_id.DeviceId);
600 DXLOG((DeviceNames3Dfx[DeviceId]));
604 DeviceId=(unsigned)Get_3DLabs_Device(adapter_id.DeviceId);
605 DXLOG((DeviceNames3DLabs[DeviceId]));
614 DXLOG((
"Vendor id: 0x%x\r\n",adapter_id.VendorId));
615 DXLOG((
"Device id: 0x%x\r\n",adapter_id.DeviceId));
616 DXLOG((
"SubSys id: 0x%x\r\n",adapter_id.SubSysId));
617 DXLOG((
"Revision: %d\r\n",adapter_id.Revision));
619 DXLOG((
"GUID = {0x%x, 0x%x, 0x%x}, {0x%2.2x, 0x%2.2x, 0x%2.2x, 0x%2.2x, 0x%2.2x, 0x%2.2x, 0x%2.2x, 0x%2.2x}\r\n",
620 adapter_id.DeviceIdentifier.Data1,
621 adapter_id.DeviceIdentifier.Data2,
622 adapter_id.DeviceIdentifier.Data3,
623 adapter_id.DeviceIdentifier.Data4[0],
624 adapter_id.DeviceIdentifier.Data4[1],
625 adapter_id.DeviceIdentifier.Data4[2],
626 adapter_id.DeviceIdentifier.Data4[3],
627 adapter_id.DeviceIdentifier.Data4[4],
628 adapter_id.DeviceIdentifier.Data4[5],
629 adapter_id.DeviceIdentifier.Data4[6],
630 adapter_id.DeviceIdentifier.Data4[7]));
633 SupportPointSprites = (Caps.MaxPointSize > 1.0f);
634 SupportNPatches = ((Caps.DevCaps&D3DDEVCAPS_NPATCHES)==D3DDEVCAPS_NPATCHES);
635 SupportZBias = ((Caps.RasterCaps&D3DPRASTERCAPS_ZBIAS)==D3DPRASTERCAPS_ZBIAS);
636 supportGamma=((Caps.Caps2&D3DCAPS2_FULLSCREENGAMMA)==D3DCAPS2_FULLSCREENGAMMA);
637 SupportModAlphaAddClr = (Caps.TextureOpCaps & D3DTEXOPCAPS_MODULATEALPHA_ADDCOLOR) == D3DTEXOPCAPS_MODULATEALPHA_ADDCOLOR;
638 SupportDot3=(Caps.TextureOpCaps & D3DTEXOPCAPS_DOTPRODUCT3) == D3DTEXOPCAPS_DOTPRODUCT3;
639 SupportCubemaps=(Caps.TextureCaps & D3DPTEXTURECAPS_CUBEMAP) == D3DPTEXTURECAPS_CUBEMAP;
640 SupportAnisotropicFiltering=
641 (Caps.TextureFilterCaps&D3DPTFILTERCAPS_MAGFANISOTROPIC) && (Caps.TextureFilterCaps&D3DPTFILTERCAPS_MINFANISOTROPIC);
643 DXLOG((
"Hardware T&L support: %s\r\n",SupportTnL ?
"Yes" :
"No"));
644 DXLOG((
"NPatch support: %s\r\n",SupportNPatches ?
"Yes" :
"No"));
645 DXLOG((
"ZBias support: %s\r\n",SupportZBias ?
"Yes" :
"No"));
646 DXLOG((
"Gamma support: %s\r\n",supportGamma ?
"Yes" :
"No"));
647 DXLOG((
"ModAlphaAddClr support: %s\r\n",SupportModAlphaAddClr ?
"Yes" :
"No"));
648 DXLOG((
"Dot3 support: %s\r\n",SupportDot3 ?
"Yes" :
"No"));
649 DXLOG((
"Anisotropic filtering support: %s\r\n",SupportAnisotropicFiltering ?
"Yes" :
"No"));
651 Check_Texture_Format_Support(display_format,Caps);
652 Check_Render_To_Texture_Support(display_format,Caps);
653 Check_Depth_Stencil_Support(display_format,Caps);
654 Check_Texture_Compression_Support(Caps);
655 Check_Bumpmap_Support(Caps);
656 Check_Shader_Support(Caps);
657 Check_Driver_Version_Status();
658 Check_Maximum_Texture_Support(Caps);
660 MaxTexturesPerPass=Caps.MaxSimultaneousTextures;
662 DXLOG((
"Max textures per pass: %d\r\n",MaxTexturesPerPass));
664 Vendor_Specific_Hacks(adapter_id);
674void DX8Caps::Check_Bumpmap_Support(
const D3DCAPS8& caps)
676 SupportBumpEnvmap=!!(caps.TextureOpCaps & D3DTEXOPCAPS_BUMPENVMAP);
677 SupportBumpEnvmapLuminance=!!(caps.TextureOpCaps & D3DTEXOPCAPS_BUMPENVMAPLUMINANCE);
678 DXLOG((
"Bumpmap support: %s\r\n",SupportBumpEnvmap ?
"Yes" :
"No"));
679 DXLOG((
"Bumpmap luminance support: %s\r\n",SupportBumpEnvmapLuminance ?
"Yes" :
"No"));
688void DX8Caps::Check_Texture_Compression_Support(
const D3DCAPS8& caps)
695 DXLOG((
"Texture compression support: %s\r\n",SupportDXTC ?
"Yes" :
"No"));
698void DX8Caps::Check_Texture_Format_Support(
WW3DFormat display_format,
const D3DCAPS8& caps)
702 SupportTextureFormat[i]=
false;
709 SupportTextureFormat[i]=
false;
713 SupportTextureFormat[i]=SUCCEEDED(
714 Direct3D->CheckDeviceFormat(
721 if (SupportTextureFormat[i]) {
722 StringClass name(0,
true);
724 DXLOG((
"Supports texture format: %s\r\n",name));
730void DX8Caps::Check_Render_To_Texture_Support(
WW3DFormat display_format,
const D3DCAPS8& caps)
734 SupportRenderToTextureFormat[i]=
false;
741 SupportRenderToTextureFormat[i]=
false;
745 SupportRenderToTextureFormat[i]=SUCCEEDED(
746 Direct3D->CheckDeviceFormat(
750 D3DUSAGE_RENDERTARGET,
753 if (SupportRenderToTextureFormat[i]) {
754 StringClass name(0,
true);
756 DXLOG((
"Supports render-to-texture format: %s\r\n",name));
766void DX8Caps::Check_Depth_Stencil_Support(
WW3DFormat display_format,
const D3DCAPS8& caps)
772 SupportDepthStencilFormat[i]=
false;
783 SupportDepthStencilFormat[i]=
false;
788 SupportDepthStencilFormat[i]=SUCCEEDED
790 Direct3D->CheckDeviceFormat
795 D3DUSAGE_DEPTHSTENCIL,
801 if (SupportDepthStencilFormat[i])
803 StringClass name(0,
true);
805 DXLOG((
"Supports depth stencil format: %s\r\n",name));
811void DX8Caps::Check_Maximum_Texture_Support(
const D3DCAPS8& caps)
813 MaxSimultaneousTextures=caps.MaxSimultaneousTextures;
816void DX8Caps::Check_Shader_Support(
const D3DCAPS8& caps)
818 VertexShaderVersion=caps.VertexShaderVersion;
819 PixelShaderVersion=caps.PixelShaderVersion;
820 DXLOG((
"Vertex shader version: %d.%d, pixel shader version: %d.%d\r\n",
821 (VertexShaderVersion>>8)&0xff,VertexShaderVersion&0xff,
822 (PixelShaderVersion>>8)&0xff,PixelShaderVersion&0xff));
825void DX8Caps::Check_Driver_Version_Status()
835 if (!stricmp(DriverDLL,
"nv4.dll")) {
836 switch (DriverBuildVersion) {
842 if (!stricmp(DriverDLL,
"nv4_disp.dll") || !stricmp(DriverDLL,
"nvdd32.dll")) {
843 switch (DriverBuildVersion) {
895 if (DriverBuildVersion<2000) {
904 if (!stricmp(DriverDLL,
"egdad.dll")) {
906 switch (DriverBuildVersion) {
915 if (!stricmp(DriverDLL,
"egliid.dll")) {
916 switch (DriverBuildVersion) {
926 if (!stricmp(DriverDLL,
"v66_disp.dll")) {
931 if (!stricmp(DriverDLL,
"ati2dvag.dll")) {
932 switch (DriverBuildVersion) {
950 if (!stricmp(DriverDLL,
"atid32ae.dll")) {
951 switch (DriverBuildVersion) {
956 if (!stricmp(DriverDLL,
"ati3drai.dll")) {
957 switch (DriverBuildVersion) {
964 if (!stricmp(DriverDLL,
"pmx2hal.dll")) {
965 switch (DriverBuildVersion) {
973 switch (DriverVersionStatus) {
976 DXLOG((
"Driver version status: Unknown\r\n"));
979 DXLOG((
"Driver version status: OK (No known problems)\r\n"));
982 DXLOG((
"Driver version status: Good\r\n"));
985 DXLOG((
"Driver version status: Bad (Driver update recommended)\r\n"));
993 if (MaxDisplayWidth==0 && MaxDisplayHeight==0)
return true;
995 if (width>MaxDisplayWidth || height>MaxDisplayHeight)
return false;
1006void DX8Caps::Vendor_Specific_Hacks(
const D3DADAPTER_IDENTIFIER8& adapter_id)
1010 if (SupportNPatches) {
1011 DXLOG((
"NVidia Driver reported N-Patch support, disabling.\r\n"));
1014 DXLOG((
"Disabling DXT1 support on NVidia hardware.\r\n"));
1017 SupportNPatches =
false;
1030 DXLOG((
"Maximum screen resolution limited to 1024 x 768 on NVidia GeForce2 mx/mx400 cards\r\n"));
1031 MaxDisplayWidth=1024;
1032 MaxDisplayHeight=768;
1043 DXLOG((
"ModAlphaAddClr disabled Matrox G400 and G550 cards (cannot put texture in 2nd arg)\r\n"));
1044 SupportModAlphaAddClr =
false;
1052 DXLOG((
"Disabling multitexturing on ATI Rage Pro\r\n"));
1053 MaxTexturesPerPass=1;
1054 CanDoMultiPass=
false;
1056 DXLOG((
"Disabling render-to-texture on Rage Pro\r\n"));
1058 SupportRenderToTextureFormat[i]=
false;
1068 CanDoMultiPass=
false;
1070 DXLOG((
"Disabling render-to-texture on ATI Rage 128 Pro GL\r\n"));
1072 SupportRenderToTextureFormat[i]=
false;
1086 DXLOG((
"Maximum screen resolution limited to 1280 x 1024 on ATI Rage 128 cards\r\n"));
1087 MaxDisplayWidth=1280;
1088 MaxDisplayHeight=1024;
1089 DXLOG((
"ModAlphaAddClr disabled ATI Rage 128 cards (cannot put texture in 2nd arg)\r\n"));
1090 SupportModAlphaAddClr =
false;
1100 DXLOG((
"Disabling render-to-texture on Radeon\r\n"));
1102 SupportRenderToTextureFormat[i]=
false;
1108 DXLOG((
"Disabling anisotropic filtering on Radeon VE\r\n"));
1109 SupportAnisotropicFiltering=
false;
1120 DXLOG((
"Disabling multitexturing on Voodoo2/Voodoo3/Banshee\r\n"));
1121 MaxTexturesPerPass=1;
1123 DXLOG((
"Maximum screen resolution limited to 1280 x 1024 on Voodoo2/Voodoo3/Banshee\r\n"));
1124 MaxDisplayWidth=1280;
1125 MaxDisplayHeight=1024;
1129 DXLOG((
"Disabling render-to-texture on Voodoo3\r\n"));
1131 SupportRenderToTextureFormat[i]=
false;
1137 DXLOG((
"Maximum screen resolution limited to 1280 x 1024 on PowerVR Kyro cards\r\n"));
1138 MaxDisplayWidth=1280;
1139 MaxDisplayHeight=1024;
1147 DXLOG((
"Maximum screen resolution limited to 1024 x 768 on S3 Savage 4 cards\r\n"));
1148 MaxDisplayWidth=800;
1149 MaxDisplayHeight=600;
1153 DXLOG((
"Disabling multitexturing on S3 Savage 2000\r\n"));
1154 MaxTexturesPerPass=1;
1155 CanDoMultiPass=
false;
@ DEVICE_NVIDIA_GEFORCE4_MX_420
@ DEVICE_NVIDIA_GEFORCE_DDR
@ DEVICE_NVIDIA_GEFORCE_256
@ DEVICE_NVIDIA_GEFORCE2_INTEGRATED
@ DEVICE_NVIDIA_GEFORCE2_MX_100_200
@ DEVICE_NVIDIA_GEFORCE4_GO_440
@ DEVICE_NVIDIA_QUADRO_DCC
@ DEVICE_NVIDIA_GEFORCE2_MX_400
@ DEVICE_NVIDIA_QUADRO2_MXR_EX_GO
@ DEVICE_NVIDIA_GEFORCE2_ULTRA
@ DEVICE_NVIDIA_GEFORCE4_TI
@ DEVICE_NVIDIA_GEFORCE3_TI_200
@ DEVICE_NVIDIA_TNT2_ULTRA
@ DEVICE_NVIDIA_GEFORCE4_GO_420_32M
@ DEVICE_NVIDIA_GEFORCE4_TI_4600
@ DEVICE_NVIDIA_TNT_VANTA
@ DEVICE_NVIDIA_GEFORCE4_MX_440
@ DEVICE_NVIDIA_GEFORCE4_MX_460
@ DEVICE_NVIDIA_GEFORCE4_GO
@ DEVICE_NVIDIA_GEFORCE4_TI_4200
@ DEVICE_NVIDIA_QUADRO2_PRO
@ DEVICE_NVIDIA_GEFORCE2_TI
@ DEVICE_NVIDIA_GEFORCE4_GO_440_64M
@ DEVICE_NVIDIA_GEFORCE4_TI_4400
@ DEVICE_NVIDIA_TNT2_ALADDIN
@ DEVICE_NVIDIA_GEFORCE2_GO
@ DEVICE_NVIDIA_GEFORCE4_GO_420
@ DEVICE_NVIDIA_TNT2_VANTA
@ DEVICE_NVIDIA_GEFORCE3_TI_500
@ DEVICE_NVIDIA_GEFORCE2_MX
@ DEVICE_NVIDIA_GEFORCE2_GTS
@ DEVICE_ATI_RAGE_128_MOBILITY
@ DEVICE_ATI_RAGE_128_MOBILITY_M4
@ DEVICE_ATI_RAGE_128_PRO_VR
@ DEVICE_ATI_RAGE_128_PRO_ULTRA
@ DEVICE_ATI_RAGE_128_PRO_GL
@ DEVICE_ATI_RAGE_IIC_AGP
@ DEVICE_ATI_RAGE_PRO_MOBILITY
@ DEVICE_ATI_MOBILITY_R7500
@ DEVICE_ATI_RAGE_128_MOBILITY_M3
@ DEVICE_ATI_RAGE_II_PLUS
@ DEVICE_ATI_MOBILITY_RADEON_VE_M6
@ DEVICE_ATI_RAGE_IIC_PCI
@ DEVICE_ATI_MOBILITY_RADEON
@ DEVICE_MATROX_PARHELIA_AGP8X
@ DEVICE_MATROX_MILLENNIUM_II_AGP
@ DEVICE_MATROX_MILLENNIUM_II_PCI
@ DEVICE_MATROX_MILLENNIUM
@ DEVICE_3DFX_VOODOO_GRAPHICS
@ DEVICE_3DFX_VOODOO_RUSH
@ DEVICE_3DFX_VOODOO_5500_AGP
bool Is_Valid_Display_Format(int width, int height, WW3DFormat format)
@ DEVICE_3DLABS_OXYGEN_VX1
@ DEVICE_3DLABS_PERMEDIA4
@ DEVICE_3DLABS_PERMEDIA2
@ DEVICE_3DLABS_PERMEDIA3
@ DEVICE_3DLABS_PERMEDIA2S_ST
static void Shutdown(void)
void Compute_Caps(WW3DFormat display_format, const D3DADAPTER_IDENTIFIER8 &adapter_id)
DX8Caps(IDirect3D8 *direct3d, const D3DCAPS8 &caps, WW3DFormat display_format, const D3DADAPTER_IDENTIFIER8 &adapter_id)