2 * Copyright 2002-2004 Jason Edmeades
3 * Copyright 2003-2004 Raphael Junqueira
4 * Copyright 2004 Christian Costa
5 * Copyright 2005 Oliver Stieber
6 * Copyright 2007-2008 Stefan Dösinger for CodeWeavers
7 * Copyright 2009-2011 Henri Verbeet for CodeWeavers
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
25 #include "wine/port.h"
27 #include "wined3d_private.h"
30 WINE_DEFAULT_DEBUG_CHANNEL(d3d
);
32 #define DEFAULT_REFRESH_RATE 0
34 enum wined3d_driver_model
43 /* The d3d device ID */
44 static const GUID IID_D3DDEVICE_D3DUID
= { 0xaeb2cdd4, 0x6e41, 0x43ea, { 0x94,0x1c,0x83,0x61,0xcc,0x76,0x07,0x81 } };
46 /**********************************************************
47 * Utility functions follow
48 **********************************************************/
50 const struct min_lookup minMipLookup
[] =
52 /* NONE POINT LINEAR */
53 {{GL_NEAREST
, GL_NEAREST
, GL_NEAREST
}}, /* NONE */
54 {{GL_NEAREST
, GL_NEAREST_MIPMAP_NEAREST
, GL_NEAREST_MIPMAP_LINEAR
}}, /* POINT*/
55 {{GL_LINEAR
, GL_LINEAR_MIPMAP_NEAREST
, GL_LINEAR_MIPMAP_LINEAR
}}, /* LINEAR */
58 const GLenum magLookup
[] =
60 /* NONE POINT LINEAR */
61 GL_NEAREST
, GL_NEAREST
, GL_LINEAR
,
64 /* Adjust the amount of used texture memory */
65 UINT64
adapter_adjust_memory(struct wined3d_adapter
*adapter
, INT64 amount
)
67 adapter
->vram_bytes_used
+= amount
;
68 TRACE("Adjusted used adapter memory by 0x%s to 0x%s.\n",
69 wine_dbgstr_longlong(amount
),
70 wine_dbgstr_longlong(adapter
->vram_bytes_used
));
71 return adapter
->vram_bytes_used
;
74 static void wined3d_adapter_cleanup(struct wined3d_adapter
*adapter
)
76 heap_free(adapter
->formats
);
77 heap_free(adapter
->cfgs
);
80 ULONG CDECL
wined3d_incref(struct wined3d
*wined3d
)
82 ULONG refcount
= InterlockedIncrement(&wined3d
->ref
);
84 TRACE("%p increasing refcount to %u.\n", wined3d
, refcount
);
89 ULONG CDECL
wined3d_decref(struct wined3d
*wined3d
)
91 ULONG refcount
= InterlockedDecrement(&wined3d
->ref
);
93 TRACE("%p decreasing refcount to %u.\n", wined3d
, refcount
);
99 for (i
= 0; i
< wined3d
->adapter_count
; ++i
)
101 wined3d_adapter_cleanup(&wined3d
->adapters
[i
]);
109 /* Certain applications (Steam) complain if we report an outdated driver version. In general,
110 * reporting a driver version is moot because we are not the Windows driver, and we have different
111 * bugs, features, etc.
113 * The driver version has the form "x.y.z.w".
115 * "x" is the Windows version the driver is meant for:
122 * "y" is the maximum Direct3D version the driver supports.
123 * y -> d3d version mapping:
132 * "z" is the subversion number.
134 * "w" is the vendor specific driver build number.
137 struct driver_version_information
139 enum wined3d_display_driver driver
;
140 enum wined3d_driver_model driver_model
;
141 const char *driver_name
; /* name of Windows driver */
142 WORD version
; /* version word ('y'), contained in low word of DriverVersion.HighPart */
143 WORD subversion
; /* subversion word ('z'), contained in high word of DriverVersion.LowPart */
144 WORD build
; /* build number ('w'), contained in low word of DriverVersion.LowPart */
147 /* The driver version table contains driver information for different devices on several OS versions. */
148 static const struct driver_version_information driver_version_table
[] =
151 * - Radeon HD2x00 (R600) and up supported by current drivers.
152 * - Radeon 9500 (R300) - X1*00 (R5xx) supported up to Catalyst 9.3 (Linux) and 10.2 (XP/Vista/Win7)
153 * - Radeon 7xxx (R100) - 9250 (RV250) supported up to Catalyst 6.11 (XP)
154 * - Rage 128 supported up to XP, latest official build 6.13.3279 dated October 2001 */
155 {DRIVER_AMD_RAGE_128PRO
, DRIVER_MODEL_NT5X
, "ati2dvaa.dll", 13, 3279, 0},
156 {DRIVER_AMD_R100
, DRIVER_MODEL_NT5X
, "ati2dvag.dll", 14, 10, 6614},
157 {DRIVER_AMD_R300
, DRIVER_MODEL_NT5X
, "ati2dvag.dll", 14, 10, 6764},
158 {DRIVER_AMD_R600
, DRIVER_MODEL_NT5X
, "ati2dvag.dll", 17, 10, 1280},
159 {DRIVER_AMD_R300
, DRIVER_MODEL_NT6X
, "atiumdag.dll", 14, 10, 741 },
160 {DRIVER_AMD_R600
, DRIVER_MODEL_NT6X
, "atiumdag.dll", 17, 10, 1280},
161 {DRIVER_AMD_RX
, DRIVER_MODEL_NT6X
, "aticfx32.dll", 17, 10, 1474},
164 * The drivers are unified but not all versions support all GPUs. At some point the 2k/xp
165 * drivers used ialmrnt5.dll for GMA800/GMA900 but at some point the file was renamed to
166 * igxprd32.dll but the GMA800 driver was never updated. */
167 {DRIVER_INTEL_GMA800
, DRIVER_MODEL_NT5X
, "ialmrnt5.dll", 14, 10, 3889},
168 {DRIVER_INTEL_GMA900
, DRIVER_MODEL_NT5X
, "igxprd32.dll", 14, 10, 4764},
169 {DRIVER_INTEL_GMA950
, DRIVER_MODEL_NT5X
, "igxprd32.dll", 14, 10, 4926},
170 {DRIVER_INTEL_GMA3000
, DRIVER_MODEL_NT5X
, "igxprd32.dll", 14, 10, 5218},
171 {DRIVER_INTEL_GMA950
, DRIVER_MODEL_NT6X
, "igdumd32.dll", 14, 10, 1504},
172 {DRIVER_INTEL_GMA3000
, DRIVER_MODEL_NT6X
, "igdumd32.dll", 15, 10, 1666},
173 {DRIVER_INTEL_HD4000
, DRIVER_MODEL_NT6X
, "igdumdim32.dll", 19, 15, 4352},
176 * - Geforce8 and newer is supported by the current 340.52 driver on XP-Win8
177 * - Geforce6 and 7 support is up to 307.83 on XP-Win8
178 * - GeforceFX support is up to 173.x on <= XP
179 * - Geforce2MX/3/4 up to 96.x on <= XP
180 * - TNT/Geforce1/2 up to 71.x on <= XP
181 * All version numbers used below are from the Linux nvidia drivers. */
182 {DRIVER_NVIDIA_TNT
, DRIVER_MODEL_NT5X
, "nv4_disp.dll", 14, 10, 7186},
183 {DRIVER_NVIDIA_GEFORCE2MX
, DRIVER_MODEL_NT5X
, "nv4_disp.dll", 14, 10, 9371},
184 {DRIVER_NVIDIA_GEFORCEFX
, DRIVER_MODEL_NT5X
, "nv4_disp.dll", 14, 11, 7516},
185 {DRIVER_NVIDIA_GEFORCE6
, DRIVER_MODEL_NT5X
, "nv4_disp.dll", 18, 13, 783},
186 {DRIVER_NVIDIA_GEFORCE8
, DRIVER_MODEL_NT5X
, "nv4_disp.dll", 18, 13, 4052},
187 {DRIVER_NVIDIA_GEFORCE6
, DRIVER_MODEL_NT6X
, "nvd3dum.dll", 18, 13, 783},
188 {DRIVER_NVIDIA_GEFORCE8
, DRIVER_MODEL_NT6X
, "nvd3dum.dll", 18, 13, 4052},
191 {DRIVER_VMWARE
, DRIVER_MODEL_NT5X
, "vm3dum.dll", 14, 1, 1134},
194 {DRIVER_WINE
, DRIVER_MODEL_GENERIC
, "wined3d.dll", 0, 0, 0},
197 /* The amount of video memory stored in the gpu description table is the minimum amount of video memory
198 * found on a board containing a specific GPU. */
199 static const struct wined3d_gpu_description gpu_description_table
[] =
202 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_RIVA_128
, "NVIDIA RIVA 128", DRIVER_NVIDIA_TNT
, 4 },
203 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_RIVA_TNT
, "NVIDIA RIVA TNT", DRIVER_NVIDIA_TNT
, 16 },
204 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_RIVA_TNT2
, "NVIDIA RIVA TNT2/TNT2 Pro", DRIVER_NVIDIA_TNT
, 32 },
205 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE
, "NVIDIA GeForce 256", DRIVER_NVIDIA_TNT
, 32 },
206 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE2
, "NVIDIA GeForce2 GTS/GeForce2 Pro", DRIVER_NVIDIA_TNT
, 32 },
207 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE2_MX
, "NVIDIA GeForce2 MX/MX 400", DRIVER_NVIDIA_GEFORCE2MX
,32 },
208 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE3
, "NVIDIA GeForce3", DRIVER_NVIDIA_GEFORCE2MX
,64 },
209 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE4_MX
, "NVIDIA GeForce4 MX 460", DRIVER_NVIDIA_GEFORCE2MX
,64 },
210 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE4_TI4200
, "NVIDIA GeForce4 Ti 4200", DRIVER_NVIDIA_GEFORCE2MX
,64, },
211 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCEFX_5200
, "NVIDIA GeForce FX 5200", DRIVER_NVIDIA_GEFORCEFX
, 64 },
212 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCEFX_5600
, "NVIDIA GeForce FX 5600", DRIVER_NVIDIA_GEFORCEFX
, 128 },
213 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCEFX_5800
, "NVIDIA GeForce FX 5800", DRIVER_NVIDIA_GEFORCEFX
, 256 },
214 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_6200
, "NVIDIA GeForce 6200", DRIVER_NVIDIA_GEFORCE6
, 64 },
215 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_6600GT
, "NVIDIA GeForce 6600 GT", DRIVER_NVIDIA_GEFORCE6
, 128 },
216 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_6800
, "NVIDIA GeForce 6800", DRIVER_NVIDIA_GEFORCE6
, 128 },
217 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_7300
, "NVIDIA GeForce Go 7300", DRIVER_NVIDIA_GEFORCE6
, 256 },
218 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_7400
, "NVIDIA GeForce Go 7400", DRIVER_NVIDIA_GEFORCE6
, 256 },
219 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_7600
, "NVIDIA GeForce 7600 GT", DRIVER_NVIDIA_GEFORCE6
, 256 },
220 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_7800GT
, "NVIDIA GeForce 7800 GT", DRIVER_NVIDIA_GEFORCE6
, 256 },
221 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_8200
, "NVIDIA GeForce 8200", DRIVER_NVIDIA_GEFORCE8
, 512 },
222 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_8300GS
, "NVIDIA GeForce 8300 GS", DRIVER_NVIDIA_GEFORCE8
, 128 },
223 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_8400GS
, "NVIDIA GeForce 8400 GS", DRIVER_NVIDIA_GEFORCE8
, 128 },
224 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_8500GT
, "NVIDIA GeForce 8500 GT", DRIVER_NVIDIA_GEFORCE8
, 256 },
225 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_8600GT
, "NVIDIA GeForce 8600 GT", DRIVER_NVIDIA_GEFORCE8
, 256 },
226 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_8600MGT
, "NVIDIA GeForce 8600M GT", DRIVER_NVIDIA_GEFORCE8
, 512 },
227 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_8800GTS
, "NVIDIA GeForce 8800 GTS", DRIVER_NVIDIA_GEFORCE8
, 320 },
228 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_8800GTX
, "NVIDIA GeForce 8800 GTX", DRIVER_NVIDIA_GEFORCE8
, 768 },
229 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_9200
, "NVIDIA GeForce 9200", DRIVER_NVIDIA_GEFORCE8
, 256 },
230 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_9300
, "NVIDIA GeForce 9300", DRIVER_NVIDIA_GEFORCE8
, 256 },
231 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_9400M
, "NVIDIA GeForce 9400M", DRIVER_NVIDIA_GEFORCE8
, 256 },
232 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_9400GT
, "NVIDIA GeForce 9400 GT", DRIVER_NVIDIA_GEFORCE8
, 256 },
233 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_9500GT
, "NVIDIA GeForce 9500 GT", DRIVER_NVIDIA_GEFORCE8
, 256 },
234 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_9600GT
, "NVIDIA GeForce 9600 GT", DRIVER_NVIDIA_GEFORCE8
, 512 },
235 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_9700MGT
, "NVIDIA GeForce 9700M GT", DRIVER_NVIDIA_GEFORCE8
, 512 },
236 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_9800GT
, "NVIDIA GeForce 9800 GT", DRIVER_NVIDIA_GEFORCE8
, 512 },
237 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_210
, "NVIDIA GeForce 210", DRIVER_NVIDIA_GEFORCE8
, 512 },
238 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT220
, "NVIDIA GeForce GT 220", DRIVER_NVIDIA_GEFORCE8
, 512 },
239 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT240
, "NVIDIA GeForce GT 240", DRIVER_NVIDIA_GEFORCE8
, 512 },
240 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTS250
, "NVIDIA GeForce GTS 250", DRIVER_NVIDIA_GEFORCE8
, 1024},
241 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX260
, "NVIDIA GeForce GTX 260", DRIVER_NVIDIA_GEFORCE8
, 1024},
242 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX275
, "NVIDIA GeForce GTX 275", DRIVER_NVIDIA_GEFORCE8
, 896 },
243 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX280
, "NVIDIA GeForce GTX 280", DRIVER_NVIDIA_GEFORCE8
, 1024},
244 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_315M
, "NVIDIA GeForce 315M", DRIVER_NVIDIA_GEFORCE8
, 512 },
245 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_320M
, "NVIDIA GeForce 320M", DRIVER_NVIDIA_GEFORCE8
, 256},
246 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT320M
, "NVIDIA GeForce GT 320M", DRIVER_NVIDIA_GEFORCE8
, 1024},
247 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT325M
, "NVIDIA GeForce GT 325M", DRIVER_NVIDIA_GEFORCE8
, 1024},
248 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT330
, "NVIDIA GeForce GT 330", DRIVER_NVIDIA_GEFORCE8
, 1024},
249 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTS350M
, "NVIDIA GeForce GTS 350M", DRIVER_NVIDIA_GEFORCE8
, 1024},
250 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_410M
, "NVIDIA GeForce 410M", DRIVER_NVIDIA_GEFORCE8
, 512},
251 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT420
, "NVIDIA GeForce GT 420", DRIVER_NVIDIA_GEFORCE8
, 2048},
252 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT425M
, "NVIDIA GeForce GT 425M", DRIVER_NVIDIA_GEFORCE8
, 1024},
253 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT430
, "NVIDIA GeForce GT 430", DRIVER_NVIDIA_GEFORCE8
, 1024},
254 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT440
, "NVIDIA GeForce GT 440", DRIVER_NVIDIA_GEFORCE8
, 1024},
255 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTS450
, "NVIDIA GeForce GTS 450", DRIVER_NVIDIA_GEFORCE8
, 1024},
256 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX460
, "NVIDIA GeForce GTX 460", DRIVER_NVIDIA_GEFORCE8
, 768 },
257 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX460M
, "NVIDIA GeForce GTX 460M", DRIVER_NVIDIA_GEFORCE8
, 1536},
258 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX465
, "NVIDIA GeForce GTX 465", DRIVER_NVIDIA_GEFORCE8
, 1024},
259 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX470
, "NVIDIA GeForce GTX 470", DRIVER_NVIDIA_GEFORCE8
, 1280},
260 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX480
, "NVIDIA GeForce GTX 480", DRIVER_NVIDIA_GEFORCE8
, 1536},
261 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT520
, "NVIDIA GeForce GT 520", DRIVER_NVIDIA_GEFORCE8
, 1024},
262 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT525M
, "NVIDIA GeForce GT 525M", DRIVER_NVIDIA_GEFORCE8
, 1024},
263 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT540M
, "NVIDIA GeForce GT 540M", DRIVER_NVIDIA_GEFORCE8
, 1024},
264 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX550
, "NVIDIA GeForce GTX 550 Ti", DRIVER_NVIDIA_GEFORCE8
, 1024},
265 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT555M
, "NVIDIA GeForce GT 555M", DRIVER_NVIDIA_GEFORCE8
, 1024},
266 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX560TI
, "NVIDIA GeForce GTX 560 Ti", DRIVER_NVIDIA_GEFORCE8
, 1024},
267 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX560M
, "NVIDIA GeForce GTX 560M", DRIVER_NVIDIA_GEFORCE8
, 3072},
268 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX560
, "NVIDIA GeForce GTX 560", DRIVER_NVIDIA_GEFORCE8
, 1024},
269 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX570
, "NVIDIA GeForce GTX 570", DRIVER_NVIDIA_GEFORCE8
, 1280},
270 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX580
, "NVIDIA GeForce GTX 580", DRIVER_NVIDIA_GEFORCE8
, 1536},
271 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT610
, "NVIDIA GeForce GT 610", DRIVER_NVIDIA_GEFORCE8
, 1024},
272 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT630
, "NVIDIA GeForce GT 630", DRIVER_NVIDIA_GEFORCE8
, 1024},
273 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT630M
, "NVIDIA GeForce GT 630M", DRIVER_NVIDIA_GEFORCE8
, 1024},
274 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT640M
, "NVIDIA GeForce GT 640M", DRIVER_NVIDIA_GEFORCE8
, 1024},
275 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT650M
, "NVIDIA GeForce GT 650M", DRIVER_NVIDIA_GEFORCE8
, 2048},
276 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX650
, "NVIDIA GeForce GTX 650", DRIVER_NVIDIA_GEFORCE8
, 1024},
277 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX650TI
, "NVIDIA GeForce GTX 650 Ti", DRIVER_NVIDIA_GEFORCE8
, 1024},
278 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX660
, "NVIDIA GeForce GTX 660", DRIVER_NVIDIA_GEFORCE8
, 2048},
279 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX660M
, "NVIDIA GeForce GTX 660M", DRIVER_NVIDIA_GEFORCE8
, 2048},
280 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX660TI
, "NVIDIA GeForce GTX 660 Ti", DRIVER_NVIDIA_GEFORCE8
, 2048},
281 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX670
, "NVIDIA GeForce GTX 670", DRIVER_NVIDIA_GEFORCE8
, 2048},
282 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX670MX
, "NVIDIA GeForce GTX 670MX", DRIVER_NVIDIA_GEFORCE8
, 3072},
283 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX675MX
, "NVIDIA GeForce GTX 675MX", DRIVER_NVIDIA_GEFORCE8
, 4096},
284 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX680
, "NVIDIA GeForce GTX 680", DRIVER_NVIDIA_GEFORCE8
, 2048},
285 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX690
, "NVIDIA GeForce GTX 690", DRIVER_NVIDIA_GEFORCE8
, 2048},
286 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT730
, "NVIDIA GeForce GT 730", DRIVER_NVIDIA_GEFORCE8
, 2048},
287 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT730M
, "NVIDIA GeForce GT 730M", DRIVER_NVIDIA_GEFORCE8
, 1024},
288 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT740M
, "NVIDIA GeForce GT 740M", DRIVER_NVIDIA_GEFORCE8
, 2048},
289 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT750M
, "NVIDIA GeForce GT 750M", DRIVER_NVIDIA_GEFORCE8
, 1024},
290 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX750
, "NVIDIA GeForce GTX 750", DRIVER_NVIDIA_GEFORCE8
, 1024},
291 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX750TI
, "NVIDIA GeForce GTX 750 Ti", DRIVER_NVIDIA_GEFORCE8
, 2048},
292 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX760
, "NVIDIA GeForce GTX 760", DRIVER_NVIDIA_GEFORCE8
, 2048},
293 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX760TI
, "NVIDIA GeForce GTX 760 Ti", DRIVER_NVIDIA_GEFORCE8
, 2048},
294 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX765M
, "NVIDIA GeForce GTX 765M", DRIVER_NVIDIA_GEFORCE8
, 2048},
295 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX770M
, "NVIDIA GeForce GTX 770M", DRIVER_NVIDIA_GEFORCE8
, 3072},
296 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX770
, "NVIDIA GeForce GTX 770", DRIVER_NVIDIA_GEFORCE8
, 2048},
297 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX780
, "NVIDIA GeForce GTX 780", DRIVER_NVIDIA_GEFORCE8
, 3072},
298 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX780TI
, "NVIDIA GeForce GTX 780 Ti", DRIVER_NVIDIA_GEFORCE8
, 3072},
299 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTXTITAN
, "NVIDIA GeForce GTX TITAN", DRIVER_NVIDIA_GEFORCE8
, 6144},
300 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTXTITANB
, "NVIDIA GeForce GTX TITAN Black", DRIVER_NVIDIA_GEFORCE8
, 6144},
301 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTXTITANX
, "NVIDIA GeForce GTX TITAN X", DRIVER_NVIDIA_GEFORCE8
, 12288},
302 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTXTITANZ
, "NVIDIA GeForce GTX TITAN Z", DRIVER_NVIDIA_GEFORCE8
, 12288},
303 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_820M
, "NVIDIA GeForce 820M", DRIVER_NVIDIA_GEFORCE8
, 2048},
304 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_830M
, "NVIDIA GeForce 830M", DRIVER_NVIDIA_GEFORCE8
, 2048},
305 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_840M
, "NVIDIA GeForce 840M", DRIVER_NVIDIA_GEFORCE8
, 2048},
306 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_845M
, "NVIDIA GeForce 845M", DRIVER_NVIDIA_GEFORCE8
, 2048},
307 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX850M
, "NVIDIA GeForce GTX 850M", DRIVER_NVIDIA_GEFORCE8
, 2048},
308 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX860M
, "NVIDIA GeForce GTX 860M", DRIVER_NVIDIA_GEFORCE8
, 2048},
309 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX870M
, "NVIDIA GeForce GTX 870M", DRIVER_NVIDIA_GEFORCE8
, 3072},
310 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX880M
, "NVIDIA GeForce GTX 880M", DRIVER_NVIDIA_GEFORCE8
, 4096},
311 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_940M
, "NVIDIA GeForce 940M", DRIVER_NVIDIA_GEFORCE8
, 4096},
312 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX950
, "NVIDIA GeForce GTX 950", DRIVER_NVIDIA_GEFORCE8
, 2048},
313 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX950M
, "NVIDIA GeForce GTX 950M", DRIVER_NVIDIA_GEFORCE8
, 4096},
314 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX960
, "NVIDIA GeForce GTX 960", DRIVER_NVIDIA_GEFORCE8
, 4096},
315 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX960M
, "NVIDIA GeForce GTX 960M", DRIVER_NVIDIA_GEFORCE8
, 2048},
316 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX970
, "NVIDIA GeForce GTX 970", DRIVER_NVIDIA_GEFORCE8
, 4096},
317 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX970M
, "NVIDIA GeForce GTX 970M", DRIVER_NVIDIA_GEFORCE8
, 3072},
318 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX980
, "NVIDIA GeForce GTX 980", DRIVER_NVIDIA_GEFORCE8
, 4096},
319 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX980TI
, "NVIDIA GeForce GTX 980 Ti", DRIVER_NVIDIA_GEFORCE8
, 6144},
320 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX1050
, "NVIDIA GeForce GTX 1050", DRIVER_NVIDIA_GEFORCE8
, 2048},
321 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX1050TI
, "NVIDIA GeForce GTX 1050 Ti", DRIVER_NVIDIA_GEFORCE8
, 4096},
322 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX1060
, "NVIDIA GeForce GTX 1060", DRIVER_NVIDIA_GEFORCE8
, 6144},
323 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX1070
, "NVIDIA GeForce GTX 1070", DRIVER_NVIDIA_GEFORCE8
, 8192},
324 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX1080
, "NVIDIA GeForce GTX 1080", DRIVER_NVIDIA_GEFORCE8
, 8192},
325 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX1080TI
, "NVIDIA GeForce GTX 1080 Ti", DRIVER_NVIDIA_GEFORCE8
, 11264},
326 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_TITANX_PASCAL
, "NVIDIA TITAN X (Pascal)", DRIVER_NVIDIA_GEFORCE8
, 12288},
327 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_TITANV
, "NVIDIA TITAN V", DRIVER_NVIDIA_GEFORCE8
, 12288},
330 {HW_VENDOR_AMD
, CARD_AMD_RAGE_128PRO
, "ATI Rage Fury", DRIVER_AMD_RAGE_128PRO
, 16 },
331 {HW_VENDOR_AMD
, CARD_AMD_RADEON_7200
, "ATI RADEON 7200 SERIES", DRIVER_AMD_R100
, 32 },
332 {HW_VENDOR_AMD
, CARD_AMD_RADEON_8500
, "ATI RADEON 8500 SERIES", DRIVER_AMD_R100
, 64 },
333 {HW_VENDOR_AMD
, CARD_AMD_RADEON_9500
, "ATI Radeon 9500", DRIVER_AMD_R300
, 64 },
334 {HW_VENDOR_AMD
, CARD_AMD_RADEON_XPRESS_200M
, "ATI RADEON XPRESS 200M Series", DRIVER_AMD_R300
, 64 },
335 {HW_VENDOR_AMD
, CARD_AMD_RADEON_X700
, "ATI Radeon X700 SE", DRIVER_AMD_R300
, 128 },
336 {HW_VENDOR_AMD
, CARD_AMD_RADEON_X1600
, "ATI Radeon X1600 Series", DRIVER_AMD_R300
, 128 },
337 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD2350
, "ATI Mobility Radeon HD 2350", DRIVER_AMD_R600
, 256 },
338 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD2600
, "ATI Mobility Radeon HD 2600", DRIVER_AMD_R600
, 256 },
339 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD2900
, "ATI Radeon HD 2900 XT", DRIVER_AMD_R600
, 512 },
340 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD3200
, "ATI Radeon HD 3200 Graphics", DRIVER_AMD_R600
, 128 },
341 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD3850
, "ATI Radeon HD 3850 AGP", DRIVER_AMD_R600
, 512 },
342 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD4200M
, "ATI Mobility Radeon HD 4200", DRIVER_AMD_R600
, 256 },
343 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD4350
, "ATI Radeon HD 4350", DRIVER_AMD_R600
, 256 },
344 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD4600
, "ATI Radeon HD 4600 Series", DRIVER_AMD_R600
, 512 },
345 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD4700
, "ATI Radeon HD 4700 Series", DRIVER_AMD_R600
, 512 },
346 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD4800
, "ATI Radeon HD 4800 Series", DRIVER_AMD_R600
, 512 },
347 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD5400
, "ATI Radeon HD 5400 Series", DRIVER_AMD_R600
, 512 },
348 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD5600
, "ATI Radeon HD 5600 Series", DRIVER_AMD_R600
, 512 },
349 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD5700
, "ATI Radeon HD 5700 Series", DRIVER_AMD_R600
, 512 },
350 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD5800
, "ATI Radeon HD 5800 Series", DRIVER_AMD_R600
, 1024},
351 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD5900
, "ATI Radeon HD 5900 Series", DRIVER_AMD_R600
, 1024},
352 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD6300
, "AMD Radeon HD 6300 series Graphics", DRIVER_AMD_R600
, 1024},
353 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD6400
, "AMD Radeon HD 6400 Series", DRIVER_AMD_R600
, 1024},
354 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD6410D
, "AMD Radeon HD 6410D", DRIVER_AMD_R600
, 1024},
355 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD6480G
, "AMD Radeon HD 6480G", DRIVER_AMD_R600
, 512 },
356 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD6550D
, "AMD Radeon HD 6550D", DRIVER_AMD_R600
, 1024},
357 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD6600
, "AMD Radeon HD 6600 Series", DRIVER_AMD_R600
, 1024},
358 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD6600M
, "AMD Radeon HD 6600M Series", DRIVER_AMD_R600
, 512 },
359 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD6700
, "AMD Radeon HD 6700 Series", DRIVER_AMD_R600
, 1024},
360 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD6800
, "AMD Radeon HD 6800 Series", DRIVER_AMD_R600
, 1024},
361 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD6900
, "AMD Radeon HD 6900 Series", DRIVER_AMD_R600
, 2048},
362 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD7660D
, "AMD Radeon HD 7660D", DRIVER_AMD_R600
, 2048},
363 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD7700
, "AMD Radeon HD 7700 Series", DRIVER_AMD_R600
, 1024},
364 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD7800
, "AMD Radeon HD 7800 Series", DRIVER_AMD_R600
, 2048},
365 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD7900
, "AMD Radeon HD 7900 Series", DRIVER_AMD_R600
, 2048},
366 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD8600M
, "AMD Radeon HD 8600M Series", DRIVER_AMD_R600
, 1024},
367 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD8670
, "AMD Radeon HD 8670", DRIVER_AMD_R600
, 2048},
368 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD8770
, "AMD Radeon HD 8770", DRIVER_AMD_R600
, 2048},
369 {HW_VENDOR_AMD
, CARD_AMD_RADEON_R3
, "AMD Radeon HD 8400 / R3 Series", DRIVER_AMD_R600
, 2048},
370 {HW_VENDOR_AMD
, CARD_AMD_RADEON_R7
, "AMD Radeon(TM) R7 Graphics", DRIVER_AMD_R600
, 2048},
371 {HW_VENDOR_AMD
, CARD_AMD_RADEON_R9_285
, "AMD Radeon R9 285", DRIVER_AMD_RX
, 2048},
372 {HW_VENDOR_AMD
, CARD_AMD_RADEON_R9_290
, "AMD Radeon R9 290", DRIVER_AMD_RX
, 4096},
373 {HW_VENDOR_AMD
, CARD_AMD_RADEON_R9_FURY
, "AMD Radeon (TM) R9 Fury Series", DRIVER_AMD_RX
, 4096},
374 {HW_VENDOR_AMD
, CARD_AMD_RADEON_RX_460
, "Radeon(TM) RX 460 Graphics", DRIVER_AMD_RX
, 4096},
375 {HW_VENDOR_AMD
, CARD_AMD_RADEON_RX_480
, "Radeon (TM) RX 480 Graphics", DRIVER_AMD_RX
, 4096},
376 {HW_VENDOR_AMD
, CARD_AMD_RADEON_RX_VEGA
, "Radeon RX Vega", DRIVER_AMD_RX
, 8192},
379 {HW_VENDOR_VMWARE
, CARD_VMWARE_SVGA3D
, "VMware SVGA 3D (Microsoft Corporation - WDDM)", DRIVER_VMWARE
, 1024},
382 {HW_VENDOR_INTEL
, CARD_INTEL_830M
, "Intel(R) 82830M Graphics Controller", DRIVER_INTEL_GMA800
, 32 },
383 {HW_VENDOR_INTEL
, CARD_INTEL_855GM
, "Intel(R) 82852/82855 GM/GME Graphics Controller", DRIVER_INTEL_GMA800
, 32 },
384 {HW_VENDOR_INTEL
, CARD_INTEL_845G
, "Intel(R) 845G", DRIVER_INTEL_GMA800
, 32 },
385 {HW_VENDOR_INTEL
, CARD_INTEL_865G
, "Intel(R) 82865G Graphics Controller", DRIVER_INTEL_GMA800
, 32 },
386 {HW_VENDOR_INTEL
, CARD_INTEL_915G
, "Intel(R) 82915G/GV/910GL Express Chipset Family", DRIVER_INTEL_GMA900
, 64 },
387 {HW_VENDOR_INTEL
, CARD_INTEL_E7221G
, "Intel(R) E7221G", DRIVER_INTEL_GMA900
, 64 },
388 {HW_VENDOR_INTEL
, CARD_INTEL_915GM
, "Mobile Intel(R) 915GM/GMS,910GML Express Chipset Family", DRIVER_INTEL_GMA900
, 64 },
389 {HW_VENDOR_INTEL
, CARD_INTEL_945G
, "Intel(R) 945G", DRIVER_INTEL_GMA950
, 64 },
390 {HW_VENDOR_INTEL
, CARD_INTEL_945GM
, "Mobile Intel(R) 945GM Express Chipset Family", DRIVER_INTEL_GMA950
, 64 },
391 {HW_VENDOR_INTEL
, CARD_INTEL_945GME
, "Intel(R) 945GME", DRIVER_INTEL_GMA950
, 64 },
392 {HW_VENDOR_INTEL
, CARD_INTEL_Q35
, "Intel(R) Q35", DRIVER_INTEL_GMA950
, 64 },
393 {HW_VENDOR_INTEL
, CARD_INTEL_G33
, "Intel(R) G33", DRIVER_INTEL_GMA950
, 64 },
394 {HW_VENDOR_INTEL
, CARD_INTEL_Q33
, "Intel(R) Q33", DRIVER_INTEL_GMA950
, 64 },
395 {HW_VENDOR_INTEL
, CARD_INTEL_PNVG
, "Intel(R) IGD", DRIVER_INTEL_GMA950
, 64 },
396 {HW_VENDOR_INTEL
, CARD_INTEL_PNVM
, "Intel(R) IGD", DRIVER_INTEL_GMA950
, 64 },
397 {HW_VENDOR_INTEL
, CARD_INTEL_965Q
, "Intel(R) 965Q", DRIVER_INTEL_GMA3000
, 128},
398 {HW_VENDOR_INTEL
, CARD_INTEL_965G
, "Intel(R) 965G", DRIVER_INTEL_GMA3000
, 128},
399 {HW_VENDOR_INTEL
, CARD_INTEL_946GZ
, "Intel(R) 946GZ", DRIVER_INTEL_GMA3000
, 128},
400 {HW_VENDOR_INTEL
, CARD_INTEL_965GM
, "Mobile Intel(R) 965 Express Chipset Family", DRIVER_INTEL_GMA3000
, 128},
401 {HW_VENDOR_INTEL
, CARD_INTEL_965GME
, "Intel(R) 965GME", DRIVER_INTEL_GMA3000
, 128},
402 {HW_VENDOR_INTEL
, CARD_INTEL_GM45
, "Mobile Intel(R) GM45 Express Chipset Family", DRIVER_INTEL_GMA3000
, 512},
403 {HW_VENDOR_INTEL
, CARD_INTEL_IGD
, "Intel(R) Integrated Graphics Device", DRIVER_INTEL_GMA3000
, 512},
404 {HW_VENDOR_INTEL
, CARD_INTEL_G45
, "Intel(R) G45/G43", DRIVER_INTEL_GMA3000
, 512},
405 {HW_VENDOR_INTEL
, CARD_INTEL_Q45
, "Intel(R) Q45/Q43", DRIVER_INTEL_GMA3000
, 512},
406 {HW_VENDOR_INTEL
, CARD_INTEL_G41
, "Intel(R) G41", DRIVER_INTEL_GMA3000
, 512},
407 {HW_VENDOR_INTEL
, CARD_INTEL_B43
, "Intel(R) B43", DRIVER_INTEL_GMA3000
, 512},
408 {HW_VENDOR_INTEL
, CARD_INTEL_ILKD
, "Intel(R) HD Graphics", DRIVER_INTEL_GMA3000
, 1536},
409 {HW_VENDOR_INTEL
, CARD_INTEL_ILKM
, "Intel(R) HD Graphics", DRIVER_INTEL_GMA3000
, 1536},
410 {HW_VENDOR_INTEL
, CARD_INTEL_SNBD
, "Intel(R) HD Graphics 3000", DRIVER_INTEL_GMA3000
, 1536},
411 {HW_VENDOR_INTEL
, CARD_INTEL_SNBM
, "Intel(R) HD Graphics 3000", DRIVER_INTEL_GMA3000
, 1536},
412 {HW_VENDOR_INTEL
, CARD_INTEL_SNBS
, "Intel(R) HD Graphics Family", DRIVER_INTEL_GMA3000
, 1536},
413 {HW_VENDOR_INTEL
, CARD_INTEL_IVBD
, "Intel(R) HD Graphics 4000", DRIVER_INTEL_HD4000
, 1536},
414 {HW_VENDOR_INTEL
, CARD_INTEL_IVBM
, "Intel(R) HD Graphics 4000", DRIVER_INTEL_HD4000
, 1536},
415 {HW_VENDOR_INTEL
, CARD_INTEL_IVBS
, "Intel(R) HD Graphics Family", DRIVER_INTEL_HD4000
, 1536},
416 {HW_VENDOR_INTEL
, CARD_INTEL_HWD
, "Intel(R) HD Graphics 4600", DRIVER_INTEL_HD4000
, 1536},
417 {HW_VENDOR_INTEL
, CARD_INTEL_HWM
, "Intel(R) HD Graphics 4600", DRIVER_INTEL_HD4000
, 1536},
418 {HW_VENDOR_INTEL
, CARD_INTEL_HD5000
, "Intel(R) HD Graphics 5000", DRIVER_INTEL_HD4000
, 1536},
419 {HW_VENDOR_INTEL
, CARD_INTEL_I5100_1
, "Intel(R) Iris(TM) Graphics 5100", DRIVER_INTEL_HD4000
, 1536},
420 {HW_VENDOR_INTEL
, CARD_INTEL_I5100_2
, "Intel(R) Iris(TM) Graphics 5100", DRIVER_INTEL_HD4000
, 1536},
421 {HW_VENDOR_INTEL
, CARD_INTEL_I5100_3
, "Intel(R) Iris(TM) Graphics 5100", DRIVER_INTEL_HD4000
, 1536},
422 {HW_VENDOR_INTEL
, CARD_INTEL_I5100_4
, "Intel(R) Iris(TM) Graphics 5100", DRIVER_INTEL_HD4000
, 1536},
423 {HW_VENDOR_INTEL
, CARD_INTEL_IP5200_1
, "Intel(R) Iris(TM) Pro Graphics 5200", DRIVER_INTEL_HD4000
, 1536},
424 {HW_VENDOR_INTEL
, CARD_INTEL_IP5200_2
, "Intel(R) Iris(TM) Pro Graphics 5200", DRIVER_INTEL_HD4000
, 1536},
425 {HW_VENDOR_INTEL
, CARD_INTEL_IP5200_3
, "Intel(R) Iris(TM) Pro Graphics 5200", DRIVER_INTEL_HD4000
, 1536},
426 {HW_VENDOR_INTEL
, CARD_INTEL_IP5200_4
, "Intel(R) Iris(TM) Pro Graphics 5200", DRIVER_INTEL_HD4000
, 1536},
427 {HW_VENDOR_INTEL
, CARD_INTEL_IP5200_5
, "Intel(R) Iris(TM) Pro Graphics 5200", DRIVER_INTEL_HD4000
, 1536},
428 {HW_VENDOR_INTEL
, CARD_INTEL_HD5300
, "Intel(R) HD Graphics 5300", DRIVER_INTEL_HD4000
, 2048},
429 {HW_VENDOR_INTEL
, CARD_INTEL_HD5500
, "Intel(R) HD Graphics 5500", DRIVER_INTEL_HD4000
, 2048},
430 {HW_VENDOR_INTEL
, CARD_INTEL_HD5600
, "Intel(R) HD Graphics 5600", DRIVER_INTEL_HD4000
, 2048},
431 {HW_VENDOR_INTEL
, CARD_INTEL_HD6000
, "Intel(R) HD Graphics 6000", DRIVER_INTEL_HD4000
, 2048},
432 {HW_VENDOR_INTEL
, CARD_INTEL_I6100
, "Intel(R) Iris(TM) Graphics 6100", DRIVER_INTEL_HD4000
, 2048},
433 {HW_VENDOR_INTEL
, CARD_INTEL_IP6200
, "Intel(R) Iris(TM) Pro Graphics 6200", DRIVER_INTEL_HD4000
, 2048},
434 {HW_VENDOR_INTEL
, CARD_INTEL_IPP6300
, "Intel(R) Iris(TM) Pro Graphics P6300", DRIVER_INTEL_HD4000
, 2048},
435 {HW_VENDOR_INTEL
, CARD_INTEL_HD510_1
, "Intel(R) HD Graphics 510", DRIVER_INTEL_HD4000
, 2048},
436 {HW_VENDOR_INTEL
, CARD_INTEL_HD510_2
, "Intel(R) HD Graphics 510", DRIVER_INTEL_HD4000
, 2048},
437 {HW_VENDOR_INTEL
, CARD_INTEL_HD510_3
, "Intel(R) HD Graphics 510", DRIVER_INTEL_HD4000
, 2048},
438 {HW_VENDOR_INTEL
, CARD_INTEL_HD515
, "Intel(R) HD Graphics 515", DRIVER_INTEL_HD4000
, 2048},
439 {HW_VENDOR_INTEL
, CARD_INTEL_HD520_1
, "Intel(R) HD Graphics 520", DRIVER_INTEL_HD4000
, 2048},
440 {HW_VENDOR_INTEL
, CARD_INTEL_HD520_2
, "Intel(R) HD Graphics 520", DRIVER_INTEL_HD4000
, 2048},
441 {HW_VENDOR_INTEL
, CARD_INTEL_HD530_1
, "Intel(R) HD Graphics 530", DRIVER_INTEL_HD4000
, 2048},
442 {HW_VENDOR_INTEL
, CARD_INTEL_HD530_2
, "Intel(R) HD Graphics 530", DRIVER_INTEL_HD4000
, 2048},
443 {HW_VENDOR_INTEL
, CARD_INTEL_HDP530
, "Intel(R) HD Graphics P530", DRIVER_INTEL_HD4000
, 2048},
444 {HW_VENDOR_INTEL
, CARD_INTEL_I540
, "Intel(R) Iris(TM) Graphics 540", DRIVER_INTEL_HD4000
, 2048},
445 {HW_VENDOR_INTEL
, CARD_INTEL_I550
, "Intel(R) Iris(TM) Graphics 550", DRIVER_INTEL_HD4000
, 2048},
446 {HW_VENDOR_INTEL
, CARD_INTEL_I555
, "Intel(R) Iris(TM) Graphics 555", DRIVER_INTEL_HD4000
, 2048},
447 {HW_VENDOR_INTEL
, CARD_INTEL_IP555
, "Intel(R) Iris(TM) Graphics P555", DRIVER_INTEL_HD4000
, 2048},
448 {HW_VENDOR_INTEL
, CARD_INTEL_IP580_1
, "Intel(R) Iris(TM) Pro Graphics 580", DRIVER_INTEL_HD4000
, 2048},
449 {HW_VENDOR_INTEL
, CARD_INTEL_IP580_2
, "Intel(R) Iris(TM) Pro Graphics 580", DRIVER_INTEL_HD4000
, 2048},
450 {HW_VENDOR_INTEL
, CARD_INTEL_IPP580_1
, "Intel(R) Iris(TM) Pro Graphics P580", DRIVER_INTEL_HD4000
, 2048},
451 {HW_VENDOR_INTEL
, CARD_INTEL_IPP580_2
, "Intel(R) Iris(TM) Pro Graphics P580", DRIVER_INTEL_HD4000
, 2048},
452 {HW_VENDOR_INTEL
, CARD_INTEL_HD630
, "Intel(R) HD Graphics 630", DRIVER_INTEL_HD4000
, 3072},
455 static const struct driver_version_information
*get_driver_version_info(enum wined3d_display_driver driver
,
456 enum wined3d_driver_model driver_model
)
460 TRACE("Looking up version info for driver %#x, driver_model %#x.\n", driver
, driver_model
);
462 for (i
= 0; i
< ARRAY_SIZE(driver_version_table
); ++i
)
464 const struct driver_version_information
*entry
= &driver_version_table
[i
];
466 if (entry
->driver
== driver
&& (driver_model
== DRIVER_MODEL_GENERIC
467 || entry
->driver_model
== driver_model
))
469 TRACE("Found driver \"%s\", version %u, subversion %u, build %u.\n",
470 entry
->driver_name
, entry
->version
, entry
->subversion
, entry
->build
);
477 const struct wined3d_gpu_description
*wined3d_get_gpu_description(enum wined3d_pci_vendor vendor
,
478 enum wined3d_pci_device device
)
482 for (i
= 0; i
< ARRAY_SIZE(gpu_description_table
); ++i
)
484 if (vendor
== gpu_description_table
[i
].vendor
&& device
== gpu_description_table
[i
].device
)
485 return &gpu_description_table
[i
];
491 void wined3d_driver_info_init(struct wined3d_driver_info
*driver_info
,
492 const struct wined3d_gpu_description
*gpu_desc
, UINT64 vram_bytes
)
494 OSVERSIONINFOW os_version
;
495 WORD driver_os_version
;
496 enum wined3d_display_driver driver
;
497 enum wined3d_driver_model driver_model
;
498 const struct driver_version_information
*version_info
;
500 memset(&os_version
, 0, sizeof(os_version
));
501 os_version
.dwOSVersionInfoSize
= sizeof(os_version
);
502 if (!GetVersionExW(&os_version
))
504 ERR("Failed to get OS version, reporting 2000/XP.\n");
505 driver_os_version
= 6;
506 driver_model
= DRIVER_MODEL_NT5X
;
510 TRACE("OS version %u.%u.\n", os_version
.dwMajorVersion
, os_version
.dwMinorVersion
);
511 switch (os_version
.dwMajorVersion
)
514 /* If needed we could distinguish between 9x and NT4, but this code won't make
515 * sense for NT4 since it had no way to obtain this info through DirectDraw 3.0.
517 driver_os_version
= 4;
518 driver_model
= DRIVER_MODEL_WIN9X
;
522 driver_os_version
= 6;
523 driver_model
= DRIVER_MODEL_NT5X
;
527 if (os_version
.dwMinorVersion
== 0)
529 driver_os_version
= 7;
530 driver_model
= DRIVER_MODEL_NT6X
;
532 else if (os_version
.dwMinorVersion
== 1)
534 driver_os_version
= 8;
535 driver_model
= DRIVER_MODEL_NT6X
;
539 if (os_version
.dwMinorVersion
> 2)
541 FIXME("Unhandled OS version %u.%u, reporting Win 8.\n",
542 os_version
.dwMajorVersion
, os_version
.dwMinorVersion
);
544 driver_os_version
= 9;
545 driver_model
= DRIVER_MODEL_NT6X
;
550 driver_os_version
= 10;
551 driver_model
= DRIVER_MODEL_NT6X
;
555 FIXME("Unhandled OS version %u.%u, reporting 2000/XP.\n",
556 os_version
.dwMajorVersion
, os_version
.dwMinorVersion
);
557 driver_os_version
= 6;
558 driver_model
= DRIVER_MODEL_NT5X
;
563 driver_info
->vendor
= gpu_desc
->vendor
;
564 driver_info
->device
= gpu_desc
->device
;
565 driver_info
->description
= gpu_desc
->description
;
566 driver_info
->vram_bytes
= vram_bytes
? vram_bytes
: (UINT64
)gpu_desc
->vidmem
* 1024 * 1024;
567 driver
= gpu_desc
->driver
;
569 if (wined3d_settings
.emulated_textureram
)
571 driver_info
->vram_bytes
= wined3d_settings
.emulated_textureram
;
572 TRACE("Overriding amount of video memory with 0x%s bytes.\n",
573 wine_dbgstr_longlong(driver_info
->vram_bytes
));
577 * Diablo 2 crashes when the amount of video memory is greater than 0x7fffffff.
578 * In order to avoid this application bug we limit the amount of video memory
579 * to LONG_MAX for older Windows versions.
581 if (driver_model
< DRIVER_MODEL_NT6X
&& driver_info
->vram_bytes
> LONG_MAX
)
583 TRACE("Limiting amount of video memory to %#lx bytes for OS version older than Vista.\n", LONG_MAX
);
584 driver_info
->vram_bytes
= LONG_MAX
;
587 /* Try to obtain driver version information for the current Windows version. This fails in
589 * - the gpu is not available on the currently selected OS version:
590 * - Geforce GTX480 on Win98. When running applications in compatibility mode on Windows,
591 * version information for the current Windows version is returned instead of faked info.
592 * We do the same and assume the default Windows version to emulate is WinXP.
594 * - Videocard is a Riva TNT but winver is set to win7 (there are no drivers for this beast)
595 * For now return the XP driver info. Perhaps later on we should return VESA.
597 * - the gpu is not in our database (can happen when the user overrides the vendor_id / device_id)
598 * This could be an indication that our database is not up to date, so this should be fixed.
600 if ((version_info
= get_driver_version_info(driver
, driver_model
))
601 || (version_info
= get_driver_version_info(driver
, DRIVER_MODEL_GENERIC
)))
603 driver_info
->name
= version_info
->driver_name
;
604 driver_info
->version_high
= MAKEDWORD_VERSION(driver_os_version
, version_info
->version
);
605 driver_info
->version_low
= MAKEDWORD_VERSION(version_info
->subversion
, version_info
->build
);
609 ERR("No driver version info found for device %04x:%04x, driver model %#x.\n",
610 driver_info
->vendor
, driver_info
->device
, driver_model
);
611 driver_info
->name
= "Display";
612 driver_info
->version_high
= MAKEDWORD_VERSION(driver_os_version
, 15);
613 driver_info
->version_low
= MAKEDWORD_VERSION(8, 6); /* NVIDIA RIVA TNT, arbitrary */
617 enum wined3d_pci_device
wined3d_gpu_from_feature_level(enum wined3d_pci_vendor
*vendor
,
618 enum wined3d_feature_level feature_level
)
622 static const enum wined3d_pci_device card_fallback_nvidia
[] =
624 CARD_NVIDIA_RIVA_128
, /* D3D5 */
625 CARD_NVIDIA_RIVA_TNT
, /* D3D6 */
626 CARD_NVIDIA_GEFORCE
, /* D3D7 */
627 CARD_NVIDIA_GEFORCE3
, /* D3D8 */
628 CARD_NVIDIA_GEFORCEFX_5800
, /* D3D9_SM2 */
629 CARD_NVIDIA_GEFORCE_6800
, /* D3D9_SM3 */
630 CARD_NVIDIA_GEFORCE_8800GTX
, /* D3D10 */
631 CARD_NVIDIA_GEFORCE_GTX470
, /* D3D11 */
633 card_fallback_amd
[] =
635 CARD_AMD_RAGE_128PRO
, /* D3D5 */
636 CARD_AMD_RAGE_128PRO
, /* D3D6 */
637 CARD_AMD_RADEON_7200
, /* D3D7 */
638 CARD_AMD_RADEON_8500
, /* D3D8 */
639 CARD_AMD_RADEON_9500
, /* D3D9_SM2 */
640 CARD_AMD_RADEON_X1600
, /* D3D9_SM3 */
641 CARD_AMD_RADEON_HD2900
, /* D3D10 */
642 CARD_AMD_RADEON_HD5600
, /* D3D11 */
644 card_fallback_intel
[] =
646 CARD_INTEL_845G
, /* D3D5 */
647 CARD_INTEL_845G
, /* D3D6 */
648 CARD_INTEL_845G
, /* D3D7 */
649 CARD_INTEL_915G
, /* D3D8 */
650 CARD_INTEL_915G
, /* D3D9_SM2 */
651 CARD_INTEL_945G
, /* D3D9_SM3 */
652 CARD_INTEL_G45
, /* D3D10 */
653 CARD_INTEL_IVBD
, /* D3D11 */
655 C_ASSERT(ARRAY_SIZE(card_fallback_nvidia
) == WINED3D_FEATURE_LEVEL_COUNT
);
656 C_ASSERT(ARRAY_SIZE(card_fallback_amd
) == WINED3D_FEATURE_LEVEL_COUNT
);
657 C_ASSERT(ARRAY_SIZE(card_fallback_intel
) == WINED3D_FEATURE_LEVEL_COUNT
);
661 enum wined3d_pci_vendor vendor
;
662 const enum wined3d_pci_device
*device
;
666 {HW_VENDOR_AMD
, card_fallback_amd
},
667 {HW_VENDOR_NVIDIA
, card_fallback_nvidia
},
668 {HW_VENDOR_VMWARE
, card_fallback_amd
},
669 {HW_VENDOR_INTEL
, card_fallback_intel
},
672 for (i
= 0; i
< ARRAY_SIZE(fallbacks
); ++i
)
674 if (*vendor
== fallbacks
[i
].vendor
)
675 return fallbacks
[i
].device
[feature_level
];
678 *vendor
= HW_VENDOR_NVIDIA
;
680 return card_fallback_nvidia
[feature_level
];
683 UINT CDECL
wined3d_get_adapter_count(const struct wined3d
*wined3d
)
685 TRACE("wined3d %p, reporting %u adapters.\n",
686 wined3d
, wined3d
->adapter_count
);
688 return wined3d
->adapter_count
;
691 HRESULT CDECL
wined3d_register_software_device(struct wined3d
*wined3d
, void *init_function
)
693 FIXME("wined3d %p, init_function %p stub!\n", wined3d
, init_function
);
698 HRESULT CDECL
wined3d_get_output_desc(const struct wined3d
*wined3d
, unsigned int adapter_idx
,
699 struct wined3d_output_desc
*desc
)
701 enum wined3d_display_rotation rotation
;
702 const struct wined3d_adapter
*adapter
;
703 struct wined3d_display_mode mode
;
707 TRACE("wined3d %p, adapter_idx %u, desc %p.\n", wined3d
, adapter_idx
, desc
);
709 if (adapter_idx
>= wined3d
->adapter_count
)
710 return WINED3DERR_INVALIDCALL
;
712 adapter
= &wined3d
->adapters
[adapter_idx
];
713 if (!(monitor
= MonitorFromPoint(adapter
->monitor_position
, MONITOR_DEFAULTTOPRIMARY
)))
714 return WINED3DERR_INVALIDCALL
;
716 if (FAILED(hr
= wined3d_get_adapter_display_mode(wined3d
, adapter_idx
, &mode
, &rotation
)))
719 memcpy(desc
->device_name
, adapter
->DeviceName
, sizeof(desc
->device_name
));
720 SetRect(&desc
->desktop_rect
, 0, 0, mode
.width
, mode
.height
);
721 OffsetRect(&desc
->desktop_rect
, adapter
->monitor_position
.x
, adapter
->monitor_position
.y
);
722 /* FIXME: We should get this from EnumDisplayDevices() when the adapters
724 desc
->attached_to_desktop
= TRUE
;
725 desc
->rotation
= rotation
;
726 desc
->monitor
= monitor
;
731 /* FIXME: GetAdapterModeCount and EnumAdapterModes currently only returns modes
732 of the same bpp but different resolutions */
734 /* Note: dx9 supplies a format. Calls from d3d8 supply WINED3DFMT_UNKNOWN */
735 UINT CDECL
wined3d_get_adapter_mode_count(const struct wined3d
*wined3d
, UINT adapter_idx
,
736 enum wined3d_format_id format_id
, enum wined3d_scanline_ordering scanline_ordering
)
738 const struct wined3d_adapter
*adapter
;
739 const struct wined3d_format
*format
;
745 TRACE("wined3d %p, adapter_idx %u, format %s, scanline_ordering %#x.\n",
746 wined3d
, adapter_idx
, debug_d3dformat(format_id
), scanline_ordering
);
748 if (adapter_idx
>= wined3d
->adapter_count
)
751 adapter
= &wined3d
->adapters
[adapter_idx
];
752 format
= wined3d_get_format(adapter
, format_id
, WINED3DUSAGE_RENDERTARGET
);
753 format_bits
= format
->byte_count
* CHAR_BIT
;
755 memset(&mode
, 0, sizeof(mode
));
756 mode
.dmSize
= sizeof(mode
);
758 while (EnumDisplaySettingsExW(adapter
->DeviceName
, j
++, &mode
, 0))
760 if (mode
.dmFields
& DM_DISPLAYFLAGS
)
762 if (scanline_ordering
== WINED3D_SCANLINE_ORDERING_PROGRESSIVE
763 && (mode
.u2
.dmDisplayFlags
& DM_INTERLACED
))
766 if (scanline_ordering
== WINED3D_SCANLINE_ORDERING_INTERLACED
767 && !(mode
.u2
.dmDisplayFlags
& DM_INTERLACED
))
771 if (format_id
== WINED3DFMT_UNKNOWN
)
773 /* This is for d3d8, do not enumerate P8 here. */
774 if (mode
.dmBitsPerPel
== 32 || mode
.dmBitsPerPel
== 16) ++i
;
776 else if (mode
.dmBitsPerPel
== format_bits
)
782 TRACE("Returning %u matching modes (out of %u total) for adapter %u.\n", i
, j
, adapter_idx
);
787 /* Note: dx9 supplies a format. Calls from d3d8 supply WINED3DFMT_UNKNOWN */
788 HRESULT CDECL
wined3d_enum_adapter_modes(const struct wined3d
*wined3d
, UINT adapter_idx
,
789 enum wined3d_format_id format_id
, enum wined3d_scanline_ordering scanline_ordering
,
790 UINT mode_idx
, struct wined3d_display_mode
*mode
)
792 const struct wined3d_adapter
*adapter
;
793 const struct wined3d_format
*format
;
799 TRACE("wined3d %p, adapter_idx %u, format %s, scanline_ordering %#x, mode_idx %u, mode %p.\n",
800 wined3d
, adapter_idx
, debug_d3dformat(format_id
), scanline_ordering
, mode_idx
, mode
);
802 if (!mode
|| adapter_idx
>= wined3d
->adapter_count
)
803 return WINED3DERR_INVALIDCALL
;
805 adapter
= &wined3d
->adapters
[adapter_idx
];
806 format
= wined3d_get_format(adapter
, format_id
, WINED3DUSAGE_RENDERTARGET
);
807 format_bits
= format
->byte_count
* CHAR_BIT
;
809 memset(&m
, 0, sizeof(m
));
810 m
.dmSize
= sizeof(m
);
812 while (i
<= mode_idx
)
814 if (!EnumDisplaySettingsExW(adapter
->DeviceName
, j
++, &m
, 0))
816 WARN("Invalid mode_idx %u.\n", mode_idx
);
817 return WINED3DERR_INVALIDCALL
;
820 if (m
.dmFields
& DM_DISPLAYFLAGS
)
822 if (scanline_ordering
== WINED3D_SCANLINE_ORDERING_PROGRESSIVE
823 && (m
.u2
.dmDisplayFlags
& DM_INTERLACED
))
826 if (scanline_ordering
== WINED3D_SCANLINE_ORDERING_INTERLACED
827 && !(m
.u2
.dmDisplayFlags
& DM_INTERLACED
))
831 if (format_id
== WINED3DFMT_UNKNOWN
)
833 /* This is for d3d8, do not enumerate P8 here. */
834 if (m
.dmBitsPerPel
== 32 || m
.dmBitsPerPel
== 16) ++i
;
836 else if (m
.dmBitsPerPel
== format_bits
)
842 mode
->width
= m
.dmPelsWidth
;
843 mode
->height
= m
.dmPelsHeight
;
844 mode
->refresh_rate
= DEFAULT_REFRESH_RATE
;
845 if (m
.dmFields
& DM_DISPLAYFREQUENCY
)
846 mode
->refresh_rate
= m
.dmDisplayFrequency
;
848 if (format_id
== WINED3DFMT_UNKNOWN
)
849 mode
->format_id
= pixelformat_for_depth(m
.dmBitsPerPel
);
851 mode
->format_id
= format_id
;
853 if (!(m
.dmFields
& DM_DISPLAYFLAGS
))
854 mode
->scanline_ordering
= WINED3D_SCANLINE_ORDERING_UNKNOWN
;
855 else if (m
.u2
.dmDisplayFlags
& DM_INTERLACED
)
856 mode
->scanline_ordering
= WINED3D_SCANLINE_ORDERING_INTERLACED
;
858 mode
->scanline_ordering
= WINED3D_SCANLINE_ORDERING_PROGRESSIVE
;
860 TRACE("%ux%u@%u %u bpp, %s %#x.\n", mode
->width
, mode
->height
, mode
->refresh_rate
,
861 m
.dmBitsPerPel
, debug_d3dformat(mode
->format_id
), mode
->scanline_ordering
);
866 HRESULT CDECL
wined3d_find_closest_matching_adapter_mode(const struct wined3d
*wined3d
,
867 unsigned int adapter_idx
, struct wined3d_display_mode
*mode
)
869 unsigned int i
, j
, mode_count
, matching_mode_count
, closest
;
870 struct wined3d_display_mode
**matching_modes
;
871 struct wined3d_display_mode
*modes
;
874 TRACE("wined3d %p, adapter_idx %u, mode %p.\n", wined3d
, adapter_idx
, mode
);
876 if (!(mode_count
= wined3d_get_adapter_mode_count(wined3d
, adapter_idx
,
877 mode
->format_id
, WINED3D_SCANLINE_ORDERING_UNKNOWN
)))
879 WARN("Adapter has 0 matching modes.\n");
883 if (!(modes
= heap_calloc(mode_count
, sizeof(*modes
))))
884 return E_OUTOFMEMORY
;
885 if (!(matching_modes
= heap_calloc(mode_count
, sizeof(*matching_modes
))))
888 return E_OUTOFMEMORY
;
891 for (i
= 0; i
< mode_count
; ++i
)
893 if (FAILED(hr
= wined3d_enum_adapter_modes(wined3d
, adapter_idx
,
894 mode
->format_id
, WINED3D_SCANLINE_ORDERING_UNKNOWN
, i
, &modes
[i
])))
896 heap_free(matching_modes
);
900 matching_modes
[i
] = &modes
[i
];
903 matching_mode_count
= mode_count
;
905 if (mode
->scanline_ordering
!= WINED3D_SCANLINE_ORDERING_UNKNOWN
)
907 for (i
= 0, j
= 0; i
< matching_mode_count
; ++i
)
909 if (matching_modes
[i
]->scanline_ordering
== mode
->scanline_ordering
)
910 matching_modes
[j
++] = matching_modes
[i
];
913 matching_mode_count
= j
;
916 if (mode
->refresh_rate
)
918 for (i
= 0, j
= 0; i
< matching_mode_count
; ++i
)
920 if (matching_modes
[i
]->refresh_rate
== mode
->refresh_rate
)
921 matching_modes
[j
++] = matching_modes
[i
];
924 matching_mode_count
= j
;
927 if (!mode
->width
|| !mode
->height
)
929 struct wined3d_display_mode current_mode
;
930 if (FAILED(hr
= wined3d_get_adapter_display_mode(wined3d
, adapter_idx
,
931 ¤t_mode
, NULL
)))
933 heap_free(matching_modes
);
937 mode
->width
= current_mode
.width
;
938 mode
->height
= current_mode
.height
;
942 for (i
= 0, j
= 0; i
< matching_mode_count
; ++i
)
944 unsigned int d
= abs(mode
->width
- matching_modes
[i
]->width
)
945 + abs(mode
->height
- matching_modes
[i
]->height
);
954 *mode
= *matching_modes
[j
];
956 heap_free(matching_modes
);
959 TRACE("Returning %ux%u@%u %s %#x.\n", mode
->width
, mode
->height
,
960 mode
->refresh_rate
, debug_d3dformat(mode
->format_id
),
961 mode
->scanline_ordering
);
966 HRESULT CDECL
wined3d_get_adapter_display_mode(const struct wined3d
*wined3d
, UINT adapter_idx
,
967 struct wined3d_display_mode
*mode
, enum wined3d_display_rotation
*rotation
)
969 const struct wined3d_adapter
*adapter
;
972 TRACE("wined3d %p, adapter_idx %u, display_mode %p, rotation %p.\n",
973 wined3d
, adapter_idx
, mode
, rotation
);
975 if (!mode
|| adapter_idx
>= wined3d
->adapter_count
)
976 return WINED3DERR_INVALIDCALL
;
978 adapter
= &wined3d
->adapters
[adapter_idx
];
980 memset(&m
, 0, sizeof(m
));
981 m
.dmSize
= sizeof(m
);
983 EnumDisplaySettingsExW(adapter
->DeviceName
, ENUM_CURRENT_SETTINGS
, &m
, 0);
984 mode
->width
= m
.dmPelsWidth
;
985 mode
->height
= m
.dmPelsHeight
;
986 mode
->refresh_rate
= DEFAULT_REFRESH_RATE
;
987 if (m
.dmFields
& DM_DISPLAYFREQUENCY
)
988 mode
->refresh_rate
= m
.dmDisplayFrequency
;
989 mode
->format_id
= pixelformat_for_depth(m
.dmBitsPerPel
);
991 /* Lie about the format. X11 can't change the color depth, and some apps
992 * are pretty angry if they SetDisplayMode from 24 to 16 bpp and find out
993 * that GetDisplayMode still returns 24 bpp. This should probably be
994 * handled in winex11 instead. */
995 if (adapter
->screen_format
&& adapter
->screen_format
!= mode
->format_id
)
997 WARN("Overriding format %s with stored format %s.\n",
998 debug_d3dformat(mode
->format_id
),
999 debug_d3dformat(adapter
->screen_format
));
1000 mode
->format_id
= adapter
->screen_format
;
1003 if (!(m
.dmFields
& DM_DISPLAYFLAGS
))
1004 mode
->scanline_ordering
= WINED3D_SCANLINE_ORDERING_UNKNOWN
;
1005 else if (m
.u2
.dmDisplayFlags
& DM_INTERLACED
)
1006 mode
->scanline_ordering
= WINED3D_SCANLINE_ORDERING_INTERLACED
;
1008 mode
->scanline_ordering
= WINED3D_SCANLINE_ORDERING_PROGRESSIVE
;
1012 switch (m
.u1
.s2
.dmDisplayOrientation
)
1015 *rotation
= WINED3D_DISPLAY_ROTATION_0
;
1018 *rotation
= WINED3D_DISPLAY_ROTATION_90
;
1021 *rotation
= WINED3D_DISPLAY_ROTATION_180
;
1024 *rotation
= WINED3D_DISPLAY_ROTATION_270
;
1027 FIXME("Unhandled display rotation %#x.\n", m
.u1
.s2
.dmDisplayOrientation
);
1028 *rotation
= WINED3D_DISPLAY_ROTATION_UNSPECIFIED
;
1033 TRACE("Returning %ux%u@%u %s %#x.\n", mode
->width
, mode
->height
,
1034 mode
->refresh_rate
, debug_d3dformat(mode
->format_id
),
1035 mode
->scanline_ordering
);
1039 HRESULT CDECL
wined3d_set_adapter_display_mode(struct wined3d
*wined3d
,
1040 UINT adapter_idx
, const struct wined3d_display_mode
*mode
)
1042 struct wined3d_adapter
*adapter
;
1043 DEVMODEW new_mode
, current_mode
;
1046 enum wined3d_format_id new_format_id
;
1048 TRACE("wined3d %p, adapter_idx %u, mode %p.\n", wined3d
, adapter_idx
, mode
);
1050 if (adapter_idx
>= wined3d
->adapter_count
)
1051 return WINED3DERR_INVALIDCALL
;
1052 adapter
= &wined3d
->adapters
[adapter_idx
];
1054 memset(&new_mode
, 0, sizeof(new_mode
));
1055 new_mode
.dmSize
= sizeof(new_mode
);
1056 memset(¤t_mode
, 0, sizeof(current_mode
));
1057 current_mode
.dmSize
= sizeof(current_mode
);
1060 const struct wined3d_format
*format
;
1062 TRACE("mode %ux%u@%u %s %#x.\n", mode
->width
, mode
->height
, mode
->refresh_rate
,
1063 debug_d3dformat(mode
->format_id
), mode
->scanline_ordering
);
1065 format
= wined3d_get_format(adapter
, mode
->format_id
, WINED3DUSAGE_RENDERTARGET
);
1067 new_mode
.dmFields
= DM_BITSPERPEL
| DM_PELSWIDTH
| DM_PELSHEIGHT
;
1068 new_mode
.dmBitsPerPel
= format
->byte_count
* CHAR_BIT
;
1069 new_mode
.dmPelsWidth
= mode
->width
;
1070 new_mode
.dmPelsHeight
= mode
->height
;
1072 new_mode
.dmDisplayFrequency
= mode
->refresh_rate
;
1073 if (mode
->refresh_rate
)
1074 new_mode
.dmFields
|= DM_DISPLAYFREQUENCY
;
1076 if (mode
->scanline_ordering
!= WINED3D_SCANLINE_ORDERING_UNKNOWN
)
1078 new_mode
.dmFields
|= DM_DISPLAYFLAGS
;
1079 if (mode
->scanline_ordering
== WINED3D_SCANLINE_ORDERING_INTERLACED
)
1080 new_mode
.u2
.dmDisplayFlags
|= DM_INTERLACED
;
1082 new_format_id
= mode
->format_id
;
1086 if (!EnumDisplaySettingsW(adapter
->DeviceName
, ENUM_REGISTRY_SETTINGS
, &new_mode
))
1088 ERR("Failed to read mode from registry.\n");
1089 return WINED3DERR_NOTAVAILABLE
;
1091 new_format_id
= pixelformat_for_depth(new_mode
.dmBitsPerPel
);
1094 /* Only change the mode if necessary. */
1095 if (!EnumDisplaySettingsW(adapter
->DeviceName
, ENUM_CURRENT_SETTINGS
, ¤t_mode
))
1097 ERR("Failed to get current display mode.\n");
1099 else if (current_mode
.dmPelsWidth
== new_mode
.dmPelsWidth
1100 && current_mode
.dmPelsHeight
== new_mode
.dmPelsHeight
1101 && current_mode
.dmBitsPerPel
== new_mode
.dmBitsPerPel
1102 && (current_mode
.dmDisplayFrequency
== new_mode
.dmDisplayFrequency
1103 || !(new_mode
.dmFields
& DM_DISPLAYFREQUENCY
))
1104 && (current_mode
.u2
.dmDisplayFlags
== new_mode
.u2
.dmDisplayFlags
1105 || !(new_mode
.dmFields
& DM_DISPLAYFLAGS
)))
1107 TRACE("Skipping redundant mode setting call.\n");
1108 adapter
->screen_format
= new_format_id
;
1112 ret
= ChangeDisplaySettingsExW(adapter
->DeviceName
, &new_mode
, NULL
, CDS_FULLSCREEN
, NULL
);
1113 if (ret
!= DISP_CHANGE_SUCCESSFUL
)
1115 if (new_mode
.dmFields
& DM_DISPLAYFREQUENCY
)
1117 WARN("ChangeDisplaySettingsExW failed, trying without the refresh rate.\n");
1118 new_mode
.dmFields
&= ~DM_DISPLAYFREQUENCY
;
1119 new_mode
.dmDisplayFrequency
= 0;
1120 ret
= ChangeDisplaySettingsExW(adapter
->DeviceName
, &new_mode
, NULL
, CDS_FULLSCREEN
, NULL
);
1122 if (ret
!= DISP_CHANGE_SUCCESSFUL
)
1123 return WINED3DERR_NOTAVAILABLE
;
1126 /* Store the new values. */
1127 adapter
->screen_format
= new_format_id
;
1129 /* And finally clip mouse to our screen. */
1130 SetRect(&clip_rc
, 0, 0, new_mode
.dmPelsWidth
, new_mode
.dmPelsHeight
);
1131 ClipCursor(&clip_rc
);
1136 /* NOTE: due to structure differences between dx8 and dx9 D3DADAPTER_IDENTIFIER,
1137 and fields being inserted in the middle, a new structure is used in place */
1138 HRESULT CDECL
wined3d_get_adapter_identifier(const struct wined3d
*wined3d
,
1139 UINT adapter_idx
, DWORD flags
, struct wined3d_adapter_identifier
*identifier
)
1141 const struct wined3d_adapter
*adapter
;
1144 TRACE("wined3d %p, adapter_idx %u, flags %#x, identifier %p.\n",
1145 wined3d
, adapter_idx
, flags
, identifier
);
1147 if (adapter_idx
>= wined3d
->adapter_count
)
1148 return WINED3DERR_INVALIDCALL
;
1150 adapter
= &wined3d
->adapters
[adapter_idx
];
1152 if (identifier
->driver_size
)
1154 const char *name
= adapter
->driver_info
.name
;
1155 len
= min(strlen(name
), identifier
->driver_size
- 1);
1156 memcpy(identifier
->driver
, name
, len
);
1157 memset(&identifier
->driver
[len
], 0, identifier
->driver_size
- len
);
1160 if (identifier
->description_size
)
1162 const char *description
= adapter
->driver_info
.description
;
1163 len
= min(strlen(description
), identifier
->description_size
- 1);
1164 memcpy(identifier
->description
, description
, len
);
1165 memset(&identifier
->description
[len
], 0, identifier
->description_size
- len
);
1168 /* Note that d3d8 doesn't supply a device name. */
1169 if (identifier
->device_name_size
)
1171 if (!WideCharToMultiByte(CP_ACP
, 0, adapter
->DeviceName
, -1, identifier
->device_name
,
1172 identifier
->device_name_size
, NULL
, NULL
))
1174 ERR("Failed to convert device name, last error %#x.\n", GetLastError());
1175 return WINED3DERR_INVALIDCALL
;
1179 identifier
->driver_version
.u
.HighPart
= adapter
->driver_info
.version_high
;
1180 identifier
->driver_version
.u
.LowPart
= adapter
->driver_info
.version_low
;
1181 identifier
->vendor_id
= adapter
->driver_info
.vendor
;
1182 identifier
->device_id
= adapter
->driver_info
.device
;
1183 identifier
->subsystem_id
= 0;
1184 identifier
->revision
= 0;
1185 memcpy(&identifier
->device_identifier
, &IID_D3DDEVICE_D3DUID
, sizeof(identifier
->device_identifier
));
1186 identifier
->whql_level
= (flags
& WINED3DENUM_NO_WHQL_LEVEL
) ? 0 : 1;
1187 memcpy(&identifier
->adapter_luid
, &adapter
->luid
, sizeof(identifier
->adapter_luid
));
1188 identifier
->video_memory
= min(~(SIZE_T
)0, adapter
->vram_bytes
);
1193 HRESULT CDECL
wined3d_get_adapter_raster_status(const struct wined3d
*wined3d
, UINT adapter_idx
,
1194 struct wined3d_raster_status
*raster_status
)
1196 LONGLONG freq_per_frame
, freq_per_line
;
1197 LARGE_INTEGER counter
, freq_per_sec
;
1198 struct wined3d_display_mode mode
;
1202 FIXME("wined3d %p, adapter_idx %u, raster_status %p semi-stub!\n",
1203 wined3d
, adapter_idx
, raster_status
);
1205 WARN("wined3d %p, adapter_idx %u, raster_status %p semi-stub!\n",
1206 wined3d
, adapter_idx
, raster_status
);
1208 /* Obtaining the raster status is a widely implemented but optional
1209 * feature. When this method returns OK StarCraft 2 expects the
1210 * raster_status->InVBlank value to actually change over time.
1211 * And Endless Alice Crysis doesn't care even if this method fails.
1212 * Thus this method returns OK and fakes raster_status by
1213 * QueryPerformanceCounter. */
1215 if (!QueryPerformanceCounter(&counter
) || !QueryPerformanceFrequency(&freq_per_sec
))
1216 return WINED3DERR_INVALIDCALL
;
1217 if (FAILED(wined3d_get_adapter_display_mode(wined3d
, adapter_idx
, &mode
, NULL
)))
1218 return WINED3DERR_INVALIDCALL
;
1219 if (mode
.refresh_rate
== DEFAULT_REFRESH_RATE
)
1220 mode
.refresh_rate
= 60;
1222 freq_per_frame
= freq_per_sec
.QuadPart
/ mode
.refresh_rate
;
1223 /* Assume 20 scan lines in the vertical blank. */
1224 freq_per_line
= freq_per_frame
/ (mode
.height
+ 20);
1225 raster_status
->scan_line
= (counter
.QuadPart
% freq_per_frame
) / freq_per_line
;
1226 if (raster_status
->scan_line
< mode
.height
)
1227 raster_status
->in_vblank
= FALSE
;
1230 raster_status
->scan_line
= 0;
1231 raster_status
->in_vblank
= TRUE
;
1234 TRACE("Returning fake value, in_vblank %u, scan_line %u.\n",
1235 raster_status
->in_vblank
, raster_status
->scan_line
);
1240 static BOOL
wined3d_check_pixel_format_color(const struct wined3d_pixel_format
*cfg
,
1241 const struct wined3d_format
*format
)
1243 /* Float formats need FBOs. If FBOs are used this function isn't called */
1244 if (format
->flags
[WINED3D_GL_RES_TYPE_TEX_2D
] & WINED3DFMT_FLAG_FLOAT
)
1247 /* Probably a RGBA_float or color index mode. */
1248 if (cfg
->iPixelType
!= WGL_TYPE_RGBA_ARB
)
1251 if (cfg
->redSize
< format
->red_size
1252 || cfg
->greenSize
< format
->green_size
1253 || cfg
->blueSize
< format
->blue_size
1254 || cfg
->alphaSize
< format
->alpha_size
)
1260 static BOOL
wined3d_check_pixel_format_depth(const struct wined3d_pixel_format
*cfg
,
1261 const struct wined3d_format
*format
)
1263 BOOL lockable
= FALSE
;
1265 /* Float formats need FBOs. If FBOs are used this function isn't called */
1266 if (format
->flags
[WINED3D_GL_RES_TYPE_TEX_2D
] & WINED3DFMT_FLAG_FLOAT
)
1269 if ((format
->id
== WINED3DFMT_D16_LOCKABLE
) || (format
->id
== WINED3DFMT_D32_FLOAT
))
1272 /* On some modern cards like the Geforce8/9, GLX doesn't offer some
1273 * depth/stencil formats which D3D9 reports. We can safely report
1274 * "compatible" formats (e.g. D24 can be used for D16) as long as we
1275 * aren't dealing with a lockable format. This also helps D3D <= 7 as they
1276 * expect D16 which isn't offered without this on Geforce8 cards. */
1277 if (!(cfg
->depthSize
== format
->depth_size
|| (!lockable
&& cfg
->depthSize
> format
->depth_size
)))
1280 /* Some cards like Intel i915 ones only offer D24S8 but lots of games also
1281 * need a format without stencil. We can allow a mismatch if the format
1282 * doesn't have any stencil bits. If it does have stencil bits the size
1283 * must match, or stencil wrapping would break. */
1284 if (format
->stencil_size
&& cfg
->stencilSize
!= format
->stencil_size
)
1290 HRESULT CDECL
wined3d_check_depth_stencil_match(const struct wined3d
*wined3d
,
1291 UINT adapter_idx
, enum wined3d_device_type device_type
, enum wined3d_format_id adapter_format_id
,
1292 enum wined3d_format_id render_target_format_id
, enum wined3d_format_id depth_stencil_format_id
)
1294 const struct wined3d_format
*rt_format
;
1295 const struct wined3d_format
*ds_format
;
1296 const struct wined3d_adapter
*adapter
;
1298 TRACE("wined3d %p, adapter_idx %u, device_type %s,\n"
1299 "adapter_format %s, render_target_format %s, depth_stencil_format %s.\n",
1300 wined3d
, adapter_idx
, debug_d3ddevicetype(device_type
), debug_d3dformat(adapter_format_id
),
1301 debug_d3dformat(render_target_format_id
), debug_d3dformat(depth_stencil_format_id
));
1303 if (adapter_idx
>= wined3d
->adapter_count
)
1304 return WINED3DERR_INVALIDCALL
;
1306 adapter
= &wined3d
->adapters
[adapter_idx
];
1307 rt_format
= wined3d_get_format(adapter
, render_target_format_id
, WINED3DUSAGE_RENDERTARGET
);
1308 ds_format
= wined3d_get_format(adapter
, depth_stencil_format_id
, WINED3DUSAGE_DEPTHSTENCIL
);
1309 if (wined3d_settings
.offscreen_rendering_mode
== ORM_FBO
)
1311 if ((rt_format
->flags
[WINED3D_GL_RES_TYPE_TEX_2D
] & WINED3DFMT_FLAG_RENDERTARGET
)
1312 && (ds_format
->flags
[WINED3D_GL_RES_TYPE_TEX_2D
] & (WINED3DFMT_FLAG_DEPTH
| WINED3DFMT_FLAG_STENCIL
)))
1314 TRACE("Formats match.\n");
1320 const struct wined3d_pixel_format
*cfgs
;
1321 unsigned int cfg_count
;
1324 cfgs
= adapter
->cfgs
;
1325 cfg_count
= adapter
->cfg_count
;
1326 for (i
= 0; i
< cfg_count
; ++i
)
1328 if (wined3d_check_pixel_format_color(&cfgs
[i
], rt_format
)
1329 && wined3d_check_pixel_format_depth(&cfgs
[i
], ds_format
))
1331 TRACE("Formats match.\n");
1337 TRACE("Unsupported format pair: %s and %s.\n",
1338 debug_d3dformat(render_target_format_id
),
1339 debug_d3dformat(depth_stencil_format_id
));
1341 return WINED3DERR_NOTAVAILABLE
;
1344 HRESULT CDECL
wined3d_check_device_multisample_type(const struct wined3d
*wined3d
, UINT adapter_idx
,
1345 enum wined3d_device_type device_type
, enum wined3d_format_id surface_format_id
, BOOL windowed
,
1346 enum wined3d_multisample_type multisample_type
, DWORD
*quality_levels
)
1348 const struct wined3d_adapter
*adapter
;
1349 const struct wined3d_format
*format
;
1350 HRESULT hr
= WINED3D_OK
;
1352 TRACE("wined3d %p, adapter_idx %u, device_type %s, surface_format %s, "
1353 "windowed %#x, multisample_type %#x, quality_levels %p.\n",
1354 wined3d
, adapter_idx
, debug_d3ddevicetype(device_type
), debug_d3dformat(surface_format_id
),
1355 windowed
, multisample_type
, quality_levels
);
1357 if (adapter_idx
>= wined3d
->adapter_count
)
1358 return WINED3DERR_INVALIDCALL
;
1359 if (surface_format_id
== WINED3DFMT_UNKNOWN
)
1360 return WINED3DERR_INVALIDCALL
;
1361 if (multisample_type
< WINED3D_MULTISAMPLE_NONE
)
1362 return WINED3DERR_INVALIDCALL
;
1363 if (multisample_type
> WINED3D_MULTISAMPLE_16_SAMPLES
)
1365 FIXME("multisample_type %u not handled yet.\n", multisample_type
);
1366 return WINED3DERR_NOTAVAILABLE
;
1369 adapter
= &wined3d
->adapters
[adapter_idx
];
1370 format
= wined3d_get_format(adapter
, surface_format_id
, 0);
1372 if (multisample_type
&& !(format
->multisample_types
& 1u << (multisample_type
- 1)))
1373 hr
= WINED3DERR_NOTAVAILABLE
;
1375 if (SUCCEEDED(hr
) || (multisample_type
== WINED3D_MULTISAMPLE_NON_MASKABLE
&& format
->multisample_types
))
1379 if (multisample_type
== WINED3D_MULTISAMPLE_NON_MASKABLE
)
1380 *quality_levels
= wined3d_popcount(format
->multisample_types
);
1382 *quality_levels
= 1;
1387 TRACE("Returning not supported.\n");
1391 /* Check if the given DisplayFormat + DepthStencilFormat combination is valid for the Adapter */
1392 static BOOL
CheckDepthStencilCapability(const struct wined3d_adapter
*adapter
,
1393 const struct wined3d_format
*display_format
, const struct wined3d_format
*ds_format
,
1394 enum wined3d_gl_resource_type gl_type
)
1396 /* Only allow depth/stencil formats */
1397 if (!(ds_format
->depth_size
|| ds_format
->stencil_size
))
1400 /* Blacklist formats not supported on Windows */
1401 switch (ds_format
->id
)
1403 case WINED3DFMT_S1_UINT_D15_UNORM
: /* Breaks the shadowvol2 dx7 sdk sample */
1404 case WINED3DFMT_S4X4_UINT_D24_UNORM
:
1405 TRACE("[FAILED] - not supported on windows.\n");
1412 if (wined3d_settings
.offscreen_rendering_mode
== ORM_FBO
)
1414 /* With FBOs WGL limitations do not apply, but the format needs to be FBO attachable */
1415 if (ds_format
->flags
[gl_type
] & (WINED3DFMT_FLAG_DEPTH
| WINED3DFMT_FLAG_STENCIL
))
1422 /* Walk through all WGL pixel formats to find a match */
1423 for (i
= 0; i
< adapter
->cfg_count
; ++i
)
1425 const struct wined3d_pixel_format
*cfg
= &adapter
->cfgs
[i
];
1426 if (wined3d_check_pixel_format_color(cfg
, display_format
)
1427 && wined3d_check_pixel_format_depth(cfg
, ds_format
))
1435 /* Check the render target capabilities of a format */
1436 static BOOL
CheckRenderTargetCapability(const struct wined3d_adapter
*adapter
,
1437 const struct wined3d_format
*adapter_format
, const struct wined3d_format
*check_format
,
1438 enum wined3d_gl_resource_type gl_type
)
1440 /* Filter out non-RT formats */
1441 if (!(check_format
->flags
[gl_type
] & WINED3DFMT_FLAG_RENDERTARGET
))
1443 if (wined3d_settings
.offscreen_rendering_mode
== ORM_FBO
)
1445 if (wined3d_settings
.offscreen_rendering_mode
== ORM_BACKBUFFER
)
1447 const struct wined3d_pixel_format
*cfgs
= adapter
->cfgs
;
1450 /* In backbuffer mode the front and backbuffer share the same WGL
1451 * pixelformat. The format must match in RGB, alpha is allowed to be
1452 * different. (Only the backbuffer can have alpha.) */
1453 if (adapter_format
->red_size
!= check_format
->red_size
1454 || adapter_format
->green_size
!= check_format
->green_size
1455 || adapter_format
->blue_size
!= check_format
->blue_size
)
1457 TRACE("[FAILED]\n");
1461 /* Check if there is a WGL pixel format matching the requirements, the format should also be window
1462 * drawable (not offscreen; e.g. Nvidia offers R5G6B5 for pbuffers even when X is running at 24bit) */
1463 for (i
= 0; i
< adapter
->cfg_count
; ++i
)
1465 if (cfgs
[i
].windowDrawable
1466 && wined3d_check_pixel_format_color(&cfgs
[i
], check_format
))
1468 TRACE("Pixel format %d is compatible with format %s.\n",
1469 cfgs
[i
].iPixelFormat
, debug_d3dformat(check_format
->id
));
1477 static BOOL
wined3d_check_surface_capability(const struct wined3d_format
*format
, BOOL no3d
)
1483 case WINED3DFMT_B8G8R8_UNORM
:
1484 TRACE("[FAILED] - Not enumerated on Windows.\n");
1486 case WINED3DFMT_B8G8R8A8_UNORM
:
1487 case WINED3DFMT_B8G8R8X8_UNORM
:
1488 case WINED3DFMT_B5G6R5_UNORM
:
1489 case WINED3DFMT_B5G5R5X1_UNORM
:
1490 case WINED3DFMT_B5G5R5A1_UNORM
:
1491 case WINED3DFMT_B4G4R4A4_UNORM
:
1492 case WINED3DFMT_B2G3R3_UNORM
:
1493 case WINED3DFMT_A8_UNORM
:
1494 case WINED3DFMT_B2G3R3A8_UNORM
:
1495 case WINED3DFMT_B4G4R4X4_UNORM
:
1496 case WINED3DFMT_R10G10B10A2_UNORM
:
1497 case WINED3DFMT_R8G8B8A8_UNORM
:
1498 case WINED3DFMT_R8G8B8X8_UNORM
:
1499 case WINED3DFMT_R16G16_UNORM
:
1500 case WINED3DFMT_B10G10R10A2_UNORM
:
1501 case WINED3DFMT_R16G16B16A16_UNORM
:
1502 case WINED3DFMT_P8_UINT
:
1506 TRACE("[FAILED] - Not available on GDI surfaces.\n");
1511 if (format
->glInternal
)
1517 if ((format
->flags
[WINED3D_GL_RES_TYPE_TEX_2D
] & (WINED3DFMT_FLAG_EXTENSION
| WINED3DFMT_FLAG_TEXTURE
))
1518 == (WINED3DFMT_FLAG_EXTENSION
| WINED3DFMT_FLAG_TEXTURE
))
1524 /* Reject other formats */
1525 TRACE("[FAILED]\n");
1529 /* OpenGL supports mipmapping on all formats. Wrapping is unsupported, but we
1530 * have to report mipmapping so we cannot reject WRAPANDMIP. Tests show that
1531 * Windows reports WRAPANDMIP on unfilterable surfaces as well, apparently to
1532 * show that wrapping is supported. The lack of filtering will sort out the
1533 * mipmapping capability anyway.
1535 * For now lets report this on all formats, but in the future we may want to
1536 * restrict it to some should applications need that. */
1537 HRESULT CDECL
wined3d_check_device_format(const struct wined3d
*wined3d
, UINT adapter_idx
,
1538 enum wined3d_device_type device_type
, enum wined3d_format_id adapter_format_id
, DWORD usage
,
1539 enum wined3d_resource_type resource_type
, enum wined3d_format_id check_format_id
)
1541 const struct wined3d_format
*adapter_format
, *format
;
1542 enum wined3d_gl_resource_type gl_type
, gl_type_end
;
1543 const struct wined3d_adapter
*adapter
;
1544 BOOL mipmap_gen_supported
= TRUE
;
1545 DWORD format_flags
= 0;
1546 DWORD allowed_usage
;
1548 TRACE("wined3d %p, adapter_idx %u, device_type %s, adapter_format %s, usage %s, %s, "
1549 "resource_type %s, check_format %s.\n",
1550 wined3d
, adapter_idx
, debug_d3ddevicetype(device_type
), debug_d3dformat(adapter_format_id
),
1551 debug_d3dusage(usage
), debug_d3dusagequery(usage
), debug_d3dresourcetype(resource_type
),
1552 debug_d3dformat(check_format_id
));
1554 if (adapter_idx
>= wined3d
->adapter_count
)
1555 return WINED3DERR_INVALIDCALL
;
1557 adapter
= &wined3d
->adapters
[adapter_idx
];
1558 adapter_format
= wined3d_get_format(adapter
, adapter_format_id
, WINED3DUSAGE_RENDERTARGET
);
1559 format
= wined3d_get_format(adapter
, check_format_id
, usage
);
1561 switch (resource_type
)
1563 case WINED3D_RTYPE_NONE
:
1564 allowed_usage
= WINED3DUSAGE_DEPTHSTENCIL
1565 | WINED3DUSAGE_RENDERTARGET
;
1566 gl_type
= WINED3D_GL_RES_TYPE_TEX_2D
;
1567 gl_type_end
= WINED3D_GL_RES_TYPE_TEX_3D
;
1570 case WINED3D_RTYPE_TEXTURE_1D
:
1571 allowed_usage
= WINED3DUSAGE_DYNAMIC
1572 | WINED3DUSAGE_SOFTWAREPROCESSING
1573 | WINED3DUSAGE_TEXTURE
1574 | WINED3DUSAGE_QUERY_FILTER
1575 | WINED3DUSAGE_QUERY_GENMIPMAP
1576 | WINED3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING
1577 | WINED3DUSAGE_QUERY_SRGBREAD
1578 | WINED3DUSAGE_QUERY_SRGBWRITE
1579 | WINED3DUSAGE_QUERY_VERTEXTEXTURE
1580 | WINED3DUSAGE_QUERY_WRAPANDMIP
;
1581 gl_type
= gl_type_end
= WINED3D_GL_RES_TYPE_TEX_1D
;
1584 case WINED3D_RTYPE_TEXTURE_2D
:
1585 allowed_usage
= WINED3DUSAGE_DEPTHSTENCIL
1586 | WINED3DUSAGE_RENDERTARGET
1587 | WINED3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING
;
1588 if (usage
& WINED3DUSAGE_RENDERTARGET
)
1589 allowed_usage
|= WINED3DUSAGE_QUERY_SRGBWRITE
;
1590 if (!(usage
& WINED3DUSAGE_TEXTURE
))
1592 if (!wined3d_check_surface_capability(format
, wined3d
->flags
& WINED3D_NO3D
))
1594 TRACE("[FAILED] - Not supported for plain surfaces.\n");
1595 return WINED3DERR_NOTAVAILABLE
;
1598 gl_type
= gl_type_end
= WINED3D_GL_RES_TYPE_RB
;
1601 allowed_usage
|= WINED3DUSAGE_DYNAMIC
1602 | WINED3DUSAGE_LEGACY_CUBEMAP
1603 | WINED3DUSAGE_SOFTWAREPROCESSING
1604 | WINED3DUSAGE_TEXTURE
1605 | WINED3DUSAGE_QUERY_FILTER
1606 | WINED3DUSAGE_QUERY_GENMIPMAP
1607 | WINED3DUSAGE_QUERY_LEGACYBUMPMAP
1608 | WINED3DUSAGE_QUERY_SRGBREAD
1609 | WINED3DUSAGE_QUERY_SRGBWRITE
1610 | WINED3DUSAGE_QUERY_VERTEXTEXTURE
1611 | WINED3DUSAGE_QUERY_WRAPANDMIP
;
1612 gl_type
= gl_type_end
= WINED3D_GL_RES_TYPE_TEX_2D
;
1613 if (usage
& WINED3DUSAGE_LEGACY_CUBEMAP
)
1615 allowed_usage
&= ~(WINED3DUSAGE_DEPTHSTENCIL
| WINED3DUSAGE_QUERY_LEGACYBUMPMAP
);
1616 gl_type
= gl_type_end
= WINED3D_GL_RES_TYPE_TEX_CUBE
;
1618 else if ((usage
& WINED3DUSAGE_DEPTHSTENCIL
)
1619 && (format
->flags
[WINED3D_GL_RES_TYPE_TEX_2D
] & WINED3DFMT_FLAG_SHADOW
)
1620 && !adapter
->gl_info
.supported
[ARB_SHADOW
])
1622 TRACE("[FAILED] - No shadow sampler support.\n");
1623 return WINED3DERR_NOTAVAILABLE
;
1627 case WINED3D_RTYPE_TEXTURE_3D
:
1628 allowed_usage
= WINED3DUSAGE_DYNAMIC
1629 | WINED3DUSAGE_SOFTWAREPROCESSING
1630 | WINED3DUSAGE_TEXTURE
1631 | WINED3DUSAGE_QUERY_FILTER
1632 | WINED3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING
1633 | WINED3DUSAGE_QUERY_SRGBREAD
1634 | WINED3DUSAGE_QUERY_SRGBWRITE
1635 | WINED3DUSAGE_QUERY_VERTEXTEXTURE
1636 | WINED3DUSAGE_QUERY_WRAPANDMIP
;
1637 gl_type
= gl_type_end
= WINED3D_GL_RES_TYPE_TEX_3D
;
1641 FIXME("Unhandled resource type %s.\n", debug_d3dresourcetype(resource_type
));
1642 return WINED3DERR_NOTAVAILABLE
;
1645 if ((usage
& allowed_usage
) != usage
)
1647 TRACE("Requested usage %#x, but resource type %s only allows %#x.\n",
1648 usage
, debug_d3dresourcetype(resource_type
), allowed_usage
);
1649 return WINED3DERR_NOTAVAILABLE
;
1652 if (usage
& WINED3DUSAGE_TEXTURE
)
1653 format_flags
|= WINED3DFMT_FLAG_TEXTURE
;
1654 if (usage
& WINED3DUSAGE_QUERY_FILTER
)
1655 format_flags
|= WINED3DFMT_FLAG_FILTERING
;
1656 if (usage
& WINED3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING
)
1657 format_flags
|= WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING
;
1658 if (usage
& WINED3DUSAGE_QUERY_SRGBREAD
)
1659 format_flags
|= WINED3DFMT_FLAG_SRGB_READ
;
1660 if (usage
& WINED3DUSAGE_QUERY_SRGBWRITE
)
1661 format_flags
|= WINED3DFMT_FLAG_SRGB_WRITE
;
1662 if (usage
& WINED3DUSAGE_QUERY_VERTEXTEXTURE
)
1663 format_flags
|= WINED3DFMT_FLAG_VTF
;
1664 if (usage
& WINED3DUSAGE_QUERY_LEGACYBUMPMAP
)
1665 format_flags
|= WINED3DFMT_FLAG_BUMPMAP
;
1667 if ((format_flags
& WINED3DFMT_FLAG_TEXTURE
) && (wined3d
->flags
& WINED3D_NO3D
))
1669 TRACE("Requested texturing support, but wined3d was created with WINED3D_NO3D.\n");
1670 return WINED3DERR_NOTAVAILABLE
;
1673 for (; gl_type
<= gl_type_end
; ++gl_type
)
1675 if ((format
->flags
[gl_type
] & format_flags
) != format_flags
)
1677 TRACE("Requested format flags %#x, but format %s only has %#x.\n",
1678 format_flags
, debug_d3dformat(check_format_id
), format
->flags
[gl_type
]);
1679 return WINED3DERR_NOTAVAILABLE
;
1682 if ((usage
& WINED3DUSAGE_RENDERTARGET
)
1683 && !CheckRenderTargetCapability(adapter
, adapter_format
, format
, gl_type
))
1685 TRACE("Requested WINED3DUSAGE_RENDERTARGET, but format %s is not supported for render targets.\n",
1686 debug_d3dformat(check_format_id
));
1687 return WINED3DERR_NOTAVAILABLE
;
1690 /* 3D depth / stencil textures are never supported. */
1691 if (usage
== WINED3DUSAGE_DEPTHSTENCIL
&& gl_type
== WINED3D_GL_RES_TYPE_TEX_3D
)
1694 if ((usage
& WINED3DUSAGE_DEPTHSTENCIL
)
1695 && !CheckDepthStencilCapability(adapter
, adapter_format
, format
, gl_type
))
1697 TRACE("Requested WINED3DUSAGE_DEPTHSTENCIL, but format %s is not supported for depth / stencil buffers.\n",
1698 debug_d3dformat(check_format_id
));
1699 return WINED3DERR_NOTAVAILABLE
;
1702 if (!(format
->flags
[gl_type
] & WINED3DFMT_FLAG_GEN_MIPMAP
))
1703 mipmap_gen_supported
= FALSE
;
1706 if ((usage
& WINED3DUSAGE_QUERY_GENMIPMAP
) && !mipmap_gen_supported
)
1708 TRACE("No WINED3DUSAGE_AUTOGENMIPMAP support, returning WINED3DOK_NOAUTOGEN.\n");
1709 return WINED3DOK_NOMIPGEN
;
1715 UINT CDECL
wined3d_calculate_format_pitch(const struct wined3d
*wined3d
, UINT adapter_idx
,
1716 enum wined3d_format_id format_id
, UINT width
)
1718 const struct wined3d_adapter
*adapter
;
1719 unsigned int row_pitch
, slice_pitch
;
1721 TRACE("wined3d %p, adapter_idx %u, format_id %s, width %u.\n",
1722 wined3d
, adapter_idx
, debug_d3dformat(format_id
), width
);
1724 if (adapter_idx
>= wined3d
->adapter_count
)
1727 adapter
= &wined3d
->adapters
[adapter_idx
];
1728 wined3d_format_calculate_pitch(wined3d_get_format(adapter
, format_id
, 0),
1729 1, width
, 1, &row_pitch
, &slice_pitch
);
1734 HRESULT CDECL
wined3d_check_device_format_conversion(const struct wined3d
*wined3d
, UINT adapter_idx
,
1735 enum wined3d_device_type device_type
, enum wined3d_format_id src_format
, enum wined3d_format_id dst_format
)
1737 FIXME("wined3d %p, adapter_idx %u, device_type %s, src_format %s, dst_format %s stub!\n",
1738 wined3d
, adapter_idx
, debug_d3ddevicetype(device_type
), debug_d3dformat(src_format
),
1739 debug_d3dformat(dst_format
));
1744 HRESULT CDECL
wined3d_check_device_type(const struct wined3d
*wined3d
, UINT adapter_idx
,
1745 enum wined3d_device_type device_type
, enum wined3d_format_id display_format
,
1746 enum wined3d_format_id backbuffer_format
, BOOL windowed
)
1748 BOOL present_conversion
= wined3d
->flags
& WINED3D_PRESENT_CONVERSION
;
1750 TRACE("wined3d %p, adapter_idx %u, device_type %s, display_format %s, backbuffer_format %s, windowed %#x.\n",
1751 wined3d
, adapter_idx
, debug_d3ddevicetype(device_type
), debug_d3dformat(display_format
),
1752 debug_d3dformat(backbuffer_format
), windowed
);
1754 if (adapter_idx
>= wined3d
->adapter_count
)
1755 return WINED3DERR_INVALIDCALL
;
1757 /* The task of this function is to check whether a certain display / backbuffer format
1758 * combination is available on the given adapter. In fullscreen mode microsoft specified
1759 * that the display format shouldn't provide alpha and that ignoring alpha the backbuffer
1760 * and display format should match exactly.
1761 * In windowed mode format conversion can occur and this depends on the driver. */
1763 /* There are only 4 display formats. */
1764 if (!(display_format
== WINED3DFMT_B5G6R5_UNORM
1765 || display_format
== WINED3DFMT_B5G5R5X1_UNORM
1766 || display_format
== WINED3DFMT_B8G8R8X8_UNORM
1767 || display_format
== WINED3DFMT_B10G10R10A2_UNORM
))
1769 TRACE("Format %s is not supported as display format.\n", debug_d3dformat(display_format
));
1770 return WINED3DERR_NOTAVAILABLE
;
1775 /* If the requested display format is not available, don't continue. */
1776 if (!wined3d_get_adapter_mode_count(wined3d
, adapter_idx
,
1777 display_format
, WINED3D_SCANLINE_ORDERING_UNKNOWN
))
1779 TRACE("No available modes for display format %s.\n", debug_d3dformat(display_format
));
1780 return WINED3DERR_NOTAVAILABLE
;
1783 present_conversion
= FALSE
;
1785 else if (display_format
== WINED3DFMT_B10G10R10A2_UNORM
)
1787 /* WINED3DFMT_B10G10R10A2_UNORM is only allowed in fullscreen mode. */
1788 TRACE("Unsupported format combination %s / %s in windowed mode.\n",
1789 debug_d3dformat(display_format
), debug_d3dformat(backbuffer_format
));
1790 return WINED3DERR_NOTAVAILABLE
;
1793 if (present_conversion
)
1795 /* Use the display format as back buffer format if the latter is
1796 * WINED3DFMT_UNKNOWN. */
1797 if (backbuffer_format
== WINED3DFMT_UNKNOWN
)
1798 backbuffer_format
= display_format
;
1800 if (FAILED(wined3d_check_device_format_conversion(wined3d
, adapter_idx
,
1801 device_type
, backbuffer_format
, display_format
)))
1803 TRACE("Format conversion from %s to %s not supported.\n",
1804 debug_d3dformat(backbuffer_format
), debug_d3dformat(display_format
));
1805 return WINED3DERR_NOTAVAILABLE
;
1810 /* When format conversion from the back buffer format to the display
1811 * format is not allowed, only a limited number of combinations are
1814 if (display_format
== WINED3DFMT_B5G6R5_UNORM
&& backbuffer_format
!= WINED3DFMT_B5G6R5_UNORM
)
1816 TRACE("Unsupported format combination %s / %s.\n",
1817 debug_d3dformat(display_format
), debug_d3dformat(backbuffer_format
));
1818 return WINED3DERR_NOTAVAILABLE
;
1821 if (display_format
== WINED3DFMT_B5G5R5X1_UNORM
1822 && !(backbuffer_format
== WINED3DFMT_B5G5R5X1_UNORM
|| backbuffer_format
== WINED3DFMT_B5G5R5A1_UNORM
))
1824 TRACE("Unsupported format combination %s / %s.\n",
1825 debug_d3dformat(display_format
), debug_d3dformat(backbuffer_format
));
1826 return WINED3DERR_NOTAVAILABLE
;
1829 if (display_format
== WINED3DFMT_B8G8R8X8_UNORM
1830 && !(backbuffer_format
== WINED3DFMT_B8G8R8X8_UNORM
|| backbuffer_format
== WINED3DFMT_B8G8R8A8_UNORM
))
1832 TRACE("Unsupported format combination %s / %s.\n",
1833 debug_d3dformat(display_format
), debug_d3dformat(backbuffer_format
));
1834 return WINED3DERR_NOTAVAILABLE
;
1837 if (display_format
== WINED3DFMT_B10G10R10A2_UNORM
1838 && backbuffer_format
!= WINED3DFMT_B10G10R10A2_UNORM
)
1840 TRACE("Unsupported format combination %s / %s.\n",
1841 debug_d3dformat(display_format
), debug_d3dformat(backbuffer_format
));
1842 return WINED3DERR_NOTAVAILABLE
;
1846 /* Validate that the back buffer format is usable for render targets. */
1847 if (FAILED(wined3d_check_device_format(wined3d
, adapter_idx
, device_type
, display_format
,
1848 WINED3DUSAGE_RENDERTARGET
, WINED3D_RTYPE_TEXTURE_2D
, backbuffer_format
)))
1850 TRACE("Format %s not allowed for render targets.\n", debug_d3dformat(backbuffer_format
));
1851 return WINED3DERR_NOTAVAILABLE
;
1857 HRESULT CDECL
wined3d_get_device_caps(const struct wined3d
*wined3d
, UINT adapter_idx
,
1858 enum wined3d_device_type device_type
, struct wined3d_caps
*caps
)
1860 const struct wined3d_adapter
*adapter
= &wined3d
->adapters
[adapter_idx
];
1861 const struct wined3d_d3d_info
*d3d_info
= &adapter
->d3d_info
;
1862 const struct wined3d_gl_info
*gl_info
= &adapter
->gl_info
;
1863 struct wined3d_vertex_caps vertex_caps
;
1864 DWORD ckey_caps
, blit_caps
, fx_caps
;
1865 struct fragment_caps fragment_caps
;
1866 struct shader_caps shader_caps
;
1868 TRACE("wined3d %p, adapter_idx %u, device_type %s, caps %p.\n",
1869 wined3d
, adapter_idx
, debug_d3ddevicetype(device_type
), caps
);
1871 if (adapter_idx
>= wined3d
->adapter_count
)
1872 return WINED3DERR_INVALIDCALL
;
1874 caps
->DeviceType
= (device_type
== WINED3D_DEVICE_TYPE_HAL
) ? WINED3D_DEVICE_TYPE_HAL
: WINED3D_DEVICE_TYPE_REF
;
1875 caps
->AdapterOrdinal
= adapter_idx
;
1878 caps
->Caps2
= WINED3DCAPS2_CANRENDERWINDOWED
|
1879 WINED3DCAPS2_FULLSCREENGAMMA
|
1880 WINED3DCAPS2_DYNAMICTEXTURES
;
1881 if (gl_info
->supported
[ARB_FRAMEBUFFER_OBJECT
] || gl_info
->supported
[EXT_FRAMEBUFFER_OBJECT
])
1882 caps
->Caps2
|= WINED3DCAPS2_CANGENMIPMAP
;
1884 caps
->Caps3
= WINED3DCAPS3_ALPHA_FULLSCREEN_FLIP_OR_DISCARD
|
1885 WINED3DCAPS3_COPY_TO_VIDMEM
|
1886 WINED3DCAPS3_COPY_TO_SYSTEMMEM
;
1888 caps
->CursorCaps
= WINED3DCURSORCAPS_COLOR
|
1889 WINED3DCURSORCAPS_LOWRES
;
1891 caps
->DevCaps
= WINED3DDEVCAPS_FLOATTLVERTEX
|
1892 WINED3DDEVCAPS_EXECUTESYSTEMMEMORY
|
1893 WINED3DDEVCAPS_TLVERTEXSYSTEMMEMORY
|
1894 WINED3DDEVCAPS_TLVERTEXVIDEOMEMORY
|
1895 WINED3DDEVCAPS_DRAWPRIMTLVERTEX
|
1896 WINED3DDEVCAPS_HWTRANSFORMANDLIGHT
|
1897 WINED3DDEVCAPS_EXECUTEVIDEOMEMORY
|
1898 WINED3DDEVCAPS_PUREDEVICE
|
1899 WINED3DDEVCAPS_HWRASTERIZATION
|
1900 WINED3DDEVCAPS_TEXTUREVIDEOMEMORY
|
1901 WINED3DDEVCAPS_TEXTURESYSTEMMEMORY
|
1902 WINED3DDEVCAPS_CANRENDERAFTERFLIP
|
1903 WINED3DDEVCAPS_DRAWPRIMITIVES2
|
1904 WINED3DDEVCAPS_DRAWPRIMITIVES2EX
;
1906 caps
->PrimitiveMiscCaps
= WINED3DPMISCCAPS_CULLNONE
|
1907 WINED3DPMISCCAPS_CULLCCW
|
1908 WINED3DPMISCCAPS_CULLCW
|
1909 WINED3DPMISCCAPS_COLORWRITEENABLE
|
1910 WINED3DPMISCCAPS_CLIPTLVERTS
|
1911 WINED3DPMISCCAPS_CLIPPLANESCALEDPOINTS
|
1912 WINED3DPMISCCAPS_MASKZ
|
1913 WINED3DPMISCCAPS_MRTPOSTPIXELSHADERBLENDING
;
1915 WINED3DPMISCCAPS_NULLREFERENCE
1916 WINED3DPMISCCAPS_FOGANDSPECULARALPHA
1917 WINED3DPMISCCAPS_MRTINDEPENDENTBITDEPTHS
1918 WINED3DPMISCCAPS_FOGVERTEXCLAMPED */
1920 if (gl_info
->supported
[WINED3D_GL_BLEND_EQUATION
])
1921 caps
->PrimitiveMiscCaps
|= WINED3DPMISCCAPS_BLENDOP
;
1922 if (gl_info
->supported
[EXT_BLEND_EQUATION_SEPARATE
] && gl_info
->supported
[EXT_BLEND_FUNC_SEPARATE
])
1923 caps
->PrimitiveMiscCaps
|= WINED3DPMISCCAPS_SEPARATEALPHABLEND
;
1924 if (gl_info
->supported
[EXT_DRAW_BUFFERS2
])
1925 caps
->PrimitiveMiscCaps
|= WINED3DPMISCCAPS_INDEPENDENTWRITEMASKS
;
1926 if (gl_info
->supported
[ARB_FRAMEBUFFER_SRGB
])
1927 caps
->PrimitiveMiscCaps
|= WINED3DPMISCCAPS_POSTBLENDSRGBCONVERT
;
1929 caps
->RasterCaps
= WINED3DPRASTERCAPS_DITHER
|
1930 WINED3DPRASTERCAPS_PAT
|
1931 WINED3DPRASTERCAPS_WFOG
|
1932 WINED3DPRASTERCAPS_ZFOG
|
1933 WINED3DPRASTERCAPS_FOGVERTEX
|
1934 WINED3DPRASTERCAPS_FOGTABLE
|
1935 WINED3DPRASTERCAPS_STIPPLE
|
1936 WINED3DPRASTERCAPS_SUBPIXEL
|
1937 WINED3DPRASTERCAPS_ZTEST
|
1938 WINED3DPRASTERCAPS_SCISSORTEST
|
1939 WINED3DPRASTERCAPS_SLOPESCALEDEPTHBIAS
|
1940 WINED3DPRASTERCAPS_DEPTHBIAS
;
1942 if (gl_info
->supported
[ARB_TEXTURE_FILTER_ANISOTROPIC
])
1944 caps
->RasterCaps
|= WINED3DPRASTERCAPS_ANISOTROPY
|
1945 WINED3DPRASTERCAPS_ZBIAS
|
1946 WINED3DPRASTERCAPS_MIPMAPLODBIAS
;
1949 caps
->ZCmpCaps
= WINED3DPCMPCAPS_ALWAYS
|
1950 WINED3DPCMPCAPS_EQUAL
|
1951 WINED3DPCMPCAPS_GREATER
|
1952 WINED3DPCMPCAPS_GREATEREQUAL
|
1953 WINED3DPCMPCAPS_LESS
|
1954 WINED3DPCMPCAPS_LESSEQUAL
|
1955 WINED3DPCMPCAPS_NEVER
|
1956 WINED3DPCMPCAPS_NOTEQUAL
;
1958 /* WINED3DPBLENDCAPS_BOTHINVSRCALPHA and WINED3DPBLENDCAPS_BOTHSRCALPHA
1959 * are legacy settings for srcblend only. */
1960 caps
->SrcBlendCaps
= WINED3DPBLENDCAPS_BOTHINVSRCALPHA
|
1961 WINED3DPBLENDCAPS_BOTHSRCALPHA
|
1962 WINED3DPBLENDCAPS_DESTALPHA
|
1963 WINED3DPBLENDCAPS_DESTCOLOR
|
1964 WINED3DPBLENDCAPS_INVDESTALPHA
|
1965 WINED3DPBLENDCAPS_INVDESTCOLOR
|
1966 WINED3DPBLENDCAPS_INVSRCALPHA
|
1967 WINED3DPBLENDCAPS_INVSRCCOLOR
|
1968 WINED3DPBLENDCAPS_ONE
|
1969 WINED3DPBLENDCAPS_SRCALPHA
|
1970 WINED3DPBLENDCAPS_SRCALPHASAT
|
1971 WINED3DPBLENDCAPS_SRCCOLOR
|
1972 WINED3DPBLENDCAPS_ZERO
;
1974 caps
->DestBlendCaps
= WINED3DPBLENDCAPS_DESTALPHA
|
1975 WINED3DPBLENDCAPS_DESTCOLOR
|
1976 WINED3DPBLENDCAPS_INVDESTALPHA
|
1977 WINED3DPBLENDCAPS_INVDESTCOLOR
|
1978 WINED3DPBLENDCAPS_INVSRCALPHA
|
1979 WINED3DPBLENDCAPS_INVSRCCOLOR
|
1980 WINED3DPBLENDCAPS_ONE
|
1981 WINED3DPBLENDCAPS_SRCALPHA
|
1982 WINED3DPBLENDCAPS_SRCCOLOR
|
1983 WINED3DPBLENDCAPS_ZERO
;
1985 if (gl_info
->supported
[ARB_BLEND_FUNC_EXTENDED
])
1986 caps
->DestBlendCaps
|= WINED3DPBLENDCAPS_SRCALPHASAT
;
1988 if (gl_info
->supported
[EXT_BLEND_COLOR
])
1990 caps
->SrcBlendCaps
|= WINED3DPBLENDCAPS_BLENDFACTOR
;
1991 caps
->DestBlendCaps
|= WINED3DPBLENDCAPS_BLENDFACTOR
;
1995 caps
->AlphaCmpCaps
= WINED3DPCMPCAPS_ALWAYS
|
1996 WINED3DPCMPCAPS_EQUAL
|
1997 WINED3DPCMPCAPS_GREATER
|
1998 WINED3DPCMPCAPS_GREATEREQUAL
|
1999 WINED3DPCMPCAPS_LESS
|
2000 WINED3DPCMPCAPS_LESSEQUAL
|
2001 WINED3DPCMPCAPS_NEVER
|
2002 WINED3DPCMPCAPS_NOTEQUAL
;
2004 caps
->ShadeCaps
= WINED3DPSHADECAPS_SPECULARGOURAUDRGB
|
2005 WINED3DPSHADECAPS_COLORGOURAUDRGB
|
2006 WINED3DPSHADECAPS_ALPHAFLATBLEND
|
2007 WINED3DPSHADECAPS_ALPHAGOURAUDBLEND
|
2008 WINED3DPSHADECAPS_COLORFLATRGB
|
2009 WINED3DPSHADECAPS_FOGFLAT
|
2010 WINED3DPSHADECAPS_FOGGOURAUD
|
2011 WINED3DPSHADECAPS_SPECULARFLATRGB
;
2013 caps
->TextureCaps
= WINED3DPTEXTURECAPS_ALPHA
|
2014 WINED3DPTEXTURECAPS_ALPHAPALETTE
|
2015 WINED3DPTEXTURECAPS_TRANSPARENCY
|
2016 WINED3DPTEXTURECAPS_BORDER
|
2017 WINED3DPTEXTURECAPS_MIPMAP
|
2018 WINED3DPTEXTURECAPS_PROJECTED
|
2019 WINED3DPTEXTURECAPS_PERSPECTIVE
;
2021 if (!d3d_info
->texture_npot
)
2023 caps
->TextureCaps
|= WINED3DPTEXTURECAPS_POW2
;
2024 if (d3d_info
->texture_npot_conditional
)
2025 caps
->TextureCaps
|= WINED3DPTEXTURECAPS_NONPOW2CONDITIONAL
;
2028 if (gl_info
->supported
[EXT_TEXTURE3D
])
2030 caps
->TextureCaps
|= WINED3DPTEXTURECAPS_VOLUMEMAP
2031 | WINED3DPTEXTURECAPS_MIPVOLUMEMAP
;
2032 if (!d3d_info
->texture_npot
)
2033 caps
->TextureCaps
|= WINED3DPTEXTURECAPS_VOLUMEMAP_POW2
;
2036 if (gl_info
->supported
[ARB_TEXTURE_CUBE_MAP
])
2038 caps
->TextureCaps
|= WINED3DPTEXTURECAPS_CUBEMAP
2039 | WINED3DPTEXTURECAPS_MIPCUBEMAP
;
2040 if (!d3d_info
->texture_npot
)
2041 caps
->TextureCaps
|= WINED3DPTEXTURECAPS_CUBEMAP_POW2
;
2044 caps
->TextureFilterCaps
= WINED3DPTFILTERCAPS_MAGFLINEAR
|
2045 WINED3DPTFILTERCAPS_MAGFPOINT
|
2046 WINED3DPTFILTERCAPS_MINFLINEAR
|
2047 WINED3DPTFILTERCAPS_MINFPOINT
|
2048 WINED3DPTFILTERCAPS_MIPFLINEAR
|
2049 WINED3DPTFILTERCAPS_MIPFPOINT
|
2050 WINED3DPTFILTERCAPS_LINEAR
|
2051 WINED3DPTFILTERCAPS_LINEARMIPLINEAR
|
2052 WINED3DPTFILTERCAPS_LINEARMIPNEAREST
|
2053 WINED3DPTFILTERCAPS_MIPLINEAR
|
2054 WINED3DPTFILTERCAPS_MIPNEAREST
|
2055 WINED3DPTFILTERCAPS_NEAREST
;
2057 if (gl_info
->supported
[ARB_TEXTURE_FILTER_ANISOTROPIC
])
2059 caps
->TextureFilterCaps
|= WINED3DPTFILTERCAPS_MAGFANISOTROPIC
|
2060 WINED3DPTFILTERCAPS_MINFANISOTROPIC
;
2063 if (gl_info
->supported
[ARB_TEXTURE_CUBE_MAP
])
2065 caps
->CubeTextureFilterCaps
= WINED3DPTFILTERCAPS_MAGFLINEAR
|
2066 WINED3DPTFILTERCAPS_MAGFPOINT
|
2067 WINED3DPTFILTERCAPS_MINFLINEAR
|
2068 WINED3DPTFILTERCAPS_MINFPOINT
|
2069 WINED3DPTFILTERCAPS_MIPFLINEAR
|
2070 WINED3DPTFILTERCAPS_MIPFPOINT
|
2071 WINED3DPTFILTERCAPS_LINEAR
|
2072 WINED3DPTFILTERCAPS_LINEARMIPLINEAR
|
2073 WINED3DPTFILTERCAPS_LINEARMIPNEAREST
|
2074 WINED3DPTFILTERCAPS_MIPLINEAR
|
2075 WINED3DPTFILTERCAPS_MIPNEAREST
|
2076 WINED3DPTFILTERCAPS_NEAREST
;
2078 if (gl_info
->supported
[ARB_TEXTURE_FILTER_ANISOTROPIC
])
2080 caps
->CubeTextureFilterCaps
|= WINED3DPTFILTERCAPS_MAGFANISOTROPIC
|
2081 WINED3DPTFILTERCAPS_MINFANISOTROPIC
;
2086 caps
->CubeTextureFilterCaps
= 0;
2089 if (gl_info
->supported
[EXT_TEXTURE3D
])
2091 caps
->VolumeTextureFilterCaps
= WINED3DPTFILTERCAPS_MAGFLINEAR
|
2092 WINED3DPTFILTERCAPS_MAGFPOINT
|
2093 WINED3DPTFILTERCAPS_MINFLINEAR
|
2094 WINED3DPTFILTERCAPS_MINFPOINT
|
2095 WINED3DPTFILTERCAPS_MIPFLINEAR
|
2096 WINED3DPTFILTERCAPS_MIPFPOINT
|
2097 WINED3DPTFILTERCAPS_LINEAR
|
2098 WINED3DPTFILTERCAPS_LINEARMIPLINEAR
|
2099 WINED3DPTFILTERCAPS_LINEARMIPNEAREST
|
2100 WINED3DPTFILTERCAPS_MIPLINEAR
|
2101 WINED3DPTFILTERCAPS_MIPNEAREST
|
2102 WINED3DPTFILTERCAPS_NEAREST
;
2106 caps
->VolumeTextureFilterCaps
= 0;
2109 caps
->TextureAddressCaps
= WINED3DPTADDRESSCAPS_INDEPENDENTUV
|
2110 WINED3DPTADDRESSCAPS_CLAMP
|
2111 WINED3DPTADDRESSCAPS_WRAP
;
2113 if (gl_info
->supported
[ARB_TEXTURE_BORDER_CLAMP
])
2115 caps
->TextureAddressCaps
|= WINED3DPTADDRESSCAPS_BORDER
;
2117 if (gl_info
->supported
[ARB_TEXTURE_MIRRORED_REPEAT
])
2119 caps
->TextureAddressCaps
|= WINED3DPTADDRESSCAPS_MIRROR
;
2121 if (gl_info
->supported
[ARB_TEXTURE_MIRROR_CLAMP_TO_EDGE
])
2123 caps
->TextureAddressCaps
|= WINED3DPTADDRESSCAPS_MIRRORONCE
;
2126 if (gl_info
->supported
[EXT_TEXTURE3D
])
2128 caps
->VolumeTextureAddressCaps
= WINED3DPTADDRESSCAPS_INDEPENDENTUV
|
2129 WINED3DPTADDRESSCAPS_CLAMP
|
2130 WINED3DPTADDRESSCAPS_WRAP
;
2131 if (gl_info
->supported
[ARB_TEXTURE_BORDER_CLAMP
])
2133 caps
->VolumeTextureAddressCaps
|= WINED3DPTADDRESSCAPS_BORDER
;
2135 if (gl_info
->supported
[ARB_TEXTURE_MIRRORED_REPEAT
])
2137 caps
->VolumeTextureAddressCaps
|= WINED3DPTADDRESSCAPS_MIRROR
;
2139 if (gl_info
->supported
[ARB_TEXTURE_MIRROR_CLAMP_TO_EDGE
])
2141 caps
->VolumeTextureAddressCaps
|= WINED3DPTADDRESSCAPS_MIRRORONCE
;
2146 caps
->VolumeTextureAddressCaps
= 0;
2149 caps
->LineCaps
= WINED3DLINECAPS_TEXTURE
|
2150 WINED3DLINECAPS_ZTEST
|
2151 WINED3DLINECAPS_BLEND
|
2152 WINED3DLINECAPS_ALPHACMP
|
2153 WINED3DLINECAPS_FOG
;
2154 /* WINED3DLINECAPS_ANTIALIAS is not supported on Windows, and dx and gl seem to have a different
2155 * idea how generating the smoothing alpha values works; the result is different
2158 caps
->MaxTextureWidth
= gl_info
->limits
.texture_size
;
2159 caps
->MaxTextureHeight
= gl_info
->limits
.texture_size
;
2161 if (gl_info
->supported
[EXT_TEXTURE3D
])
2162 caps
->MaxVolumeExtent
= gl_info
->limits
.texture3d_size
;
2164 caps
->MaxVolumeExtent
= 0;
2166 caps
->MaxTextureRepeat
= 32768;
2167 caps
->MaxTextureAspectRatio
= gl_info
->limits
.texture_size
;
2168 caps
->MaxVertexW
= 1.0f
;
2170 caps
->GuardBandLeft
= 0.0f
;
2171 caps
->GuardBandTop
= 0.0f
;
2172 caps
->GuardBandRight
= 0.0f
;
2173 caps
->GuardBandBottom
= 0.0f
;
2175 caps
->ExtentsAdjust
= 0.0f
;
2177 caps
->StencilCaps
= WINED3DSTENCILCAPS_DECRSAT
|
2178 WINED3DSTENCILCAPS_INCRSAT
|
2179 WINED3DSTENCILCAPS_INVERT
|
2180 WINED3DSTENCILCAPS_KEEP
|
2181 WINED3DSTENCILCAPS_REPLACE
|
2182 WINED3DSTENCILCAPS_ZERO
;
2183 if (gl_info
->supported
[EXT_STENCIL_WRAP
])
2185 caps
->StencilCaps
|= WINED3DSTENCILCAPS_DECR
|
2186 WINED3DSTENCILCAPS_INCR
;
2188 if (gl_info
->supported
[WINED3D_GL_VERSION_2_0
] || gl_info
->supported
[EXT_STENCIL_TWO_SIDE
]
2189 || gl_info
->supported
[ATI_SEPARATE_STENCIL
])
2191 caps
->StencilCaps
|= WINED3DSTENCILCAPS_TWOSIDED
;
2194 caps
->MaxAnisotropy
= gl_info
->limits
.anisotropy
;
2195 caps
->MaxPointSize
= d3d_info
->limits
.pointsize_max
;
2197 caps
->MaxPrimitiveCount
= 0x555555; /* Taken from an AMD Radeon HD 5700 (Evergreen) GPU. */
2198 caps
->MaxVertexIndex
= 0xffffff; /* Taken from an AMD Radeon HD 5700 (Evergreen) GPU. */
2199 caps
->MaxStreams
= MAX_STREAMS
;
2200 caps
->MaxStreamStride
= 1024;
2202 /* d3d9.dll sets D3DDEVCAPS2_CAN_STRETCHRECT_FROM_TEXTURES here because StretchRects is implemented in d3d9 */
2203 caps
->DevCaps2
= WINED3DDEVCAPS2_STREAMOFFSET
|
2204 WINED3DDEVCAPS2_VERTEXELEMENTSCANSHARESTREAMOFFSET
;
2205 caps
->MaxNpatchTessellationLevel
= 0;
2206 caps
->MasterAdapterOrdinal
= 0;
2207 caps
->AdapterOrdinalInGroup
= 0;
2208 caps
->NumberOfAdaptersInGroup
= 1;
2210 caps
->NumSimultaneousRTs
= d3d_info
->limits
.max_rt_count
;
2212 caps
->StretchRectFilterCaps
= WINED3DPTFILTERCAPS_MINFPOINT
|
2213 WINED3DPTFILTERCAPS_MAGFPOINT
|
2214 WINED3DPTFILTERCAPS_MINFLINEAR
|
2215 WINED3DPTFILTERCAPS_MAGFLINEAR
;
2216 caps
->VertexTextureFilterCaps
= 0;
2218 adapter
->shader_backend
->shader_get_caps(gl_info
, &shader_caps
);
2219 adapter
->fragment_pipe
->get_caps(gl_info
, &fragment_caps
);
2220 adapter
->vertex_pipe
->vp_get_caps(gl_info
, &vertex_caps
);
2222 /* Add shader misc caps. Only some of them belong to the shader parts of the pipeline */
2223 caps
->PrimitiveMiscCaps
|= fragment_caps
.PrimitiveMiscCaps
;
2225 caps
->VertexShaderVersion
= shader_caps
.vs_version
;
2226 caps
->MaxVertexShaderConst
= shader_caps
.vs_uniform_count
;
2228 caps
->PixelShaderVersion
= shader_caps
.ps_version
;
2229 caps
->PixelShader1xMaxValue
= shader_caps
.ps_1x_max_value
;
2231 caps
->TextureOpCaps
= fragment_caps
.TextureOpCaps
;
2232 caps
->MaxTextureBlendStages
= fragment_caps
.MaxTextureBlendStages
;
2233 caps
->MaxSimultaneousTextures
= fragment_caps
.MaxSimultaneousTextures
;
2235 caps
->MaxUserClipPlanes
= vertex_caps
.max_user_clip_planes
;
2236 caps
->MaxActiveLights
= vertex_caps
.max_active_lights
;
2237 caps
->MaxVertexBlendMatrices
= vertex_caps
.max_vertex_blend_matrices
;
2238 caps
->MaxVertexBlendMatrixIndex
= vertex_caps
.max_vertex_blend_matrix_index
;
2239 caps
->VertexProcessingCaps
= vertex_caps
.vertex_processing_caps
;
2240 caps
->FVFCaps
= vertex_caps
.fvf_caps
;
2241 caps
->RasterCaps
|= vertex_caps
.raster_caps
;
2243 /* The following caps are shader specific, but they are things we cannot detect, or which
2244 * are the same among all shader models. So to avoid code duplication set the shader version
2245 * specific, but otherwise constant caps here
2247 if (caps
->VertexShaderVersion
>= 3)
2249 /* Where possible set the caps based on OpenGL extensions and if they
2250 * aren't set (in case of software rendering) use the VS 3.0 from
2251 * MSDN or else if there's OpenGL spec use a hardcoded value minimum
2253 caps
->VS20Caps
.caps
= WINED3DVS20CAPS_PREDICATION
;
2254 /* VS 3.0 requires MAX_DYNAMICFLOWCONTROLDEPTH (24) */
2255 caps
->VS20Caps
.dynamic_flow_control_depth
= WINED3DVS20_MAX_DYNAMICFLOWCONTROLDEPTH
;
2256 caps
->VS20Caps
.temp_count
= max(32, gl_info
->limits
.arb_vs_temps
);
2257 /* level of nesting in loops / if-statements; VS 3.0 requires MAX (4) */
2258 caps
->VS20Caps
.static_flow_control_depth
= WINED3DVS20_MAX_STATICFLOWCONTROLDEPTH
;
2260 caps
->MaxVShaderInstructionsExecuted
= 65535; /* VS 3.0 needs at least 65535, some cards even use 2^32-1 */
2261 caps
->MaxVertexShader30InstructionSlots
= max(512, gl_info
->limits
.arb_vs_instructions
);
2262 caps
->VertexTextureFilterCaps
= WINED3DPTFILTERCAPS_MINFPOINT
| WINED3DPTFILTERCAPS_MAGFPOINT
;
2264 else if (caps
->VertexShaderVersion
== 2)
2266 caps
->VS20Caps
.caps
= 0;
2267 caps
->VS20Caps
.dynamic_flow_control_depth
= WINED3DVS20_MIN_DYNAMICFLOWCONTROLDEPTH
;
2268 caps
->VS20Caps
.temp_count
= max(12, gl_info
->limits
.arb_vs_temps
);
2269 caps
->VS20Caps
.static_flow_control_depth
= 1;
2271 caps
->MaxVShaderInstructionsExecuted
= 65535;
2272 caps
->MaxVertexShader30InstructionSlots
= 0;
2276 caps
->VS20Caps
.caps
= 0;
2277 caps
->VS20Caps
.dynamic_flow_control_depth
= 0;
2278 caps
->VS20Caps
.temp_count
= 0;
2279 caps
->VS20Caps
.static_flow_control_depth
= 0;
2281 caps
->MaxVShaderInstructionsExecuted
= 0;
2282 caps
->MaxVertexShader30InstructionSlots
= 0;
2285 if (caps
->PixelShaderVersion
>= 3)
2287 /* Where possible set the caps based on OpenGL extensions and if they
2288 * aren't set (in case of software rendering) use the PS 3.0 from
2289 * MSDN or else if there's OpenGL spec use a hardcoded value minimum
2292 /* Caps is more or less undocumented on MSDN but it appears to be
2293 * used for PS20Caps based on results from R9600/FX5900/Geforce6800
2294 * cards from Windows */
2295 caps
->PS20Caps
.caps
= WINED3DPS20CAPS_ARBITRARYSWIZZLE
|
2296 WINED3DPS20CAPS_GRADIENTINSTRUCTIONS
|
2297 WINED3DPS20CAPS_PREDICATION
|
2298 WINED3DPS20CAPS_NODEPENDENTREADLIMIT
|
2299 WINED3DPS20CAPS_NOTEXINSTRUCTIONLIMIT
;
2300 /* PS 3.0 requires MAX_DYNAMICFLOWCONTROLDEPTH (24) */
2301 caps
->PS20Caps
.dynamic_flow_control_depth
= WINED3DPS20_MAX_DYNAMICFLOWCONTROLDEPTH
;
2302 caps
->PS20Caps
.temp_count
= max(32, gl_info
->limits
.arb_ps_temps
);
2303 /* PS 3.0 requires MAX_STATICFLOWCONTROLDEPTH (4) */
2304 caps
->PS20Caps
.static_flow_control_depth
= WINED3DPS20_MAX_STATICFLOWCONTROLDEPTH
;
2305 /* PS 3.0 requires MAX_NUMINSTRUCTIONSLOTS (512) */
2306 caps
->PS20Caps
.instruction_slot_count
= WINED3DPS20_MAX_NUMINSTRUCTIONSLOTS
;
2308 caps
->MaxPShaderInstructionsExecuted
= 65535;
2309 caps
->MaxPixelShader30InstructionSlots
= max(WINED3DMIN30SHADERINSTRUCTIONS
,
2310 gl_info
->limits
.arb_ps_instructions
);
2312 else if(caps
->PixelShaderVersion
== 2)
2314 /* Below we assume PS2.0 specs, not extended 2.0a(GeforceFX)/2.0b(Radeon R3xx) ones */
2315 caps
->PS20Caps
.caps
= 0;
2316 caps
->PS20Caps
.dynamic_flow_control_depth
= 0; /* WINED3DVS20_MIN_DYNAMICFLOWCONTROLDEPTH = 0 */
2317 caps
->PS20Caps
.temp_count
= max(12, gl_info
->limits
.arb_ps_temps
);
2318 caps
->PS20Caps
.static_flow_control_depth
= WINED3DPS20_MIN_STATICFLOWCONTROLDEPTH
; /* Minimum: 1 */
2319 /* Minimum number (64 ALU + 32 Texture), a GeforceFX uses 512 */
2320 caps
->PS20Caps
.instruction_slot_count
= WINED3DPS20_MIN_NUMINSTRUCTIONSLOTS
;
2322 caps
->MaxPShaderInstructionsExecuted
= 512; /* Minimum value, a GeforceFX uses 1024 */
2323 caps
->MaxPixelShader30InstructionSlots
= 0;
2327 caps
->PS20Caps
.caps
= 0;
2328 caps
->PS20Caps
.dynamic_flow_control_depth
= 0;
2329 caps
->PS20Caps
.temp_count
= 0;
2330 caps
->PS20Caps
.static_flow_control_depth
= 0;
2331 caps
->PS20Caps
.instruction_slot_count
= 0;
2333 caps
->MaxPShaderInstructionsExecuted
= 0;
2334 caps
->MaxPixelShader30InstructionSlots
= 0;
2337 if (caps
->VertexShaderVersion
>= 2)
2339 /* OpenGL supports all the formats below, perhaps not always
2340 * without conversion, but it supports them.
2341 * Further GLSL doesn't seem to have an official unsigned type so
2342 * don't advertise it yet as I'm not sure how we handle it.
2343 * We might need to add some clamping in the shader engine to
2345 * TODO: WINED3DDTCAPS_USHORT2N, WINED3DDTCAPS_USHORT4N, WINED3DDTCAPS_UDEC3, WINED3DDTCAPS_DEC3N */
2346 caps
->DeclTypes
= WINED3DDTCAPS_UBYTE4
|
2347 WINED3DDTCAPS_UBYTE4N
|
2348 WINED3DDTCAPS_SHORT2N
|
2349 WINED3DDTCAPS_SHORT4N
;
2350 if (gl_info
->supported
[ARB_HALF_FLOAT_VERTEX
])
2352 caps
->DeclTypes
|= WINED3DDTCAPS_FLOAT16_2
|
2353 WINED3DDTCAPS_FLOAT16_4
;
2358 caps
->DeclTypes
= 0;
2361 /* Set DirectDraw helper Caps */
2362 ckey_caps
= WINEDDCKEYCAPS_DESTBLT
|
2363 WINEDDCKEYCAPS_SRCBLT
;
2364 fx_caps
= WINEDDFXCAPS_BLTALPHA
|
2365 WINEDDFXCAPS_BLTMIRRORLEFTRIGHT
|
2366 WINEDDFXCAPS_BLTMIRRORUPDOWN
|
2367 WINEDDFXCAPS_BLTROTATION90
|
2368 WINEDDFXCAPS_BLTSHRINKX
|
2369 WINEDDFXCAPS_BLTSHRINKXN
|
2370 WINEDDFXCAPS_BLTSHRINKY
|
2371 WINEDDFXCAPS_BLTSHRINKYN
|
2372 WINEDDFXCAPS_BLTSTRETCHX
|
2373 WINEDDFXCAPS_BLTSTRETCHXN
|
2374 WINEDDFXCAPS_BLTSTRETCHY
|
2375 WINEDDFXCAPS_BLTSTRETCHYN
;
2376 blit_caps
= WINEDDCAPS_BLT
|
2377 WINEDDCAPS_BLTCOLORFILL
|
2378 WINEDDCAPS_BLTDEPTHFILL
|
2379 WINEDDCAPS_BLTSTRETCH
|
2380 WINEDDCAPS_CANBLTSYSMEM
|
2381 WINEDDCAPS_CANCLIP
|
2382 WINEDDCAPS_CANCLIPSTRETCHED
|
2383 WINEDDCAPS_COLORKEY
|
2384 WINEDDCAPS_COLORKEYHWASSIST
;
2386 /* Fill the ddraw caps structure */
2387 caps
->ddraw_caps
.caps
= WINEDDCAPS_GDI
|
2388 WINEDDCAPS_PALETTE
|
2390 caps
->ddraw_caps
.caps2
= WINEDDCAPS2_CERTIFIED
|
2391 WINEDDCAPS2_NOPAGELOCKREQUIRED
|
2392 WINEDDCAPS2_PRIMARYGAMMA
|
2393 WINEDDCAPS2_WIDESURFACES
|
2394 WINEDDCAPS2_CANRENDERWINDOWED
;
2395 caps
->ddraw_caps
.color_key_caps
= ckey_caps
;
2396 caps
->ddraw_caps
.fx_caps
= fx_caps
;
2397 caps
->ddraw_caps
.svb_caps
= blit_caps
;
2398 caps
->ddraw_caps
.svb_color_key_caps
= ckey_caps
;
2399 caps
->ddraw_caps
.svb_fx_caps
= fx_caps
;
2400 caps
->ddraw_caps
.vsb_caps
= blit_caps
;
2401 caps
->ddraw_caps
.vsb_color_key_caps
= ckey_caps
;
2402 caps
->ddraw_caps
.vsb_fx_caps
= fx_caps
;
2403 caps
->ddraw_caps
.ssb_caps
= blit_caps
;
2404 caps
->ddraw_caps
.ssb_color_key_caps
= ckey_caps
;
2405 caps
->ddraw_caps
.ssb_fx_caps
= fx_caps
;
2407 caps
->ddraw_caps
.dds_caps
= WINEDDSCAPS_ALPHA
|
2408 WINEDDSCAPS_BACKBUFFER
|
2410 WINEDDSCAPS_FRONTBUFFER
|
2411 WINEDDSCAPS_OFFSCREENPLAIN
|
2412 WINEDDSCAPS_PALETTE
|
2413 WINEDDSCAPS_PRIMARYSURFACE
|
2414 WINEDDSCAPS_SYSTEMMEMORY
|
2415 WINEDDSCAPS_VIDEOMEMORY
|
2416 WINEDDSCAPS_VISIBLE
;
2418 if (!(wined3d
->flags
& WINED3D_NO3D
))
2420 caps
->ddraw_caps
.dds_caps
|= WINEDDSCAPS_3DDEVICE
|
2421 WINEDDSCAPS_MIPMAP
|
2422 WINEDDSCAPS_TEXTURE
|
2423 WINEDDSCAPS_ZBUFFER
;
2424 caps
->ddraw_caps
.caps
|= WINEDDCAPS_3D
;
2427 caps
->shader_double_precision
= d3d_info
->shader_double_precision
;
2429 caps
->max_feature_level
= d3d_info
->feature_level
;
2434 HRESULT CDECL
wined3d_device_create(struct wined3d
*wined3d
, UINT adapter_idx
, enum wined3d_device_type device_type
,
2435 HWND focus_window
, DWORD flags
, BYTE surface_alignment
, struct wined3d_device_parent
*device_parent
,
2436 struct wined3d_device
**device
)
2438 struct wined3d_device
*object
;
2441 TRACE("wined3d %p, adapter_idx %u, device_type %#x, focus_window %p, "
2442 "flags %#x, surface_alignment %u, device_parent %p, device %p.\n",
2443 wined3d
, adapter_idx
, device_type
, focus_window
, flags
, surface_alignment
, device_parent
, device
);
2445 if (adapter_idx
>= wined3d
->adapter_count
)
2446 return WINED3DERR_INVALIDCALL
;
2448 if (!(object
= heap_alloc_zero(sizeof(*object
))))
2449 return E_OUTOFMEMORY
;
2451 hr
= device_init(object
, wined3d
, adapter_idx
, device_type
,
2452 focus_window
, flags
, surface_alignment
, device_parent
);
2455 WARN("Failed to initialize device, hr %#x.\n", hr
);
2460 TRACE("Created device %p.\n", object
);
2463 device_parent
->ops
->wined3d_device_created(device_parent
, *device
);
2468 static BOOL
wined3d_adapter_no3d_create_context(struct wined3d_context
*context
,
2469 struct wined3d_texture
*target
, const struct wined3d_format
*ds_format
)
2474 static const struct wined3d_adapter_ops wined3d_adapter_no3d_ops
=
2476 wined3d_adapter_no3d_create_context
,
2479 static BOOL
wined3d_adapter_no3d_init(struct wined3d_adapter
*adapter
)
2481 static const struct wined3d_gpu_description gpu_description
=
2483 HW_VENDOR_SOFTWARE
, CARD_WINE
, "WineD3D DirectDraw Emulation", DRIVER_WINE
, 128,
2486 TRACE("adapter %p.\n", adapter
);
2488 wined3d_driver_info_init(&adapter
->driver_info
, &gpu_description
, 0);
2489 adapter
->vram_bytes
= adapter
->driver_info
.vram_bytes
;
2490 adapter
->vram_bytes_used
= 0;
2491 TRACE("Emulating 0x%s bytes of video ram.\n", wine_dbgstr_longlong(adapter
->vram_bytes
));
2493 if (!wined3d_adapter_init_format_info(adapter
, NULL
))
2496 adapter
->vertex_pipe
= &none_vertex_pipe
;
2497 adapter
->fragment_pipe
= &none_fragment_pipe
;
2498 adapter
->shader_backend
= &none_shader_backend
;
2499 adapter
->adapter_ops
= &wined3d_adapter_no3d_ops
;
2504 static BOOL
wined3d_adapter_init(struct wined3d_adapter
*adapter
, unsigned int ordinal
, DWORD wined3d_creation_flags
)
2506 DISPLAY_DEVICEW display_device
;
2508 adapter
->ordinal
= ordinal
;
2510 display_device
.cb
= sizeof(display_device
);
2511 EnumDisplayDevicesW(NULL
, ordinal
, &display_device
, 0);
2512 TRACE("Display device: %s\n", debugstr_w(display_device
.DeviceName
));
2513 strcpyW(adapter
->DeviceName
, display_device
.DeviceName
);
2515 if (!AllocateLocallyUniqueId(&adapter
->luid
))
2517 ERR("Failed to set adapter LUID (%#x).\n", GetLastError());
2520 TRACE("Allocated LUID %08x:%08x for adapter %p.\n",
2521 adapter
->luid
.HighPart
, adapter
->luid
.LowPart
, adapter
);
2523 adapter
->formats
= NULL
;
2525 if (wined3d_creation_flags
& WINED3D_NO3D
)
2526 return wined3d_adapter_no3d_init(adapter
);
2527 return wined3d_adapter_gl_init(adapter
, wined3d_creation_flags
);
2530 static void STDMETHODCALLTYPE
wined3d_null_wined3d_object_destroyed(void *parent
) {}
2532 const struct wined3d_parent_ops wined3d_null_parent_ops
=
2534 wined3d_null_wined3d_object_destroyed
,
2537 HRESULT
wined3d_init(struct wined3d
*wined3d
, DWORD flags
)
2540 wined3d
->flags
= flags
;
2542 TRACE("Initialising adapters.\n");
2544 if (!wined3d_adapter_init(&wined3d
->adapters
[0], 0, flags
))
2546 WARN("Failed to initialise adapter.\n");
2549 wined3d
->adapter_count
= 1;