1 /****************************************************************************
3 * Mesa 3-D graphics library
4 * Direct3D Driver Interface
6 * ========================================================================
8 * Copyright (C) 1991-2004 SciTech Software, Inc. All rights reserved.
10 * Permission is hereby granted, free of charge, to any person obtaining a
11 * copy of this software and associated documentation files (the "Software"),
12 * to deal in the Software without restriction, including without limitation
13 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
14 * and/or sell copies of the Software, and to permit persons to whom the
15 * Software is furnished to do so, subject to the following conditions:
17 * The above copyright notice and this permission notice shall be included
18 * in all copies or substantial portions of the Software.
20 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
23 * SCITECH SOFTWARE INC BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
24 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
25 * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28 * ======================================================================
31 * Environment: Windows 9x (Win32)
33 * Description: GLDirect utility for determining lame boards/drivers.
35 ****************************************************************************/
38 #define WIN32_LEAN_AND_MEAN
42 Ack. Broken out from gldlame.c because of broken D3D headers. KeithH
45 /****************************************************************************
47 Scans list of DirectDraw devices for specific device IDs.
48 ****************************************************************************/
50 #define VENDORID_ATI 0x1002
52 static DWORD devATIRagePro[] = {
53 0x4742, // 3D RAGE PRO BGA AGP 1X/2X
54 0x4744, // 3D RAGE PRO BGA AGP 1X only
55 0x4749, // 3D RAGE PRO BGA PCI 33 MHz
56 0x4750, // 3D RAGE PRO PQFP PCI 33 MHz
57 0x4751, // 3D RAGE PRO PQFP PCI 33 MHz limited 3D
58 0x4C42, // 3D RAGE LT PRO BGA-312 AGP 133 MHz
59 0x4C44, // 3D RAGE LT PRO BGA-312 AGP 66 MHz
60 0x4C49, // 3D RAGE LT PRO BGA-312 PCI 33 MHz
61 0x4C50, // 3D RAGE LT PRO BGA-256 PCI 33 MHz
62 0x4C51, // 3D RAGE LT PRO BGA-256 PCI 33 MHz limited 3D
65 static DWORD devATIRageIIplus[] = {
66 0x4755, // 3D RAGE II+
67 0x4756, // 3D RAGE IIC PQFP PCI
68 0x4757, // 3D RAGE IIC BGA AGP
69 0x475A, // 3D RAGE IIC PQFP AGP
70 0x4C47, // 3D RAGE LT-G
73 static __inline BOOL IsDevice(
74 DWORD *lpDeviceIdList,
80 for (i=0; i<count; i++)
81 if (dwDeviceId == lpDeviceIdList[i])
87 /****************************************************************************
89 Test the Direct3D8 device for "lameness" with respect to GLDirect.
90 This is done on per-chipset basis, as in GLD CAD driver (DGLCONTEXT.C).
91 If bTestForWHQL is set then the device is tested to see if it is
92 certified, and bIsWHQL is set to indicate TRUE or FALSE. Otherwise bIsWHQL
93 is not set. [WHQL = Windows Hardware Quality Labs]
95 NOTE: There is a one- or two-second time penalty incurred in determining
96 the WHQL certification date.
97 ****************************************************************************/
104 DWORD dwFlags = bTestForWHQL ? 0 : D3DENUM_NO_WHQL_LEVEL;
105 D3DADAPTER_IDENTIFIER8 d3dai;
108 hr = IDirect3D8_GetAdapterIdentifier(pD3D, dwAdapter, dwFlags, &d3dai);
110 return TRUE; // Definitely lame if adapter details can't be obtained!
113 *bIsWHQL = d3dai.WHQLLevel ? TRUE : FALSE;
117 if (d3dai.VendorId == VENDORID_ATI) {
118 // Test A: ATI Rage PRO
119 if (IsDevice(devATIRagePro, d3dai.DeviceId, sizeof(devATIRagePro)))
120 return TRUE; // bad mipmapping
121 // Test B: ATI Rage II+
122 if (IsDevice(devATIRageIIplus, d3dai.DeviceId, sizeof(devATIRageIIplus)))
123 return TRUE; // bad HW alpha testing
129 /****************************************************************************
131 Test the Direct3DDevice8 device for "lameness" with respect to GLDirect.
132 This is done by querying for particular caps, as in GLD CPL (CPLMAIN.CPP).
133 ****************************************************************************/
134 BOOL IsThisD3D8DeviceLame(
135 IDirect3DDevice8 *pDev)
140 hr = IDirect3DDevice8_GetDeviceCaps(pDev, &d3dCaps);
144 // Test 1: Perspective-correct textures
145 // Any card that cannot do perspective-textures is *exceptionally* lame.
146 if (!(d3dCaps.TextureCaps & D3DPTEXTURECAPS_PERSPECTIVE)) {
147 return TRUE; // Lame!
150 // Test 2: Bilinear filtering
151 if (!(d3dCaps.TextureFilterCaps & D3DPTFILTERCAPS_MINFLINEAR)) {
152 return TRUE; // Lame!
155 // Test 3: Mipmapping
156 if (!(d3dCaps.TextureCaps & D3DPTEXTURECAPS_MIPMAP)) {
157 return TRUE; // Lame!
160 // Test 4: Depth-test modes (?)
162 // Test 5: Blend Modes -- Based on DX7 D3DIM MTEXTURE.CPP caps test
164 // Accept devices that can do multipass, alpha blending
165 if( !((d3dCaps.DestBlendCaps & D3DPBLENDCAPS_INVSRCALPHA) &&
166 (d3dCaps.SrcBlendCaps & D3DPBLENDCAPS_SRCALPHA)) )
169 // Accept devices that can do multipass, color blending
170 if( !((d3dCaps.DestBlendCaps & D3DPBLENDCAPS_SRCCOLOR) &&
171 (d3dCaps.SrcBlendCaps & D3DPBLENDCAPS_ZERO)) )
174 // Accept devices that really support multiple textures.
175 if( !((d3dCaps.MaxTextureBlendStages > 1 ) &&
176 (d3dCaps.MaxSimultaneousTextures > 1 ) &&
177 (d3dCaps.TextureOpCaps & D3DTEXOPCAPS_MODULATE )) )
180 return FALSE; // Not lame