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
);
31 WINE_DECLARE_DEBUG_CHANNEL(winediag
);
33 #define DEFAULT_REFRESH_RATE 0
35 enum wined3d_driver_model
44 /* The d3d device ID */
45 static const GUID IID_D3DDEVICE_D3DUID
= { 0xaeb2cdd4, 0x6e41, 0x43ea, { 0x94,0x1c,0x83,0x61,0xcc,0x76,0x07,0x81 } };
47 /**********************************************************
48 * Utility functions follow
49 **********************************************************/
51 const struct min_lookup minMipLookup
[] =
53 /* NONE POINT LINEAR */
54 {{GL_NEAREST
, GL_NEAREST
, GL_NEAREST
}}, /* NONE */
55 {{GL_NEAREST
, GL_NEAREST_MIPMAP_NEAREST
, GL_NEAREST_MIPMAP_LINEAR
}}, /* POINT*/
56 {{GL_LINEAR
, GL_LINEAR_MIPMAP_NEAREST
, GL_LINEAR_MIPMAP_LINEAR
}}, /* LINEAR */
59 const GLenum magLookup
[] =
61 /* NONE POINT LINEAR */
62 GL_NEAREST
, GL_NEAREST
, GL_LINEAR
,
65 /* Adjust the amount of used texture memory */
66 UINT64
adapter_adjust_memory(struct wined3d_adapter
*adapter
, INT64 amount
)
68 adapter
->vram_bytes_used
+= amount
;
69 TRACE("Adjusted used adapter memory by 0x%s to 0x%s.\n",
70 wine_dbgstr_longlong(amount
),
71 wine_dbgstr_longlong(adapter
->vram_bytes_used
));
72 return adapter
->vram_bytes_used
;
75 void wined3d_adapter_cleanup(struct wined3d_adapter
*adapter
)
77 heap_free(adapter
->formats
);
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 struct wined3d_adapter
*adapter
= wined3d
->adapters
[i
];
103 adapter
->adapter_ops
->adapter_destroy(adapter
);
111 /* Certain applications (Steam) complain if we report an outdated driver version. In general,
112 * reporting a driver version is moot because we are not the Windows driver, and we have different
113 * bugs, features, etc.
115 * The driver version has the form "x.y.z.w".
117 * "x" is the Windows version the driver is meant for:
124 * "y" is the maximum Direct3D version the driver supports.
125 * y -> d3d version mapping:
134 * "z" is the subversion number.
136 * "w" is the vendor specific driver build number.
139 struct driver_version_information
141 enum wined3d_display_driver driver
;
142 enum wined3d_driver_model driver_model
;
143 const char *driver_name
; /* name of Windows driver */
144 WORD version
; /* version word ('y'), contained in low word of DriverVersion.HighPart */
145 WORD subversion
; /* subversion word ('z'), contained in high word of DriverVersion.LowPart */
146 WORD build
; /* build number ('w'), contained in low word of DriverVersion.LowPart */
149 /* The driver version table contains driver information for different devices on several OS versions. */
150 static const struct driver_version_information driver_version_table
[] =
153 * - Radeon HD2x00 (R600) and up supported by current drivers.
154 * - Radeon 9500 (R300) - X1*00 (R5xx) supported up to Catalyst 9.3 (Linux) and 10.2 (XP/Vista/Win7)
155 * - Radeon 7xxx (R100) - 9250 (RV250) supported up to Catalyst 6.11 (XP)
156 * - Rage 128 supported up to XP, latest official build 6.13.3279 dated October 2001 */
157 {DRIVER_AMD_RAGE_128PRO
, DRIVER_MODEL_NT5X
, "ati2dvaa.dll", 13, 3279, 0},
158 {DRIVER_AMD_R100
, DRIVER_MODEL_NT5X
, "ati2dvag.dll", 14, 10, 6614},
159 {DRIVER_AMD_R300
, DRIVER_MODEL_NT5X
, "ati2dvag.dll", 14, 10, 6764},
160 {DRIVER_AMD_R600
, DRIVER_MODEL_NT5X
, "ati2dvag.dll", 17, 10, 1280},
161 {DRIVER_AMD_R300
, DRIVER_MODEL_NT6X
, "atiumdag.dll", 14, 10, 741 },
162 {DRIVER_AMD_R600
, DRIVER_MODEL_NT6X
, "atiumdag.dll", 17, 10, 1280},
163 {DRIVER_AMD_RX
, DRIVER_MODEL_NT6X
, "aticfx32.dll", 17, 10, 1474},
166 * The drivers are unified but not all versions support all GPUs. At some point the 2k/xp
167 * drivers used ialmrnt5.dll for GMA800/GMA900 but at some point the file was renamed to
168 * igxprd32.dll but the GMA800 driver was never updated. */
169 {DRIVER_INTEL_GMA800
, DRIVER_MODEL_NT5X
, "ialmrnt5.dll", 14, 10, 3889},
170 {DRIVER_INTEL_GMA900
, DRIVER_MODEL_NT5X
, "igxprd32.dll", 14, 10, 4764},
171 {DRIVER_INTEL_GMA950
, DRIVER_MODEL_NT5X
, "igxprd32.dll", 14, 10, 4926},
172 {DRIVER_INTEL_GMA3000
, DRIVER_MODEL_NT5X
, "igxprd32.dll", 14, 10, 5218},
173 {DRIVER_INTEL_GMA950
, DRIVER_MODEL_NT6X
, "igdumd32.dll", 14, 10, 1504},
174 {DRIVER_INTEL_GMA3000
, DRIVER_MODEL_NT6X
, "igdumd32.dll", 15, 10, 1666},
175 {DRIVER_INTEL_HD4000
, DRIVER_MODEL_NT6X
, "igdumdim32.dll", 19, 15, 4352},
178 * - Geforce8 and newer is supported by the current 340.52 driver on XP-Win8
179 * - Geforce6 and 7 support is up to 307.83 on XP-Win8
180 * - GeforceFX support is up to 173.x on <= XP
181 * - Geforce2MX/3/4 up to 96.x on <= XP
182 * - TNT/Geforce1/2 up to 71.x on <= XP
183 * All version numbers used below are from the Linux nvidia drivers. */
184 {DRIVER_NVIDIA_TNT
, DRIVER_MODEL_NT5X
, "nv4_disp.dll", 14, 10, 7186},
185 {DRIVER_NVIDIA_GEFORCE2MX
, DRIVER_MODEL_NT5X
, "nv4_disp.dll", 14, 10, 9371},
186 {DRIVER_NVIDIA_GEFORCEFX
, DRIVER_MODEL_NT5X
, "nv4_disp.dll", 14, 11, 7516},
187 {DRIVER_NVIDIA_GEFORCE6
, DRIVER_MODEL_NT5X
, "nv4_disp.dll", 18, 13, 783},
188 {DRIVER_NVIDIA_GEFORCE8
, DRIVER_MODEL_NT5X
, "nv4_disp.dll", 18, 13, 4052},
189 {DRIVER_NVIDIA_GEFORCE6
, DRIVER_MODEL_NT6X
, "nvd3dum.dll", 18, 13, 783},
190 {DRIVER_NVIDIA_GEFORCE8
, DRIVER_MODEL_NT6X
, "nvd3dum.dll", 18, 13, 4052},
193 {DRIVER_REDHAT_VIRGL
, DRIVER_MODEL_GENERIC
, "virgl.dll", 0, 0, 0},
196 {DRIVER_VMWARE
, DRIVER_MODEL_NT5X
, "vm3dum.dll", 14, 1, 1134},
199 {DRIVER_WINE
, DRIVER_MODEL_GENERIC
, "wined3d.dll", 0, 0, 0},
202 /* The amount of video memory stored in the gpu description table is the minimum amount of video memory
203 * found on a board containing a specific GPU. */
204 static const struct wined3d_gpu_description gpu_description_table
[] =
207 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_RIVA_128
, "NVIDIA RIVA 128", DRIVER_NVIDIA_TNT
, 4 },
208 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_RIVA_TNT
, "NVIDIA RIVA TNT", DRIVER_NVIDIA_TNT
, 16 },
209 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_RIVA_TNT2
, "NVIDIA RIVA TNT2/TNT2 Pro", DRIVER_NVIDIA_TNT
, 32 },
210 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE
, "NVIDIA GeForce 256", DRIVER_NVIDIA_TNT
, 32 },
211 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE2
, "NVIDIA GeForce2 GTS/GeForce2 Pro", DRIVER_NVIDIA_TNT
, 32 },
212 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE2_MX
, "NVIDIA GeForce2 MX/MX 400", DRIVER_NVIDIA_GEFORCE2MX
,32 },
213 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE3
, "NVIDIA GeForce3", DRIVER_NVIDIA_GEFORCE2MX
,64 },
214 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE4_MX
, "NVIDIA GeForce4 MX 460", DRIVER_NVIDIA_GEFORCE2MX
,64 },
215 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE4_TI4200
, "NVIDIA GeForce4 Ti 4200", DRIVER_NVIDIA_GEFORCE2MX
,64, },
216 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCEFX_5200
, "NVIDIA GeForce FX 5200", DRIVER_NVIDIA_GEFORCEFX
, 64 },
217 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCEFX_5600
, "NVIDIA GeForce FX 5600", DRIVER_NVIDIA_GEFORCEFX
, 128 },
218 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCEFX_5800
, "NVIDIA GeForce FX 5800", DRIVER_NVIDIA_GEFORCEFX
, 256 },
219 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_6200
, "NVIDIA GeForce 6200", DRIVER_NVIDIA_GEFORCE6
, 64 },
220 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_6600GT
, "NVIDIA GeForce 6600 GT", DRIVER_NVIDIA_GEFORCE6
, 128 },
221 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_6800
, "NVIDIA GeForce 6800", DRIVER_NVIDIA_GEFORCE6
, 128 },
222 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_7300
, "NVIDIA GeForce Go 7300", DRIVER_NVIDIA_GEFORCE6
, 256 },
223 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_7400
, "NVIDIA GeForce Go 7400", DRIVER_NVIDIA_GEFORCE6
, 256 },
224 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_7600
, "NVIDIA GeForce 7600 GT", DRIVER_NVIDIA_GEFORCE6
, 256 },
225 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_7800GT
, "NVIDIA GeForce 7800 GT", DRIVER_NVIDIA_GEFORCE6
, 256 },
226 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_8200
, "NVIDIA GeForce 8200", DRIVER_NVIDIA_GEFORCE8
, 512 },
227 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_8300GS
, "NVIDIA GeForce 8300 GS", DRIVER_NVIDIA_GEFORCE8
, 128 },
228 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_8400GS
, "NVIDIA GeForce 8400 GS", DRIVER_NVIDIA_GEFORCE8
, 128 },
229 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_8500GT
, "NVIDIA GeForce 8500 GT", DRIVER_NVIDIA_GEFORCE8
, 256 },
230 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_8600GT
, "NVIDIA GeForce 8600 GT", DRIVER_NVIDIA_GEFORCE8
, 256 },
231 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_8600MGT
, "NVIDIA GeForce 8600M GT", DRIVER_NVIDIA_GEFORCE8
, 512 },
232 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_8800GTS
, "NVIDIA GeForce 8800 GTS", DRIVER_NVIDIA_GEFORCE8
, 320 },
233 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_8800GTX
, "NVIDIA GeForce 8800 GTX", DRIVER_NVIDIA_GEFORCE8
, 768 },
234 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_9200
, "NVIDIA GeForce 9200", DRIVER_NVIDIA_GEFORCE8
, 256 },
235 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_9300
, "NVIDIA GeForce 9300", DRIVER_NVIDIA_GEFORCE8
, 256 },
236 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_9400M
, "NVIDIA GeForce 9400M", DRIVER_NVIDIA_GEFORCE8
, 256 },
237 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_9400GT
, "NVIDIA GeForce 9400 GT", DRIVER_NVIDIA_GEFORCE8
, 256 },
238 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_9500GT
, "NVIDIA GeForce 9500 GT", DRIVER_NVIDIA_GEFORCE8
, 256 },
239 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_9600GT
, "NVIDIA GeForce 9600 GT", DRIVER_NVIDIA_GEFORCE8
, 512 },
240 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_9700MGT
, "NVIDIA GeForce 9700M GT", DRIVER_NVIDIA_GEFORCE8
, 512 },
241 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_9800GT
, "NVIDIA GeForce 9800 GT", DRIVER_NVIDIA_GEFORCE8
, 512 },
242 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_210
, "NVIDIA GeForce 210", DRIVER_NVIDIA_GEFORCE8
, 512 },
243 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT220
, "NVIDIA GeForce GT 220", DRIVER_NVIDIA_GEFORCE8
, 512 },
244 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT240
, "NVIDIA GeForce GT 240", DRIVER_NVIDIA_GEFORCE8
, 512 },
245 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTS250
, "NVIDIA GeForce GTS 250", DRIVER_NVIDIA_GEFORCE8
, 1024},
246 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX260
, "NVIDIA GeForce GTX 260", DRIVER_NVIDIA_GEFORCE8
, 1024},
247 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX275
, "NVIDIA GeForce GTX 275", DRIVER_NVIDIA_GEFORCE8
, 896 },
248 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX280
, "NVIDIA GeForce GTX 280", DRIVER_NVIDIA_GEFORCE8
, 1024},
249 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_315M
, "NVIDIA GeForce 315M", DRIVER_NVIDIA_GEFORCE8
, 512 },
250 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_320M
, "NVIDIA GeForce 320M", DRIVER_NVIDIA_GEFORCE8
, 256},
251 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT320M
, "NVIDIA GeForce GT 320M", DRIVER_NVIDIA_GEFORCE8
, 1024},
252 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT325M
, "NVIDIA GeForce GT 325M", DRIVER_NVIDIA_GEFORCE8
, 1024},
253 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT330
, "NVIDIA GeForce GT 330", DRIVER_NVIDIA_GEFORCE8
, 1024},
254 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTS350M
, "NVIDIA GeForce GTS 350M", DRIVER_NVIDIA_GEFORCE8
, 1024},
255 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_410M
, "NVIDIA GeForce 410M", DRIVER_NVIDIA_GEFORCE8
, 512},
256 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT420
, "NVIDIA GeForce GT 420", DRIVER_NVIDIA_GEFORCE8
, 2048},
257 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT425M
, "NVIDIA GeForce GT 425M", DRIVER_NVIDIA_GEFORCE8
, 1024},
258 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT430
, "NVIDIA GeForce GT 430", DRIVER_NVIDIA_GEFORCE8
, 1024},
259 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT440
, "NVIDIA GeForce GT 440", DRIVER_NVIDIA_GEFORCE8
, 1024},
260 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTS450
, "NVIDIA GeForce GTS 450", DRIVER_NVIDIA_GEFORCE8
, 1024},
261 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX460
, "NVIDIA GeForce GTX 460", DRIVER_NVIDIA_GEFORCE8
, 768 },
262 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX460M
, "NVIDIA GeForce GTX 460M", DRIVER_NVIDIA_GEFORCE8
, 1536},
263 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX465
, "NVIDIA GeForce GTX 465", DRIVER_NVIDIA_GEFORCE8
, 1024},
264 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX470
, "NVIDIA GeForce GTX 470", DRIVER_NVIDIA_GEFORCE8
, 1280},
265 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX480
, "NVIDIA GeForce GTX 480", DRIVER_NVIDIA_GEFORCE8
, 1536},
266 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT520
, "NVIDIA GeForce GT 520", DRIVER_NVIDIA_GEFORCE8
, 1024},
267 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT525M
, "NVIDIA GeForce GT 525M", DRIVER_NVIDIA_GEFORCE8
, 1024},
268 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT540M
, "NVIDIA GeForce GT 540M", DRIVER_NVIDIA_GEFORCE8
, 1024},
269 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX550
, "NVIDIA GeForce GTX 550 Ti", DRIVER_NVIDIA_GEFORCE8
, 1024},
270 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT555M
, "NVIDIA GeForce GT 555M", DRIVER_NVIDIA_GEFORCE8
, 1024},
271 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX560TI
, "NVIDIA GeForce GTX 560 Ti", DRIVER_NVIDIA_GEFORCE8
, 1024},
272 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX560M
, "NVIDIA GeForce GTX 560M", DRIVER_NVIDIA_GEFORCE8
, 3072},
273 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX560
, "NVIDIA GeForce GTX 560", DRIVER_NVIDIA_GEFORCE8
, 1024},
274 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX570
, "NVIDIA GeForce GTX 570", DRIVER_NVIDIA_GEFORCE8
, 1280},
275 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX580
, "NVIDIA GeForce GTX 580", DRIVER_NVIDIA_GEFORCE8
, 1536},
276 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT610
, "NVIDIA GeForce GT 610", DRIVER_NVIDIA_GEFORCE8
, 1024},
277 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT630
, "NVIDIA GeForce GT 630", DRIVER_NVIDIA_GEFORCE8
, 1024},
278 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT630M
, "NVIDIA GeForce GT 630M", DRIVER_NVIDIA_GEFORCE8
, 1024},
279 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT640M
, "NVIDIA GeForce GT 640M", DRIVER_NVIDIA_GEFORCE8
, 1024},
280 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT650M
, "NVIDIA GeForce GT 650M", DRIVER_NVIDIA_GEFORCE8
, 2048},
281 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX650
, "NVIDIA GeForce GTX 650", DRIVER_NVIDIA_GEFORCE8
, 1024},
282 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX650TI
, "NVIDIA GeForce GTX 650 Ti", DRIVER_NVIDIA_GEFORCE8
, 1024},
283 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX660
, "NVIDIA GeForce GTX 660", DRIVER_NVIDIA_GEFORCE8
, 2048},
284 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX660M
, "NVIDIA GeForce GTX 660M", DRIVER_NVIDIA_GEFORCE8
, 2048},
285 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX660TI
, "NVIDIA GeForce GTX 660 Ti", DRIVER_NVIDIA_GEFORCE8
, 2048},
286 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX670
, "NVIDIA GeForce GTX 670", DRIVER_NVIDIA_GEFORCE8
, 2048},
287 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX670MX
, "NVIDIA GeForce GTX 670MX", DRIVER_NVIDIA_GEFORCE8
, 3072},
288 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX675MX
, "NVIDIA GeForce GTX 675MX", DRIVER_NVIDIA_GEFORCE8
, 4096},
289 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX680
, "NVIDIA GeForce GTX 680", DRIVER_NVIDIA_GEFORCE8
, 2048},
290 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX690
, "NVIDIA GeForce GTX 690", DRIVER_NVIDIA_GEFORCE8
, 2048},
291 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT720
, "NVIDIA GeForce GT 720", DRIVER_NVIDIA_GEFORCE8
, 2048},
292 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT730
, "NVIDIA GeForce GT 730", DRIVER_NVIDIA_GEFORCE8
, 2048},
293 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT730M
, "NVIDIA GeForce GT 730M", DRIVER_NVIDIA_GEFORCE8
, 1024},
294 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT740M
, "NVIDIA GeForce GT 740M", DRIVER_NVIDIA_GEFORCE8
, 2048},
295 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT750M
, "NVIDIA GeForce GT 750M", DRIVER_NVIDIA_GEFORCE8
, 1024},
296 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX750
, "NVIDIA GeForce GTX 750", DRIVER_NVIDIA_GEFORCE8
, 1024},
297 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX750TI
, "NVIDIA GeForce GTX 750 Ti", DRIVER_NVIDIA_GEFORCE8
, 2048},
298 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX760
, "NVIDIA GeForce GTX 760", DRIVER_NVIDIA_GEFORCE8
, 2048},
299 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX760TI
, "NVIDIA GeForce GTX 760 Ti", DRIVER_NVIDIA_GEFORCE8
, 2048},
300 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX765M
, "NVIDIA GeForce GTX 765M", DRIVER_NVIDIA_GEFORCE8
, 2048},
301 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX770M
, "NVIDIA GeForce GTX 770M", DRIVER_NVIDIA_GEFORCE8
, 3072},
302 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX770
, "NVIDIA GeForce GTX 770", DRIVER_NVIDIA_GEFORCE8
, 2048},
303 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX780
, "NVIDIA GeForce GTX 780", DRIVER_NVIDIA_GEFORCE8
, 3072},
304 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX780TI
, "NVIDIA GeForce GTX 780 Ti", DRIVER_NVIDIA_GEFORCE8
, 3072},
305 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTXTITAN
, "NVIDIA GeForce GTX TITAN", DRIVER_NVIDIA_GEFORCE8
, 6144},
306 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTXTITANB
, "NVIDIA GeForce GTX TITAN Black", DRIVER_NVIDIA_GEFORCE8
, 6144},
307 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTXTITANX
, "NVIDIA GeForce GTX TITAN X", DRIVER_NVIDIA_GEFORCE8
, 12288},
308 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTXTITANZ
, "NVIDIA GeForce GTX TITAN Z", DRIVER_NVIDIA_GEFORCE8
, 12288},
309 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_820M
, "NVIDIA GeForce 820M", DRIVER_NVIDIA_GEFORCE8
, 2048},
310 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_830M
, "NVIDIA GeForce 830M", DRIVER_NVIDIA_GEFORCE8
, 2048},
311 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_840M
, "NVIDIA GeForce 840M", DRIVER_NVIDIA_GEFORCE8
, 2048},
312 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_845M
, "NVIDIA GeForce 845M", DRIVER_NVIDIA_GEFORCE8
, 2048},
313 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX850M
, "NVIDIA GeForce GTX 850M", DRIVER_NVIDIA_GEFORCE8
, 2048},
314 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX860M
, "NVIDIA GeForce GTX 860M", DRIVER_NVIDIA_GEFORCE8
, 2048},
315 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX870M
, "NVIDIA GeForce GTX 870M", DRIVER_NVIDIA_GEFORCE8
, 3072},
316 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX880M
, "NVIDIA GeForce GTX 880M", DRIVER_NVIDIA_GEFORCE8
, 4096},
317 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_940M
, "NVIDIA GeForce 940M", DRIVER_NVIDIA_GEFORCE8
, 4096},
318 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX950
, "NVIDIA GeForce GTX 950", DRIVER_NVIDIA_GEFORCE8
, 2048},
319 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX950M
, "NVIDIA GeForce GTX 950M", DRIVER_NVIDIA_GEFORCE8
, 4096},
320 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX960
, "NVIDIA GeForce GTX 960", DRIVER_NVIDIA_GEFORCE8
, 4096},
321 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX960M
, "NVIDIA GeForce GTX 960M", DRIVER_NVIDIA_GEFORCE8
, 2048},
322 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX970
, "NVIDIA GeForce GTX 970", DRIVER_NVIDIA_GEFORCE8
, 4096},
323 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX970M
, "NVIDIA GeForce GTX 970M", DRIVER_NVIDIA_GEFORCE8
, 3072},
324 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX980
, "NVIDIA GeForce GTX 980", DRIVER_NVIDIA_GEFORCE8
, 4096},
325 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX980TI
, "NVIDIA GeForce GTX 980 Ti", DRIVER_NVIDIA_GEFORCE8
, 6144},
326 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX1050
, "NVIDIA GeForce GTX 1050", DRIVER_NVIDIA_GEFORCE8
, 2048},
327 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX1050TI
, "NVIDIA GeForce GTX 1050 Ti", DRIVER_NVIDIA_GEFORCE8
, 4096},
328 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX1060
, "NVIDIA GeForce GTX 1060", DRIVER_NVIDIA_GEFORCE8
, 6144},
329 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX1070
, "NVIDIA GeForce GTX 1070", DRIVER_NVIDIA_GEFORCE8
, 8192},
330 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX1080
, "NVIDIA GeForce GTX 1080", DRIVER_NVIDIA_GEFORCE8
, 8192},
331 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX1080TI
, "NVIDIA GeForce GTX 1080 Ti", DRIVER_NVIDIA_GEFORCE8
, 11264},
332 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_TITANX_PASCAL
, "NVIDIA TITAN X (Pascal)", DRIVER_NVIDIA_GEFORCE8
, 12288},
333 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_TITANV
, "NVIDIA TITAN V", DRIVER_NVIDIA_GEFORCE8
, 12288},
334 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_RTX2060
, "NVIDIA GeForce RTX 2060", DRIVER_NVIDIA_GEFORCE8
, 6144},
335 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_RTX2070
, "NVIDIA GeForce RTX 2070", DRIVER_NVIDIA_GEFORCE8
, 8192},
336 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_RTX2080
, "NVIDIA GeForce RTX 2080", DRIVER_NVIDIA_GEFORCE8
, 8192},
337 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_RTX2080TI
, "NVIDIA GeForce RTX 2080 Ti", DRIVER_NVIDIA_GEFORCE8
, 11264},
340 {HW_VENDOR_AMD
, CARD_AMD_RAGE_128PRO
, "ATI Rage Fury", DRIVER_AMD_RAGE_128PRO
, 16 },
341 {HW_VENDOR_AMD
, CARD_AMD_RADEON_7200
, "ATI RADEON 7200 SERIES", DRIVER_AMD_R100
, 32 },
342 {HW_VENDOR_AMD
, CARD_AMD_RADEON_8500
, "ATI RADEON 8500 SERIES", DRIVER_AMD_R100
, 64 },
343 {HW_VENDOR_AMD
, CARD_AMD_RADEON_9500
, "ATI Radeon 9500", DRIVER_AMD_R300
, 64 },
344 {HW_VENDOR_AMD
, CARD_AMD_RADEON_XPRESS_200M
, "ATI RADEON XPRESS 200M Series", DRIVER_AMD_R300
, 64 },
345 {HW_VENDOR_AMD
, CARD_AMD_RADEON_X700
, "ATI Radeon X700 SE", DRIVER_AMD_R300
, 128 },
346 {HW_VENDOR_AMD
, CARD_AMD_RADEON_X1600
, "ATI Radeon X1600 Series", DRIVER_AMD_R300
, 128 },
347 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD2350
, "ATI Mobility Radeon HD 2350", DRIVER_AMD_R600
, 256 },
348 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD2600
, "ATI Mobility Radeon HD 2600", DRIVER_AMD_R600
, 256 },
349 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD2900
, "ATI Radeon HD 2900 XT", DRIVER_AMD_R600
, 512 },
350 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD3200
, "ATI Radeon HD 3200 Graphics", DRIVER_AMD_R600
, 128 },
351 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD3850
, "ATI Radeon HD 3850 AGP", DRIVER_AMD_R600
, 512 },
352 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD4200M
, "ATI Mobility Radeon HD 4200", DRIVER_AMD_R600
, 256 },
353 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD4350
, "ATI Radeon HD 4350", DRIVER_AMD_R600
, 256 },
354 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD4600
, "ATI Radeon HD 4600 Series", DRIVER_AMD_R600
, 512 },
355 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD4700
, "ATI Radeon HD 4700 Series", DRIVER_AMD_R600
, 512 },
356 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD4800
, "ATI Radeon HD 4800 Series", DRIVER_AMD_R600
, 512 },
357 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD5400
, "ATI Radeon HD 5400 Series", DRIVER_AMD_R600
, 512 },
358 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD5600
, "ATI Radeon HD 5600 Series", DRIVER_AMD_R600
, 512 },
359 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD5700
, "ATI Radeon HD 5700 Series", DRIVER_AMD_R600
, 512 },
360 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD5800
, "ATI Radeon HD 5800 Series", DRIVER_AMD_R600
, 1024},
361 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD5900
, "ATI Radeon HD 5900 Series", DRIVER_AMD_R600
, 1024},
362 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD6300
, "AMD Radeon HD 6300 series Graphics", DRIVER_AMD_R600
, 1024},
363 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD6400
, "AMD Radeon HD 6400 Series", DRIVER_AMD_R600
, 1024},
364 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD6410D
, "AMD Radeon HD 6410D", DRIVER_AMD_R600
, 1024},
365 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD6480G
, "AMD Radeon HD 6480G", DRIVER_AMD_R600
, 512 },
366 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD6550D
, "AMD Radeon HD 6550D", DRIVER_AMD_R600
, 1024},
367 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD6600
, "AMD Radeon HD 6600 Series", DRIVER_AMD_R600
, 1024},
368 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD6600M
, "AMD Radeon HD 6600M Series", DRIVER_AMD_R600
, 512 },
369 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD6700
, "AMD Radeon HD 6700 Series", DRIVER_AMD_R600
, 1024},
370 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD6800
, "AMD Radeon HD 6800 Series", DRIVER_AMD_R600
, 1024},
371 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD6900
, "AMD Radeon HD 6900 Series", DRIVER_AMD_R600
, 2048},
372 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD7660D
, "AMD Radeon HD 7660D", DRIVER_AMD_R600
, 2048},
373 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD7700
, "AMD Radeon HD 7700 Series", DRIVER_AMD_R600
, 1024},
374 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD7800
, "AMD Radeon HD 7800 Series", DRIVER_AMD_R600
, 2048},
375 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD7900
, "AMD Radeon HD 7900 Series", DRIVER_AMD_R600
, 2048},
376 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD8600M
, "AMD Radeon HD 8600M Series", DRIVER_AMD_R600
, 1024},
377 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD8670
, "AMD Radeon HD 8670", DRIVER_AMD_R600
, 2048},
378 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD8770
, "AMD Radeon HD 8770", DRIVER_AMD_R600
, 2048},
379 {HW_VENDOR_AMD
, CARD_AMD_RADEON_R3
, "AMD Radeon HD 8400 / R3 Series", DRIVER_AMD_R600
, 2048},
380 {HW_VENDOR_AMD
, CARD_AMD_RADEON_R7
, "AMD Radeon(TM) R7 Graphics", DRIVER_AMD_R600
, 2048},
381 {HW_VENDOR_AMD
, CARD_AMD_RADEON_R9_285
, "AMD Radeon R9 285", DRIVER_AMD_RX
, 2048},
382 {HW_VENDOR_AMD
, CARD_AMD_RADEON_R9_290
, "AMD Radeon R9 290", DRIVER_AMD_RX
, 4096},
383 {HW_VENDOR_AMD
, CARD_AMD_RADEON_R9_FURY
, "AMD Radeon (TM) R9 Fury Series", DRIVER_AMD_RX
, 4096},
384 {HW_VENDOR_AMD
, CARD_AMD_RADEON_RX_460
, "Radeon(TM) RX 460 Graphics", DRIVER_AMD_RX
, 4096},
385 {HW_VENDOR_AMD
, CARD_AMD_RADEON_RX_480
, "Radeon (TM) RX 480 Graphics", DRIVER_AMD_RX
, 4096},
386 {HW_VENDOR_AMD
, CARD_AMD_RADEON_RX_VEGA
, "Radeon RX Vega", DRIVER_AMD_RX
, 8192},
389 {HW_VENDOR_REDHAT
, CARD_REDHAT_VIRGL
, "Red Hat VirtIO GPU", DRIVER_REDHAT_VIRGL
, 1024},
392 {HW_VENDOR_VMWARE
, CARD_VMWARE_SVGA3D
, "VMware SVGA 3D (Microsoft Corporation - WDDM)", DRIVER_VMWARE
, 1024},
395 {HW_VENDOR_INTEL
, CARD_INTEL_830M
, "Intel(R) 82830M Graphics Controller", DRIVER_INTEL_GMA800
, 32 },
396 {HW_VENDOR_INTEL
, CARD_INTEL_855GM
, "Intel(R) 82852/82855 GM/GME Graphics Controller", DRIVER_INTEL_GMA800
, 32 },
397 {HW_VENDOR_INTEL
, CARD_INTEL_845G
, "Intel(R) 845G", DRIVER_INTEL_GMA800
, 32 },
398 {HW_VENDOR_INTEL
, CARD_INTEL_865G
, "Intel(R) 82865G Graphics Controller", DRIVER_INTEL_GMA800
, 32 },
399 {HW_VENDOR_INTEL
, CARD_INTEL_915G
, "Intel(R) 82915G/GV/910GL Express Chipset Family", DRIVER_INTEL_GMA900
, 64 },
400 {HW_VENDOR_INTEL
, CARD_INTEL_E7221G
, "Intel(R) E7221G", DRIVER_INTEL_GMA900
, 64 },
401 {HW_VENDOR_INTEL
, CARD_INTEL_915GM
, "Mobile Intel(R) 915GM/GMS,910GML Express Chipset Family", DRIVER_INTEL_GMA900
, 64 },
402 {HW_VENDOR_INTEL
, CARD_INTEL_945G
, "Intel(R) 945G", DRIVER_INTEL_GMA950
, 64 },
403 {HW_VENDOR_INTEL
, CARD_INTEL_945GM
, "Mobile Intel(R) 945GM Express Chipset Family", DRIVER_INTEL_GMA950
, 64 },
404 {HW_VENDOR_INTEL
, CARD_INTEL_945GME
, "Intel(R) 945GME", DRIVER_INTEL_GMA950
, 64 },
405 {HW_VENDOR_INTEL
, CARD_INTEL_Q35
, "Intel(R) Q35", DRIVER_INTEL_GMA950
, 64 },
406 {HW_VENDOR_INTEL
, CARD_INTEL_G33
, "Intel(R) G33", DRIVER_INTEL_GMA950
, 64 },
407 {HW_VENDOR_INTEL
, CARD_INTEL_Q33
, "Intel(R) Q33", DRIVER_INTEL_GMA950
, 64 },
408 {HW_VENDOR_INTEL
, CARD_INTEL_PNVG
, "Intel(R) IGD", DRIVER_INTEL_GMA950
, 64 },
409 {HW_VENDOR_INTEL
, CARD_INTEL_PNVM
, "Intel(R) IGD", DRIVER_INTEL_GMA950
, 64 },
410 {HW_VENDOR_INTEL
, CARD_INTEL_965Q
, "Intel(R) 965Q", DRIVER_INTEL_GMA3000
, 128},
411 {HW_VENDOR_INTEL
, CARD_INTEL_965G
, "Intel(R) 965G", DRIVER_INTEL_GMA3000
, 128},
412 {HW_VENDOR_INTEL
, CARD_INTEL_946GZ
, "Intel(R) 946GZ", DRIVER_INTEL_GMA3000
, 128},
413 {HW_VENDOR_INTEL
, CARD_INTEL_965GM
, "Mobile Intel(R) 965 Express Chipset Family", DRIVER_INTEL_GMA3000
, 128},
414 {HW_VENDOR_INTEL
, CARD_INTEL_965GME
, "Intel(R) 965GME", DRIVER_INTEL_GMA3000
, 128},
415 {HW_VENDOR_INTEL
, CARD_INTEL_GM45
, "Mobile Intel(R) GM45 Express Chipset Family", DRIVER_INTEL_GMA3000
, 512},
416 {HW_VENDOR_INTEL
, CARD_INTEL_IGD
, "Intel(R) Integrated Graphics Device", DRIVER_INTEL_GMA3000
, 512},
417 {HW_VENDOR_INTEL
, CARD_INTEL_G45
, "Intel(R) G45/G43", DRIVER_INTEL_GMA3000
, 512},
418 {HW_VENDOR_INTEL
, CARD_INTEL_Q45
, "Intel(R) Q45/Q43", DRIVER_INTEL_GMA3000
, 512},
419 {HW_VENDOR_INTEL
, CARD_INTEL_G41
, "Intel(R) G41", DRIVER_INTEL_GMA3000
, 512},
420 {HW_VENDOR_INTEL
, CARD_INTEL_B43
, "Intel(R) B43", DRIVER_INTEL_GMA3000
, 512},
421 {HW_VENDOR_INTEL
, CARD_INTEL_ILKD
, "Intel(R) HD Graphics", DRIVER_INTEL_GMA3000
, 1536},
422 {HW_VENDOR_INTEL
, CARD_INTEL_ILKM
, "Intel(R) HD Graphics", DRIVER_INTEL_GMA3000
, 1536},
423 {HW_VENDOR_INTEL
, CARD_INTEL_SNBD
, "Intel(R) HD Graphics 3000", DRIVER_INTEL_GMA3000
, 1536},
424 {HW_VENDOR_INTEL
, CARD_INTEL_SNBM
, "Intel(R) HD Graphics 3000", DRIVER_INTEL_GMA3000
, 1536},
425 {HW_VENDOR_INTEL
, CARD_INTEL_SNBS
, "Intel(R) HD Graphics Family", DRIVER_INTEL_GMA3000
, 1536},
426 {HW_VENDOR_INTEL
, CARD_INTEL_IVBD
, "Intel(R) HD Graphics 4000", DRIVER_INTEL_HD4000
, 1536},
427 {HW_VENDOR_INTEL
, CARD_INTEL_IVBM
, "Intel(R) HD Graphics 4000", DRIVER_INTEL_HD4000
, 1536},
428 {HW_VENDOR_INTEL
, CARD_INTEL_IVBS
, "Intel(R) HD Graphics Family", DRIVER_INTEL_HD4000
, 1536},
429 {HW_VENDOR_INTEL
, CARD_INTEL_HWD
, "Intel(R) HD Graphics 4600", DRIVER_INTEL_HD4000
, 1536},
430 {HW_VENDOR_INTEL
, CARD_INTEL_HWM
, "Intel(R) HD Graphics 4600", DRIVER_INTEL_HD4000
, 1536},
431 {HW_VENDOR_INTEL
, CARD_INTEL_HD5000
, "Intel(R) HD Graphics 5000", DRIVER_INTEL_HD4000
, 1536},
432 {HW_VENDOR_INTEL
, CARD_INTEL_I5100_1
, "Intel(R) Iris(TM) Graphics 5100", DRIVER_INTEL_HD4000
, 1536},
433 {HW_VENDOR_INTEL
, CARD_INTEL_I5100_2
, "Intel(R) Iris(TM) Graphics 5100", DRIVER_INTEL_HD4000
, 1536},
434 {HW_VENDOR_INTEL
, CARD_INTEL_I5100_3
, "Intel(R) Iris(TM) Graphics 5100", DRIVER_INTEL_HD4000
, 1536},
435 {HW_VENDOR_INTEL
, CARD_INTEL_I5100_4
, "Intel(R) Iris(TM) Graphics 5100", DRIVER_INTEL_HD4000
, 1536},
436 {HW_VENDOR_INTEL
, CARD_INTEL_IP5200_1
, "Intel(R) Iris(TM) Pro Graphics 5200", DRIVER_INTEL_HD4000
, 1536},
437 {HW_VENDOR_INTEL
, CARD_INTEL_IP5200_2
, "Intel(R) Iris(TM) Pro Graphics 5200", DRIVER_INTEL_HD4000
, 1536},
438 {HW_VENDOR_INTEL
, CARD_INTEL_IP5200_3
, "Intel(R) Iris(TM) Pro Graphics 5200", DRIVER_INTEL_HD4000
, 1536},
439 {HW_VENDOR_INTEL
, CARD_INTEL_IP5200_4
, "Intel(R) Iris(TM) Pro Graphics 5200", DRIVER_INTEL_HD4000
, 1536},
440 {HW_VENDOR_INTEL
, CARD_INTEL_IP5200_5
, "Intel(R) Iris(TM) Pro Graphics 5200", DRIVER_INTEL_HD4000
, 1536},
441 {HW_VENDOR_INTEL
, CARD_INTEL_HD5300
, "Intel(R) HD Graphics 5300", DRIVER_INTEL_HD4000
, 2048},
442 {HW_VENDOR_INTEL
, CARD_INTEL_HD5500
, "Intel(R) HD Graphics 5500", DRIVER_INTEL_HD4000
, 2048},
443 {HW_VENDOR_INTEL
, CARD_INTEL_HD5600
, "Intel(R) HD Graphics 5600", DRIVER_INTEL_HD4000
, 2048},
444 {HW_VENDOR_INTEL
, CARD_INTEL_HD6000
, "Intel(R) HD Graphics 6000", DRIVER_INTEL_HD4000
, 2048},
445 {HW_VENDOR_INTEL
, CARD_INTEL_I6100
, "Intel(R) Iris(TM) Graphics 6100", DRIVER_INTEL_HD4000
, 2048},
446 {HW_VENDOR_INTEL
, CARD_INTEL_IP6200
, "Intel(R) Iris(TM) Pro Graphics 6200", DRIVER_INTEL_HD4000
, 2048},
447 {HW_VENDOR_INTEL
, CARD_INTEL_IPP6300
, "Intel(R) Iris(TM) Pro Graphics P6300", DRIVER_INTEL_HD4000
, 2048},
448 {HW_VENDOR_INTEL
, CARD_INTEL_HD510_1
, "Intel(R) HD Graphics 510", DRIVER_INTEL_HD4000
, 2048},
449 {HW_VENDOR_INTEL
, CARD_INTEL_HD510_2
, "Intel(R) HD Graphics 510", DRIVER_INTEL_HD4000
, 2048},
450 {HW_VENDOR_INTEL
, CARD_INTEL_HD510_3
, "Intel(R) HD Graphics 510", DRIVER_INTEL_HD4000
, 2048},
451 {HW_VENDOR_INTEL
, CARD_INTEL_HD515
, "Intel(R) HD Graphics 515", DRIVER_INTEL_HD4000
, 2048},
452 {HW_VENDOR_INTEL
, CARD_INTEL_HD520_1
, "Intel(R) HD Graphics 520", DRIVER_INTEL_HD4000
, 2048},
453 {HW_VENDOR_INTEL
, CARD_INTEL_HD520_2
, "Intel(R) HD Graphics 520", DRIVER_INTEL_HD4000
, 2048},
454 {HW_VENDOR_INTEL
, CARD_INTEL_HD530_1
, "Intel(R) HD Graphics 530", DRIVER_INTEL_HD4000
, 2048},
455 {HW_VENDOR_INTEL
, CARD_INTEL_HD530_2
, "Intel(R) HD Graphics 530", DRIVER_INTEL_HD4000
, 2048},
456 {HW_VENDOR_INTEL
, CARD_INTEL_HDP530
, "Intel(R) HD Graphics P530", DRIVER_INTEL_HD4000
, 2048},
457 {HW_VENDOR_INTEL
, CARD_INTEL_I540
, "Intel(R) Iris(TM) Graphics 540", DRIVER_INTEL_HD4000
, 2048},
458 {HW_VENDOR_INTEL
, CARD_INTEL_I550
, "Intel(R) Iris(TM) Graphics 550", DRIVER_INTEL_HD4000
, 2048},
459 {HW_VENDOR_INTEL
, CARD_INTEL_I555
, "Intel(R) Iris(TM) Graphics 555", DRIVER_INTEL_HD4000
, 2048},
460 {HW_VENDOR_INTEL
, CARD_INTEL_IP555
, "Intel(R) Iris(TM) Graphics P555", DRIVER_INTEL_HD4000
, 2048},
461 {HW_VENDOR_INTEL
, CARD_INTEL_IP580_1
, "Intel(R) Iris(TM) Pro Graphics 580", DRIVER_INTEL_HD4000
, 2048},
462 {HW_VENDOR_INTEL
, CARD_INTEL_IP580_2
, "Intel(R) Iris(TM) Pro Graphics 580", DRIVER_INTEL_HD4000
, 2048},
463 {HW_VENDOR_INTEL
, CARD_INTEL_IPP580_1
, "Intel(R) Iris(TM) Pro Graphics P580", DRIVER_INTEL_HD4000
, 2048},
464 {HW_VENDOR_INTEL
, CARD_INTEL_IPP580_2
, "Intel(R) Iris(TM) Pro Graphics P580", DRIVER_INTEL_HD4000
, 2048},
465 {HW_VENDOR_INTEL
, CARD_INTEL_HD620
, "Intel(R) HD Graphics 620", DRIVER_INTEL_HD4000
, 3072},
466 {HW_VENDOR_INTEL
, CARD_INTEL_HD630
, "Intel(R) HD Graphics 630", DRIVER_INTEL_HD4000
, 3072},
469 static const struct driver_version_information
*get_driver_version_info(enum wined3d_display_driver driver
,
470 enum wined3d_driver_model driver_model
)
474 TRACE("Looking up version info for driver %#x, driver_model %#x.\n", driver
, driver_model
);
476 for (i
= 0; i
< ARRAY_SIZE(driver_version_table
); ++i
)
478 const struct driver_version_information
*entry
= &driver_version_table
[i
];
480 if (entry
->driver
== driver
&& (driver_model
== DRIVER_MODEL_GENERIC
481 || entry
->driver_model
== driver_model
))
483 TRACE("Found driver \"%s\", version %u, subversion %u, build %u.\n",
484 entry
->driver_name
, entry
->version
, entry
->subversion
, entry
->build
);
491 const struct wined3d_gpu_description
*wined3d_get_gpu_description(enum wined3d_pci_vendor vendor
,
492 enum wined3d_pci_device device
)
496 for (i
= 0; i
< ARRAY_SIZE(gpu_description_table
); ++i
)
498 if (vendor
== gpu_description_table
[i
].vendor
&& device
== gpu_description_table
[i
].device
)
499 return &gpu_description_table
[i
];
505 const struct wined3d_gpu_description
*wined3d_get_user_override_gpu_description(enum wined3d_pci_vendor vendor
,
506 enum wined3d_pci_device device
)
508 const struct wined3d_gpu_description
*gpu_desc
;
509 static unsigned int once
;
511 if (wined3d_settings
.pci_vendor_id
== PCI_VENDOR_NONE
&& wined3d_settings
.pci_device_id
== PCI_DEVICE_NONE
)
514 if (wined3d_settings
.pci_vendor_id
!= PCI_VENDOR_NONE
)
516 vendor
= wined3d_settings
.pci_vendor_id
;
517 TRACE("Overriding vendor PCI ID with 0x%04x.\n", vendor
);
519 if (wined3d_settings
.pci_device_id
!= PCI_DEVICE_NONE
)
521 device
= wined3d_settings
.pci_device_id
;
522 TRACE("Overriding device PCI ID with 0x%04x.\n", device
);
525 if (!(gpu_desc
= wined3d_get_gpu_description(vendor
, device
)) && !once
++)
526 ERR_(winediag
)("Invalid GPU override %04x:%04x specified, ignoring.\n", vendor
, device
);
531 void wined3d_driver_info_init(struct wined3d_driver_info
*driver_info
,
532 const struct wined3d_gpu_description
*gpu_desc
, UINT64 vram_bytes
)
534 const struct driver_version_information
*version_info
;
535 enum wined3d_driver_model driver_model
;
536 enum wined3d_display_driver driver
;
537 MEMORYSTATUSEX memory_status
;
538 OSVERSIONINFOW os_version
;
539 WORD driver_os_version
;
541 memset(&os_version
, 0, sizeof(os_version
));
542 os_version
.dwOSVersionInfoSize
= sizeof(os_version
);
543 if (!GetVersionExW(&os_version
))
545 ERR("Failed to get OS version, reporting 2000/XP.\n");
546 driver_os_version
= 6;
547 driver_model
= DRIVER_MODEL_NT5X
;
551 TRACE("OS version %u.%u.\n", os_version
.dwMajorVersion
, os_version
.dwMinorVersion
);
552 switch (os_version
.dwMajorVersion
)
555 /* If needed we could distinguish between 9x and NT4, but this code won't make
556 * sense for NT4 since it had no way to obtain this info through DirectDraw 3.0.
558 driver_os_version
= 4;
559 driver_model
= DRIVER_MODEL_WIN9X
;
563 driver_os_version
= 6;
564 driver_model
= DRIVER_MODEL_NT5X
;
568 if (os_version
.dwMinorVersion
== 0)
570 driver_os_version
= 7;
571 driver_model
= DRIVER_MODEL_NT6X
;
573 else if (os_version
.dwMinorVersion
== 1)
575 driver_os_version
= 8;
576 driver_model
= DRIVER_MODEL_NT6X
;
580 if (os_version
.dwMinorVersion
> 2)
582 FIXME("Unhandled OS version %u.%u, reporting Win 8.\n",
583 os_version
.dwMajorVersion
, os_version
.dwMinorVersion
);
585 driver_os_version
= 9;
586 driver_model
= DRIVER_MODEL_NT6X
;
591 driver_os_version
= 10;
592 driver_model
= DRIVER_MODEL_NT6X
;
596 FIXME("Unhandled OS version %u.%u, reporting 2000/XP.\n",
597 os_version
.dwMajorVersion
, os_version
.dwMinorVersion
);
598 driver_os_version
= 6;
599 driver_model
= DRIVER_MODEL_NT5X
;
604 driver_info
->vendor
= gpu_desc
->vendor
;
605 driver_info
->device
= gpu_desc
->device
;
606 driver_info
->description
= gpu_desc
->description
;
607 driver_info
->vram_bytes
= vram_bytes
? vram_bytes
: (UINT64
)gpu_desc
->vidmem
* 1024 * 1024;
608 driver
= gpu_desc
->driver
;
610 if (wined3d_settings
.emulated_textureram
)
612 driver_info
->vram_bytes
= wined3d_settings
.emulated_textureram
;
613 TRACE("Overriding amount of video memory with 0x%s bytes.\n",
614 wine_dbgstr_longlong(driver_info
->vram_bytes
));
618 * Diablo 2 crashes when the amount of video memory is greater than 0x7fffffff.
619 * In order to avoid this application bug we limit the amount of video memory
620 * to LONG_MAX for older Windows versions.
622 if (driver_model
< DRIVER_MODEL_NT6X
&& driver_info
->vram_bytes
> LONG_MAX
)
624 TRACE("Limiting amount of video memory to %#lx bytes for OS version older than Vista.\n", LONG_MAX
);
625 driver_info
->vram_bytes
= LONG_MAX
;
628 driver_info
->sysmem_bytes
= 64 * 1024 * 1024;
629 memory_status
.dwLength
= sizeof(memory_status
);
630 if (GlobalMemoryStatusEx(&memory_status
))
631 driver_info
->sysmem_bytes
= max(memory_status
.ullTotalPhys
/ 2, driver_info
->sysmem_bytes
);
633 ERR("Failed to get global memory status.\n");
635 /* Try to obtain driver version information for the current Windows version. This fails in
637 * - the gpu is not available on the currently selected OS version:
638 * - Geforce GTX480 on Win98. When running applications in compatibility mode on Windows,
639 * version information for the current Windows version is returned instead of faked info.
640 * We do the same and assume the default Windows version to emulate is WinXP.
642 * - Videocard is a Riva TNT but winver is set to win7 (there are no drivers for this beast)
643 * For now return the XP driver info. Perhaps later on we should return VESA.
645 * - the gpu is not in our database (can happen when the user overrides the vendor_id / device_id)
646 * This could be an indication that our database is not up to date, so this should be fixed.
648 if ((version_info
= get_driver_version_info(driver
, driver_model
))
649 || (version_info
= get_driver_version_info(driver
, DRIVER_MODEL_GENERIC
)))
651 driver_info
->name
= version_info
->driver_name
;
652 driver_info
->version_high
= MAKEDWORD_VERSION(driver_os_version
, version_info
->version
);
653 driver_info
->version_low
= MAKEDWORD_VERSION(version_info
->subversion
, version_info
->build
);
657 ERR("No driver version info found for device %04x:%04x, driver model %#x.\n",
658 driver_info
->vendor
, driver_info
->device
, driver_model
);
659 driver_info
->name
= "Display";
660 driver_info
->version_high
= MAKEDWORD_VERSION(driver_os_version
, 15);
661 driver_info
->version_low
= MAKEDWORD_VERSION(8, 6); /* NVIDIA RIVA TNT, arbitrary */
665 enum wined3d_pci_device
wined3d_gpu_from_feature_level(enum wined3d_pci_vendor
*vendor
,
666 enum wined3d_feature_level feature_level
)
668 static const struct wined3d_fallback_card
670 enum wined3d_feature_level feature_level
;
671 enum wined3d_pci_device device_id
;
673 card_fallback_nvidia
[] =
675 {WINED3D_FEATURE_LEVEL_5
, CARD_NVIDIA_RIVA_128
},
676 {WINED3D_FEATURE_LEVEL_6
, CARD_NVIDIA_RIVA_TNT
},
677 {WINED3D_FEATURE_LEVEL_7
, CARD_NVIDIA_GEFORCE
},
678 {WINED3D_FEATURE_LEVEL_8
, CARD_NVIDIA_GEFORCE3
},
679 {WINED3D_FEATURE_LEVEL_9_SM2
, CARD_NVIDIA_GEFORCEFX_5800
},
680 {WINED3D_FEATURE_LEVEL_9_SM3
, CARD_NVIDIA_GEFORCE_6800
},
681 {WINED3D_FEATURE_LEVEL_10
, CARD_NVIDIA_GEFORCE_8800GTX
},
682 {WINED3D_FEATURE_LEVEL_11
, CARD_NVIDIA_GEFORCE_GTX470
},
683 {WINED3D_FEATURE_LEVEL_NONE
},
685 card_fallback_amd
[] =
687 {WINED3D_FEATURE_LEVEL_5
, CARD_AMD_RAGE_128PRO
},
688 {WINED3D_FEATURE_LEVEL_7
, CARD_AMD_RADEON_7200
},
689 {WINED3D_FEATURE_LEVEL_8
, CARD_AMD_RADEON_8500
},
690 {WINED3D_FEATURE_LEVEL_9_SM2
, CARD_AMD_RADEON_9500
},
691 {WINED3D_FEATURE_LEVEL_9_SM3
, CARD_AMD_RADEON_X1600
},
692 {WINED3D_FEATURE_LEVEL_10
, CARD_AMD_RADEON_HD2900
},
693 {WINED3D_FEATURE_LEVEL_11
, CARD_AMD_RADEON_HD5600
},
694 {WINED3D_FEATURE_LEVEL_NONE
},
696 card_fallback_intel
[] =
698 {WINED3D_FEATURE_LEVEL_5
, CARD_INTEL_845G
},
699 {WINED3D_FEATURE_LEVEL_8
, CARD_INTEL_915G
},
700 {WINED3D_FEATURE_LEVEL_9_SM3
, CARD_INTEL_945G
},
701 {WINED3D_FEATURE_LEVEL_10
, CARD_INTEL_G45
},
702 {WINED3D_FEATURE_LEVEL_11
, CARD_INTEL_IVBD
},
703 {WINED3D_FEATURE_LEVEL_NONE
},
708 enum wined3d_pci_vendor vendor
;
709 const struct wined3d_fallback_card
*cards
;
713 {HW_VENDOR_AMD
, card_fallback_amd
},
714 {HW_VENDOR_NVIDIA
, card_fallback_nvidia
},
715 {HW_VENDOR_VMWARE
, card_fallback_amd
},
716 {HW_VENDOR_INTEL
, card_fallback_intel
},
719 const struct wined3d_fallback_card
*cards
;
720 enum wined3d_pci_device device_id
;
724 for (i
= 0; i
< ARRAY_SIZE(fallbacks
); ++i
)
726 if (*vendor
== fallbacks
[i
].vendor
)
727 cards
= fallbacks
[i
].cards
;
731 *vendor
= HW_VENDOR_NVIDIA
;
732 cards
= card_fallback_nvidia
;
735 device_id
= cards
->device_id
;
736 for (i
= 0; cards
[i
].feature_level
; ++i
)
738 if (feature_level
>= cards
[i
].feature_level
)
739 device_id
= cards
[i
].device_id
;
744 UINT CDECL
wined3d_get_adapter_count(const struct wined3d
*wined3d
)
746 TRACE("wined3d %p, reporting %u adapters.\n",
747 wined3d
, wined3d
->adapter_count
);
749 return wined3d
->adapter_count
;
752 HRESULT CDECL
wined3d_register_software_device(struct wined3d
*wined3d
, void *init_function
)
754 FIXME("wined3d %p, init_function %p stub!\n", wined3d
, init_function
);
759 HRESULT CDECL
wined3d_get_output_desc(const struct wined3d
*wined3d
, unsigned int adapter_idx
,
760 struct wined3d_output_desc
*desc
)
762 enum wined3d_display_rotation rotation
;
763 const struct wined3d_adapter
*adapter
;
764 struct wined3d_display_mode mode
;
768 TRACE("wined3d %p, adapter_idx %u, desc %p.\n", wined3d
, adapter_idx
, desc
);
770 if (adapter_idx
>= wined3d
->adapter_count
)
771 return WINED3DERR_INVALIDCALL
;
773 adapter
= wined3d
->adapters
[adapter_idx
];
774 if (!(monitor
= MonitorFromPoint(adapter
->monitor_position
, MONITOR_DEFAULTTOPRIMARY
)))
775 return WINED3DERR_INVALIDCALL
;
777 if (FAILED(hr
= wined3d_get_adapter_display_mode(wined3d
, adapter_idx
, &mode
, &rotation
)))
780 memcpy(desc
->device_name
, adapter
->device_name
, sizeof(desc
->device_name
));
781 SetRect(&desc
->desktop_rect
, 0, 0, mode
.width
, mode
.height
);
782 OffsetRect(&desc
->desktop_rect
, adapter
->monitor_position
.x
, adapter
->monitor_position
.y
);
783 /* FIXME: We should get this from EnumDisplayDevices() when the adapters
785 desc
->attached_to_desktop
= TRUE
;
786 desc
->rotation
= rotation
;
787 desc
->monitor
= monitor
;
792 /* FIXME: GetAdapterModeCount and EnumAdapterModes currently only returns modes
793 of the same bpp but different resolutions */
795 /* Note: dx9 supplies a format. Calls from d3d8 supply WINED3DFMT_UNKNOWN */
796 UINT CDECL
wined3d_get_adapter_mode_count(const struct wined3d
*wined3d
, UINT adapter_idx
,
797 enum wined3d_format_id format_id
, enum wined3d_scanline_ordering scanline_ordering
)
799 const struct wined3d_adapter
*adapter
;
800 const struct wined3d_format
*format
;
806 TRACE("wined3d %p, adapter_idx %u, format %s, scanline_ordering %#x.\n",
807 wined3d
, adapter_idx
, debug_d3dformat(format_id
), scanline_ordering
);
809 if (adapter_idx
>= wined3d
->adapter_count
)
812 adapter
= wined3d
->adapters
[adapter_idx
];
813 format
= wined3d_get_format(adapter
, format_id
, WINED3D_BIND_RENDER_TARGET
);
814 format_bits
= format
->byte_count
* CHAR_BIT
;
816 memset(&mode
, 0, sizeof(mode
));
817 mode
.dmSize
= sizeof(mode
);
819 while (EnumDisplaySettingsExW(adapter
->device_name
, j
++, &mode
, 0))
821 if (mode
.dmFields
& DM_DISPLAYFLAGS
)
823 if (scanline_ordering
== WINED3D_SCANLINE_ORDERING_PROGRESSIVE
824 && (mode
.u2
.dmDisplayFlags
& DM_INTERLACED
))
827 if (scanline_ordering
== WINED3D_SCANLINE_ORDERING_INTERLACED
828 && !(mode
.u2
.dmDisplayFlags
& DM_INTERLACED
))
832 if (format_id
== WINED3DFMT_UNKNOWN
)
834 /* This is for d3d8, do not enumerate P8 here. */
835 if (mode
.dmBitsPerPel
== 32 || mode
.dmBitsPerPel
== 16) ++i
;
837 else if (mode
.dmBitsPerPel
== format_bits
)
843 TRACE("Returning %u matching modes (out of %u total) for adapter %u.\n", i
, j
, adapter_idx
);
848 /* Note: dx9 supplies a format. Calls from d3d8 supply WINED3DFMT_UNKNOWN */
849 HRESULT CDECL
wined3d_enum_adapter_modes(const struct wined3d
*wined3d
, UINT adapter_idx
,
850 enum wined3d_format_id format_id
, enum wined3d_scanline_ordering scanline_ordering
,
851 UINT mode_idx
, struct wined3d_display_mode
*mode
)
853 const struct wined3d_adapter
*adapter
;
854 const struct wined3d_format
*format
;
860 TRACE("wined3d %p, adapter_idx %u, format %s, scanline_ordering %#x, mode_idx %u, mode %p.\n",
861 wined3d
, adapter_idx
, debug_d3dformat(format_id
), scanline_ordering
, mode_idx
, mode
);
863 if (!mode
|| adapter_idx
>= wined3d
->adapter_count
)
864 return WINED3DERR_INVALIDCALL
;
866 adapter
= wined3d
->adapters
[adapter_idx
];
867 format
= wined3d_get_format(adapter
, format_id
, WINED3D_BIND_RENDER_TARGET
);
868 format_bits
= format
->byte_count
* CHAR_BIT
;
870 memset(&m
, 0, sizeof(m
));
871 m
.dmSize
= sizeof(m
);
873 while (i
<= mode_idx
)
875 if (!EnumDisplaySettingsExW(adapter
->device_name
, j
++, &m
, 0))
877 WARN("Invalid mode_idx %u.\n", mode_idx
);
878 return WINED3DERR_INVALIDCALL
;
881 if (m
.dmFields
& DM_DISPLAYFLAGS
)
883 if (scanline_ordering
== WINED3D_SCANLINE_ORDERING_PROGRESSIVE
884 && (m
.u2
.dmDisplayFlags
& DM_INTERLACED
))
887 if (scanline_ordering
== WINED3D_SCANLINE_ORDERING_INTERLACED
888 && !(m
.u2
.dmDisplayFlags
& DM_INTERLACED
))
892 if (format_id
== WINED3DFMT_UNKNOWN
)
894 /* This is for d3d8, do not enumerate P8 here. */
895 if (m
.dmBitsPerPel
== 32 || m
.dmBitsPerPel
== 16) ++i
;
897 else if (m
.dmBitsPerPel
== format_bits
)
903 mode
->width
= m
.dmPelsWidth
;
904 mode
->height
= m
.dmPelsHeight
;
905 mode
->refresh_rate
= DEFAULT_REFRESH_RATE
;
906 if (m
.dmFields
& DM_DISPLAYFREQUENCY
)
907 mode
->refresh_rate
= m
.dmDisplayFrequency
;
909 if (format_id
== WINED3DFMT_UNKNOWN
)
910 mode
->format_id
= pixelformat_for_depth(m
.dmBitsPerPel
);
912 mode
->format_id
= format_id
;
914 if (!(m
.dmFields
& DM_DISPLAYFLAGS
))
915 mode
->scanline_ordering
= WINED3D_SCANLINE_ORDERING_UNKNOWN
;
916 else if (m
.u2
.dmDisplayFlags
& DM_INTERLACED
)
917 mode
->scanline_ordering
= WINED3D_SCANLINE_ORDERING_INTERLACED
;
919 mode
->scanline_ordering
= WINED3D_SCANLINE_ORDERING_PROGRESSIVE
;
921 TRACE("%ux%u@%u %u bpp, %s %#x.\n", mode
->width
, mode
->height
, mode
->refresh_rate
,
922 m
.dmBitsPerPel
, debug_d3dformat(mode
->format_id
), mode
->scanline_ordering
);
927 HRESULT CDECL
wined3d_find_closest_matching_adapter_mode(const struct wined3d
*wined3d
,
928 unsigned int adapter_idx
, struct wined3d_display_mode
*mode
)
930 unsigned int i
, j
, mode_count
, matching_mode_count
, closest
;
931 struct wined3d_display_mode
**matching_modes
;
932 struct wined3d_display_mode
*modes
;
935 TRACE("wined3d %p, adapter_idx %u, mode %p.\n", wined3d
, adapter_idx
, mode
);
937 if (!(mode_count
= wined3d_get_adapter_mode_count(wined3d
, adapter_idx
,
938 mode
->format_id
, WINED3D_SCANLINE_ORDERING_UNKNOWN
)))
940 WARN("Adapter has 0 matching modes.\n");
944 if (!(modes
= heap_calloc(mode_count
, sizeof(*modes
))))
945 return E_OUTOFMEMORY
;
946 if (!(matching_modes
= heap_calloc(mode_count
, sizeof(*matching_modes
))))
949 return E_OUTOFMEMORY
;
952 for (i
= 0; i
< mode_count
; ++i
)
954 if (FAILED(hr
= wined3d_enum_adapter_modes(wined3d
, adapter_idx
,
955 mode
->format_id
, WINED3D_SCANLINE_ORDERING_UNKNOWN
, i
, &modes
[i
])))
957 heap_free(matching_modes
);
961 matching_modes
[i
] = &modes
[i
];
964 matching_mode_count
= mode_count
;
966 if (mode
->scanline_ordering
!= WINED3D_SCANLINE_ORDERING_UNKNOWN
)
968 for (i
= 0, j
= 0; i
< matching_mode_count
; ++i
)
970 if (matching_modes
[i
]->scanline_ordering
== mode
->scanline_ordering
)
971 matching_modes
[j
++] = matching_modes
[i
];
974 matching_mode_count
= j
;
977 if (mode
->refresh_rate
)
979 for (i
= 0, j
= 0; i
< matching_mode_count
; ++i
)
981 if (matching_modes
[i
]->refresh_rate
== mode
->refresh_rate
)
982 matching_modes
[j
++] = matching_modes
[i
];
985 matching_mode_count
= j
;
988 if (!mode
->width
|| !mode
->height
)
990 struct wined3d_display_mode current_mode
;
991 if (FAILED(hr
= wined3d_get_adapter_display_mode(wined3d
, adapter_idx
,
992 ¤t_mode
, NULL
)))
994 heap_free(matching_modes
);
998 mode
->width
= current_mode
.width
;
999 mode
->height
= current_mode
.height
;
1003 for (i
= 0, j
= 0; i
< matching_mode_count
; ++i
)
1005 unsigned int d
= abs(mode
->width
- matching_modes
[i
]->width
)
1006 + abs(mode
->height
- matching_modes
[i
]->height
);
1015 *mode
= *matching_modes
[j
];
1017 heap_free(matching_modes
);
1020 TRACE("Returning %ux%u@%u %s %#x.\n", mode
->width
, mode
->height
,
1021 mode
->refresh_rate
, debug_d3dformat(mode
->format_id
),
1022 mode
->scanline_ordering
);
1027 HRESULT CDECL
wined3d_get_adapter_display_mode(const struct wined3d
*wined3d
, UINT adapter_idx
,
1028 struct wined3d_display_mode
*mode
, enum wined3d_display_rotation
*rotation
)
1030 const struct wined3d_adapter
*adapter
;
1033 TRACE("wined3d %p, adapter_idx %u, display_mode %p, rotation %p.\n",
1034 wined3d
, adapter_idx
, mode
, rotation
);
1036 if (!mode
|| adapter_idx
>= wined3d
->adapter_count
)
1037 return WINED3DERR_INVALIDCALL
;
1039 adapter
= wined3d
->adapters
[adapter_idx
];
1041 memset(&m
, 0, sizeof(m
));
1042 m
.dmSize
= sizeof(m
);
1044 EnumDisplaySettingsExW(adapter
->device_name
, ENUM_CURRENT_SETTINGS
, &m
, 0);
1045 mode
->width
= m
.dmPelsWidth
;
1046 mode
->height
= m
.dmPelsHeight
;
1047 mode
->refresh_rate
= DEFAULT_REFRESH_RATE
;
1048 if (m
.dmFields
& DM_DISPLAYFREQUENCY
)
1049 mode
->refresh_rate
= m
.dmDisplayFrequency
;
1050 mode
->format_id
= pixelformat_for_depth(m
.dmBitsPerPel
);
1052 /* Lie about the format. X11 can't change the color depth, and some apps
1053 * are pretty angry if they SetDisplayMode from 24 to 16 bpp and find out
1054 * that GetDisplayMode still returns 24 bpp. This should probably be
1055 * handled in winex11 instead. */
1056 if (adapter
->screen_format
&& adapter
->screen_format
!= mode
->format_id
)
1058 WARN("Overriding format %s with stored format %s.\n",
1059 debug_d3dformat(mode
->format_id
),
1060 debug_d3dformat(adapter
->screen_format
));
1061 mode
->format_id
= adapter
->screen_format
;
1064 if (!(m
.dmFields
& DM_DISPLAYFLAGS
))
1065 mode
->scanline_ordering
= WINED3D_SCANLINE_ORDERING_UNKNOWN
;
1066 else if (m
.u2
.dmDisplayFlags
& DM_INTERLACED
)
1067 mode
->scanline_ordering
= WINED3D_SCANLINE_ORDERING_INTERLACED
;
1069 mode
->scanline_ordering
= WINED3D_SCANLINE_ORDERING_PROGRESSIVE
;
1073 switch (m
.u1
.s2
.dmDisplayOrientation
)
1076 *rotation
= WINED3D_DISPLAY_ROTATION_0
;
1079 *rotation
= WINED3D_DISPLAY_ROTATION_90
;
1082 *rotation
= WINED3D_DISPLAY_ROTATION_180
;
1085 *rotation
= WINED3D_DISPLAY_ROTATION_270
;
1088 FIXME("Unhandled display rotation %#x.\n", m
.u1
.s2
.dmDisplayOrientation
);
1089 *rotation
= WINED3D_DISPLAY_ROTATION_UNSPECIFIED
;
1094 TRACE("Returning %ux%u@%u %s %#x.\n", mode
->width
, mode
->height
,
1095 mode
->refresh_rate
, debug_d3dformat(mode
->format_id
),
1096 mode
->scanline_ordering
);
1100 HRESULT CDECL
wined3d_set_adapter_display_mode(struct wined3d
*wined3d
,
1101 UINT adapter_idx
, const struct wined3d_display_mode
*mode
)
1103 struct wined3d_adapter
*adapter
;
1104 DEVMODEW new_mode
, current_mode
;
1107 enum wined3d_format_id new_format_id
;
1109 TRACE("wined3d %p, adapter_idx %u, mode %p.\n", wined3d
, adapter_idx
, mode
);
1111 if (adapter_idx
>= wined3d
->adapter_count
)
1112 return WINED3DERR_INVALIDCALL
;
1113 adapter
= wined3d
->adapters
[adapter_idx
];
1115 memset(&new_mode
, 0, sizeof(new_mode
));
1116 new_mode
.dmSize
= sizeof(new_mode
);
1117 memset(¤t_mode
, 0, sizeof(current_mode
));
1118 current_mode
.dmSize
= sizeof(current_mode
);
1121 const struct wined3d_format
*format
;
1123 TRACE("mode %ux%u@%u %s %#x.\n", mode
->width
, mode
->height
, mode
->refresh_rate
,
1124 debug_d3dformat(mode
->format_id
), mode
->scanline_ordering
);
1126 format
= wined3d_get_format(adapter
, mode
->format_id
, WINED3D_BIND_RENDER_TARGET
);
1128 new_mode
.dmFields
= DM_BITSPERPEL
| DM_PELSWIDTH
| DM_PELSHEIGHT
;
1129 new_mode
.dmBitsPerPel
= format
->byte_count
* CHAR_BIT
;
1130 new_mode
.dmPelsWidth
= mode
->width
;
1131 new_mode
.dmPelsHeight
= mode
->height
;
1133 new_mode
.dmDisplayFrequency
= mode
->refresh_rate
;
1134 if (mode
->refresh_rate
)
1135 new_mode
.dmFields
|= DM_DISPLAYFREQUENCY
;
1137 if (mode
->scanline_ordering
!= WINED3D_SCANLINE_ORDERING_UNKNOWN
)
1139 new_mode
.dmFields
|= DM_DISPLAYFLAGS
;
1140 if (mode
->scanline_ordering
== WINED3D_SCANLINE_ORDERING_INTERLACED
)
1141 new_mode
.u2
.dmDisplayFlags
|= DM_INTERLACED
;
1143 new_format_id
= mode
->format_id
;
1147 if (!EnumDisplaySettingsW(adapter
->device_name
, ENUM_REGISTRY_SETTINGS
, &new_mode
))
1149 ERR("Failed to read mode from registry.\n");
1150 return WINED3DERR_NOTAVAILABLE
;
1152 new_format_id
= pixelformat_for_depth(new_mode
.dmBitsPerPel
);
1155 /* Only change the mode if necessary. */
1156 if (!EnumDisplaySettingsW(adapter
->device_name
, ENUM_CURRENT_SETTINGS
, ¤t_mode
))
1158 ERR("Failed to get current display mode.\n");
1160 else if (current_mode
.dmPelsWidth
== new_mode
.dmPelsWidth
1161 && current_mode
.dmPelsHeight
== new_mode
.dmPelsHeight
1162 && current_mode
.dmBitsPerPel
== new_mode
.dmBitsPerPel
1163 && (current_mode
.dmDisplayFrequency
== new_mode
.dmDisplayFrequency
1164 || !(new_mode
.dmFields
& DM_DISPLAYFREQUENCY
))
1165 && (current_mode
.u2
.dmDisplayFlags
== new_mode
.u2
.dmDisplayFlags
1166 || !(new_mode
.dmFields
& DM_DISPLAYFLAGS
)))
1168 TRACE("Skipping redundant mode setting call.\n");
1169 adapter
->screen_format
= new_format_id
;
1173 ret
= ChangeDisplaySettingsExW(adapter
->device_name
, &new_mode
, NULL
, CDS_FULLSCREEN
, NULL
);
1174 if (ret
!= DISP_CHANGE_SUCCESSFUL
)
1176 if (new_mode
.dmFields
& DM_DISPLAYFREQUENCY
)
1178 WARN("ChangeDisplaySettingsExW failed, trying without the refresh rate.\n");
1179 new_mode
.dmFields
&= ~DM_DISPLAYFREQUENCY
;
1180 new_mode
.dmDisplayFrequency
= 0;
1181 ret
= ChangeDisplaySettingsExW(adapter
->device_name
, &new_mode
, NULL
, CDS_FULLSCREEN
, NULL
);
1183 if (ret
!= DISP_CHANGE_SUCCESSFUL
)
1184 return WINED3DERR_NOTAVAILABLE
;
1187 /* Store the new values. */
1188 adapter
->screen_format
= new_format_id
;
1190 /* And finally clip mouse to our screen. */
1191 SetRect(&clip_rc
, 0, 0, new_mode
.dmPelsWidth
, new_mode
.dmPelsHeight
);
1192 ClipCursor(&clip_rc
);
1197 HRESULT CDECL
wined3d_get_adapter_identifier(const struct wined3d
*wined3d
,
1198 UINT adapter_idx
, DWORD flags
, struct wined3d_adapter_identifier
*identifier
)
1200 const struct wined3d_adapter
*adapter
;
1203 TRACE("wined3d %p, adapter_idx %u, flags %#x, identifier %p.\n",
1204 wined3d
, adapter_idx
, flags
, identifier
);
1206 wined3d_mutex_lock();
1208 if (adapter_idx
>= wined3d
->adapter_count
)
1211 adapter
= wined3d
->adapters
[adapter_idx
];
1213 if (identifier
->driver_size
)
1215 const char *name
= adapter
->driver_info
.name
;
1216 len
= min(strlen(name
), identifier
->driver_size
- 1);
1217 memcpy(identifier
->driver
, name
, len
);
1218 memset(&identifier
->driver
[len
], 0, identifier
->driver_size
- len
);
1221 if (identifier
->description_size
)
1223 const char *description
= adapter
->driver_info
.description
;
1224 len
= min(strlen(description
), identifier
->description_size
- 1);
1225 memcpy(identifier
->description
, description
, len
);
1226 memset(&identifier
->description
[len
], 0, identifier
->description_size
- len
);
1229 /* Note that d3d8 doesn't supply a device name. */
1230 if (identifier
->device_name_size
)
1232 if (!WideCharToMultiByte(CP_ACP
, 0, adapter
->device_name
, -1, identifier
->device_name
,
1233 identifier
->device_name_size
, NULL
, NULL
))
1235 ERR("Failed to convert device name, last error %#x.\n", GetLastError());
1240 identifier
->driver_version
.u
.HighPart
= adapter
->driver_info
.version_high
;
1241 identifier
->driver_version
.u
.LowPart
= adapter
->driver_info
.version_low
;
1242 identifier
->vendor_id
= adapter
->driver_info
.vendor
;
1243 identifier
->device_id
= adapter
->driver_info
.device
;
1244 identifier
->subsystem_id
= 0;
1245 identifier
->revision
= 0;
1246 identifier
->device_identifier
= IID_D3DDEVICE_D3DUID
;
1247 identifier
->driver_uuid
= adapter
->driver_uuid
;
1248 identifier
->device_uuid
= adapter
->device_uuid
;
1249 identifier
->whql_level
= (flags
& WINED3DENUM_NO_WHQL_LEVEL
) ? 0 : 1;
1250 identifier
->adapter_luid
= adapter
->luid
;
1251 identifier
->video_memory
= min(~(SIZE_T
)0, adapter
->driver_info
.vram_bytes
);
1252 identifier
->shared_system_memory
= min(~(SIZE_T
)0, adapter
->driver_info
.sysmem_bytes
);
1254 wined3d_mutex_unlock();
1259 wined3d_mutex_unlock();
1260 return WINED3DERR_INVALIDCALL
;
1263 HRESULT CDECL
wined3d_get_adapter_raster_status(const struct wined3d
*wined3d
, UINT adapter_idx
,
1264 struct wined3d_raster_status
*raster_status
)
1266 LONGLONG freq_per_frame
, freq_per_line
;
1267 LARGE_INTEGER counter
, freq_per_sec
;
1268 struct wined3d_display_mode mode
;
1272 FIXME("wined3d %p, adapter_idx %u, raster_status %p semi-stub!\n",
1273 wined3d
, adapter_idx
, raster_status
);
1275 WARN("wined3d %p, adapter_idx %u, raster_status %p semi-stub!\n",
1276 wined3d
, adapter_idx
, raster_status
);
1278 /* Obtaining the raster status is a widely implemented but optional
1279 * feature. When this method returns OK StarCraft 2 expects the
1280 * raster_status->InVBlank value to actually change over time.
1281 * And Endless Alice Crysis doesn't care even if this method fails.
1282 * Thus this method returns OK and fakes raster_status by
1283 * QueryPerformanceCounter. */
1285 if (!QueryPerformanceCounter(&counter
) || !QueryPerformanceFrequency(&freq_per_sec
))
1286 return WINED3DERR_INVALIDCALL
;
1287 if (FAILED(wined3d_get_adapter_display_mode(wined3d
, adapter_idx
, &mode
, NULL
)))
1288 return WINED3DERR_INVALIDCALL
;
1289 if (mode
.refresh_rate
== DEFAULT_REFRESH_RATE
)
1290 mode
.refresh_rate
= 60;
1292 freq_per_frame
= freq_per_sec
.QuadPart
/ mode
.refresh_rate
;
1293 /* Assume 20 scan lines in the vertical blank. */
1294 freq_per_line
= freq_per_frame
/ (mode
.height
+ 20);
1295 raster_status
->scan_line
= (counter
.QuadPart
% freq_per_frame
) / freq_per_line
;
1296 if (raster_status
->scan_line
< mode
.height
)
1297 raster_status
->in_vblank
= FALSE
;
1300 raster_status
->scan_line
= 0;
1301 raster_status
->in_vblank
= TRUE
;
1304 TRACE("Returning fake value, in_vblank %u, scan_line %u.\n",
1305 raster_status
->in_vblank
, raster_status
->scan_line
);
1310 HRESULT CDECL
wined3d_check_depth_stencil_match(const struct wined3d
*wined3d
,
1311 UINT adapter_idx
, enum wined3d_device_type device_type
, enum wined3d_format_id adapter_format_id
,
1312 enum wined3d_format_id render_target_format_id
, enum wined3d_format_id depth_stencil_format_id
)
1314 const struct wined3d_format
*rt_format
;
1315 const struct wined3d_format
*ds_format
;
1316 const struct wined3d_adapter
*adapter
;
1318 TRACE("wined3d %p, adapter_idx %u, device_type %s, "
1319 "adapter_format %s, render_target_format %s, depth_stencil_format %s.\n",
1320 wined3d
, adapter_idx
, debug_d3ddevicetype(device_type
), debug_d3dformat(adapter_format_id
),
1321 debug_d3dformat(render_target_format_id
), debug_d3dformat(depth_stencil_format_id
));
1323 if (adapter_idx
>= wined3d
->adapter_count
)
1324 return WINED3DERR_INVALIDCALL
;
1326 adapter
= wined3d
->adapters
[adapter_idx
];
1328 rt_format
= wined3d_get_format(adapter
, render_target_format_id
, WINED3D_BIND_RENDER_TARGET
);
1329 ds_format
= wined3d_get_format(adapter
, depth_stencil_format_id
, WINED3D_BIND_DEPTH_STENCIL
);
1331 if (!(rt_format
->flags
[WINED3D_GL_RES_TYPE_TEX_2D
] & WINED3DFMT_FLAG_RENDERTARGET
))
1333 WARN("Format %s is not render target format.\n", debug_d3dformat(rt_format
->id
));
1334 return WINED3DERR_NOTAVAILABLE
;
1336 if (!(ds_format
->flags
[WINED3D_GL_RES_TYPE_TEX_2D
] & (WINED3DFMT_FLAG_DEPTH
| WINED3DFMT_FLAG_STENCIL
)))
1338 WARN("Format %s is not depth/stencil format.\n", debug_d3dformat(ds_format
->id
));
1339 return WINED3DERR_NOTAVAILABLE
;
1342 if (adapter
->adapter_ops
->adapter_check_format(adapter
, NULL
, rt_format
, ds_format
))
1344 TRACE("Formats match.\n");
1348 TRACE("Unsupported format pair: %s and %s.\n",
1349 debug_d3dformat(render_target_format_id
),
1350 debug_d3dformat(depth_stencil_format_id
));
1352 return WINED3DERR_NOTAVAILABLE
;
1355 HRESULT CDECL
wined3d_check_device_multisample_type(const struct wined3d
*wined3d
, UINT adapter_idx
,
1356 enum wined3d_device_type device_type
, enum wined3d_format_id surface_format_id
, BOOL windowed
,
1357 enum wined3d_multisample_type multisample_type
, DWORD
*quality_levels
)
1359 const struct wined3d_adapter
*adapter
;
1360 const struct wined3d_format
*format
;
1361 HRESULT hr
= WINED3D_OK
;
1363 TRACE("wined3d %p, adapter_idx %u, device_type %s, surface_format %s, "
1364 "windowed %#x, multisample_type %#x, quality_levels %p.\n",
1365 wined3d
, adapter_idx
, debug_d3ddevicetype(device_type
), debug_d3dformat(surface_format_id
),
1366 windowed
, multisample_type
, quality_levels
);
1368 if (adapter_idx
>= wined3d
->adapter_count
)
1369 return WINED3DERR_INVALIDCALL
;
1370 if (surface_format_id
== WINED3DFMT_UNKNOWN
)
1371 return WINED3DERR_INVALIDCALL
;
1372 if (multisample_type
< WINED3D_MULTISAMPLE_NONE
)
1373 return WINED3DERR_INVALIDCALL
;
1374 if (multisample_type
> WINED3D_MULTISAMPLE_16_SAMPLES
)
1376 FIXME("multisample_type %u not handled yet.\n", multisample_type
);
1377 return WINED3DERR_NOTAVAILABLE
;
1380 adapter
= wined3d
->adapters
[adapter_idx
];
1381 format
= wined3d_get_format(adapter
, surface_format_id
, 0);
1383 if (multisample_type
&& !(format
->multisample_types
& 1u << (multisample_type
- 1)))
1384 hr
= WINED3DERR_NOTAVAILABLE
;
1386 if (SUCCEEDED(hr
) || (multisample_type
== WINED3D_MULTISAMPLE_NON_MASKABLE
&& format
->multisample_types
))
1390 if (multisample_type
== WINED3D_MULTISAMPLE_NON_MASKABLE
)
1391 *quality_levels
= wined3d_popcount(format
->multisample_types
);
1393 *quality_levels
= 1;
1398 TRACE("Returning not supported.\n");
1402 static BOOL
wined3d_check_depth_stencil_format(const struct wined3d_adapter
*adapter
,
1403 const struct wined3d_format
*adapter_format
, const struct wined3d_format
*ds_format
,
1404 enum wined3d_gl_resource_type gl_type
)
1406 if (!ds_format
->depth_size
&& !ds_format
->stencil_size
)
1408 if (!(ds_format
->flags
[gl_type
] & (WINED3DFMT_FLAG_DEPTH
| WINED3DFMT_FLAG_STENCIL
)))
1411 /* Blacklist formats not supported on Windows */
1412 if (ds_format
->id
== WINED3DFMT_S1_UINT_D15_UNORM
/* Breaks the shadowvol2 dx7 sdk sample */
1413 || ds_format
->id
== WINED3DFMT_S4X4_UINT_D24_UNORM
)
1415 TRACE("Format %s is blacklisted.\n", debug_d3dformat(ds_format
->id
));
1419 return adapter
->adapter_ops
->adapter_check_format(adapter
, adapter_format
, NULL
, ds_format
);
1422 static BOOL
wined3d_check_surface_format(const struct wined3d_format
*format
)
1424 if ((format
->flags
[WINED3D_GL_RES_TYPE_TEX_2D
] | format
->flags
[WINED3D_GL_RES_TYPE_RB
]) & WINED3DFMT_FLAG_BLIT
)
1427 if ((format
->flags
[WINED3D_GL_RES_TYPE_TEX_2D
] & (WINED3DFMT_FLAG_EXTENSION
| WINED3DFMT_FLAG_TEXTURE
))
1428 == (WINED3DFMT_FLAG_EXTENSION
| WINED3DFMT_FLAG_TEXTURE
))
1434 /* OpenGL supports mipmapping on all formats. Wrapping is unsupported, but we
1435 * have to report mipmapping so we cannot reject WRAPANDMIP. Tests show that
1436 * Windows reports WRAPANDMIP on unfilterable surfaces as well, apparently to
1437 * show that wrapping is supported. The lack of filtering will sort out the
1438 * mipmapping capability anyway.
1440 * For now lets report this on all formats, but in the future we may want to
1441 * restrict it to some should applications need that. */
1442 HRESULT CDECL
wined3d_check_device_format(const struct wined3d
*wined3d
, UINT adapter_idx
,
1443 enum wined3d_device_type device_type
, enum wined3d_format_id adapter_format_id
, DWORD usage
,
1444 unsigned int bind_flags
, enum wined3d_resource_type resource_type
, enum wined3d_format_id check_format_id
)
1446 const struct wined3d_format
*adapter_format
, *format
;
1447 enum wined3d_gl_resource_type gl_type
, gl_type_end
;
1448 const struct wined3d_adapter
*adapter
;
1449 BOOL mipmap_gen_supported
= TRUE
;
1450 unsigned int allowed_bind_flags
;
1451 DWORD format_flags
= 0;
1452 DWORD allowed_usage
;
1454 TRACE("wined3d %p, adapter_idx %u, device_type %s, adapter_format %s, usage %s, %s, "
1455 "bind_flags %s, resource_type %s, check_format %s.\n",
1456 wined3d
, adapter_idx
, debug_d3ddevicetype(device_type
), debug_d3dformat(adapter_format_id
),
1457 debug_d3dusage(usage
), debug_d3dusagequery(usage
), wined3d_debug_bind_flags(bind_flags
),
1458 debug_d3dresourcetype(resource_type
), debug_d3dformat(check_format_id
));
1460 if (adapter_idx
>= wined3d
->adapter_count
)
1461 return WINED3DERR_INVALIDCALL
;
1463 adapter
= wined3d
->adapters
[adapter_idx
];
1464 adapter_format
= wined3d_get_format(adapter
, adapter_format_id
, WINED3D_BIND_RENDER_TARGET
);
1465 format
= wined3d_get_format(adapter
, check_format_id
, bind_flags
);
1467 switch (resource_type
)
1469 case WINED3D_RTYPE_NONE
:
1471 allowed_bind_flags
= WINED3D_BIND_RENDER_TARGET
1472 | WINED3D_BIND_DEPTH_STENCIL
;
1473 gl_type
= WINED3D_GL_RES_TYPE_TEX_2D
;
1474 gl_type_end
= WINED3D_GL_RES_TYPE_TEX_3D
;
1477 case WINED3D_RTYPE_TEXTURE_1D
:
1478 allowed_usage
= WINED3DUSAGE_DYNAMIC
1479 | WINED3DUSAGE_SOFTWAREPROCESSING
1480 | WINED3DUSAGE_QUERY_FILTER
1481 | WINED3DUSAGE_QUERY_GENMIPMAP
1482 | WINED3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING
1483 | WINED3DUSAGE_QUERY_SRGBREAD
1484 | WINED3DUSAGE_QUERY_SRGBWRITE
1485 | WINED3DUSAGE_QUERY_VERTEXTEXTURE
1486 | WINED3DUSAGE_QUERY_WRAPANDMIP
;
1487 allowed_bind_flags
= WINED3D_BIND_SHADER_RESOURCE
;
1488 gl_type
= gl_type_end
= WINED3D_GL_RES_TYPE_TEX_1D
;
1491 case WINED3D_RTYPE_TEXTURE_2D
:
1492 allowed_usage
= WINED3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING
;
1493 if (bind_flags
& WINED3D_BIND_RENDER_TARGET
)
1494 allowed_usage
|= WINED3DUSAGE_QUERY_SRGBWRITE
;
1495 allowed_bind_flags
= WINED3D_BIND_RENDER_TARGET
1496 | WINED3D_BIND_DEPTH_STENCIL
;
1497 if (!(bind_flags
& WINED3D_BIND_SHADER_RESOURCE
))
1499 if (!wined3d_check_surface_format(format
))
1501 TRACE("%s is not supported for plain surfaces.\n", debug_d3dformat(format
->id
));
1502 return WINED3DERR_NOTAVAILABLE
;
1505 gl_type
= gl_type_end
= WINED3D_GL_RES_TYPE_RB
;
1508 allowed_usage
|= WINED3DUSAGE_DYNAMIC
1509 | WINED3DUSAGE_LEGACY_CUBEMAP
1510 | WINED3DUSAGE_SOFTWAREPROCESSING
1511 | WINED3DUSAGE_QUERY_FILTER
1512 | WINED3DUSAGE_QUERY_GENMIPMAP
1513 | WINED3DUSAGE_QUERY_LEGACYBUMPMAP
1514 | WINED3DUSAGE_QUERY_SRGBREAD
1515 | WINED3DUSAGE_QUERY_SRGBWRITE
1516 | WINED3DUSAGE_QUERY_VERTEXTEXTURE
1517 | WINED3DUSAGE_QUERY_WRAPANDMIP
;
1518 allowed_bind_flags
|= WINED3D_BIND_SHADER_RESOURCE
;
1519 gl_type
= gl_type_end
= WINED3D_GL_RES_TYPE_TEX_2D
;
1520 if (usage
& WINED3DUSAGE_LEGACY_CUBEMAP
)
1522 allowed_usage
&= ~WINED3DUSAGE_QUERY_LEGACYBUMPMAP
;
1523 allowed_bind_flags
&= ~WINED3D_BIND_DEPTH_STENCIL
;
1524 gl_type
= gl_type_end
= WINED3D_GL_RES_TYPE_TEX_CUBE
;
1528 case WINED3D_RTYPE_TEXTURE_3D
:
1529 allowed_usage
= WINED3DUSAGE_DYNAMIC
1530 | WINED3DUSAGE_SOFTWAREPROCESSING
1531 | WINED3DUSAGE_QUERY_FILTER
1532 | WINED3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING
1533 | WINED3DUSAGE_QUERY_SRGBREAD
1534 | WINED3DUSAGE_QUERY_SRGBWRITE
1535 | WINED3DUSAGE_QUERY_VERTEXTEXTURE
1536 | WINED3DUSAGE_QUERY_WRAPANDMIP
;
1537 allowed_bind_flags
= WINED3D_BIND_SHADER_RESOURCE
;
1538 gl_type
= gl_type_end
= WINED3D_GL_RES_TYPE_TEX_3D
;
1542 FIXME("Unhandled resource type %s.\n", debug_d3dresourcetype(resource_type
));
1543 return WINED3DERR_NOTAVAILABLE
;
1546 if ((usage
& allowed_usage
) != usage
)
1548 TRACE("Requested usage %#x, but resource type %s only allows %#x.\n",
1549 usage
, debug_d3dresourcetype(resource_type
), allowed_usage
);
1550 return WINED3DERR_NOTAVAILABLE
;
1553 if ((bind_flags
& allowed_bind_flags
) != bind_flags
)
1555 TRACE("Requested bind flags %s, but resource type %s only allows %s.\n",
1556 wined3d_debug_bind_flags(bind_flags
), debug_d3dresourcetype(resource_type
),
1557 wined3d_debug_bind_flags(allowed_bind_flags
));
1558 return WINED3DERR_NOTAVAILABLE
;
1561 if (bind_flags
& WINED3D_BIND_SHADER_RESOURCE
)
1562 format_flags
|= WINED3DFMT_FLAG_TEXTURE
;
1563 if (bind_flags
& WINED3D_BIND_RENDER_TARGET
)
1564 format_flags
|= WINED3DFMT_FLAG_RENDERTARGET
;
1565 if (usage
& WINED3DUSAGE_QUERY_FILTER
)
1566 format_flags
|= WINED3DFMT_FLAG_FILTERING
;
1567 if (usage
& WINED3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING
)
1568 format_flags
|= WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING
;
1569 if (usage
& WINED3DUSAGE_QUERY_SRGBREAD
)
1570 format_flags
|= WINED3DFMT_FLAG_SRGB_READ
;
1571 if (usage
& WINED3DUSAGE_QUERY_SRGBWRITE
)
1572 format_flags
|= WINED3DFMT_FLAG_SRGB_WRITE
;
1573 if (usage
& WINED3DUSAGE_QUERY_VERTEXTEXTURE
)
1574 format_flags
|= WINED3DFMT_FLAG_VTF
;
1575 if (usage
& WINED3DUSAGE_QUERY_LEGACYBUMPMAP
)
1576 format_flags
|= WINED3DFMT_FLAG_BUMPMAP
;
1578 if ((format_flags
& WINED3DFMT_FLAG_TEXTURE
) && (wined3d
->flags
& WINED3D_NO3D
))
1580 TRACE("Requested texturing support, but wined3d was created with WINED3D_NO3D.\n");
1581 return WINED3DERR_NOTAVAILABLE
;
1584 for (; gl_type
<= gl_type_end
; ++gl_type
)
1586 if ((format
->flags
[gl_type
] & format_flags
) != format_flags
)
1588 TRACE("Requested format flags %#x, but format %s only has %#x.\n",
1589 format_flags
, debug_d3dformat(check_format_id
), format
->flags
[gl_type
]);
1590 return WINED3DERR_NOTAVAILABLE
;
1593 if ((bind_flags
& WINED3D_BIND_RENDER_TARGET
)
1594 && !adapter
->adapter_ops
->adapter_check_format(adapter
, adapter_format
, format
, NULL
))
1596 TRACE("Requested WINED3D_BIND_RENDER_TARGET, but format %s is not supported for render targets.\n",
1597 debug_d3dformat(check_format_id
));
1598 return WINED3DERR_NOTAVAILABLE
;
1601 /* 3D depth / stencil textures are never supported. */
1602 if (bind_flags
== WINED3D_BIND_DEPTH_STENCIL
&& gl_type
== WINED3D_GL_RES_TYPE_TEX_3D
)
1605 if ((bind_flags
& WINED3D_BIND_DEPTH_STENCIL
)
1606 && !wined3d_check_depth_stencil_format(adapter
, adapter_format
, format
, gl_type
))
1608 TRACE("Requested WINED3D_BIND_DEPTH_STENCIL, but format %s is not supported for depth/stencil buffers.\n",
1609 debug_d3dformat(check_format_id
));
1610 return WINED3DERR_NOTAVAILABLE
;
1613 if (!(format
->flags
[gl_type
] & WINED3DFMT_FLAG_GEN_MIPMAP
))
1614 mipmap_gen_supported
= FALSE
;
1617 if ((usage
& WINED3DUSAGE_QUERY_GENMIPMAP
) && !mipmap_gen_supported
)
1619 TRACE("No WINED3DUSAGE_AUTOGENMIPMAP support, returning WINED3DOK_NOAUTOGEN.\n");
1620 return WINED3DOK_NOMIPGEN
;
1626 UINT CDECL
wined3d_calculate_format_pitch(const struct wined3d
*wined3d
, UINT adapter_idx
,
1627 enum wined3d_format_id format_id
, UINT width
)
1629 const struct wined3d_adapter
*adapter
;
1630 unsigned int row_pitch
, slice_pitch
;
1632 TRACE("wined3d %p, adapter_idx %u, format_id %s, width %u.\n",
1633 wined3d
, adapter_idx
, debug_d3dformat(format_id
), width
);
1635 if (adapter_idx
>= wined3d
->adapter_count
)
1638 adapter
= wined3d
->adapters
[adapter_idx
];
1639 wined3d_format_calculate_pitch(wined3d_get_format(adapter
, format_id
, 0),
1640 1, width
, 1, &row_pitch
, &slice_pitch
);
1645 HRESULT CDECL
wined3d_check_device_format_conversion(const struct wined3d
*wined3d
, UINT adapter_idx
,
1646 enum wined3d_device_type device_type
, enum wined3d_format_id src_format
, enum wined3d_format_id dst_format
)
1648 FIXME("wined3d %p, adapter_idx %u, device_type %s, src_format %s, dst_format %s stub!\n",
1649 wined3d
, adapter_idx
, debug_d3ddevicetype(device_type
), debug_d3dformat(src_format
),
1650 debug_d3dformat(dst_format
));
1655 HRESULT CDECL
wined3d_check_device_type(const struct wined3d
*wined3d
, UINT adapter_idx
,
1656 enum wined3d_device_type device_type
, enum wined3d_format_id display_format
,
1657 enum wined3d_format_id backbuffer_format
, BOOL windowed
)
1659 BOOL present_conversion
= wined3d
->flags
& WINED3D_PRESENT_CONVERSION
;
1661 TRACE("wined3d %p, adapter_idx %u, device_type %s, display_format %s, backbuffer_format %s, windowed %#x.\n",
1662 wined3d
, adapter_idx
, debug_d3ddevicetype(device_type
), debug_d3dformat(display_format
),
1663 debug_d3dformat(backbuffer_format
), windowed
);
1665 if (adapter_idx
>= wined3d
->adapter_count
)
1666 return WINED3DERR_INVALIDCALL
;
1668 /* The task of this function is to check whether a certain display / backbuffer format
1669 * combination is available on the given adapter. In fullscreen mode microsoft specified
1670 * that the display format shouldn't provide alpha and that ignoring alpha the backbuffer
1671 * and display format should match exactly.
1672 * In windowed mode format conversion can occur and this depends on the driver. */
1674 /* There are only 4 display formats. */
1675 if (!(display_format
== WINED3DFMT_B5G6R5_UNORM
1676 || display_format
== WINED3DFMT_B5G5R5X1_UNORM
1677 || display_format
== WINED3DFMT_B8G8R8X8_UNORM
1678 || display_format
== WINED3DFMT_B10G10R10A2_UNORM
))
1680 TRACE("Format %s is not supported as display format.\n", debug_d3dformat(display_format
));
1681 return WINED3DERR_NOTAVAILABLE
;
1686 /* If the requested display format is not available, don't continue. */
1687 if (!wined3d_get_adapter_mode_count(wined3d
, adapter_idx
,
1688 display_format
, WINED3D_SCANLINE_ORDERING_UNKNOWN
))
1690 TRACE("No available modes for display format %s.\n", debug_d3dformat(display_format
));
1691 return WINED3DERR_NOTAVAILABLE
;
1694 present_conversion
= FALSE
;
1696 else if (display_format
== WINED3DFMT_B10G10R10A2_UNORM
)
1698 /* WINED3DFMT_B10G10R10A2_UNORM is only allowed in fullscreen mode. */
1699 TRACE("Unsupported format combination %s / %s in windowed mode.\n",
1700 debug_d3dformat(display_format
), debug_d3dformat(backbuffer_format
));
1701 return WINED3DERR_NOTAVAILABLE
;
1704 if (present_conversion
)
1706 /* Use the display format as back buffer format if the latter is
1707 * WINED3DFMT_UNKNOWN. */
1708 if (backbuffer_format
== WINED3DFMT_UNKNOWN
)
1709 backbuffer_format
= display_format
;
1711 if (FAILED(wined3d_check_device_format_conversion(wined3d
, adapter_idx
,
1712 device_type
, backbuffer_format
, display_format
)))
1714 TRACE("Format conversion from %s to %s not supported.\n",
1715 debug_d3dformat(backbuffer_format
), debug_d3dformat(display_format
));
1716 return WINED3DERR_NOTAVAILABLE
;
1721 /* When format conversion from the back buffer format to the display
1722 * format is not allowed, only a limited number of combinations are
1725 if (display_format
== WINED3DFMT_B5G6R5_UNORM
&& backbuffer_format
!= WINED3DFMT_B5G6R5_UNORM
)
1727 TRACE("Unsupported format combination %s / %s.\n",
1728 debug_d3dformat(display_format
), debug_d3dformat(backbuffer_format
));
1729 return WINED3DERR_NOTAVAILABLE
;
1732 if (display_format
== WINED3DFMT_B5G5R5X1_UNORM
1733 && !(backbuffer_format
== WINED3DFMT_B5G5R5X1_UNORM
|| backbuffer_format
== WINED3DFMT_B5G5R5A1_UNORM
))
1735 TRACE("Unsupported format combination %s / %s.\n",
1736 debug_d3dformat(display_format
), debug_d3dformat(backbuffer_format
));
1737 return WINED3DERR_NOTAVAILABLE
;
1740 if (display_format
== WINED3DFMT_B8G8R8X8_UNORM
1741 && !(backbuffer_format
== WINED3DFMT_B8G8R8X8_UNORM
|| backbuffer_format
== WINED3DFMT_B8G8R8A8_UNORM
))
1743 TRACE("Unsupported format combination %s / %s.\n",
1744 debug_d3dformat(display_format
), debug_d3dformat(backbuffer_format
));
1745 return WINED3DERR_NOTAVAILABLE
;
1748 if (display_format
== WINED3DFMT_B10G10R10A2_UNORM
1749 && backbuffer_format
!= WINED3DFMT_B10G10R10A2_UNORM
)
1751 TRACE("Unsupported format combination %s / %s.\n",
1752 debug_d3dformat(display_format
), debug_d3dformat(backbuffer_format
));
1753 return WINED3DERR_NOTAVAILABLE
;
1757 /* Validate that the back buffer format is usable for render targets. */
1758 if (FAILED(wined3d_check_device_format(wined3d
, adapter_idx
, device_type
, display_format
,
1759 0, WINED3D_BIND_RENDER_TARGET
, WINED3D_RTYPE_TEXTURE_2D
, backbuffer_format
)))
1761 TRACE("Format %s not allowed for render targets.\n", debug_d3dformat(backbuffer_format
));
1762 return WINED3DERR_NOTAVAILABLE
;
1768 HRESULT CDECL
wined3d_get_device_caps(const struct wined3d
*wined3d
, unsigned int adapter_idx
,
1769 enum wined3d_device_type device_type
, struct wined3d_caps
*caps
)
1771 const struct wined3d_d3d_info
*d3d_info
;
1772 struct wined3d_vertex_caps vertex_caps
;
1773 const struct wined3d_adapter
*adapter
;
1774 DWORD ckey_caps
, blit_caps
, fx_caps
;
1775 struct fragment_caps fragment_caps
;
1776 struct shader_caps shader_caps
;
1778 TRACE("wined3d %p, adapter_idx %u, device_type %s, caps %p.\n",
1779 wined3d
, adapter_idx
, debug_d3ddevicetype(device_type
), caps
);
1781 if (adapter_idx
>= wined3d
->adapter_count
)
1782 return WINED3DERR_INVALIDCALL
;
1784 adapter
= wined3d
->adapters
[adapter_idx
];
1785 d3d_info
= &adapter
->d3d_info
;
1787 caps
->DeviceType
= (device_type
== WINED3D_DEVICE_TYPE_HAL
) ? WINED3D_DEVICE_TYPE_HAL
: WINED3D_DEVICE_TYPE_REF
;
1788 caps
->AdapterOrdinal
= adapter_idx
;
1791 caps
->Caps2
= WINED3DCAPS2_CANRENDERWINDOWED
|
1792 WINED3DCAPS2_FULLSCREENGAMMA
|
1793 WINED3DCAPS2_DYNAMICTEXTURES
;
1795 caps
->Caps3
= WINED3DCAPS3_ALPHA_FULLSCREEN_FLIP_OR_DISCARD
|
1796 WINED3DCAPS3_COPY_TO_VIDMEM
|
1797 WINED3DCAPS3_COPY_TO_SYSTEMMEM
;
1799 caps
->CursorCaps
= WINED3DCURSORCAPS_COLOR
|
1800 WINED3DCURSORCAPS_LOWRES
;
1802 caps
->DevCaps
= WINED3DDEVCAPS_FLOATTLVERTEX
|
1803 WINED3DDEVCAPS_EXECUTESYSTEMMEMORY
|
1804 WINED3DDEVCAPS_TLVERTEXSYSTEMMEMORY
|
1805 WINED3DDEVCAPS_TLVERTEXVIDEOMEMORY
|
1806 WINED3DDEVCAPS_DRAWPRIMTLVERTEX
|
1807 WINED3DDEVCAPS_HWTRANSFORMANDLIGHT
|
1808 WINED3DDEVCAPS_EXECUTEVIDEOMEMORY
|
1809 WINED3DDEVCAPS_PUREDEVICE
|
1810 WINED3DDEVCAPS_HWRASTERIZATION
|
1811 WINED3DDEVCAPS_TEXTUREVIDEOMEMORY
|
1812 WINED3DDEVCAPS_TEXTURESYSTEMMEMORY
|
1813 WINED3DDEVCAPS_CANRENDERAFTERFLIP
|
1814 WINED3DDEVCAPS_DRAWPRIMITIVES2
|
1815 WINED3DDEVCAPS_DRAWPRIMITIVES2EX
;
1817 caps
->PrimitiveMiscCaps
= WINED3DPMISCCAPS_CULLNONE
|
1818 WINED3DPMISCCAPS_CULLCCW
|
1819 WINED3DPMISCCAPS_CULLCW
|
1820 WINED3DPMISCCAPS_COLORWRITEENABLE
|
1821 WINED3DPMISCCAPS_CLIPTLVERTS
|
1822 WINED3DPMISCCAPS_CLIPPLANESCALEDPOINTS
|
1823 WINED3DPMISCCAPS_MASKZ
|
1824 WINED3DPMISCCAPS_MRTPOSTPIXELSHADERBLENDING
;
1826 WINED3DPMISCCAPS_NULLREFERENCE
1827 WINED3DPMISCCAPS_FOGANDSPECULARALPHA
1828 WINED3DPMISCCAPS_MRTINDEPENDENTBITDEPTHS
1829 WINED3DPMISCCAPS_FOGVERTEXCLAMPED */
1831 caps
->RasterCaps
= WINED3DPRASTERCAPS_DITHER
|
1832 WINED3DPRASTERCAPS_PAT
|
1833 WINED3DPRASTERCAPS_WFOG
|
1834 WINED3DPRASTERCAPS_ZFOG
|
1835 WINED3DPRASTERCAPS_FOGVERTEX
|
1836 WINED3DPRASTERCAPS_FOGTABLE
|
1837 WINED3DPRASTERCAPS_STIPPLE
|
1838 WINED3DPRASTERCAPS_SUBPIXEL
|
1839 WINED3DPRASTERCAPS_ZTEST
|
1840 WINED3DPRASTERCAPS_SCISSORTEST
|
1841 WINED3DPRASTERCAPS_SLOPESCALEDEPTHBIAS
|
1842 WINED3DPRASTERCAPS_DEPTHBIAS
;
1844 caps
->ZCmpCaps
= WINED3DPCMPCAPS_ALWAYS
|
1845 WINED3DPCMPCAPS_EQUAL
|
1846 WINED3DPCMPCAPS_GREATER
|
1847 WINED3DPCMPCAPS_GREATEREQUAL
|
1848 WINED3DPCMPCAPS_LESS
|
1849 WINED3DPCMPCAPS_LESSEQUAL
|
1850 WINED3DPCMPCAPS_NEVER
|
1851 WINED3DPCMPCAPS_NOTEQUAL
;
1853 /* WINED3DPBLENDCAPS_BOTHINVSRCALPHA and WINED3DPBLENDCAPS_BOTHSRCALPHA
1854 * are legacy settings for srcblend only. */
1855 caps
->SrcBlendCaps
= WINED3DPBLENDCAPS_BOTHINVSRCALPHA
|
1856 WINED3DPBLENDCAPS_BOTHSRCALPHA
|
1857 WINED3DPBLENDCAPS_DESTALPHA
|
1858 WINED3DPBLENDCAPS_DESTCOLOR
|
1859 WINED3DPBLENDCAPS_INVDESTALPHA
|
1860 WINED3DPBLENDCAPS_INVDESTCOLOR
|
1861 WINED3DPBLENDCAPS_INVSRCALPHA
|
1862 WINED3DPBLENDCAPS_INVSRCCOLOR
|
1863 WINED3DPBLENDCAPS_ONE
|
1864 WINED3DPBLENDCAPS_SRCALPHA
|
1865 WINED3DPBLENDCAPS_SRCALPHASAT
|
1866 WINED3DPBLENDCAPS_SRCCOLOR
|
1867 WINED3DPBLENDCAPS_ZERO
;
1869 caps
->DestBlendCaps
= WINED3DPBLENDCAPS_DESTALPHA
|
1870 WINED3DPBLENDCAPS_DESTCOLOR
|
1871 WINED3DPBLENDCAPS_INVDESTALPHA
|
1872 WINED3DPBLENDCAPS_INVDESTCOLOR
|
1873 WINED3DPBLENDCAPS_INVSRCALPHA
|
1874 WINED3DPBLENDCAPS_INVSRCCOLOR
|
1875 WINED3DPBLENDCAPS_ONE
|
1876 WINED3DPBLENDCAPS_SRCALPHA
|
1877 WINED3DPBLENDCAPS_SRCCOLOR
|
1878 WINED3DPBLENDCAPS_ZERO
;
1880 caps
->AlphaCmpCaps
= WINED3DPCMPCAPS_ALWAYS
|
1881 WINED3DPCMPCAPS_EQUAL
|
1882 WINED3DPCMPCAPS_GREATER
|
1883 WINED3DPCMPCAPS_GREATEREQUAL
|
1884 WINED3DPCMPCAPS_LESS
|
1885 WINED3DPCMPCAPS_LESSEQUAL
|
1886 WINED3DPCMPCAPS_NEVER
|
1887 WINED3DPCMPCAPS_NOTEQUAL
;
1889 caps
->ShadeCaps
= WINED3DPSHADECAPS_SPECULARGOURAUDRGB
|
1890 WINED3DPSHADECAPS_COLORGOURAUDRGB
|
1891 WINED3DPSHADECAPS_ALPHAFLATBLEND
|
1892 WINED3DPSHADECAPS_ALPHAGOURAUDBLEND
|
1893 WINED3DPSHADECAPS_COLORFLATRGB
|
1894 WINED3DPSHADECAPS_FOGFLAT
|
1895 WINED3DPSHADECAPS_FOGGOURAUD
|
1896 WINED3DPSHADECAPS_SPECULARFLATRGB
;
1898 caps
->TextureCaps
= WINED3DPTEXTURECAPS_ALPHA
|
1899 WINED3DPTEXTURECAPS_ALPHAPALETTE
|
1900 WINED3DPTEXTURECAPS_TRANSPARENCY
|
1901 WINED3DPTEXTURECAPS_BORDER
|
1902 WINED3DPTEXTURECAPS_MIPMAP
|
1903 WINED3DPTEXTURECAPS_PROJECTED
|
1904 WINED3DPTEXTURECAPS_PERSPECTIVE
;
1906 if (!d3d_info
->texture_npot
)
1908 caps
->TextureCaps
|= WINED3DPTEXTURECAPS_POW2
;
1909 if (d3d_info
->texture_npot_conditional
)
1910 caps
->TextureCaps
|= WINED3DPTEXTURECAPS_NONPOW2CONDITIONAL
;
1913 caps
->TextureFilterCaps
= WINED3DPTFILTERCAPS_MAGFLINEAR
|
1914 WINED3DPTFILTERCAPS_MAGFPOINT
|
1915 WINED3DPTFILTERCAPS_MINFLINEAR
|
1916 WINED3DPTFILTERCAPS_MINFPOINT
|
1917 WINED3DPTFILTERCAPS_MIPFLINEAR
|
1918 WINED3DPTFILTERCAPS_MIPFPOINT
|
1919 WINED3DPTFILTERCAPS_LINEAR
|
1920 WINED3DPTFILTERCAPS_LINEARMIPLINEAR
|
1921 WINED3DPTFILTERCAPS_LINEARMIPNEAREST
|
1922 WINED3DPTFILTERCAPS_MIPLINEAR
|
1923 WINED3DPTFILTERCAPS_MIPNEAREST
|
1924 WINED3DPTFILTERCAPS_NEAREST
;
1926 caps
->CubeTextureFilterCaps
= 0;
1927 caps
->VolumeTextureFilterCaps
= 0;
1929 caps
->TextureAddressCaps
= WINED3DPTADDRESSCAPS_INDEPENDENTUV
|
1930 WINED3DPTADDRESSCAPS_CLAMP
|
1931 WINED3DPTADDRESSCAPS_WRAP
;
1933 caps
->VolumeTextureAddressCaps
= 0;
1935 caps
->LineCaps
= WINED3DLINECAPS_TEXTURE
|
1936 WINED3DLINECAPS_ZTEST
|
1937 WINED3DLINECAPS_BLEND
|
1938 WINED3DLINECAPS_ALPHACMP
|
1939 WINED3DLINECAPS_FOG
;
1940 /* WINED3DLINECAPS_ANTIALIAS is not supported on Windows, and dx and gl seem to have a different
1941 * idea how generating the smoothing alpha values works; the result is different
1944 caps
->MaxTextureWidth
= d3d_info
->limits
.texture_size
;
1945 caps
->MaxTextureHeight
= d3d_info
->limits
.texture_size
;
1947 caps
->MaxVolumeExtent
= 0;
1949 caps
->MaxTextureRepeat
= 32768;
1950 caps
->MaxTextureAspectRatio
= d3d_info
->limits
.texture_size
;
1951 caps
->MaxVertexW
= 1e10f
;
1953 caps
->GuardBandLeft
= 0.0f
;
1954 caps
->GuardBandTop
= 0.0f
;
1955 caps
->GuardBandRight
= 0.0f
;
1956 caps
->GuardBandBottom
= 0.0f
;
1958 caps
->ExtentsAdjust
= 0.0f
;
1960 caps
->StencilCaps
= WINED3DSTENCILCAPS_DECRSAT
|
1961 WINED3DSTENCILCAPS_INCRSAT
|
1962 WINED3DSTENCILCAPS_INVERT
|
1963 WINED3DSTENCILCAPS_KEEP
|
1964 WINED3DSTENCILCAPS_REPLACE
|
1965 WINED3DSTENCILCAPS_ZERO
;
1967 caps
->MaxAnisotropy
= 0;
1968 caps
->MaxPointSize
= d3d_info
->limits
.pointsize_max
;
1970 caps
->MaxPrimitiveCount
= 0x555555; /* Taken from an AMD Radeon HD 5700 (Evergreen) GPU. */
1971 caps
->MaxVertexIndex
= 0xffffff; /* Taken from an AMD Radeon HD 5700 (Evergreen) GPU. */
1972 caps
->MaxStreams
= WINED3D_MAX_STREAMS
;
1973 caps
->MaxStreamStride
= 1024;
1975 /* d3d9.dll sets D3DDEVCAPS2_CAN_STRETCHRECT_FROM_TEXTURES here because StretchRects is implemented in d3d9 */
1976 caps
->DevCaps2
= WINED3DDEVCAPS2_STREAMOFFSET
|
1977 WINED3DDEVCAPS2_VERTEXELEMENTSCANSHARESTREAMOFFSET
;
1978 caps
->MaxNpatchTessellationLevel
= 0;
1979 caps
->MasterAdapterOrdinal
= 0;
1980 caps
->AdapterOrdinalInGroup
= 0;
1981 caps
->NumberOfAdaptersInGroup
= 1;
1983 caps
->NumSimultaneousRTs
= d3d_info
->limits
.max_rt_count
;
1985 caps
->StretchRectFilterCaps
= WINED3DPTFILTERCAPS_MINFPOINT
|
1986 WINED3DPTFILTERCAPS_MAGFPOINT
|
1987 WINED3DPTFILTERCAPS_MINFLINEAR
|
1988 WINED3DPTFILTERCAPS_MAGFLINEAR
;
1989 caps
->VertexTextureFilterCaps
= 0;
1991 adapter
->shader_backend
->shader_get_caps(adapter
, &shader_caps
);
1992 adapter
->fragment_pipe
->get_caps(adapter
, &fragment_caps
);
1993 adapter
->vertex_pipe
->vp_get_caps(adapter
, &vertex_caps
);
1995 /* Add shader misc caps. Only some of them belong to the shader parts of the pipeline */
1996 caps
->PrimitiveMiscCaps
|= fragment_caps
.PrimitiveMiscCaps
;
1998 caps
->VertexShaderVersion
= shader_caps
.vs_version
;
1999 caps
->MaxVertexShaderConst
= shader_caps
.vs_uniform_count
;
2001 caps
->PixelShaderVersion
= shader_caps
.ps_version
;
2002 caps
->PixelShader1xMaxValue
= shader_caps
.ps_1x_max_value
;
2004 caps
->TextureOpCaps
= fragment_caps
.TextureOpCaps
;
2005 caps
->MaxTextureBlendStages
= fragment_caps
.MaxTextureBlendStages
;
2006 caps
->MaxSimultaneousTextures
= fragment_caps
.MaxSimultaneousTextures
;
2008 caps
->MaxUserClipPlanes
= vertex_caps
.max_user_clip_planes
;
2009 caps
->MaxActiveLights
= vertex_caps
.max_active_lights
;
2010 caps
->MaxVertexBlendMatrices
= vertex_caps
.max_vertex_blend_matrices
;
2011 caps
->MaxVertexBlendMatrixIndex
= vertex_caps
.max_vertex_blend_matrix_index
;
2012 caps
->VertexProcessingCaps
= vertex_caps
.vertex_processing_caps
;
2013 caps
->FVFCaps
= vertex_caps
.fvf_caps
;
2014 caps
->RasterCaps
|= vertex_caps
.raster_caps
;
2016 /* The following caps are shader specific, but they are things we cannot detect, or which
2017 * are the same among all shader models. So to avoid code duplication set the shader version
2018 * specific, but otherwise constant caps here
2020 if (caps
->VertexShaderVersion
>= 3)
2022 /* Where possible set the caps based on OpenGL extensions and if they
2023 * aren't set (in case of software rendering) use the VS 3.0 from
2024 * MSDN or else if there's OpenGL spec use a hardcoded value minimum
2026 caps
->VS20Caps
.caps
= WINED3DVS20CAPS_PREDICATION
;
2027 /* VS 3.0 requires MAX_DYNAMICFLOWCONTROLDEPTH (24) */
2028 caps
->VS20Caps
.dynamic_flow_control_depth
= WINED3DVS20_MAX_DYNAMICFLOWCONTROLDEPTH
;
2029 caps
->VS20Caps
.temp_count
= 32;
2030 /* level of nesting in loops / if-statements; VS 3.0 requires MAX (4) */
2031 caps
->VS20Caps
.static_flow_control_depth
= WINED3DVS20_MAX_STATICFLOWCONTROLDEPTH
;
2033 caps
->MaxVShaderInstructionsExecuted
= 65535; /* VS 3.0 needs at least 65535, some cards even use 2^32-1 */
2034 caps
->MaxVertexShader30InstructionSlots
= WINED3DMIN30SHADERINSTRUCTIONS
;
2035 caps
->VertexTextureFilterCaps
= WINED3DPTFILTERCAPS_MINFPOINT
| WINED3DPTFILTERCAPS_MAGFPOINT
;
2037 else if (caps
->VertexShaderVersion
== 2)
2039 caps
->VS20Caps
.caps
= 0;
2040 caps
->VS20Caps
.dynamic_flow_control_depth
= WINED3DVS20_MIN_DYNAMICFLOWCONTROLDEPTH
;
2041 caps
->VS20Caps
.temp_count
= WINED3DVS20_MIN_NUMTEMPS
;
2042 caps
->VS20Caps
.static_flow_control_depth
= 1;
2044 caps
->MaxVShaderInstructionsExecuted
= 65535;
2045 caps
->MaxVertexShader30InstructionSlots
= 0;
2049 caps
->VS20Caps
.caps
= 0;
2050 caps
->VS20Caps
.dynamic_flow_control_depth
= 0;
2051 caps
->VS20Caps
.temp_count
= 0;
2052 caps
->VS20Caps
.static_flow_control_depth
= 0;
2054 caps
->MaxVShaderInstructionsExecuted
= 0;
2055 caps
->MaxVertexShader30InstructionSlots
= 0;
2058 if (caps
->PixelShaderVersion
>= 3)
2060 /* Where possible set the caps based on OpenGL extensions and if they
2061 * aren't set (in case of software rendering) use the PS 3.0 from
2062 * MSDN or else if there's OpenGL spec use a hardcoded value minimum
2065 /* Caps is more or less undocumented on MSDN but it appears to be
2066 * used for PS20Caps based on results from R9600/FX5900/Geforce6800
2067 * cards from Windows */
2068 caps
->PS20Caps
.caps
= WINED3DPS20CAPS_ARBITRARYSWIZZLE
|
2069 WINED3DPS20CAPS_GRADIENTINSTRUCTIONS
|
2070 WINED3DPS20CAPS_PREDICATION
|
2071 WINED3DPS20CAPS_NODEPENDENTREADLIMIT
|
2072 WINED3DPS20CAPS_NOTEXINSTRUCTIONLIMIT
;
2073 /* PS 3.0 requires MAX_DYNAMICFLOWCONTROLDEPTH (24) */
2074 caps
->PS20Caps
.dynamic_flow_control_depth
= WINED3DPS20_MAX_DYNAMICFLOWCONTROLDEPTH
;
2075 caps
->PS20Caps
.temp_count
= 32;
2076 /* PS 3.0 requires MAX_STATICFLOWCONTROLDEPTH (4) */
2077 caps
->PS20Caps
.static_flow_control_depth
= WINED3DPS20_MAX_STATICFLOWCONTROLDEPTH
;
2078 /* PS 3.0 requires MAX_NUMINSTRUCTIONSLOTS (512) */
2079 caps
->PS20Caps
.instruction_slot_count
= WINED3DPS20_MAX_NUMINSTRUCTIONSLOTS
;
2081 caps
->MaxPShaderInstructionsExecuted
= 65535;
2082 caps
->MaxPixelShader30InstructionSlots
= WINED3DMIN30SHADERINSTRUCTIONS
;
2084 else if (caps
->PixelShaderVersion
== 2)
2086 /* Below we assume PS2.0 specs, not extended 2.0a(GeforceFX)/2.0b(Radeon R3xx) ones */
2087 caps
->PS20Caps
.caps
= 0;
2088 caps
->PS20Caps
.dynamic_flow_control_depth
= 0; /* WINED3DVS20_MIN_DYNAMICFLOWCONTROLDEPTH = 0 */
2089 caps
->PS20Caps
.temp_count
= WINED3DPS20_MIN_NUMTEMPS
;
2090 caps
->PS20Caps
.static_flow_control_depth
= WINED3DPS20_MIN_STATICFLOWCONTROLDEPTH
; /* Minimum: 1 */
2091 /* Minimum number (64 ALU + 32 Texture), a GeforceFX uses 512 */
2092 caps
->PS20Caps
.instruction_slot_count
= WINED3DPS20_MIN_NUMINSTRUCTIONSLOTS
;
2094 caps
->MaxPShaderInstructionsExecuted
= 512; /* Minimum value, a GeforceFX uses 1024 */
2095 caps
->MaxPixelShader30InstructionSlots
= 0;
2099 caps
->PS20Caps
.caps
= 0;
2100 caps
->PS20Caps
.dynamic_flow_control_depth
= 0;
2101 caps
->PS20Caps
.temp_count
= 0;
2102 caps
->PS20Caps
.static_flow_control_depth
= 0;
2103 caps
->PS20Caps
.instruction_slot_count
= 0;
2105 caps
->MaxPShaderInstructionsExecuted
= 0;
2106 caps
->MaxPixelShader30InstructionSlots
= 0;
2109 if (caps
->VertexShaderVersion
>= 2)
2111 /* OpenGL supports all the formats below, perhaps not always
2112 * without conversion, but it supports them.
2113 * Further GLSL doesn't seem to have an official unsigned type so
2114 * don't advertise it yet as I'm not sure how we handle it.
2115 * We might need to add some clamping in the shader engine to
2117 * TODO: WINED3DDTCAPS_USHORT2N, WINED3DDTCAPS_USHORT4N, WINED3DDTCAPS_UDEC3, WINED3DDTCAPS_DEC3N */
2118 caps
->DeclTypes
= WINED3DDTCAPS_UBYTE4
|
2119 WINED3DDTCAPS_UBYTE4N
|
2120 WINED3DDTCAPS_SHORT2N
|
2121 WINED3DDTCAPS_SHORT4N
;
2125 caps
->DeclTypes
= 0;
2128 /* Set DirectDraw helper Caps */
2129 ckey_caps
= WINEDDCKEYCAPS_DESTBLT
|
2130 WINEDDCKEYCAPS_SRCBLT
;
2131 fx_caps
= WINEDDFXCAPS_BLTALPHA
|
2132 WINEDDFXCAPS_BLTMIRRORLEFTRIGHT
|
2133 WINEDDFXCAPS_BLTMIRRORUPDOWN
|
2134 WINEDDFXCAPS_BLTROTATION90
|
2135 WINEDDFXCAPS_BLTSHRINKX
|
2136 WINEDDFXCAPS_BLTSHRINKXN
|
2137 WINEDDFXCAPS_BLTSHRINKY
|
2138 WINEDDFXCAPS_BLTSHRINKYN
|
2139 WINEDDFXCAPS_BLTSTRETCHX
|
2140 WINEDDFXCAPS_BLTSTRETCHXN
|
2141 WINEDDFXCAPS_BLTSTRETCHY
|
2142 WINEDDFXCAPS_BLTSTRETCHYN
;
2143 blit_caps
= WINEDDCAPS_BLT
|
2144 WINEDDCAPS_BLTCOLORFILL
|
2145 WINEDDCAPS_BLTDEPTHFILL
|
2146 WINEDDCAPS_BLTSTRETCH
|
2147 WINEDDCAPS_CANBLTSYSMEM
|
2148 WINEDDCAPS_CANCLIP
|
2149 WINEDDCAPS_CANCLIPSTRETCHED
|
2150 WINEDDCAPS_COLORKEY
|
2151 WINEDDCAPS_COLORKEYHWASSIST
;
2153 /* Fill the ddraw caps structure */
2154 caps
->ddraw_caps
.caps
= WINEDDCAPS_GDI
|
2155 WINEDDCAPS_PALETTE
|
2157 caps
->ddraw_caps
.caps2
= WINEDDCAPS2_CERTIFIED
|
2158 WINEDDCAPS2_NOPAGELOCKREQUIRED
|
2159 WINEDDCAPS2_PRIMARYGAMMA
|
2160 WINEDDCAPS2_WIDESURFACES
|
2161 WINEDDCAPS2_CANRENDERWINDOWED
;
2162 caps
->ddraw_caps
.color_key_caps
= ckey_caps
;
2163 caps
->ddraw_caps
.fx_caps
= fx_caps
;
2164 caps
->ddraw_caps
.svb_caps
= blit_caps
;
2165 caps
->ddraw_caps
.svb_color_key_caps
= ckey_caps
;
2166 caps
->ddraw_caps
.svb_fx_caps
= fx_caps
;
2167 caps
->ddraw_caps
.vsb_caps
= blit_caps
;
2168 caps
->ddraw_caps
.vsb_color_key_caps
= ckey_caps
;
2169 caps
->ddraw_caps
.vsb_fx_caps
= fx_caps
;
2170 caps
->ddraw_caps
.ssb_caps
= blit_caps
;
2171 caps
->ddraw_caps
.ssb_color_key_caps
= ckey_caps
;
2172 caps
->ddraw_caps
.ssb_fx_caps
= fx_caps
;
2174 caps
->ddraw_caps
.dds_caps
= WINEDDSCAPS_ALPHA
2175 | WINEDDSCAPS_BACKBUFFER
2177 | WINEDDSCAPS_FRONTBUFFER
2178 | WINEDDSCAPS_OFFSCREENPLAIN
2179 | WINEDDSCAPS_PALETTE
2180 | WINEDDSCAPS_PRIMARYSURFACE
2181 | WINEDDSCAPS_SYSTEMMEMORY
2182 | WINEDDSCAPS_VISIBLE
;
2184 caps
->shader_double_precision
= d3d_info
->shader_double_precision
;
2185 caps
->viewport_array_index_any_shader
= d3d_info
->viewport_array_index_any_shader
;
2187 caps
->max_feature_level
= d3d_info
->feature_level
;
2189 adapter
->adapter_ops
->adapter_get_wined3d_caps(adapter
, caps
);
2194 HRESULT CDECL
wined3d_device_create(struct wined3d
*wined3d
, unsigned int adapter_idx
,
2195 enum wined3d_device_type device_type
, HWND focus_window
, DWORD flags
, BYTE surface_alignment
,
2196 const enum wined3d_feature_level
*feature_levels
, unsigned int feature_level_count
,
2197 struct wined3d_device_parent
*device_parent
, struct wined3d_device
**device
)
2199 const struct wined3d_adapter
*adapter
;
2200 struct wined3d_device
*object
;
2203 TRACE("wined3d %p, adapter_idx %u, device_type %#x, focus_window %p, flags %#x, "
2204 "surface_alignment %u, feature_levels %p, feature_level_count %u, device_parent %p, device %p.\n",
2205 wined3d
, adapter_idx
, device_type
, focus_window
, flags
, surface_alignment
,
2206 feature_levels
, feature_level_count
, device_parent
, device
);
2208 if (adapter_idx
>= wined3d
->adapter_count
)
2209 return WINED3DERR_INVALIDCALL
;
2211 adapter
= wined3d
->adapters
[adapter_idx
];
2212 if (FAILED(hr
= adapter
->adapter_ops
->adapter_create_device(wined3d
, adapter
,
2213 device_type
, focus_window
, flags
, surface_alignment
,
2214 feature_levels
, feature_level_count
, device_parent
, &object
)))
2217 TRACE("Created device %p.\n", object
);
2220 device_parent
->ops
->wined3d_device_created(device_parent
, *device
);
2225 static void adapter_no3d_destroy(struct wined3d_adapter
*adapter
)
2227 wined3d_adapter_cleanup(adapter
);
2231 static HRESULT
adapter_no3d_create_device(struct wined3d
*wined3d
, const struct wined3d_adapter
*adapter
,
2232 enum wined3d_device_type device_type
, HWND focus_window
, unsigned int flags
, BYTE surface_alignment
,
2233 const enum wined3d_feature_level
*levels
, unsigned int level_count
,
2234 struct wined3d_device_parent
*device_parent
, struct wined3d_device
**device
)
2236 struct wined3d_device
*object
;
2239 if (!(object
= heap_alloc_zero(sizeof(*object
))))
2240 return E_OUTOFMEMORY
;
2242 if (FAILED(hr
= wined3d_device_init(object
, wined3d
, adapter
->ordinal
, device_type
,
2243 focus_window
, flags
, surface_alignment
, levels
, level_count
, device_parent
)))
2245 WARN("Failed to initialize device, hr %#x.\n", hr
);
2254 static void adapter_no3d_destroy_device(struct wined3d_device
*device
)
2256 wined3d_device_cleanup(device
);
2260 static BOOL
wined3d_adapter_no3d_create_context(struct wined3d_context
*context
,
2261 struct wined3d_texture
*target
, const struct wined3d_format
*ds_format
)
2266 static void adapter_no3d_get_wined3d_caps(const struct wined3d_adapter
*adapter
, struct wined3d_caps
*caps
)
2270 static BOOL
adapter_no3d_check_format(const struct wined3d_adapter
*adapter
,
2271 const struct wined3d_format
*adapter_format
, const struct wined3d_format
*rt_format
,
2272 const struct wined3d_format
*ds_format
)
2277 static const struct wined3d_adapter_ops wined3d_adapter_no3d_ops
=
2279 adapter_no3d_destroy
,
2280 adapter_no3d_create_device
,
2281 adapter_no3d_destroy_device
,
2282 wined3d_adapter_no3d_create_context
,
2283 adapter_no3d_get_wined3d_caps
,
2284 adapter_no3d_check_format
,
2287 static void wined3d_adapter_no3d_init_d3d_info(struct wined3d_adapter
*adapter
, unsigned int wined3d_creation_flags
)
2289 struct wined3d_d3d_info
*d3d_info
= &adapter
->d3d_info
;
2291 d3d_info
->wined3d_creation_flags
= wined3d_creation_flags
;
2292 d3d_info
->texture_npot
= TRUE
;
2293 d3d_info
->feature_level
= WINED3D_FEATURE_LEVEL_5
;
2296 static struct wined3d_adapter
*wined3d_adapter_no3d_create(unsigned int ordinal
, unsigned int wined3d_creation_flags
)
2298 struct wined3d_adapter
*adapter
;
2300 static const struct wined3d_gpu_description gpu_description
=
2302 HW_VENDOR_SOFTWARE
, CARD_WINE
, "WineD3D DirectDraw Emulation", DRIVER_WINE
, 128,
2305 TRACE("ordinal %u, wined3d_creation_flags %#x.\n", ordinal
, wined3d_creation_flags
);
2307 if (!(adapter
= heap_alloc_zero(sizeof(*adapter
))))
2310 wined3d_driver_info_init(&adapter
->driver_info
, &gpu_description
, 0);
2311 adapter
->vram_bytes_used
= 0;
2312 TRACE("Emulating 0x%s bytes of video ram.\n", wine_dbgstr_longlong(adapter
->driver_info
.vram_bytes
));
2314 if (!wined3d_adapter_init(adapter
, ordinal
, &wined3d_adapter_no3d_ops
))
2320 if (!wined3d_adapter_no3d_init_format_info(adapter
))
2326 adapter
->vertex_pipe
= &none_vertex_pipe
;
2327 adapter
->fragment_pipe
= &none_fragment_pipe
;
2328 adapter
->shader_backend
= &none_shader_backend
;
2330 wined3d_adapter_no3d_init_d3d_info(adapter
, wined3d_creation_flags
);
2332 TRACE("Created adapter %p.\n", adapter
);
2337 BOOL
wined3d_adapter_init(struct wined3d_adapter
*adapter
, unsigned int ordinal
,
2338 const struct wined3d_adapter_ops
*adapter_ops
)
2340 DISPLAY_DEVICEW display_device
;
2342 adapter
->ordinal
= ordinal
;
2344 display_device
.cb
= sizeof(display_device
);
2345 EnumDisplayDevicesW(NULL
, ordinal
, &display_device
, 0);
2346 TRACE("Display device: %s.\n", debugstr_w(display_device
.DeviceName
));
2347 strcpyW(adapter
->device_name
, display_device
.DeviceName
);
2349 if (!AllocateLocallyUniqueId(&adapter
->luid
))
2351 ERR("Failed to set adapter LUID (%#x).\n", GetLastError());
2354 TRACE("Allocated LUID %08x:%08x for adapter %p.\n",
2355 adapter
->luid
.HighPart
, adapter
->luid
.LowPart
, adapter
);
2357 memset(&adapter
->driver_uuid
, 0, sizeof(adapter
->driver_uuid
));
2358 memset(&adapter
->device_uuid
, 0, sizeof(adapter
->device_uuid
));
2360 adapter
->formats
= NULL
;
2361 adapter
->adapter_ops
= adapter_ops
;
2366 static struct wined3d_adapter
*wined3d_adapter_create(unsigned int ordinal
, DWORD wined3d_creation_flags
)
2368 if (wined3d_creation_flags
& WINED3D_NO3D
)
2369 return wined3d_adapter_no3d_create(ordinal
, wined3d_creation_flags
);
2371 if (wined3d_settings
.renderer
== WINED3D_RENDERER_VULKAN
)
2372 return wined3d_adapter_vk_create(ordinal
, wined3d_creation_flags
);
2374 return wined3d_adapter_gl_create(ordinal
, wined3d_creation_flags
);
2377 static void STDMETHODCALLTYPE
wined3d_null_wined3d_object_destroyed(void *parent
) {}
2379 const struct wined3d_parent_ops wined3d_null_parent_ops
=
2381 wined3d_null_wined3d_object_destroyed
,
2384 HRESULT
wined3d_init(struct wined3d
*wined3d
, DWORD flags
)
2387 wined3d
->flags
= flags
;
2389 TRACE("Initialising adapters.\n");
2391 if (!(wined3d
->adapters
[0] = wined3d_adapter_create(0, flags
)))
2393 WARN("Failed to create adapter.\n");
2396 wined3d
->adapter_count
= 1;