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
)
620 static const struct wined3d_fallback_card
622 enum wined3d_feature_level feature_level
;
623 enum wined3d_pci_device device_id
;
625 card_fallback_nvidia
[] =
627 {WINED3D_FEATURE_LEVEL_5
, CARD_NVIDIA_RIVA_128
},
628 {WINED3D_FEATURE_LEVEL_6
, CARD_NVIDIA_RIVA_TNT
},
629 {WINED3D_FEATURE_LEVEL_7
, CARD_NVIDIA_GEFORCE
},
630 {WINED3D_FEATURE_LEVEL_8
, CARD_NVIDIA_GEFORCE3
},
631 {WINED3D_FEATURE_LEVEL_9_SM2
, CARD_NVIDIA_GEFORCEFX_5800
},
632 {WINED3D_FEATURE_LEVEL_9_SM3
, CARD_NVIDIA_GEFORCE_6800
},
633 {WINED3D_FEATURE_LEVEL_10
, CARD_NVIDIA_GEFORCE_8800GTX
},
634 {WINED3D_FEATURE_LEVEL_11
, CARD_NVIDIA_GEFORCE_GTX470
},
635 {WINED3D_FEATURE_LEVEL_NONE
},
637 card_fallback_amd
[] =
639 {WINED3D_FEATURE_LEVEL_5
, CARD_AMD_RAGE_128PRO
},
640 {WINED3D_FEATURE_LEVEL_7
, CARD_AMD_RADEON_7200
},
641 {WINED3D_FEATURE_LEVEL_8
, CARD_AMD_RADEON_8500
},
642 {WINED3D_FEATURE_LEVEL_9_SM2
, CARD_AMD_RADEON_9500
},
643 {WINED3D_FEATURE_LEVEL_9_SM3
, CARD_AMD_RADEON_X1600
},
644 {WINED3D_FEATURE_LEVEL_10
, CARD_AMD_RADEON_HD2900
},
645 {WINED3D_FEATURE_LEVEL_11
, CARD_AMD_RADEON_HD5600
},
646 {WINED3D_FEATURE_LEVEL_NONE
},
648 card_fallback_intel
[] =
650 {WINED3D_FEATURE_LEVEL_5
, CARD_INTEL_845G
},
651 {WINED3D_FEATURE_LEVEL_8
, CARD_INTEL_915G
},
652 {WINED3D_FEATURE_LEVEL_9_SM3
, CARD_INTEL_945G
},
653 {WINED3D_FEATURE_LEVEL_10
, CARD_INTEL_G45
},
654 {WINED3D_FEATURE_LEVEL_11
, CARD_INTEL_IVBD
},
655 {WINED3D_FEATURE_LEVEL_NONE
},
660 enum wined3d_pci_vendor vendor
;
661 const struct wined3d_fallback_card
*cards
;
665 {HW_VENDOR_AMD
, card_fallback_amd
},
666 {HW_VENDOR_NVIDIA
, card_fallback_nvidia
},
667 {HW_VENDOR_VMWARE
, card_fallback_amd
},
668 {HW_VENDOR_INTEL
, card_fallback_intel
},
671 const struct wined3d_fallback_card
*cards
;
672 enum wined3d_pci_device device_id
;
676 for (i
= 0; i
< ARRAY_SIZE(fallbacks
); ++i
)
678 if (*vendor
== fallbacks
[i
].vendor
)
679 cards
= fallbacks
[i
].cards
;
683 *vendor
= HW_VENDOR_NVIDIA
;
684 cards
= card_fallback_nvidia
;
687 device_id
= cards
->device_id
;
688 for (i
= 0; cards
[i
].feature_level
; ++i
)
690 if (feature_level
>= cards
[i
].feature_level
)
691 device_id
= cards
[i
].device_id
;
696 UINT CDECL
wined3d_get_adapter_count(const struct wined3d
*wined3d
)
698 TRACE("wined3d %p, reporting %u adapters.\n",
699 wined3d
, wined3d
->adapter_count
);
701 return wined3d
->adapter_count
;
704 HRESULT CDECL
wined3d_register_software_device(struct wined3d
*wined3d
, void *init_function
)
706 FIXME("wined3d %p, init_function %p stub!\n", wined3d
, init_function
);
711 HRESULT CDECL
wined3d_get_output_desc(const struct wined3d
*wined3d
, unsigned int adapter_idx
,
712 struct wined3d_output_desc
*desc
)
714 enum wined3d_display_rotation rotation
;
715 const struct wined3d_adapter
*adapter
;
716 struct wined3d_display_mode mode
;
720 TRACE("wined3d %p, adapter_idx %u, desc %p.\n", wined3d
, adapter_idx
, desc
);
722 if (adapter_idx
>= wined3d
->adapter_count
)
723 return WINED3DERR_INVALIDCALL
;
725 adapter
= &wined3d
->adapters
[adapter_idx
];
726 if (!(monitor
= MonitorFromPoint(adapter
->monitor_position
, MONITOR_DEFAULTTOPRIMARY
)))
727 return WINED3DERR_INVALIDCALL
;
729 if (FAILED(hr
= wined3d_get_adapter_display_mode(wined3d
, adapter_idx
, &mode
, &rotation
)))
732 memcpy(desc
->device_name
, adapter
->DeviceName
, sizeof(desc
->device_name
));
733 SetRect(&desc
->desktop_rect
, 0, 0, mode
.width
, mode
.height
);
734 OffsetRect(&desc
->desktop_rect
, adapter
->monitor_position
.x
, adapter
->monitor_position
.y
);
735 /* FIXME: We should get this from EnumDisplayDevices() when the adapters
737 desc
->attached_to_desktop
= TRUE
;
738 desc
->rotation
= rotation
;
739 desc
->monitor
= monitor
;
744 /* FIXME: GetAdapterModeCount and EnumAdapterModes currently only returns modes
745 of the same bpp but different resolutions */
747 /* Note: dx9 supplies a format. Calls from d3d8 supply WINED3DFMT_UNKNOWN */
748 UINT CDECL
wined3d_get_adapter_mode_count(const struct wined3d
*wined3d
, UINT adapter_idx
,
749 enum wined3d_format_id format_id
, enum wined3d_scanline_ordering scanline_ordering
)
751 const struct wined3d_adapter
*adapter
;
752 const struct wined3d_format
*format
;
758 TRACE("wined3d %p, adapter_idx %u, format %s, scanline_ordering %#x.\n",
759 wined3d
, adapter_idx
, debug_d3dformat(format_id
), scanline_ordering
);
761 if (adapter_idx
>= wined3d
->adapter_count
)
764 adapter
= &wined3d
->adapters
[adapter_idx
];
765 format
= wined3d_get_format(adapter
, format_id
, WINED3DUSAGE_RENDERTARGET
);
766 format_bits
= format
->byte_count
* CHAR_BIT
;
768 memset(&mode
, 0, sizeof(mode
));
769 mode
.dmSize
= sizeof(mode
);
771 while (EnumDisplaySettingsExW(adapter
->DeviceName
, j
++, &mode
, 0))
773 if (mode
.dmFields
& DM_DISPLAYFLAGS
)
775 if (scanline_ordering
== WINED3D_SCANLINE_ORDERING_PROGRESSIVE
776 && (mode
.u2
.dmDisplayFlags
& DM_INTERLACED
))
779 if (scanline_ordering
== WINED3D_SCANLINE_ORDERING_INTERLACED
780 && !(mode
.u2
.dmDisplayFlags
& DM_INTERLACED
))
784 if (format_id
== WINED3DFMT_UNKNOWN
)
786 /* This is for d3d8, do not enumerate P8 here. */
787 if (mode
.dmBitsPerPel
== 32 || mode
.dmBitsPerPel
== 16) ++i
;
789 else if (mode
.dmBitsPerPel
== format_bits
)
795 TRACE("Returning %u matching modes (out of %u total) for adapter %u.\n", i
, j
, adapter_idx
);
800 /* Note: dx9 supplies a format. Calls from d3d8 supply WINED3DFMT_UNKNOWN */
801 HRESULT CDECL
wined3d_enum_adapter_modes(const struct wined3d
*wined3d
, UINT adapter_idx
,
802 enum wined3d_format_id format_id
, enum wined3d_scanline_ordering scanline_ordering
,
803 UINT mode_idx
, struct wined3d_display_mode
*mode
)
805 const struct wined3d_adapter
*adapter
;
806 const struct wined3d_format
*format
;
812 TRACE("wined3d %p, adapter_idx %u, format %s, scanline_ordering %#x, mode_idx %u, mode %p.\n",
813 wined3d
, adapter_idx
, debug_d3dformat(format_id
), scanline_ordering
, mode_idx
, mode
);
815 if (!mode
|| adapter_idx
>= wined3d
->adapter_count
)
816 return WINED3DERR_INVALIDCALL
;
818 adapter
= &wined3d
->adapters
[adapter_idx
];
819 format
= wined3d_get_format(adapter
, format_id
, WINED3DUSAGE_RENDERTARGET
);
820 format_bits
= format
->byte_count
* CHAR_BIT
;
822 memset(&m
, 0, sizeof(m
));
823 m
.dmSize
= sizeof(m
);
825 while (i
<= mode_idx
)
827 if (!EnumDisplaySettingsExW(adapter
->DeviceName
, j
++, &m
, 0))
829 WARN("Invalid mode_idx %u.\n", mode_idx
);
830 return WINED3DERR_INVALIDCALL
;
833 if (m
.dmFields
& DM_DISPLAYFLAGS
)
835 if (scanline_ordering
== WINED3D_SCANLINE_ORDERING_PROGRESSIVE
836 && (m
.u2
.dmDisplayFlags
& DM_INTERLACED
))
839 if (scanline_ordering
== WINED3D_SCANLINE_ORDERING_INTERLACED
840 && !(m
.u2
.dmDisplayFlags
& DM_INTERLACED
))
844 if (format_id
== WINED3DFMT_UNKNOWN
)
846 /* This is for d3d8, do not enumerate P8 here. */
847 if (m
.dmBitsPerPel
== 32 || m
.dmBitsPerPel
== 16) ++i
;
849 else if (m
.dmBitsPerPel
== format_bits
)
855 mode
->width
= m
.dmPelsWidth
;
856 mode
->height
= m
.dmPelsHeight
;
857 mode
->refresh_rate
= DEFAULT_REFRESH_RATE
;
858 if (m
.dmFields
& DM_DISPLAYFREQUENCY
)
859 mode
->refresh_rate
= m
.dmDisplayFrequency
;
861 if (format_id
== WINED3DFMT_UNKNOWN
)
862 mode
->format_id
= pixelformat_for_depth(m
.dmBitsPerPel
);
864 mode
->format_id
= format_id
;
866 if (!(m
.dmFields
& DM_DISPLAYFLAGS
))
867 mode
->scanline_ordering
= WINED3D_SCANLINE_ORDERING_UNKNOWN
;
868 else if (m
.u2
.dmDisplayFlags
& DM_INTERLACED
)
869 mode
->scanline_ordering
= WINED3D_SCANLINE_ORDERING_INTERLACED
;
871 mode
->scanline_ordering
= WINED3D_SCANLINE_ORDERING_PROGRESSIVE
;
873 TRACE("%ux%u@%u %u bpp, %s %#x.\n", mode
->width
, mode
->height
, mode
->refresh_rate
,
874 m
.dmBitsPerPel
, debug_d3dformat(mode
->format_id
), mode
->scanline_ordering
);
879 HRESULT CDECL
wined3d_find_closest_matching_adapter_mode(const struct wined3d
*wined3d
,
880 unsigned int adapter_idx
, struct wined3d_display_mode
*mode
)
882 unsigned int i
, j
, mode_count
, matching_mode_count
, closest
;
883 struct wined3d_display_mode
**matching_modes
;
884 struct wined3d_display_mode
*modes
;
887 TRACE("wined3d %p, adapter_idx %u, mode %p.\n", wined3d
, adapter_idx
, mode
);
889 if (!(mode_count
= wined3d_get_adapter_mode_count(wined3d
, adapter_idx
,
890 mode
->format_id
, WINED3D_SCANLINE_ORDERING_UNKNOWN
)))
892 WARN("Adapter has 0 matching modes.\n");
896 if (!(modes
= heap_calloc(mode_count
, sizeof(*modes
))))
897 return E_OUTOFMEMORY
;
898 if (!(matching_modes
= heap_calloc(mode_count
, sizeof(*matching_modes
))))
901 return E_OUTOFMEMORY
;
904 for (i
= 0; i
< mode_count
; ++i
)
906 if (FAILED(hr
= wined3d_enum_adapter_modes(wined3d
, adapter_idx
,
907 mode
->format_id
, WINED3D_SCANLINE_ORDERING_UNKNOWN
, i
, &modes
[i
])))
909 heap_free(matching_modes
);
913 matching_modes
[i
] = &modes
[i
];
916 matching_mode_count
= mode_count
;
918 if (mode
->scanline_ordering
!= WINED3D_SCANLINE_ORDERING_UNKNOWN
)
920 for (i
= 0, j
= 0; i
< matching_mode_count
; ++i
)
922 if (matching_modes
[i
]->scanline_ordering
== mode
->scanline_ordering
)
923 matching_modes
[j
++] = matching_modes
[i
];
926 matching_mode_count
= j
;
929 if (mode
->refresh_rate
)
931 for (i
= 0, j
= 0; i
< matching_mode_count
; ++i
)
933 if (matching_modes
[i
]->refresh_rate
== mode
->refresh_rate
)
934 matching_modes
[j
++] = matching_modes
[i
];
937 matching_mode_count
= j
;
940 if (!mode
->width
|| !mode
->height
)
942 struct wined3d_display_mode current_mode
;
943 if (FAILED(hr
= wined3d_get_adapter_display_mode(wined3d
, adapter_idx
,
944 ¤t_mode
, NULL
)))
946 heap_free(matching_modes
);
950 mode
->width
= current_mode
.width
;
951 mode
->height
= current_mode
.height
;
955 for (i
= 0, j
= 0; i
< matching_mode_count
; ++i
)
957 unsigned int d
= abs(mode
->width
- matching_modes
[i
]->width
)
958 + abs(mode
->height
- matching_modes
[i
]->height
);
967 *mode
= *matching_modes
[j
];
969 heap_free(matching_modes
);
972 TRACE("Returning %ux%u@%u %s %#x.\n", mode
->width
, mode
->height
,
973 mode
->refresh_rate
, debug_d3dformat(mode
->format_id
),
974 mode
->scanline_ordering
);
979 HRESULT CDECL
wined3d_get_adapter_display_mode(const struct wined3d
*wined3d
, UINT adapter_idx
,
980 struct wined3d_display_mode
*mode
, enum wined3d_display_rotation
*rotation
)
982 const struct wined3d_adapter
*adapter
;
985 TRACE("wined3d %p, adapter_idx %u, display_mode %p, rotation %p.\n",
986 wined3d
, adapter_idx
, mode
, rotation
);
988 if (!mode
|| adapter_idx
>= wined3d
->adapter_count
)
989 return WINED3DERR_INVALIDCALL
;
991 adapter
= &wined3d
->adapters
[adapter_idx
];
993 memset(&m
, 0, sizeof(m
));
994 m
.dmSize
= sizeof(m
);
996 EnumDisplaySettingsExW(adapter
->DeviceName
, ENUM_CURRENT_SETTINGS
, &m
, 0);
997 mode
->width
= m
.dmPelsWidth
;
998 mode
->height
= m
.dmPelsHeight
;
999 mode
->refresh_rate
= DEFAULT_REFRESH_RATE
;
1000 if (m
.dmFields
& DM_DISPLAYFREQUENCY
)
1001 mode
->refresh_rate
= m
.dmDisplayFrequency
;
1002 mode
->format_id
= pixelformat_for_depth(m
.dmBitsPerPel
);
1004 /* Lie about the format. X11 can't change the color depth, and some apps
1005 * are pretty angry if they SetDisplayMode from 24 to 16 bpp and find out
1006 * that GetDisplayMode still returns 24 bpp. This should probably be
1007 * handled in winex11 instead. */
1008 if (adapter
->screen_format
&& adapter
->screen_format
!= mode
->format_id
)
1010 WARN("Overriding format %s with stored format %s.\n",
1011 debug_d3dformat(mode
->format_id
),
1012 debug_d3dformat(adapter
->screen_format
));
1013 mode
->format_id
= adapter
->screen_format
;
1016 if (!(m
.dmFields
& DM_DISPLAYFLAGS
))
1017 mode
->scanline_ordering
= WINED3D_SCANLINE_ORDERING_UNKNOWN
;
1018 else if (m
.u2
.dmDisplayFlags
& DM_INTERLACED
)
1019 mode
->scanline_ordering
= WINED3D_SCANLINE_ORDERING_INTERLACED
;
1021 mode
->scanline_ordering
= WINED3D_SCANLINE_ORDERING_PROGRESSIVE
;
1025 switch (m
.u1
.s2
.dmDisplayOrientation
)
1028 *rotation
= WINED3D_DISPLAY_ROTATION_0
;
1031 *rotation
= WINED3D_DISPLAY_ROTATION_90
;
1034 *rotation
= WINED3D_DISPLAY_ROTATION_180
;
1037 *rotation
= WINED3D_DISPLAY_ROTATION_270
;
1040 FIXME("Unhandled display rotation %#x.\n", m
.u1
.s2
.dmDisplayOrientation
);
1041 *rotation
= WINED3D_DISPLAY_ROTATION_UNSPECIFIED
;
1046 TRACE("Returning %ux%u@%u %s %#x.\n", mode
->width
, mode
->height
,
1047 mode
->refresh_rate
, debug_d3dformat(mode
->format_id
),
1048 mode
->scanline_ordering
);
1052 HRESULT CDECL
wined3d_set_adapter_display_mode(struct wined3d
*wined3d
,
1053 UINT adapter_idx
, const struct wined3d_display_mode
*mode
)
1055 struct wined3d_adapter
*adapter
;
1056 DEVMODEW new_mode
, current_mode
;
1059 enum wined3d_format_id new_format_id
;
1061 TRACE("wined3d %p, adapter_idx %u, mode %p.\n", wined3d
, adapter_idx
, mode
);
1063 if (adapter_idx
>= wined3d
->adapter_count
)
1064 return WINED3DERR_INVALIDCALL
;
1065 adapter
= &wined3d
->adapters
[adapter_idx
];
1067 memset(&new_mode
, 0, sizeof(new_mode
));
1068 new_mode
.dmSize
= sizeof(new_mode
);
1069 memset(¤t_mode
, 0, sizeof(current_mode
));
1070 current_mode
.dmSize
= sizeof(current_mode
);
1073 const struct wined3d_format
*format
;
1075 TRACE("mode %ux%u@%u %s %#x.\n", mode
->width
, mode
->height
, mode
->refresh_rate
,
1076 debug_d3dformat(mode
->format_id
), mode
->scanline_ordering
);
1078 format
= wined3d_get_format(adapter
, mode
->format_id
, WINED3DUSAGE_RENDERTARGET
);
1080 new_mode
.dmFields
= DM_BITSPERPEL
| DM_PELSWIDTH
| DM_PELSHEIGHT
;
1081 new_mode
.dmBitsPerPel
= format
->byte_count
* CHAR_BIT
;
1082 new_mode
.dmPelsWidth
= mode
->width
;
1083 new_mode
.dmPelsHeight
= mode
->height
;
1085 new_mode
.dmDisplayFrequency
= mode
->refresh_rate
;
1086 if (mode
->refresh_rate
)
1087 new_mode
.dmFields
|= DM_DISPLAYFREQUENCY
;
1089 if (mode
->scanline_ordering
!= WINED3D_SCANLINE_ORDERING_UNKNOWN
)
1091 new_mode
.dmFields
|= DM_DISPLAYFLAGS
;
1092 if (mode
->scanline_ordering
== WINED3D_SCANLINE_ORDERING_INTERLACED
)
1093 new_mode
.u2
.dmDisplayFlags
|= DM_INTERLACED
;
1095 new_format_id
= mode
->format_id
;
1099 if (!EnumDisplaySettingsW(adapter
->DeviceName
, ENUM_REGISTRY_SETTINGS
, &new_mode
))
1101 ERR("Failed to read mode from registry.\n");
1102 return WINED3DERR_NOTAVAILABLE
;
1104 new_format_id
= pixelformat_for_depth(new_mode
.dmBitsPerPel
);
1107 /* Only change the mode if necessary. */
1108 if (!EnumDisplaySettingsW(adapter
->DeviceName
, ENUM_CURRENT_SETTINGS
, ¤t_mode
))
1110 ERR("Failed to get current display mode.\n");
1112 else if (current_mode
.dmPelsWidth
== new_mode
.dmPelsWidth
1113 && current_mode
.dmPelsHeight
== new_mode
.dmPelsHeight
1114 && current_mode
.dmBitsPerPel
== new_mode
.dmBitsPerPel
1115 && (current_mode
.dmDisplayFrequency
== new_mode
.dmDisplayFrequency
1116 || !(new_mode
.dmFields
& DM_DISPLAYFREQUENCY
))
1117 && (current_mode
.u2
.dmDisplayFlags
== new_mode
.u2
.dmDisplayFlags
1118 || !(new_mode
.dmFields
& DM_DISPLAYFLAGS
)))
1120 TRACE("Skipping redundant mode setting call.\n");
1121 adapter
->screen_format
= new_format_id
;
1125 ret
= ChangeDisplaySettingsExW(adapter
->DeviceName
, &new_mode
, NULL
, CDS_FULLSCREEN
, NULL
);
1126 if (ret
!= DISP_CHANGE_SUCCESSFUL
)
1128 if (new_mode
.dmFields
& DM_DISPLAYFREQUENCY
)
1130 WARN("ChangeDisplaySettingsExW failed, trying without the refresh rate.\n");
1131 new_mode
.dmFields
&= ~DM_DISPLAYFREQUENCY
;
1132 new_mode
.dmDisplayFrequency
= 0;
1133 ret
= ChangeDisplaySettingsExW(adapter
->DeviceName
, &new_mode
, NULL
, CDS_FULLSCREEN
, NULL
);
1135 if (ret
!= DISP_CHANGE_SUCCESSFUL
)
1136 return WINED3DERR_NOTAVAILABLE
;
1139 /* Store the new values. */
1140 adapter
->screen_format
= new_format_id
;
1142 /* And finally clip mouse to our screen. */
1143 SetRect(&clip_rc
, 0, 0, new_mode
.dmPelsWidth
, new_mode
.dmPelsHeight
);
1144 ClipCursor(&clip_rc
);
1149 /* NOTE: due to structure differences between dx8 and dx9 D3DADAPTER_IDENTIFIER,
1150 and fields being inserted in the middle, a new structure is used in place */
1151 HRESULT CDECL
wined3d_get_adapter_identifier(const struct wined3d
*wined3d
,
1152 UINT adapter_idx
, DWORD flags
, struct wined3d_adapter_identifier
*identifier
)
1154 const struct wined3d_adapter
*adapter
;
1157 TRACE("wined3d %p, adapter_idx %u, flags %#x, identifier %p.\n",
1158 wined3d
, adapter_idx
, flags
, identifier
);
1160 if (adapter_idx
>= wined3d
->adapter_count
)
1161 return WINED3DERR_INVALIDCALL
;
1163 adapter
= &wined3d
->adapters
[adapter_idx
];
1165 if (identifier
->driver_size
)
1167 const char *name
= adapter
->driver_info
.name
;
1168 len
= min(strlen(name
), identifier
->driver_size
- 1);
1169 memcpy(identifier
->driver
, name
, len
);
1170 memset(&identifier
->driver
[len
], 0, identifier
->driver_size
- len
);
1173 if (identifier
->description_size
)
1175 const char *description
= adapter
->driver_info
.description
;
1176 len
= min(strlen(description
), identifier
->description_size
- 1);
1177 memcpy(identifier
->description
, description
, len
);
1178 memset(&identifier
->description
[len
], 0, identifier
->description_size
- len
);
1181 /* Note that d3d8 doesn't supply a device name. */
1182 if (identifier
->device_name_size
)
1184 if (!WideCharToMultiByte(CP_ACP
, 0, adapter
->DeviceName
, -1, identifier
->device_name
,
1185 identifier
->device_name_size
, NULL
, NULL
))
1187 ERR("Failed to convert device name, last error %#x.\n", GetLastError());
1188 return WINED3DERR_INVALIDCALL
;
1192 identifier
->driver_version
.u
.HighPart
= adapter
->driver_info
.version_high
;
1193 identifier
->driver_version
.u
.LowPart
= adapter
->driver_info
.version_low
;
1194 identifier
->vendor_id
= adapter
->driver_info
.vendor
;
1195 identifier
->device_id
= adapter
->driver_info
.device
;
1196 identifier
->subsystem_id
= 0;
1197 identifier
->revision
= 0;
1198 memcpy(&identifier
->device_identifier
, &IID_D3DDEVICE_D3DUID
, sizeof(identifier
->device_identifier
));
1199 identifier
->whql_level
= (flags
& WINED3DENUM_NO_WHQL_LEVEL
) ? 0 : 1;
1200 memcpy(&identifier
->adapter_luid
, &adapter
->luid
, sizeof(identifier
->adapter_luid
));
1201 identifier
->video_memory
= min(~(SIZE_T
)0, adapter
->vram_bytes
);
1206 HRESULT CDECL
wined3d_get_adapter_raster_status(const struct wined3d
*wined3d
, UINT adapter_idx
,
1207 struct wined3d_raster_status
*raster_status
)
1209 LONGLONG freq_per_frame
, freq_per_line
;
1210 LARGE_INTEGER counter
, freq_per_sec
;
1211 struct wined3d_display_mode mode
;
1215 FIXME("wined3d %p, adapter_idx %u, raster_status %p semi-stub!\n",
1216 wined3d
, adapter_idx
, raster_status
);
1218 WARN("wined3d %p, adapter_idx %u, raster_status %p semi-stub!\n",
1219 wined3d
, adapter_idx
, raster_status
);
1221 /* Obtaining the raster status is a widely implemented but optional
1222 * feature. When this method returns OK StarCraft 2 expects the
1223 * raster_status->InVBlank value to actually change over time.
1224 * And Endless Alice Crysis doesn't care even if this method fails.
1225 * Thus this method returns OK and fakes raster_status by
1226 * QueryPerformanceCounter. */
1228 if (!QueryPerformanceCounter(&counter
) || !QueryPerformanceFrequency(&freq_per_sec
))
1229 return WINED3DERR_INVALIDCALL
;
1230 if (FAILED(wined3d_get_adapter_display_mode(wined3d
, adapter_idx
, &mode
, NULL
)))
1231 return WINED3DERR_INVALIDCALL
;
1232 if (mode
.refresh_rate
== DEFAULT_REFRESH_RATE
)
1233 mode
.refresh_rate
= 60;
1235 freq_per_frame
= freq_per_sec
.QuadPart
/ mode
.refresh_rate
;
1236 /* Assume 20 scan lines in the vertical blank. */
1237 freq_per_line
= freq_per_frame
/ (mode
.height
+ 20);
1238 raster_status
->scan_line
= (counter
.QuadPart
% freq_per_frame
) / freq_per_line
;
1239 if (raster_status
->scan_line
< mode
.height
)
1240 raster_status
->in_vblank
= FALSE
;
1243 raster_status
->scan_line
= 0;
1244 raster_status
->in_vblank
= TRUE
;
1247 TRACE("Returning fake value, in_vblank %u, scan_line %u.\n",
1248 raster_status
->in_vblank
, raster_status
->scan_line
);
1253 static BOOL
wined3d_check_pixel_format_color(const struct wined3d_pixel_format
*cfg
,
1254 const struct wined3d_format
*format
)
1256 /* Float formats need FBOs. If FBOs are used this function isn't called */
1257 if (format
->flags
[WINED3D_GL_RES_TYPE_TEX_2D
] & WINED3DFMT_FLAG_FLOAT
)
1260 /* Probably a RGBA_float or color index mode. */
1261 if (cfg
->iPixelType
!= WGL_TYPE_RGBA_ARB
)
1264 if (cfg
->redSize
< format
->red_size
1265 || cfg
->greenSize
< format
->green_size
1266 || cfg
->blueSize
< format
->blue_size
1267 || cfg
->alphaSize
< format
->alpha_size
)
1273 static BOOL
wined3d_check_pixel_format_depth(const struct wined3d_pixel_format
*cfg
,
1274 const struct wined3d_format
*format
)
1276 BOOL lockable
= FALSE
;
1278 /* Float formats need FBOs. If FBOs are used this function isn't called */
1279 if (format
->flags
[WINED3D_GL_RES_TYPE_TEX_2D
] & WINED3DFMT_FLAG_FLOAT
)
1282 if ((format
->id
== WINED3DFMT_D16_LOCKABLE
) || (format
->id
== WINED3DFMT_D32_FLOAT
))
1285 /* On some modern cards like the Geforce8/9, GLX doesn't offer some
1286 * depth/stencil formats which D3D9 reports. We can safely report
1287 * "compatible" formats (e.g. D24 can be used for D16) as long as we
1288 * aren't dealing with a lockable format. This also helps D3D <= 7 as they
1289 * expect D16 which isn't offered without this on Geforce8 cards. */
1290 if (!(cfg
->depthSize
== format
->depth_size
|| (!lockable
&& cfg
->depthSize
> format
->depth_size
)))
1293 /* Some cards like Intel i915 ones only offer D24S8 but lots of games also
1294 * need a format without stencil. We can allow a mismatch if the format
1295 * doesn't have any stencil bits. If it does have stencil bits the size
1296 * must match, or stencil wrapping would break. */
1297 if (format
->stencil_size
&& cfg
->stencilSize
!= format
->stencil_size
)
1303 HRESULT CDECL
wined3d_check_depth_stencil_match(const struct wined3d
*wined3d
,
1304 UINT adapter_idx
, enum wined3d_device_type device_type
, enum wined3d_format_id adapter_format_id
,
1305 enum wined3d_format_id render_target_format_id
, enum wined3d_format_id depth_stencil_format_id
)
1307 const struct wined3d_format
*rt_format
;
1308 const struct wined3d_format
*ds_format
;
1309 const struct wined3d_adapter
*adapter
;
1311 TRACE("wined3d %p, adapter_idx %u, device_type %s,\n"
1312 "adapter_format %s, render_target_format %s, depth_stencil_format %s.\n",
1313 wined3d
, adapter_idx
, debug_d3ddevicetype(device_type
), debug_d3dformat(adapter_format_id
),
1314 debug_d3dformat(render_target_format_id
), debug_d3dformat(depth_stencil_format_id
));
1316 if (adapter_idx
>= wined3d
->adapter_count
)
1317 return WINED3DERR_INVALIDCALL
;
1319 adapter
= &wined3d
->adapters
[adapter_idx
];
1320 rt_format
= wined3d_get_format(adapter
, render_target_format_id
, WINED3DUSAGE_RENDERTARGET
);
1321 ds_format
= wined3d_get_format(adapter
, depth_stencil_format_id
, WINED3DUSAGE_DEPTHSTENCIL
);
1322 if (wined3d_settings
.offscreen_rendering_mode
== ORM_FBO
)
1324 if ((rt_format
->flags
[WINED3D_GL_RES_TYPE_TEX_2D
] & WINED3DFMT_FLAG_RENDERTARGET
)
1325 && (ds_format
->flags
[WINED3D_GL_RES_TYPE_TEX_2D
] & (WINED3DFMT_FLAG_DEPTH
| WINED3DFMT_FLAG_STENCIL
)))
1327 TRACE("Formats match.\n");
1333 const struct wined3d_pixel_format
*cfgs
;
1334 unsigned int cfg_count
;
1337 cfgs
= adapter
->cfgs
;
1338 cfg_count
= adapter
->cfg_count
;
1339 for (i
= 0; i
< cfg_count
; ++i
)
1341 if (wined3d_check_pixel_format_color(&cfgs
[i
], rt_format
)
1342 && wined3d_check_pixel_format_depth(&cfgs
[i
], ds_format
))
1344 TRACE("Formats match.\n");
1350 TRACE("Unsupported format pair: %s and %s.\n",
1351 debug_d3dformat(render_target_format_id
),
1352 debug_d3dformat(depth_stencil_format_id
));
1354 return WINED3DERR_NOTAVAILABLE
;
1357 HRESULT CDECL
wined3d_check_device_multisample_type(const struct wined3d
*wined3d
, UINT adapter_idx
,
1358 enum wined3d_device_type device_type
, enum wined3d_format_id surface_format_id
, BOOL windowed
,
1359 enum wined3d_multisample_type multisample_type
, DWORD
*quality_levels
)
1361 const struct wined3d_adapter
*adapter
;
1362 const struct wined3d_format
*format
;
1363 HRESULT hr
= WINED3D_OK
;
1365 TRACE("wined3d %p, adapter_idx %u, device_type %s, surface_format %s, "
1366 "windowed %#x, multisample_type %#x, quality_levels %p.\n",
1367 wined3d
, adapter_idx
, debug_d3ddevicetype(device_type
), debug_d3dformat(surface_format_id
),
1368 windowed
, multisample_type
, quality_levels
);
1370 if (adapter_idx
>= wined3d
->adapter_count
)
1371 return WINED3DERR_INVALIDCALL
;
1372 if (surface_format_id
== WINED3DFMT_UNKNOWN
)
1373 return WINED3DERR_INVALIDCALL
;
1374 if (multisample_type
< WINED3D_MULTISAMPLE_NONE
)
1375 return WINED3DERR_INVALIDCALL
;
1376 if (multisample_type
> WINED3D_MULTISAMPLE_16_SAMPLES
)
1378 FIXME("multisample_type %u not handled yet.\n", multisample_type
);
1379 return WINED3DERR_NOTAVAILABLE
;
1382 adapter
= &wined3d
->adapters
[adapter_idx
];
1383 format
= wined3d_get_format(adapter
, surface_format_id
, 0);
1385 if (multisample_type
&& !(format
->multisample_types
& 1u << (multisample_type
- 1)))
1386 hr
= WINED3DERR_NOTAVAILABLE
;
1388 if (SUCCEEDED(hr
) || (multisample_type
== WINED3D_MULTISAMPLE_NON_MASKABLE
&& format
->multisample_types
))
1392 if (multisample_type
== WINED3D_MULTISAMPLE_NON_MASKABLE
)
1393 *quality_levels
= wined3d_popcount(format
->multisample_types
);
1395 *quality_levels
= 1;
1400 TRACE("Returning not supported.\n");
1404 /* Check if the given DisplayFormat + DepthStencilFormat combination is valid for the Adapter */
1405 static BOOL
CheckDepthStencilCapability(const struct wined3d_adapter
*adapter
,
1406 const struct wined3d_format
*display_format
, const struct wined3d_format
*ds_format
,
1407 enum wined3d_gl_resource_type gl_type
)
1409 /* Only allow depth/stencil formats */
1410 if (!(ds_format
->depth_size
|| ds_format
->stencil_size
))
1413 /* Blacklist formats not supported on Windows */
1414 switch (ds_format
->id
)
1416 case WINED3DFMT_S1_UINT_D15_UNORM
: /* Breaks the shadowvol2 dx7 sdk sample */
1417 case WINED3DFMT_S4X4_UINT_D24_UNORM
:
1418 TRACE("[FAILED] - not supported on windows.\n");
1425 if (wined3d_settings
.offscreen_rendering_mode
== ORM_FBO
)
1427 /* With FBOs WGL limitations do not apply, but the format needs to be FBO attachable */
1428 if (ds_format
->flags
[gl_type
] & (WINED3DFMT_FLAG_DEPTH
| WINED3DFMT_FLAG_STENCIL
))
1435 /* Walk through all WGL pixel formats to find a match */
1436 for (i
= 0; i
< adapter
->cfg_count
; ++i
)
1438 const struct wined3d_pixel_format
*cfg
= &adapter
->cfgs
[i
];
1439 if (wined3d_check_pixel_format_color(cfg
, display_format
)
1440 && wined3d_check_pixel_format_depth(cfg
, ds_format
))
1448 /* Check the render target capabilities of a format */
1449 static BOOL
CheckRenderTargetCapability(const struct wined3d_adapter
*adapter
,
1450 const struct wined3d_format
*adapter_format
, const struct wined3d_format
*check_format
,
1451 enum wined3d_gl_resource_type gl_type
)
1453 /* Filter out non-RT formats */
1454 if (!(check_format
->flags
[gl_type
] & WINED3DFMT_FLAG_RENDERTARGET
))
1456 if (wined3d_settings
.offscreen_rendering_mode
== ORM_FBO
)
1458 if (wined3d_settings
.offscreen_rendering_mode
== ORM_BACKBUFFER
)
1460 const struct wined3d_pixel_format
*cfgs
= adapter
->cfgs
;
1463 /* In backbuffer mode the front and backbuffer share the same WGL
1464 * pixelformat. The format must match in RGB, alpha is allowed to be
1465 * different. (Only the backbuffer can have alpha.) */
1466 if (adapter_format
->red_size
!= check_format
->red_size
1467 || adapter_format
->green_size
!= check_format
->green_size
1468 || adapter_format
->blue_size
!= check_format
->blue_size
)
1470 TRACE("[FAILED]\n");
1474 /* Check if there is a WGL pixel format matching the requirements, the format should also be window
1475 * drawable (not offscreen; e.g. Nvidia offers R5G6B5 for pbuffers even when X is running at 24bit) */
1476 for (i
= 0; i
< adapter
->cfg_count
; ++i
)
1478 if (cfgs
[i
].windowDrawable
1479 && wined3d_check_pixel_format_color(&cfgs
[i
], check_format
))
1481 TRACE("Pixel format %d is compatible with format %s.\n",
1482 cfgs
[i
].iPixelFormat
, debug_d3dformat(check_format
->id
));
1490 static BOOL
wined3d_check_surface_capability(const struct wined3d_format
*format
)
1492 if ((format
->flags
[WINED3D_GL_RES_TYPE_TEX_2D
] | format
->flags
[WINED3D_GL_RES_TYPE_RB
]) & WINED3DFMT_FLAG_BLIT
)
1498 if ((format
->flags
[WINED3D_GL_RES_TYPE_TEX_2D
] & (WINED3DFMT_FLAG_EXTENSION
| WINED3DFMT_FLAG_TEXTURE
))
1499 == (WINED3DFMT_FLAG_EXTENSION
| WINED3DFMT_FLAG_TEXTURE
))
1505 /* Reject other formats */
1506 TRACE("[FAILED]\n");
1510 /* OpenGL supports mipmapping on all formats. Wrapping is unsupported, but we
1511 * have to report mipmapping so we cannot reject WRAPANDMIP. Tests show that
1512 * Windows reports WRAPANDMIP on unfilterable surfaces as well, apparently to
1513 * show that wrapping is supported. The lack of filtering will sort out the
1514 * mipmapping capability anyway.
1516 * For now lets report this on all formats, but in the future we may want to
1517 * restrict it to some should applications need that. */
1518 HRESULT CDECL
wined3d_check_device_format(const struct wined3d
*wined3d
, UINT adapter_idx
,
1519 enum wined3d_device_type device_type
, enum wined3d_format_id adapter_format_id
, DWORD usage
,
1520 enum wined3d_resource_type resource_type
, enum wined3d_format_id check_format_id
)
1522 const struct wined3d_format
*adapter_format
, *format
;
1523 enum wined3d_gl_resource_type gl_type
, gl_type_end
;
1524 const struct wined3d_adapter
*adapter
;
1525 BOOL mipmap_gen_supported
= TRUE
;
1526 DWORD format_flags
= 0;
1527 DWORD allowed_usage
;
1529 TRACE("wined3d %p, adapter_idx %u, device_type %s, adapter_format %s, usage %s, %s, "
1530 "resource_type %s, check_format %s.\n",
1531 wined3d
, adapter_idx
, debug_d3ddevicetype(device_type
), debug_d3dformat(adapter_format_id
),
1532 debug_d3dusage(usage
), debug_d3dusagequery(usage
), debug_d3dresourcetype(resource_type
),
1533 debug_d3dformat(check_format_id
));
1535 if (adapter_idx
>= wined3d
->adapter_count
)
1536 return WINED3DERR_INVALIDCALL
;
1538 adapter
= &wined3d
->adapters
[adapter_idx
];
1539 adapter_format
= wined3d_get_format(adapter
, adapter_format_id
, WINED3DUSAGE_RENDERTARGET
);
1540 format
= wined3d_get_format(adapter
, check_format_id
, usage
);
1542 switch (resource_type
)
1544 case WINED3D_RTYPE_NONE
:
1545 allowed_usage
= WINED3DUSAGE_DEPTHSTENCIL
1546 | WINED3DUSAGE_RENDERTARGET
;
1547 gl_type
= WINED3D_GL_RES_TYPE_TEX_2D
;
1548 gl_type_end
= WINED3D_GL_RES_TYPE_TEX_3D
;
1551 case WINED3D_RTYPE_TEXTURE_1D
:
1552 allowed_usage
= WINED3DUSAGE_DYNAMIC
1553 | WINED3DUSAGE_SOFTWAREPROCESSING
1554 | WINED3DUSAGE_TEXTURE
1555 | WINED3DUSAGE_QUERY_FILTER
1556 | WINED3DUSAGE_QUERY_GENMIPMAP
1557 | WINED3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING
1558 | WINED3DUSAGE_QUERY_SRGBREAD
1559 | WINED3DUSAGE_QUERY_SRGBWRITE
1560 | WINED3DUSAGE_QUERY_VERTEXTEXTURE
1561 | WINED3DUSAGE_QUERY_WRAPANDMIP
;
1562 gl_type
= gl_type_end
= WINED3D_GL_RES_TYPE_TEX_1D
;
1565 case WINED3D_RTYPE_TEXTURE_2D
:
1566 allowed_usage
= WINED3DUSAGE_DEPTHSTENCIL
1567 | WINED3DUSAGE_RENDERTARGET
1568 | WINED3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING
;
1569 if (usage
& WINED3DUSAGE_RENDERTARGET
)
1570 allowed_usage
|= WINED3DUSAGE_QUERY_SRGBWRITE
;
1571 if (!(usage
& WINED3DUSAGE_TEXTURE
))
1573 if (!wined3d_check_surface_capability(format
))
1575 TRACE("[FAILED] - Not supported for plain surfaces.\n");
1576 return WINED3DERR_NOTAVAILABLE
;
1579 gl_type
= gl_type_end
= WINED3D_GL_RES_TYPE_RB
;
1582 allowed_usage
|= WINED3DUSAGE_DYNAMIC
1583 | WINED3DUSAGE_LEGACY_CUBEMAP
1584 | WINED3DUSAGE_SOFTWAREPROCESSING
1585 | WINED3DUSAGE_TEXTURE
1586 | WINED3DUSAGE_QUERY_FILTER
1587 | WINED3DUSAGE_QUERY_GENMIPMAP
1588 | WINED3DUSAGE_QUERY_LEGACYBUMPMAP
1589 | WINED3DUSAGE_QUERY_SRGBREAD
1590 | WINED3DUSAGE_QUERY_SRGBWRITE
1591 | WINED3DUSAGE_QUERY_VERTEXTEXTURE
1592 | WINED3DUSAGE_QUERY_WRAPANDMIP
;
1593 gl_type
= gl_type_end
= WINED3D_GL_RES_TYPE_TEX_2D
;
1594 if (usage
& WINED3DUSAGE_LEGACY_CUBEMAP
)
1596 allowed_usage
&= ~(WINED3DUSAGE_DEPTHSTENCIL
| WINED3DUSAGE_QUERY_LEGACYBUMPMAP
);
1597 gl_type
= gl_type_end
= WINED3D_GL_RES_TYPE_TEX_CUBE
;
1599 else if ((usage
& WINED3DUSAGE_DEPTHSTENCIL
)
1600 && (format
->flags
[WINED3D_GL_RES_TYPE_TEX_2D
] & WINED3DFMT_FLAG_SHADOW
)
1601 && !adapter
->gl_info
.supported
[ARB_SHADOW
])
1603 TRACE("[FAILED] - No shadow sampler support.\n");
1604 return WINED3DERR_NOTAVAILABLE
;
1608 case WINED3D_RTYPE_TEXTURE_3D
:
1609 allowed_usage
= WINED3DUSAGE_DYNAMIC
1610 | WINED3DUSAGE_SOFTWAREPROCESSING
1611 | WINED3DUSAGE_TEXTURE
1612 | WINED3DUSAGE_QUERY_FILTER
1613 | WINED3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING
1614 | WINED3DUSAGE_QUERY_SRGBREAD
1615 | WINED3DUSAGE_QUERY_SRGBWRITE
1616 | WINED3DUSAGE_QUERY_VERTEXTEXTURE
1617 | WINED3DUSAGE_QUERY_WRAPANDMIP
;
1618 gl_type
= gl_type_end
= WINED3D_GL_RES_TYPE_TEX_3D
;
1622 FIXME("Unhandled resource type %s.\n", debug_d3dresourcetype(resource_type
));
1623 return WINED3DERR_NOTAVAILABLE
;
1626 if ((usage
& allowed_usage
) != usage
)
1628 TRACE("Requested usage %#x, but resource type %s only allows %#x.\n",
1629 usage
, debug_d3dresourcetype(resource_type
), allowed_usage
);
1630 return WINED3DERR_NOTAVAILABLE
;
1633 if (usage
& WINED3DUSAGE_TEXTURE
)
1634 format_flags
|= WINED3DFMT_FLAG_TEXTURE
;
1635 if (usage
& WINED3DUSAGE_QUERY_FILTER
)
1636 format_flags
|= WINED3DFMT_FLAG_FILTERING
;
1637 if (usage
& WINED3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING
)
1638 format_flags
|= WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING
;
1639 if (usage
& WINED3DUSAGE_QUERY_SRGBREAD
)
1640 format_flags
|= WINED3DFMT_FLAG_SRGB_READ
;
1641 if (usage
& WINED3DUSAGE_QUERY_SRGBWRITE
)
1642 format_flags
|= WINED3DFMT_FLAG_SRGB_WRITE
;
1643 if (usage
& WINED3DUSAGE_QUERY_VERTEXTEXTURE
)
1644 format_flags
|= WINED3DFMT_FLAG_VTF
;
1645 if (usage
& WINED3DUSAGE_QUERY_LEGACYBUMPMAP
)
1646 format_flags
|= WINED3DFMT_FLAG_BUMPMAP
;
1648 if ((format_flags
& WINED3DFMT_FLAG_TEXTURE
) && (wined3d
->flags
& WINED3D_NO3D
))
1650 TRACE("Requested texturing support, but wined3d was created with WINED3D_NO3D.\n");
1651 return WINED3DERR_NOTAVAILABLE
;
1654 for (; gl_type
<= gl_type_end
; ++gl_type
)
1656 if ((format
->flags
[gl_type
] & format_flags
) != format_flags
)
1658 TRACE("Requested format flags %#x, but format %s only has %#x.\n",
1659 format_flags
, debug_d3dformat(check_format_id
), format
->flags
[gl_type
]);
1660 return WINED3DERR_NOTAVAILABLE
;
1663 if ((usage
& WINED3DUSAGE_RENDERTARGET
)
1664 && !CheckRenderTargetCapability(adapter
, adapter_format
, format
, gl_type
))
1666 TRACE("Requested WINED3DUSAGE_RENDERTARGET, but format %s is not supported for render targets.\n",
1667 debug_d3dformat(check_format_id
));
1668 return WINED3DERR_NOTAVAILABLE
;
1671 /* 3D depth / stencil textures are never supported. */
1672 if (usage
== WINED3DUSAGE_DEPTHSTENCIL
&& gl_type
== WINED3D_GL_RES_TYPE_TEX_3D
)
1675 if ((usage
& WINED3DUSAGE_DEPTHSTENCIL
)
1676 && !CheckDepthStencilCapability(adapter
, adapter_format
, format
, gl_type
))
1678 TRACE("Requested WINED3DUSAGE_DEPTHSTENCIL, but format %s is not supported for depth / stencil buffers.\n",
1679 debug_d3dformat(check_format_id
));
1680 return WINED3DERR_NOTAVAILABLE
;
1683 if (!(format
->flags
[gl_type
] & WINED3DFMT_FLAG_GEN_MIPMAP
))
1684 mipmap_gen_supported
= FALSE
;
1687 if ((usage
& WINED3DUSAGE_QUERY_GENMIPMAP
) && !mipmap_gen_supported
)
1689 TRACE("No WINED3DUSAGE_AUTOGENMIPMAP support, returning WINED3DOK_NOAUTOGEN.\n");
1690 return WINED3DOK_NOMIPGEN
;
1696 UINT CDECL
wined3d_calculate_format_pitch(const struct wined3d
*wined3d
, UINT adapter_idx
,
1697 enum wined3d_format_id format_id
, UINT width
)
1699 const struct wined3d_adapter
*adapter
;
1700 unsigned int row_pitch
, slice_pitch
;
1702 TRACE("wined3d %p, adapter_idx %u, format_id %s, width %u.\n",
1703 wined3d
, adapter_idx
, debug_d3dformat(format_id
), width
);
1705 if (adapter_idx
>= wined3d
->adapter_count
)
1708 adapter
= &wined3d
->adapters
[adapter_idx
];
1709 wined3d_format_calculate_pitch(wined3d_get_format(adapter
, format_id
, 0),
1710 1, width
, 1, &row_pitch
, &slice_pitch
);
1715 HRESULT CDECL
wined3d_check_device_format_conversion(const struct wined3d
*wined3d
, UINT adapter_idx
,
1716 enum wined3d_device_type device_type
, enum wined3d_format_id src_format
, enum wined3d_format_id dst_format
)
1718 FIXME("wined3d %p, adapter_idx %u, device_type %s, src_format %s, dst_format %s stub!\n",
1719 wined3d
, adapter_idx
, debug_d3ddevicetype(device_type
), debug_d3dformat(src_format
),
1720 debug_d3dformat(dst_format
));
1725 HRESULT CDECL
wined3d_check_device_type(const struct wined3d
*wined3d
, UINT adapter_idx
,
1726 enum wined3d_device_type device_type
, enum wined3d_format_id display_format
,
1727 enum wined3d_format_id backbuffer_format
, BOOL windowed
)
1729 BOOL present_conversion
= wined3d
->flags
& WINED3D_PRESENT_CONVERSION
;
1731 TRACE("wined3d %p, adapter_idx %u, device_type %s, display_format %s, backbuffer_format %s, windowed %#x.\n",
1732 wined3d
, adapter_idx
, debug_d3ddevicetype(device_type
), debug_d3dformat(display_format
),
1733 debug_d3dformat(backbuffer_format
), windowed
);
1735 if (adapter_idx
>= wined3d
->adapter_count
)
1736 return WINED3DERR_INVALIDCALL
;
1738 /* The task of this function is to check whether a certain display / backbuffer format
1739 * combination is available on the given adapter. In fullscreen mode microsoft specified
1740 * that the display format shouldn't provide alpha and that ignoring alpha the backbuffer
1741 * and display format should match exactly.
1742 * In windowed mode format conversion can occur and this depends on the driver. */
1744 /* There are only 4 display formats. */
1745 if (!(display_format
== WINED3DFMT_B5G6R5_UNORM
1746 || display_format
== WINED3DFMT_B5G5R5X1_UNORM
1747 || display_format
== WINED3DFMT_B8G8R8X8_UNORM
1748 || display_format
== WINED3DFMT_B10G10R10A2_UNORM
))
1750 TRACE("Format %s is not supported as display format.\n", debug_d3dformat(display_format
));
1751 return WINED3DERR_NOTAVAILABLE
;
1756 /* If the requested display format is not available, don't continue. */
1757 if (!wined3d_get_adapter_mode_count(wined3d
, adapter_idx
,
1758 display_format
, WINED3D_SCANLINE_ORDERING_UNKNOWN
))
1760 TRACE("No available modes for display format %s.\n", debug_d3dformat(display_format
));
1761 return WINED3DERR_NOTAVAILABLE
;
1764 present_conversion
= FALSE
;
1766 else if (display_format
== WINED3DFMT_B10G10R10A2_UNORM
)
1768 /* WINED3DFMT_B10G10R10A2_UNORM is only allowed in fullscreen mode. */
1769 TRACE("Unsupported format combination %s / %s in windowed mode.\n",
1770 debug_d3dformat(display_format
), debug_d3dformat(backbuffer_format
));
1771 return WINED3DERR_NOTAVAILABLE
;
1774 if (present_conversion
)
1776 /* Use the display format as back buffer format if the latter is
1777 * WINED3DFMT_UNKNOWN. */
1778 if (backbuffer_format
== WINED3DFMT_UNKNOWN
)
1779 backbuffer_format
= display_format
;
1781 if (FAILED(wined3d_check_device_format_conversion(wined3d
, adapter_idx
,
1782 device_type
, backbuffer_format
, display_format
)))
1784 TRACE("Format conversion from %s to %s not supported.\n",
1785 debug_d3dformat(backbuffer_format
), debug_d3dformat(display_format
));
1786 return WINED3DERR_NOTAVAILABLE
;
1791 /* When format conversion from the back buffer format to the display
1792 * format is not allowed, only a limited number of combinations are
1795 if (display_format
== WINED3DFMT_B5G6R5_UNORM
&& backbuffer_format
!= WINED3DFMT_B5G6R5_UNORM
)
1797 TRACE("Unsupported format combination %s / %s.\n",
1798 debug_d3dformat(display_format
), debug_d3dformat(backbuffer_format
));
1799 return WINED3DERR_NOTAVAILABLE
;
1802 if (display_format
== WINED3DFMT_B5G5R5X1_UNORM
1803 && !(backbuffer_format
== WINED3DFMT_B5G5R5X1_UNORM
|| backbuffer_format
== WINED3DFMT_B5G5R5A1_UNORM
))
1805 TRACE("Unsupported format combination %s / %s.\n",
1806 debug_d3dformat(display_format
), debug_d3dformat(backbuffer_format
));
1807 return WINED3DERR_NOTAVAILABLE
;
1810 if (display_format
== WINED3DFMT_B8G8R8X8_UNORM
1811 && !(backbuffer_format
== WINED3DFMT_B8G8R8X8_UNORM
|| backbuffer_format
== WINED3DFMT_B8G8R8A8_UNORM
))
1813 TRACE("Unsupported format combination %s / %s.\n",
1814 debug_d3dformat(display_format
), debug_d3dformat(backbuffer_format
));
1815 return WINED3DERR_NOTAVAILABLE
;
1818 if (display_format
== WINED3DFMT_B10G10R10A2_UNORM
1819 && backbuffer_format
!= WINED3DFMT_B10G10R10A2_UNORM
)
1821 TRACE("Unsupported format combination %s / %s.\n",
1822 debug_d3dformat(display_format
), debug_d3dformat(backbuffer_format
));
1823 return WINED3DERR_NOTAVAILABLE
;
1827 /* Validate that the back buffer format is usable for render targets. */
1828 if (FAILED(wined3d_check_device_format(wined3d
, adapter_idx
, device_type
, display_format
,
1829 WINED3DUSAGE_RENDERTARGET
, WINED3D_RTYPE_TEXTURE_2D
, backbuffer_format
)))
1831 TRACE("Format %s not allowed for render targets.\n", debug_d3dformat(backbuffer_format
));
1832 return WINED3DERR_NOTAVAILABLE
;
1838 HRESULT CDECL
wined3d_get_device_caps(const struct wined3d
*wined3d
, UINT adapter_idx
,
1839 enum wined3d_device_type device_type
, struct wined3d_caps
*caps
)
1841 const struct wined3d_adapter
*adapter
= &wined3d
->adapters
[adapter_idx
];
1842 const struct wined3d_d3d_info
*d3d_info
= &adapter
->d3d_info
;
1843 const struct wined3d_gl_info
*gl_info
= &adapter
->gl_info
;
1844 struct wined3d_vertex_caps vertex_caps
;
1845 DWORD ckey_caps
, blit_caps
, fx_caps
;
1846 struct fragment_caps fragment_caps
;
1847 struct shader_caps shader_caps
;
1849 TRACE("wined3d %p, adapter_idx %u, device_type %s, caps %p.\n",
1850 wined3d
, adapter_idx
, debug_d3ddevicetype(device_type
), caps
);
1852 if (adapter_idx
>= wined3d
->adapter_count
)
1853 return WINED3DERR_INVALIDCALL
;
1855 caps
->DeviceType
= (device_type
== WINED3D_DEVICE_TYPE_HAL
) ? WINED3D_DEVICE_TYPE_HAL
: WINED3D_DEVICE_TYPE_REF
;
1856 caps
->AdapterOrdinal
= adapter_idx
;
1859 caps
->Caps2
= WINED3DCAPS2_CANRENDERWINDOWED
|
1860 WINED3DCAPS2_FULLSCREENGAMMA
|
1861 WINED3DCAPS2_DYNAMICTEXTURES
;
1862 if (gl_info
->supported
[ARB_FRAMEBUFFER_OBJECT
] || gl_info
->supported
[EXT_FRAMEBUFFER_OBJECT
])
1863 caps
->Caps2
|= WINED3DCAPS2_CANGENMIPMAP
;
1865 caps
->Caps3
= WINED3DCAPS3_ALPHA_FULLSCREEN_FLIP_OR_DISCARD
|
1866 WINED3DCAPS3_COPY_TO_VIDMEM
|
1867 WINED3DCAPS3_COPY_TO_SYSTEMMEM
;
1869 caps
->CursorCaps
= WINED3DCURSORCAPS_COLOR
|
1870 WINED3DCURSORCAPS_LOWRES
;
1872 caps
->DevCaps
= WINED3DDEVCAPS_FLOATTLVERTEX
|
1873 WINED3DDEVCAPS_EXECUTESYSTEMMEMORY
|
1874 WINED3DDEVCAPS_TLVERTEXSYSTEMMEMORY
|
1875 WINED3DDEVCAPS_TLVERTEXVIDEOMEMORY
|
1876 WINED3DDEVCAPS_DRAWPRIMTLVERTEX
|
1877 WINED3DDEVCAPS_HWTRANSFORMANDLIGHT
|
1878 WINED3DDEVCAPS_EXECUTEVIDEOMEMORY
|
1879 WINED3DDEVCAPS_PUREDEVICE
|
1880 WINED3DDEVCAPS_HWRASTERIZATION
|
1881 WINED3DDEVCAPS_TEXTUREVIDEOMEMORY
|
1882 WINED3DDEVCAPS_TEXTURESYSTEMMEMORY
|
1883 WINED3DDEVCAPS_CANRENDERAFTERFLIP
|
1884 WINED3DDEVCAPS_DRAWPRIMITIVES2
|
1885 WINED3DDEVCAPS_DRAWPRIMITIVES2EX
;
1887 caps
->PrimitiveMiscCaps
= WINED3DPMISCCAPS_CULLNONE
|
1888 WINED3DPMISCCAPS_CULLCCW
|
1889 WINED3DPMISCCAPS_CULLCW
|
1890 WINED3DPMISCCAPS_COLORWRITEENABLE
|
1891 WINED3DPMISCCAPS_CLIPTLVERTS
|
1892 WINED3DPMISCCAPS_CLIPPLANESCALEDPOINTS
|
1893 WINED3DPMISCCAPS_MASKZ
|
1894 WINED3DPMISCCAPS_MRTPOSTPIXELSHADERBLENDING
;
1896 WINED3DPMISCCAPS_NULLREFERENCE
1897 WINED3DPMISCCAPS_FOGANDSPECULARALPHA
1898 WINED3DPMISCCAPS_MRTINDEPENDENTBITDEPTHS
1899 WINED3DPMISCCAPS_FOGVERTEXCLAMPED */
1901 if (gl_info
->supported
[WINED3D_GL_BLEND_EQUATION
])
1902 caps
->PrimitiveMiscCaps
|= WINED3DPMISCCAPS_BLENDOP
;
1903 if (gl_info
->supported
[EXT_BLEND_EQUATION_SEPARATE
] && gl_info
->supported
[EXT_BLEND_FUNC_SEPARATE
])
1904 caps
->PrimitiveMiscCaps
|= WINED3DPMISCCAPS_SEPARATEALPHABLEND
;
1905 if (gl_info
->supported
[EXT_DRAW_BUFFERS2
])
1906 caps
->PrimitiveMiscCaps
|= WINED3DPMISCCAPS_INDEPENDENTWRITEMASKS
;
1907 if (gl_info
->supported
[ARB_FRAMEBUFFER_SRGB
])
1908 caps
->PrimitiveMiscCaps
|= WINED3DPMISCCAPS_POSTBLENDSRGBCONVERT
;
1910 caps
->RasterCaps
= WINED3DPRASTERCAPS_DITHER
|
1911 WINED3DPRASTERCAPS_PAT
|
1912 WINED3DPRASTERCAPS_WFOG
|
1913 WINED3DPRASTERCAPS_ZFOG
|
1914 WINED3DPRASTERCAPS_FOGVERTEX
|
1915 WINED3DPRASTERCAPS_FOGTABLE
|
1916 WINED3DPRASTERCAPS_STIPPLE
|
1917 WINED3DPRASTERCAPS_SUBPIXEL
|
1918 WINED3DPRASTERCAPS_ZTEST
|
1919 WINED3DPRASTERCAPS_SCISSORTEST
|
1920 WINED3DPRASTERCAPS_SLOPESCALEDEPTHBIAS
|
1921 WINED3DPRASTERCAPS_DEPTHBIAS
;
1923 if (gl_info
->supported
[ARB_TEXTURE_FILTER_ANISOTROPIC
])
1925 caps
->RasterCaps
|= WINED3DPRASTERCAPS_ANISOTROPY
|
1926 WINED3DPRASTERCAPS_ZBIAS
|
1927 WINED3DPRASTERCAPS_MIPMAPLODBIAS
;
1930 caps
->ZCmpCaps
= WINED3DPCMPCAPS_ALWAYS
|
1931 WINED3DPCMPCAPS_EQUAL
|
1932 WINED3DPCMPCAPS_GREATER
|
1933 WINED3DPCMPCAPS_GREATEREQUAL
|
1934 WINED3DPCMPCAPS_LESS
|
1935 WINED3DPCMPCAPS_LESSEQUAL
|
1936 WINED3DPCMPCAPS_NEVER
|
1937 WINED3DPCMPCAPS_NOTEQUAL
;
1939 /* WINED3DPBLENDCAPS_BOTHINVSRCALPHA and WINED3DPBLENDCAPS_BOTHSRCALPHA
1940 * are legacy settings for srcblend only. */
1941 caps
->SrcBlendCaps
= WINED3DPBLENDCAPS_BOTHINVSRCALPHA
|
1942 WINED3DPBLENDCAPS_BOTHSRCALPHA
|
1943 WINED3DPBLENDCAPS_DESTALPHA
|
1944 WINED3DPBLENDCAPS_DESTCOLOR
|
1945 WINED3DPBLENDCAPS_INVDESTALPHA
|
1946 WINED3DPBLENDCAPS_INVDESTCOLOR
|
1947 WINED3DPBLENDCAPS_INVSRCALPHA
|
1948 WINED3DPBLENDCAPS_INVSRCCOLOR
|
1949 WINED3DPBLENDCAPS_ONE
|
1950 WINED3DPBLENDCAPS_SRCALPHA
|
1951 WINED3DPBLENDCAPS_SRCALPHASAT
|
1952 WINED3DPBLENDCAPS_SRCCOLOR
|
1953 WINED3DPBLENDCAPS_ZERO
;
1955 caps
->DestBlendCaps
= WINED3DPBLENDCAPS_DESTALPHA
|
1956 WINED3DPBLENDCAPS_DESTCOLOR
|
1957 WINED3DPBLENDCAPS_INVDESTALPHA
|
1958 WINED3DPBLENDCAPS_INVDESTCOLOR
|
1959 WINED3DPBLENDCAPS_INVSRCALPHA
|
1960 WINED3DPBLENDCAPS_INVSRCCOLOR
|
1961 WINED3DPBLENDCAPS_ONE
|
1962 WINED3DPBLENDCAPS_SRCALPHA
|
1963 WINED3DPBLENDCAPS_SRCCOLOR
|
1964 WINED3DPBLENDCAPS_ZERO
;
1966 if (gl_info
->supported
[ARB_BLEND_FUNC_EXTENDED
])
1967 caps
->DestBlendCaps
|= WINED3DPBLENDCAPS_SRCALPHASAT
;
1969 if (gl_info
->supported
[EXT_BLEND_COLOR
])
1971 caps
->SrcBlendCaps
|= WINED3DPBLENDCAPS_BLENDFACTOR
;
1972 caps
->DestBlendCaps
|= WINED3DPBLENDCAPS_BLENDFACTOR
;
1976 caps
->AlphaCmpCaps
= WINED3DPCMPCAPS_ALWAYS
|
1977 WINED3DPCMPCAPS_EQUAL
|
1978 WINED3DPCMPCAPS_GREATER
|
1979 WINED3DPCMPCAPS_GREATEREQUAL
|
1980 WINED3DPCMPCAPS_LESS
|
1981 WINED3DPCMPCAPS_LESSEQUAL
|
1982 WINED3DPCMPCAPS_NEVER
|
1983 WINED3DPCMPCAPS_NOTEQUAL
;
1985 caps
->ShadeCaps
= WINED3DPSHADECAPS_SPECULARGOURAUDRGB
|
1986 WINED3DPSHADECAPS_COLORGOURAUDRGB
|
1987 WINED3DPSHADECAPS_ALPHAFLATBLEND
|
1988 WINED3DPSHADECAPS_ALPHAGOURAUDBLEND
|
1989 WINED3DPSHADECAPS_COLORFLATRGB
|
1990 WINED3DPSHADECAPS_FOGFLAT
|
1991 WINED3DPSHADECAPS_FOGGOURAUD
|
1992 WINED3DPSHADECAPS_SPECULARFLATRGB
;
1994 caps
->TextureCaps
= WINED3DPTEXTURECAPS_ALPHA
|
1995 WINED3DPTEXTURECAPS_ALPHAPALETTE
|
1996 WINED3DPTEXTURECAPS_TRANSPARENCY
|
1997 WINED3DPTEXTURECAPS_BORDER
|
1998 WINED3DPTEXTURECAPS_MIPMAP
|
1999 WINED3DPTEXTURECAPS_PROJECTED
|
2000 WINED3DPTEXTURECAPS_PERSPECTIVE
;
2002 if (!d3d_info
->texture_npot
)
2004 caps
->TextureCaps
|= WINED3DPTEXTURECAPS_POW2
;
2005 if (d3d_info
->texture_npot_conditional
)
2006 caps
->TextureCaps
|= WINED3DPTEXTURECAPS_NONPOW2CONDITIONAL
;
2009 if (gl_info
->supported
[EXT_TEXTURE3D
])
2011 caps
->TextureCaps
|= WINED3DPTEXTURECAPS_VOLUMEMAP
2012 | WINED3DPTEXTURECAPS_MIPVOLUMEMAP
;
2013 if (!d3d_info
->texture_npot
)
2014 caps
->TextureCaps
|= WINED3DPTEXTURECAPS_VOLUMEMAP_POW2
;
2017 if (gl_info
->supported
[ARB_TEXTURE_CUBE_MAP
])
2019 caps
->TextureCaps
|= WINED3DPTEXTURECAPS_CUBEMAP
2020 | WINED3DPTEXTURECAPS_MIPCUBEMAP
;
2021 if (!d3d_info
->texture_npot
)
2022 caps
->TextureCaps
|= WINED3DPTEXTURECAPS_CUBEMAP_POW2
;
2025 caps
->TextureFilterCaps
= WINED3DPTFILTERCAPS_MAGFLINEAR
|
2026 WINED3DPTFILTERCAPS_MAGFPOINT
|
2027 WINED3DPTFILTERCAPS_MINFLINEAR
|
2028 WINED3DPTFILTERCAPS_MINFPOINT
|
2029 WINED3DPTFILTERCAPS_MIPFLINEAR
|
2030 WINED3DPTFILTERCAPS_MIPFPOINT
|
2031 WINED3DPTFILTERCAPS_LINEAR
|
2032 WINED3DPTFILTERCAPS_LINEARMIPLINEAR
|
2033 WINED3DPTFILTERCAPS_LINEARMIPNEAREST
|
2034 WINED3DPTFILTERCAPS_MIPLINEAR
|
2035 WINED3DPTFILTERCAPS_MIPNEAREST
|
2036 WINED3DPTFILTERCAPS_NEAREST
;
2038 if (gl_info
->supported
[ARB_TEXTURE_FILTER_ANISOTROPIC
])
2040 caps
->TextureFilterCaps
|= WINED3DPTFILTERCAPS_MAGFANISOTROPIC
|
2041 WINED3DPTFILTERCAPS_MINFANISOTROPIC
;
2044 if (gl_info
->supported
[ARB_TEXTURE_CUBE_MAP
])
2046 caps
->CubeTextureFilterCaps
= WINED3DPTFILTERCAPS_MAGFLINEAR
|
2047 WINED3DPTFILTERCAPS_MAGFPOINT
|
2048 WINED3DPTFILTERCAPS_MINFLINEAR
|
2049 WINED3DPTFILTERCAPS_MINFPOINT
|
2050 WINED3DPTFILTERCAPS_MIPFLINEAR
|
2051 WINED3DPTFILTERCAPS_MIPFPOINT
|
2052 WINED3DPTFILTERCAPS_LINEAR
|
2053 WINED3DPTFILTERCAPS_LINEARMIPLINEAR
|
2054 WINED3DPTFILTERCAPS_LINEARMIPNEAREST
|
2055 WINED3DPTFILTERCAPS_MIPLINEAR
|
2056 WINED3DPTFILTERCAPS_MIPNEAREST
|
2057 WINED3DPTFILTERCAPS_NEAREST
;
2059 if (gl_info
->supported
[ARB_TEXTURE_FILTER_ANISOTROPIC
])
2061 caps
->CubeTextureFilterCaps
|= WINED3DPTFILTERCAPS_MAGFANISOTROPIC
|
2062 WINED3DPTFILTERCAPS_MINFANISOTROPIC
;
2067 caps
->CubeTextureFilterCaps
= 0;
2070 if (gl_info
->supported
[EXT_TEXTURE3D
])
2072 caps
->VolumeTextureFilterCaps
= WINED3DPTFILTERCAPS_MAGFLINEAR
|
2073 WINED3DPTFILTERCAPS_MAGFPOINT
|
2074 WINED3DPTFILTERCAPS_MINFLINEAR
|
2075 WINED3DPTFILTERCAPS_MINFPOINT
|
2076 WINED3DPTFILTERCAPS_MIPFLINEAR
|
2077 WINED3DPTFILTERCAPS_MIPFPOINT
|
2078 WINED3DPTFILTERCAPS_LINEAR
|
2079 WINED3DPTFILTERCAPS_LINEARMIPLINEAR
|
2080 WINED3DPTFILTERCAPS_LINEARMIPNEAREST
|
2081 WINED3DPTFILTERCAPS_MIPLINEAR
|
2082 WINED3DPTFILTERCAPS_MIPNEAREST
|
2083 WINED3DPTFILTERCAPS_NEAREST
;
2087 caps
->VolumeTextureFilterCaps
= 0;
2090 caps
->TextureAddressCaps
= WINED3DPTADDRESSCAPS_INDEPENDENTUV
|
2091 WINED3DPTADDRESSCAPS_CLAMP
|
2092 WINED3DPTADDRESSCAPS_WRAP
;
2094 if (gl_info
->supported
[ARB_TEXTURE_BORDER_CLAMP
])
2096 caps
->TextureAddressCaps
|= WINED3DPTADDRESSCAPS_BORDER
;
2098 if (gl_info
->supported
[ARB_TEXTURE_MIRRORED_REPEAT
])
2100 caps
->TextureAddressCaps
|= WINED3DPTADDRESSCAPS_MIRROR
;
2102 if (gl_info
->supported
[ARB_TEXTURE_MIRROR_CLAMP_TO_EDGE
])
2104 caps
->TextureAddressCaps
|= WINED3DPTADDRESSCAPS_MIRRORONCE
;
2107 if (gl_info
->supported
[EXT_TEXTURE3D
])
2109 caps
->VolumeTextureAddressCaps
= WINED3DPTADDRESSCAPS_INDEPENDENTUV
|
2110 WINED3DPTADDRESSCAPS_CLAMP
|
2111 WINED3DPTADDRESSCAPS_WRAP
;
2112 if (gl_info
->supported
[ARB_TEXTURE_BORDER_CLAMP
])
2114 caps
->VolumeTextureAddressCaps
|= WINED3DPTADDRESSCAPS_BORDER
;
2116 if (gl_info
->supported
[ARB_TEXTURE_MIRRORED_REPEAT
])
2118 caps
->VolumeTextureAddressCaps
|= WINED3DPTADDRESSCAPS_MIRROR
;
2120 if (gl_info
->supported
[ARB_TEXTURE_MIRROR_CLAMP_TO_EDGE
])
2122 caps
->VolumeTextureAddressCaps
|= WINED3DPTADDRESSCAPS_MIRRORONCE
;
2127 caps
->VolumeTextureAddressCaps
= 0;
2130 caps
->LineCaps
= WINED3DLINECAPS_TEXTURE
|
2131 WINED3DLINECAPS_ZTEST
|
2132 WINED3DLINECAPS_BLEND
|
2133 WINED3DLINECAPS_ALPHACMP
|
2134 WINED3DLINECAPS_FOG
;
2135 /* WINED3DLINECAPS_ANTIALIAS is not supported on Windows, and dx and gl seem to have a different
2136 * idea how generating the smoothing alpha values works; the result is different
2139 caps
->MaxTextureWidth
= d3d_info
->limits
.texture_size
;
2140 caps
->MaxTextureHeight
= d3d_info
->limits
.texture_size
;
2142 if (gl_info
->supported
[EXT_TEXTURE3D
])
2143 caps
->MaxVolumeExtent
= gl_info
->limits
.texture3d_size
;
2145 caps
->MaxVolumeExtent
= 0;
2147 caps
->MaxTextureRepeat
= 32768;
2148 caps
->MaxTextureAspectRatio
= d3d_info
->limits
.texture_size
;
2149 caps
->MaxVertexW
= 1.0f
;
2151 caps
->GuardBandLeft
= 0.0f
;
2152 caps
->GuardBandTop
= 0.0f
;
2153 caps
->GuardBandRight
= 0.0f
;
2154 caps
->GuardBandBottom
= 0.0f
;
2156 caps
->ExtentsAdjust
= 0.0f
;
2158 caps
->StencilCaps
= WINED3DSTENCILCAPS_DECRSAT
|
2159 WINED3DSTENCILCAPS_INCRSAT
|
2160 WINED3DSTENCILCAPS_INVERT
|
2161 WINED3DSTENCILCAPS_KEEP
|
2162 WINED3DSTENCILCAPS_REPLACE
|
2163 WINED3DSTENCILCAPS_ZERO
;
2164 if (gl_info
->supported
[EXT_STENCIL_WRAP
])
2166 caps
->StencilCaps
|= WINED3DSTENCILCAPS_DECR
|
2167 WINED3DSTENCILCAPS_INCR
;
2169 if (gl_info
->supported
[WINED3D_GL_VERSION_2_0
] || gl_info
->supported
[EXT_STENCIL_TWO_SIDE
]
2170 || gl_info
->supported
[ATI_SEPARATE_STENCIL
])
2172 caps
->StencilCaps
|= WINED3DSTENCILCAPS_TWOSIDED
;
2175 caps
->MaxAnisotropy
= gl_info
->limits
.anisotropy
;
2176 caps
->MaxPointSize
= d3d_info
->limits
.pointsize_max
;
2178 caps
->MaxPrimitiveCount
= 0x555555; /* Taken from an AMD Radeon HD 5700 (Evergreen) GPU. */
2179 caps
->MaxVertexIndex
= 0xffffff; /* Taken from an AMD Radeon HD 5700 (Evergreen) GPU. */
2180 caps
->MaxStreams
= MAX_STREAMS
;
2181 caps
->MaxStreamStride
= 1024;
2183 /* d3d9.dll sets D3DDEVCAPS2_CAN_STRETCHRECT_FROM_TEXTURES here because StretchRects is implemented in d3d9 */
2184 caps
->DevCaps2
= WINED3DDEVCAPS2_STREAMOFFSET
|
2185 WINED3DDEVCAPS2_VERTEXELEMENTSCANSHARESTREAMOFFSET
;
2186 caps
->MaxNpatchTessellationLevel
= 0;
2187 caps
->MasterAdapterOrdinal
= 0;
2188 caps
->AdapterOrdinalInGroup
= 0;
2189 caps
->NumberOfAdaptersInGroup
= 1;
2191 caps
->NumSimultaneousRTs
= d3d_info
->limits
.max_rt_count
;
2193 caps
->StretchRectFilterCaps
= WINED3DPTFILTERCAPS_MINFPOINT
|
2194 WINED3DPTFILTERCAPS_MAGFPOINT
|
2195 WINED3DPTFILTERCAPS_MINFLINEAR
|
2196 WINED3DPTFILTERCAPS_MAGFLINEAR
;
2197 caps
->VertexTextureFilterCaps
= 0;
2199 adapter
->shader_backend
->shader_get_caps(gl_info
, &shader_caps
);
2200 adapter
->fragment_pipe
->get_caps(gl_info
, &fragment_caps
);
2201 adapter
->vertex_pipe
->vp_get_caps(gl_info
, &vertex_caps
);
2203 /* Add shader misc caps. Only some of them belong to the shader parts of the pipeline */
2204 caps
->PrimitiveMiscCaps
|= fragment_caps
.PrimitiveMiscCaps
;
2206 caps
->VertexShaderVersion
= shader_caps
.vs_version
;
2207 caps
->MaxVertexShaderConst
= shader_caps
.vs_uniform_count
;
2209 caps
->PixelShaderVersion
= shader_caps
.ps_version
;
2210 caps
->PixelShader1xMaxValue
= shader_caps
.ps_1x_max_value
;
2212 caps
->TextureOpCaps
= fragment_caps
.TextureOpCaps
;
2213 caps
->MaxTextureBlendStages
= fragment_caps
.MaxTextureBlendStages
;
2214 caps
->MaxSimultaneousTextures
= fragment_caps
.MaxSimultaneousTextures
;
2216 caps
->MaxUserClipPlanes
= vertex_caps
.max_user_clip_planes
;
2217 caps
->MaxActiveLights
= vertex_caps
.max_active_lights
;
2218 caps
->MaxVertexBlendMatrices
= vertex_caps
.max_vertex_blend_matrices
;
2219 caps
->MaxVertexBlendMatrixIndex
= vertex_caps
.max_vertex_blend_matrix_index
;
2220 caps
->VertexProcessingCaps
= vertex_caps
.vertex_processing_caps
;
2221 caps
->FVFCaps
= vertex_caps
.fvf_caps
;
2222 caps
->RasterCaps
|= vertex_caps
.raster_caps
;
2224 /* The following caps are shader specific, but they are things we cannot detect, or which
2225 * are the same among all shader models. So to avoid code duplication set the shader version
2226 * specific, but otherwise constant caps here
2228 if (caps
->VertexShaderVersion
>= 3)
2230 /* Where possible set the caps based on OpenGL extensions and if they
2231 * aren't set (in case of software rendering) use the VS 3.0 from
2232 * MSDN or else if there's OpenGL spec use a hardcoded value minimum
2234 caps
->VS20Caps
.caps
= WINED3DVS20CAPS_PREDICATION
;
2235 /* VS 3.0 requires MAX_DYNAMICFLOWCONTROLDEPTH (24) */
2236 caps
->VS20Caps
.dynamic_flow_control_depth
= WINED3DVS20_MAX_DYNAMICFLOWCONTROLDEPTH
;
2237 caps
->VS20Caps
.temp_count
= max(32, gl_info
->limits
.arb_vs_temps
);
2238 /* level of nesting in loops / if-statements; VS 3.0 requires MAX (4) */
2239 caps
->VS20Caps
.static_flow_control_depth
= WINED3DVS20_MAX_STATICFLOWCONTROLDEPTH
;
2241 caps
->MaxVShaderInstructionsExecuted
= 65535; /* VS 3.0 needs at least 65535, some cards even use 2^32-1 */
2242 caps
->MaxVertexShader30InstructionSlots
= max(512, gl_info
->limits
.arb_vs_instructions
);
2243 caps
->VertexTextureFilterCaps
= WINED3DPTFILTERCAPS_MINFPOINT
| WINED3DPTFILTERCAPS_MAGFPOINT
;
2245 else if (caps
->VertexShaderVersion
== 2)
2247 caps
->VS20Caps
.caps
= 0;
2248 caps
->VS20Caps
.dynamic_flow_control_depth
= WINED3DVS20_MIN_DYNAMICFLOWCONTROLDEPTH
;
2249 caps
->VS20Caps
.temp_count
= max(12, gl_info
->limits
.arb_vs_temps
);
2250 caps
->VS20Caps
.static_flow_control_depth
= 1;
2252 caps
->MaxVShaderInstructionsExecuted
= 65535;
2253 caps
->MaxVertexShader30InstructionSlots
= 0;
2257 caps
->VS20Caps
.caps
= 0;
2258 caps
->VS20Caps
.dynamic_flow_control_depth
= 0;
2259 caps
->VS20Caps
.temp_count
= 0;
2260 caps
->VS20Caps
.static_flow_control_depth
= 0;
2262 caps
->MaxVShaderInstructionsExecuted
= 0;
2263 caps
->MaxVertexShader30InstructionSlots
= 0;
2266 if (caps
->PixelShaderVersion
>= 3)
2268 /* Where possible set the caps based on OpenGL extensions and if they
2269 * aren't set (in case of software rendering) use the PS 3.0 from
2270 * MSDN or else if there's OpenGL spec use a hardcoded value minimum
2273 /* Caps is more or less undocumented on MSDN but it appears to be
2274 * used for PS20Caps based on results from R9600/FX5900/Geforce6800
2275 * cards from Windows */
2276 caps
->PS20Caps
.caps
= WINED3DPS20CAPS_ARBITRARYSWIZZLE
|
2277 WINED3DPS20CAPS_GRADIENTINSTRUCTIONS
|
2278 WINED3DPS20CAPS_PREDICATION
|
2279 WINED3DPS20CAPS_NODEPENDENTREADLIMIT
|
2280 WINED3DPS20CAPS_NOTEXINSTRUCTIONLIMIT
;
2281 /* PS 3.0 requires MAX_DYNAMICFLOWCONTROLDEPTH (24) */
2282 caps
->PS20Caps
.dynamic_flow_control_depth
= WINED3DPS20_MAX_DYNAMICFLOWCONTROLDEPTH
;
2283 caps
->PS20Caps
.temp_count
= max(32, gl_info
->limits
.arb_ps_temps
);
2284 /* PS 3.0 requires MAX_STATICFLOWCONTROLDEPTH (4) */
2285 caps
->PS20Caps
.static_flow_control_depth
= WINED3DPS20_MAX_STATICFLOWCONTROLDEPTH
;
2286 /* PS 3.0 requires MAX_NUMINSTRUCTIONSLOTS (512) */
2287 caps
->PS20Caps
.instruction_slot_count
= WINED3DPS20_MAX_NUMINSTRUCTIONSLOTS
;
2289 caps
->MaxPShaderInstructionsExecuted
= 65535;
2290 caps
->MaxPixelShader30InstructionSlots
= max(WINED3DMIN30SHADERINSTRUCTIONS
,
2291 gl_info
->limits
.arb_ps_instructions
);
2293 else if(caps
->PixelShaderVersion
== 2)
2295 /* Below we assume PS2.0 specs, not extended 2.0a(GeforceFX)/2.0b(Radeon R3xx) ones */
2296 caps
->PS20Caps
.caps
= 0;
2297 caps
->PS20Caps
.dynamic_flow_control_depth
= 0; /* WINED3DVS20_MIN_DYNAMICFLOWCONTROLDEPTH = 0 */
2298 caps
->PS20Caps
.temp_count
= max(12, gl_info
->limits
.arb_ps_temps
);
2299 caps
->PS20Caps
.static_flow_control_depth
= WINED3DPS20_MIN_STATICFLOWCONTROLDEPTH
; /* Minimum: 1 */
2300 /* Minimum number (64 ALU + 32 Texture), a GeforceFX uses 512 */
2301 caps
->PS20Caps
.instruction_slot_count
= WINED3DPS20_MIN_NUMINSTRUCTIONSLOTS
;
2303 caps
->MaxPShaderInstructionsExecuted
= 512; /* Minimum value, a GeforceFX uses 1024 */
2304 caps
->MaxPixelShader30InstructionSlots
= 0;
2308 caps
->PS20Caps
.caps
= 0;
2309 caps
->PS20Caps
.dynamic_flow_control_depth
= 0;
2310 caps
->PS20Caps
.temp_count
= 0;
2311 caps
->PS20Caps
.static_flow_control_depth
= 0;
2312 caps
->PS20Caps
.instruction_slot_count
= 0;
2314 caps
->MaxPShaderInstructionsExecuted
= 0;
2315 caps
->MaxPixelShader30InstructionSlots
= 0;
2318 if (caps
->VertexShaderVersion
>= 2)
2320 /* OpenGL supports all the formats below, perhaps not always
2321 * without conversion, but it supports them.
2322 * Further GLSL doesn't seem to have an official unsigned type so
2323 * don't advertise it yet as I'm not sure how we handle it.
2324 * We might need to add some clamping in the shader engine to
2326 * TODO: WINED3DDTCAPS_USHORT2N, WINED3DDTCAPS_USHORT4N, WINED3DDTCAPS_UDEC3, WINED3DDTCAPS_DEC3N */
2327 caps
->DeclTypes
= WINED3DDTCAPS_UBYTE4
|
2328 WINED3DDTCAPS_UBYTE4N
|
2329 WINED3DDTCAPS_SHORT2N
|
2330 WINED3DDTCAPS_SHORT4N
;
2331 if (gl_info
->supported
[ARB_HALF_FLOAT_VERTEX
])
2333 caps
->DeclTypes
|= WINED3DDTCAPS_FLOAT16_2
|
2334 WINED3DDTCAPS_FLOAT16_4
;
2339 caps
->DeclTypes
= 0;
2342 /* Set DirectDraw helper Caps */
2343 ckey_caps
= WINEDDCKEYCAPS_DESTBLT
|
2344 WINEDDCKEYCAPS_SRCBLT
;
2345 fx_caps
= WINEDDFXCAPS_BLTALPHA
|
2346 WINEDDFXCAPS_BLTMIRRORLEFTRIGHT
|
2347 WINEDDFXCAPS_BLTMIRRORUPDOWN
|
2348 WINEDDFXCAPS_BLTROTATION90
|
2349 WINEDDFXCAPS_BLTSHRINKX
|
2350 WINEDDFXCAPS_BLTSHRINKXN
|
2351 WINEDDFXCAPS_BLTSHRINKY
|
2352 WINEDDFXCAPS_BLTSHRINKYN
|
2353 WINEDDFXCAPS_BLTSTRETCHX
|
2354 WINEDDFXCAPS_BLTSTRETCHXN
|
2355 WINEDDFXCAPS_BLTSTRETCHY
|
2356 WINEDDFXCAPS_BLTSTRETCHYN
;
2357 blit_caps
= WINEDDCAPS_BLT
|
2358 WINEDDCAPS_BLTCOLORFILL
|
2359 WINEDDCAPS_BLTDEPTHFILL
|
2360 WINEDDCAPS_BLTSTRETCH
|
2361 WINEDDCAPS_CANBLTSYSMEM
|
2362 WINEDDCAPS_CANCLIP
|
2363 WINEDDCAPS_CANCLIPSTRETCHED
|
2364 WINEDDCAPS_COLORKEY
|
2365 WINEDDCAPS_COLORKEYHWASSIST
;
2367 /* Fill the ddraw caps structure */
2368 caps
->ddraw_caps
.caps
= WINEDDCAPS_GDI
|
2369 WINEDDCAPS_PALETTE
|
2371 caps
->ddraw_caps
.caps2
= WINEDDCAPS2_CERTIFIED
|
2372 WINEDDCAPS2_NOPAGELOCKREQUIRED
|
2373 WINEDDCAPS2_PRIMARYGAMMA
|
2374 WINEDDCAPS2_WIDESURFACES
|
2375 WINEDDCAPS2_CANRENDERWINDOWED
;
2376 caps
->ddraw_caps
.color_key_caps
= ckey_caps
;
2377 caps
->ddraw_caps
.fx_caps
= fx_caps
;
2378 caps
->ddraw_caps
.svb_caps
= blit_caps
;
2379 caps
->ddraw_caps
.svb_color_key_caps
= ckey_caps
;
2380 caps
->ddraw_caps
.svb_fx_caps
= fx_caps
;
2381 caps
->ddraw_caps
.vsb_caps
= blit_caps
;
2382 caps
->ddraw_caps
.vsb_color_key_caps
= ckey_caps
;
2383 caps
->ddraw_caps
.vsb_fx_caps
= fx_caps
;
2384 caps
->ddraw_caps
.ssb_caps
= blit_caps
;
2385 caps
->ddraw_caps
.ssb_color_key_caps
= ckey_caps
;
2386 caps
->ddraw_caps
.ssb_fx_caps
= fx_caps
;
2388 caps
->ddraw_caps
.dds_caps
= WINEDDSCAPS_ALPHA
2389 | WINEDDSCAPS_BACKBUFFER
2391 | WINEDDSCAPS_FRONTBUFFER
2392 | WINEDDSCAPS_OFFSCREENPLAIN
2393 | WINEDDSCAPS_PALETTE
2394 | WINEDDSCAPS_PRIMARYSURFACE
2395 | WINEDDSCAPS_SYSTEMMEMORY
2396 | WINEDDSCAPS_VISIBLE
;
2398 if (!(wined3d
->flags
& WINED3D_NO3D
))
2400 caps
->ddraw_caps
.dds_caps
|= WINEDDSCAPS_3DDEVICE
2401 | WINEDDSCAPS_MIPMAP
2402 | WINEDDSCAPS_TEXTURE
2403 | WINEDDSCAPS_VIDEOMEMORY
2404 | WINEDDSCAPS_ZBUFFER
;
2405 caps
->ddraw_caps
.caps
|= WINEDDCAPS_3D
;
2408 caps
->shader_double_precision
= d3d_info
->shader_double_precision
;
2409 caps
->viewport_array_index_any_shader
= d3d_info
->viewport_array_index_any_shader
;
2411 caps
->max_feature_level
= d3d_info
->feature_level
;
2416 HRESULT CDECL
wined3d_device_create(struct wined3d
*wined3d
, unsigned int adapter_idx
,
2417 enum wined3d_device_type device_type
, HWND focus_window
, DWORD flags
, BYTE surface_alignment
,
2418 const enum wined3d_feature_level
*feature_levels
, unsigned int feature_level_count
,
2419 struct wined3d_device_parent
*device_parent
, struct wined3d_device
**device
)
2421 struct wined3d_device
*object
;
2424 TRACE("wined3d %p, adapter_idx %u, device_type %#x, focus_window %p, flags %#x, "
2425 "surface_alignment %u, feature_levels %p, feature_level_count %u, device_parent %p, device %p.\n",
2426 wined3d
, adapter_idx
, device_type
, focus_window
, flags
, surface_alignment
,
2427 feature_levels
, feature_level_count
, device_parent
, device
);
2429 if (adapter_idx
>= wined3d
->adapter_count
)
2430 return WINED3DERR_INVALIDCALL
;
2432 if (!(object
= heap_alloc_zero(sizeof(*object
))))
2433 return E_OUTOFMEMORY
;
2435 if (FAILED(hr
= device_init(object
, wined3d
, adapter_idx
,
2436 device_type
, focus_window
, flags
, surface_alignment
,
2437 feature_levels
, feature_level_count
, device_parent
)))
2439 WARN("Failed to initialize device, hr %#x.\n", hr
);
2444 TRACE("Created device %p.\n", object
);
2447 device_parent
->ops
->wined3d_device_created(device_parent
, *device
);
2452 static BOOL
wined3d_adapter_no3d_create_context(struct wined3d_context
*context
,
2453 struct wined3d_texture
*target
, const struct wined3d_format
*ds_format
)
2458 static const struct wined3d_adapter_ops wined3d_adapter_no3d_ops
=
2460 wined3d_adapter_no3d_create_context
,
2463 static void wined3d_adapter_no3d_init_d3d_info(struct wined3d_adapter
*adapter
, DWORD wined3d_creation_flags
)
2465 struct wined3d_d3d_info
*d3d_info
= &adapter
->d3d_info
;
2467 d3d_info
->wined3d_creation_flags
= wined3d_creation_flags
;
2468 d3d_info
->texture_npot
= TRUE
;
2469 d3d_info
->feature_level
= WINED3D_FEATURE_LEVEL_5
;
2472 static BOOL
wined3d_adapter_no3d_init(struct wined3d_adapter
*adapter
, DWORD wined3d_creation_flags
)
2474 static const struct wined3d_gpu_description gpu_description
=
2476 HW_VENDOR_SOFTWARE
, CARD_WINE
, "WineD3D DirectDraw Emulation", DRIVER_WINE
, 128,
2479 TRACE("adapter %p.\n", adapter
);
2481 wined3d_driver_info_init(&adapter
->driver_info
, &gpu_description
, 0);
2482 adapter
->vram_bytes
= adapter
->driver_info
.vram_bytes
;
2483 adapter
->vram_bytes_used
= 0;
2484 TRACE("Emulating 0x%s bytes of video ram.\n", wine_dbgstr_longlong(adapter
->vram_bytes
));
2486 if (!wined3d_adapter_no3d_init_format_info(adapter
))
2489 adapter
->vertex_pipe
= &none_vertex_pipe
;
2490 adapter
->fragment_pipe
= &none_fragment_pipe
;
2491 adapter
->shader_backend
= &none_shader_backend
;
2492 adapter
->adapter_ops
= &wined3d_adapter_no3d_ops
;
2494 wined3d_adapter_no3d_init_d3d_info(adapter
, wined3d_creation_flags
);
2499 static BOOL
wined3d_adapter_init(struct wined3d_adapter
*adapter
, unsigned int ordinal
, DWORD wined3d_creation_flags
)
2501 DISPLAY_DEVICEW display_device
;
2503 adapter
->ordinal
= ordinal
;
2505 display_device
.cb
= sizeof(display_device
);
2506 EnumDisplayDevicesW(NULL
, ordinal
, &display_device
, 0);
2507 TRACE("Display device: %s\n", debugstr_w(display_device
.DeviceName
));
2508 strcpyW(adapter
->DeviceName
, display_device
.DeviceName
);
2510 if (!AllocateLocallyUniqueId(&adapter
->luid
))
2512 ERR("Failed to set adapter LUID (%#x).\n", GetLastError());
2515 TRACE("Allocated LUID %08x:%08x for adapter %p.\n",
2516 adapter
->luid
.HighPart
, adapter
->luid
.LowPart
, adapter
);
2518 adapter
->formats
= NULL
;
2520 if (wined3d_creation_flags
& WINED3D_NO3D
)
2521 return wined3d_adapter_no3d_init(adapter
, wined3d_creation_flags
);
2522 return wined3d_adapter_gl_init(adapter
, wined3d_creation_flags
);
2525 static void STDMETHODCALLTYPE
wined3d_null_wined3d_object_destroyed(void *parent
) {}
2527 const struct wined3d_parent_ops wined3d_null_parent_ops
=
2529 wined3d_null_wined3d_object_destroyed
,
2532 HRESULT
wined3d_init(struct wined3d
*wined3d
, DWORD flags
)
2535 wined3d
->flags
= flags
;
2537 TRACE("Initialising adapters.\n");
2539 if (!wined3d_adapter_init(&wined3d
->adapters
[0], 0, flags
))
2541 WARN("Failed to initialise adapter.\n");
2544 wined3d
->adapter_count
= 1;