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
24 #include "wined3d_private.h"
25 #include "wined3d_gl.h"
27 #include "wine/list.h"
29 WINE_DEFAULT_DEBUG_CHANNEL(d3d
);
30 WINE_DECLARE_DEBUG_CHANNEL(winediag
);
32 #define DEFAULT_REFRESH_RATE 0
34 enum wined3d_driver_model
43 struct wined3d_adapter_budget_change_notification
45 const struct wined3d_adapter
*adapter
;
48 UINT64 last_local_budget
;
49 UINT64 last_non_local_budget
;
53 static struct list adapter_budget_change_notifications
= LIST_INIT( adapter_budget_change_notifications
);
54 static HANDLE notification_thread
, notification_thread_stop_event
;
56 /* The d3d device ID */
57 static const GUID IID_D3DDEVICE_D3DUID
= { 0xaeb2cdd4, 0x6e41, 0x43ea, { 0x94,0x1c,0x83,0x61,0xcc,0x76,0x07,0x81 } };
59 /**********************************************************
60 * Utility functions follow
61 **********************************************************/
63 const struct min_lookup minMipLookup
[] =
65 /* NONE POINT LINEAR */
66 {{GL_NEAREST
, GL_NEAREST
, GL_NEAREST
}}, /* NONE */
67 {{GL_NEAREST
, GL_NEAREST_MIPMAP_NEAREST
, GL_NEAREST_MIPMAP_LINEAR
}}, /* POINT*/
68 {{GL_LINEAR
, GL_LINEAR_MIPMAP_NEAREST
, GL_LINEAR_MIPMAP_LINEAR
}}, /* LINEAR */
71 const GLenum magLookup
[] =
73 /* NONE POINT LINEAR */
74 GL_NEAREST
, GL_NEAREST
, GL_LINEAR
,
77 void CDECL
wined3d_output_release_ownership(const struct wined3d_output
*output
)
79 D3DKMT_SETVIDPNSOURCEOWNER set_owner_desc
= {0};
81 TRACE("output %p.\n", output
);
83 set_owner_desc
.hDevice
= output
->kmt_device
;
84 D3DKMTSetVidPnSourceOwner(&set_owner_desc
);
87 HRESULT CDECL
wined3d_output_take_ownership(const struct wined3d_output
*output
, BOOL exclusive
)
89 D3DKMT_SETVIDPNSOURCEOWNER set_owner_desc
;
90 D3DKMT_VIDPNSOURCEOWNER_TYPE owner_type
;
93 TRACE("output %p, exclusive %#x.\n", output
, exclusive
);
95 owner_type
= exclusive
? D3DKMT_VIDPNSOURCEOWNER_EXCLUSIVE
: D3DKMT_VIDPNSOURCEOWNER_SHARED
;
96 set_owner_desc
.pType
= &owner_type
;
97 set_owner_desc
.pVidPnSourceId
= &output
->vidpn_source_id
;
98 set_owner_desc
.VidPnSourceCount
= 1;
99 set_owner_desc
.hDevice
= output
->kmt_device
;
100 status
= D3DKMTSetVidPnSourceOwner(&set_owner_desc
);
104 case STATUS_GRAPHICS_VIDPN_SOURCE_IN_USE
:
105 return DXGI_ERROR_NOT_CURRENTLY_AVAILABLE
;
106 case STATUS_INVALID_PARAMETER
:
108 case STATUS_PROCEDURE_NOT_FOUND
:
109 return E_NOINTERFACE
;
113 FIXME("Unhandled error %#lx.\n", status
);
118 static void wined3d_output_cleanup(const struct wined3d_output
*output
)
120 D3DKMT_DESTROYDEVICE destroy_device_desc
;
122 TRACE("output %p.\n", output
);
124 destroy_device_desc
.hDevice
= output
->kmt_device
;
125 D3DKMTDestroyDevice(&destroy_device_desc
);
128 static HRESULT
wined3d_output_init(struct wined3d_output
*output
, unsigned int ordinal
,
129 struct wined3d_adapter
*adapter
, const WCHAR
*device_name
)
131 D3DKMT_OPENADAPTERFROMGDIDISPLAYNAME open_adapter_desc
;
132 D3DKMT_CREATEDEVICE create_device_desc
= {{0}};
133 D3DKMT_CLOSEADAPTER close_adapter_desc
;
135 TRACE("output %p, device_name %s.\n", output
, wine_dbgstr_w(device_name
));
137 lstrcpyW(open_adapter_desc
.DeviceName
, device_name
);
138 if (D3DKMTOpenAdapterFromGdiDisplayName(&open_adapter_desc
))
140 close_adapter_desc
.hAdapter
= open_adapter_desc
.hAdapter
;
141 D3DKMTCloseAdapter(&close_adapter_desc
);
143 create_device_desc
.hAdapter
= adapter
->kmt_adapter
;
144 if (D3DKMTCreateDevice(&create_device_desc
))
147 output
->ordinal
= ordinal
;
148 lstrcpyW(output
->device_name
, device_name
);
149 output
->adapter
= adapter
;
150 output
->screen_format
= WINED3DFMT_UNKNOWN
;
151 output
->kmt_device
= create_device_desc
.hDevice
;
152 output
->vidpn_source_id
= open_adapter_desc
.VidPnSourceId
;
157 /* Adjust the amount of used texture memory */
158 UINT64
adapter_adjust_memory(struct wined3d_adapter
*adapter
, INT64 amount
)
160 adapter
->vram_bytes_used
+= amount
;
161 TRACE("Adjusted used adapter memory by 0x%s to 0x%s.\n",
162 wine_dbgstr_longlong(amount
),
163 wine_dbgstr_longlong(adapter
->vram_bytes_used
));
164 return adapter
->vram_bytes_used
;
167 ssize_t
adapter_adjust_mapped_memory(struct wined3d_adapter
*adapter
, ssize_t size
)
169 /* Note that this needs to be thread-safe; the Vulkan adapter may map from
171 ssize_t ret
= InterlockedExchangeAddSizeT(&adapter
->mapped_size
, size
) + size
;
172 TRACE("Adjusted mapped adapter memory by %Id to %Id.\n", size
, ret
);
176 void wined3d_adapter_cleanup(struct wined3d_adapter
*adapter
)
178 D3DKMT_CLOSEADAPTER close_adapter_desc
;
179 unsigned int output_idx
;
181 for (output_idx
= 0; output_idx
< adapter
->output_count
; ++output_idx
)
182 wined3d_output_cleanup(&adapter
->outputs
[output_idx
]);
183 free(adapter
->outputs
);
184 free(adapter
->formats
);
185 close_adapter_desc
.hAdapter
= adapter
->kmt_adapter
;
186 D3DKMTCloseAdapter(&close_adapter_desc
);
189 ULONG CDECL
wined3d_incref(struct wined3d
*wined3d
)
191 unsigned int refcount
= InterlockedIncrement(&wined3d
->ref
);
193 TRACE("%p increasing refcount to %u.\n", wined3d
, refcount
);
198 ULONG CDECL
wined3d_decref(struct wined3d
*wined3d
)
200 unsigned int refcount
= InterlockedDecrement(&wined3d
->ref
);
202 TRACE("%p decreasing refcount to %u.\n", wined3d
, refcount
);
208 wined3d_mutex_lock();
209 for (i
= 0; i
< wined3d
->adapter_count
; ++i
)
211 struct wined3d_adapter
*adapter
= wined3d
->adapters
[i
];
213 adapter
->adapter_ops
->adapter_destroy(adapter
);
216 wined3d_mutex_unlock();
222 /* Certain applications (e.g. Steam) complain if we report an outdated driver
225 * The driver version has the form "x.y.z.w".
227 * "x" is the Windows version / driver model the driver is meant for:
231 * 7 -> Vista - WDDM 1.0
232 * 8 -> Windows 7 - WDDM 1.1
233 * 9 -> Windows 8 - WDDM 1.2
234 * 10 -> Windows 8.1 - WDDM 1.3
235 * 20 -> Windows 10 - WDDM 2.0
236 * 21 -> Windows 10 Anniversary Update - WDDM 2.1
237 * 22 -> Windows 10 Creators Update - WDDM 2.2
238 * 23 -> Windows 10 Fall Creators Update - WDDM 2.3
239 * 24 -> Windows 10 April 2018 Update - WDDM 2.4
240 * 25 -> Windows 10 October 2018 Update - WDDM 2.5
241 * 26 -> Windows 10 May 2019 Update - WDDM 2.6
242 * 27 -> Windows 10 May 2020 Update - WDDM 2.7
243 * 30 -> Windows 11 21H2 - WDDM 3.0
244 * 31 -> Windows 11 22H2 - WDDM 3.1
246 * "y" is the maximum Direct3D version / feature level the driver supports.
259 * "z" is the subversion number.
261 * "w" is the vendor specific driver build number.
263 * In practice the reported version is tied to the driver, not the actual
264 * Windows version or feature level. E.g. NVIDIA driver 445.87 advertises the
265 * exact same version 26.21.14.4587 on Windows 7 as it does on Windows 10
266 * (it's in fact the same driver). Similarly for driver 310.90 that advertises
267 * itself as 9.18.13.1090 on Windows Vista with a GeForce 9600M. */
269 struct driver_version_information
271 enum wined3d_display_driver driver
;
272 enum wined3d_driver_model driver_model
;
273 const char *driver_name
; /* name of Windows driver */
274 WORD subversion
; /* subversion word ('z'), contained in high word of DriverVersion.LowPart */
275 WORD build
; /* build number ('w'), contained in low word of DriverVersion.LowPart */
278 /* The driver version table contains driver information for different devices on several OS versions. */
279 static const struct driver_version_information driver_version_table
[] =
282 * - Radeon HD2x00 (R600) and up supported by current drivers.
283 * - Radeon 9500 (R300) - X1*00 (R5xx) supported up to Catalyst 9.3 (Linux) and 10.2 (XP/Vista/Win7)
284 * - Radeon 7xxx (R100) - 9250 (RV250) supported up to Catalyst 6.11 (XP)
285 * - Rage 128 supported up to XP, latest official build 6.13.3279 dated October 2001 */
286 {DRIVER_AMD_RAGE_128PRO
, DRIVER_MODEL_NT5X
, "ati2dvaa.dll", 3279, 0},
287 {DRIVER_AMD_R100
, DRIVER_MODEL_NT5X
, "ati2dvag.dll", 10, 6614},
288 {DRIVER_AMD_R300
, DRIVER_MODEL_NT5X
, "ati2dvag.dll", 10, 6764},
289 {DRIVER_AMD_R600
, DRIVER_MODEL_NT5X
, "ati2dvag.dll", 10, 1280},
290 {DRIVER_AMD_R300
, DRIVER_MODEL_NT6X
, "atiumdag.dll", 10, 741 },
291 {DRIVER_AMD_R600
, DRIVER_MODEL_NT6X
, "atiumdag.dll", 10, 1280},
292 {DRIVER_AMD_RX
, DRIVER_MODEL_NT6X
, "aticfx32.dll", 23013, 1023}, /* Adrenalin 23.12.1 */
295 * The drivers are unified but not all versions support all GPUs. At some point the 2k/xp
296 * drivers used ialmrnt5.dll for GMA800/GMA900 but at some point the file was renamed to
297 * igxprd32.dll but the GMA800 driver was never updated. */
298 {DRIVER_INTEL_GMA800
, DRIVER_MODEL_NT5X
, "ialmrnt5.dll", 10, 3889},
299 {DRIVER_INTEL_GMA900
, DRIVER_MODEL_NT5X
, "igxprd32.dll", 10, 4764},
300 {DRIVER_INTEL_GMA950
, DRIVER_MODEL_NT5X
, "igxprd32.dll", 10, 4926},
301 {DRIVER_INTEL_GMA3000
, DRIVER_MODEL_NT5X
, "igxprd32.dll", 10, 5218},
302 {DRIVER_INTEL_GMA950
, DRIVER_MODEL_NT6X
, "igdumd32.dll", 10, 1504},
303 {DRIVER_INTEL_GMA3000
, DRIVER_MODEL_NT6X
, "igdumd32.dll", 10, 1666},
304 {DRIVER_INTEL_HD4000
, DRIVER_MODEL_NT6X
, "igdumdim32.dll", 101, 4577},
307 * - Geforce8 and newer is supported by the current 340.52 driver on XP-Win8
308 * - Geforce6 and 7 support is up to 307.83 on XP-Win8
309 * - GeforceFX support is up to 173.x on <= XP
310 * - Geforce2MX/3/4 up to 96.x on <= XP
311 * - TNT/Geforce1/2 up to 71.x on <= XP
312 * All version numbers used below are from the Linux nvidia drivers. */
313 {DRIVER_NVIDIA_TNT
, DRIVER_MODEL_NT5X
, "nv4_disp.dll", 10, 7186},
314 {DRIVER_NVIDIA_GEFORCE2MX
, DRIVER_MODEL_NT5X
, "nv4_disp.dll", 10, 9371},
315 {DRIVER_NVIDIA_GEFORCEFX
, DRIVER_MODEL_NT5X
, "nv4_disp.dll", 11, 7516},
316 {DRIVER_NVIDIA_GEFORCE6
, DRIVER_MODEL_NT5X
, "nv4_disp.dll", 13, 783},
317 {DRIVER_NVIDIA_GEFORCE8
, DRIVER_MODEL_NT5X
, "nv4_disp.dll", 13, 4052},
318 {DRIVER_NVIDIA_GEFORCE6
, DRIVER_MODEL_NT6X
, "nvd3dum.dll", 13, 783},
319 {DRIVER_NVIDIA_GEFORCE8
, DRIVER_MODEL_NT6X
, "nvd3dum.dll", 13, 4052},
320 {DRIVER_NVIDIA_FERMI
, DRIVER_MODEL_NT6X
, "nvd3dum.dll", 13, 9135},
321 {DRIVER_NVIDIA_KEPLER
, DRIVER_MODEL_NT6X
, "nvd3dum.dll", 15, 3118}, /* 531.18 */
324 {DRIVER_REDHAT_VIRGL
, DRIVER_MODEL_GENERIC
, "virgl.dll", 0, 0},
327 {DRIVER_VMWARE
, DRIVER_MODEL_NT5X
, "vm3dum.dll", 1, 1134},
330 {DRIVER_WINE
, DRIVER_MODEL_GENERIC
, "wined3d.dll", 0, 0},
333 /* The amount of video memory stored in the gpu description table is the minimum amount of video memory
334 * found on a board containing a specific GPU. */
335 static const struct wined3d_gpu_description gpu_description_table
[] =
338 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_RIVA_128
, "NVIDIA RIVA 128", DRIVER_NVIDIA_TNT
, 4 },
339 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_RIVA_TNT
, "NVIDIA RIVA TNT", DRIVER_NVIDIA_TNT
, 16 },
340 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_RIVA_TNT2
, "NVIDIA RIVA TNT2/TNT2 Pro", DRIVER_NVIDIA_TNT
, 32 },
341 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE
, "NVIDIA GeForce 256", DRIVER_NVIDIA_TNT
, 32 },
342 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE2
, "NVIDIA GeForce2 GTS/GeForce2 Pro", DRIVER_NVIDIA_TNT
, 32 },
343 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE2_MX
, "NVIDIA GeForce2 MX/MX 400", DRIVER_NVIDIA_GEFORCE2MX
,32 },
344 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE3
, "NVIDIA GeForce3", DRIVER_NVIDIA_GEFORCE2MX
,64 },
345 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE4_MX
, "NVIDIA GeForce4 MX 460", DRIVER_NVIDIA_GEFORCE2MX
,64 },
346 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE4_TI4200
, "NVIDIA GeForce4 Ti 4200", DRIVER_NVIDIA_GEFORCE2MX
,64, },
347 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCEFX_5200
, "NVIDIA GeForce FX 5200", DRIVER_NVIDIA_GEFORCEFX
, 64 },
348 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCEFX_5600
, "NVIDIA GeForce FX 5600", DRIVER_NVIDIA_GEFORCEFX
, 128 },
349 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCEFX_5800
, "NVIDIA GeForce FX 5800", DRIVER_NVIDIA_GEFORCEFX
, 256 },
350 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_6200
, "NVIDIA GeForce 6200", DRIVER_NVIDIA_GEFORCE6
, 64 },
351 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_6600GT
, "NVIDIA GeForce 6600 GT", DRIVER_NVIDIA_GEFORCE6
, 128 },
352 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_6800
, "NVIDIA GeForce 6800", DRIVER_NVIDIA_GEFORCE6
, 128 },
353 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_7300
, "NVIDIA GeForce Go 7300", DRIVER_NVIDIA_GEFORCE6
, 256 },
354 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_7400
, "NVIDIA GeForce Go 7400", DRIVER_NVIDIA_GEFORCE6
, 256 },
355 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_7600
, "NVIDIA GeForce 7600 GT", DRIVER_NVIDIA_GEFORCE6
, 256 },
356 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_7800GT
, "NVIDIA GeForce 7800 GT", DRIVER_NVIDIA_GEFORCE6
, 256 },
357 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_8200
, "NVIDIA GeForce 8200", DRIVER_NVIDIA_GEFORCE8
, 512 },
358 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_8300GS
, "NVIDIA GeForce 8300 GS", DRIVER_NVIDIA_GEFORCE8
, 128 },
359 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_8400GS
, "NVIDIA GeForce 8400 GS", DRIVER_NVIDIA_GEFORCE8
, 128 },
360 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_8500GT
, "NVIDIA GeForce 8500 GT", DRIVER_NVIDIA_GEFORCE8
, 256 },
361 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_8600GT
, "NVIDIA GeForce 8600 GT", DRIVER_NVIDIA_GEFORCE8
, 256 },
362 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_8600MGT
, "NVIDIA GeForce 8600M GT", DRIVER_NVIDIA_GEFORCE8
, 512 },
363 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_8800GTS
, "NVIDIA GeForce 8800 GTS", DRIVER_NVIDIA_GEFORCE8
, 320 },
364 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_8800GTX
, "NVIDIA GeForce 8800 GTX", DRIVER_NVIDIA_GEFORCE8
, 768 },
365 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_9200
, "NVIDIA GeForce 9200", DRIVER_NVIDIA_GEFORCE8
, 256 },
366 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_9300
, "NVIDIA GeForce 9300", DRIVER_NVIDIA_GEFORCE8
, 256 },
367 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_9400M
, "NVIDIA GeForce 9400M", DRIVER_NVIDIA_GEFORCE8
, 256 },
368 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_9400GT
, "NVIDIA GeForce 9400 GT", DRIVER_NVIDIA_GEFORCE8
, 256 },
369 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_9500GT
, "NVIDIA GeForce 9500 GT", DRIVER_NVIDIA_GEFORCE8
, 256 },
370 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_9600GT
, "NVIDIA GeForce 9600 GT", DRIVER_NVIDIA_GEFORCE8
, 512 },
371 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_9700MGT
, "NVIDIA GeForce 9700M GT", DRIVER_NVIDIA_GEFORCE8
, 512 },
372 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_9800GT
, "NVIDIA GeForce 9800 GT", DRIVER_NVIDIA_GEFORCE8
, 512 },
373 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_210
, "NVIDIA GeForce 210", DRIVER_NVIDIA_GEFORCE8
, 512 },
374 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT220
, "NVIDIA GeForce GT 220", DRIVER_NVIDIA_GEFORCE8
, 512 },
375 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT240
, "NVIDIA GeForce GT 240", DRIVER_NVIDIA_GEFORCE8
, 512 },
376 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTS250
, "NVIDIA GeForce GTS 250", DRIVER_NVIDIA_GEFORCE8
, 1024},
377 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX260
, "NVIDIA GeForce GTX 260", DRIVER_NVIDIA_GEFORCE8
, 1024},
378 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX275
, "NVIDIA GeForce GTX 275", DRIVER_NVIDIA_GEFORCE8
, 896 },
379 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX280
, "NVIDIA GeForce GTX 280", DRIVER_NVIDIA_GEFORCE8
, 1024},
380 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_315M
, "NVIDIA GeForce 315M", DRIVER_NVIDIA_GEFORCE8
, 512 },
381 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_320M
, "NVIDIA GeForce 320M", DRIVER_NVIDIA_GEFORCE8
, 256},
382 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT320M
, "NVIDIA GeForce GT 320M", DRIVER_NVIDIA_GEFORCE8
, 1024},
383 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT325M
, "NVIDIA GeForce GT 325M", DRIVER_NVIDIA_GEFORCE8
, 1024},
384 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT330
, "NVIDIA GeForce GT 330", DRIVER_NVIDIA_GEFORCE8
, 1024},
385 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTS350M
, "NVIDIA GeForce GTS 350M", DRIVER_NVIDIA_GEFORCE8
, 1024},
386 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_410M
, "NVIDIA GeForce 410M", DRIVER_NVIDIA_FERMI
, 512},
387 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT420
, "NVIDIA GeForce GT 420", DRIVER_NVIDIA_FERMI
, 2048},
388 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT425M
, "NVIDIA GeForce GT 425M", DRIVER_NVIDIA_FERMI
, 1024},
389 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT430
, "NVIDIA GeForce GT 430", DRIVER_NVIDIA_FERMI
, 1024},
390 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT440
, "NVIDIA GeForce GT 440", DRIVER_NVIDIA_FERMI
, 1024},
391 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTS450
, "NVIDIA GeForce GTS 450", DRIVER_NVIDIA_FERMI
, 1024},
392 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX460
, "NVIDIA GeForce GTX 460", DRIVER_NVIDIA_FERMI
, 768 },
393 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX460M
, "NVIDIA GeForce GTX 460M", DRIVER_NVIDIA_FERMI
, 1536},
394 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX465
, "NVIDIA GeForce GTX 465", DRIVER_NVIDIA_FERMI
, 1024},
395 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX470
, "NVIDIA GeForce GTX 470", DRIVER_NVIDIA_FERMI
, 1280},
396 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX480
, "NVIDIA GeForce GTX 480", DRIVER_NVIDIA_FERMI
, 1536},
397 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT520
, "NVIDIA GeForce GT 520", DRIVER_NVIDIA_FERMI
, 1024},
398 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT525M
, "NVIDIA GeForce GT 525M", DRIVER_NVIDIA_FERMI
, 1024},
399 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT540M
, "NVIDIA GeForce GT 540M", DRIVER_NVIDIA_FERMI
, 1024},
400 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX550
, "NVIDIA GeForce GTX 550 Ti", DRIVER_NVIDIA_FERMI
, 1024},
401 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT555M
, "NVIDIA GeForce GT 555M", DRIVER_NVIDIA_FERMI
, 1024},
402 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX560TI
, "NVIDIA GeForce GTX 560 Ti", DRIVER_NVIDIA_FERMI
, 1024},
403 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX560M
, "NVIDIA GeForce GTX 560M", DRIVER_NVIDIA_FERMI
, 3072},
404 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX560
, "NVIDIA GeForce GTX 560", DRIVER_NVIDIA_FERMI
, 1024},
405 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX570
, "NVIDIA GeForce GTX 570", DRIVER_NVIDIA_FERMI
, 1280},
406 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX580
, "NVIDIA GeForce GTX 580", DRIVER_NVIDIA_FERMI
, 1536},
407 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT610
, "NVIDIA GeForce GT 610", DRIVER_NVIDIA_FERMI
, 1024},
408 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT630
, "NVIDIA GeForce GT 630", DRIVER_NVIDIA_KEPLER
, 1024},
409 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT630M
, "NVIDIA GeForce GT 630M", DRIVER_NVIDIA_FERMI
, 1024},
410 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT640
, "NVIDIA GeForce GT 640", DRIVER_NVIDIA_KEPLER
, 1024},
411 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT640M
, "NVIDIA GeForce GT 640M", DRIVER_NVIDIA_KEPLER
, 1024},
412 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT650M
, "NVIDIA GeForce GT 650M", DRIVER_NVIDIA_KEPLER
, 2048},
413 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX650
, "NVIDIA GeForce GTX 650", DRIVER_NVIDIA_KEPLER
, 1024},
414 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX650TI
, "NVIDIA GeForce GTX 650 Ti", DRIVER_NVIDIA_KEPLER
, 1024},
415 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX660
, "NVIDIA GeForce GTX 660", DRIVER_NVIDIA_KEPLER
, 2048},
416 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX660M
, "NVIDIA GeForce GTX 660M", DRIVER_NVIDIA_KEPLER
, 2048},
417 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX660TI
, "NVIDIA GeForce GTX 660 Ti", DRIVER_NVIDIA_KEPLER
, 2048},
418 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX670
, "NVIDIA GeForce GTX 670", DRIVER_NVIDIA_KEPLER
, 2048},
419 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX670MX
, "NVIDIA GeForce GTX 670MX", DRIVER_NVIDIA_KEPLER
, 3072},
420 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX675MX_1
, "NVIDIA GeForce GTX 675MX", DRIVER_NVIDIA_KEPLER
, 4096},
421 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX675MX_2
, "NVIDIA GeForce GTX 675MX", DRIVER_NVIDIA_KEPLER
, 2048},
422 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX680
, "NVIDIA GeForce GTX 680", DRIVER_NVIDIA_KEPLER
, 2048},
423 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX690
, "NVIDIA GeForce GTX 690", DRIVER_NVIDIA_KEPLER
, 2048},
424 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT720
, "NVIDIA GeForce GT 720", DRIVER_NVIDIA_KEPLER
, 2048},
425 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT730
, "NVIDIA GeForce GT 730", DRIVER_NVIDIA_KEPLER
, 2048},
426 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT730M
, "NVIDIA GeForce GT 730M", DRIVER_NVIDIA_KEPLER
, 1024},
427 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT740M
, "NVIDIA GeForce GT 740M", DRIVER_NVIDIA_KEPLER
, 2048},
428 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT750M
, "NVIDIA GeForce GT 750M", DRIVER_NVIDIA_KEPLER
, 1024},
429 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT755M
, "NVIDIA GeForce GT 755M", DRIVER_NVIDIA_KEPLER
, 1024},
430 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX750
, "NVIDIA GeForce GTX 750", DRIVER_NVIDIA_KEPLER
, 1024},
431 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX750TI
, "NVIDIA GeForce GTX 750 Ti", DRIVER_NVIDIA_KEPLER
, 2048},
432 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX760
, "NVIDIA GeForce GTX 760", DRIVER_NVIDIA_KEPLER
, 2048},
433 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX760TI
, "NVIDIA GeForce GTX 760 Ti", DRIVER_NVIDIA_KEPLER
, 2048},
434 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX765M
, "NVIDIA GeForce GTX 765M", DRIVER_NVIDIA_KEPLER
, 2048},
435 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX770M
, "NVIDIA GeForce GTX 770M", DRIVER_NVIDIA_KEPLER
, 3072},
436 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX770
, "NVIDIA GeForce GTX 770", DRIVER_NVIDIA_KEPLER
, 2048},
437 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX775M
, "NVIDIA GeForce GTX 775M", DRIVER_NVIDIA_KEPLER
, 3072},
438 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX780
, "NVIDIA GeForce GTX 780", DRIVER_NVIDIA_KEPLER
, 3072},
439 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX780M
, "NVIDIA GeForce GTX 780M", DRIVER_NVIDIA_KEPLER
, 4096},
440 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX780TI
, "NVIDIA GeForce GTX 780 Ti", DRIVER_NVIDIA_KEPLER
, 3072},
441 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTXTITAN
, "NVIDIA GeForce GTX TITAN", DRIVER_NVIDIA_KEPLER
, 6144},
442 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTXTITANB
, "NVIDIA GeForce GTX TITAN Black", DRIVER_NVIDIA_KEPLER
, 6144},
443 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTXTITANX
, "NVIDIA GeForce GTX TITAN X", DRIVER_NVIDIA_KEPLER
, 12288},
444 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTXTITANZ
, "NVIDIA GeForce GTX TITAN Z", DRIVER_NVIDIA_KEPLER
, 12288},
445 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_820M
, "NVIDIA GeForce 820M", DRIVER_NVIDIA_FERMI
, 2048},
446 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_830M
, "NVIDIA GeForce 830M", DRIVER_NVIDIA_KEPLER
, 2048},
447 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_840M
, "NVIDIA GeForce 840M", DRIVER_NVIDIA_KEPLER
, 2048},
448 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_845M
, "NVIDIA GeForce 845M", DRIVER_NVIDIA_KEPLER
, 2048},
449 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX850M
, "NVIDIA GeForce GTX 850M", DRIVER_NVIDIA_KEPLER
, 2048},
450 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX860M
, "NVIDIA GeForce GTX 860M", DRIVER_NVIDIA_KEPLER
, 2048},
451 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX870M
, "NVIDIA GeForce GTX 870M", DRIVER_NVIDIA_KEPLER
, 3072},
452 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX880M
, "NVIDIA GeForce GTX 880M", DRIVER_NVIDIA_KEPLER
, 4096},
453 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_940M
, "NVIDIA GeForce 940M", DRIVER_NVIDIA_KEPLER
, 4096},
454 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX950
, "NVIDIA GeForce GTX 950", DRIVER_NVIDIA_KEPLER
, 2048},
455 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX950M
, "NVIDIA GeForce GTX 950M", DRIVER_NVIDIA_KEPLER
, 4096},
456 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX960
, "NVIDIA GeForce GTX 960", DRIVER_NVIDIA_KEPLER
, 4096},
457 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX960M
, "NVIDIA GeForce GTX 960M", DRIVER_NVIDIA_KEPLER
, 2048},
458 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX970
, "NVIDIA GeForce GTX 970", DRIVER_NVIDIA_KEPLER
, 4096},
459 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX970M
, "NVIDIA GeForce GTX 970M", DRIVER_NVIDIA_KEPLER
, 3072},
460 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX980
, "NVIDIA GeForce GTX 980", DRIVER_NVIDIA_KEPLER
, 4096},
461 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX980TI
, "NVIDIA GeForce GTX 980 Ti", DRIVER_NVIDIA_KEPLER
, 6144},
462 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT1030
, "NVIDIA GeForce GT 1030", DRIVER_NVIDIA_KEPLER
, 2048},
463 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX1050
, "NVIDIA GeForce GTX 1050", DRIVER_NVIDIA_KEPLER
, 2048},
464 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX1050TI
, "NVIDIA GeForce GTX 1050 Ti", DRIVER_NVIDIA_KEPLER
, 4096},
465 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX1060_3GB
,"NVIDIA GeForce GTX 1060 3GB", DRIVER_NVIDIA_KEPLER
, 3072},
466 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX1060
, "NVIDIA GeForce GTX 1060", DRIVER_NVIDIA_KEPLER
, 6144},
467 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX1060M
, "NVIDIA GeForce GTX 1060M", DRIVER_NVIDIA_KEPLER
, 6144},
468 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX1070
, "NVIDIA GeForce GTX 1070", DRIVER_NVIDIA_KEPLER
, 8192},
469 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX1070M
, "NVIDIA GeForce GTX 1070M", DRIVER_NVIDIA_KEPLER
, 8192},
470 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX1080
, "NVIDIA GeForce GTX 1080", DRIVER_NVIDIA_KEPLER
, 8192},
471 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX1080M
, "NVIDIA GeForce GTX 1080M", DRIVER_NVIDIA_KEPLER
, 8192},
472 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX1080TI
, "NVIDIA GeForce GTX 1080 Ti", DRIVER_NVIDIA_KEPLER
, 11264},
473 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_TITANX_PASCAL
, "NVIDIA TITAN X (Pascal)", DRIVER_NVIDIA_KEPLER
, 12288},
474 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_TITANV
, "NVIDIA TITAN V", DRIVER_NVIDIA_KEPLER
, 12288},
475 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX1650
,"NVIDIA GeForce GTX 1650" , DRIVER_NVIDIA_KEPLER
, 4096},
476 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX1650SUPER
,"NVIDIA GeForce GTX 1650 SUPER", DRIVER_NVIDIA_KEPLER
, 4096},
477 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX1660SUPER
,"NVIDIA GeForce GTX 1660 SUPER", DRIVER_NVIDIA_KEPLER
, 6144},
478 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX1660TI
, "NVIDIA GeForce GTX 1660 Ti", DRIVER_NVIDIA_KEPLER
, 6144},
479 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_RTX2060
, "NVIDIA GeForce RTX 2060", DRIVER_NVIDIA_KEPLER
, 6144},
480 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_RTX2070
, "NVIDIA GeForce RTX 2070", DRIVER_NVIDIA_KEPLER
, 8192},
481 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_RTX2080
, "NVIDIA GeForce RTX 2080", DRIVER_NVIDIA_KEPLER
, 8192},
482 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_RTX2080TI
, "NVIDIA GeForce RTX 2080 Ti", DRIVER_NVIDIA_KEPLER
, 11264},
483 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_RTX3070
, "NVIDIA GeForce RTX 3070", DRIVER_NVIDIA_KEPLER
, 8192},
484 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_RTX3080
, "NVIDIA GeForce RTX 3080", DRIVER_NVIDIA_KEPLER
, 10240},
485 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_TESLA_T4
, "NVIDIA Tesla T4", DRIVER_NVIDIA_KEPLER
, 16384},
486 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_AMPERE_A10
, "NVIDIA Ampere A10", DRIVER_NVIDIA_KEPLER
, 24576},
489 {HW_VENDOR_AMD
, CARD_AMD_RAGE_128PRO
, "ATI Rage Fury", DRIVER_AMD_RAGE_128PRO
, 16 },
490 {HW_VENDOR_AMD
, CARD_AMD_RADEON_7200
, "ATI RADEON 7200 SERIES", DRIVER_AMD_R100
, 32 },
491 {HW_VENDOR_AMD
, CARD_AMD_RADEON_8500
, "ATI RADEON 8500 SERIES", DRIVER_AMD_R100
, 64 },
492 {HW_VENDOR_AMD
, CARD_AMD_RADEON_9500
, "ATI Radeon 9500", DRIVER_AMD_R300
, 64 },
493 {HW_VENDOR_AMD
, CARD_AMD_RADEON_XPRESS_200M
, "ATI RADEON XPRESS 200M Series", DRIVER_AMD_R300
, 64 },
494 {HW_VENDOR_AMD
, CARD_AMD_RADEON_X700
, "ATI Radeon X700 SE", DRIVER_AMD_R300
, 128 },
495 {HW_VENDOR_AMD
, CARD_AMD_RADEON_X1600
, "ATI Radeon X1600 Series", DRIVER_AMD_R300
, 128 },
496 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD2350
, "ATI Mobility Radeon HD 2350", DRIVER_AMD_R600
, 256 },
497 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD2600
, "ATI Mobility Radeon HD 2600", DRIVER_AMD_R600
, 256 },
498 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD2900
, "ATI Radeon HD 2900 XT", DRIVER_AMD_R600
, 512 },
499 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD3200
, "ATI Radeon HD 3200 Graphics", DRIVER_AMD_R600
, 128 },
500 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD3850
, "ATI Radeon HD 3850 AGP", DRIVER_AMD_R600
, 512 },
501 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD4200M
, "ATI Mobility Radeon HD 4200", DRIVER_AMD_R600
, 256 },
502 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD4350
, "ATI Radeon HD 4350", DRIVER_AMD_R600
, 256 },
503 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD4600
, "ATI Radeon HD 4600 Series", DRIVER_AMD_R600
, 512 },
504 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD4700
, "ATI Radeon HD 4700 Series", DRIVER_AMD_R600
, 512 },
505 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD4800
, "ATI Radeon HD 4800 Series", DRIVER_AMD_R600
, 512 },
506 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD5400
, "ATI Radeon HD 5400 Series", DRIVER_AMD_R600
, 512 },
507 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD5600
, "ATI Radeon HD 5600 Series", DRIVER_AMD_R600
, 512 },
508 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD5700
, "ATI Radeon HD 5700 Series", DRIVER_AMD_R600
, 512 },
509 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD5800
, "ATI Radeon HD 5800 Series", DRIVER_AMD_R600
, 1024},
510 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD5900
, "ATI Radeon HD 5900 Series", DRIVER_AMD_R600
, 1024},
511 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD6300
, "AMD Radeon HD 6300 series Graphics", DRIVER_AMD_R600
, 1024},
512 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD6400
, "AMD Radeon HD 6400 Series", DRIVER_AMD_R600
, 1024},
513 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD6410D
, "AMD Radeon HD 6410D", DRIVER_AMD_R600
, 1024},
514 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD6480G
, "AMD Radeon HD 6480G", DRIVER_AMD_R600
, 512 },
515 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD6490M
, "AMD Radeon HD 6490M", DRIVER_AMD_R600
, 1024},
516 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD6550D
, "AMD Radeon HD 6550D", DRIVER_AMD_R600
, 1024},
517 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD6600
, "AMD Radeon HD 6600 Series", DRIVER_AMD_R600
, 1024},
518 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD6600M
, "AMD Radeon HD 6600M Series", DRIVER_AMD_R600
, 512 },
519 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD6700
, "AMD Radeon HD 6700 Series", DRIVER_AMD_R600
, 1024},
520 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD6800
, "AMD Radeon HD 6800 Series", DRIVER_AMD_R600
, 1024},
521 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD6900
, "AMD Radeon HD 6900 Series", DRIVER_AMD_R600
, 2048},
522 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD7660D
, "AMD Radeon HD 7660D", DRIVER_AMD_R600
, 2048},
523 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD7700
, "AMD Radeon HD 7700 Series", DRIVER_AMD_R600
, 1024},
524 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD7800
, "AMD Radeon HD 7800 Series", DRIVER_AMD_R600
, 2048},
525 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD7870
, "AMD Radeon HD 7870 Series", DRIVER_AMD_R600
, 2048},
526 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD7900
, "AMD Radeon HD 7900 Series", DRIVER_AMD_R600
, 2048},
527 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD8600M
, "AMD Radeon HD 8600M Series", DRIVER_AMD_R600
, 1024},
528 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD8670
, "AMD Radeon HD 8670", DRIVER_AMD_R600
, 2048},
529 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD8770
, "AMD Radeon HD 8770", DRIVER_AMD_R600
, 2048},
530 {HW_VENDOR_AMD
, CARD_AMD_RADEON_R3
, "AMD Radeon HD 8400 / R3 Series", DRIVER_AMD_R600
, 2048},
531 {HW_VENDOR_AMD
, CARD_AMD_RADEON_R7
, "AMD Radeon(TM) R7 Graphics", DRIVER_AMD_R600
, 2048},
532 {HW_VENDOR_AMD
, CARD_AMD_RADEON_R9_285
, "AMD Radeon R9 285", DRIVER_AMD_RX
, 2048},
533 {HW_VENDOR_AMD
, CARD_AMD_RADEON_R9_290
, "AMD Radeon R9 290", DRIVER_AMD_RX
, 4096},
534 {HW_VENDOR_AMD
, CARD_AMD_RADEON_R9_290X
, "AMD Radeon R9 290X", DRIVER_AMD_RX
, 4096},
535 {HW_VENDOR_AMD
, CARD_AMD_RADEON_R9_FURY
, "AMD Radeon (TM) R9 Fury Series", DRIVER_AMD_RX
, 4096},
536 {HW_VENDOR_AMD
, CARD_AMD_RADEON_R9_M370X
, "AMD Radeon R9 M370X", DRIVER_AMD_RX
, 2048},
537 {HW_VENDOR_AMD
, CARD_AMD_RADEON_R9_M380
, "AMD Radeon R9 M380", DRIVER_AMD_RX
, 2048},
538 {HW_VENDOR_AMD
, CARD_AMD_RADEON_R9_M395X
, "AMD Radeon R9 M395X", DRIVER_AMD_RX
, 4096},
539 {HW_VENDOR_AMD
, CARD_AMD_RADEON_RX_460
, "Radeon(TM) RX 460 Graphics", DRIVER_AMD_RX
, 4096},
540 {HW_VENDOR_AMD
, CARD_AMD_RADEON_RX_480
, "Radeon (TM) RX 480 Graphics", DRIVER_AMD_RX
, 4096},
541 {HW_VENDOR_AMD
, CARD_AMD_RADEON_RX_VEGA_10
, "Radeon RX Vega", DRIVER_AMD_RX
, 8192},
542 {HW_VENDOR_AMD
, CARD_AMD_RADEON_RX_VEGA_12
, "Radeon Pro Vega 20", DRIVER_AMD_RX
, 4096},
543 {HW_VENDOR_AMD
, CARD_AMD_RADEON_RAVEN
, "AMD Radeon(TM) Vega 10 Mobile Graphics", DRIVER_AMD_RX
, 1024},
544 {HW_VENDOR_AMD
, CARD_AMD_RADEON_RX_VEGA_20
, "Radeon RX Vega 20", DRIVER_AMD_RX
, 4096},
545 {HW_VENDOR_AMD
, CARD_AMD_RADEON_RX_NAVI_10
, "Radeon RX 5700 / 5700 XT", DRIVER_AMD_RX
, 8192},
546 {HW_VENDOR_AMD
, CARD_AMD_RADEON_RX_NAVI_14
, "Radeon RX 5500M", DRIVER_AMD_RX
, 4096},
547 {HW_VENDOR_AMD
, CARD_AMD_RADEON_RX_NAVI_21
, "Radeon RX 6800/6800 XT / 6900 XT", DRIVER_AMD_RX
, 16384},
548 {HW_VENDOR_AMD
, CARD_AMD_RADEON_PRO_V620
, "Radeon Pro V620", DRIVER_AMD_RX
, 32768},
549 {HW_VENDOR_AMD
, CARD_AMD_RADEON_PRO_V620_VF
, "Radeon Pro V620 VF", DRIVER_AMD_RX
, 32768},
550 {HW_VENDOR_AMD
, CARD_AMD_VANGOGH
, "AMD VANGOGH", DRIVER_AMD_RX
, 4096},
551 {HW_VENDOR_AMD
, CARD_AMD_RAPHAEL
, "AMD Radeon(TM) Graphics", DRIVER_AMD_RX
, 4096},
554 {HW_VENDOR_REDHAT
, CARD_REDHAT_VIRGL
, "Red Hat VirtIO GPU", DRIVER_REDHAT_VIRGL
, 1024},
557 {HW_VENDOR_VMWARE
, CARD_VMWARE_SVGA3D
, "VMware SVGA 3D (Microsoft Corporation - WDDM)", DRIVER_VMWARE
, 1024},
560 {HW_VENDOR_INTEL
, CARD_INTEL_830M
, "Intel(R) 82830M Graphics Controller", DRIVER_INTEL_GMA800
, 32 },
561 {HW_VENDOR_INTEL
, CARD_INTEL_855GM
, "Intel(R) 82852/82855 GM/GME Graphics Controller", DRIVER_INTEL_GMA800
, 32 },
562 {HW_VENDOR_INTEL
, CARD_INTEL_845G
, "Intel(R) 845G", DRIVER_INTEL_GMA800
, 32 },
563 {HW_VENDOR_INTEL
, CARD_INTEL_865G
, "Intel(R) 82865G Graphics Controller", DRIVER_INTEL_GMA800
, 32 },
564 {HW_VENDOR_INTEL
, CARD_INTEL_915G
, "Intel(R) 82915G/GV/910GL Express Chipset Family", DRIVER_INTEL_GMA900
, 64 },
565 {HW_VENDOR_INTEL
, CARD_INTEL_E7221G
, "Intel(R) E7221G", DRIVER_INTEL_GMA900
, 64 },
566 {HW_VENDOR_INTEL
, CARD_INTEL_915GM
, "Mobile Intel(R) 915GM/GMS,910GML Express Chipset Family", DRIVER_INTEL_GMA900
, 64 },
567 {HW_VENDOR_INTEL
, CARD_INTEL_945G
, "Intel(R) 945G", DRIVER_INTEL_GMA950
, 64 },
568 {HW_VENDOR_INTEL
, CARD_INTEL_945GM
, "Mobile Intel(R) 945GM Express Chipset Family", DRIVER_INTEL_GMA950
, 64 },
569 {HW_VENDOR_INTEL
, CARD_INTEL_945GME
, "Intel(R) 945GME", DRIVER_INTEL_GMA950
, 64 },
570 {HW_VENDOR_INTEL
, CARD_INTEL_Q35
, "Intel(R) Q35", DRIVER_INTEL_GMA950
, 64 },
571 {HW_VENDOR_INTEL
, CARD_INTEL_G33
, "Intel(R) G33", DRIVER_INTEL_GMA950
, 64 },
572 {HW_VENDOR_INTEL
, CARD_INTEL_Q33
, "Intel(R) Q33", DRIVER_INTEL_GMA950
, 64 },
573 {HW_VENDOR_INTEL
, CARD_INTEL_PNVG
, "Intel(R) IGD", DRIVER_INTEL_GMA950
, 64 },
574 {HW_VENDOR_INTEL
, CARD_INTEL_PNVM
, "Intel(R) IGD", DRIVER_INTEL_GMA950
, 64 },
575 {HW_VENDOR_INTEL
, CARD_INTEL_965Q
, "Intel(R) 965Q", DRIVER_INTEL_GMA3000
, 128},
576 {HW_VENDOR_INTEL
, CARD_INTEL_965G
, "Intel(R) 965G", DRIVER_INTEL_GMA3000
, 128},
577 {HW_VENDOR_INTEL
, CARD_INTEL_946GZ
, "Intel(R) 946GZ", DRIVER_INTEL_GMA3000
, 128},
578 {HW_VENDOR_INTEL
, CARD_INTEL_965GM
, "Mobile Intel(R) 965 Express Chipset Family", DRIVER_INTEL_GMA3000
, 128},
579 {HW_VENDOR_INTEL
, CARD_INTEL_965GME
, "Intel(R) 965GME", DRIVER_INTEL_GMA3000
, 128},
580 {HW_VENDOR_INTEL
, CARD_INTEL_GM45
, "Mobile Intel(R) GM45 Express Chipset Family", DRIVER_INTEL_GMA3000
, 512},
581 {HW_VENDOR_INTEL
, CARD_INTEL_IGD
, "Intel(R) Integrated Graphics Device", DRIVER_INTEL_GMA3000
, 512},
582 {HW_VENDOR_INTEL
, CARD_INTEL_G45
, "Intel(R) G45/G43", DRIVER_INTEL_GMA3000
, 512},
583 {HW_VENDOR_INTEL
, CARD_INTEL_Q45
, "Intel(R) Q45/Q43", DRIVER_INTEL_GMA3000
, 512},
584 {HW_VENDOR_INTEL
, CARD_INTEL_G41
, "Intel(R) G41", DRIVER_INTEL_GMA3000
, 512},
585 {HW_VENDOR_INTEL
, CARD_INTEL_B43
, "Intel(R) B43", DRIVER_INTEL_GMA3000
, 512},
586 {HW_VENDOR_INTEL
, CARD_INTEL_ILKD
, "Intel(R) HD Graphics", DRIVER_INTEL_GMA3000
, 1536},
587 {HW_VENDOR_INTEL
, CARD_INTEL_ILKM
, "Intel(R) HD Graphics", DRIVER_INTEL_GMA3000
, 1536},
588 {HW_VENDOR_INTEL
, CARD_INTEL_SNBD
, "Intel(R) HD Graphics 3000", DRIVER_INTEL_GMA3000
, 1536},
589 {HW_VENDOR_INTEL
, CARD_INTEL_SNBM
, "Intel(R) HD Graphics 3000", DRIVER_INTEL_GMA3000
, 1536},
590 {HW_VENDOR_INTEL
, CARD_INTEL_SNBS
, "Intel(R) HD Graphics Family", DRIVER_INTEL_GMA3000
, 1536},
591 {HW_VENDOR_INTEL
, CARD_INTEL_IVBD
, "Intel(R) HD Graphics 4000", DRIVER_INTEL_HD4000
, 1536},
592 {HW_VENDOR_INTEL
, CARD_INTEL_IVBM
, "Intel(R) HD Graphics 4000", DRIVER_INTEL_HD4000
, 1536},
593 {HW_VENDOR_INTEL
, CARD_INTEL_IVBS
, "Intel(R) HD Graphics Family", DRIVER_INTEL_HD4000
, 1536},
594 {HW_VENDOR_INTEL
, CARD_INTEL_HWD
, "Intel(R) HD Graphics 4600", DRIVER_INTEL_HD4000
, 1536},
595 {HW_VENDOR_INTEL
, CARD_INTEL_HWM
, "Intel(R) HD Graphics 4600", DRIVER_INTEL_HD4000
, 1536},
596 {HW_VENDOR_INTEL
, CARD_INTEL_HD5000_1
, "Intel(R) HD Graphics 5000", DRIVER_INTEL_HD4000
, 1536},
597 {HW_VENDOR_INTEL
, CARD_INTEL_HD5000_2
, "Intel(R) HD Graphics 5000", DRIVER_INTEL_HD4000
, 1536},
598 {HW_VENDOR_INTEL
, CARD_INTEL_I5100_1
, "Intel(R) Iris(TM) Graphics 5100", DRIVER_INTEL_HD4000
, 1536},
599 {HW_VENDOR_INTEL
, CARD_INTEL_I5100_2
, "Intel(R) Iris(TM) Graphics 5100", DRIVER_INTEL_HD4000
, 1536},
600 {HW_VENDOR_INTEL
, CARD_INTEL_I5100_3
, "Intel(R) Iris(TM) Graphics 5100", DRIVER_INTEL_HD4000
, 1536},
601 {HW_VENDOR_INTEL
, CARD_INTEL_I5100_4
, "Intel(R) Iris(TM) Graphics 5100", DRIVER_INTEL_HD4000
, 1536},
602 {HW_VENDOR_INTEL
, CARD_INTEL_IP5200_1
, "Intel(R) Iris(TM) Pro Graphics 5200", DRIVER_INTEL_HD4000
, 1536},
603 {HW_VENDOR_INTEL
, CARD_INTEL_IP5200_2
, "Intel(R) Iris(TM) Pro Graphics 5200", DRIVER_INTEL_HD4000
, 1536},
604 {HW_VENDOR_INTEL
, CARD_INTEL_IP5200_3
, "Intel(R) Iris(TM) Pro Graphics 5200", DRIVER_INTEL_HD4000
, 1536},
605 {HW_VENDOR_INTEL
, CARD_INTEL_IP5200_4
, "Intel(R) Iris(TM) Pro Graphics 5200", DRIVER_INTEL_HD4000
, 1536},
606 {HW_VENDOR_INTEL
, CARD_INTEL_IP5200_5
, "Intel(R) Iris(TM) Pro Graphics 5200", DRIVER_INTEL_HD4000
, 1536},
607 {HW_VENDOR_INTEL
, CARD_INTEL_IP5200_6
, "Intel(R) Iris(TM) Pro Graphics 5200", DRIVER_INTEL_HD4000
, 2048},
608 {HW_VENDOR_INTEL
, CARD_INTEL_HD5300
, "Intel(R) HD Graphics 5300", DRIVER_INTEL_HD4000
, 2048},
609 {HW_VENDOR_INTEL
, CARD_INTEL_HD5500
, "Intel(R) HD Graphics 5500", DRIVER_INTEL_HD4000
, 2048},
610 {HW_VENDOR_INTEL
, CARD_INTEL_HD5600
, "Intel(R) HD Graphics 5600", DRIVER_INTEL_HD4000
, 2048},
611 {HW_VENDOR_INTEL
, CARD_INTEL_HD6000
, "Intel(R) HD Graphics 6000", DRIVER_INTEL_HD4000
, 2048},
612 {HW_VENDOR_INTEL
, CARD_INTEL_I6100
, "Intel(R) Iris(TM) Graphics 6100", DRIVER_INTEL_HD4000
, 2048},
613 {HW_VENDOR_INTEL
, CARD_INTEL_IP6200
, "Intel(R) Iris(TM) Pro Graphics 6200", DRIVER_INTEL_HD4000
, 2048},
614 {HW_VENDOR_INTEL
, CARD_INTEL_IPP6300
, "Intel(R) Iris(TM) Pro Graphics P6300", DRIVER_INTEL_HD4000
, 2048},
615 {HW_VENDOR_INTEL
, CARD_INTEL_HD510_1
, "Intel(R) HD Graphics 510", DRIVER_INTEL_HD4000
, 2048},
616 {HW_VENDOR_INTEL
, CARD_INTEL_HD510_2
, "Intel(R) HD Graphics 510", DRIVER_INTEL_HD4000
, 2048},
617 {HW_VENDOR_INTEL
, CARD_INTEL_HD510_3
, "Intel(R) HD Graphics 510", DRIVER_INTEL_HD4000
, 2048},
618 {HW_VENDOR_INTEL
, CARD_INTEL_HD515
, "Intel(R) HD Graphics 515", DRIVER_INTEL_HD4000
, 2048},
619 {HW_VENDOR_INTEL
, CARD_INTEL_HD520_1
, "Intel(R) HD Graphics 520", DRIVER_INTEL_HD4000
, 2048},
620 {HW_VENDOR_INTEL
, CARD_INTEL_HD520_2
, "Intel(R) HD Graphics 520", DRIVER_INTEL_HD4000
, 2048},
621 {HW_VENDOR_INTEL
, CARD_INTEL_HD530_1
, "Intel(R) HD Graphics 530", DRIVER_INTEL_HD4000
, 2048},
622 {HW_VENDOR_INTEL
, CARD_INTEL_HD530_2
, "Intel(R) HD Graphics 530", DRIVER_INTEL_HD4000
, 2048},
623 {HW_VENDOR_INTEL
, CARD_INTEL_HDP530
, "Intel(R) HD Graphics P530", DRIVER_INTEL_HD4000
, 2048},
624 {HW_VENDOR_INTEL
, CARD_INTEL_I540
, "Intel(R) Iris(TM) Graphics 540", DRIVER_INTEL_HD4000
, 2048},
625 {HW_VENDOR_INTEL
, CARD_INTEL_I550
, "Intel(R) Iris(TM) Graphics 550", DRIVER_INTEL_HD4000
, 2048},
626 {HW_VENDOR_INTEL
, CARD_INTEL_I555
, "Intel(R) Iris(TM) Graphics 555", DRIVER_INTEL_HD4000
, 2048},
627 {HW_VENDOR_INTEL
, CARD_INTEL_IP555
, "Intel(R) Iris(TM) Graphics P555", DRIVER_INTEL_HD4000
, 2048},
628 {HW_VENDOR_INTEL
, CARD_INTEL_IP580_1
, "Intel(R) Iris(TM) Pro Graphics 580", DRIVER_INTEL_HD4000
, 2048},
629 {HW_VENDOR_INTEL
, CARD_INTEL_IP580_2
, "Intel(R) Iris(TM) Pro Graphics 580", DRIVER_INTEL_HD4000
, 2048},
630 {HW_VENDOR_INTEL
, CARD_INTEL_IPP580_1
, "Intel(R) Iris(TM) Pro Graphics P580", DRIVER_INTEL_HD4000
, 2048},
631 {HW_VENDOR_INTEL
, CARD_INTEL_IPP580_2
, "Intel(R) Iris(TM) Pro Graphics P580", DRIVER_INTEL_HD4000
, 2048},
632 {HW_VENDOR_INTEL
, CARD_INTEL_UHD617
, "Intel(R) UHD Graphics 617", DRIVER_INTEL_HD4000
, 2048},
633 {HW_VENDOR_INTEL
, CARD_INTEL_UHD620
, "Intel(R) UHD Graphics 620", DRIVER_INTEL_HD4000
, 3072},
634 {HW_VENDOR_INTEL
, CARD_INTEL_HD615
, "Intel(R) HD Graphics 615", DRIVER_INTEL_HD4000
, 2048},
635 {HW_VENDOR_INTEL
, CARD_INTEL_HD620
, "Intel(R) HD Graphics 620", DRIVER_INTEL_HD4000
, 3072},
636 {HW_VENDOR_INTEL
, CARD_INTEL_HD630_1
, "Intel(R) HD Graphics 630", DRIVER_INTEL_HD4000
, 3072},
637 {HW_VENDOR_INTEL
, CARD_INTEL_HD630_2
, "Intel(R) HD Graphics 630", DRIVER_INTEL_HD4000
, 3072},
638 {HW_VENDOR_INTEL
, CARD_INTEL_UHD630_1
, "Intel(R) UHD Graphics 630", DRIVER_INTEL_HD4000
, 3072},
639 {HW_VENDOR_INTEL
, CARD_INTEL_UHD630_2
, "Intel(R) UHD Graphics 630", DRIVER_INTEL_HD4000
, 3072},
642 static const struct driver_version_information
*get_driver_version_info(enum wined3d_display_driver driver
,
643 enum wined3d_driver_model driver_model
)
647 TRACE("Looking up version info for driver %#x, driver_model %#x.\n", driver
, driver_model
);
649 for (i
= 0; i
< ARRAY_SIZE(driver_version_table
); ++i
)
651 const struct driver_version_information
*entry
= &driver_version_table
[i
];
653 if (entry
->driver
== driver
&& (driver_model
== DRIVER_MODEL_GENERIC
654 || entry
->driver_model
== driver_model
))
656 TRACE("Found driver \"%s\", subversion %u, build %u.\n",
657 entry
->driver_name
, entry
->subversion
, entry
->build
);
664 const struct wined3d_gpu_description
*wined3d_get_gpu_description(enum wined3d_pci_vendor vendor
,
665 enum wined3d_pci_device device
)
669 for (i
= 0; i
< ARRAY_SIZE(gpu_description_table
); ++i
)
671 if (vendor
== gpu_description_table
[i
].vendor
&& device
== gpu_description_table
[i
].device
)
672 return &gpu_description_table
[i
];
678 const struct wined3d_gpu_description
*wined3d_get_user_override_gpu_description(enum wined3d_pci_vendor vendor
,
679 enum wined3d_pci_device device
)
681 const struct wined3d_gpu_description
*gpu_desc
;
682 static unsigned int once
;
684 if (wined3d_settings
.pci_vendor_id
== PCI_VENDOR_NONE
&& wined3d_settings
.pci_device_id
== PCI_DEVICE_NONE
)
687 if (wined3d_settings
.pci_vendor_id
!= PCI_VENDOR_NONE
)
689 vendor
= wined3d_settings
.pci_vendor_id
;
690 TRACE("Overriding vendor PCI ID with 0x%04x.\n", vendor
);
692 if (wined3d_settings
.pci_device_id
!= PCI_DEVICE_NONE
)
694 device
= wined3d_settings
.pci_device_id
;
695 TRACE("Overriding device PCI ID with 0x%04x.\n", device
);
698 if (!(gpu_desc
= wined3d_get_gpu_description(vendor
, device
)) && !once
++)
699 ERR_(winediag
)("Invalid GPU override %04x:%04x specified, ignoring.\n", vendor
, device
);
704 static void wined3d_copy_name(char *dst
, const char *src
, unsigned int dst_size
)
710 len
= min(strlen(src
), dst_size
- 1);
711 memcpy(dst
, src
, len
);
712 memset(&dst
[len
], 0, dst_size
- len
);
716 bool wined3d_driver_info_init(struct wined3d_driver_info
*driver_info
,
717 const struct wined3d_gpu_description
*gpu_desc
, enum wined3d_feature_level feature_level
,
718 UINT64 vram_bytes
, UINT64 sysmem_bytes
)
720 const struct driver_version_information
*version_info
;
721 WORD driver_os_version
, driver_feature_level
= 10;
722 enum wined3d_driver_model driver_model
;
723 enum wined3d_display_driver driver
;
724 MEMORYSTATUSEX memory_status
;
725 OSVERSIONINFOW os_version
;
727 memset(&os_version
, 0, sizeof(os_version
));
728 os_version
.dwOSVersionInfoSize
= sizeof(os_version
);
729 if (!GetVersionExW(&os_version
))
731 ERR("Failed to get OS version, reporting 2000/XP.\n");
732 driver_os_version
= 6;
733 driver_model
= DRIVER_MODEL_NT5X
;
737 TRACE("OS version %lu.%lu.\n", os_version
.dwMajorVersion
, os_version
.dwMinorVersion
);
738 switch (os_version
.dwMajorVersion
)
743 /* If needed we could distinguish between 9x and NT4, but this code won't make
744 * sense for NT4 since it had no way to obtain this info through DirectDraw 3.0.
746 driver_os_version
= 4;
747 driver_model
= DRIVER_MODEL_WIN9X
;
751 driver_os_version
= 6;
752 driver_model
= DRIVER_MODEL_NT5X
;
756 if (os_version
.dwMinorVersion
== 0)
758 driver_os_version
= 7;
759 driver_model
= DRIVER_MODEL_NT6X
;
761 else if (os_version
.dwMinorVersion
== 1)
763 driver_os_version
= 8;
764 driver_model
= DRIVER_MODEL_NT6X
;
766 else if (os_version
.dwMinorVersion
== 2)
768 driver_os_version
= 9;
769 driver_model
= DRIVER_MODEL_NT6X
;
773 if (os_version
.dwMinorVersion
> 3)
775 FIXME("Unhandled OS version %lu.%lu, reporting Windows 8.1.\n",
776 os_version
.dwMajorVersion
, os_version
.dwMinorVersion
);
778 driver_os_version
= 10;
779 driver_model
= DRIVER_MODEL_NT6X
;
784 driver_os_version
= 31;
785 driver_model
= DRIVER_MODEL_NT6X
;
789 FIXME("Unhandled OS version %lu.%lu, reporting Windows 7.\n",
790 os_version
.dwMajorVersion
, os_version
.dwMinorVersion
);
791 driver_os_version
= 8;
792 driver_model
= DRIVER_MODEL_NT6X
;
797 TRACE("GPU maximum feature level %#x.\n", feature_level
);
798 switch (feature_level
)
800 case WINED3D_FEATURE_LEVEL_NONE
:
801 case WINED3D_FEATURE_LEVEL_5
:
802 if (driver_model
== DRIVER_MODEL_WIN9X
)
803 driver_feature_level
= 5;
805 driver_feature_level
= 10;
807 case WINED3D_FEATURE_LEVEL_6
:
808 driver_feature_level
= 11;
810 case WINED3D_FEATURE_LEVEL_7
:
811 driver_feature_level
= 12;
813 case WINED3D_FEATURE_LEVEL_8
:
814 driver_feature_level
= 13;
816 case WINED3D_FEATURE_LEVEL_9_1
:
817 case WINED3D_FEATURE_LEVEL_9_2
:
818 case WINED3D_FEATURE_LEVEL_9_3
:
819 driver_feature_level
= 14;
821 case WINED3D_FEATURE_LEVEL_10
:
822 driver_feature_level
= 15;
824 case WINED3D_FEATURE_LEVEL_10_1
:
825 driver_feature_level
= 16;
827 case WINED3D_FEATURE_LEVEL_11
:
828 driver_feature_level
= 17;
830 case WINED3D_FEATURE_LEVEL_11_1
:
831 /* Advertise support for everything up to FL 12_x. */
832 driver_feature_level
= 21;
835 if (os_version
.dwMajorVersion
== 6 && !os_version
.dwMinorVersion
)
836 driver_feature_level
= min(driver_feature_level
, 18);
837 else if (os_version
.dwMajorVersion
< 6)
838 driver_feature_level
= min(driver_feature_level
, 14);
840 /* Drivers with the OS version 30+ all have the feature level word set to 0 */
841 if (driver_os_version
>= 30)
842 driver_feature_level
= 0;
844 driver_info
->vendor
= gpu_desc
->vendor
;
845 driver_info
->device
= gpu_desc
->device
;
846 wined3d_copy_name(driver_info
->description
, gpu_desc
->description
, ARRAY_SIZE(driver_info
->description
));
847 driver_info
->vram_bytes
= vram_bytes
? vram_bytes
: (UINT64
)gpu_desc
->vidmem
* 1024 * 1024;
848 driver
= gpu_desc
->driver
;
850 if (wined3d_settings
.emulated_textureram
)
852 driver_info
->vram_bytes
= wined3d_settings
.emulated_textureram
;
853 TRACE("Overriding amount of video memory with 0x%s bytes.\n",
854 wine_dbgstr_longlong(driver_info
->vram_bytes
));
858 * Diablo 2 crashes when the amount of video memory is greater than 0x7fffffff.
859 * In order to avoid this application bug we limit the amount of video memory
860 * to LONG_MAX for older Windows versions.
862 if (driver_model
< DRIVER_MODEL_NT6X
&& driver_info
->vram_bytes
> LONG_MAX
)
864 TRACE("Limiting amount of video memory to %#lx bytes for OS version older than Vista.\n", LONG_MAX
);
865 driver_info
->vram_bytes
= LONG_MAX
;
868 if (!(driver_info
->sysmem_bytes
= sysmem_bytes
))
870 driver_info
->sysmem_bytes
= 64 * 1024 * 1024;
871 memory_status
.dwLength
= sizeof(memory_status
);
872 if (GlobalMemoryStatusEx(&memory_status
))
873 driver_info
->sysmem_bytes
= max(memory_status
.ullTotalPhys
/ 2, driver_info
->sysmem_bytes
);
875 ERR("Failed to get global memory status.\n");
878 /* Try to obtain driver version information for the current Windows version. This fails in
880 * - the gpu is not available on the currently selected OS version:
881 * - Geforce GTX480 on Win98. When running applications in compatibility mode on Windows,
882 * version information for the current Windows version is returned instead of faked info.
883 * We do the same and assume the default Windows version to emulate is WinXP.
885 * - Videocard is a Riva TNT but winver is set to win7 (there are no drivers for this beast)
886 * For now return the XP driver info. Perhaps later on we should return VESA.
888 * - the gpu is not in our database (can happen when the user overrides the vendor_id / device_id)
889 * This could be an indication that our database is not up to date, so this should be fixed.
891 if ((version_info
= get_driver_version_info(driver
, driver_model
))
892 || (version_info
= get_driver_version_info(driver
, DRIVER_MODEL_GENERIC
)))
894 driver_info
->name
= version_info
->driver_name
;
895 driver_info
->version_high
= MAKEDWORD_VERSION(driver_os_version
, driver_feature_level
);
896 driver_info
->version_low
= MAKEDWORD_VERSION(version_info
->subversion
, version_info
->build
);
901 ERR("No driver version info found for device %04x:%04x, driver model %#x.\n",
902 driver_info
->vendor
, driver_info
->device
, driver_model
);
906 enum wined3d_pci_device
wined3d_gpu_from_feature_level(enum wined3d_pci_vendor
*vendor
,
907 enum wined3d_feature_level feature_level
)
909 static const struct wined3d_fallback_card
911 enum wined3d_feature_level feature_level
;
912 enum wined3d_pci_device device_id
;
914 card_fallback_nvidia
[] =
916 {WINED3D_FEATURE_LEVEL_5
, CARD_NVIDIA_RIVA_128
},
917 {WINED3D_FEATURE_LEVEL_6
, CARD_NVIDIA_RIVA_TNT
},
918 {WINED3D_FEATURE_LEVEL_7
, CARD_NVIDIA_GEFORCE
},
919 {WINED3D_FEATURE_LEVEL_8
, CARD_NVIDIA_GEFORCE3
},
920 {WINED3D_FEATURE_LEVEL_9_2
, CARD_NVIDIA_GEFORCEFX_5800
},
921 {WINED3D_FEATURE_LEVEL_9_3
, CARD_NVIDIA_GEFORCE_6800
},
922 {WINED3D_FEATURE_LEVEL_10
, CARD_NVIDIA_GEFORCE_8800GTX
},
923 {WINED3D_FEATURE_LEVEL_11
, CARD_NVIDIA_GEFORCE_GTX470
},
924 {WINED3D_FEATURE_LEVEL_NONE
},
926 card_fallback_amd
[] =
928 {WINED3D_FEATURE_LEVEL_5
, CARD_AMD_RAGE_128PRO
},
929 {WINED3D_FEATURE_LEVEL_7
, CARD_AMD_RADEON_7200
},
930 {WINED3D_FEATURE_LEVEL_8
, CARD_AMD_RADEON_8500
},
931 {WINED3D_FEATURE_LEVEL_9_1
, CARD_AMD_RADEON_9500
},
932 {WINED3D_FEATURE_LEVEL_9_3
, CARD_AMD_RADEON_X1600
},
933 {WINED3D_FEATURE_LEVEL_10
, CARD_AMD_RADEON_HD2900
},
934 {WINED3D_FEATURE_LEVEL_11
, CARD_AMD_RADEON_HD5600
},
935 {WINED3D_FEATURE_LEVEL_NONE
},
937 card_fallback_intel
[] =
939 {WINED3D_FEATURE_LEVEL_5
, CARD_INTEL_845G
},
940 {WINED3D_FEATURE_LEVEL_8
, CARD_INTEL_915G
},
941 {WINED3D_FEATURE_LEVEL_9_3
, CARD_INTEL_945G
},
942 {WINED3D_FEATURE_LEVEL_10
, CARD_INTEL_G45
},
943 {WINED3D_FEATURE_LEVEL_11
, CARD_INTEL_IVBD
},
944 {WINED3D_FEATURE_LEVEL_NONE
},
949 enum wined3d_pci_vendor vendor
;
950 const struct wined3d_fallback_card
*cards
;
954 {HW_VENDOR_AMD
, card_fallback_amd
},
955 {HW_VENDOR_NVIDIA
, card_fallback_nvidia
},
956 {HW_VENDOR_VMWARE
, card_fallback_amd
},
957 {HW_VENDOR_INTEL
, card_fallback_intel
},
960 const struct wined3d_fallback_card
*cards
;
961 enum wined3d_pci_device device_id
;
965 for (i
= 0; i
< ARRAY_SIZE(fallbacks
); ++i
)
967 if (*vendor
== fallbacks
[i
].vendor
)
968 cards
= fallbacks
[i
].cards
;
972 *vendor
= HW_VENDOR_NVIDIA
;
973 cards
= card_fallback_nvidia
;
976 device_id
= cards
->device_id
;
977 for (i
= 0; cards
[i
].feature_level
; ++i
)
979 if (feature_level
>= cards
[i
].feature_level
)
980 device_id
= cards
[i
].device_id
;
985 struct wined3d_adapter
* CDECL
wined3d_get_adapter(const struct wined3d
*wined3d
, unsigned int idx
)
987 TRACE("wined3d %p, idx %u.\n", wined3d
, idx
);
989 if (idx
>= wined3d
->adapter_count
)
992 return wined3d
->adapters
[idx
];
995 UINT CDECL
wined3d_get_adapter_count(const struct wined3d
*wined3d
)
997 TRACE("wined3d %p, reporting %u adapters.\n",
998 wined3d
, wined3d
->adapter_count
);
1000 return wined3d
->adapter_count
;
1003 struct wined3d_output
* CDECL
wined3d_adapter_get_output(const struct wined3d_adapter
*adapter
,
1006 TRACE("adapter %p, idx %u.\n", adapter
, idx
);
1008 if (idx
>= adapter
->output_count
)
1011 return &adapter
->outputs
[idx
];
1014 unsigned int CDECL
wined3d_adapter_get_output_count(const struct wined3d_adapter
*adapter
)
1016 TRACE("adapter %p, reporting %Iu outputs.\n", adapter
, adapter
->output_count
);
1018 return adapter
->output_count
;
1021 HRESULT CDECL
wined3d_adapter_get_video_memory_info(const struct wined3d_adapter
*adapter
,
1022 unsigned int node_idx
, enum wined3d_memory_segment_group group
,
1023 struct wined3d_video_memory_info
*info
)
1025 static unsigned int once
;
1026 D3DKMT_QUERYVIDEOMEMORYINFO query_memory_info
;
1027 struct wined3d_adapter_identifier adapter_id
;
1031 TRACE("adapter %p, node_idx %u, group %d, info %p.\n", adapter
, node_idx
, group
, info
);
1033 if (group
> WINED3D_MEMORY_SEGMENT_GROUP_NON_LOCAL
)
1035 WARN("Invalid memory segment group %#x.\n", group
);
1036 return E_INVALIDARG
;
1039 query_memory_info
.hProcess
= NULL
;
1040 query_memory_info
.hAdapter
= adapter
->kmt_adapter
;
1041 query_memory_info
.PhysicalAdapterIndex
= node_idx
;
1042 query_memory_info
.MemorySegmentGroup
= (D3DKMT_MEMORY_SEGMENT_GROUP
)group
;
1043 status
= D3DKMTQueryVideoMemoryInfo(&query_memory_info
);
1044 if (status
== STATUS_SUCCESS
)
1046 info
->budget
= query_memory_info
.Budget
;
1047 info
->current_usage
= query_memory_info
.CurrentUsage
;
1048 info
->current_reservation
= query_memory_info
.CurrentReservation
;
1049 info
->available_reservation
= query_memory_info
.AvailableForReservation
;
1053 /* D3DKMTQueryVideoMemoryInfo() failed, fallback to fake memory info */
1055 FIXME("Returning fake video memory info.\n");
1058 FIXME("Ignoring node index %u.\n", node_idx
);
1060 adapter_id
.driver_size
= 0;
1061 adapter_id
.description_size
= 0;
1062 if (FAILED(hr
= wined3d_adapter_get_identifier(adapter
, 0, &adapter_id
)))
1067 case WINED3D_MEMORY_SEGMENT_GROUP_LOCAL
:
1068 info
->budget
= adapter_id
.video_memory
;
1069 info
->current_usage
= adapter
->vram_bytes_used
;
1070 info
->available_reservation
= adapter_id
.video_memory
/ 2;
1071 info
->current_reservation
= 0;
1073 case WINED3D_MEMORY_SEGMENT_GROUP_NON_LOCAL
:
1074 memset(info
, 0, sizeof(*info
));
1080 static DWORD CALLBACK
notification_thread_func(void *stop_event
)
1082 struct wined3d_adapter_budget_change_notification
*notification
;
1083 struct wined3d_video_memory_info info
;
1086 SetThreadDescription(GetCurrentThread(), L
"wined3d_budget_change_notification");
1090 wined3d_mutex_lock();
1091 LIST_FOR_EACH_ENTRY(notification
, &adapter_budget_change_notifications
,
1092 struct wined3d_adapter_budget_change_notification
, entry
)
1094 hr
= wined3d_adapter_get_video_memory_info(notification
->adapter
, 0,
1095 WINED3D_MEMORY_SEGMENT_GROUP_LOCAL
, &info
);
1096 if (SUCCEEDED(hr
) && info
.budget
!= notification
->last_local_budget
)
1098 notification
->last_local_budget
= info
.budget
;
1099 SetEvent(notification
->event
);
1103 hr
= wined3d_adapter_get_video_memory_info(notification
->adapter
, 0,
1104 WINED3D_MEMORY_SEGMENT_GROUP_NON_LOCAL
, &info
);
1105 if (SUCCEEDED(hr
) && info
.budget
!= notification
->last_non_local_budget
)
1107 notification
->last_non_local_budget
= info
.budget
;
1108 SetEvent(notification
->event
);
1111 wined3d_mutex_unlock();
1113 if (WaitForSingleObject(stop_event
, 1000) == WAIT_OBJECT_0
)
1120 HRESULT CDECL
wined3d_adapter_register_budget_change_notification(const struct wined3d_adapter
*adapter
,
1121 HANDLE event
, DWORD
*cookie
)
1123 static DWORD cookie_counter
;
1124 static BOOL wrapped
;
1125 struct wined3d_adapter_budget_change_notification
*notification
, *new_notification
;
1128 new_notification
= calloc(1, sizeof(*new_notification
));
1129 if (!new_notification
)
1130 return E_OUTOFMEMORY
;
1132 wined3d_mutex_lock();
1133 new_notification
->adapter
= adapter
;
1134 new_notification
->event
= event
;
1135 new_notification
->cookie
= cookie_counter
++;
1136 if (cookie_counter
< new_notification
->cookie
)
1142 LIST_FOR_EACH_ENTRY(notification
, &adapter_budget_change_notifications
,
1143 struct wined3d_adapter_budget_change_notification
, entry
)
1145 if (notification
->cookie
== new_notification
->cookie
)
1155 new_notification
->cookie
= cookie_counter
++;
1159 *cookie
= new_notification
->cookie
;
1160 list_add_head(&adapter_budget_change_notifications
, &new_notification
->entry
);
1162 if (!notification_thread
)
1164 notification_thread_stop_event
= CreateEventW(0, FALSE
, FALSE
, NULL
);
1165 notification_thread
= CreateThread(NULL
, 0, notification_thread_func
,
1166 notification_thread_stop_event
, 0, NULL
);
1168 wined3d_mutex_unlock();
1172 HRESULT CDECL
wined3d_adapter_unregister_budget_change_notification(DWORD cookie
)
1174 struct wined3d_adapter_budget_change_notification
*notification
;
1175 HANDLE thread
, thread_stop_event
;
1177 wined3d_mutex_lock();
1178 LIST_FOR_EACH_ENTRY(notification
, &adapter_budget_change_notifications
,
1179 struct wined3d_adapter_budget_change_notification
, entry
)
1181 if (notification
->cookie
== cookie
)
1183 list_remove(¬ification
->entry
);
1189 if (!list_empty(&adapter_budget_change_notifications
))
1191 wined3d_mutex_unlock();
1195 thread
= notification_thread
;
1196 thread_stop_event
= notification_thread_stop_event
;
1197 notification_thread
= NULL
;
1198 notification_thread_stop_event
= NULL
;
1199 wined3d_mutex_unlock();
1200 SetEvent(thread_stop_event
);
1201 WaitForSingleObject(thread
, INFINITE
);
1202 CloseHandle(thread
);
1203 CloseHandle(thread_stop_event
);
1207 HRESULT CDECL
wined3d_register_software_device(struct wined3d
*wined3d
, void *init_function
)
1209 FIXME("wined3d %p, init_function %p stub!\n", wined3d
, init_function
);
1214 static BOOL CALLBACK
enum_monitor_proc(HMONITOR monitor
, HDC hdc
, RECT
*rect
, LPARAM lparam
)
1216 struct wined3d_output_desc
*desc
= (struct wined3d_output_desc
*)lparam
;
1217 MONITORINFOEXW monitor_info
;
1219 monitor_info
.cbSize
= sizeof(monitor_info
);
1220 if (GetMonitorInfoW(monitor
, (MONITORINFO
*)&monitor_info
) &&
1221 !lstrcmpiW(desc
->device_name
, monitor_info
.szDevice
))
1223 desc
->monitor
= monitor
;
1224 desc
->desktop_rect
= monitor_info
.rcMonitor
;
1225 desc
->attached_to_desktop
= TRUE
;
1232 HRESULT CDECL
wined3d_output_get_desc(const struct wined3d_output
*output
,
1233 struct wined3d_output_desc
*desc
)
1235 TRACE("output %p, desc %p.\n", output
, desc
);
1237 memset(desc
, 0, sizeof(*desc
));
1238 desc
->ordinal
= output
->ordinal
;
1239 lstrcpyW(desc
->device_name
, output
->device_name
);
1240 EnumDisplayMonitors(NULL
, NULL
, enum_monitor_proc
, (LPARAM
)desc
);
1244 /* FIXME: GetAdapterModeCount and EnumAdapterModes currently only returns modes
1245 of the same bpp but different resolutions */
1247 static void wined3d_output_update_modes(struct wined3d_output
*output
, bool cached
)
1249 struct wined3d_display_mode
*wined3d_mode
;
1250 DEVMODEW mode
= {.dmSize
= sizeof(mode
)};
1253 if (output
->modes_valid
&& cached
)
1256 output
->mode_count
= 0;
1258 for (i
= 0; EnumDisplaySettingsExW(output
->device_name
, i
, &mode
, 0); ++i
)
1260 if (!wined3d_array_reserve((void **)&output
->modes
, &output
->modes_size
,
1261 output
->mode_count
+ 1, sizeof(*output
->modes
)))
1264 wined3d_mode
= &output
->modes
[output
->mode_count
++];
1265 wined3d_mode
->width
= mode
.dmPelsWidth
;
1266 wined3d_mode
->height
= mode
.dmPelsHeight
;
1267 wined3d_mode
->format_id
= pixelformat_for_depth(mode
.dmBitsPerPel
);
1269 if (mode
.dmFields
& DM_DISPLAYFREQUENCY
)
1270 wined3d_mode
->refresh_rate
= mode
.dmDisplayFrequency
;
1272 wined3d_mode
->refresh_rate
= DEFAULT_REFRESH_RATE
;
1274 if (mode
.dmFields
& DM_DISPLAYFLAGS
)
1276 if (mode
.dmDisplayFlags
& DM_INTERLACED
)
1277 wined3d_mode
->scanline_ordering
= WINED3D_SCANLINE_ORDERING_INTERLACED
;
1279 wined3d_mode
->scanline_ordering
= WINED3D_SCANLINE_ORDERING_PROGRESSIVE
;
1283 wined3d_mode
->scanline_ordering
= WINED3D_SCANLINE_ORDERING_UNKNOWN
;
1287 output
->modes_valid
= true;
1290 static bool mode_matches_filter(const struct wined3d_adapter
*adapter
, const struct wined3d_display_mode
*mode
,
1291 const struct wined3d_format
*format
, enum wined3d_scanline_ordering scanline_ordering
)
1293 if (scanline_ordering
!= WINED3D_SCANLINE_ORDERING_UNKNOWN
1294 && mode
->scanline_ordering
!= WINED3D_SCANLINE_ORDERING_UNKNOWN
1295 && scanline_ordering
!= mode
->scanline_ordering
)
1298 if (format
->id
== WINED3DFMT_UNKNOWN
)
1300 /* This is for d3d8, do not enumerate P8 here. */
1301 if (mode
->format_id
!= WINED3DFMT_B5G6R5_UNORM
&& mode
->format_id
!= WINED3DFMT_B8G8R8X8_UNORM
)
1306 const struct wined3d_format
*mode_format
= wined3d_get_format(adapter
,
1307 mode
->format_id
, WINED3D_BIND_RENDER_TARGET
);
1309 if (format
->byte_count
!= mode_format
->byte_count
)
1316 /* Note: dx9 supplies a format. Calls from d3d8 supply WINED3DFMT_UNKNOWN */
1317 unsigned int CDECL
wined3d_output_get_mode_count(struct wined3d_output
*output
,
1318 enum wined3d_format_id format_id
, enum wined3d_scanline_ordering scanline_ordering
, bool cached
)
1320 const struct wined3d_adapter
*adapter
;
1321 const struct wined3d_format
*format
;
1322 unsigned int count
= 0;
1325 TRACE("output %p, format %s, scanline_ordering %#x.\n",
1326 output
, debug_d3dformat(format_id
), scanline_ordering
);
1328 adapter
= output
->adapter
;
1329 format
= wined3d_get_format(adapter
, format_id
, WINED3D_BIND_RENDER_TARGET
);
1331 wined3d_output_update_modes(output
, cached
);
1333 for (i
= 0; i
< output
->mode_count
; ++i
)
1335 if (mode_matches_filter(adapter
, &output
->modes
[i
], format
, scanline_ordering
))
1339 TRACE("Returning %u matching modes (out of %Iu total).\n", count
, output
->mode_count
);
1344 /* Note: dx9 supplies a format. Calls from d3d8 supply WINED3DFMT_UNKNOWN */
1345 HRESULT CDECL
wined3d_output_get_mode(struct wined3d_output
*output
,
1346 enum wined3d_format_id format_id
, enum wined3d_scanline_ordering scanline_ordering
,
1347 unsigned int mode_idx
, struct wined3d_display_mode
*mode
, bool cached
)
1349 const struct wined3d_adapter
*adapter
;
1350 const struct wined3d_format
*format
;
1351 SIZE_T i
, match_idx
= 0;
1353 TRACE("output %p, format %s, scanline_ordering %#x, mode_idx %u, mode %p.\n",
1354 output
, debug_d3dformat(format_id
), scanline_ordering
, mode_idx
, mode
);
1357 return WINED3DERR_INVALIDCALL
;
1359 adapter
= output
->adapter
;
1360 format
= wined3d_get_format(adapter
, format_id
, WINED3D_BIND_RENDER_TARGET
);
1362 wined3d_output_update_modes(output
, cached
);
1364 for (i
= 0; i
< output
->mode_count
; ++i
)
1366 const struct wined3d_display_mode
*wined3d_mode
= &output
->modes
[i
];
1368 if (mode_matches_filter(adapter
, wined3d_mode
, format
, scanline_ordering
) && match_idx
++ == mode_idx
)
1370 *mode
= *wined3d_mode
;
1371 if (format_id
!= WINED3DFMT_UNKNOWN
)
1372 mode
->format_id
= format_id
;
1374 TRACE("%ux%u@%u %u bpp, %s %#x.\n", mode
->width
, mode
->height
, mode
->refresh_rate
,
1375 wined3d_get_format(adapter
, mode
->format_id
, WINED3D_BIND_RENDER_TARGET
)->byte_count
* CHAR_BIT
,
1376 debug_d3dformat(mode
->format_id
), mode
->scanline_ordering
);
1381 WARN("Invalid mode_idx %u.\n", mode_idx
);
1382 return WINED3DERR_INVALIDCALL
;
1385 HRESULT CDECL
wined3d_output_find_closest_matching_mode(struct wined3d_output
*output
,
1386 struct wined3d_display_mode
*mode
)
1388 unsigned int i
, j
, mode_count
, matching_mode_count
, closest
;
1389 struct wined3d_display_mode
**matching_modes
;
1390 struct wined3d_display_mode
*modes
;
1393 TRACE("output %p, mode %p.\n", output
, mode
);
1395 if (!(mode_count
= wined3d_output_get_mode_count(output
, mode
->format_id
,
1396 WINED3D_SCANLINE_ORDERING_UNKNOWN
, false)))
1398 WARN("Output has 0 matching modes.\n");
1402 if (!(modes
= calloc(mode_count
, sizeof(*modes
))))
1403 return E_OUTOFMEMORY
;
1404 if (!(matching_modes
= calloc(mode_count
, sizeof(*matching_modes
))))
1407 return E_OUTOFMEMORY
;
1410 for (i
= 0; i
< mode_count
; ++i
)
1412 if (FAILED(hr
= wined3d_output_get_mode(output
, mode
->format_id
,
1413 WINED3D_SCANLINE_ORDERING_UNKNOWN
, i
, &modes
[i
], true)))
1415 free(matching_modes
);
1419 matching_modes
[i
] = &modes
[i
];
1422 matching_mode_count
= mode_count
;
1424 if (mode
->scanline_ordering
!= WINED3D_SCANLINE_ORDERING_UNKNOWN
)
1426 for (i
= 0, j
= 0; i
< matching_mode_count
; ++i
)
1428 if (matching_modes
[i
]->scanline_ordering
== mode
->scanline_ordering
)
1429 matching_modes
[j
++] = matching_modes
[i
];
1432 matching_mode_count
= j
;
1435 if (mode
->refresh_rate
)
1437 for (i
= 0, j
= 0; i
< matching_mode_count
; ++i
)
1439 if (matching_modes
[i
]->refresh_rate
== mode
->refresh_rate
)
1440 matching_modes
[j
++] = matching_modes
[i
];
1443 matching_mode_count
= j
;
1446 if (!mode
->width
|| !mode
->height
)
1448 struct wined3d_display_mode current_mode
;
1449 if (FAILED(hr
= wined3d_output_get_display_mode(output
, ¤t_mode
, NULL
)))
1451 free(matching_modes
);
1455 mode
->width
= current_mode
.width
;
1456 mode
->height
= current_mode
.height
;
1460 for (i
= 0, j
= 0; i
< matching_mode_count
; ++i
)
1462 unsigned int d
= abs((int)(mode
->width
- matching_modes
[i
]->width
))
1463 + abs((int)(mode
->height
- matching_modes
[i
]->height
));
1472 *mode
= *matching_modes
[j
];
1474 free(matching_modes
);
1477 TRACE("Returning %ux%u@%u %s %#x.\n", mode
->width
, mode
->height
,
1478 mode
->refresh_rate
, debug_d3dformat(mode
->format_id
),
1479 mode
->scanline_ordering
);
1484 struct wined3d_adapter
* CDECL
wined3d_output_get_adapter(const struct wined3d_output
*output
)
1486 TRACE("output %p.\n", output
);
1488 return output
->adapter
;
1491 HRESULT CDECL
wined3d_output_get_display_mode(const struct wined3d_output
*output
,
1492 struct wined3d_display_mode
*mode
, enum wined3d_display_rotation
*rotation
)
1496 TRACE("output %p, display_mode %p, rotation %p.\n", output
, mode
, rotation
);
1499 return WINED3DERR_INVALIDCALL
;
1501 memset(&m
, 0, sizeof(m
));
1502 m
.dmSize
= sizeof(m
);
1504 EnumDisplaySettingsExW(output
->device_name
, ENUM_CURRENT_SETTINGS
, &m
, 0);
1505 mode
->width
= m
.dmPelsWidth
;
1506 mode
->height
= m
.dmPelsHeight
;
1507 mode
->refresh_rate
= DEFAULT_REFRESH_RATE
;
1508 if (m
.dmFields
& DM_DISPLAYFREQUENCY
)
1509 mode
->refresh_rate
= m
.dmDisplayFrequency
;
1510 mode
->format_id
= pixelformat_for_depth(m
.dmBitsPerPel
);
1512 /* Lie about the format. X11 can't change the color depth, and some apps
1513 * are pretty angry if they SetDisplayMode from 24 to 16 bpp and find out
1514 * that GetDisplayMode still returns 24 bpp. This should probably be
1515 * handled in winex11 instead. */
1516 if (output
->screen_format
&& output
->screen_format
!= mode
->format_id
)
1518 WARN("Overriding format %s with stored format %s.\n",
1519 debug_d3dformat(mode
->format_id
),
1520 debug_d3dformat(output
->screen_format
));
1521 mode
->format_id
= output
->screen_format
;
1524 if (!(m
.dmFields
& DM_DISPLAYFLAGS
))
1525 mode
->scanline_ordering
= WINED3D_SCANLINE_ORDERING_UNKNOWN
;
1526 else if (m
.dmDisplayFlags
& DM_INTERLACED
)
1527 mode
->scanline_ordering
= WINED3D_SCANLINE_ORDERING_INTERLACED
;
1529 mode
->scanline_ordering
= WINED3D_SCANLINE_ORDERING_PROGRESSIVE
;
1533 switch (m
.dmDisplayOrientation
)
1536 *rotation
= WINED3D_DISPLAY_ROTATION_0
;
1539 *rotation
= WINED3D_DISPLAY_ROTATION_90
;
1542 *rotation
= WINED3D_DISPLAY_ROTATION_180
;
1545 *rotation
= WINED3D_DISPLAY_ROTATION_270
;
1548 FIXME("Unhandled display rotation %#lx.\n", m
.dmDisplayOrientation
);
1549 *rotation
= WINED3D_DISPLAY_ROTATION_UNSPECIFIED
;
1554 TRACE("Returning %ux%u@%u %s %#x.\n", mode
->width
, mode
->height
,
1555 mode
->refresh_rate
, debug_d3dformat(mode
->format_id
),
1556 mode
->scanline_ordering
);
1560 static BOOL
equal_display_mode(const DEVMODEW
*mode1
, const DEVMODEW
*mode2
)
1562 if (mode1
->dmFields
& mode2
->dmFields
& DM_PELSWIDTH
1563 && mode1
->dmPelsWidth
!= mode2
->dmPelsWidth
)
1566 if (mode1
->dmFields
& mode2
->dmFields
& DM_PELSHEIGHT
1567 && mode1
->dmPelsHeight
!= mode2
->dmPelsHeight
)
1570 if (mode1
->dmFields
& mode2
->dmFields
& DM_BITSPERPEL
1571 && mode1
->dmBitsPerPel
!= mode2
->dmBitsPerPel
)
1574 if (mode1
->dmFields
& mode2
->dmFields
& DM_DISPLAYFLAGS
1575 && mode1
->dmDisplayFlags
!= mode2
->dmDisplayFlags
)
1578 if (mode1
->dmFields
& mode2
->dmFields
& DM_DISPLAYFREQUENCY
1579 && mode1
->dmDisplayFrequency
!= mode2
->dmDisplayFrequency
)
1582 if (mode1
->dmFields
& mode2
->dmFields
& DM_DISPLAYORIENTATION
1583 && mode1
->dmDisplayOrientation
!= mode2
->dmDisplayOrientation
)
1586 if (mode1
->dmFields
& mode2
->dmFields
& DM_POSITION
1587 && (mode1
->dmPosition
.x
!= mode2
->dmPosition
.x
1588 || mode1
->dmPosition
.y
!= mode2
->dmPosition
.y
))
1594 HRESULT CDECL
wined3d_restore_display_modes(struct wined3d
*wined3d
)
1596 unsigned int adapter_idx
, output_idx
= 0;
1597 DEVMODEW current_mode
, registry_mode
;
1598 struct wined3d_adapter
*adapter
;
1599 DISPLAY_DEVICEW display_device
;
1600 struct wined3d_output
*output
;
1601 BOOL do_mode_change
= FALSE
;
1604 TRACE("wined3d %p.\n", wined3d
);
1606 memset(¤t_mode
, 0, sizeof(current_mode
));
1607 memset(®istry_mode
, 0, sizeof(registry_mode
));
1608 current_mode
.dmSize
= sizeof(current_mode
);
1609 registry_mode
.dmSize
= sizeof(registry_mode
);
1610 display_device
.cb
= sizeof(display_device
);
1611 while (EnumDisplayDevicesW(NULL
, output_idx
++, &display_device
, 0))
1613 if (!EnumDisplaySettingsExW(display_device
.DeviceName
, ENUM_CURRENT_SETTINGS
, ¤t_mode
, 0))
1615 ERR("Failed to read the current display mode for %s.\n",
1616 wine_dbgstr_w(display_device
.DeviceName
));
1617 return WINED3DERR_NOTAVAILABLE
;
1620 if (!EnumDisplaySettingsExW(display_device
.DeviceName
, ENUM_REGISTRY_SETTINGS
, ®istry_mode
, 0))
1622 ERR("Failed to read the registry display mode for %s.\n",
1623 wine_dbgstr_w(display_device
.DeviceName
));
1624 return WINED3DERR_NOTAVAILABLE
;
1627 if (!equal_display_mode(¤t_mode
, ®istry_mode
))
1629 do_mode_change
= TRUE
;
1636 ret
= ChangeDisplaySettingsExW(NULL
, NULL
, NULL
, 0, NULL
);
1637 if (ret
!= DISP_CHANGE_SUCCESSFUL
)
1639 ERR("Failed to restore all outputs to their registry display settings, error %ld.\n", ret
);
1640 return WINED3DERR_NOTAVAILABLE
;
1645 TRACE("Skipping redundant mode setting call.\n");
1648 for (adapter_idx
= 0; adapter_idx
< wined3d
->adapter_count
; ++adapter_idx
)
1650 adapter
= wined3d
->adapters
[adapter_idx
];
1651 for (output_idx
= 0; output_idx
< adapter
->output_count
; ++output_idx
)
1653 output
= &adapter
->outputs
[output_idx
];
1655 if (!EnumDisplaySettingsExW(output
->device_name
, ENUM_CURRENT_SETTINGS
, ¤t_mode
, 0))
1657 ERR("Failed to read the current display mode for %s.\n",
1658 wine_dbgstr_w(output
->device_name
));
1659 return WINED3DERR_NOTAVAILABLE
;
1662 output
->screen_format
= pixelformat_for_depth(current_mode
.dmBitsPerPel
);
1669 HRESULT CDECL
wined3d_output_set_display_mode(struct wined3d_output
*output
,
1670 const struct wined3d_display_mode
*mode
)
1672 enum wined3d_format_id new_format_id
;
1673 const struct wined3d_format
*format
;
1674 DEVMODEW new_mode
, current_mode
;
1677 TRACE("output %p, mode %p.\n", output
, mode
);
1678 TRACE("mode %ux%u@%u %s %#x.\n", mode
->width
, mode
->height
, mode
->refresh_rate
,
1679 debug_d3dformat(mode
->format_id
), mode
->scanline_ordering
);
1681 memset(&new_mode
, 0, sizeof(new_mode
));
1682 new_mode
.dmSize
= sizeof(new_mode
);
1683 memset(¤t_mode
, 0, sizeof(current_mode
));
1684 current_mode
.dmSize
= sizeof(current_mode
);
1686 format
= wined3d_get_format(output
->adapter
, mode
->format_id
, WINED3D_BIND_RENDER_TARGET
);
1688 new_mode
.dmFields
= DM_BITSPERPEL
| DM_PELSWIDTH
| DM_PELSHEIGHT
;
1689 new_mode
.dmBitsPerPel
= format
->byte_count
* CHAR_BIT
;
1690 new_mode
.dmPelsWidth
= mode
->width
;
1691 new_mode
.dmPelsHeight
= mode
->height
;
1692 new_mode
.dmDisplayFrequency
= mode
->refresh_rate
;
1693 if (mode
->refresh_rate
)
1694 new_mode
.dmFields
|= DM_DISPLAYFREQUENCY
;
1695 if (mode
->scanline_ordering
!= WINED3D_SCANLINE_ORDERING_UNKNOWN
)
1697 new_mode
.dmFields
|= DM_DISPLAYFLAGS
;
1698 if (mode
->scanline_ordering
== WINED3D_SCANLINE_ORDERING_INTERLACED
)
1699 new_mode
.dmDisplayFlags
|= DM_INTERLACED
;
1701 new_format_id
= mode
->format_id
;
1703 /* Only change the mode if necessary. */
1704 if (!EnumDisplaySettingsW(output
->device_name
, ENUM_CURRENT_SETTINGS
, ¤t_mode
))
1706 ERR("Failed to get current display mode.\n");
1708 else if (equal_display_mode(¤t_mode
, &new_mode
))
1710 TRACE("Skipping redundant mode setting call.\n");
1711 output
->screen_format
= new_format_id
;
1715 ret
= ChangeDisplaySettingsExW(output
->device_name
, &new_mode
, NULL
, CDS_FULLSCREEN
, NULL
);
1716 if (ret
!= DISP_CHANGE_SUCCESSFUL
)
1718 if (new_mode
.dmFields
& DM_DISPLAYFREQUENCY
)
1720 WARN("ChangeDisplaySettingsExW failed, trying without the refresh rate.\n");
1721 new_mode
.dmFields
&= ~DM_DISPLAYFREQUENCY
;
1722 new_mode
.dmDisplayFrequency
= 0;
1723 ret
= ChangeDisplaySettingsExW(output
->device_name
, &new_mode
, NULL
, CDS_FULLSCREEN
, NULL
);
1725 if (ret
!= DISP_CHANGE_SUCCESSFUL
)
1726 return WINED3DERR_NOTAVAILABLE
;
1729 /* Store the new values. */
1730 output
->screen_format
= new_format_id
;
1735 HRESULT CDECL
wined3d_output_set_gamma_ramp(struct wined3d_output
*output
, const struct wined3d_gamma_ramp
*ramp
)
1739 TRACE("output %p, ramp %p.\n", output
, ramp
);
1741 dc
= CreateDCW(output
->device_name
, NULL
, NULL
, NULL
);
1742 SetDeviceGammaRamp(dc
, (void *)ramp
);
1748 HRESULT
wined3d_output_get_gamma_ramp(struct wined3d_output
*output
, struct wined3d_gamma_ramp
*ramp
)
1752 TRACE("output %p, ramp %p.\n", output
, ramp
);
1754 dc
= CreateDCW(output
->device_name
, NULL
, NULL
, NULL
);
1755 GetDeviceGammaRamp(dc
, ramp
);
1761 HRESULT CDECL
wined3d_adapter_get_identifier(const struct wined3d_adapter
*adapter
,
1762 uint32_t flags
, struct wined3d_adapter_identifier
*identifier
)
1764 TRACE("adapter %p, flags %#x, identifier %p.\n", adapter
, flags
, identifier
);
1766 wined3d_mutex_lock();
1768 wined3d_copy_name(identifier
->driver
, adapter
->driver_info
.name
, identifier
->driver_size
);
1769 wined3d_copy_name(identifier
->description
, adapter
->driver_info
.description
, identifier
->description_size
);
1771 identifier
->driver_version
.u
.HighPart
= adapter
->driver_info
.version_high
;
1772 identifier
->driver_version
.u
.LowPart
= adapter
->driver_info
.version_low
;
1773 identifier
->vendor_id
= adapter
->driver_info
.vendor
;
1774 identifier
->device_id
= adapter
->driver_info
.device
;
1775 identifier
->subsystem_id
= 0;
1776 identifier
->revision
= 0;
1777 identifier
->device_identifier
= IID_D3DDEVICE_D3DUID
;
1778 identifier
->driver_uuid
= adapter
->driver_uuid
;
1779 identifier
->device_uuid
= adapter
->device_uuid
;
1780 identifier
->whql_level
= (flags
& WINED3DENUM_WHQL_LEVEL
) ? 1 : 0;
1781 identifier
->adapter_luid
= adapter
->luid
;
1782 identifier
->video_memory
= min(~(SIZE_T
)0, adapter
->driver_info
.vram_bytes
);
1783 identifier
->shared_system_memory
= min(~(SIZE_T
)0, adapter
->driver_info
.sysmem_bytes
);
1785 wined3d_mutex_unlock();
1790 HRESULT CDECL
wined3d_output_get_raster_status(const struct wined3d_output
*output
,
1791 struct wined3d_raster_status
*raster_status
)
1793 LONGLONG freq_per_frame
, freq_per_line
;
1794 LARGE_INTEGER counter
, freq_per_sec
;
1795 struct wined3d_display_mode mode
;
1799 FIXME("output %p, raster_status %p semi-stub!\n", output
, raster_status
);
1801 WARN("output %p, raster_status %p semi-stub!\n", output
, raster_status
);
1803 /* Obtaining the raster status is a widely implemented but optional
1804 * feature. When this method returns OK StarCraft 2 expects the
1805 * raster_status->InVBlank value to actually change over time.
1806 * And Endless Alice Crysis doesn't care even if this method fails.
1807 * Thus this method returns OK and fakes raster_status by
1808 * QueryPerformanceCounter. */
1810 if (!QueryPerformanceCounter(&counter
) || !QueryPerformanceFrequency(&freq_per_sec
))
1811 return WINED3DERR_INVALIDCALL
;
1812 if (FAILED(wined3d_output_get_display_mode(output
, &mode
, NULL
)))
1813 return WINED3DERR_INVALIDCALL
;
1814 if (mode
.refresh_rate
== DEFAULT_REFRESH_RATE
)
1815 mode
.refresh_rate
= 60;
1817 freq_per_frame
= freq_per_sec
.QuadPart
/ mode
.refresh_rate
;
1818 /* Assume 20 scan lines in the vertical blank. */
1819 freq_per_line
= freq_per_frame
/ (mode
.height
+ 20);
1820 raster_status
->scan_line
= (counter
.QuadPart
% freq_per_frame
) / freq_per_line
;
1821 if (raster_status
->scan_line
< mode
.height
)
1822 raster_status
->in_vblank
= FALSE
;
1825 raster_status
->scan_line
= 0;
1826 raster_status
->in_vblank
= TRUE
;
1829 TRACE("Returning fake value, in_vblank %u, scan_line %u.\n",
1830 raster_status
->in_vblank
, raster_status
->scan_line
);
1835 HRESULT CDECL
wined3d_check_depth_stencil_match(const struct wined3d_adapter
*adapter
,
1836 enum wined3d_device_type device_type
, enum wined3d_format_id adapter_format_id
,
1837 enum wined3d_format_id render_target_format_id
, enum wined3d_format_id depth_stencil_format_id
)
1839 const struct wined3d_format
*rt_format
;
1840 const struct wined3d_format
*ds_format
;
1842 TRACE("adapter %p, device_type %s, adapter_format %s, render_target_format %s, "
1843 "depth_stencil_format %s.\n",
1844 adapter
, debug_d3ddevicetype(device_type
), debug_d3dformat(adapter_format_id
),
1845 debug_d3dformat(render_target_format_id
), debug_d3dformat(depth_stencil_format_id
));
1847 rt_format
= wined3d_get_format(adapter
, render_target_format_id
, WINED3D_BIND_RENDER_TARGET
);
1848 ds_format
= wined3d_get_format(adapter
, depth_stencil_format_id
, WINED3D_BIND_DEPTH_STENCIL
);
1850 if (!(rt_format
->caps
[WINED3D_GL_RES_TYPE_TEX_2D
] & WINED3D_FORMAT_CAP_RENDERTARGET
))
1852 WARN("Format %s is not render target format.\n", debug_d3dformat(rt_format
->id
));
1853 return WINED3DERR_NOTAVAILABLE
;
1855 if (!(ds_format
->caps
[WINED3D_GL_RES_TYPE_TEX_2D
] & WINED3D_FORMAT_CAP_DEPTH_STENCIL
))
1857 WARN("Format %s is not depth/stencil format.\n", debug_d3dformat(ds_format
->id
));
1858 return WINED3DERR_NOTAVAILABLE
;
1861 if (adapter
->adapter_ops
->adapter_check_format(adapter
, NULL
, rt_format
, ds_format
))
1863 TRACE("Formats match.\n");
1867 TRACE("Unsupported format pair: %s and %s.\n",
1868 debug_d3dformat(render_target_format_id
),
1869 debug_d3dformat(depth_stencil_format_id
));
1871 return WINED3DERR_NOTAVAILABLE
;
1874 HRESULT CDECL
wined3d_check_device_multisample_type(const struct wined3d_adapter
*adapter
,
1875 enum wined3d_device_type device_type
, enum wined3d_format_id surface_format_id
, BOOL windowed
,
1876 enum wined3d_multisample_type multisample_type
, unsigned int *quality_levels
)
1878 const struct wined3d_format
*format
;
1879 HRESULT hr
= WINED3D_OK
;
1881 TRACE("adapter %p, device_type %s, surface_format %s, "
1882 "windowed %#x, multisample_type %#x, quality_levels %p.\n",
1883 adapter
, debug_d3ddevicetype(device_type
), debug_d3dformat(surface_format_id
),
1884 windowed
, multisample_type
, quality_levels
);
1886 if (surface_format_id
== WINED3DFMT_UNKNOWN
)
1887 return WINED3DERR_INVALIDCALL
;
1888 if (multisample_type
< WINED3D_MULTISAMPLE_NONE
)
1889 return WINED3DERR_INVALIDCALL
;
1890 if (multisample_type
> WINED3D_MULTISAMPLE_16_SAMPLES
)
1892 FIXME("multisample_type %u not handled yet.\n", multisample_type
);
1893 return WINED3DERR_NOTAVAILABLE
;
1896 format
= wined3d_get_format(adapter
, surface_format_id
, 0);
1898 if (multisample_type
&& !(format
->multisample_types
& 1u << (multisample_type
- 1)))
1899 hr
= WINED3DERR_NOTAVAILABLE
;
1901 if (SUCCEEDED(hr
) || (multisample_type
== WINED3D_MULTISAMPLE_NON_MASKABLE
&& format
->multisample_types
))
1905 if (multisample_type
== WINED3D_MULTISAMPLE_NON_MASKABLE
)
1906 *quality_levels
= wined3d_popcount(format
->multisample_types
);
1908 *quality_levels
= 1;
1913 TRACE("Returning not supported.\n");
1917 static BOOL
wined3d_check_depth_stencil_format(const struct wined3d_adapter
*adapter
,
1918 const struct wined3d_format
*adapter_format
, const struct wined3d_format
*ds_format
,
1919 enum wined3d_gl_resource_type gl_type
)
1921 if (!ds_format
->depth_size
&& !ds_format
->stencil_size
)
1924 return adapter
->adapter_ops
->adapter_check_format(adapter
, adapter_format
, NULL
, ds_format
);
1927 static BOOL
wined3d_check_surface_format(const struct wined3d_format
*format
)
1929 if ((format
->caps
[WINED3D_GL_RES_TYPE_TEX_2D
] | format
->caps
[WINED3D_GL_RES_TYPE_RB
])
1930 & WINED3D_FORMAT_CAP_BLIT
)
1933 if ((format
->attrs
& WINED3D_FORMAT_ATTR_EXTENSION
)
1934 && (format
->caps
[WINED3D_GL_RES_TYPE_TEX_2D
] & WINED3D_FORMAT_CAP_TEXTURE
))
1940 /* OpenGL supports mipmapping on all formats. Wrapping is unsupported, but we
1941 * have to report mipmapping so we cannot reject WRAPANDMIP. Tests show that
1942 * Windows reports WRAPANDMIP on unfilterable surfaces as well, apparently to
1943 * show that wrapping is supported. The lack of filtering will sort out the
1944 * mipmapping capability anyway.
1946 * For now lets report this on all formats, but in the future we may want to
1947 * restrict it to some should applications need that. */
1948 HRESULT CDECL
wined3d_check_device_format(const struct wined3d
*wined3d
,
1949 const struct wined3d_adapter
*adapter
, enum wined3d_device_type device_type
,
1950 enum wined3d_format_id adapter_format_id
, uint32_t usage
, unsigned int bind_flags
,
1951 enum wined3d_resource_type resource_type
, enum wined3d_format_id check_format_id
)
1953 const struct wined3d_format
*adapter_format
, *format
;
1954 enum wined3d_gl_resource_type gl_type
, gl_type_end
;
1955 unsigned int format_caps
= 0, format_attrs
= 0;
1956 BOOL mipmap_gen_supported
= TRUE
;
1957 unsigned int allowed_bind_flags
;
1958 uint32_t allowed_usage
;
1960 TRACE("wined3d %p, adapter %p, device_type %s, adapter_format %s, usage %s, "
1961 "bind_flags %s, resource_type %s, check_format %s.\n",
1962 wined3d
, adapter
, debug_d3ddevicetype(device_type
), debug_d3dformat(adapter_format_id
),
1963 debug_d3dusage(usage
), wined3d_debug_bind_flags(bind_flags
),
1964 debug_d3dresourcetype(resource_type
), debug_d3dformat(check_format_id
));
1966 adapter_format
= wined3d_get_format(adapter
, adapter_format_id
, WINED3D_BIND_RENDER_TARGET
);
1967 format
= wined3d_get_format(adapter
, check_format_id
, bind_flags
);
1969 switch (resource_type
)
1971 case WINED3D_RTYPE_NONE
:
1973 allowed_bind_flags
= WINED3D_BIND_RENDER_TARGET
1974 | WINED3D_BIND_DEPTH_STENCIL
1975 | WINED3D_BIND_UNORDERED_ACCESS
;
1976 gl_type
= WINED3D_GL_RES_TYPE_TEX_2D
;
1977 gl_type_end
= WINED3D_GL_RES_TYPE_TEX_3D
;
1980 case WINED3D_RTYPE_TEXTURE_1D
:
1981 allowed_usage
= WINED3DUSAGE_DYNAMIC
1982 | WINED3DUSAGE_SOFTWAREPROCESSING
1983 | WINED3DUSAGE_QUERY_FILTER
1984 | WINED3DUSAGE_QUERY_GENMIPMAP
1985 | WINED3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING
1986 | WINED3DUSAGE_QUERY_SRGBREAD
1987 | WINED3DUSAGE_QUERY_SRGBWRITE
1988 | WINED3DUSAGE_QUERY_VERTEXTEXTURE
1989 | WINED3DUSAGE_QUERY_WRAPANDMIP
;
1990 allowed_bind_flags
= WINED3D_BIND_SHADER_RESOURCE
1991 | WINED3D_BIND_UNORDERED_ACCESS
;
1992 gl_type
= gl_type_end
= WINED3D_GL_RES_TYPE_TEX_1D
;
1995 case WINED3D_RTYPE_TEXTURE_2D
:
1996 allowed_usage
= WINED3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING
;
1997 if (bind_flags
& WINED3D_BIND_RENDER_TARGET
)
1998 allowed_usage
|= WINED3DUSAGE_QUERY_SRGBWRITE
;
1999 allowed_bind_flags
= WINED3D_BIND_RENDER_TARGET
2000 | WINED3D_BIND_DEPTH_STENCIL
2001 | WINED3D_BIND_UNORDERED_ACCESS
;
2002 gl_type
= gl_type_end
= WINED3D_GL_RES_TYPE_TEX_2D
;
2003 if (!(bind_flags
& WINED3D_BIND_SHADER_RESOURCE
))
2005 if (!wined3d_check_surface_format(format
))
2007 TRACE("%s is not supported for plain surfaces.\n", debug_d3dformat(format
->id
));
2008 return WINED3DERR_NOTAVAILABLE
;
2012 allowed_usage
|= WINED3DUSAGE_DYNAMIC
2013 | WINED3DUSAGE_LEGACY_CUBEMAP
2014 | WINED3DUSAGE_SOFTWAREPROCESSING
2015 | WINED3DUSAGE_QUERY_FILTER
2016 | WINED3DUSAGE_QUERY_GENMIPMAP
2017 | WINED3DUSAGE_QUERY_LEGACYBUMPMAP
2018 | WINED3DUSAGE_QUERY_SRGBREAD
2019 | WINED3DUSAGE_QUERY_SRGBWRITE
2020 | WINED3DUSAGE_QUERY_VERTEXTEXTURE
2021 | WINED3DUSAGE_QUERY_WRAPANDMIP
;
2022 allowed_bind_flags
|= WINED3D_BIND_SHADER_RESOURCE
;
2023 if (usage
& WINED3DUSAGE_LEGACY_CUBEMAP
)
2025 allowed_usage
&= ~WINED3DUSAGE_QUERY_LEGACYBUMPMAP
;
2026 allowed_bind_flags
&= ~WINED3D_BIND_DEPTH_STENCIL
;
2027 gl_type
= gl_type_end
= WINED3D_GL_RES_TYPE_TEX_CUBE
;
2031 case WINED3D_RTYPE_TEXTURE_3D
:
2032 allowed_usage
= WINED3DUSAGE_DYNAMIC
2033 | WINED3DUSAGE_SOFTWAREPROCESSING
2034 | WINED3DUSAGE_QUERY_FILTER
2035 | WINED3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING
2036 | WINED3DUSAGE_QUERY_SRGBREAD
2037 | WINED3DUSAGE_QUERY_SRGBWRITE
2038 | WINED3DUSAGE_QUERY_VERTEXTEXTURE
2039 | WINED3DUSAGE_QUERY_WRAPANDMIP
;
2040 allowed_bind_flags
= WINED3D_BIND_SHADER_RESOURCE
2041 | WINED3D_BIND_UNORDERED_ACCESS
;
2042 gl_type
= gl_type_end
= WINED3D_GL_RES_TYPE_TEX_3D
;
2045 case WINED3D_RTYPE_BUFFER
:
2046 if (wined3d_format_is_typeless(format
))
2048 TRACE("Requested WINED3D_RTYPE_BUFFER, but format %s is typeless.\n", debug_d3dformat(check_format_id
));
2049 return WINED3DERR_NOTAVAILABLE
;
2052 allowed_usage
= WINED3DUSAGE_DYNAMIC
;
2053 allowed_bind_flags
= WINED3D_BIND_SHADER_RESOURCE
2054 | WINED3D_BIND_UNORDERED_ACCESS
2055 | WINED3D_BIND_VERTEX_BUFFER
2056 | WINED3D_BIND_INDEX_BUFFER
;
2057 gl_type
= gl_type_end
= WINED3D_GL_RES_TYPE_BUFFER
;
2061 FIXME("Unhandled resource type %s.\n", debug_d3dresourcetype(resource_type
));
2062 return WINED3DERR_NOTAVAILABLE
;
2065 if ((usage
& allowed_usage
) != usage
)
2067 TRACE("Requested usage %#x, but resource type %s only allows %#x.\n",
2068 usage
, debug_d3dresourcetype(resource_type
), allowed_usage
);
2069 return WINED3DERR_NOTAVAILABLE
;
2072 if ((bind_flags
& allowed_bind_flags
) != bind_flags
)
2074 TRACE("Requested bind flags %s, but resource type %s only allows %s.\n",
2075 wined3d_debug_bind_flags(bind_flags
), debug_d3dresourcetype(resource_type
),
2076 wined3d_debug_bind_flags(allowed_bind_flags
));
2077 return WINED3DERR_NOTAVAILABLE
;
2080 if (bind_flags
& WINED3D_BIND_SHADER_RESOURCE
)
2081 format_caps
|= WINED3D_FORMAT_CAP_TEXTURE
;
2082 if (bind_flags
& WINED3D_BIND_RENDER_TARGET
)
2083 format_caps
|= WINED3D_FORMAT_CAP_RENDERTARGET
;
2084 if (bind_flags
& WINED3D_BIND_DEPTH_STENCIL
)
2085 format_caps
|= WINED3D_FORMAT_CAP_DEPTH_STENCIL
;
2086 if (bind_flags
& WINED3D_BIND_UNORDERED_ACCESS
)
2087 format_caps
|= WINED3D_FORMAT_CAP_UNORDERED_ACCESS
;
2088 if (bind_flags
& WINED3D_BIND_VERTEX_BUFFER
)
2089 format_caps
|= WINED3D_FORMAT_CAP_VERTEX_ATTRIBUTE
;
2090 if (bind_flags
& WINED3D_BIND_INDEX_BUFFER
)
2091 format_caps
|= WINED3D_FORMAT_CAP_INDEX_BUFFER
;
2093 if (usage
& WINED3DUSAGE_QUERY_FILTER
)
2094 format_caps
|= WINED3D_FORMAT_CAP_FILTERING
;
2095 if (usage
& WINED3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING
)
2096 format_caps
|= WINED3D_FORMAT_CAP_POSTPIXELSHADER_BLENDING
;
2097 if (usage
& WINED3DUSAGE_QUERY_SRGBREAD
)
2098 format_caps
|= WINED3D_FORMAT_CAP_SRGB_READ
;
2099 if (usage
& WINED3DUSAGE_QUERY_SRGBWRITE
)
2100 format_caps
|= WINED3D_FORMAT_CAP_SRGB_WRITE
;
2101 if (usage
& WINED3DUSAGE_QUERY_VERTEXTEXTURE
)
2102 format_caps
|= WINED3D_FORMAT_CAP_VTF
;
2103 if (usage
& WINED3DUSAGE_QUERY_LEGACYBUMPMAP
)
2104 format_attrs
|= WINED3D_FORMAT_ATTR_BUMPMAP
;
2106 if ((format_caps
& WINED3D_FORMAT_CAP_TEXTURE
) && (wined3d
->flags
& WINED3D_NO3D
))
2108 TRACE("Requested texturing support, but wined3d was created with WINED3D_NO3D.\n");
2109 return WINED3DERR_NOTAVAILABLE
;
2112 if ((format
->attrs
& format_attrs
) != format_attrs
)
2114 TRACE("Requested format attributes %#x, but format %s only has %#x.\n",
2115 format_attrs
, debug_d3dformat(check_format_id
), format
->attrs
);
2116 return WINED3DERR_NOTAVAILABLE
;
2119 for (; gl_type
<= gl_type_end
; ++gl_type
)
2121 unsigned int caps
= format
->caps
[gl_type
];
2123 if (gl_type
== WINED3D_GL_RES_TYPE_TEX_2D
&& !(bind_flags
& WINED3D_BIND_SHADER_RESOURCE
))
2124 caps
|= format
->caps
[WINED3D_GL_RES_TYPE_RB
];
2126 if ((bind_flags
& WINED3D_BIND_RENDER_TARGET
)
2127 && !adapter
->adapter_ops
->adapter_check_format(adapter
, adapter_format
, format
, NULL
))
2129 TRACE("Requested WINED3D_BIND_RENDER_TARGET, but format %s is not supported for render targets.\n",
2130 debug_d3dformat(check_format_id
));
2131 return WINED3DERR_NOTAVAILABLE
;
2134 /* 3D depth / stencil textures are never supported. */
2135 if (bind_flags
== WINED3D_BIND_DEPTH_STENCIL
&& gl_type
== WINED3D_GL_RES_TYPE_TEX_3D
)
2138 if ((bind_flags
& WINED3D_BIND_DEPTH_STENCIL
)
2139 && !wined3d_check_depth_stencil_format(adapter
, adapter_format
, format
, gl_type
))
2141 TRACE("Requested WINED3D_BIND_DEPTH_STENCIL, but format %s is not supported for depth/stencil buffers.\n",
2142 debug_d3dformat(check_format_id
));
2143 return WINED3DERR_NOTAVAILABLE
;
2146 if ((bind_flags
& WINED3D_BIND_UNORDERED_ACCESS
) && wined3d_format_is_typeless(format
))
2148 TRACE("Requested WINED3D_BIND_UNORDERED_ACCESS, but format %s is typeless.\n",
2149 debug_d3dformat(check_format_id
));
2150 return WINED3DERR_NOTAVAILABLE
;
2153 if ((caps
& format_caps
) != format_caps
)
2155 TRACE("Requested format caps %#x, but format %s only has %#x.\n",
2156 format_caps
, debug_d3dformat(check_format_id
), caps
);
2157 return WINED3DERR_NOTAVAILABLE
;
2160 if (!(caps
& WINED3D_FORMAT_CAP_GEN_MIPMAP
))
2161 mipmap_gen_supported
= FALSE
;
2164 if ((usage
& WINED3DUSAGE_QUERY_GENMIPMAP
) && !mipmap_gen_supported
)
2166 TRACE("No WINED3DUSAGE_AUTOGENMIPMAP support, returning WINED3DOK_NOAUTOGEN.\n");
2167 return WINED3DOK_NOMIPGEN
;
2173 unsigned int CDECL
wined3d_calculate_format_pitch(const struct wined3d_adapter
*adapter
,
2174 enum wined3d_format_id format_id
, unsigned int width
)
2176 unsigned int row_pitch
, slice_pitch
;
2178 TRACE("adapter %p, format_id %s, width %u.\n", adapter
, debug_d3dformat(format_id
), width
);
2180 wined3d_format_calculate_pitch(wined3d_get_format(adapter
, format_id
, 0),
2181 1, width
, 1, &row_pitch
, &slice_pitch
);
2186 HRESULT CDECL
wined3d_check_device_format_conversion(const struct wined3d_output
*output
,
2187 enum wined3d_device_type device_type
, enum wined3d_format_id src_format_id
,
2188 enum wined3d_format_id dst_format_id
)
2190 const struct wined3d_format
*src_format
= wined3d_get_format(output
->adapter
, src_format_id
, 0);
2191 const struct wined3d_format
*dst_format
= wined3d_get_format(output
->adapter
, dst_format_id
, 0);
2193 TRACE("output %p, device_type %s, src_format %s, dst_format %s.\n",
2194 output
, debug_d3ddevicetype(device_type
), debug_d3dformat(src_format_id
),
2195 debug_d3dformat(dst_format_id
));
2197 if (!(src_format
->caps
[WINED3D_GL_RES_TYPE_TEX_2D
] & WINED3D_FORMAT_CAP_BLIT
))
2199 TRACE("Source format does not support blitting.\n");
2200 return WINED3DERR_NOTAVAILABLE
;
2203 if (!(dst_format
->caps
[WINED3D_GL_RES_TYPE_TEX_2D
] & WINED3D_FORMAT_CAP_BLIT
))
2205 TRACE("Destination format does not support blitting.\n");
2206 return WINED3DERR_NOTAVAILABLE
;
2209 /* Source cannot be depth/stencil (although it can be YUV or compressed,
2210 * and AMD also allows blitting from luminance formats). */
2211 if (src_format
->depth_size
|| src_format
->stencil_size
)
2213 TRACE("Source format is depth/stencil.\n");
2214 return WINED3DERR_NOTAVAILABLE
;
2217 /* The destination format must be a simple RGB format (no luminance, YUV,
2218 * compression, etc.) All such formats have a nonzero red_size; the only
2219 * exceptions are X24G8 (not supported in d3d9) and A8 (which, it turns out,
2220 * no vendor reports support for converting to). */
2221 if (!dst_format
->red_size
)
2223 TRACE("Destination format is not a simple RGB format.\n");
2224 return WINED3DERR_NOTAVAILABLE
;
2230 HRESULT CDECL
wined3d_check_device_type(const struct wined3d
*wined3d
,
2231 struct wined3d_output
*output
, enum wined3d_device_type device_type
,
2232 enum wined3d_format_id display_format
, enum wined3d_format_id backbuffer_format
,
2235 BOOL present_conversion
= wined3d
->flags
& WINED3D_PRESENT_CONVERSION
;
2237 TRACE("wined3d %p, output %p, device_type %s, display_format %s, backbuffer_format %s, windowed %#x.\n",
2238 wined3d
, output
, debug_d3ddevicetype(device_type
), debug_d3dformat(display_format
),
2239 debug_d3dformat(backbuffer_format
), windowed
);
2241 /* The task of this function is to check whether a certain display / backbuffer format
2242 * combination is available on the given output. In fullscreen mode microsoft specified
2243 * that the display format shouldn't provide alpha and that ignoring alpha the backbuffer
2244 * and display format should match exactly.
2245 * In windowed mode format conversion can occur and this depends on the driver. */
2247 /* There are only 4 display formats. */
2248 if (!(display_format
== WINED3DFMT_B5G6R5_UNORM
2249 || display_format
== WINED3DFMT_B5G5R5X1_UNORM
2250 || display_format
== WINED3DFMT_B8G8R8X8_UNORM
2251 || display_format
== WINED3DFMT_B10G10R10A2_UNORM
))
2253 TRACE("Format %s is not supported as display format.\n", debug_d3dformat(display_format
));
2254 return WINED3DERR_NOTAVAILABLE
;
2259 /* If the requested display format is not available, don't continue. */
2260 if (!wined3d_output_get_mode_count(output
, display_format
,
2261 WINED3D_SCANLINE_ORDERING_UNKNOWN
, false))
2263 TRACE("No available modes for display format %s.\n", debug_d3dformat(display_format
));
2264 return WINED3DERR_NOTAVAILABLE
;
2267 present_conversion
= FALSE
;
2269 else if (display_format
== WINED3DFMT_B10G10R10A2_UNORM
)
2271 /* WINED3DFMT_B10G10R10A2_UNORM is only allowed in fullscreen mode. */
2272 TRACE("Unsupported format combination %s / %s in windowed mode.\n",
2273 debug_d3dformat(display_format
), debug_d3dformat(backbuffer_format
));
2274 return WINED3DERR_NOTAVAILABLE
;
2277 if (present_conversion
)
2279 /* Use the display format as back buffer format if the latter is
2280 * WINED3DFMT_UNKNOWN. */
2281 if (backbuffer_format
== WINED3DFMT_UNKNOWN
)
2282 backbuffer_format
= display_format
;
2284 if (FAILED(wined3d_check_device_format_conversion(output
, device_type
, backbuffer_format
,
2287 TRACE("Format conversion from %s to %s not supported.\n",
2288 debug_d3dformat(backbuffer_format
), debug_d3dformat(display_format
));
2289 return WINED3DERR_NOTAVAILABLE
;
2294 /* When format conversion from the back buffer format to the display
2295 * format is not allowed, only a limited number of combinations are
2298 if (display_format
== WINED3DFMT_B5G6R5_UNORM
&& backbuffer_format
!= WINED3DFMT_B5G6R5_UNORM
)
2300 TRACE("Unsupported format combination %s / %s.\n",
2301 debug_d3dformat(display_format
), debug_d3dformat(backbuffer_format
));
2302 return WINED3DERR_NOTAVAILABLE
;
2305 if (display_format
== WINED3DFMT_B5G5R5X1_UNORM
2306 && !(backbuffer_format
== WINED3DFMT_B5G5R5X1_UNORM
|| backbuffer_format
== WINED3DFMT_B5G5R5A1_UNORM
))
2308 TRACE("Unsupported format combination %s / %s.\n",
2309 debug_d3dformat(display_format
), debug_d3dformat(backbuffer_format
));
2310 return WINED3DERR_NOTAVAILABLE
;
2313 if (display_format
== WINED3DFMT_B8G8R8X8_UNORM
2314 && !(backbuffer_format
== WINED3DFMT_B8G8R8X8_UNORM
|| backbuffer_format
== WINED3DFMT_B8G8R8A8_UNORM
))
2316 TRACE("Unsupported format combination %s / %s.\n",
2317 debug_d3dformat(display_format
), debug_d3dformat(backbuffer_format
));
2318 return WINED3DERR_NOTAVAILABLE
;
2321 if (display_format
== WINED3DFMT_B10G10R10A2_UNORM
2322 && backbuffer_format
!= WINED3DFMT_B10G10R10A2_UNORM
)
2324 TRACE("Unsupported format combination %s / %s.\n",
2325 debug_d3dformat(display_format
), debug_d3dformat(backbuffer_format
));
2326 return WINED3DERR_NOTAVAILABLE
;
2330 /* Validate that the back buffer format is usable for render targets. */
2331 if (FAILED(wined3d_check_device_format(wined3d
, output
->adapter
, device_type
,
2332 display_format
, 0, WINED3D_BIND_RENDER_TARGET
, WINED3D_RTYPE_TEXTURE_2D
,
2333 backbuffer_format
)))
2335 TRACE("Format %s not allowed for render targets.\n", debug_d3dformat(backbuffer_format
));
2336 return WINED3DERR_NOTAVAILABLE
;
2342 HRESULT CDECL
wined3d_get_device_caps(const struct wined3d_adapter
*adapter
,
2343 enum wined3d_device_type device_type
, struct wined3d_caps
*caps
)
2345 const struct wined3d_d3d_info
*d3d_info
;
2346 struct wined3d_vertex_caps vertex_caps
;
2347 DWORD ckey_caps
, blit_caps
, fx_caps
;
2348 struct fragment_caps fragment_caps
;
2349 struct shader_caps shader_caps
;
2351 TRACE("adapter %p, device_type %s, caps %p.\n",
2352 adapter
, debug_d3ddevicetype(device_type
), caps
);
2354 d3d_info
= &adapter
->d3d_info
;
2356 caps
->DeviceType
= (device_type
== WINED3D_DEVICE_TYPE_HAL
) ? WINED3D_DEVICE_TYPE_HAL
: WINED3D_DEVICE_TYPE_REF
;
2359 caps
->Caps2
= WINED3DCAPS2_CANRENDERWINDOWED
|
2360 WINED3DCAPS2_FULLSCREENGAMMA
|
2361 WINED3DCAPS2_DYNAMICTEXTURES
;
2363 caps
->Caps3
= WINED3DCAPS3_ALPHA_FULLSCREEN_FLIP_OR_DISCARD
|
2364 WINED3DCAPS3_COPY_TO_VIDMEM
|
2365 WINED3DCAPS3_COPY_TO_SYSTEMMEM
;
2367 caps
->CursorCaps
= WINED3DCURSORCAPS_COLOR
|
2368 WINED3DCURSORCAPS_LOWRES
;
2370 caps
->DevCaps
= WINED3DDEVCAPS_FLOATTLVERTEX
|
2371 WINED3DDEVCAPS_EXECUTESYSTEMMEMORY
|
2372 WINED3DDEVCAPS_TLVERTEXSYSTEMMEMORY
|
2373 WINED3DDEVCAPS_TLVERTEXVIDEOMEMORY
|
2374 WINED3DDEVCAPS_DRAWPRIMTLVERTEX
|
2375 WINED3DDEVCAPS_HWTRANSFORMANDLIGHT
|
2376 WINED3DDEVCAPS_EXECUTEVIDEOMEMORY
|
2377 WINED3DDEVCAPS_PUREDEVICE
|
2378 WINED3DDEVCAPS_HWRASTERIZATION
|
2379 WINED3DDEVCAPS_TEXTUREVIDEOMEMORY
|
2380 WINED3DDEVCAPS_TEXTURESYSTEMMEMORY
|
2381 WINED3DDEVCAPS_CANRENDERAFTERFLIP
|
2382 WINED3DDEVCAPS_DRAWPRIMITIVES2
|
2383 WINED3DDEVCAPS_DRAWPRIMITIVES2EX
;
2385 caps
->PrimitiveMiscCaps
= WINED3DPMISCCAPS_CULLNONE
|
2386 WINED3DPMISCCAPS_CULLCCW
|
2387 WINED3DPMISCCAPS_CULLCW
|
2388 WINED3DPMISCCAPS_COLORWRITEENABLE
|
2389 WINED3DPMISCCAPS_CLIPTLVERTS
|
2390 WINED3DPMISCCAPS_CLIPPLANESCALEDPOINTS
|
2391 WINED3DPMISCCAPS_MASKZ
|
2392 WINED3DPMISCCAPS_MRTPOSTPIXELSHADERBLENDING
;
2394 WINED3DPMISCCAPS_NULLREFERENCE
2395 WINED3DPMISCCAPS_FOGANDSPECULARALPHA
2396 WINED3DPMISCCAPS_FOGVERTEXCLAMPED */
2398 caps
->RasterCaps
= WINED3DPRASTERCAPS_DITHER
|
2399 WINED3DPRASTERCAPS_PAT
|
2400 WINED3DPRASTERCAPS_WFOG
|
2401 WINED3DPRASTERCAPS_ZFOG
|
2402 WINED3DPRASTERCAPS_FOGVERTEX
|
2403 WINED3DPRASTERCAPS_FOGTABLE
|
2404 WINED3DPRASTERCAPS_STIPPLE
|
2405 WINED3DPRASTERCAPS_SUBPIXEL
|
2406 WINED3DPRASTERCAPS_ZTEST
|
2407 WINED3DPRASTERCAPS_SCISSORTEST
|
2408 WINED3DPRASTERCAPS_SLOPESCALEDEPTHBIAS
|
2409 WINED3DPRASTERCAPS_DEPTHBIAS
;
2411 caps
->ZCmpCaps
= WINED3DPCMPCAPS_ALWAYS
|
2412 WINED3DPCMPCAPS_EQUAL
|
2413 WINED3DPCMPCAPS_GREATER
|
2414 WINED3DPCMPCAPS_GREATEREQUAL
|
2415 WINED3DPCMPCAPS_LESS
|
2416 WINED3DPCMPCAPS_LESSEQUAL
|
2417 WINED3DPCMPCAPS_NEVER
|
2418 WINED3DPCMPCAPS_NOTEQUAL
;
2420 /* WINED3DPBLENDCAPS_BOTHINVSRCALPHA and WINED3DPBLENDCAPS_BOTHSRCALPHA
2421 * are legacy settings for srcblend only. */
2422 caps
->SrcBlendCaps
= WINED3DPBLENDCAPS_BOTHINVSRCALPHA
|
2423 WINED3DPBLENDCAPS_BOTHSRCALPHA
|
2424 WINED3DPBLENDCAPS_DESTALPHA
|
2425 WINED3DPBLENDCAPS_DESTCOLOR
|
2426 WINED3DPBLENDCAPS_INVDESTALPHA
|
2427 WINED3DPBLENDCAPS_INVDESTCOLOR
|
2428 WINED3DPBLENDCAPS_INVSRCALPHA
|
2429 WINED3DPBLENDCAPS_INVSRCCOLOR
|
2430 WINED3DPBLENDCAPS_ONE
|
2431 WINED3DPBLENDCAPS_SRCALPHA
|
2432 WINED3DPBLENDCAPS_SRCALPHASAT
|
2433 WINED3DPBLENDCAPS_SRCCOLOR
|
2434 WINED3DPBLENDCAPS_ZERO
;
2436 caps
->DestBlendCaps
= WINED3DPBLENDCAPS_DESTALPHA
|
2437 WINED3DPBLENDCAPS_DESTCOLOR
|
2438 WINED3DPBLENDCAPS_INVDESTALPHA
|
2439 WINED3DPBLENDCAPS_INVDESTCOLOR
|
2440 WINED3DPBLENDCAPS_INVSRCALPHA
|
2441 WINED3DPBLENDCAPS_INVSRCCOLOR
|
2442 WINED3DPBLENDCAPS_ONE
|
2443 WINED3DPBLENDCAPS_SRCALPHA
|
2444 WINED3DPBLENDCAPS_SRCCOLOR
|
2445 WINED3DPBLENDCAPS_ZERO
;
2447 caps
->AlphaCmpCaps
= WINED3DPCMPCAPS_ALWAYS
|
2448 WINED3DPCMPCAPS_EQUAL
|
2449 WINED3DPCMPCAPS_GREATER
|
2450 WINED3DPCMPCAPS_GREATEREQUAL
|
2451 WINED3DPCMPCAPS_LESS
|
2452 WINED3DPCMPCAPS_LESSEQUAL
|
2453 WINED3DPCMPCAPS_NEVER
|
2454 WINED3DPCMPCAPS_NOTEQUAL
;
2456 caps
->ShadeCaps
= WINED3DPSHADECAPS_SPECULARGOURAUDRGB
|
2457 WINED3DPSHADECAPS_COLORGOURAUDRGB
|
2458 WINED3DPSHADECAPS_ALPHAFLATBLEND
|
2459 WINED3DPSHADECAPS_ALPHAGOURAUDBLEND
|
2460 WINED3DPSHADECAPS_COLORFLATRGB
|
2461 WINED3DPSHADECAPS_FOGFLAT
|
2462 WINED3DPSHADECAPS_FOGGOURAUD
|
2463 WINED3DPSHADECAPS_SPECULARFLATRGB
;
2465 caps
->TextureCaps
= WINED3DPTEXTURECAPS_ALPHA
|
2466 WINED3DPTEXTURECAPS_ALPHAPALETTE
|
2467 WINED3DPTEXTURECAPS_TRANSPARENCY
|
2468 WINED3DPTEXTURECAPS_BORDER
|
2469 WINED3DPTEXTURECAPS_MIPMAP
|
2470 WINED3DPTEXTURECAPS_PROJECTED
|
2471 WINED3DPTEXTURECAPS_PERSPECTIVE
;
2473 if (!d3d_info
->unconditional_npot
)
2474 caps
->TextureCaps
|= WINED3DPTEXTURECAPS_POW2
| WINED3DPTEXTURECAPS_NONPOW2CONDITIONAL
;
2476 caps
->TextureFilterCaps
= WINED3DPTFILTERCAPS_MAGFLINEAR
|
2477 WINED3DPTFILTERCAPS_MAGFPOINT
|
2478 WINED3DPTFILTERCAPS_MINFLINEAR
|
2479 WINED3DPTFILTERCAPS_MINFPOINT
|
2480 WINED3DPTFILTERCAPS_MIPFLINEAR
|
2481 WINED3DPTFILTERCAPS_MIPFPOINT
|
2482 WINED3DPTFILTERCAPS_LINEAR
|
2483 WINED3DPTFILTERCAPS_LINEARMIPLINEAR
|
2484 WINED3DPTFILTERCAPS_LINEARMIPNEAREST
|
2485 WINED3DPTFILTERCAPS_MIPLINEAR
|
2486 WINED3DPTFILTERCAPS_MIPNEAREST
|
2487 WINED3DPTFILTERCAPS_NEAREST
;
2489 caps
->CubeTextureFilterCaps
= 0;
2490 caps
->VolumeTextureFilterCaps
= 0;
2492 caps
->TextureAddressCaps
= WINED3DPTADDRESSCAPS_INDEPENDENTUV
|
2493 WINED3DPTADDRESSCAPS_CLAMP
|
2494 WINED3DPTADDRESSCAPS_WRAP
;
2496 caps
->VolumeTextureAddressCaps
= 0;
2498 caps
->LineCaps
= WINED3DLINECAPS_TEXTURE
|
2499 WINED3DLINECAPS_ZTEST
|
2500 WINED3DLINECAPS_BLEND
|
2501 WINED3DLINECAPS_ALPHACMP
|
2502 WINED3DLINECAPS_FOG
;
2503 /* WINED3DLINECAPS_ANTIALIAS is not supported on Windows, and dx and gl seem to have a different
2504 * idea how generating the smoothing alpha values works; the result is different
2507 caps
->MaxTextureWidth
= d3d_info
->limits
.texture_size
;
2508 caps
->MaxTextureHeight
= d3d_info
->limits
.texture_size
;
2510 caps
->MaxVolumeExtent
= 0;
2512 caps
->MaxTextureRepeat
= 32768;
2513 caps
->MaxTextureAspectRatio
= d3d_info
->limits
.texture_size
;
2514 caps
->MaxVertexW
= 1e10f
;
2516 caps
->GuardBandLeft
= -32768.0f
;
2517 caps
->GuardBandTop
= -32768.0f
;
2518 caps
->GuardBandRight
= 32768.0f
;
2519 caps
->GuardBandBottom
= 32768.0f
;
2521 caps
->ExtentsAdjust
= 0.0f
;
2523 caps
->StencilCaps
= WINED3DSTENCILCAPS_DECRSAT
|
2524 WINED3DSTENCILCAPS_INCRSAT
|
2525 WINED3DSTENCILCAPS_INVERT
|
2526 WINED3DSTENCILCAPS_KEEP
|
2527 WINED3DSTENCILCAPS_REPLACE
|
2528 WINED3DSTENCILCAPS_ZERO
;
2530 caps
->MaxAnisotropy
= 0;
2531 caps
->MaxPointSize
= d3d_info
->limits
.pointsize_max
;
2533 caps
->MaxPrimitiveCount
= 0x555555; /* Taken from an AMD Radeon HD 5700 (Evergreen) GPU. */
2534 caps
->MaxVertexIndex
= 0xffffff; /* Taken from an AMD Radeon HD 5700 (Evergreen) GPU. */
2535 caps
->MaxStreams
= WINED3D_MAX_STREAMS
;
2536 caps
->MaxStreamStride
= 1024;
2538 /* d3d9.dll sets D3DDEVCAPS2_CAN_STRETCHRECT_FROM_TEXTURES here because StretchRects is implemented in d3d9 */
2539 caps
->DevCaps2
= WINED3DDEVCAPS2_STREAMOFFSET
|
2540 WINED3DDEVCAPS2_VERTEXELEMENTSCANSHARESTREAMOFFSET
;
2541 caps
->MaxNpatchTessellationLevel
= 0;
2543 caps
->NumSimultaneousRTs
= d3d_info
->limits
.max_rt_count
;
2545 caps
->StretchRectFilterCaps
= WINED3DPTFILTERCAPS_MINFPOINT
|
2546 WINED3DPTFILTERCAPS_MAGFPOINT
|
2547 WINED3DPTFILTERCAPS_MINFLINEAR
|
2548 WINED3DPTFILTERCAPS_MAGFLINEAR
;
2549 caps
->VertexTextureFilterCaps
= 0;
2551 adapter
->shader_backend
->shader_get_caps(adapter
, &shader_caps
);
2552 adapter
->fragment_pipe
->get_caps(adapter
, &fragment_caps
);
2553 adapter
->vertex_pipe
->vp_get_caps(adapter
, &vertex_caps
);
2555 /* Add shader misc caps. Only some of them belong to the shader parts of the pipeline */
2556 caps
->PrimitiveMiscCaps
|= fragment_caps
.PrimitiveMiscCaps
;
2558 caps
->VertexShaderVersion
= shader_caps
.vs_version
;
2559 caps
->MaxVertexShaderConst
= shader_caps
.vs_uniform_count
;
2561 caps
->PixelShaderVersion
= shader_caps
.ps_version
;
2562 caps
->PixelShader1xMaxValue
= shader_caps
.ps_1x_max_value
;
2564 caps
->TextureOpCaps
= fragment_caps
.TextureOpCaps
;
2565 caps
->MaxTextureBlendStages
= fragment_caps
.max_blend_stages
;
2566 caps
->MaxSimultaneousTextures
= fragment_caps
.max_textures
;
2568 caps
->MaxUserClipPlanes
= vertex_caps
.max_user_clip_planes
;
2569 caps
->MaxActiveLights
= vertex_caps
.max_active_lights
;
2570 caps
->MaxVertexBlendMatrices
= vertex_caps
.max_vertex_blend_matrices
;
2571 caps
->MaxVertexBlendMatrixIndex
= vertex_caps
.max_vertex_blend_matrix_index
;
2572 caps
->VertexProcessingCaps
= vertex_caps
.vertex_processing_caps
;
2573 caps
->FVFCaps
= vertex_caps
.fvf_caps
;
2574 caps
->RasterCaps
|= vertex_caps
.raster_caps
;
2576 /* The following caps are shader specific, but they are things we cannot detect, or which
2577 * are the same among all shader models. So to avoid code duplication set the shader version
2578 * specific, but otherwise constant caps here
2580 if (caps
->VertexShaderVersion
>= 3)
2582 /* Where possible set the caps based on OpenGL extensions and if they
2583 * aren't set (in case of software rendering) use the VS 3.0 from
2584 * MSDN or else if there's OpenGL spec use a hardcoded value minimum
2586 caps
->VS20Caps
.caps
= WINED3DVS20CAPS_PREDICATION
;
2587 /* VS 3.0 requires MAX_DYNAMICFLOWCONTROLDEPTH (24) */
2588 caps
->VS20Caps
.dynamic_flow_control_depth
= WINED3DVS20_MAX_DYNAMICFLOWCONTROLDEPTH
;
2589 caps
->VS20Caps
.temp_count
= 32;
2590 /* level of nesting in loops / if-statements; VS 3.0 requires MAX (4) */
2591 caps
->VS20Caps
.static_flow_control_depth
= WINED3DVS20_MAX_STATICFLOWCONTROLDEPTH
;
2593 caps
->MaxVShaderInstructionsExecuted
= 65535; /* VS 3.0 needs at least 65535, some cards even use 2^32-1 */
2594 caps
->MaxVertexShader30InstructionSlots
= WINED3DMIN30SHADERINSTRUCTIONS
;
2595 caps
->VertexTextureFilterCaps
= WINED3DPTFILTERCAPS_MINFPOINT
| WINED3DPTFILTERCAPS_MAGFPOINT
;
2597 else if (caps
->VertexShaderVersion
== 2)
2599 caps
->VS20Caps
.caps
= 0;
2600 caps
->VS20Caps
.dynamic_flow_control_depth
= WINED3DVS20_MIN_DYNAMICFLOWCONTROLDEPTH
;
2601 caps
->VS20Caps
.temp_count
= WINED3DVS20_MIN_NUMTEMPS
;
2602 caps
->VS20Caps
.static_flow_control_depth
= 1;
2604 caps
->MaxVShaderInstructionsExecuted
= 65535;
2605 caps
->MaxVertexShader30InstructionSlots
= 0;
2609 caps
->VS20Caps
.caps
= 0;
2610 caps
->VS20Caps
.dynamic_flow_control_depth
= 0;
2611 caps
->VS20Caps
.temp_count
= 0;
2612 caps
->VS20Caps
.static_flow_control_depth
= 0;
2614 caps
->MaxVShaderInstructionsExecuted
= 0;
2615 caps
->MaxVertexShader30InstructionSlots
= 0;
2618 if (caps
->PixelShaderVersion
>= 3)
2620 /* Where possible set the caps based on OpenGL extensions and if they
2621 * aren't set (in case of software rendering) use the PS 3.0 from
2622 * MSDN or else if there's OpenGL spec use a hardcoded value minimum
2625 /* Caps is more or less undocumented on MSDN but it appears to be
2626 * used for PS20Caps based on results from R9600/FX5900/Geforce6800
2627 * cards from Windows */
2628 caps
->PS20Caps
.caps
= WINED3DPS20CAPS_ARBITRARYSWIZZLE
|
2629 WINED3DPS20CAPS_GRADIENTINSTRUCTIONS
|
2630 WINED3DPS20CAPS_PREDICATION
|
2631 WINED3DPS20CAPS_NODEPENDENTREADLIMIT
|
2632 WINED3DPS20CAPS_NOTEXINSTRUCTIONLIMIT
;
2633 /* PS 3.0 requires MAX_DYNAMICFLOWCONTROLDEPTH (24) */
2634 caps
->PS20Caps
.dynamic_flow_control_depth
= WINED3DPS20_MAX_DYNAMICFLOWCONTROLDEPTH
;
2635 caps
->PS20Caps
.temp_count
= 32;
2636 /* PS 3.0 requires MAX_STATICFLOWCONTROLDEPTH (4) */
2637 caps
->PS20Caps
.static_flow_control_depth
= WINED3DPS20_MAX_STATICFLOWCONTROLDEPTH
;
2638 /* PS 3.0 requires MAX_NUMINSTRUCTIONSLOTS (512) */
2639 caps
->PS20Caps
.instruction_slot_count
= WINED3DPS20_MAX_NUMINSTRUCTIONSLOTS
;
2641 caps
->MaxPShaderInstructionsExecuted
= 65535;
2642 caps
->MaxPixelShader30InstructionSlots
= WINED3DMIN30SHADERINSTRUCTIONS
;
2644 else if (caps
->PixelShaderVersion
== 2)
2646 /* Below we assume PS2.0 specs, not extended 2.0a(GeforceFX)/2.0b(Radeon R3xx) ones */
2647 caps
->PS20Caps
.caps
= 0;
2648 caps
->PS20Caps
.dynamic_flow_control_depth
= 0; /* WINED3DVS20_MIN_DYNAMICFLOWCONTROLDEPTH = 0 */
2649 caps
->PS20Caps
.temp_count
= WINED3DPS20_MIN_NUMTEMPS
;
2650 caps
->PS20Caps
.static_flow_control_depth
= WINED3DPS20_MIN_STATICFLOWCONTROLDEPTH
; /* Minimum: 1 */
2651 /* Minimum number (64 ALU + 32 Texture), a GeforceFX uses 512 */
2652 caps
->PS20Caps
.instruction_slot_count
= WINED3DPS20_MIN_NUMINSTRUCTIONSLOTS
;
2654 caps
->MaxPShaderInstructionsExecuted
= 512; /* Minimum value, a GeforceFX uses 1024 */
2655 caps
->MaxPixelShader30InstructionSlots
= 0;
2659 caps
->PS20Caps
.caps
= 0;
2660 caps
->PS20Caps
.dynamic_flow_control_depth
= 0;
2661 caps
->PS20Caps
.temp_count
= 0;
2662 caps
->PS20Caps
.static_flow_control_depth
= 0;
2663 caps
->PS20Caps
.instruction_slot_count
= 0;
2665 caps
->MaxPShaderInstructionsExecuted
= 0;
2666 caps
->MaxPixelShader30InstructionSlots
= 0;
2669 if (caps
->VertexShaderVersion
>= 2)
2671 /* OpenGL supports all the formats below, perhaps not always
2672 * without conversion, but it supports them.
2673 * Further GLSL doesn't seem to have an official unsigned type so
2674 * don't advertise it yet as I'm not sure how we handle it.
2675 * We might need to add some clamping in the shader engine to
2677 * TODO: WINED3DDTCAPS_USHORT2N, WINED3DDTCAPS_USHORT4N, WINED3DDTCAPS_UDEC3, WINED3DDTCAPS_DEC3N */
2678 caps
->DeclTypes
= WINED3DDTCAPS_UBYTE4
|
2679 WINED3DDTCAPS_UBYTE4N
|
2680 WINED3DDTCAPS_SHORT2N
|
2681 WINED3DDTCAPS_SHORT4N
;
2685 caps
->DeclTypes
= 0;
2688 /* Set DirectDraw helper Caps */
2689 ckey_caps
= WINEDDCKEYCAPS_DESTBLT
|
2690 WINEDDCKEYCAPS_SRCBLT
;
2691 fx_caps
= WINEDDFXCAPS_BLTALPHA
|
2692 WINEDDFXCAPS_BLTMIRRORLEFTRIGHT
|
2693 WINEDDFXCAPS_BLTMIRRORUPDOWN
|
2694 WINEDDFXCAPS_BLTROTATION90
|
2695 WINEDDFXCAPS_BLTSHRINKX
|
2696 WINEDDFXCAPS_BLTSHRINKXN
|
2697 WINEDDFXCAPS_BLTSHRINKY
|
2698 WINEDDFXCAPS_BLTSHRINKYN
|
2699 WINEDDFXCAPS_BLTSTRETCHX
|
2700 WINEDDFXCAPS_BLTSTRETCHXN
|
2701 WINEDDFXCAPS_BLTSTRETCHY
|
2702 WINEDDFXCAPS_BLTSTRETCHYN
;
2703 blit_caps
= WINEDDCAPS_BLT
|
2704 WINEDDCAPS_BLTCOLORFILL
|
2705 WINEDDCAPS_BLTDEPTHFILL
|
2706 WINEDDCAPS_BLTSTRETCH
|
2707 WINEDDCAPS_CANBLTSYSMEM
|
2708 WINEDDCAPS_CANCLIP
|
2709 WINEDDCAPS_CANCLIPSTRETCHED
|
2710 WINEDDCAPS_COLORKEY
|
2711 WINEDDCAPS_COLORKEYHWASSIST
;
2713 /* Fill the ddraw caps structure */
2714 caps
->ddraw_caps
.caps
= WINEDDCAPS_GDI
|
2715 WINEDDCAPS_PALETTE
|
2717 caps
->ddraw_caps
.caps2
= WINEDDCAPS2_CERTIFIED
|
2718 WINEDDCAPS2_NOPAGELOCKREQUIRED
|
2719 WINEDDCAPS2_PRIMARYGAMMA
|
2720 WINEDDCAPS2_WIDESURFACES
|
2721 WINEDDCAPS2_CANRENDERWINDOWED
;
2722 caps
->ddraw_caps
.color_key_caps
= ckey_caps
;
2723 caps
->ddraw_caps
.fx_caps
= fx_caps
;
2724 caps
->ddraw_caps
.svb_caps
= blit_caps
;
2725 caps
->ddraw_caps
.svb_color_key_caps
= ckey_caps
;
2726 caps
->ddraw_caps
.svb_fx_caps
= fx_caps
;
2727 caps
->ddraw_caps
.vsb_caps
= blit_caps
;
2728 caps
->ddraw_caps
.vsb_color_key_caps
= ckey_caps
;
2729 caps
->ddraw_caps
.vsb_fx_caps
= fx_caps
;
2730 caps
->ddraw_caps
.ssb_caps
= blit_caps
;
2731 caps
->ddraw_caps
.ssb_color_key_caps
= ckey_caps
;
2732 caps
->ddraw_caps
.ssb_fx_caps
= fx_caps
;
2734 caps
->ddraw_caps
.dds_caps
= WINEDDSCAPS_FLIP
2735 | WINEDDSCAPS_OFFSCREENPLAIN
2736 | WINEDDSCAPS_PALETTE
2737 | WINEDDSCAPS_PRIMARYSURFACE
2738 | WINEDDSCAPS_TEXTURE
2739 | WINEDDSCAPS_ZBUFFER
2740 | WINEDDSCAPS_MIPMAP
;
2742 caps
->shader_double_precision
= d3d_info
->shader_double_precision
;
2743 caps
->viewport_array_index_any_shader
= d3d_info
->viewport_array_index_any_shader
;
2744 caps
->stencil_export
= d3d_info
->stencil_export
;
2746 caps
->max_feature_level
= d3d_info
->feature_level
;
2748 adapter
->adapter_ops
->adapter_get_wined3d_caps(adapter
, caps
);
2753 HRESULT CDECL
wined3d_device_create(struct wined3d
*wined3d
, struct wined3d_adapter
*adapter
,
2754 enum wined3d_device_type device_type
, HWND focus_window
, uint32_t flags
, BYTE surface_alignment
,
2755 const enum wined3d_feature_level
*feature_levels
, unsigned int feature_level_count
,
2756 struct wined3d_device_parent
*device_parent
, struct wined3d_device
**device
)
2758 struct wined3d_device
*object
;
2761 TRACE("wined3d %p, adapter %p, device_type %#x, focus_window %p, flags %#x, "
2762 "surface_alignment %u, feature_levels %p, feature_level_count %u, device_parent %p, device %p.\n",
2763 wined3d
, adapter
, device_type
, focus_window
, flags
, surface_alignment
,
2764 feature_levels
, feature_level_count
, device_parent
, device
);
2766 if (FAILED(hr
= adapter
->adapter_ops
->adapter_create_device(wined3d
, adapter
,
2767 device_type
, focus_window
, flags
, surface_alignment
,
2768 feature_levels
, feature_level_count
, device_parent
, &object
)))
2771 TRACE("Created device %p.\n", object
);
2774 device_parent
->ops
->wined3d_device_created(device_parent
, *device
);
2779 static const struct wined3d_state_entry_template misc_state_template_no3d
[] =
2781 {STATE_CONSTANT_BUFFER(WINED3D_SHADER_TYPE_VERTEX
), {STATE_VDECL
}},
2782 {STATE_CONSTANT_BUFFER(WINED3D_SHADER_TYPE_HULL
), {STATE_VDECL
}},
2783 {STATE_CONSTANT_BUFFER(WINED3D_SHADER_TYPE_DOMAIN
), {STATE_VDECL
}},
2784 {STATE_CONSTANT_BUFFER(WINED3D_SHADER_TYPE_GEOMETRY
), {STATE_VDECL
}},
2785 {STATE_CONSTANT_BUFFER(WINED3D_SHADER_TYPE_PIXEL
), {STATE_VDECL
}},
2786 {STATE_CONSTANT_BUFFER(WINED3D_SHADER_TYPE_COMPUTE
), {STATE_VDECL
}},
2787 {STATE_GRAPHICS_SHADER_RESOURCE_BINDING
, {STATE_VDECL
}},
2788 {STATE_GRAPHICS_UNORDERED_ACCESS_VIEW_BINDING
, {STATE_VDECL
}},
2789 {STATE_COMPUTE_SHADER_RESOURCE_BINDING
, {STATE_VDECL
}},
2790 {STATE_COMPUTE_UNORDERED_ACCESS_VIEW_BINDING
, {STATE_VDECL
}},
2791 {STATE_STREAM_OUTPUT
, {STATE_VDECL
}},
2792 {STATE_BLEND
, {STATE_VDECL
}},
2793 {STATE_BLEND_FACTOR
, {STATE_VDECL
}},
2794 {STATE_SAMPLE_MASK
, {STATE_VDECL
}},
2795 {STATE_DEPTH_STENCIL
, {STATE_VDECL
}},
2796 {STATE_STENCIL_REF
, {STATE_VDECL
}},
2797 {STATE_DEPTH_BOUNDS
, {STATE_VDECL
}},
2798 {STATE_STREAMSRC
, {STATE_VDECL
}},
2799 {STATE_VDECL
, {STATE_VDECL
, state_nop
}},
2800 {STATE_RASTERIZER
, {STATE_VDECL
}},
2801 {STATE_SCISSORRECT
, {STATE_VDECL
}},
2803 {STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_MAT00
), {STATE_VDECL
}},
2804 {STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_MAT01
), {STATE_VDECL
}},
2805 {STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_MAT10
), {STATE_VDECL
}},
2806 {STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_MAT11
), {STATE_VDECL
}},
2807 {STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_MAT00
), {STATE_VDECL
}},
2808 {STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_MAT01
), {STATE_VDECL
}},
2809 {STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_MAT10
), {STATE_VDECL
}},
2810 {STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_MAT11
), {STATE_VDECL
}},
2811 {STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_MAT00
), {STATE_VDECL
}},
2812 {STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_MAT01
), {STATE_VDECL
}},
2813 {STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_MAT10
), {STATE_VDECL
}},
2814 {STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_MAT11
), {STATE_VDECL
}},
2815 {STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_MAT00
), {STATE_VDECL
}},
2816 {STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_MAT01
), {STATE_VDECL
}},
2817 {STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_MAT10
), {STATE_VDECL
}},
2818 {STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_MAT11
), {STATE_VDECL
}},
2819 {STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_MAT00
), {STATE_VDECL
}},
2820 {STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_MAT01
), {STATE_VDECL
}},
2821 {STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_MAT10
), {STATE_VDECL
}},
2822 {STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_MAT11
), {STATE_VDECL
}},
2823 {STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_MAT00
), {STATE_VDECL
}},
2824 {STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_MAT01
), {STATE_VDECL
}},
2825 {STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_MAT10
), {STATE_VDECL
}},
2826 {STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_MAT11
), {STATE_VDECL
}},
2827 {STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_MAT00
), {STATE_VDECL
}},
2828 {STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_MAT01
), {STATE_VDECL
}},
2829 {STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_MAT10
), {STATE_VDECL
}},
2830 {STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_MAT11
), {STATE_VDECL
}},
2831 {STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_MAT00
), {STATE_VDECL
}},
2832 {STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_MAT01
), {STATE_VDECL
}},
2833 {STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_MAT10
), {STATE_VDECL
}},
2834 {STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_MAT11
), {STATE_VDECL
}},
2835 {STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_LSCALE
), {STATE_VDECL
}},
2836 {STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_LOFFSET
), {STATE_VDECL
}},
2837 {STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_LSCALE
), {STATE_VDECL
}},
2838 {STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_LOFFSET
), {STATE_VDECL
}},
2839 {STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_LSCALE
), {STATE_VDECL
}},
2840 {STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_LOFFSET
), {STATE_VDECL
}},
2841 {STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_LSCALE
), {STATE_VDECL
}},
2842 {STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_LOFFSET
), {STATE_VDECL
}},
2843 {STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_LSCALE
), {STATE_VDECL
}},
2844 {STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_LOFFSET
), {STATE_VDECL
}},
2845 {STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_LSCALE
), {STATE_VDECL
}},
2846 {STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_LOFFSET
), {STATE_VDECL
}},
2847 {STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_LSCALE
), {STATE_VDECL
}},
2848 {STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_LOFFSET
), {STATE_VDECL
}},
2849 {STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_LSCALE
), {STATE_VDECL
}},
2850 {STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_LOFFSET
), {STATE_VDECL
}},
2852 {STATE_VIEWPORT
, {STATE_VDECL
}},
2853 {STATE_INDEXBUFFER
, {STATE_VDECL
}},
2854 {STATE_RENDER(WINED3D_RS_LINEPATTERN
), {STATE_VDECL
}},
2855 {STATE_RENDER(WINED3D_RS_ZFUNC
), {STATE_VDECL
}},
2856 {STATE_RENDER(WINED3D_RS_DITHERENABLE
), {STATE_VDECL
}},
2857 {STATE_RENDER(WINED3D_RS_MULTISAMPLEANTIALIAS
), {STATE_VDECL
}},
2858 {STATE_BASEVERTEXINDEX
, {STATE_VDECL
}},
2859 {STATE_FRAMEBUFFER
, {STATE_VDECL
}},
2860 {STATE_SHADER(WINED3D_SHADER_TYPE_PIXEL
), {STATE_VDECL
}},
2861 {STATE_SHADER(WINED3D_SHADER_TYPE_HULL
), {STATE_VDECL
}},
2862 {STATE_SHADER(WINED3D_SHADER_TYPE_DOMAIN
), {STATE_VDECL
}},
2863 {STATE_SHADER(WINED3D_SHADER_TYPE_GEOMETRY
), {STATE_VDECL
}},
2864 {STATE_SHADER(WINED3D_SHADER_TYPE_COMPUTE
), {STATE_VDECL
}},
2865 {0}, /* Terminate */
2868 static void adapter_no3d_destroy(struct wined3d_adapter
*adapter
)
2870 wined3d_adapter_cleanup(adapter
);
2874 static HRESULT
adapter_no3d_create_device(struct wined3d
*wined3d
, const struct wined3d_adapter
*adapter
,
2875 enum wined3d_device_type device_type
, HWND focus_window
, unsigned int flags
, BYTE surface_alignment
,
2876 const enum wined3d_feature_level
*levels
, unsigned int level_count
,
2877 struct wined3d_device_parent
*device_parent
, struct wined3d_device
**device
)
2879 /* No extensions in the state table, only extension 0, which is implicitly supported. */
2880 static const BOOL supported_extensions
[] = {TRUE
};
2881 struct wined3d_device_no3d
*device_no3d
;
2884 if (!(device_no3d
= calloc(1, sizeof(*device_no3d
))))
2885 return E_OUTOFMEMORY
;
2887 if (FAILED(hr
= wined3d_device_init(&device_no3d
->d
, wined3d
, adapter
->ordinal
, device_type
, focus_window
,
2888 flags
, surface_alignment
, levels
, level_count
, supported_extensions
, device_parent
)))
2890 WARN("Failed to initialize device, hr %#lx.\n", hr
);
2895 *device
= &device_no3d
->d
;
2900 static void adapter_no3d_destroy_device(struct wined3d_device
*device
)
2902 wined3d_device_cleanup(device
);
2906 static struct wined3d_context
*adapter_no3d_acquire_context(struct wined3d_device
*device
,
2907 struct wined3d_texture
*texture
, unsigned int sub_resource_idx
)
2909 TRACE("device %p, texture %p, sub_resource_idx %u.\n", device
, texture
, sub_resource_idx
);
2911 wined3d_from_cs(device
->cs
);
2913 if (!device
->context_count
)
2916 return &wined3d_device_no3d(device
)->context_no3d
;
2919 static void adapter_no3d_release_context(struct wined3d_context
*context
)
2921 TRACE("context %p.\n", context
);
2924 static void adapter_no3d_get_wined3d_caps(const struct wined3d_adapter
*adapter
, struct wined3d_caps
*caps
)
2928 static BOOL
adapter_no3d_check_format(const struct wined3d_adapter
*adapter
,
2929 const struct wined3d_format
*adapter_format
, const struct wined3d_format
*rt_format
,
2930 const struct wined3d_format
*ds_format
)
2935 static HRESULT
adapter_no3d_init_3d(struct wined3d_device
*device
)
2937 struct wined3d_context
*context_no3d
;
2940 TRACE("device %p.\n", device
);
2942 context_no3d
= &wined3d_device_no3d(device
)->context_no3d
;
2943 if (FAILED(hr
= wined3d_context_no3d_init(context_no3d
, device
->swapchains
[0])))
2945 WARN("Failed to initialise context.\n");
2949 if (!device_context_add(device
, context_no3d
))
2951 ERR("Failed to add the newly created context to the context list.\n");
2952 wined3d_context_cleanup(context_no3d
);
2956 TRACE("Initialised context %p.\n", context_no3d
);
2958 if (!(device
->blitter
= wined3d_cpu_blitter_create()))
2960 ERR("Failed to create CPU blitter.\n");
2961 device_context_remove(device
, context_no3d
);
2962 wined3d_context_cleanup(context_no3d
);
2969 static void adapter_no3d_uninit_3d(struct wined3d_device
*device
)
2971 struct wined3d_context
*context_no3d
;
2973 TRACE("device %p.\n", device
);
2975 context_no3d
= &wined3d_device_no3d(device
)->context_no3d
;
2976 device
->blitter
->ops
->blitter_destroy(device
->blitter
, NULL
);
2977 wined3d_cs_finish(device
->cs
, WINED3D_CS_QUEUE_DEFAULT
);
2979 device_context_remove(device
, context_no3d
);
2980 wined3d_context_cleanup(context_no3d
);
2983 static void *adapter_no3d_map_bo_address(struct wined3d_context
*context
,
2984 const struct wined3d_bo_address
*data
, size_t size
, uint32_t map_flags
)
2986 if (data
->buffer_object
)
2988 ERR("Unsupported buffer object %p.\n", data
->buffer_object
);
2995 static void adapter_no3d_unmap_bo_address(struct wined3d_context
*context
,
2996 const struct wined3d_bo_address
*data
, unsigned int range_count
, const struct wined3d_range
*ranges
)
2998 if (data
->buffer_object
)
2999 ERR("Unsupported buffer object %p.\n", data
->buffer_object
);
3002 static void adapter_no3d_copy_bo_address(struct wined3d_context
*context
,
3003 const struct wined3d_bo_address
*dst
, const struct wined3d_bo_address
*src
,
3004 unsigned int range_count
, const struct wined3d_range
*ranges
, uint32_t map_flags
)
3008 if (dst
->buffer_object
)
3009 ERR("Unsupported dst buffer object %p.\n", dst
->buffer_object
);
3010 if (src
->buffer_object
)
3011 ERR("Unsupported src buffer object %p.\n", src
->buffer_object
);
3012 if (dst
->buffer_object
|| src
->buffer_object
)
3015 for (i
= 0; i
< range_count
; ++i
)
3016 memcpy(dst
->addr
+ ranges
[i
].offset
, src
->addr
+ ranges
[i
].offset
, ranges
[i
].size
);
3019 static void adapter_no3d_flush_bo_address(struct wined3d_context
*context
,
3020 const struct wined3d_const_bo_address
*data
, size_t size
)
3024 static bool adapter_no3d_alloc_bo(struct wined3d_device
*device
, struct wined3d_resource
*resource
,
3025 unsigned int sub_resource_idx
, struct wined3d_bo_address
*addr
)
3030 static void adapter_no3d_destroy_bo(struct wined3d_context
*context
, struct wined3d_bo
*bo
)
3034 static HRESULT
adapter_no3d_create_swapchain(struct wined3d_device
*device
,
3035 const struct wined3d_swapchain_desc
*desc
, struct wined3d_swapchain_state_parent
*state_parent
,
3036 void *parent
, const struct wined3d_parent_ops
*parent_ops
, struct wined3d_swapchain
**swapchain
)
3038 struct wined3d_swapchain
*swapchain_no3d
;
3041 TRACE("device %p, desc %p, state_parent %p, parent %p, parent_ops %p, swapchain %p.\n",
3042 device
, desc
, state_parent
, parent
, parent_ops
, swapchain
);
3044 if (!(swapchain_no3d
= calloc(1, sizeof(*swapchain_no3d
))))
3045 return E_OUTOFMEMORY
;
3047 if (FAILED(hr
= wined3d_swapchain_no3d_init(swapchain_no3d
, device
, desc
, state_parent
, parent
,
3050 WARN("Failed to initialise swapchain, hr %#lx.\n", hr
);
3051 free(swapchain_no3d
);
3055 TRACE("Created swapchain %p.\n", swapchain_no3d
);
3056 *swapchain
= swapchain_no3d
;
3061 static void adapter_no3d_destroy_swapchain(struct wined3d_swapchain
*swapchain
)
3063 wined3d_swapchain_cleanup(swapchain
);
3067 static HRESULT
adapter_no3d_create_buffer(struct wined3d_device
*device
,
3068 const struct wined3d_buffer_desc
*desc
, const struct wined3d_sub_resource_data
*data
,
3069 void *parent
, const struct wined3d_parent_ops
*parent_ops
, struct wined3d_buffer
**buffer
)
3071 struct wined3d_buffer
*buffer_no3d
;
3074 TRACE("device %p, desc %p, data %p, parent %p, parent_ops %p, buffer %p.\n",
3075 device
, desc
, data
, parent
, parent_ops
, buffer
);
3077 if (!(buffer_no3d
= calloc(1, sizeof(*buffer_no3d
))))
3078 return E_OUTOFMEMORY
;
3080 if (FAILED(hr
= wined3d_buffer_no3d_init(buffer_no3d
, device
, desc
, data
, parent
, parent_ops
)))
3082 WARN("Failed to initialise buffer, hr %#lx.\n", hr
);
3087 TRACE("Created buffer %p.\n", buffer_no3d
);
3088 *buffer
= buffer_no3d
;
3093 static void adapter_no3d_destroy_buffer(struct wined3d_buffer
*buffer
)
3095 struct wined3d_device
*device
= buffer
->resource
.device
;
3096 unsigned int swapchain_count
= device
->swapchain_count
;
3098 TRACE("buffer %p.\n", buffer
);
3100 /* Take a reference to the device, in case releasing the buffer would
3101 * cause the device to be destroyed. However, swapchain resources don't
3102 * take a reference to the device, and we wouldn't want to increment the
3103 * refcount on a device that's in the process of being destroyed. */
3104 if (swapchain_count
)
3105 wined3d_device_incref(device
);
3106 wined3d_buffer_cleanup(buffer
);
3107 wined3d_cs_destroy_object(device
->cs
, free
, buffer
);
3108 if (swapchain_count
)
3109 wined3d_device_decref(device
);
3112 static HRESULT
adapter_no3d_create_texture(struct wined3d_device
*device
,
3113 const struct wined3d_resource_desc
*desc
, unsigned int layer_count
, unsigned int level_count
,
3114 uint32_t flags
, void *parent
, const struct wined3d_parent_ops
*parent_ops
, struct wined3d_texture
**texture
)
3116 struct wined3d_texture
*texture_no3d
;
3119 TRACE("device %p, desc %p, layer_count %u, level_count %u, flags %#x, parent %p, parent_ops %p, texture %p.\n",
3120 device
, desc
, layer_count
, level_count
, flags
, parent
, parent_ops
, texture
);
3122 if (!(texture_no3d
= wined3d_texture_allocate_object_memory(sizeof(*texture_no3d
), level_count
, layer_count
)))
3123 return E_OUTOFMEMORY
;
3125 if (FAILED(hr
= wined3d_texture_no3d_init(texture_no3d
, device
, desc
,
3126 layer_count
, level_count
, flags
, parent
, parent_ops
)))
3128 WARN("Failed to initialise texture, hr %#lx.\n", hr
);
3133 TRACE("Created texture %p.\n", texture_no3d
);
3134 *texture
= texture_no3d
;
3139 static void adapter_no3d_destroy_texture(struct wined3d_texture
*texture
)
3141 struct wined3d_device
*device
= texture
->resource
.device
;
3142 unsigned int swapchain_count
= device
->swapchain_count
;
3144 TRACE("texture %p.\n", texture
);
3146 /* Take a reference to the device, in case releasing the texture would
3147 * cause the device to be destroyed. However, swapchain resources don't
3148 * take a reference to the device, and we wouldn't want to increment the
3149 * refcount on a device that's in the process of being destroyed. */
3150 if (swapchain_count
)
3151 wined3d_device_incref(device
);
3153 wined3d_texture_sub_resources_destroyed(texture
);
3154 texture
->resource
.parent_ops
->wined3d_object_destroyed(texture
->resource
.parent
);
3156 wined3d_texture_cleanup(texture
);
3157 wined3d_cs_destroy_object(device
->cs
, free
, texture
);
3159 if (swapchain_count
)
3160 wined3d_device_decref(device
);
3163 static HRESULT
adapter_no3d_create_rendertarget_view(const struct wined3d_view_desc
*desc
,
3164 struct wined3d_resource
*resource
, void *parent
, const struct wined3d_parent_ops
*parent_ops
,
3165 struct wined3d_rendertarget_view
**view
)
3167 struct wined3d_rendertarget_view
*view_no3d
;
3170 TRACE("desc %s, resource %p, parent %p, parent_ops %p, view %p.\n",
3171 wined3d_debug_view_desc(desc
, resource
), resource
, parent
, parent_ops
, view
);
3173 if (!(view_no3d
= calloc(1, sizeof(*view_no3d
))))
3174 return E_OUTOFMEMORY
;
3176 if (FAILED(hr
= wined3d_rendertarget_view_no3d_init(view_no3d
, desc
, resource
, parent
, parent_ops
)))
3178 WARN("Failed to initialise view, hr %#lx.\n", hr
);
3183 TRACE("Created render target view %p.\n", view_no3d
);
3189 static void adapter_no3d_destroy_rendertarget_view(struct wined3d_rendertarget_view
*view
)
3191 struct wined3d_device
*device
= view
->resource
->device
;
3192 unsigned int swapchain_count
= device
->swapchain_count
;
3194 TRACE("view %p.\n", view
);
3196 /* Take a reference to the device, in case releasing the view's resource
3197 * would cause the device to be destroyed. However, swapchain resources
3198 * don't take a reference to the device, and we wouldn't want to increment
3199 * the refcount on a device that's in the process of being destroyed. */
3200 if (swapchain_count
)
3201 wined3d_device_incref(device
);
3202 wined3d_rendertarget_view_cleanup(view
);
3203 wined3d_cs_destroy_object(device
->cs
, free
, view
);
3204 if (swapchain_count
)
3205 wined3d_device_decref(device
);
3208 static HRESULT
adapter_no3d_create_shader_resource_view(const struct wined3d_view_desc
*desc
,
3209 struct wined3d_resource
*resource
, void *parent
, const struct wined3d_parent_ops
*parent_ops
,
3210 struct wined3d_shader_resource_view
**view
)
3212 TRACE("desc %s, resource %p, parent %p, parent_ops %p, view %p.\n",
3213 wined3d_debug_view_desc(desc
, resource
), resource
, parent
, parent_ops
, view
);
3218 static void adapter_no3d_destroy_shader_resource_view(struct wined3d_shader_resource_view
*view
)
3220 TRACE("view %p.\n", view
);
3223 static HRESULT
adapter_no3d_create_unordered_access_view(const struct wined3d_view_desc
*desc
,
3224 struct wined3d_resource
*resource
, void *parent
, const struct wined3d_parent_ops
*parent_ops
,
3225 struct wined3d_unordered_access_view
**view
)
3227 TRACE("desc %s, resource %p, parent %p, parent_ops %p, view %p.\n",
3228 wined3d_debug_view_desc(desc
, resource
), resource
, parent
, parent_ops
, view
);
3233 static void adapter_no3d_destroy_unordered_access_view(struct wined3d_unordered_access_view
*view
)
3235 TRACE("view %p.\n", view
);
3238 static HRESULT
adapter_no3d_create_sampler(struct wined3d_device
*device
, const struct wined3d_sampler_desc
*desc
,
3239 void *parent
, const struct wined3d_parent_ops
*parent_ops
, struct wined3d_sampler
**sampler
)
3241 TRACE("device %p, desc %p, parent %p, parent_ops %p, sampler %p.\n",
3242 device
, desc
, parent
, parent_ops
, sampler
);
3247 static void adapter_no3d_destroy_sampler(struct wined3d_sampler
*sampler
)
3249 TRACE("sampler %p.\n", sampler
);
3252 static HRESULT
adapter_no3d_create_query(struct wined3d_device
*device
, enum wined3d_query_type type
,
3253 void *parent
, const struct wined3d_parent_ops
*parent_ops
, struct wined3d_query
**query
)
3255 TRACE("device %p, type %#x, parent %p, parent_ops %p, query %p.\n",
3256 device
, type
, parent
, parent_ops
, query
);
3258 return WINED3DERR_NOTAVAILABLE
;
3261 static void adapter_no3d_destroy_query(struct wined3d_query
*query
)
3263 TRACE("query %p.\n", query
);
3266 static void adapter_no3d_flush_context(struct wined3d_context
*context
)
3268 TRACE("context %p.\n", context
);
3271 static void adapter_no3d_draw_primitive(struct wined3d_device
*device
,
3272 const struct wined3d_state
*state
, const struct wined3d_draw_parameters
*parameters
)
3274 ERR("device %p, state %p, parameters %p.\n", device
, state
, parameters
);
3277 static void adapter_no3d_dispatch_compute(struct wined3d_device
*device
,
3278 const struct wined3d_state
*state
, const struct wined3d_dispatch_parameters
*parameters
)
3280 ERR("device %p, state %p, parameters %p.\n", device
, state
, parameters
);
3283 static void adapter_no3d_clear_uav(struct wined3d_context
*context
,
3284 struct wined3d_unordered_access_view
*view
, const struct wined3d_uvec4
*clear_value
, bool fp
)
3286 ERR("context %p, view %p, clear_value %s, fp %#x.\n", context
, view
, debug_uvec4(clear_value
), fp
);
3289 static const struct wined3d_adapter_ops wined3d_adapter_no3d_ops
=
3291 .adapter_destroy
= adapter_no3d_destroy
,
3292 .adapter_create_device
= adapter_no3d_create_device
,
3293 .adapter_destroy_device
= adapter_no3d_destroy_device
,
3294 .adapter_acquire_context
= adapter_no3d_acquire_context
,
3295 .adapter_release_context
= adapter_no3d_release_context
,
3296 .adapter_get_wined3d_caps
= adapter_no3d_get_wined3d_caps
,
3297 .adapter_check_format
= adapter_no3d_check_format
,
3298 .adapter_init_3d
= adapter_no3d_init_3d
,
3299 .adapter_uninit_3d
= adapter_no3d_uninit_3d
,
3300 .adapter_map_bo_address
= adapter_no3d_map_bo_address
,
3301 .adapter_unmap_bo_address
= adapter_no3d_unmap_bo_address
,
3302 .adapter_copy_bo_address
= adapter_no3d_copy_bo_address
,
3303 .adapter_flush_bo_address
= adapter_no3d_flush_bo_address
,
3304 .adapter_alloc_bo
= adapter_no3d_alloc_bo
,
3305 .adapter_destroy_bo
= adapter_no3d_destroy_bo
,
3306 .adapter_create_swapchain
= adapter_no3d_create_swapchain
,
3307 .adapter_destroy_swapchain
= adapter_no3d_destroy_swapchain
,
3308 .adapter_create_buffer
= adapter_no3d_create_buffer
,
3309 .adapter_destroy_buffer
= adapter_no3d_destroy_buffer
,
3310 .adapter_create_texture
= adapter_no3d_create_texture
,
3311 .adapter_destroy_texture
= adapter_no3d_destroy_texture
,
3312 .adapter_create_rendertarget_view
= adapter_no3d_create_rendertarget_view
,
3313 .adapter_destroy_rendertarget_view
= adapter_no3d_destroy_rendertarget_view
,
3314 .adapter_create_shader_resource_view
= adapter_no3d_create_shader_resource_view
,
3315 .adapter_destroy_shader_resource_view
= adapter_no3d_destroy_shader_resource_view
,
3316 .adapter_create_unordered_access_view
= adapter_no3d_create_unordered_access_view
,
3317 .adapter_destroy_unordered_access_view
= adapter_no3d_destroy_unordered_access_view
,
3318 .adapter_create_sampler
= adapter_no3d_create_sampler
,
3319 .adapter_destroy_sampler
= adapter_no3d_destroy_sampler
,
3320 .adapter_create_query
= adapter_no3d_create_query
,
3321 .adapter_destroy_query
= adapter_no3d_destroy_query
,
3322 .adapter_flush_context
= adapter_no3d_flush_context
,
3323 .adapter_draw_primitive
= adapter_no3d_draw_primitive
,
3324 .adapter_dispatch_compute
= adapter_no3d_dispatch_compute
,
3325 .adapter_clear_uav
= adapter_no3d_clear_uav
,
3328 static void wined3d_adapter_no3d_init_d3d_info(struct wined3d_adapter
*adapter
, unsigned int wined3d_creation_flags
)
3330 struct wined3d_d3d_info
*d3d_info
= &adapter
->d3d_info
;
3332 d3d_info
->wined3d_creation_flags
= wined3d_creation_flags
;
3333 d3d_info
->unconditional_npot
= true;
3334 d3d_info
->feature_level
= WINED3D_FEATURE_LEVEL_5
;
3337 static struct wined3d_adapter
*wined3d_adapter_no3d_create(unsigned int ordinal
, unsigned int wined3d_creation_flags
)
3339 struct wined3d_adapter
*adapter
;
3340 LUID primary_luid
, *luid
= NULL
;
3342 static const struct wined3d_gpu_description gpu_description
=
3344 HW_VENDOR_SOFTWARE
, CARD_WINE
, "WineD3D DirectDraw Emulation", DRIVER_WINE
, 128,
3347 TRACE("ordinal %u, wined3d_creation_flags %#x.\n", ordinal
, wined3d_creation_flags
);
3349 if (!(adapter
= calloc(1, sizeof(*adapter
))))
3352 if (ordinal
== 0 && wined3d_get_primary_adapter_luid(&primary_luid
))
3353 luid
= &primary_luid
;
3355 if (!wined3d_adapter_init(adapter
, ordinal
, luid
, &wined3d_adapter_no3d_ops
))
3361 if (!wined3d_adapter_no3d_init_format_info(adapter
))
3363 wined3d_adapter_cleanup(adapter
);
3368 if (!wined3d_driver_info_init(&adapter
->driver_info
, &gpu_description
, WINED3D_FEATURE_LEVEL_NONE
, 0, 0))
3370 wined3d_adapter_cleanup(adapter
);
3374 adapter
->vram_bytes_used
= 0;
3375 TRACE("Emulating 0x%s bytes of video ram.\n", wine_dbgstr_longlong(adapter
->driver_info
.vram_bytes
));
3377 adapter
->vertex_pipe
= &none_vertex_pipe
;
3378 adapter
->fragment_pipe
= &none_fragment_pipe
;
3379 adapter
->misc_state_template
= misc_state_template_no3d
;
3380 adapter
->shader_backend
= &none_shader_backend
;
3382 wined3d_adapter_no3d_init_d3d_info(adapter
, wined3d_creation_flags
);
3384 TRACE("Created adapter %p.\n", adapter
);
3389 static BOOL
wined3d_adapter_create_output(struct wined3d_adapter
*adapter
, const WCHAR
*output_name
)
3393 if (!wined3d_array_reserve((void **)&adapter
->outputs
, &adapter
->outputs_size
,
3394 adapter
->output_count
+ 1, sizeof(*adapter
->outputs
)))
3397 if (FAILED(hr
= wined3d_output_init(&adapter
->outputs
[adapter
->output_count
],
3398 adapter
->output_count
, adapter
, output_name
)))
3400 ERR("Failed to initialise output %s, hr %#lx.\n", wine_dbgstr_w(output_name
), hr
);
3404 ++adapter
->output_count
;
3405 TRACE("Initialised output %s.\n", wine_dbgstr_w(output_name
));
3409 BOOL
wined3d_adapter_init(struct wined3d_adapter
*adapter
, unsigned int ordinal
, const LUID
*luid
,
3410 const struct wined3d_adapter_ops
*adapter_ops
)
3412 D3DKMT_OPENADAPTERFROMLUID open_adapter_desc
;
3413 unsigned int output_idx
= 0, primary_idx
= 0;
3414 D3DKMT_CLOSEADAPTER close_adapter_desc
;
3415 DISPLAY_DEVICEW display_device
;
3418 adapter
->ordinal
= ordinal
;
3419 adapter
->output_count
= 0;
3420 adapter
->outputs
= NULL
;
3424 adapter
->luid
= *luid
;
3428 WARN("Allocating a random LUID.\n");
3429 if (!AllocateLocallyUniqueId(&adapter
->luid
))
3431 ERR("Failed to allocate a LUID, error %#lx.\n", GetLastError());
3435 TRACE("adapter %p LUID %08lx:%08lx.\n", adapter
, adapter
->luid
.HighPart
, adapter
->luid
.LowPart
);
3437 open_adapter_desc
.AdapterLuid
= adapter
->luid
;
3438 if (D3DKMTOpenAdapterFromLuid(&open_adapter_desc
))
3440 adapter
->kmt_adapter
= open_adapter_desc
.hAdapter
;
3442 display_device
.cb
= sizeof(display_device
);
3443 while (EnumDisplayDevicesW(NULL
, output_idx
++, &display_device
, 0))
3445 /* Detached outputs are not enumerated */
3446 if (!(display_device
.StateFlags
& DISPLAY_DEVICE_ATTACHED_TO_DESKTOP
))
3449 if (display_device
.StateFlags
& DISPLAY_DEVICE_PRIMARY_DEVICE
)
3450 primary_idx
= adapter
->output_count
;
3452 if (!wined3d_adapter_create_output(adapter
, display_device
.DeviceName
))
3455 TRACE("Initialised %Iu outputs for adapter %p.\n", adapter
->output_count
, adapter
);
3457 /* Make the primary output first */
3460 struct wined3d_output tmp
= adapter
->outputs
[0];
3461 adapter
->outputs
[0] = adapter
->outputs
[primary_idx
];
3462 adapter
->outputs
[0].ordinal
= 0;
3463 adapter
->outputs
[primary_idx
] = tmp
;
3464 adapter
->outputs
[primary_idx
].ordinal
= primary_idx
;
3467 memset(&adapter
->driver_uuid
, 0, sizeof(adapter
->driver_uuid
));
3468 memset(&adapter
->device_uuid
, 0, sizeof(adapter
->device_uuid
));
3470 adapter
->formats
= NULL
;
3471 adapter
->adapter_ops
= adapter_ops
;
3476 for (output_idx
= 0; output_idx
< adapter
->output_count
; ++output_idx
)
3477 wined3d_output_cleanup(&adapter
->outputs
[output_idx
]);
3478 free(adapter
->outputs
);
3479 close_adapter_desc
.hAdapter
= adapter
->kmt_adapter
;
3480 D3DKMTCloseAdapter(&close_adapter_desc
);
3485 static struct wined3d_adapter
*wined3d_adapter_create(unsigned int ordinal
, DWORD wined3d_creation_flags
)
3487 if (wined3d_creation_flags
& WINED3D_NO3D
)
3488 return wined3d_adapter_no3d_create(ordinal
, wined3d_creation_flags
);
3490 if (wined3d_settings
.renderer
== WINED3D_RENDERER_VULKAN
)
3491 return wined3d_adapter_vk_create(ordinal
, wined3d_creation_flags
);
3493 return wined3d_adapter_gl_create(ordinal
, wined3d_creation_flags
);
3496 static void STDMETHODCALLTYPE
wined3d_null_wined3d_object_destroyed(void *parent
) {}
3498 const struct wined3d_parent_ops wined3d_null_parent_ops
=
3500 wined3d_null_wined3d_object_destroyed
,
3503 HRESULT
wined3d_init(struct wined3d
*wined3d
, uint32_t flags
)
3506 wined3d
->flags
= flags
;
3508 TRACE("Initialising adapters.\n");
3510 if (!(wined3d
->adapters
[0] = wined3d_adapter_create(0, flags
)))
3512 WARN("Failed to create adapter.\n");
3515 wined3d
->adapter_count
= 1;