ReactOS  r76032
directx.c
Go to the documentation of this file.
1 /*
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
8  *
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.
13  *
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.
18  *
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
22  */
23 
24 #include "wined3d_private.h"
25 #include <winternl.h>
26 
27 #include <wine/unicode.h>
28 
32 
33 #define DEFAULT_REFRESH_RATE 0
34 
35 /* The driver names reflect the lowest GPU supported
36  * by a certain driver, so DRIVER_AMD_R300 supports
37  * R3xx, R4xx and R5xx GPUs. */
39 {
57 };
58 
60 {
66 };
67 
69 {
75 };
76 
78 {
88 };
89 
90 /* The d3d device ID */
91 static const GUID IID_D3DDEVICE_D3DUID = { 0xaeb2cdd4, 0x6e41, 0x43ea, { 0x94,0x1c,0x83,0x61,0xcc,0x76,0x07,0x81 } };
92 
93 /* Extension detection */
95 {
96  const char *extension_string;
98 };
99 
101 {
102  /* APPLE */
103  {"GL_APPLE_fence", APPLE_FENCE },
104  {"GL_APPLE_float_pixels", APPLE_FLOAT_PIXELS },
105  {"GL_APPLE_flush_buffer_range", APPLE_FLUSH_BUFFER_RANGE },
106  {"GL_APPLE_ycbcr_422", APPLE_YCBCR_422 },
107 
108  /* ARB */
109  {"GL_ARB_base_instance", ARB_BASE_INSTANCE },
110  {"GL_ARB_blend_func_extended", ARB_BLEND_FUNC_EXTENDED },
111  {"GL_ARB_clear_buffer_object", ARB_CLEAR_BUFFER_OBJECT },
112  {"GL_ARB_clear_texture", ARB_CLEAR_TEXTURE },
113  {"GL_ARB_clip_control", ARB_CLIP_CONTROL },
114  {"GL_ARB_color_buffer_float", ARB_COLOR_BUFFER_FLOAT },
115  {"GL_ARB_compute_shader", ARB_COMPUTE_SHADER },
116  {"GL_ARB_conservative_depth", ARB_CONSERVATIVE_DEPTH },
117  {"GL_ARB_copy_buffer", ARB_COPY_BUFFER },
118  {"GL_ARB_copy_image", ARB_COPY_IMAGE },
119  {"GL_ARB_debug_output", ARB_DEBUG_OUTPUT },
120  {"GL_ARB_depth_buffer_float", ARB_DEPTH_BUFFER_FLOAT },
121  {"GL_ARB_depth_clamp", ARB_DEPTH_CLAMP },
122  {"GL_ARB_depth_texture", ARB_DEPTH_TEXTURE },
123  {"GL_ARB_derivative_control", ARB_DERIVATIVE_CONTROL },
124  {"GL_ARB_draw_buffers", ARB_DRAW_BUFFERS },
125  {"GL_ARB_draw_elements_base_vertex", ARB_DRAW_ELEMENTS_BASE_VERTEX },
126  {"GL_ARB_draw_indirect", ARB_DRAW_INDIRECT },
127  {"GL_ARB_draw_instanced", ARB_DRAW_INSTANCED },
128  {"GL_ARB_ES2_compatibility", ARB_ES2_COMPATIBILITY },
129  {"GL_ARB_ES3_compatibility", ARB_ES3_COMPATIBILITY },
130  {"GL_ARB_explicit_attrib_location", ARB_EXPLICIT_ATTRIB_LOCATION },
131  {"GL_ARB_fragment_coord_conventions", ARB_FRAGMENT_COORD_CONVENTIONS},
132  {"GL_ARB_fragment_layer_viewport", ARB_FRAGMENT_LAYER_VIEWPORT },
133  {"GL_ARB_fragment_program", ARB_FRAGMENT_PROGRAM },
134  {"GL_ARB_fragment_shader", ARB_FRAGMENT_SHADER },
135  {"GL_ARB_framebuffer_object", ARB_FRAMEBUFFER_OBJECT },
136  {"GL_ARB_framebuffer_sRGB", ARB_FRAMEBUFFER_SRGB },
137  {"GL_ARB_geometry_shader4", ARB_GEOMETRY_SHADER4 },
138  {"GL_ARB_gpu_shader5", ARB_GPU_SHADER5 },
139  {"GL_ARB_half_float_pixel", ARB_HALF_FLOAT_PIXEL },
140  {"GL_ARB_half_float_vertex", ARB_HALF_FLOAT_VERTEX },
141  {"GL_ARB_instanced_arrays", ARB_INSTANCED_ARRAYS },
142  {"GL_ARB_internalformat_query", ARB_INTERNALFORMAT_QUERY },
143  {"GL_ARB_internalformat_query2", ARB_INTERNALFORMAT_QUERY2 },
144  {"GL_ARB_map_buffer_alignment", ARB_MAP_BUFFER_ALIGNMENT },
145  {"GL_ARB_map_buffer_range", ARB_MAP_BUFFER_RANGE },
146  {"GL_ARB_multisample", ARB_MULTISAMPLE },
147  {"GL_ARB_multitexture", ARB_MULTITEXTURE },
148  {"GL_ARB_occlusion_query", ARB_OCCLUSION_QUERY },
149  {"GL_ARB_pipeline_statistics_query", ARB_PIPELINE_STATISTICS_QUERY },
150  {"GL_ARB_pixel_buffer_object", ARB_PIXEL_BUFFER_OBJECT },
151  {"GL_ARB_point_parameters", ARB_POINT_PARAMETERS },
152  {"GL_ARB_point_sprite", ARB_POINT_SPRITE },
153  {"GL_ARB_provoking_vertex", ARB_PROVOKING_VERTEX },
154  {"GL_ARB_sampler_objects", ARB_SAMPLER_OBJECTS },
155  {"GL_ARB_seamless_cube_map", ARB_SEAMLESS_CUBE_MAP },
156  {"GL_ARB_shader_atomic_counters", ARB_SHADER_ATOMIC_COUNTERS },
157  {"GL_ARB_shader_bit_encoding", ARB_SHADER_BIT_ENCODING },
158  {"GL_ARB_shader_image_load_store", ARB_SHADER_IMAGE_LOAD_STORE },
159  {"GL_ARB_shader_image_size", ARB_SHADER_IMAGE_SIZE },
160  {"GL_ARB_shader_storage_buffer_object", ARB_SHADER_STORAGE_BUFFER_OBJECT},
161  {"GL_ARB_shader_texture_lod", ARB_SHADER_TEXTURE_LOD },
162  {"GL_ARB_shading_language_100", ARB_SHADING_LANGUAGE_100 },
163  {"GL_ARB_shading_language_420pack", ARB_SHADING_LANGUAGE_420PACK },
164  {"GL_ARB_shading_language_packing", ARB_SHADING_LANGUAGE_PACKING },
165  {"GL_ARB_shadow", ARB_SHADOW },
166  {"GL_ARB_stencil_texturing", ARB_STENCIL_TEXTURING },
167  {"GL_ARB_sync", ARB_SYNC },
168  {"GL_ARB_tessellation_shader", ARB_TESSELLATION_SHADER },
169  {"GL_ARB_texture_border_clamp", ARB_TEXTURE_BORDER_CLAMP },
170  {"GL_ARB_texture_buffer_object", ARB_TEXTURE_BUFFER_OBJECT },
171  {"GL_ARB_texture_buffer_range", ARB_TEXTURE_BUFFER_RANGE },
172  {"GL_ARB_texture_compression", ARB_TEXTURE_COMPRESSION },
173  {"GL_ARB_texture_compression_bptc", ARB_TEXTURE_COMPRESSION_BPTC },
174  {"GL_ARB_texture_compression_rgtc", ARB_TEXTURE_COMPRESSION_RGTC },
175  {"GL_ARB_texture_cube_map", ARB_TEXTURE_CUBE_MAP },
176  {"GL_ARB_texture_cube_map_array", ARB_TEXTURE_CUBE_MAP_ARRAY },
177  {"GL_ARB_texture_env_combine", ARB_TEXTURE_ENV_COMBINE },
178  {"GL_ARB_texture_env_dot3", ARB_TEXTURE_ENV_DOT3 },
179  {"GL_ARB_texture_float", ARB_TEXTURE_FLOAT },
180  {"GL_ARB_texture_gather", ARB_TEXTURE_GATHER },
181  {"GL_ARB_texture_mirrored_repeat", ARB_TEXTURE_MIRRORED_REPEAT },
182  {"GL_ARB_texture_mirror_clamp_to_edge", ARB_TEXTURE_MIRROR_CLAMP_TO_EDGE},
183  {"GL_ARB_texture_non_power_of_two", ARB_TEXTURE_NON_POWER_OF_TWO },
184  {"GL_ARB_texture_query_levels", ARB_TEXTURE_QUERY_LEVELS },
185  {"GL_ARB_texture_rectangle", ARB_TEXTURE_RECTANGLE },
186  {"GL_ARB_texture_rg", ARB_TEXTURE_RG },
187  {"GL_ARB_texture_rgb10_a2ui", ARB_TEXTURE_RGB10_A2UI },
188  {"GL_ARB_texture_storage", ARB_TEXTURE_STORAGE },
189  {"GL_ARB_texture_swizzle", ARB_TEXTURE_SWIZZLE },
190  {"GL_ARB_texture_view", ARB_TEXTURE_VIEW },
191  {"GL_ARB_timer_query", ARB_TIMER_QUERY },
192  {"GL_ARB_transform_feedback2", ARB_TRANSFORM_FEEDBACK2 },
193  {"GL_ARB_transform_feedback3", ARB_TRANSFORM_FEEDBACK3 },
194  {"GL_ARB_uniform_buffer_object", ARB_UNIFORM_BUFFER_OBJECT },
195  {"GL_ARB_vertex_array_bgra", ARB_VERTEX_ARRAY_BGRA },
196  {"GL_ARB_vertex_blend", ARB_VERTEX_BLEND },
197  {"GL_ARB_vertex_buffer_object", ARB_VERTEX_BUFFER_OBJECT },
198  {"GL_ARB_vertex_program", ARB_VERTEX_PROGRAM },
199  {"GL_ARB_vertex_shader", ARB_VERTEX_SHADER },
200  {"GL_ARB_vertex_type_2_10_10_10_rev", ARB_VERTEX_TYPE_2_10_10_10_REV},
201  {"GL_ARB_viewport_array", ARB_VIEWPORT_ARRAY },
202 
203  /* ATI */
204  {"GL_ATI_fragment_shader", ATI_FRAGMENT_SHADER },
205  {"GL_ATI_separate_stencil", ATI_SEPARATE_STENCIL },
206  {"GL_ATI_texture_compression_3dc", ATI_TEXTURE_COMPRESSION_3DC },
207  {"GL_ATI_texture_env_combine3", ATI_TEXTURE_ENV_COMBINE3 },
208  {"GL_ATI_texture_mirror_once", ATI_TEXTURE_MIRROR_ONCE },
209 
210  /* EXT */
211  {"GL_EXT_blend_color", EXT_BLEND_COLOR },
212  {"GL_EXT_blend_equation_separate", EXT_BLEND_EQUATION_SEPARATE },
213  {"GL_EXT_blend_func_separate", EXT_BLEND_FUNC_SEPARATE },
214  {"GL_EXT_blend_minmax", EXT_BLEND_MINMAX },
215  {"GL_EXT_blend_subtract", EXT_BLEND_SUBTRACT },
216  {"GL_EXT_depth_bounds_test", EXT_DEPTH_BOUNDS_TEST },
217  {"GL_EXT_draw_buffers2", EXT_DRAW_BUFFERS2 },
218  {"GL_EXT_fog_coord", EXT_FOG_COORD },
219  {"GL_EXT_framebuffer_blit", EXT_FRAMEBUFFER_BLIT },
220  {"GL_EXT_framebuffer_multisample", EXT_FRAMEBUFFER_MULTISAMPLE },
221  {"GL_EXT_framebuffer_object", EXT_FRAMEBUFFER_OBJECT },
222  {"GL_EXT_gpu_program_parameters", EXT_GPU_PROGRAM_PARAMETERS },
223  {"GL_EXT_gpu_shader4", EXT_GPU_SHADER4 },
224  {"GL_EXT_packed_depth_stencil", EXT_PACKED_DEPTH_STENCIL },
225  {"GL_EXT_packed_float", EXT_PACKED_FLOAT },
226  {"GL_EXT_point_parameters", EXT_POINT_PARAMETERS },
227  {"GL_EXT_provoking_vertex", EXT_PROVOKING_VERTEX },
228  {"GL_EXT_secondary_color", EXT_SECONDARY_COLOR },
229  {"GL_EXT_stencil_two_side", EXT_STENCIL_TWO_SIDE },
230  {"GL_EXT_stencil_wrap", EXT_STENCIL_WRAP },
231  {"GL_EXT_texture3D", EXT_TEXTURE3D },
232  {"GL_EXT_texture_array", EXT_TEXTURE_ARRAY },
233  {"GL_EXT_texture_compression_rgtc", EXT_TEXTURE_COMPRESSION_RGTC },
234  {"GL_EXT_texture_compression_s3tc", EXT_TEXTURE_COMPRESSION_S3TC },
235  {"GL_EXT_texture_env_combine", EXT_TEXTURE_ENV_COMBINE },
236  {"GL_EXT_texture_env_dot3", EXT_TEXTURE_ENV_DOT3 },
237  {"GL_EXT_texture_filter_anisotropic", EXT_TEXTURE_FILTER_ANISOTROPIC},
238  {"GL_EXT_texture_integer", EXT_TEXTURE_INTEGER },
239  {"GL_EXT_texture_lod_bias", EXT_TEXTURE_LOD_BIAS },
240  {"GL_EXT_texture_mirror_clamp", EXT_TEXTURE_MIRROR_CLAMP },
241  {"GL_EXT_texture_shared_exponent", EXT_TEXTURE_SHARED_EXPONENT },
242  {"GL_EXT_texture_snorm", EXT_TEXTURE_SNORM },
243  {"GL_EXT_texture_sRGB", EXT_TEXTURE_SRGB },
244  {"GL_EXT_texture_sRGB_decode", EXT_TEXTURE_SRGB_DECODE },
245  {"GL_EXT_vertex_array_bgra", EXT_VERTEX_ARRAY_BGRA },
246 
247  /* NV */
248  {"GL_NV_fence", NV_FENCE },
249  {"GL_NV_fog_distance", NV_FOG_DISTANCE },
250  {"GL_NV_fragment_program", NV_FRAGMENT_PROGRAM },
251  {"GL_NV_fragment_program2", NV_FRAGMENT_PROGRAM2 },
252  {"GL_NV_fragment_program_option", NV_FRAGMENT_PROGRAM_OPTION },
253  {"GL_NV_half_float", NV_HALF_FLOAT },
254  {"GL_NV_light_max_exponent", NV_LIGHT_MAX_EXPONENT },
255  {"GL_NV_point_sprite", NV_POINT_SPRITE },
256  {"GL_NV_register_combiners", NV_REGISTER_COMBINERS },
257  {"GL_NV_register_combiners2", NV_REGISTER_COMBINERS2 },
258  {"GL_NV_texgen_reflection", NV_TEXGEN_REFLECTION },
259  {"GL_NV_texture_env_combine4", NV_TEXTURE_ENV_COMBINE4 },
260  {"GL_NV_texture_shader", NV_TEXTURE_SHADER },
261  {"GL_NV_texture_shader2", NV_TEXTURE_SHADER2 },
262  {"GL_NV_vertex_program", NV_VERTEX_PROGRAM },
263  {"GL_NV_vertex_program1_1", NV_VERTEX_PROGRAM1_1 },
264  {"GL_NV_vertex_program2", NV_VERTEX_PROGRAM2 },
265  {"GL_NV_vertex_program2_option", NV_VERTEX_PROGRAM2_OPTION },
266  {"GL_NV_vertex_program3", NV_VERTEX_PROGRAM3 },
267  {"GL_NVX_gpu_memory_info", NVX_GPU_MEMORY_INFO },
268 
269  /* SGI */
270  {"GL_SGIS_generate_mipmap", SGIS_GENERATE_MIPMAP },
271 };
272 
274 {
275  {"WGL_ARB_pixel_format", WGL_ARB_PIXEL_FORMAT },
276  {"WGL_EXT_swap_control", WGL_EXT_SWAP_CONTROL },
277  {"WGL_WINE_pixel_format_passthrough", WGL_WINE_PIXEL_FORMAT_PASSTHROUGH},
278  {"WGL_WINE_query_renderer", WGL_WINE_QUERY_RENDERER },
279 };
280 
281 /**********************************************************
282  * Utility functions follow
283  **********************************************************/
284 
285 const struct min_lookup minMipLookup[] =
286 {
287  /* NONE POINT LINEAR */
288  {{GL_NEAREST, GL_NEAREST, GL_NEAREST}}, /* NONE */
291 };
292 
293 const GLenum magLookup[] =
294 {
295  /* NONE POINT LINEAR */
297 };
298 
299 static void wined3d_caps_gl_ctx_destroy(const struct wined3d_caps_gl_ctx *ctx)
300 {
301  const struct wined3d_gl_info *gl_info = ctx->gl_info;
302 
303  TRACE("Destroying caps GL context.\n");
304 
305  /* Both glDeleteProgram and glDeleteBuffers silently ignore 0 IDs but
306  * this function might be called before the relevant function pointers
307  * in gl_info are initialized. */
308  if (ctx->test_program_id || ctx->test_vbo)
309  {
310  GL_EXTCALL(glDeleteProgram(ctx->test_program_id));
311  GL_EXTCALL(glDeleteBuffers(1, &ctx->test_vbo));
312  }
313 
314  if (!wglMakeCurrent(NULL, NULL))
315  ERR("Failed to disable caps GL context.\n");
316 
317  if (!wglDeleteContext(ctx->gl_ctx))
318  {
319  DWORD err = GetLastError();
320  ERR("wglDeleteContext(%p) failed, last error %#x.\n", ctx->gl_ctx, err);
321  }
322 
323  wined3d_release_dc(ctx->wnd, ctx->dc);
324  DestroyWindow(ctx->wnd);
325 
326  if (ctx->restore_gl_ctx && !wglMakeCurrent(ctx->restore_dc, ctx->restore_gl_ctx))
327  ERR("Failed to restore previous GL context.\n");
328 }
329 
331  struct wined3d_gl_info *gl_info)
332 {
333  HGLRC new_ctx;
334 
335  if (!(gl_info->p_wglCreateContextAttribsARB = (void *)wglGetProcAddress("wglCreateContextAttribsARB")))
336  return TRUE;
337 
338  if (!(new_ctx = context_create_wgl_attribs(gl_info, caps_gl_ctx->dc, NULL)))
339  {
340  gl_info->p_wglCreateContextAttribsARB = NULL;
341  return FALSE;
342  }
343 
344  if (!wglMakeCurrent(caps_gl_ctx->dc, new_ctx))
345  {
346  ERR("Failed to make new context current, last error %#x.\n", GetLastError());
347  if (!wglDeleteContext(new_ctx))
348  ERR("Failed to delete new context, last error %#x.\n", GetLastError());
349  gl_info->p_wglCreateContextAttribsARB = NULL;
350  return TRUE;
351  }
352 
353  if (!wglDeleteContext(caps_gl_ctx->gl_ctx))
354  ERR("Failed to delete old context, last error %#x.\n", GetLastError());
355  caps_gl_ctx->gl_ctx = new_ctx;
356 
357  return TRUE;
358 }
359 
361 {
363  int iPixelFormat;
364 
365  TRACE("getting context...\n");
366 
367  ctx->restore_dc = wglGetCurrentDC();
369 
370  /* We need a fake window as a hdc retrieved using GetDC(0) can't be used for much GL purposes. */
371  ctx->wnd = CreateWindowA(WINED3D_OPENGL_WINDOW_CLASS_NAME, "WineD3D fake window",
372  WS_OVERLAPPEDWINDOW, 10, 10, 10, 10, NULL, NULL, NULL, NULL);
373  if (!ctx->wnd)
374  {
375  ERR("Failed to create a window.\n");
376  goto fail;
377  }
378 
379  ctx->dc = GetDC(ctx->wnd);
380  if (!ctx->dc)
381  {
382  ERR("Failed to get a DC.\n");
383  goto fail;
384  }
385 
386  /* PixelFormat selection */
387  ZeroMemory(&pfd, sizeof(pfd));
388  pfd.nSize = sizeof(pfd);
389  pfd.nVersion = 1;
390  pfd.dwFlags = PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER | PFD_DRAW_TO_WINDOW; /* PFD_GENERIC_ACCELERATED */
392  pfd.cColorBits = 32;
394 
395  if (!(iPixelFormat = ChoosePixelFormat(ctx->dc, &pfd)))
396  {
397  /* If this happens something is very wrong as ChoosePixelFormat barely fails. */
398  ERR("Failed to find a suitable pixel format.\n");
399  goto fail;
400  }
401  DescribePixelFormat(ctx->dc, iPixelFormat, sizeof(pfd), &pfd);
402  SetPixelFormat(ctx->dc, iPixelFormat, &pfd);
403 
404  /* Create a GL context. */
405  if (!(ctx->gl_ctx = wglCreateContext(ctx->dc)))
406  {
407  WARN("Failed to create default context for capabilities initialization.\n");
408  goto fail;
409  }
410 
411  /* Make it the current GL context. */
412  if (!wglMakeCurrent(ctx->dc, ctx->gl_ctx))
413  {
414  ERR("Failed to make caps GL context current.\n");
415  goto fail;
416  }
417 
418  ctx->gl_info = &adapter->gl_info;
419  return TRUE;
420 
421 fail:
422  if (ctx->gl_ctx) wglDeleteContext(ctx->gl_ctx);
423  ctx->gl_ctx = NULL;
424  if (ctx->dc) ReleaseDC(ctx->wnd, ctx->dc);
425  ctx->dc = NULL;
426  if (ctx->wnd) DestroyWindow(ctx->wnd);
427  ctx->wnd = NULL;
428  if (ctx->restore_gl_ctx && !wglMakeCurrent(ctx->restore_dc, ctx->restore_gl_ctx))
429  ERR("Failed to restore previous GL context.\n");
430 
431  return FALSE;
432 }
433 
434 /* Adjust the amount of used texture memory */
436 {
437  adapter->vram_bytes_used += amount;
438  TRACE("Adjusted used adapter memory by 0x%s to 0x%s.\n",
439  wine_dbgstr_longlong(amount),
441  return adapter->vram_bytes_used;
442 }
443 
444 static void wined3d_adapter_cleanup(struct wined3d_adapter *adapter)
445 {
446  HeapFree(GetProcessHeap(), 0, adapter->gl_info.formats);
447  HeapFree(GetProcessHeap(), 0, adapter->cfgs);
448 }
449 
451 {
452  ULONG refcount = InterlockedIncrement(&wined3d->ref);
453 
454  TRACE("%p increasing refcount to %u.\n", wined3d, refcount);
455 
456  return refcount;
457 }
458 
460 {
461  ULONG refcount = InterlockedDecrement(&wined3d->ref);
462 
463  TRACE("%p decreasing refcount to %u.\n", wined3d, refcount);
464 
465  if (!refcount)
466  {
467  unsigned int i;
468 
469  for (i = 0; i < wined3d->adapter_count; ++i)
470  {
471  wined3d_adapter_cleanup(&wined3d->adapters[i]);
472  }
473  HeapFree(GetProcessHeap(), 0, wined3d);
474  }
475 
476  return refcount;
477 }
478 
479 /* Context activation is done by the caller. */
480 static BOOL test_arb_vs_offset_limit(const struct wined3d_gl_info *gl_info)
481 {
482  GLuint prog;
483  BOOL ret = FALSE;
484  static const char testcode[] =
485  "!!ARBvp1.0\n"
486  "PARAM C[66] = { program.env[0..65] };\n"
487  "ADDRESS A0;"
488  "PARAM zero = {0.0, 0.0, 0.0, 0.0};\n"
489  "ARL A0.x, zero.x;\n"
490  "MOV result.position, C[A0.x + 65];\n"
491  "END\n";
492 
493  while (gl_info->gl_ops.gl.p_glGetError());
494  GL_EXTCALL(glGenProgramsARB(1, &prog));
495  if(!prog) {
496  ERR("Failed to create an ARB offset limit test program\n");
497  }
498  GL_EXTCALL(glBindProgramARB(GL_VERTEX_PROGRAM_ARB, prog));
500  strlen(testcode), testcode));
501  if (gl_info->gl_ops.gl.p_glGetError())
502  {
503  TRACE("OpenGL implementation does not allow indirect addressing offsets > 63\n");
504  TRACE("error: %s\n", debugstr_a((const char *)gl_info->gl_ops.gl.p_glGetString(GL_PROGRAM_ERROR_STRING_ARB)));
505  ret = TRUE;
506  } else TRACE("OpenGL implementation allows offsets > 63\n");
507 
508  GL_EXTCALL(glBindProgramARB(GL_VERTEX_PROGRAM_ARB, 0));
509  GL_EXTCALL(glDeleteProgramsARB(1, &prog));
510  checkGLcall("ARB vp offset limit test cleanup");
511 
512  return ret;
513 }
514 
515 static BOOL match_amd_r300_to_500(const struct wined3d_gl_info *gl_info, struct wined3d_caps_gl_ctx *ctx,
516  const char *gl_renderer, enum wined3d_gl_vendor gl_vendor,
518 {
519  if (card_vendor != HW_VENDOR_AMD) return FALSE;
520  if (device == CARD_AMD_RADEON_9500) return TRUE;
521  if (device == CARD_AMD_RADEON_X700) return TRUE;
522  if (device == CARD_AMD_RADEON_X1600) return TRUE;
523  return FALSE;
524 }
525 
526 static BOOL match_geforce5(const struct wined3d_gl_info *gl_info, struct wined3d_caps_gl_ctx *ctx,
527  const char *gl_renderer, enum wined3d_gl_vendor gl_vendor,
529 {
530  if (card_vendor == HW_VENDOR_NVIDIA)
531  {
532  if (device == CARD_NVIDIA_GEFORCEFX_5200 ||
533  device == CARD_NVIDIA_GEFORCEFX_5600 ||
534  device == CARD_NVIDIA_GEFORCEFX_5800)
535  {
536  return TRUE;
537  }
538  }
539  return FALSE;
540 }
541 
542 static BOOL match_apple(const struct wined3d_gl_info *gl_info, struct wined3d_caps_gl_ctx *ctx,
543  const char *gl_renderer, enum wined3d_gl_vendor gl_vendor,
545 {
546  /* MacOS has various specialities in the extensions it advertises. Some have to be loaded from
547  * the opengl 1.2+ core, while other extensions are advertised, but software emulated. So try to
548  * detect the Apple OpenGL implementation to apply some extension fixups afterwards.
549  *
550  * Detecting this isn't really easy. The vendor string doesn't mention Apple. Compile-time checks
551  * aren't sufficient either because a Linux binary may display on a macos X server via remote X11.
552  * So try to detect the GL implementation by looking at certain Apple extensions. Some extensions
553  * like client storage might be supported on other implementations too, but GL_APPLE_flush_render
554  * is specific to the Mac OS X window management, and GL_APPLE_ycbcr_422 is QuickTime specific. So
555  * the chance that other implementations support them is rather small since Win32 QuickTime uses
556  * DirectDraw, not OpenGL.
557  *
558  * This test has been moved into wined3d_guess_gl_vendor()
559  */
560  return gl_vendor == GL_VENDOR_APPLE;
561 }
562 
563 /* Context activation is done by the caller. */
564 static void test_pbo_functionality(struct wined3d_gl_info *gl_info)
565 {
566  /* Some OpenGL implementations, namely Apple's Geforce 8 driver, advertises PBOs,
567  * but glTexSubImage from a PBO fails miserably, with the first line repeated over
568  * all the texture. This function detects this bug by its symptom and disables PBOs
569  * if the test fails.
570  *
571  * The test uploads a 4x4 texture via the PBO in the "native" format GL_BGRA,
572  * GL_UNSIGNED_INT_8_8_8_8_REV. This format triggers the bug, and it is what we use
573  * for D3DFMT_A8R8G8B8. Then the texture is read back without any PBO and the data
574  * read back is compared to the original. If they are equal PBOs are assumed to work,
575  * otherwise the PBO extension is disabled. */
576  GLuint texture, pbo;
577  static const unsigned int pattern[] =
578  {
579  0x00000000, 0x000000ff, 0x0000ff00, 0x40ff0000,
580  0x80ffffff, 0x40ffff00, 0x00ff00ff, 0x0000ffff,
581  0x00ffff00, 0x00ff00ff, 0x0000ffff, 0x000000ff,
582  0x80ff00ff, 0x0000ffff, 0x00ff00ff, 0x40ff00ff
583  };
584  unsigned int check[sizeof(pattern) / sizeof(pattern[0])];
585 
586  /* No PBO -> No point in testing them. */
587  if (!gl_info->supported[ARB_PIXEL_BUFFER_OBJECT]) return;
588 
589  while (gl_info->gl_ops.gl.p_glGetError());
590  gl_info->gl_ops.gl.p_glGenTextures(1, &texture);
591  gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_2D, texture);
592 
593  gl_info->gl_ops.gl.p_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0);
594  gl_info->gl_ops.gl.p_glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 4, 4, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, 0);
595  checkGLcall("Specifying the PBO test texture");
596 
597  GL_EXTCALL(glGenBuffers(1, &pbo));
598  GL_EXTCALL(glBindBuffer(GL_PIXEL_UNPACK_BUFFER, pbo));
599  GL_EXTCALL(glBufferData(GL_PIXEL_UNPACK_BUFFER, sizeof(pattern), pattern, GL_STREAM_DRAW));
600  checkGLcall("Specifying the PBO test pbo");
601 
602  gl_info->gl_ops.gl.p_glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 4, 4, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, NULL);
603  checkGLcall("Loading the PBO test texture");
604 
605  GL_EXTCALL(glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0));
606 
607  gl_info->gl_ops.gl.p_glFinish(); /* just to be sure */
608 
609  memset(check, 0, sizeof(check));
610  gl_info->gl_ops.gl.p_glGetTexImage(GL_TEXTURE_2D, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, check);
611  checkGLcall("Reading back the PBO test texture");
612 
613  gl_info->gl_ops.gl.p_glDeleteTextures(1, &texture);
614  GL_EXTCALL(glDeleteBuffers(1, &pbo));
615  checkGLcall("PBO test cleanup");
616 
617  if (memcmp(check, pattern, sizeof(check)))
618  {
619  WARN_(d3d_perf)("PBO test failed, read back data doesn't match original.\n"
620  "Disabling PBOs. This may result in slower performance.\n");
622  }
623  else
624  {
625  TRACE("PBO test successful.\n");
626  }
627 }
628 
629 static BOOL match_apple_intel(const struct wined3d_gl_info *gl_info, struct wined3d_caps_gl_ctx *ctx,
630  const char *gl_renderer, enum wined3d_gl_vendor gl_vendor,
632 {
633  return (card_vendor == HW_VENDOR_INTEL) && (gl_vendor == GL_VENDOR_APPLE);
634 }
635 
636 static BOOL match_apple_nonr500ati(const struct wined3d_gl_info *gl_info, struct wined3d_caps_gl_ctx *ctx,
637  const char *gl_renderer, enum wined3d_gl_vendor gl_vendor,
639 {
640  if (gl_vendor != GL_VENDOR_APPLE) return FALSE;
641  if (card_vendor != HW_VENDOR_AMD) return FALSE;
642  if (device == CARD_AMD_RADEON_X1600) return FALSE;
643  return TRUE;
644 }
645 
646 static BOOL match_dx10_capable(const struct wined3d_gl_info *gl_info, struct wined3d_caps_gl_ctx *ctx,
647  const char *gl_renderer, enum wined3d_gl_vendor gl_vendor,
649 {
650  /* DX9 cards support 40 single float varyings in hardware, most drivers report 32. ATI misreports
651  * 44 varyings. So assume that if we have more than 44 varyings we have a dx10 card.
652  * This detection is for the gl_ClipPos varying quirk. If a d3d9 card really supports more than 44
653  * varyings and we subtract one in dx9 shaders it's not going to hurt us because the dx9 limit is
654  * hardcoded
655  *
656  * dx10 cards usually have 64 varyings */
657  return gl_info->limits.glsl_varyings > 44;
658 }
659 
660 static BOOL match_not_dx10_capable(const struct wined3d_gl_info *gl_info, struct wined3d_caps_gl_ctx *ctx,
661  const char *gl_renderer, enum wined3d_gl_vendor gl_vendor,
663 {
664  return !match_dx10_capable(gl_info, ctx, gl_renderer, gl_vendor, card_vendor, device);
665 }
666 
667 /* A GL context is provided by the caller */
668 static BOOL match_allows_spec_alpha(const struct wined3d_gl_info *gl_info, struct wined3d_caps_gl_ctx *ctx,
669  const char *gl_renderer, enum wined3d_gl_vendor gl_vendor,
671 {
672  GLenum error;
673  DWORD data[16];
674 
675  if (!gl_info->supported[EXT_SECONDARY_COLOR])
676  return FALSE;
677 
678  while (gl_info->gl_ops.gl.p_glGetError());
679  GL_EXTCALL(glSecondaryColorPointerEXT)(4, GL_UNSIGNED_BYTE, 4, data);
680  error = gl_info->gl_ops.gl.p_glGetError();
681 
682  if (error == GL_NO_ERROR)
683  {
684  TRACE("GL Implementation accepts 4 component specular color pointers\n");
685  return TRUE;
686  }
687  else
688  {
689  TRACE("GL implementation does not accept 4 component specular colors, error %s\n",
690  debug_glerror(error));
691  return FALSE;
692  }
693 }
694 
695 /* A GL context is provided by the caller */
696 static BOOL match_broken_nv_clip(const struct wined3d_gl_info *gl_info, struct wined3d_caps_gl_ctx *ctx,
697  const char *gl_renderer, enum wined3d_gl_vendor gl_vendor,
699 {
700  GLuint prog;
701  BOOL ret = FALSE;
702  GLint pos;
703  static const char testcode[] =
704  "!!ARBvp1.0\n"
705  "OPTION NV_vertex_program2;\n"
706  "MOV result.clip[0], 0.0;\n"
707  "MOV result.position, 0.0;\n"
708  "END\n";
709 
710  if (!gl_info->supported[NV_VERTEX_PROGRAM2_OPTION]) return FALSE;
711 
712  while (gl_info->gl_ops.gl.p_glGetError());
713 
714  GL_EXTCALL(glGenProgramsARB(1, &prog));
715  if(!prog)
716  {
717  ERR("Failed to create the NVvp clip test program\n");
718  return FALSE;
719  }
720  GL_EXTCALL(glBindProgramARB(GL_VERTEX_PROGRAM_ARB, prog));
722  strlen(testcode), testcode));
723  gl_info->gl_ops.gl.p_glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &pos);
724  if(pos != -1)
725  {
726  WARN("GL_NV_vertex_program2_option result.clip[] test failed\n");
727  TRACE("error: %s\n", debugstr_a((const char *)gl_info->gl_ops.gl.p_glGetString(GL_PROGRAM_ERROR_STRING_ARB)));
728  ret = TRUE;
729  while (gl_info->gl_ops.gl.p_glGetError());
730  }
731  else TRACE("GL_NV_vertex_program2_option result.clip[] test passed\n");
732 
733  GL_EXTCALL(glBindProgramARB(GL_VERTEX_PROGRAM_ARB, 0));
734  GL_EXTCALL(glDeleteProgramsARB(1, &prog));
735  checkGLcall("GL_NV_vertex_program2_option result.clip[] test cleanup");
736 
737  return ret;
738 }
739 
740 /* Context activation is done by the caller. */
741 static BOOL match_fbo_tex_update(const struct wined3d_gl_info *gl_info, struct wined3d_caps_gl_ctx *ctx,
742  const char *gl_renderer, enum wined3d_gl_vendor gl_vendor,
744 {
745  char data[4 * 4 * 4];
746  GLuint tex, fbo;
747  GLenum status;
748 
750 
751  memset(data, 0xcc, sizeof(data));
752 
753  gl_info->gl_ops.gl.p_glGenTextures(1, &tex);
754  gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_2D, tex);
755  gl_info->gl_ops.gl.p_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
756  gl_info->gl_ops.gl.p_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
757  gl_info->gl_ops.gl.p_glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 4, 4, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, NULL);
758  checkGLcall("glTexImage2D");
759 
760  gl_info->fbo_ops.glGenFramebuffers(1, &fbo);
761  gl_info->fbo_ops.glBindFramebuffer(GL_FRAMEBUFFER, fbo);
762  gl_info->fbo_ops.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, tex, 0);
763  checkGLcall("glFramebufferTexture2D");
764 
765  status = gl_info->fbo_ops.glCheckFramebufferStatus(GL_FRAMEBUFFER);
766  if (status != GL_FRAMEBUFFER_COMPLETE) ERR("FBO status %#x\n", status);
767  checkGLcall("glCheckFramebufferStatus");
768 
769  memset(data, 0x11, sizeof(data));
770  gl_info->gl_ops.gl.p_glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 4, 4, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, data);
771  checkGLcall("glTexSubImage2D");
772 
773  gl_info->gl_ops.gl.p_glClearColor(0.996f, 0.729f, 0.745f, 0.792f);
774  gl_info->gl_ops.gl.p_glClear(GL_COLOR_BUFFER_BIT);
775  checkGLcall("glClear");
776 
777  gl_info->gl_ops.gl.p_glGetTexImage(GL_TEXTURE_2D, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, data);
778  checkGLcall("glGetTexImage");
779 
780  gl_info->fbo_ops.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, 0, 0);
781  gl_info->fbo_ops.glBindFramebuffer(GL_FRAMEBUFFER, 0);
782  gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_2D, 0);
783  checkGLcall("glBindTexture");
784 
785  gl_info->fbo_ops.glDeleteFramebuffers(1, &fbo);
786  gl_info->gl_ops.gl.p_glDeleteTextures(1, &tex);
787  checkGLcall("glDeleteTextures");
788 
789  return *(DWORD *)data == 0x11111111;
790 }
791 
792 /* Context activation is done by the caller. */
793 static BOOL match_broken_rgba16(const struct wined3d_gl_info *gl_info, struct wined3d_caps_gl_ctx *ctx,
794  const char *gl_renderer, enum wined3d_gl_vendor gl_vendor,
796 {
797  /* GL_RGBA16 uses GL_RGBA8 internally on Geforce 7 and older cards.
798  * This leads to graphical bugs in Half Life 2 and Unreal engine games. */
799  GLuint tex;
800  GLint size;
801 
802  gl_info->gl_ops.gl.p_glGenTextures(1, &tex);
803  gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_2D, tex);
804  gl_info->gl_ops.gl.p_glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA16, 4, 4, 0, GL_RGBA, GL_UNSIGNED_SHORT, NULL);
805  checkGLcall("glTexImage2D");
806 
807  gl_info->gl_ops.gl.p_glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_RED_SIZE, &size);
808  checkGLcall("glGetTexLevelParameteriv");
809  TRACE("Real color depth is %d\n", size);
810 
811  gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_2D, 0);
812  checkGLcall("glBindTexture");
813  gl_info->gl_ops.gl.p_glDeleteTextures(1, &tex);
814  checkGLcall("glDeleteTextures");
815 
816  return size < 16;
817 }
818 
819 static BOOL match_fglrx(const struct wined3d_gl_info *gl_info, struct wined3d_caps_gl_ctx *ctx,
820  const char *gl_renderer, enum wined3d_gl_vendor gl_vendor,
822 {
823  return gl_vendor == GL_VENDOR_FGLRX;
824 }
825 
826 static BOOL match_r200(const struct wined3d_gl_info *gl_info, struct wined3d_caps_gl_ctx *ctx,
827  const char *gl_renderer, enum wined3d_gl_vendor gl_vendor,
829 {
830  if (card_vendor != HW_VENDOR_AMD) return FALSE;
831  if (device == CARD_AMD_RADEON_8500) return TRUE;
832  return FALSE;
833 }
834 
835 static BOOL match_broken_arb_fog(const struct wined3d_gl_info *gl_info, struct wined3d_caps_gl_ctx *ctx,
836  const char *gl_renderer, enum wined3d_gl_vendor gl_vendor,
838 {
839  DWORD data[4];
840  GLuint tex, fbo;
841  GLenum status;
842  float color[4] = {0.0f, 1.0f, 0.0f, 0.0f};
843  GLuint prog;
844  GLint err_pos;
845  static const char program_code[] =
846  "!!ARBfp1.0\n"
847  "OPTION ARB_fog_linear;\n"
848  "MOV result.color, {1.0, 0.0, 0.0, 0.0};\n"
849  "END\n";
850 
852  return FALSE;
853  if (!gl_info->supported[ARB_FRAGMENT_PROGRAM])
854  return FALSE;
855 
856  gl_info->gl_ops.gl.p_glGenTextures(1, &tex);
857  gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_2D, tex);
858  gl_info->gl_ops.gl.p_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
859  gl_info->gl_ops.gl.p_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
860  gl_info->gl_ops.gl.p_glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB8, 4, 1, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, NULL);
861  checkGLcall("glTexImage2D");
862 
863  gl_info->fbo_ops.glGenFramebuffers(1, &fbo);
864  gl_info->fbo_ops.glBindFramebuffer(GL_FRAMEBUFFER, fbo);
865  gl_info->fbo_ops.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, tex, 0);
866  checkGLcall("glFramebufferTexture2D");
867 
868  status = gl_info->fbo_ops.glCheckFramebufferStatus(GL_FRAMEBUFFER);
869  if (status != GL_FRAMEBUFFER_COMPLETE) ERR("FBO status %#x\n", status);
870  checkGLcall("glCheckFramebufferStatus");
871 
872  gl_info->gl_ops.gl.p_glClearColor(0.0f, 0.0f, 1.0f, 0.0f);
873  gl_info->gl_ops.gl.p_glClear(GL_COLOR_BUFFER_BIT);
874  checkGLcall("glClear");
875  gl_info->gl_ops.gl.p_glViewport(0, 0, 4, 1);
876  checkGLcall("glViewport");
877 
878  gl_info->gl_ops.gl.p_glEnable(GL_FOG);
879  gl_info->gl_ops.gl.p_glFogf(GL_FOG_START, 0.5f);
880  gl_info->gl_ops.gl.p_glFogf(GL_FOG_END, 0.5f);
881  gl_info->gl_ops.gl.p_glFogi(GL_FOG_MODE, GL_LINEAR);
882  gl_info->gl_ops.gl.p_glHint(GL_FOG_HINT, GL_NICEST);
883  gl_info->gl_ops.gl.p_glFogfv(GL_FOG_COLOR, color);
884  checkGLcall("fog setup");
885 
886  GL_EXTCALL(glGenProgramsARB(1, &prog));
887  GL_EXTCALL(glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, prog));
889  strlen(program_code), program_code));
890  gl_info->gl_ops.gl.p_glEnable(GL_FRAGMENT_PROGRAM_ARB);
891  checkGLcall("Test fragment program setup");
892 
893  gl_info->gl_ops.gl.p_glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &err_pos);
894  if (err_pos != -1)
895  {
896  const char *error_str;
897  error_str = (const char *)gl_info->gl_ops.gl.p_glGetString(GL_PROGRAM_ERROR_STRING_ARB);
898  FIXME("Fog test program error at position %d: %s\n\n", err_pos, debugstr_a(error_str));
899  }
900 
901  gl_info->gl_ops.gl.p_glBegin(GL_TRIANGLE_STRIP);
902  gl_info->gl_ops.gl.p_glVertex3f(-1.0f, -1.0f, 0.0f);
903  gl_info->gl_ops.gl.p_glVertex3f( 1.0f, -1.0f, 1.0f);
904  gl_info->gl_ops.gl.p_glVertex3f(-1.0f, 1.0f, 0.0f);
905  gl_info->gl_ops.gl.p_glVertex3f( 1.0f, 1.0f, 1.0f);
906  gl_info->gl_ops.gl.p_glEnd();
907  checkGLcall("ARBfp fog test draw");
908 
909  gl_info->gl_ops.gl.p_glGetTexImage(GL_TEXTURE_2D, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, data);
910  checkGLcall("glGetTexImage");
911  data[0] &= 0x00ffffff;
912  data[1] &= 0x00ffffff;
913  data[2] &= 0x00ffffff;
914  data[3] &= 0x00ffffff;
915 
916  gl_info->fbo_ops.glBindFramebuffer(GL_FRAMEBUFFER, 0);
917  gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_2D, 0);
918 
919  gl_info->fbo_ops.glDeleteFramebuffers(1, &fbo);
920  gl_info->gl_ops.gl.p_glDeleteTextures(1, &tex);
921  gl_info->gl_ops.gl.p_glDisable(GL_FOG);
922  GL_EXTCALL(glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, 0));
923  gl_info->gl_ops.gl.p_glDisable(GL_FRAGMENT_PROGRAM_ARB);
924  GL_EXTCALL(glDeleteProgramsARB(1, &prog));
925  checkGLcall("ARBfp fog test teardown");
926 
927  TRACE("Fog test data: %08x %08x %08x %08x\n", data[0], data[1], data[2], data[3]);
928  return data[0] != 0x00ff0000 || data[3] != 0x0000ff00;
929 }
930 
932  struct wined3d_caps_gl_ctx *ctx, const char *gl_renderer, enum wined3d_gl_vendor gl_vendor,
934 {
935  if (!gl_info->supported[ARB_VIEWPORT_ARRAY])
936  return FALSE;
938  return FALSE;
940 }
941 
942 static void quirk_apple_glsl_constants(struct wined3d_gl_info *gl_info)
943 {
944  /* MacOS needs uniforms for relative addressing offsets. This can accumulate to quite a few uniforms.
945  * Beyond that the general uniform isn't optimal, so reserve a number of uniforms. 12 vec4's should
946  * allow 48 different offsets or other helper immediate values. */
947  TRACE("Reserving 12 GLSL constants for compiler private use.\n");
948  gl_info->reserved_glsl_constants = max(gl_info->reserved_glsl_constants, 12);
949 }
950 
951 static void quirk_amd_dx9(struct wined3d_gl_info *gl_info)
952 {
953  /* MacOS advertises GL_ARB_texture_non_power_of_two on ATI r500 and earlier cards, although
954  * these cards only support GL_ARB_texture_rectangle(D3DPTEXTURECAPS_NONPOW2CONDITIONAL).
955  * If real NP2 textures are used, the driver falls back to software. We could just remove the
956  * extension and use GL_ARB_texture_rectangle instead, but texture_rectangle is inconvenient
957  * due to the non-normalized texture coordinates. Thus set an internal extension flag,
958  * GL_WINE_normalized_texrect, which signals the code that it can use non power of two textures
959  * as per GL_ARB_texture_non_power_of_two, but has to stick to the texture_rectangle limits.
960  *
961  * fglrx doesn't advertise GL_ARB_texture_non_power_of_two, but it advertises opengl 2.0 which
962  * has this extension promoted to core. The extension loading code sets this extension supported
963  * due to that, so this code works on fglrx as well. */
965  {
966  TRACE("GL_ARB_texture_non_power_of_two advertised on R500 or earlier card, removing.\n");
969  }
970 }
971 
972 static void quirk_no_np2(struct wined3d_gl_info *gl_info)
973 {
974  /* The nVidia GeForceFX series reports OpenGL 2.0 capabilities with the latest drivers versions, but
975  * doesn't explicitly advertise the ARB_tex_npot extension in the GL extension string.
976  * This usually means that ARB_tex_npot is supported in hardware as long as the application is staying
977  * within the limits enforced by the ARB_texture_rectangle extension. This however is not true for the
978  * FX series, which instantly falls back to a slower software path as soon as ARB_tex_npot is used.
979  * We therefore completely remove ARB_tex_npot from the list of supported extensions.
980  *
981  * Note that wine_normalized_texrect can't be used in this case because internally it uses ARB_tex_npot,
982  * triggering the software fallback. There is not much we can do here apart from disabling the
983  * software-emulated extension and re-enable ARB_tex_rect (which was previously disabled
984  * in wined3d_adapter_init_gl_caps).
985  * This fixup removes performance problems on both the FX 5900 and FX 5700 (e.g. for framebuffer
986  * post-processing effects in the game "Max Payne 2").
987  * The behaviour can be verified through a simple test app attached in bugreport #14724. */
988  TRACE("GL_ARB_texture_non_power_of_two advertised through OpenGL 2.0 on NV FX card, removing.\n");
991 }
992 
993 static void quirk_texcoord_w(struct wined3d_gl_info *gl_info)
994 {
995  /* The Intel GPUs on MacOS set the .w register of texcoords to 0.0 by default, which causes problems
996  * with fixed function fragment processing. Ideally this flag should be detected with a test shader
997  * and OpenGL feedback mode, but some GL implementations (MacOS ATI at least, probably all MacOS ones)
998  * do not like vertex shaders in feedback mode and return an error, even though it should be valid
999  * according to the spec.
1000  *
1001  * We don't want to enable this on all cards, as it adds an extra instruction per texcoord used. This
1002  * makes the shader slower and eats instruction slots which should be available to the d3d app.
1003  *
1004  * ATI Radeon HD 2xxx cards on MacOS have the issue. Instead of checking for the buggy cards, blacklist
1005  * all radeon cards on Macs and whitelist the good ones. That way we're prepared for the future. If
1006  * this workaround is activated on cards that do not need it, it won't break things, just affect
1007  * performance negatively. */
1008  TRACE("Enabling vertex texture coord fixes in vertex shaders.\n");
1010 }
1011 
1012 static void quirk_clip_varying(struct wined3d_gl_info *gl_info)
1013 {
1015 }
1016 
1017 static void quirk_allows_specular_alpha(struct wined3d_gl_info *gl_info)
1018 {
1020 }
1021 
1022 static void quirk_disable_nvvp_clip(struct wined3d_gl_info *gl_info)
1023 {
1025 }
1026 
1027 static void quirk_fbo_tex_update(struct wined3d_gl_info *gl_info)
1028 {
1030 }
1031 
1032 static void quirk_broken_rgba16(struct wined3d_gl_info *gl_info)
1033 {
1034  gl_info->quirks |= WINED3D_QUIRK_BROKEN_RGBA16;
1035 }
1036 
1037 static void quirk_infolog_spam(struct wined3d_gl_info *gl_info)
1038 {
1039  gl_info->quirks |= WINED3D_QUIRK_INFO_LOG_SPAM;
1040 }
1041 
1042 static void quirk_limited_tex_filtering(struct wined3d_gl_info *gl_info)
1043 {
1044  /* Nvidia GeForce 6xxx and 7xxx support accelerated VTF only on a few
1045  selected texture formats. They are apparently the only DX9 class GPUs
1046  supporting VTF.
1047  Also, DX9-era GPUs are somewhat limited with float textures
1048  filtering and blending. */
1050 }
1051 
1052 static void quirk_r200_constants(struct wined3d_gl_info *gl_info)
1053 {
1054  /* The Mesa r200 driver (and there is no other driver for this GPU Wine would run on)
1055  * loads some fog parameters (start, end, exponent, but not the color) into the
1056  * program.
1057  *
1058  * Apparently the fog hardware is only able to handle linear fog with a range of 0.0;1.0,
1059  * and it is the responsibility of the vertex pipeline to handle non-linear fog and
1060  * linear fog with start and end other than 0.0 and 1.0. */
1061  TRACE("Reserving 1 ARB constant for compiler private use.\n");
1062  gl_info->reserved_arb_constants = max(gl_info->reserved_arb_constants, 1);
1063 }
1064 
1065 static void quirk_broken_arb_fog(struct wined3d_gl_info *gl_info)
1066 {
1068 }
1069 
1071 {
1072  if (gl_info->supported[ARB_CLIP_CONTROL])
1073  {
1074  TRACE("Disabling ARB_clip_control.\n");
1075  gl_info->supported[ARB_CLIP_CONTROL] = FALSE;
1076  }
1077 }
1078 
1080 {
1081  BOOL (*match)(const struct wined3d_gl_info *gl_info, struct wined3d_caps_gl_ctx *ctx,
1082  const char *gl_renderer, enum wined3d_gl_vendor gl_vendor,
1084  void (*apply)(struct wined3d_gl_info *gl_info);
1085  const char *description;
1086 };
1087 
1088 static const struct driver_quirk quirk_table[] =
1089 {
1090  {
1092  quirk_amd_dx9,
1093  "AMD normalized texrect quirk"
1094  },
1095  {
1096  match_apple,
1098  "Apple GLSL uniform override"
1099  },
1100  {
1102  quirk_no_np2,
1103  "Geforce 5 NP2 disable"
1104  },
1105  {
1108  "Init texcoord .w for Apple Intel GPU driver"
1109  },
1110  {
1113  "Init texcoord .w for Apple ATI >= r600 GPU driver"
1114  },
1115  {
1118  "Reserved varying for gl_ClipPos"
1119  },
1120  {
1121  /* GL_EXT_secondary_color does not allow 4 component secondary colors, but most
1122  * GL implementations accept it. The Mac GL is the only implementation known to
1123  * reject it.
1124  *
1125  * If we can pass 4 component specular colors, do it, because (a) we don't have
1126  * to screw around with the data, and (b) the D3D fixed function vertex pipeline
1127  * passes specular alpha to the pixel shader if any is used. Otherwise the
1128  * specular alpha is used to pass the fog coordinate, which we pass to opengl
1129  * via GL_EXT_fog_coord.
1130  */
1133  "Allow specular alpha quirk"
1134  },
1135  {
1138  "Apple NV_vertex_program clip bug quirk"
1139  },
1140  {
1143  "FBO rebind for attachment updates"
1144  },
1145  {
1148  "True RGBA16 is not available"
1149  },
1150  {
1151  match_fglrx,
1153  "Not printing GLSL infolog"
1154  },
1155  {
1158  "Texture filtering, blending and VTF support is limited"
1159  },
1160  {
1161  match_r200,
1163  "r200 vertex shader constants"
1164  },
1165  {
1168  "ARBfp fogstart == fogend workaround"
1169  },
1170  {
1173  "Nvidia viewport subpixel bits bug"
1174  },
1175 };
1176 
1177 /* Certain applications (Steam) complain if we report an outdated driver version. In general,
1178  * reporting a driver version is moot because we are not the Windows driver, and we have different
1179  * bugs, features, etc.
1180  *
1181  * The driver version has the form "x.y.z.w".
1182  *
1183  * "x" is the Windows version the driver is meant for:
1184  * 4 -> 95/98/NT4
1185  * 5 -> 2000
1186  * 6 -> 2000/XP
1187  * 7 -> Vista
1188  * 8 -> Win 7
1189  *
1190  * "y" is the maximum Direct3D version the driver supports.
1191  * y -> d3d version mapping:
1192  * 11 -> d3d6
1193  * 12 -> d3d7
1194  * 13 -> d3d8
1195  * 14 -> d3d9
1196  * 15 -> d3d10
1197  * 16 -> d3d10.1
1198  * 17 -> d3d11
1199  *
1200  * "z" is the subversion number.
1201  *
1202  * "w" is the vendor specific driver build number.
1203  */
1204 
1206 {
1209  const char *driver_name; /* name of Windows driver */
1210  WORD version; /* version word ('y'), contained in low word of DriverVersion.HighPart */
1211  WORD subversion; /* subversion word ('z'), contained in high word of DriverVersion.LowPart */
1212  WORD build; /* build number ('w'), contained in low word of DriverVersion.LowPart */
1213 };
1214 
1215 /* The driver version table contains driver information for different devices on several OS versions. */
1217 {
1218  /* AMD
1219  * - Radeon HD2x00 (R600) and up supported by current drivers.
1220  * - Radeon 9500 (R300) - X1*00 (R5xx) supported up to Catalyst 9.3 (Linux) and 10.2 (XP/Vista/Win7)
1221  * - Radeon 7xxx (R100) - 9250 (RV250) supported up to Catalyst 6.11 (XP)
1222  * - Rage 128 supported up to XP, latest official build 6.13.3279 dated October 2001 */
1223  {DRIVER_AMD_RAGE_128PRO, DRIVER_MODEL_NT5X, "ati2dvaa.dll", 13, 3279, 0},
1224  {DRIVER_AMD_R100, DRIVER_MODEL_NT5X, "ati2dvag.dll", 14, 10, 6614},
1225  {DRIVER_AMD_R300, DRIVER_MODEL_NT5X, "ati2dvag.dll", 14, 10, 6764},
1226  {DRIVER_AMD_R600, DRIVER_MODEL_NT5X, "ati2dvag.dll", 17, 10, 1280},
1227  {DRIVER_AMD_R300, DRIVER_MODEL_NT6X, "atiumdag.dll", 14, 10, 741 },
1228  {DRIVER_AMD_R600, DRIVER_MODEL_NT6X, "atiumdag.dll", 17, 10, 1280},
1229  {DRIVER_AMD_RX, DRIVER_MODEL_NT6X, "aticfx32.dll", 17, 10, 1474},
1230 
1231  /* Intel
1232  * The drivers are unified but not all versions support all GPUs. At some point the 2k/xp
1233  * drivers used ialmrnt5.dll for GMA800/GMA900 but at some point the file was renamed to
1234  * igxprd32.dll but the GMA800 driver was never updated. */
1235  {DRIVER_INTEL_GMA800, DRIVER_MODEL_NT5X, "ialmrnt5.dll", 14, 10, 3889},
1236  {DRIVER_INTEL_GMA900, DRIVER_MODEL_NT5X, "igxprd32.dll", 14, 10, 4764},
1237  {DRIVER_INTEL_GMA950, DRIVER_MODEL_NT5X, "igxprd32.dll", 14, 10, 4926},
1238  {DRIVER_INTEL_GMA3000, DRIVER_MODEL_NT5X, "igxprd32.dll", 14, 10, 5218},
1239  {DRIVER_INTEL_GMA950, DRIVER_MODEL_NT6X, "igdumd32.dll", 14, 10, 1504},
1240  {DRIVER_INTEL_GMA3000, DRIVER_MODEL_NT6X, "igdumd32.dll", 15, 10, 1666},
1241  {DRIVER_INTEL_HD4000, DRIVER_MODEL_NT6X, "igdumdim32.dll", 19, 15, 4352},
1242 
1243  /* Nvidia
1244  * - Geforce8 and newer is supported by the current 340.52 driver on XP-Win8
1245  * - Geforce6 and 7 support is up to 307.83 on XP-Win8
1246  * - GeforceFX support is up to 173.x on <= XP
1247  * - Geforce2MX/3/4 up to 96.x on <= XP
1248  * - TNT/Geforce1/2 up to 71.x on <= XP
1249  * All version numbers used below are from the Linux nvidia drivers. */
1250  {DRIVER_NVIDIA_TNT, DRIVER_MODEL_NT5X, "nv4_disp.dll", 14, 10, 7186},
1251  {DRIVER_NVIDIA_GEFORCE2MX, DRIVER_MODEL_NT5X, "nv4_disp.dll", 14, 10, 9371},
1252  {DRIVER_NVIDIA_GEFORCEFX, DRIVER_MODEL_NT5X, "nv4_disp.dll", 14, 11, 7516},
1253  {DRIVER_NVIDIA_GEFORCE6, DRIVER_MODEL_NT5X, "nv4_disp.dll", 18, 13, 783},
1254  {DRIVER_NVIDIA_GEFORCE8, DRIVER_MODEL_NT5X, "nv4_disp.dll", 18, 13, 4052},
1255  {DRIVER_NVIDIA_GEFORCE6, DRIVER_MODEL_NT6X, "nvd3dum.dll", 18, 13, 783},
1256  {DRIVER_NVIDIA_GEFORCE8, DRIVER_MODEL_NT6X, "nvd3dum.dll", 18, 13, 4052},
1257 
1258  /* VMware */
1259  {DRIVER_VMWARE, DRIVER_MODEL_NT5X, "vm3dum.dll", 14, 1, 1134},
1260 };
1261 
1263 {
1264  WORD vendor; /* reported PCI card vendor ID */
1265  WORD card; /* reported PCI card device ID */
1266  const char *description; /* Description of the card e.g. NVIDIA RIVA TNT */
1268  unsigned int vidmem;
1269 };
1270 
1271 /* The amount of video memory stored in the gpu description table is the minimum amount of video memory
1272  * found on a board containing a specific GPU. */
1274 {
1275  /* Nvidia cards */
1276  {HW_VENDOR_NVIDIA, CARD_NVIDIA_RIVA_128, "NVIDIA RIVA 128", DRIVER_NVIDIA_TNT, 4 },
1277  {HW_VENDOR_NVIDIA, CARD_NVIDIA_RIVA_TNT, "NVIDIA RIVA TNT", DRIVER_NVIDIA_TNT, 16 },
1278  {HW_VENDOR_NVIDIA, CARD_NVIDIA_RIVA_TNT2, "NVIDIA RIVA TNT2/TNT2 Pro", DRIVER_NVIDIA_TNT, 32 },
1279  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE, "NVIDIA GeForce 256", DRIVER_NVIDIA_TNT, 32 },
1280  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE2, "NVIDIA GeForce2 GTS/GeForce2 Pro", DRIVER_NVIDIA_TNT, 32 },
1281  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE2_MX, "NVIDIA GeForce2 MX/MX 400", DRIVER_NVIDIA_GEFORCE2MX,32 },
1283  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE4_MX, "NVIDIA GeForce4 MX 460", DRIVER_NVIDIA_GEFORCE2MX,64 },
1284  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE4_TI4200, "NVIDIA GeForce4 Ti 4200", DRIVER_NVIDIA_GEFORCE2MX,64, },
1285  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCEFX_5200, "NVIDIA GeForce FX 5200", DRIVER_NVIDIA_GEFORCEFX, 64 },
1286  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCEFX_5600, "NVIDIA GeForce FX 5600", DRIVER_NVIDIA_GEFORCEFX, 128 },
1287  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCEFX_5800, "NVIDIA GeForce FX 5800", DRIVER_NVIDIA_GEFORCEFX, 256 },
1288  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_6200, "NVIDIA GeForce 6200", DRIVER_NVIDIA_GEFORCE6, 64 },
1289  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_6600GT, "NVIDIA GeForce 6600 GT", DRIVER_NVIDIA_GEFORCE6, 128 },
1290  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_6800, "NVIDIA GeForce 6800", DRIVER_NVIDIA_GEFORCE6, 128 },
1291  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_7300, "NVIDIA GeForce Go 7300", DRIVER_NVIDIA_GEFORCE6, 256 },
1292  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_7400, "NVIDIA GeForce Go 7400", DRIVER_NVIDIA_GEFORCE6, 256 },
1293  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_7600, "NVIDIA GeForce 7600 GT", DRIVER_NVIDIA_GEFORCE6, 256 },
1294  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_7800GT, "NVIDIA GeForce 7800 GT", DRIVER_NVIDIA_GEFORCE6, 256 },
1295  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_8200, "NVIDIA GeForce 8200", DRIVER_NVIDIA_GEFORCE8, 512 },
1296  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_8300GS, "NVIDIA GeForce 8300 GS", DRIVER_NVIDIA_GEFORCE8, 128 },
1297  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_8400GS, "NVIDIA GeForce 8400 GS", DRIVER_NVIDIA_GEFORCE8, 128 },
1298  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_8500GT, "NVIDIA GeForce 8500 GT", DRIVER_NVIDIA_GEFORCE8, 256 },
1299  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_8600GT, "NVIDIA GeForce 8600 GT", DRIVER_NVIDIA_GEFORCE8, 256 },
1300  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_8600MGT, "NVIDIA GeForce 8600M GT", DRIVER_NVIDIA_GEFORCE8, 512 },
1301  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_8800GTS, "NVIDIA GeForce 8800 GTS", DRIVER_NVIDIA_GEFORCE8, 320 },
1302  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_8800GTX, "NVIDIA GeForce 8800 GTX", DRIVER_NVIDIA_GEFORCE8, 768 },
1303  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_9200, "NVIDIA GeForce 9200", DRIVER_NVIDIA_GEFORCE8, 256 },
1304  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_9300, "NVIDIA GeForce 9300", DRIVER_NVIDIA_GEFORCE8, 256 },
1305  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_9400M, "NVIDIA GeForce 9400M", DRIVER_NVIDIA_GEFORCE8, 256 },
1306  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_9400GT, "NVIDIA GeForce 9400 GT", DRIVER_NVIDIA_GEFORCE8, 256 },
1307  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_9500GT, "NVIDIA GeForce 9500 GT", DRIVER_NVIDIA_GEFORCE8, 256 },
1308  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_9600GT, "NVIDIA GeForce 9600 GT", DRIVER_NVIDIA_GEFORCE8, 512 },
1309  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_9700MGT, "NVIDIA GeForce 9700M GT", DRIVER_NVIDIA_GEFORCE8, 512 },
1310  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_9800GT, "NVIDIA GeForce 9800 GT", DRIVER_NVIDIA_GEFORCE8, 512 },
1311  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_210, "NVIDIA GeForce 210", DRIVER_NVIDIA_GEFORCE8, 512 },
1312  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GT220, "NVIDIA GeForce GT 220", DRIVER_NVIDIA_GEFORCE8, 512 },
1313  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GT240, "NVIDIA GeForce GT 240", DRIVER_NVIDIA_GEFORCE8, 512 },
1314  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTS250, "NVIDIA GeForce GTS 250", DRIVER_NVIDIA_GEFORCE8, 1024},
1315  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX260, "NVIDIA GeForce GTX 260", DRIVER_NVIDIA_GEFORCE8, 1024},
1316  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX275, "NVIDIA GeForce GTX 275", DRIVER_NVIDIA_GEFORCE8, 896 },
1317  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX280, "NVIDIA GeForce GTX 280", DRIVER_NVIDIA_GEFORCE8, 1024},
1318  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_315M, "NVIDIA GeForce 315M", DRIVER_NVIDIA_GEFORCE8, 512 },
1319  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_320M, "NVIDIA GeForce 320M", DRIVER_NVIDIA_GEFORCE8, 256},
1320  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GT320M, "NVIDIA GeForce GT 320M", DRIVER_NVIDIA_GEFORCE8, 1024},
1321  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GT325M, "NVIDIA GeForce GT 325M", DRIVER_NVIDIA_GEFORCE8, 1024},
1322  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GT330, "NVIDIA GeForce GT 330", DRIVER_NVIDIA_GEFORCE8, 1024},
1323  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTS350M, "NVIDIA GeForce GTS 350M", DRIVER_NVIDIA_GEFORCE8, 1024},
1324  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_410M, "NVIDIA GeForce 410M", DRIVER_NVIDIA_GEFORCE8, 512},
1325  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GT420, "NVIDIA GeForce GT 420", DRIVER_NVIDIA_GEFORCE8, 2048},
1326  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GT425M, "NVIDIA GeForce GT 425M", DRIVER_NVIDIA_GEFORCE8, 1024},
1327  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GT430, "NVIDIA GeForce GT 430", DRIVER_NVIDIA_GEFORCE8, 1024},
1328  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GT440, "NVIDIA GeForce GT 440", DRIVER_NVIDIA_GEFORCE8, 1024},
1329  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTS450, "NVIDIA GeForce GTS 450", DRIVER_NVIDIA_GEFORCE8, 1024},
1330  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX460, "NVIDIA GeForce GTX 460", DRIVER_NVIDIA_GEFORCE8, 768 },
1331  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX460M, "NVIDIA GeForce GTX 460M", DRIVER_NVIDIA_GEFORCE8, 1536},
1332  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX465, "NVIDIA GeForce GTX 465", DRIVER_NVIDIA_GEFORCE8, 1024},
1333  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX470, "NVIDIA GeForce GTX 470", DRIVER_NVIDIA_GEFORCE8, 1280},
1334  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX480, "NVIDIA GeForce GTX 480", DRIVER_NVIDIA_GEFORCE8, 1536},
1335  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GT520, "NVIDIA GeForce GT 520", DRIVER_NVIDIA_GEFORCE8, 1024},
1336  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GT525M, "NVIDIA GeForce GT 525M", DRIVER_NVIDIA_GEFORCE8, 1024},
1337  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GT540M, "NVIDIA GeForce GT 540M", DRIVER_NVIDIA_GEFORCE8, 1024},
1338  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX550, "NVIDIA GeForce GTX 550 Ti", DRIVER_NVIDIA_GEFORCE8, 1024},
1339  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GT555M, "NVIDIA GeForce GT 555M", DRIVER_NVIDIA_GEFORCE8, 1024},
1340  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX560TI, "NVIDIA GeForce GTX 560 Ti", DRIVER_NVIDIA_GEFORCE8, 1024},
1341  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX560M, "NVIDIA GeForce GTX 560M", DRIVER_NVIDIA_GEFORCE8, 3072},
1342  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX560, "NVIDIA GeForce GTX 560", DRIVER_NVIDIA_GEFORCE8, 1024},
1343  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX570, "NVIDIA GeForce GTX 570", DRIVER_NVIDIA_GEFORCE8, 1280},
1344  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX580, "NVIDIA GeForce GTX 580", DRIVER_NVIDIA_GEFORCE8, 1536},
1345  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GT610, "NVIDIA GeForce GT 610", DRIVER_NVIDIA_GEFORCE8, 1024},
1346  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GT630, "NVIDIA GeForce GT 630", DRIVER_NVIDIA_GEFORCE8, 1024},
1347  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GT630M, "NVIDIA GeForce GT 630M", DRIVER_NVIDIA_GEFORCE8, 1024},
1348  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GT640M, "NVIDIA GeForce GT 640M", DRIVER_NVIDIA_GEFORCE8, 1024},
1349  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GT650M, "NVIDIA GeForce GT 650M", DRIVER_NVIDIA_GEFORCE8, 2048},
1350  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX650, "NVIDIA GeForce GTX 650", DRIVER_NVIDIA_GEFORCE8, 1024},
1351  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX650TI, "NVIDIA GeForce GTX 650 Ti", DRIVER_NVIDIA_GEFORCE8, 1024},
1352  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX660, "NVIDIA GeForce GTX 660", DRIVER_NVIDIA_GEFORCE8, 2048},
1353  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX660M, "NVIDIA GeForce GTX 660M", DRIVER_NVIDIA_GEFORCE8, 2048},
1354  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX660TI, "NVIDIA GeForce GTX 660 Ti", DRIVER_NVIDIA_GEFORCE8, 2048},
1355  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX670, "NVIDIA GeForce GTX 670", DRIVER_NVIDIA_GEFORCE8, 2048},
1356  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX670MX, "NVIDIA GeForce GTX 670MX", DRIVER_NVIDIA_GEFORCE8, 3072},
1357  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX675MX, "NVIDIA GeForce GTX 675MX", DRIVER_NVIDIA_GEFORCE8, 4096},
1358  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX680, "NVIDIA GeForce GTX 680", DRIVER_NVIDIA_GEFORCE8, 2048},
1359  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX690, "NVIDIA GeForce GTX 690", DRIVER_NVIDIA_GEFORCE8, 2048},
1360  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GT730, "NVIDIA GeForce GT 730", DRIVER_NVIDIA_GEFORCE8, 2048},
1361  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GT730M, "NVIDIA GeForce GT 730M", DRIVER_NVIDIA_GEFORCE8, 1024},
1362  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GT740M, "NVIDIA GeForce GT 740M", DRIVER_NVIDIA_GEFORCE8, 2048},
1363  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GT750M, "NVIDIA GeForce GT 750M", DRIVER_NVIDIA_GEFORCE8, 1024},
1364  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX750, "NVIDIA GeForce GTX 750", DRIVER_NVIDIA_GEFORCE8, 1024},
1365  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX750TI, "NVIDIA GeForce GTX 750 Ti", DRIVER_NVIDIA_GEFORCE8, 2048},
1366  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX760, "NVIDIA GeForce GTX 760", DRIVER_NVIDIA_GEFORCE8, 2048},
1367  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX760TI, "NVIDIA GeForce GTX 760 Ti", DRIVER_NVIDIA_GEFORCE8, 2048},
1368  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX765M, "NVIDIA GeForce GTX 765M", DRIVER_NVIDIA_GEFORCE8, 2048},
1369  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX770M, "NVIDIA GeForce GTX 770M", DRIVER_NVIDIA_GEFORCE8, 3072},
1370  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX770, "NVIDIA GeForce GTX 770", DRIVER_NVIDIA_GEFORCE8, 2048},
1371  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX780, "NVIDIA GeForce GTX 780", DRIVER_NVIDIA_GEFORCE8, 3072},
1372  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX780TI, "NVIDIA GeForce GTX 780 Ti", DRIVER_NVIDIA_GEFORCE8, 3072},
1373  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTXTITAN, "NVIDIA GeForce GTX TITAN", DRIVER_NVIDIA_GEFORCE8, 6144},
1374  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTXTITANB, "NVIDIA GeForce GTX TITAN Black", DRIVER_NVIDIA_GEFORCE8, 6144},
1375  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTXTITANX, "NVIDIA GeForce GTX TITAN X", DRIVER_NVIDIA_GEFORCE8, 12288},
1376  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTXTITANZ, "NVIDIA GeForce GTX TITAN Z", DRIVER_NVIDIA_GEFORCE8, 12288},
1377  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_820M, "NVIDIA GeForce 820M", DRIVER_NVIDIA_GEFORCE8, 2048},
1378  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_830M, "NVIDIA GeForce 830M", DRIVER_NVIDIA_GEFORCE8, 2048},
1379  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_840M, "NVIDIA GeForce 840M", DRIVER_NVIDIA_GEFORCE8, 2048},
1380  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_845M, "NVIDIA GeForce 845M", DRIVER_NVIDIA_GEFORCE8, 2048},
1381  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX850M, "NVIDIA GeForce GTX 850M", DRIVER_NVIDIA_GEFORCE8, 2048},
1382  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX860M, "NVIDIA GeForce GTX 860M", DRIVER_NVIDIA_GEFORCE8, 2048},
1383  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX870M, "NVIDIA GeForce GTX 870M", DRIVER_NVIDIA_GEFORCE8, 3072},
1384  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX880M, "NVIDIA GeForce GTX 880M", DRIVER_NVIDIA_GEFORCE8, 4096},
1385  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_940M, "NVIDIA GeForce 940M", DRIVER_NVIDIA_GEFORCE8, 4096},
1386  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX950, "NVIDIA GeForce GTX 950", DRIVER_NVIDIA_GEFORCE8, 2048},
1387  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX950M, "NVIDIA GeForce GTX 950M", DRIVER_NVIDIA_GEFORCE8, 4096},
1388  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX960, "NVIDIA GeForce GTX 960", DRIVER_NVIDIA_GEFORCE8, 4096},
1389  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX960M, "NVIDIA GeForce GTX 960M", DRIVER_NVIDIA_GEFORCE8, 2048},
1390  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX970, "NVIDIA GeForce GTX 970", DRIVER_NVIDIA_GEFORCE8, 4096},
1391  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX970M, "NVIDIA GeForce GTX 970M", DRIVER_NVIDIA_GEFORCE8, 3072},
1392  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX980, "NVIDIA GeForce GTX 980", DRIVER_NVIDIA_GEFORCE8, 4096},
1393  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX980TI, "NVIDIA GeForce GTX 980 Ti", DRIVER_NVIDIA_GEFORCE8, 6144},
1394  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX1050, "NVIDIA GeForce GTX 1050", DRIVER_NVIDIA_GEFORCE8, 2048},
1395  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX1060, "NVIDIA GeForce GTX 1060", DRIVER_NVIDIA_GEFORCE8, 6144},
1396  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX1070, "NVIDIA GeForce GTX 1070", DRIVER_NVIDIA_GEFORCE8, 8192},
1397  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX1080, "NVIDIA GeForce GTX 1080", DRIVER_NVIDIA_GEFORCE8, 8192},
1398  {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX1080TI, "NVIDIA GeForce GTX 1080 Ti", DRIVER_NVIDIA_GEFORCE8, 11264},
1399  {HW_VENDOR_NVIDIA, CARD_NVIDIA_TITANX_PASCAL, "NVIDIA TITAN X (Pascal)", DRIVER_NVIDIA_GEFORCE8, 12288},
1400 
1401  /* AMD cards */
1402  {HW_VENDOR_AMD, CARD_AMD_RAGE_128PRO, "ATI Rage Fury", DRIVER_AMD_RAGE_128PRO, 16 },
1403  {HW_VENDOR_AMD, CARD_AMD_RADEON_7200, "ATI RADEON 7200 SERIES", DRIVER_AMD_R100, 32 },
1404  {HW_VENDOR_AMD, CARD_AMD_RADEON_8500, "ATI RADEON 8500 SERIES", DRIVER_AMD_R100, 64 },
1405  {HW_VENDOR_AMD, CARD_AMD_RADEON_9500, "ATI Radeon 9500", DRIVER_AMD_R300, 64 },
1406  {HW_VENDOR_AMD, CARD_AMD_RADEON_XPRESS_200M, "ATI RADEON XPRESS 200M Series", DRIVER_AMD_R300, 64 },
1407  {HW_VENDOR_AMD, CARD_AMD_RADEON_X700, "ATI Radeon X700 SE", DRIVER_AMD_R300, 128 },
1408  {HW_VENDOR_AMD, CARD_AMD_RADEON_X1600, "ATI Radeon X1600 Series", DRIVER_AMD_R300, 128 },
1409  {HW_VENDOR_AMD, CARD_AMD_RADEON_HD2350, "ATI Mobility Radeon HD 2350", DRIVER_AMD_R600, 256 },
1410  {HW_VENDOR_AMD, CARD_AMD_RADEON_HD2600, "ATI Mobility Radeon HD 2600", DRIVER_AMD_R600, 256 },
1411  {HW_VENDOR_AMD, CARD_AMD_RADEON_HD2900, "ATI Radeon HD 2900 XT", DRIVER_AMD_R600, 512 },
1412  {HW_VENDOR_AMD, CARD_AMD_RADEON_HD3200, "ATI Radeon HD 3200 Graphics", DRIVER_AMD_R600, 128 },
1413  {HW_VENDOR_AMD, CARD_AMD_RADEON_HD3850, "ATI Radeon HD 3850 AGP", DRIVER_AMD_R600, 512 },
1414  {HW_VENDOR_AMD, CARD_AMD_RADEON_HD4200M, "ATI Mobility Radeon HD 4200", DRIVER_AMD_R600, 256 },
1415  {HW_VENDOR_AMD, CARD_AMD_RADEON_HD4350, "ATI Radeon HD 4350", DRIVER_AMD_R600, 256 },
1416  {HW_VENDOR_AMD, CARD_AMD_RADEON_HD4600, "ATI Radeon HD 4600 Series", DRIVER_AMD_R600, 512 },
1417  {HW_VENDOR_AMD, CARD_AMD_RADEON_HD4700, "ATI Radeon HD 4700 Series", DRIVER_AMD_R600, 512 },
1418  {HW_VENDOR_AMD, CARD_AMD_RADEON_HD4800, "ATI Radeon HD 4800 Series", DRIVER_AMD_R600, 512 },
1419  {HW_VENDOR_AMD, CARD_AMD_RADEON_HD5400, "ATI Radeon HD 5400 Series", DRIVER_AMD_R600, 512 },
1420  {HW_VENDOR_AMD, CARD_AMD_RADEON_HD5600, "ATI Radeon HD 5600 Series", DRIVER_AMD_R600, 512 },
1421  {HW_VENDOR_AMD, CARD_AMD_RADEON_HD5700, "ATI Radeon HD 5700 Series", DRIVER_AMD_R600, 512 },
1422  {HW_VENDOR_AMD, CARD_AMD_RADEON_HD5800, "ATI Radeon HD 5800 Series", DRIVER_AMD_R600, 1024},
1423  {HW_VENDOR_AMD, CARD_AMD_RADEON_HD5900, "ATI Radeon HD 5900 Series", DRIVER_AMD_R600, 1024},
1424  {HW_VENDOR_AMD, CARD_AMD_RADEON_HD6300, "AMD Radeon HD 6300 series Graphics", DRIVER_AMD_R600, 1024},
1425  {HW_VENDOR_AMD, CARD_AMD_RADEON_HD6400, "AMD Radeon HD 6400 Series", DRIVER_AMD_R600, 1024},
1426  {HW_VENDOR_AMD, CARD_AMD_RADEON_HD6410D, "AMD Radeon HD 6410D", DRIVER_AMD_R600, 1024},
1427  {HW_VENDOR_AMD, CARD_AMD_RADEON_HD6480G, "AMD Radeon HD 6480G", DRIVER_AMD_R600, 512 },
1428  {HW_VENDOR_AMD, CARD_AMD_RADEON_HD6550D, "AMD Radeon HD 6550D", DRIVER_AMD_R600, 1024},
1429  {HW_VENDOR_AMD, CARD_AMD_RADEON_HD6600, "AMD Radeon HD 6600 Series", DRIVER_AMD_R600, 1024},
1430  {HW_VENDOR_AMD, CARD_AMD_RADEON_HD6600M, "AMD Radeon HD 6600M Series", DRIVER_AMD_R600, 512 },
1431  {HW_VENDOR_AMD, CARD_AMD_RADEON_HD6700, "AMD Radeon HD 6700 Series", DRIVER_AMD_R600, 1024},
1432  {HW_VENDOR_AMD, CARD_AMD_RADEON_HD6800, "AMD Radeon HD 6800 Series", DRIVER_AMD_R600, 1024},
1433  {HW_VENDOR_AMD, CARD_AMD_RADEON_HD6900, "AMD Radeon HD 6900 Series", DRIVER_AMD_R600, 2048},
1434  {HW_VENDOR_AMD, CARD_AMD_RADEON_HD7660D, "AMD Radeon HD 7660D", DRIVER_AMD_R600, 2048},
1435  {HW_VENDOR_AMD, CARD_AMD_RADEON_HD7700, "AMD Radeon HD 7700 Series", DRIVER_AMD_R600, 1024},
1436  {HW_VENDOR_AMD, CARD_AMD_RADEON_HD7800, "AMD Radeon HD 7800 Series", DRIVER_AMD_R600, 2048},
1437  {HW_VENDOR_AMD, CARD_AMD_RADEON_HD7900, "AMD Radeon HD 7900 Series", DRIVER_AMD_R600, 2048},
1438  {HW_VENDOR_AMD, CARD_AMD_RADEON_HD8600M, "AMD Radeon HD 8600M Series", DRIVER_AMD_R600, 1024},
1439  {HW_VENDOR_AMD, CARD_AMD_RADEON_HD8670, "AMD Radeon HD 8670", DRIVER_AMD_R600, 2048},
1440  {HW_VENDOR_AMD, CARD_AMD_RADEON_HD8770, "AMD Radeon HD 8770", DRIVER_AMD_R600, 2048},
1441  {HW_VENDOR_AMD, CARD_AMD_RADEON_R3, "AMD Radeon HD 8400 / R3 Series", DRIVER_AMD_R600, 2048},
1442  {HW_VENDOR_AMD, CARD_AMD_RADEON_R7, "AMD Radeon(TM) R7 Graphics", DRIVER_AMD_R600, 2048},
1443  {HW_VENDOR_AMD, CARD_AMD_RADEON_R9_285, "AMD Radeon R9 285", DRIVER_AMD_RX, 2048},
1444  {HW_VENDOR_AMD, CARD_AMD_RADEON_R9_290, "AMD Radeon R9 290", DRIVER_AMD_RX, 4096},
1445  {HW_VENDOR_AMD, CARD_AMD_RADEON_R9_FURY, "AMD Radeon (TM) R9 Fury Series", DRIVER_AMD_RX, 4096},
1446  {HW_VENDOR_AMD, CARD_AMD_RADEON_RX_460, "Radeon(TM) RX 460 Graphics", DRIVER_AMD_RX, 4096},
1447  {HW_VENDOR_AMD, CARD_AMD_RADEON_RX_480, "Radeon (TM) RX 480 Graphics", DRIVER_AMD_RX, 4096},
1448 
1449  /* VMware */
1450  {HW_VENDOR_VMWARE, CARD_VMWARE_SVGA3D, "VMware SVGA 3D (Microsoft Corporation - WDDM)", DRIVER_VMWARE, 1024},
1451 
1452  /* Intel cards */
1453  {HW_VENDOR_INTEL, CARD_INTEL_830M, "Intel(R) 82830M Graphics Controller", DRIVER_INTEL_GMA800, 32 },
1454  {HW_VENDOR_INTEL, CARD_INTEL_855GM, "Intel(R) 82852/82855 GM/GME Graphics Controller", DRIVER_INTEL_GMA800, 32 },
1455  {HW_VENDOR_INTEL, CARD_INTEL_845G, "Intel(R) 845G", DRIVER_INTEL_GMA800, 32 },
1456  {HW_VENDOR_INTEL, CARD_INTEL_865G, "Intel(R) 82865G Graphics Controller", DRIVER_INTEL_GMA800, 32 },
1457  {HW_VENDOR_INTEL, CARD_INTEL_915G, "Intel(R) 82915G/GV/910GL Express Chipset Family", DRIVER_INTEL_GMA900, 64 },
1458  {HW_VENDOR_INTEL, CARD_INTEL_E7221G, "Intel(R) E7221G", DRIVER_INTEL_GMA900, 64 },
1459  {HW_VENDOR_INTEL, CARD_INTEL_915GM, "Mobile Intel(R) 915GM/GMS,910GML Express Chipset Family", DRIVER_INTEL_GMA900, 64 },
1460  {HW_VENDOR_INTEL, CARD_INTEL_945G, "Intel(R) 945G", DRIVER_INTEL_GMA950, 64 },
1461  {HW_VENDOR_INTEL, CARD_INTEL_945GM, "Mobile Intel(R) 945GM Express Chipset Family", DRIVER_INTEL_GMA950, 64 },
1462  {HW_VENDOR_INTEL, CARD_INTEL_945GME, "Intel(R) 945GME", DRIVER_INTEL_GMA950, 64 },
1463  {HW_VENDOR_INTEL, CARD_INTEL_Q35, "Intel(R) Q35", DRIVER_INTEL_GMA950, 64 },
1464  {HW_VENDOR_INTEL, CARD_INTEL_G33, "Intel(R) G33", DRIVER_INTEL_GMA950, 64 },
1465  {HW_VENDOR_INTEL, CARD_INTEL_Q33, "Intel(R) Q33", DRIVER_INTEL_GMA950, 64 },
1466  {HW_VENDOR_INTEL, CARD_INTEL_PNVG, "Intel(R) IGD", DRIVER_INTEL_GMA950, 64 },
1467  {HW_VENDOR_INTEL, CARD_INTEL_PNVM, "Intel(R) IGD", DRIVER_INTEL_GMA950, 64 },
1468  {HW_VENDOR_INTEL, CARD_INTEL_965Q, "Intel(R) 965Q", DRIVER_INTEL_GMA3000, 128},
1469  {HW_VENDOR_INTEL, CARD_INTEL_965G, "Intel(R) 965G", DRIVER_INTEL_GMA3000, 128},
1470  {HW_VENDOR_INTEL, CARD_INTEL_946GZ, "Intel(R) 946GZ", DRIVER_INTEL_GMA3000, 128},
1471  {HW_VENDOR_INTEL, CARD_INTEL_965GM, "Mobile Intel(R) 965 Express Chipset Family", DRIVER_INTEL_GMA3000, 128},
1472  {HW_VENDOR_INTEL, CARD_INTEL_965GME, "Intel(R) 965GME", DRIVER_INTEL_GMA3000, 128},
1473  {HW_VENDOR_INTEL, CARD_INTEL_GM45, "Mobile Intel(R) GM45 Express Chipset Family", DRIVER_INTEL_GMA3000, 512},
1474  {HW_VENDOR_INTEL, CARD_INTEL_IGD, "Intel(R) Integrated Graphics Device", DRIVER_INTEL_GMA3000, 512},
1475  {HW_VENDOR_INTEL, CARD_INTEL_G45, "Intel(R) G45/G43", DRIVER_INTEL_GMA3000, 512},
1476  {HW_VENDOR_INTEL, CARD_INTEL_Q45, "Intel(R) Q45/Q43", DRIVER_INTEL_GMA3000, 512},
1477  {HW_VENDOR_INTEL, CARD_INTEL_G41, "Intel(R) G41", DRIVER_INTEL_GMA3000, 512},
1478  {HW_VENDOR_INTEL, CARD_INTEL_B43, "Intel(R) B43", DRIVER_INTEL_GMA3000, 512},
1479  {HW_VENDOR_INTEL, CARD_INTEL_ILKD, "Intel(R) HD Graphics", DRIVER_INTEL_GMA3000, 1536},
1480  {HW_VENDOR_INTEL, CARD_INTEL_ILKM, "Intel(R) HD Graphics", DRIVER_INTEL_GMA3000, 1536},
1481  {HW_VENDOR_INTEL, CARD_INTEL_SNBD, "Intel(R) HD Graphics 3000", DRIVER_INTEL_GMA3000, 1536},
1482  {HW_VENDOR_INTEL, CARD_INTEL_SNBM, "Intel(R) HD Graphics 3000", DRIVER_INTEL_GMA3000, 1536},
1483  {HW_VENDOR_INTEL, CARD_INTEL_SNBS, "Intel(R) HD Graphics Family", DRIVER_INTEL_GMA3000, 1536},
1484  {HW_VENDOR_INTEL, CARD_INTEL_IVBD, "Intel(R) HD Graphics 4000", DRIVER_INTEL_HD4000, 1536},
1485  {HW_VENDOR_INTEL, CARD_INTEL_IVBM, "Intel(R) HD Graphics 4000", DRIVER_INTEL_HD4000, 1536},
1486  {HW_VENDOR_INTEL, CARD_INTEL_IVBS, "Intel(R) HD Graphics Family", DRIVER_INTEL_HD4000, 1536},
1487  {HW_VENDOR_INTEL, CARD_INTEL_HWD, "Intel(R) HD Graphics 4600", DRIVER_INTEL_HD4000, 1536},
1488  {HW_VENDOR_INTEL, CARD_INTEL_HWM, "Intel(R) HD Graphics 4600", DRIVER_INTEL_HD4000, 1536},
1489  {HW_VENDOR_INTEL, CARD_INTEL_I5100_1, "Intel(R) Iris(TM) Graphics 5100", DRIVER_INTEL_HD4000, 1536},
1490  {HW_VENDOR_INTEL, CARD_INTEL_I5100_2, "Intel(R) Iris(TM) Graphics 5100", DRIVER_INTEL_HD4000, 1536},
1491  {HW_VENDOR_INTEL, CARD_INTEL_I5100_3, "Intel(R) Iris(TM) Graphics 5100", DRIVER_INTEL_HD4000, 1536},
1492  {HW_VENDOR_INTEL, CARD_INTEL_I5100_4, "Intel(R) Iris(TM) Graphics 5100", DRIVER_INTEL_HD4000, 1536},
1493  {HW_VENDOR_INTEL, CARD_INTEL_IP5200_1, "Intel(R) Iris(TM) Pro Graphics 5200", DRIVER_INTEL_HD4000, 1536},
1494  {HW_VENDOR_INTEL, CARD_INTEL_IP5200_2, "Intel(R) Iris(TM) Pro Graphics 5200", DRIVER_INTEL_HD4000, 1536},
1495  {HW_VENDOR_INTEL, CARD_INTEL_IP5200_3, "Intel(R) Iris(TM) Pro Graphics 5200", DRIVER_INTEL_HD4000, 1536},
1496  {HW_VENDOR_INTEL, CARD_INTEL_IP5200_4, "Intel(R) Iris(TM) Pro Graphics 5200", DRIVER_INTEL_HD4000, 1536},
1497  {HW_VENDOR_INTEL, CARD_INTEL_IP5200_5, "Intel(R) Iris(TM) Pro Graphics 5200", DRIVER_INTEL_HD4000, 1536},
1498  {HW_VENDOR_INTEL, CARD_INTEL_HD5300, "Intel(R) HD Graphics 5300", DRIVER_INTEL_HD4000, 2048},
1499  {HW_VENDOR_INTEL, CARD_INTEL_HD5500, "Intel(R) HD Graphics 5500", DRIVER_INTEL_HD4000, 2048},
1500  {HW_VENDOR_INTEL, CARD_INTEL_HD5600, "Intel(R) HD Graphics 5600", DRIVER_INTEL_HD4000, 2048},
1501  {HW_VENDOR_INTEL, CARD_INTEL_HD6000, "Intel(R) HD Graphics 6000", DRIVER_INTEL_HD4000, 2048},
1502  {HW_VENDOR_INTEL, CARD_INTEL_I6100, "Intel(R) Iris(TM) Graphics 6100", DRIVER_INTEL_HD4000, 2048},
1503  {HW_VENDOR_INTEL, CARD_INTEL_IP6200, "Intel(R) Iris(TM) Pro Graphics 6200", DRIVER_INTEL_HD4000, 2048},
1504  {HW_VENDOR_INTEL, CARD_INTEL_IPP6300, "Intel(R) Iris(TM) Pro Graphics P6300", DRIVER_INTEL_HD4000, 2048},
1505  {HW_VENDOR_INTEL, CARD_INTEL_HD510_1, "Intel(R) HD Graphics 510", DRIVER_INTEL_HD4000, 2048},
1506  {HW_VENDOR_INTEL, CARD_INTEL_HD510_2, "Intel(R) HD Graphics 510", DRIVER_INTEL_HD4000, 2048},
1507  {HW_VENDOR_INTEL, CARD_INTEL_HD510_3, "Intel(R) HD Graphics 510", DRIVER_INTEL_HD4000, 2048},
1508  {HW_VENDOR_INTEL, CARD_INTEL_HD515, "Intel(R) HD Graphics 515", DRIVER_INTEL_HD4000, 2048},
1509  {HW_VENDOR_INTEL, CARD_INTEL_HD520_1, "Intel(R) HD Graphics 520", DRIVER_INTEL_HD4000, 2048},
1510  {HW_VENDOR_INTEL, CARD_INTEL_HD520_2, "Intel(R) HD Graphics 520", DRIVER_INTEL_HD4000, 2048},
1511  {HW_VENDOR_INTEL, CARD_INTEL_HD530_1, "Intel(R) HD Graphics 530", DRIVER_INTEL_HD4000, 2048},
1512  {HW_VENDOR_INTEL, CARD_INTEL_HD530_2, "Intel(R) HD Graphics 530", DRIVER_INTEL_HD4000, 2048},
1513  {HW_VENDOR_INTEL, CARD_INTEL_HDP530, "Intel(R) HD Graphics P530", DRIVER_INTEL_HD4000, 2048},
1514  {HW_VENDOR_INTEL, CARD_INTEL_I540, "Intel(R) Iris(TM) Graphics 540", DRIVER_INTEL_HD4000, 2048},
1515  {HW_VENDOR_INTEL, CARD_INTEL_I550, "Intel(R) Iris(TM) Graphics 550", DRIVER_INTEL_HD4000, 2048},
1516  {HW_VENDOR_INTEL, CARD_INTEL_I555, "Intel(R) Iris(TM) Graphics 555", DRIVER_INTEL_HD4000, 2048},
1517  {HW_VENDOR_INTEL, CARD_INTEL_IP555, "Intel(R) Iris(TM) Graphics P555", DRIVER_INTEL_HD4000, 2048},
1518  {HW_VENDOR_INTEL, CARD_INTEL_IP580_1, "Intel(R) Iris(TM) Pro Graphics 580", DRIVER_INTEL_HD4000, 2048},
1519  {HW_VENDOR_INTEL, CARD_INTEL_IP580_2, "Intel(R) Iris(TM) Pro Graphics 580", DRIVER_INTEL_HD4000, 2048},
1520  {HW_VENDOR_INTEL, CARD_INTEL_IPP580_1, "Intel(R) Iris(TM) Pro Graphics P580", DRIVER_INTEL_HD4000, 2048},
1521  {HW_VENDOR_INTEL, CARD_INTEL_IPP580_2, "Intel(R) Iris(TM) Pro Graphics P580", DRIVER_INTEL_HD4000, 2048},
1522 };
1523 
1526 {
1527  unsigned int i;
1528 
1529  TRACE("Looking up version info for driver=%d driver_model=%d\n", driver, driver_model);
1530  for (i = 0; i < (sizeof(driver_version_table) / sizeof(driver_version_table[0])); i++)
1531  {
1532  const struct driver_version_information *entry = &driver_version_table[i];
1533 
1534  if (entry->driver == driver && (driver_model == DRIVER_MODEL_GENERIC
1535  || entry->driver_model == driver_model))
1536  {
1537  TRACE("Found driver \"%s\", version %u, subversion %u, build %u.\n",
1538  entry->driver_name, entry->version, entry->subversion, entry->build);
1539  return entry;
1540  }
1541  }
1542  return NULL;
1543 }
1544 
1547 {
1548  unsigned int i;
1549 
1550  for (i = 0; i < (sizeof(gpu_description_table) / sizeof(*gpu_description_table)); ++i)
1551  {
1552  if (vendor == gpu_description_table[i].vendor && device == gpu_description_table[i].card)
1553  return &gpu_description_table[i];
1554  }
1555 
1556  return NULL;
1557 }
1558 
1559 static const struct gpu_description *query_gpu_description(const struct wined3d_gl_info *gl_info, UINT64 *vram_bytes)
1560 {
1563  const struct gpu_description *gpu_description;
1564  static unsigned int once;
1565 
1566  if (gl_info->supported[WGL_WINE_QUERY_RENDERER])
1567  {
1568  GLuint value;
1569 
1570  if (GL_EXTCALL(wglQueryCurrentRendererIntegerWINE(WGL_RENDERER_VENDOR_ID_WINE, &value)))
1571  vendor = value;
1572  if (GL_EXTCALL(wglQueryCurrentRendererIntegerWINE(WGL_RENDERER_DEVICE_ID_WINE, &value)))
1573  device = value;
1574  if (GL_EXTCALL(wglQueryCurrentRendererIntegerWINE(WGL_RENDERER_VIDEO_MEMORY_WINE, &value)))
1575  *vram_bytes = (UINT64)value * 1024 * 1024;
1576  TRACE("Card reports vendor PCI ID 0x%04x, device PCI ID 0x%04x, 0x%s bytes of video memory.\n",
1577  vendor, device, wine_dbgstr_longlong(*vram_bytes));
1578  }
1579  else if (gl_info->supported[NVX_GPU_MEMORY_INFO])
1580  {
1581  GLint vram_kb;
1582  gl_info->gl_ops.gl.p_glGetIntegerv(GL_GPU_MEMORY_INFO_DEDICATED_VIDMEM_NVX, &vram_kb);
1583 
1584  *vram_bytes = (UINT64)vram_kb * 1024;
1585  TRACE("Got 0x%s as video memory from NVX_GPU_MEMORY_INFO extension.\n",
1586  wine_dbgstr_longlong(*vram_bytes));
1587  }
1588 
1590  {
1592  TRACE("Overriding vendor PCI ID with 0x%04x.\n", vendor);
1593  }
1594 
1596  {
1598  TRACE("Overriding device PCI ID with 0x%04x.\n", device);
1599  }
1600 
1602  {
1603  *vram_bytes = wined3d_settings.emulated_textureram;
1604  TRACE("Overriding amount of video memory with 0x%s bytes.\n",
1605  wine_dbgstr_longlong(*vram_bytes));
1606  }
1607 
1608  if (!(gpu_description = get_gpu_description(vendor, device))
1611  ERR_(winediag)("Invalid GPU override %04x:%04x specified, ignoring.\n", vendor, device);
1612 
1613  return gpu_description;
1614 }
1615 
1616 static void init_driver_info(struct wined3d_driver_info *driver_info,
1617  const struct gpu_description *gpu_desc, UINT64 vram_bytes)
1618 {
1619  OSVERSIONINFOW os_version;
1620  WORD driver_os_version;
1622  enum wined3d_driver_model driver_model;
1623  const struct driver_version_information *version_info;
1624 
1625  memset(&os_version, 0, sizeof(os_version));
1626  os_version.dwOSVersionInfoSize = sizeof(os_version);
1627  if (!GetVersionExW(&os_version))
1628  {
1629  ERR("Failed to get OS version, reporting 2000/XP.\n");
1630  driver_os_version = 6;
1631  driver_model = DRIVER_MODEL_NT5X;
1632  }
1633  else
1634  {
1635  TRACE("OS version %u.%u.\n", os_version.dwMajorVersion, os_version.dwMinorVersion);
1636  switch (os_version.dwMajorVersion)
1637  {
1638  case 4:
1639  /* If needed we could distinguish between 9x and NT4, but this code won't make
1640  * sense for NT4 since it had no way to obtain this info through DirectDraw 3.0.
1641  */
1642  driver_os_version = 4;
1643  driver_model = DRIVER_MODEL_WIN9X;
1644  break;
1645 
1646  case 5:
1647  driver_os_version = 6;
1648  driver_model = DRIVER_MODEL_NT5X;
1649  break;
1650 
1651  case 6:
1652  if (os_version.dwMinorVersion == 0)
1653  {
1654  driver_os_version = 7;
1655  driver_model = DRIVER_MODEL_NT6X;
1656  }
1657  else if (os_version.dwMinorVersion == 1)
1658  {
1659  driver_os_version = 8;
1660  driver_model = DRIVER_MODEL_NT6X;
1661  }
1662  else
1663  {
1664  if (os_version.dwMinorVersion > 2)
1665  {
1666  FIXME("Unhandled OS version %u.%u, reporting Win 8.\n",
1667  os_version.dwMajorVersion, os_version.dwMinorVersion);
1668  }
1669  driver_os_version = 9;
1670  driver_model = DRIVER_MODEL_NT6X;
1671  }
1672  break;
1673 
1674  case 10:
1675  driver_os_version = 10;
1676  driver_model = DRIVER_MODEL_NT6X;
1677  break;
1678 
1679  default:
1680  FIXME("Unhandled OS version %u.%u, reporting 2000/XP.\n",
1681  os_version.dwMajorVersion, os_version.dwMinorVersion);
1682  driver_os_version = 6;
1683  driver_model = DRIVER_MODEL_NT5X;
1684  break;
1685  }
1686  }
1687 
1688  driver_info->vendor = gpu_desc->vendor;
1689  driver_info->device = gpu_desc->card;
1690  driver_info->description = gpu_desc->description;
1691  driver_info->vram_bytes = vram_bytes ? vram_bytes : (UINT64)gpu_desc->vidmem * 1024 * 1024;
1692  driver = gpu_desc->driver;
1693 
1699 #ifdef __i386__
1700  if (driver_model < DRIVER_MODEL_NT6X && driver_info->vram_bytes > LONG_MAX)
1701  {
1702  TRACE("Limiting amount of video memory to %#lx bytes for OS version older than Vista.\n", LONG_MAX);
1703  driver_info->vram_bytes = LONG_MAX;
1704  }
1705 #endif
1706 
1707  /* Try to obtain driver version information for the current Windows version. This fails in
1708  * some cases:
1709  * - the gpu is not available on the currently selected OS version:
1710  * - Geforce GTX480 on Win98. When running applications in compatibility mode on Windows,
1711  * version information for the current Windows version is returned instead of faked info.
1712  * We do the same and assume the default Windows version to emulate is WinXP.
1713  *
1714  * - Videocard is a Riva TNT but winver is set to win7 (there are no drivers for this beast)
1715  * For now return the XP driver info. Perhaps later on we should return VESA.
1716  *
1717  * - the gpu is not in our database (can happen when the user overrides the vendor_id / device_id)
1718  * This could be an indication that our database is not up to date, so this should be fixed.
1719  */
1720  if ((version_info = get_driver_version_info(driver, driver_model))
1721  || (version_info = get_driver_version_info(driver, DRIVER_MODEL_GENERIC)))
1722  {
1723  driver_info->name = version_info->driver_name;
1724  driver_info->version_high = MAKEDWORD_VERSION(driver_os_version, version_info->version);
1725  driver_info->version_low = MAKEDWORD_VERSION(version_info->subversion, version_info->build);
1726  }
1727  else
1728  {
1729  ERR("No driver version info found for device %04x:%04x, driver model %#x.\n",
1730  driver_info->vendor, driver_info->device, driver_model);
1731  driver_info->name = "Display";
1732  driver_info->version_high = MAKEDWORD_VERSION(driver_os_version, 15);
1733  driver_info->version_low = MAKEDWORD_VERSION(8, 6); /* Nvidia RIVA TNT, arbitrary */
1734  }
1735 
1736  TRACE("Reporting (fake) driver version 0x%08x-0x%08x.\n",
1737  driver_info->version_high, driver_info->version_low);
1738 }
1739 
1740 /* Context activation is done by the caller. */
1741 static void fixup_extensions(struct wined3d_gl_info *gl_info, struct wined3d_caps_gl_ctx *ctx,
1742  const char *gl_renderer, enum wined3d_gl_vendor gl_vendor,
1744 {
1745  unsigned int i;
1746 
1747  for (i = 0; i < (sizeof(quirk_table) / sizeof(*quirk_table)); ++i)
1748  {
1749  if (!quirk_table[i].match(gl_info, ctx, gl_renderer, gl_vendor, card_vendor, device)) continue;
1750  TRACE("Applying driver quirk \"%s\".\n", quirk_table[i].description);
1751  quirk_table[i].apply(gl_info);
1752  }
1753 
1754  /* Find out if PBOs work as they are supposed to. */
1755  test_pbo_functionality(gl_info);
1756 }
1757 
1758 static DWORD wined3d_parse_gl_version(const char *gl_version)
1759 {
1760  const char *ptr = gl_version;
1761  int major, minor;
1762 
1763  major = atoi(ptr);
1764  if (major <= 0)
1765  ERR("Invalid OpenGL major version %d.\n", major);
1766 
1767  while (isdigit(*ptr)) ++ptr;
1768  if (*ptr++ != '.')
1769  ERR("Invalid OpenGL version string %s.\n", debugstr_a(gl_version));
1770 
1771  minor = atoi(ptr);
1772 
1773  TRACE("Found OpenGL version %d.%d.\n", major, minor);
1774 
1775  return MAKEDWORD_VERSION(major, minor);
1776 }
1777 
1779  const char *gl_vendor_string, const char *gl_renderer, const char *gl_version)
1780 {
1781  /* MacOS has various specialities in the extensions it advertises. Some have to be loaded from
1782  * the opengl 1.2+ core, while other extensions are advertised, but software emulated. So try to
1783  * detect the Apple OpenGL implementation to apply some extension fixups afterwards.
1784  *
1785  * Detecting this isn't really easy. The vendor string doesn't mention Apple. Compile-time checks
1786  * aren't sufficient either because a Linux binary may display on a macos X server via remote X11.
1787  * So try to detect the GL implementation by looking at certain Apple extensions. Some extensions
1788  * like client storage might be supported on other implementations too, but GL_APPLE_flush_render
1789  * is specific to the Mac OS X window management, and GL_APPLE_ycbcr_422 is QuickTime specific. So
1790  * the chance that other implementations support them is rather small since Win32 QuickTime uses
1791  * DirectDraw, not OpenGL. */
1792  if (gl_info->supported[APPLE_FENCE] && gl_info->supported[APPLE_YCBCR_422])
1793  return GL_VENDOR_APPLE;
1794 
1795  if (strstr(gl_vendor_string, "NVIDIA"))
1796  return GL_VENDOR_NVIDIA;
1797 
1798  if (strstr(gl_vendor_string, "ATI"))
1799  return GL_VENDOR_FGLRX;
1800 
1801  if (strstr(gl_vendor_string, "Mesa")
1802  || strstr(gl_vendor_string, "Brian Paul")
1803  || strstr(gl_vendor_string, "X.Org")
1804  || strstr(gl_vendor_string, "Advanced Micro Devices, Inc.")
1805  || strstr(gl_vendor_string, "DRI R300 Project")
1806  || strstr(gl_vendor_string, "Tungsten Graphics, Inc")
1807  || strstr(gl_vendor_string, "VMware, Inc.")
1808  || strstr(gl_vendor_string, "Intel")
1809  || strstr(gl_renderer, "Mesa")
1810  || strstr(gl_renderer, "Gallium")
1811  || strstr(gl_renderer, "Intel")
1812  || strstr(gl_version, "Mesa"))
1813  return GL_VENDOR_MESA;
1814 
1815  FIXME("Received unrecognized GL_VENDOR %s. Returning GL_VENDOR_UNKNOWN.\n",
1816  debugstr_a(gl_vendor_string));
1817 
1818  return GL_VENDOR_UNKNOWN;
1819 }
1820 
1821 static enum wined3d_pci_vendor wined3d_guess_card_vendor(const char *gl_vendor_string, const char *gl_renderer)
1822 {
1823  if (strstr(gl_vendor_string, "NVIDIA")
1824  || strstr(gl_vendor_string, "Nouveau")
1825  || strstr(gl_vendor_string, "nouveau"))
1826  return HW_VENDOR_NVIDIA;
1827 
1828  if (strstr(gl_vendor_string, "ATI")
1829  || strstr(gl_vendor_string, "Advanced Micro Devices, Inc.")
1830  || strstr(gl_vendor_string, "X.Org R300 Project")
1831  || strstr(gl_renderer, "AMD")
1832  || strstr(gl_renderer, "FirePro")
1833  || strstr(gl_renderer, "Radeon")
1834  || strstr(gl_renderer, "R100")
1835  || strstr(gl_renderer, "R200")
1836  || strstr(gl_renderer, "R300")
1837  || strstr(gl_renderer, "R600")
1838  || strstr(gl_renderer, "R700"))
1839  return HW_VENDOR_AMD;
1840 
1841  if (strstr(gl_vendor_string, "Intel(R)")
1842  /* Intel switched from Intel(R) to Intel® recently, so just match Intel. */
1843  || strstr(gl_renderer, "Intel")
1844  || strstr(gl_renderer, "i915")
1845  || strstr(gl_vendor_string, "Intel Inc."))
1846  return HW_VENDOR_INTEL;
1847 
1848  if (strstr(gl_renderer, "SVGA3D"))
1849  return HW_VENDOR_VMWARE;
1850 
1851  if (strstr(gl_vendor_string, "Mesa")
1852  || strstr(gl_vendor_string, "Brian Paul")
1853  || strstr(gl_vendor_string, "Tungsten Graphics, Inc")
1854  || strstr(gl_vendor_string, "VMware, Inc."))
1855  return HW_VENDOR_SOFTWARE;
1856 
1857  FIXME("Received unrecognized GL_VENDOR %s. Returning HW_VENDOR_NVIDIA.\n", debugstr_a(gl_vendor_string));
1858 
1859  return HW_VENDOR_NVIDIA;
1860 }
1861 
1862 static enum wined3d_d3d_level d3d_level_from_caps(const struct shader_caps *shader_caps, const struct fragment_caps *fragment_caps, DWORD glsl_version)
1863 {
1864  if (shader_caps->vs_version >= 5)
1865  return WINED3D_D3D_LEVEL_11;
1866  if (shader_caps->vs_version == 4)
1867  return WINED3D_D3D_LEVEL_10;
1868  if (shader_caps->vs_version == 3)
1869  {
1870  /* wined3d with default settings at the moment doesn't expose SM4+ on
1871  * Mesa drivers. */
1872  if (glsl_version >= MAKEDWORD_VERSION(4, 30))
1873  return WINED3D_D3D_LEVEL_11;
1874  if (glsl_version >= MAKEDWORD_VERSION(1, 30))
1875  return WINED3D_D3D_LEVEL_10;
1876  return WINED3D_D3D_LEVEL_9_SM3;
1877  }
1878  if (shader_caps->vs_version == 2)
1879  return WINED3D_D3D_LEVEL_9_SM2;
1880  if (shader_caps->vs_version == 1)
1881  return WINED3D_D3D_LEVEL_8;
1882 
1883  if (fragment_caps->TextureOpCaps & WINED3DTEXOPCAPS_DOTPRODUCT3)
1884  return WINED3D_D3D_LEVEL_7;
1885  if (fragment_caps->MaxSimultaneousTextures > 1)
1886  return WINED3D_D3D_LEVEL_6;
1887 
1888  return WINED3D_D3D_LEVEL_5;
1889 }
1890 
1891 static const struct wined3d_renderer_table
1892 {
1893  const char *renderer;
1895 }
1897 {
1898  /* Direct 3D 11 */
1899  {"TITAN X (Pascal)", CARD_NVIDIA_TITANX_PASCAL}, /* GeForce 1000 - highend */
1900  {"GTX 1080 Ti", CARD_NVIDIA_GEFORCE_GTX1080TI}, /* GeForce 1000 - highend */
1901  {"GTX 1080", CARD_NVIDIA_GEFORCE_GTX1080}, /* GeForce 1000 - highend */
1902  {"GTX 1070", CARD_NVIDIA_GEFORCE_GTX1070}, /* GeForce 1000 - highend */
1903  {"GTX 1060", CARD_NVIDIA_GEFORCE_GTX1060}, /* GeForce 1000 - midend high */
1904  {"GTX 1050", CARD_NVIDIA_GEFORCE_GTX1050}, /* GeForce 1000 - midend */
1905  {"GTX 980 Ti", CARD_NVIDIA_GEFORCE_GTX980TI}, /* GeForce 900 - highend */
1906  {"GTX 980", CARD_NVIDIA_GEFORCE_GTX980}, /* GeForce 900 - highend */
1907  {"GTX 970M", CARD_NVIDIA_GEFORCE_GTX970M}, /* GeForce 900 - highend mobile*/
1908  {"GTX 970", CARD_NVIDIA_GEFORCE_GTX970}, /* GeForce 900 - highend */
1909  {"GTX TITAN X", CARD_NVIDIA_GEFORCE_GTXTITANX}, /* Geforce 900 - highend */
1910  {"GTX 960M", CARD_NVIDIA_GEFORCE_GTX960M}, /* GeForce 900 - midend high mobile */
1911  {"GTX 960", CARD_NVIDIA_GEFORCE_GTX960}, /* GeForce 900 - midend high */
1912  {"GTX 950M", CARD_NVIDIA_GEFORCE_GTX950M}, /* GeForce 900 - midend mobile */
1913  {"GTX 950", CARD_NVIDIA_GEFORCE_GTX950}, /* GeForce 900 - midend */
1914  {"GeForce 940M", CARD_NVIDIA_GEFORCE_940M}, /* GeForce 900 - midend mobile */
1915  {"GTX 880M", CARD_NVIDIA_GEFORCE_GTX880M}, /* GeForce 800 - mobile */
1916  {"GTX 870M", CARD_NVIDIA_GEFORCE_GTX870M}, /* GeForce 800 - mobile */
1917  {"GTX 860M", CARD_NVIDIA_GEFORCE_GTX860M}, /* GeForce 800 - mobile */
1918  {"GTX 850M", CARD_NVIDIA_GEFORCE_GTX850M}, /* GeForce 800 - mobile */
1919  {"GeForce 845M", CARD_NVIDIA_GEFORCE_845M}, /* GeForce 800 - mobile */
1920  {"GeForce 840M", CARD_NVIDIA_GEFORCE_840M}, /* GeForce 800 - mobile */
1921  {"GeForce 830M", CARD_NVIDIA_GEFORCE_830M}, /* GeForce 800 - mobile */
1922  {"GeForce 820M", CARD_NVIDIA_GEFORCE_820M}, /* GeForce 800 - mobile */
1923  {"GTX 780 Ti", CARD_NVIDIA_GEFORCE_GTX780TI}, /* Geforce 700 - highend */
1924  {"GTX TITAN Black", CARD_NVIDIA_GEFORCE_GTXTITANB}, /* Geforce 700 - highend */
1925  {"GTX TITAN Z", CARD_NVIDIA_GEFORCE_GTXTITANZ}, /* Geforce 700 - highend */
1926  {"GTX TITAN", CARD_NVIDIA_GEFORCE_GTXTITAN}, /* Geforce 700 - highend */
1927  {"GTX 780", CARD_NVIDIA_GEFORCE_GTX780}, /* Geforce 700 - highend */
1928  {"GTX 770M", CARD_NVIDIA_GEFORCE_GTX770M}, /* Geforce 700 - midend high mobile */
1929  {"GTX 770", CARD_NVIDIA_GEFORCE_GTX770}, /* Geforce 700 - highend */
1930  {"GTX 765M", CARD_NVIDIA_GEFORCE_GTX765M}, /* Geforce 700 - midend high mobile */
1931  {"GTX 760 Ti", CARD_NVIDIA_GEFORCE_GTX760TI}, /* Geforce 700 - midend high */
1932  {"GTX 760", CARD_NVIDIA_GEFORCE_GTX760}, /* Geforce 700 - midend high */
1933  {"GTX 750 Ti", CARD_NVIDIA_GEFORCE_GTX750TI}, /* Geforce 700 - midend */
1934  {"GTX 750", CARD_NVIDIA_GEFORCE_GTX750}, /* Geforce 700 - midend */
1935  {"GT 750M", CARD_NVIDIA_GEFORCE_GT750M}, /* Geforce 700 - midend mobile */
1936  {"GT 740M", CARD_NVIDIA_GEFORCE_GT740M}, /* Geforce 700 - midend mobile */
1937  {"GT 730M", CARD_NVIDIA_GEFORCE_GT730M}, /* Geforce 700 - midend mobile */
1938  {"GT 730", CARD_NVIDIA_GEFORCE_GT730}, /* Geforce 700 - lowend */
1939  {"GTX 690", CARD_NVIDIA_GEFORCE_GTX690}, /* Geforce 600 - highend */
1940  {"GTX 680", CARD_NVIDIA_GEFORCE_GTX680}, /* Geforce 600 - highend */
1941  {"GTX 675MX", CARD_NVIDIA_GEFORCE_GTX675MX}, /* Geforce 600 - highend */
1942  {"GTX 670MX", CARD_NVIDIA_GEFORCE_GTX670MX}, /* Geforce 600 - highend */
1943  {"GTX 670", CARD_NVIDIA_GEFORCE_GTX670}, /* Geforce 600 - midend high */
1944  {"GTX 660 Ti", CARD_NVIDIA_GEFORCE_GTX660TI}, /* Geforce 600 - midend high */
1945  {"GTX 660M", CARD_NVIDIA_GEFORCE_GTX660M}, /* Geforce 600 - midend high mobile */
1946  {"GTX 660", CARD_NVIDIA_GEFORCE_GTX660}, /* Geforce 600 - midend high */
1947  {"GTX 650 Ti", CARD_NVIDIA_GEFORCE_GTX650TI}, /* Geforce 600 - lowend */
1948  {"GTX 650", CARD_NVIDIA_GEFORCE_GTX650}, /* Geforce 600 - lowend */
1949  {"GT 650M", CARD_NVIDIA_GEFORCE_GT650M}, /* Geforce 600 - midend mobile */
1950  {"GT 640M", CARD_NVIDIA_GEFORCE_GT640M}, /* Geforce 600 - midend mobile */
1951  {"GT 630M", CARD_NVIDIA_GEFORCE_GT630M}, /* Geforce 600 - midend mobile */
1952  {"GT 630", CARD_NVIDIA_GEFORCE_GT630}, /* Geforce 600 - lowend */
1953  {"GT 610", CARD_NVIDIA_GEFORCE_GT610}, /* Geforce 600 - lowend */
1954  {"GTX 580", CARD_NVIDIA_GEFORCE_GTX580}, /* Geforce 500 - highend */
1955  {"GTX 570", CARD_NVIDIA_GEFORCE_GTX570}, /* Geforce 500 - midend high */
1956  {"GTX 560 Ti", CARD_NVIDIA_GEFORCE_GTX560TI}, /* Geforce 500 - midend */
1957  {"GTX 560M", CARD_NVIDIA_GEFORCE_GTX560M}, /* Geforce 500 - midend mobile */
1958  {"GTX 560", CARD_NVIDIA_GEFORCE_GTX560}, /* Geforce 500 - midend */
1959  {"GT 555M", CARD_NVIDIA_GEFORCE_GT555M}, /* Geforce 500 - midend mobile */
1960  {"GTX 550 Ti", CARD_NVIDIA_GEFORCE_GTX550}, /* Geforce 500 - midend */
1961  {"GT 540M", CARD_NVIDIA_GEFORCE_GT540M}, /* Geforce 500 - midend mobile */
1962  {"GT 525M", CARD_NVIDIA_GEFORCE_GT525M}, /* Geforce 500 - lowend mobile */
1963  {"GT 520", CARD_NVIDIA_GEFORCE_GT520}, /* Geforce 500 - lowend */
1964  {"GTX 480", CARD_NVIDIA_GEFORCE_GTX480}, /* Geforce 400 - highend */
1965  {"GTX 470", CARD_NVIDIA_GEFORCE_GTX470}, /* Geforce 400 - midend high */
1966  /* Direct 3D 10 */
1967  {"GTX 465", CARD_NVIDIA_GEFORCE_GTX465}, /* Geforce 400 - midend */
1968  {"GTX 460M", CARD_NVIDIA_GEFORCE_GTX460M}, /* Geforce 400 - highend mobile */
1969  {"GTX 460", CARD_NVIDIA_GEFORCE_GTX460}, /* Geforce 400 - midend */
1970  {"GTS 450", CARD_NVIDIA_GEFORCE_GTS450}, /* Geforce 400 - midend low */
1971  {"GT 440", CARD_NVIDIA_GEFORCE_GT440}, /* Geforce 400 - lowend */
1972  {"GT 430", CARD_NVIDIA_GEFORCE_GT430}, /* Geforce 400 - lowend */
1973  {"GT 425M", CARD_NVIDIA_GEFORCE_GT425M}, /* Geforce 400 - lowend mobile */
1974  {"GT 420", CARD_NVIDIA_GEFORCE_GT420}, /* Geforce 400 - lowend */
1975  {"410M", CARD_NVIDIA_GEFORCE_410M}, /* Geforce 400 - lowend mobile */
1976  {"GT 330", CARD_NVIDIA_GEFORCE_GT330}, /* Geforce 300 - highend */
1977  {"GTS 360M", CARD_NVIDIA_GEFORCE_GTS350M}, /* Geforce 300 - highend mobile */
1978  {"GTS 350M", CARD_NVIDIA_GEFORCE_GTS350M}, /* Geforce 300 - highend mobile */
1979  {"GT 330M", CARD_NVIDIA_GEFORCE_GT325M}, /* Geforce 300 - midend mobile */
1980  {"GT 325M", CARD_NVIDIA_GEFORCE_GT325M}, /* Geforce 300 - midend mobile */
1981  {"GT 320M", CARD_NVIDIA_GEFORCE_GT320M}, /* Geforce 300 - midend mobile */
1982  {"320M", CARD_NVIDIA_GEFORCE_320M}, /* Geforce 300 - midend mobile */
1983  {"315M", CARD_NVIDIA_GEFORCE_315M}, /* Geforce 300 - midend mobile */
1984  {"GTX 295", CARD_NVIDIA_GEFORCE_GTX280}, /* Geforce 200 - highend */
1985  {"GTX 285", CARD_NVIDIA_GEFORCE_GTX280}, /* Geforce 200 - highend */
1986  {"GTX 280", CARD_NVIDIA_GEFORCE_GTX280}, /* Geforce 200 - highend */
1987  {"GTX 275", CARD_NVIDIA_GEFORCE_GTX275}, /* Geforce 200 - midend high */
1988  {"GTX 260", CARD_NVIDIA_GEFORCE_GTX260}, /* Geforce 200 - midend */
1989  {"GTS 250", CARD_NVIDIA_GEFORCE_GTS250}, /* Geforce 200 - midend */
1990  {"GT 240", CARD_NVIDIA_GEFORCE_GT240}, /* Geforce 200 - midend */
1991  {"GT 220", CARD_NVIDIA_GEFORCE_GT220}, /* Geforce 200 - lowend */
1992  {"GeForce 310", CARD_NVIDIA_GEFORCE_210}, /* Geforce 200 - lowend */
1993  {"GeForce 305", CARD_NVIDIA_GEFORCE_210}, /* Geforce 200 - lowend */
1994  {"GeForce 210", CARD_NVIDIA_GEFORCE_210}, /* Geforce 200 - lowend */
1995  {"G 210", CARD_NVIDIA_GEFORCE_210}, /* Geforce 200 - lowend */
1996  {"GTS 150", CARD_NVIDIA_GEFORCE_9800GT}, /* Geforce 9 - highend / Geforce 200 - midend */
1997  {"9800", CARD_NVIDIA_GEFORCE_9800GT}, /* Geforce 9 - highend / Geforce 200 - midend */
1998  {"9700M GT", CARD_NVIDIA_GEFORCE_9700MGT}, /* Geforce 9 - midend */
1999  {"GT 140", CARD_NVIDIA_GEFORCE_9600GT}, /* Geforce 9 - midend */
2000  {"9600", CARD_NVIDIA_GEFORCE_9600GT}, /* Geforce 9 - midend */
2001  {"GT 130", CARD_NVIDIA_GEFORCE_9500GT}, /* Geforce 9 - midend low / Geforce 200 - low */
2002  {"GT 120", CARD_NVIDIA_GEFORCE_9500GT}, /* Geforce 9 - midend low / Geforce 200 - low */
2003  {"9500", CARD_NVIDIA_GEFORCE_9500GT}, /* Geforce 9 - midend low / Geforce 200 - low */
2004  {"9400M", CARD_NVIDIA_GEFORCE_9400M}, /* Geforce 9 - lowend */
2005  {"9400", CARD_NVIDIA_GEFORCE_9400GT}, /* Geforce 9 - lowend */
2006  {"9300", CARD_NVIDIA_GEFORCE_9300}, /* Geforce 9 - lowend low */
2007  {"9200", CARD_NVIDIA_GEFORCE_9200}, /* Geforce 9 - lowend low */
2008  {"9100", CARD_NVIDIA_GEFORCE_9200}, /* Geforce 9 - lowend low */
2009  {"G 100", CARD_NVIDIA_GEFORCE_9200}, /* Geforce 9 - lowend low */
2010  {"8800 GTX", CARD_NVIDIA_GEFORCE_8800GTX}, /* Geforce 8 - highend high */
2011  {"8800", CARD_NVIDIA_GEFORCE_8800GTS}, /* Geforce 8 - highend */
2012  {"8600M", CARD_NVIDIA_GEFORCE_8600MGT}, /* Geforce 8 - midend mobile */
2013  {"8600 M", CARD_NVIDIA_GEFORCE_8600MGT}, /* Geforce 8 - midend mobile */
2014  {"8700", CARD_NVIDIA_GEFORCE_8600GT}, /* Geforce 8 - midend */
2015  {"8600", CARD_NVIDIA_GEFORCE_8600GT}, /* Geforce 8 - midend */
2016  {"8500", CARD_NVIDIA_GEFORCE_8500GT}, /* Geforce 8 - mid-lowend */
2017  {"8400", CARD_NVIDIA_GEFORCE_8400GS}, /* Geforce 8 - mid-lowend */
2018  {"8300", CARD_NVIDIA_GEFORCE_8300GS}, /* Geforce 8 - lowend */
2019  {"8200", CARD_NVIDIA_GEFORCE_8200}, /* Geforce 8 - lowend */
2020  {"8100", CARD_NVIDIA_GEFORCE_8200}, /* Geforce 8 - lowend */
2021  /* Direct 3D 9 SM3 */
2022  {"Quadro FX 5", CARD_NVIDIA_GEFORCE_7800GT}, /* Geforce 7 - highend */
2023  {"Quadro FX 4", CARD_NVIDIA_GEFORCE_7800GT}, /* Geforce 7 - highend */
2024  {"7950", CARD_NVIDIA_GEFORCE_7800GT}, /* Geforce 7 - highend */
2025  {"7900", CARD_NVIDIA_GEFORCE_7800GT}, /* Geforce 7 - highend */
2026  {"7800", CARD_NVIDIA_GEFORCE_7800GT}, /* Geforce 7 - highend */
2027  {"7700", CARD_NVIDIA_GEFORCE_7600}, /* Geforce 7 - midend */
2028  {"7600", CARD_NVIDIA_GEFORCE_7600}, /* Geforce 7 - midend */
2029  {"7400", CARD_NVIDIA_GEFORCE_7400}, /* Geforce 7 - lower medium */
2030  {"7300", CARD_NVIDIA_GEFORCE_7300}, /* Geforce 7 - lowend */
2031  {"6800", CARD_NVIDIA_GEFORCE_6800}, /* Geforce 6 - highend */
2032  {"6700", CARD_NVIDIA_GEFORCE_6600GT}, /* Geforce 6 - midend */
2033  {"6610", CARD_NVIDIA_GEFORCE_6600GT}, /* Geforce 6 - midend */
2034  {"6600", CARD_NVIDIA_GEFORCE_6600GT}, /* Geforce 6 - midend */
2035  /* Direct 3D 9 SM2 */
2036  {"Quadro FX", CARD_NVIDIA_GEFORCEFX_5800}, /* GeforceFX - highend */
2037  {"5950", CARD_NVIDIA_GEFORCEFX_5800}, /* GeforceFX - highend */
2038  {"5900", CARD_NVIDIA_GEFORCEFX_5800}, /* GeforceFX - highend */
2039  {"5800", CARD_NVIDIA_GEFORCEFX_5800}, /* GeforceFX - highend */
2040  {"5750", CARD_NVIDIA_GEFORCEFX_5600}, /* GeforceFX - midend */
2041  {"5700", CARD_NVIDIA_GEFORCEFX_5600}, /* GeforceFX - midend */
2042  {"5650", CARD_NVIDIA_GEFORCEFX_5600}, /* GeforceFX - midend */
2043  {"5600", CARD_NVIDIA_GEFORCEFX_5600}, /* GeforceFX - midend */
2044  {"5500", CARD_NVIDIA_GEFORCEFX_5200}, /* GeforceFX - lowend */
2045  {"5300", CARD_NVIDIA_GEFORCEFX_5200}, /* GeforceFX - lowend */
2046  {"5250", CARD_NVIDIA_GEFORCEFX_5200}, /* GeforceFX - lowend */
2047  {"5200", CARD_NVIDIA_GEFORCEFX_5200}, /* GeforceFX - lowend */
2048  {"5100", CARD_NVIDIA_GEFORCEFX_5200}, /* GeforceFX - lowend */
2049  /* Direct 3D 8 */
2050  {"Quadro4", CARD_NVIDIA_GEFORCE4_TI4200},
2051  {"GeForce4 Ti", CARD_NVIDIA_GEFORCE4_TI4200}, /* Geforce4 Ti4200/Ti4400/Ti4600/Ti4800 */
2052  /* Direct 3D 7 */
2053  {"GeForce4 MX", CARD_NVIDIA_GEFORCE4_MX}, /* MX420/MX440/MX460/MX4000 */
2054  {"Quadro2 MXR", CARD_NVIDIA_GEFORCE2_MX},
2055  {"GeForce2 MX", CARD_NVIDIA_GEFORCE2_MX}, /* Geforce2 standard/MX100/MX200/MX400 */
2056  {"Quadro2", CARD_NVIDIA_GEFORCE2},
2057  {"GeForce2", CARD_NVIDIA_GEFORCE2}, /* Geforce2 GTS/Pro/Ti/Ultra */
2058  /* Direct 3D 6 */
2059  {"TNT2", CARD_NVIDIA_RIVA_TNT2}, /* Riva TNT2 standard/M64/Pro/Ultra */
2060 },
2061 /* See http://developer.amd.com/resources/hardware-drivers/ati-catalyst-pc-vendor-id-1002-li/
2062  *
2063  * Beware: renderer string do not match exact card model,
2064  * eg HD 4800 is returned for multiple cards, even for RV790 based ones. */
2065 cards_amd_binary[] =
2066 {
2067  {"RX 480", CARD_AMD_RADEON_RX_480},
2068  {"RX 460", CARD_AMD_RADEON_RX_460},
2069  {"R9 Fury Series", CARD_AMD_RADEON_R9_FURY},
2070  /* Southern Islands */
2071  {"HD 7900", CARD_AMD_RADEON_HD7900},
2072  {"HD 7800", CARD_AMD_RADEON_HD7800},
2073  {"HD 7700", CARD_AMD_RADEON_HD7700},
2074  /* Northern Islands */
2075  {"HD 6970", CARD_AMD_RADEON_HD6900},
2076  {"HD 6900", CARD_AMD_RADEON_HD6900},
2077  {"HD 6800", CARD_AMD_RADEON_HD6800},
2078  {"HD 6770M", CARD_AMD_RADEON_HD6600M},
2079  {"HD 6750M", CARD_AMD_RADEON_HD6600M},
2080  {"HD 6700", CARD_AMD_RADEON_HD6700},
2081  {"HD 6670", CARD_AMD_RADEON_HD6600},
2082  {"HD 6630M", CARD_AMD_RADEON_HD6600M},
2083  {"HD 6600M", CARD_AMD_RADEON_HD6600M},
2084  {"HD 6600", CARD_AMD_RADEON_HD6600},
2085  {"HD 6570", CARD_AMD_RADEON_HD6600},
2086  {"HD 6500M", CARD_AMD_RADEON_HD6600M},
2087  {"HD 6500", CARD_AMD_RADEON_HD6600},
2088  {"HD 6480G", CARD_AMD_RADEON_HD6480G},
2089  {"HD 6400", CARD_AMD_RADEON_HD6400},
2090  {"HD 6300", CARD_AMD_RADEON_HD6300},
2091  {"HD 6200", CARD_AMD_RADEON_HD6300},
2092  /* Evergreen */
2093  {"HD 5870", CARD_AMD_RADEON_HD5800}, /* Radeon EG CYPRESS PRO */
2094  {"HD 5850", CARD_AMD_RADEON_HD5800}, /* Radeon EG CYPRESS XT */
2095  {"HD 5800", CARD_AMD_RADEON_HD5800}, /* Radeon EG CYPRESS HD58xx generic renderer string */
2096  {"HD 5770", CARD_AMD_RADEON_HD5700}, /* Radeon EG JUNIPER XT */
2097  {"HD 5750", CARD_AMD_RADEON_HD5700}, /* Radeon EG JUNIPER LE */
2098  {"HD 5700", CARD_AMD_RADEON_HD5700}, /* Radeon EG JUNIPER HD57xx generic renderer string */
2099  {"HD 5670", CARD_AMD_RADEON_HD5600}, /* Radeon EG REDWOOD XT */
2100  {"HD 5570", CARD_AMD_RADEON_HD5600}, /* Radeon EG REDWOOD PRO mapped to HD5600 series */
2101  {"HD 5550", CARD_AMD_RADEON_HD5600}, /* Radeon EG REDWOOD LE mapped to HD5600 series */
2102  {"HD 5450", CARD_AMD_RADEON_HD5400}, /* Radeon EG CEDAR PRO */
2103  {"HD 5000", CARD_AMD_RADEON_HD5600}, /* Defaulting to HD 5600 */
2104  /* R700 */
2105  {"HD 4890", CARD_AMD_RADEON_HD4800}, /* Radeon RV790 */
2106  {"HD 4870", CARD_AMD_RADEON_HD4800}, /* Radeon RV770 */
2107  {"HD 4850", CARD_AMD_RADEON_HD4800}, /* Radeon RV770 */
2108  {"HD 4830", CARD_AMD_RADEON_HD4800}, /* Radeon RV770 */
2109  {"HD 4800", CARD_AMD_RADEON_HD4800}, /* Radeon RV7xx HD48xx generic renderer string */
2110  {"HD 4770", CARD_AMD_RADEON_HD4700}, /* Radeon RV740 */
2111  {"HD 4700", CARD_AMD_RADEON_HD4700}, /* Radeon RV7xx HD47xx generic renderer string */
2112  {"HD 4670", CARD_AMD_RADEON_HD4600}, /* Radeon RV730 */
2113  {"HD 4650", CARD_AMD_RADEON_HD4600}, /* Radeon RV730 */
2114  {"HD 4600", CARD_AMD_RADEON_HD4600}, /* Radeon RV730 */
2115  {"HD 4550", CARD_AMD_RADEON_HD4350}, /* Radeon RV710 */
2116  {"HD 4350", CARD_AMD_RADEON_HD4350}, /* Radeon RV710 */
2117  /* R600/R700 integrated */
2118  {"HD 4200M", CARD_AMD_RADEON_HD4200M},
2119  {"HD 3300", CARD_AMD_RADEON_HD3200},
2120  {"HD 3200", CARD_AMD_RADEON_HD3200},
2121  {"HD 3100", CARD_AMD_RADEON_HD3200},
2122  /* R600 */
2123  {"HD 3870", CARD_AMD_RADEON_HD2900}, /* HD2900/HD3800 - highend */
2124  {"HD 3850", CARD_AMD_RADEON_HD2900}, /* HD2900/HD3800 - highend */
2125  {"HD 2900", CARD_AMD_RADEON_HD2900}, /* HD2900/HD3800 - highend */
2126  {"HD 3830", CARD_AMD_RADEON_HD2600}, /* China-only midend */
2127  {"HD 3690", CARD_AMD_RADEON_HD2600}, /* HD2600/HD3600 - midend */
2128  {"HD 3650", CARD_AMD_RADEON_HD2600}, /* HD2600/HD3600 - midend */
2129  {"HD 2600", CARD_AMD_RADEON_HD2600}, /* HD2600/HD3600 - midend */
2130  {"HD 3470", CARD_AMD_RADEON_HD2350}, /* HD2350/HD2400/HD3400 - lowend */
2131  {"HD 3450", CARD_AMD_RADEON_HD2350}, /* HD2350/HD2400/HD3400 - lowend */
2132  {"HD 3430", CARD_AMD_RADEON_HD2350}, /* HD2350/HD2400/HD3400 - lowend */
2133  {"HD 3400", CARD_AMD_RADEON_HD2350}, /* HD2350/HD2400/HD3400 - lowend */
2134  {"HD 2400", CARD_AMD_RADEON_HD2350}, /* HD2350/HD2400/HD3400 - lowend */
2135  {"HD 2350", CARD_AMD_RADEON_HD2350}, /* HD2350/HD2400/HD3400 - lowend */
2136  /* Radeon R5xx */
2137  {"X1950", CARD_AMD_RADEON_X1600},
2138  {"X1900", CARD_AMD_RADEON_X1600},
2139  {"X1800", CARD_AMD_RADEON_X1600},
2140  {"X1650", CARD_AMD_RADEON_X1600},
2141  {"X1600", CARD_AMD_RADEON_X1600},
2142  /* Radeon R4xx + X1300/X1400/X1450/X1550/X2300/X2500/HD2300 (lowend R5xx)
2143  * Note X2300/X2500/HD2300 are R5xx GPUs with a 2xxx naming but they are still DX9-only */
2144  {"HD 2300", CARD_AMD_RADEON_X700},
2145  {"X2500", CARD_AMD_RADEON_X700},
2146  {"X2300", CARD_AMD_RADEON_X700},
2147  {"X1550", CARD_AMD_RADEON_X700},
2148  {"X1450", CARD_AMD_RADEON_X700},
2149  {"X1400", CARD_AMD_RADEON_X700},
2150  {"X1300", CARD_AMD_RADEON_X700},
2151  {"X850", CARD_AMD_RADEON_X700},
2152  {"X800", CARD_AMD_RADEON_X700},
2153  {"X700", CARD_AMD_RADEON_X700},
2154  /* Radeon Xpress Series - onboard, DX9b, Shader 2.0, 300-400 MHz */
2155  {"Radeon Xpress", CARD_AMD_RADEON_XPRESS_200M},
2156 },
2157 cards_intel[] =
2158 {
2159  /* Skylake */
2160  {"Iris Pro Graphics P580", CARD_INTEL_IPP580_1},
2161  {"Skylake", CARD_INTEL_HD520_1},
2162  /* Broadwell */
2163  {"Iris Pro P6300", CARD_INTEL_IPP6300},
2164  {"Iris Pro 6200", CARD_INTEL_IP6200},
2165  {"Iris 6100", CARD_INTEL_I6100},
2166  {"Iris(TM) Graphics 6100", CARD_INTEL_I6100}, /* MacOS */
2167  /* Haswell */
2168  {"Iris Pro 5200", CARD_INTEL_IP5200_1},
2169  {"Iris 5100", CARD_INTEL_I5100_1},
2170  {"Haswell Mobile", CARD_INTEL_HWM},
2171  {"Iris OpenGL Engine", CARD_INTEL_HWM}, /* MacOS */
2172  /* Ivybridge */
2173  {"Ivybridge Server", CARD_INTEL_IVBS},
2174  {"Ivybridge Mobile", CARD_INTEL_IVBM},
2175  {"Ivybridge Desktop", CARD_INTEL_IVBD},
2176  {"HD Graphics 4000", CARD_INTEL_IVBD}, /* MacOS */
2177  /* Sandybridge */
2178  {"Sandybridge Server", CARD_INTEL_SNBS},
2179  {"Sandybridge Mobile", CARD_INTEL_SNBM},
2180  {"Sandybridge Desktop", CARD_INTEL_SNBD},
2181  /* Ironlake */
2182  {"Ironlake Mobile", CARD_INTEL_ILKM},
2183  {"Ironlake Desktop", CARD_INTEL_ILKD},
2184  /* G4x */
2185  {"B43", CARD_INTEL_B43},
2186  {"G41", CARD_INTEL_G41},
2187  {"G45", CARD_INTEL_G45},
2188  {"Q45", CARD_INTEL_Q45},
2189  {"Integrated Graphics Device", CARD_INTEL_IGD},
2190  {"GM45", CARD_INTEL_GM45},
2191  /* i965 */
2192  {"965GME", CARD_INTEL_965GME},
2193  {"965GM", CARD_INTEL_965GM},
2194  {"X3100", CARD_INTEL_965GM}, /* MacOS */
2195  {"946GZ", CARD_INTEL_946GZ},
2196  {"965G", CARD_INTEL_965G},
2197  {"965Q", CARD_INTEL_965Q},
2198  /* i945 */
2199  {"Pineview M", CARD_INTEL_PNVM},
2200  {"Pineview G", CARD_INTEL_PNVG},
2201  {"IGD", CARD_INTEL_PNVG},
2202  {"Q33", CARD_INTEL_Q33},
2203  {"G33", CARD_INTEL_G33},
2204  {"Q35", CARD_INTEL_Q35},
2205  {"945GME", CARD_INTEL_945GME},
2206  {"945GM", CARD_INTEL_945GM},
2207  {"GMA 950", CARD_INTEL_945GM}, /* MacOS */
2208  {"945G", CARD_INTEL_945G},
2209  /* i915 */
2210  {"915GM", CARD_INTEL_915GM},
2211  {"E7221G", CARD_INTEL_E7221G},
2212  {"915G", CARD_INTEL_915G},
2213  /* i8xx */
2214  {"865G", CARD_INTEL_865G},
2215  {"845G", CARD_INTEL_845G},
2216  {"855GM", CARD_INTEL_855GM},
2217  {"830M", CARD_INTEL_830M},
2218 },
2219 /* 20101109 - These are never returned by current Gallium radeon
2220  * drivers: R700, RV790, R680, RV535, RV516, R410, RS485, RV360, RV351.
2221  *
2222  * These are returned but not handled: RC410, RV380. */
2223 cards_amd_mesa[] =
2224 {
2225  /* Polaris 10/11 */
2226  {"POLARIS10", CARD_AMD_RADEON_RX_480},
2227  {"POLARIS11", CARD_AMD_RADEON_RX_460},
2228  /* Volcanic Islands */
2229  {"FIJI", CARD_AMD_RADEON_R9_FURY},
2230  {"TONGA", CARD_AMD_RADEON_R9_285},
2231  /* Sea Islands */
2232  {"HAWAII", CARD_AMD_RADEON_R9_290},
2233  {"KAVERI", CARD_AMD_RADEON_R7 },
2234  {"KABINI", CARD_AMD_RADEON_R3 },
2235  {"BONAIRE", CARD_AMD_RADEON_HD8770},
2236  /* Southern Islands */
2237  {"OLAND", CARD_AMD_RADEON_HD8670},
2238  {"HAINAN", CARD_AMD_RADEON_HD8600M},
2239  {"TAHITI", CARD_AMD_RADEON_HD7900},
2240  {"PITCAIRN", CARD_AMD_RADEON_HD7800},
2241  {"CAPE VERDE", CARD_AMD_RADEON_HD7700},
2242  /* Northern Islands */
2243  {"ARUBA", CARD_AMD_RADEON_HD7660D},
2244  {"CAYMAN", CARD_AMD_RADEON_HD6900},
2245  {"BARTS", CARD_AMD_RADEON_HD6800},
2246  {"TURKS", CARD_AMD_RADEON_HD6600},
2247  {"SUMO2", CARD_AMD_RADEON_HD6410D}, /* SUMO2 first, because we do a strstr(). */
2248  {"SUMO", CARD_AMD_RADEON_HD6550D},
2249  {"CAICOS", CARD_AMD_RADEON_HD6400},
2250  {"PALM", CARD_AMD_RADEON_HD6300},
2251  /* Evergreen */
2252  {"HEMLOCK", CARD_AMD_RADEON_HD5900},
2253  {"CYPRESS", CARD_AMD_RADEON_HD5800},
2254  {"JUNIPER", CARD_AMD_RADEON_HD5700},
2255  {"REDWOOD", CARD_AMD_RADEON_HD5600},
2256  {"CEDAR", CARD_AMD_RADEON_HD5400},
2257  /* R700 */
2258  {"R700", CARD_AMD_RADEON_HD4800},
2259  {"RV790", CARD_AMD_RADEON_HD4800},
2260  {"RV770", CARD_AMD_RADEON_HD4800},
2261  {"RV740", CARD_AMD_RADEON_HD4700},
2262  {"RV730", CARD_AMD_RADEON_HD4600},
2263  {"RV710", CARD_AMD_RADEON_HD4350},
2264  /* R600/R700 integrated */
2265  {"RS880", CARD_AMD_RADEON_HD4200M},
2266  {"RS780", CARD_AMD_RADEON_HD3200},
2267  /* R600 */
2268  {"R680", CARD_AMD_RADEON_HD2900},
2269  {"R600", CARD_AMD_RADEON_HD2900},
2270  {"RV670", CARD_AMD_RADEON_HD3850},
2271  {"RV635", CARD_AMD_RADEON_HD2600},
2272  {"RV630", CARD_AMD_RADEON_HD2600},
2273  {"RV620", CARD_AMD_RADEON_HD2350},
2274  {"RV610", CARD_AMD_RADEON_HD2350},
2275  /* R500 */
2276  {"R580", CARD_AMD_RADEON_X1600},
2277  {"R520", CARD_AMD_RADEON_X1600},
2278  {"RV570", CARD_AMD_RADEON_X1600},
2279  {"RV560", CARD_AMD_RADEON_X1600},
2280  {"RV535", CARD_AMD_RADEON_X1600},
2281  {"RV530", CARD_AMD_RADEON_X1600},
2282  {"RV516", CARD_AMD_RADEON_X700},
2283  {"RV515", CARD_AMD_RADEON_X700},
2284  /* R400 */
2285  {"R481", CARD_AMD_RADEON_X700},
2286  {"R480", CARD_AMD_RADEON_X700},
2287  {"R430", CARD_AMD_RADEON_X700},
2288  {"R423", CARD_AMD_RADEON_X700},
2289  {"R420", CARD_AMD_RADEON_X700},
2290  {"R410", CARD_AMD_RADEON_X700},
2291  {"RV410", CARD_AMD_RADEON_X700},
2292  /* Radeon Xpress - onboard, DX9b, Shader 2.0, 300-400 MHz */
2293  {"RS740", CARD_AMD_RADEON_XPRESS_200M},
2294  {"RS690", CARD_AMD_RADEON_XPRESS_200M},
2295  {"RS600", CARD_AMD_RADEON_XPRESS_200M},
2296  {"RS485", CARD_AMD_RADEON_XPRESS_200M},
2297  {"RS482", CARD_AMD_RADEON_XPRESS_200M},
2298  {"RS480", CARD_AMD_RADEON_XPRESS_200M},
2299  {"RS400", CARD_AMD_RADEON_XPRESS_200M},
2300  /* R300 */
2301  {"R360", CARD_AMD_RADEON_9500},
2302  {"R350", CARD_AMD_RADEON_9500},
2303  {"R300", CARD_AMD_RADEON_9500},
2304  {"RV370", CARD_AMD_RADEON_9500},
2305  {"RV360", CARD_AMD_RADEON_9500},
2306  {"RV351", CARD_AMD_RADEON_9500},
2307  {"RV350", CARD_AMD_RADEON_9500},
2308 },
2310 {
2311  /* Maxwell */
2312  {"NV124", CARD_NVIDIA_GEFORCE_GTX970},
2313  {"NV120", CARD_NVIDIA_GEFORCE_GTX980TI},
2314  {"NV118", CARD_NVIDIA_GEFORCE_840M},
2315  {"NV117", CARD_NVIDIA_GEFORCE_GTX750},
2316  /* Kepler */
2317  {"NV108", CARD_NVIDIA_GEFORCE_GT740M},
2318  {"NVF1", CARD_NVIDIA_GEFORCE_GTX780TI},
2319  {"NVF0", CARD_NVIDIA_GEFORCE_GTX780},
2320  {"NVE6", CARD_NVIDIA_GEFORCE_GTX770M},
2321  {"NVE4", CARD_NVIDIA_GEFORCE_GTX680}, /* 690 / 675MX / 760TI */
2322  /* Fermi */
2323  {"NVD9", CARD_NVIDIA_GEFORCE_GT520},
2324  {"NVD7", CARD_NVIDIA_GEFORCE_820M},
2325  {"NVCF", CARD_NVIDIA_GEFORCE_GTX550},
2326  {"NVCE", CARD_NVIDIA_GEFORCE_GTX560},
2327  {"NVC8", CARD_NVIDIA_GEFORCE_GTX570},
2328  {"NVC4", CARD_NVIDIA_GEFORCE_GTX460},
2329  {"NVC3", CARD_NVIDIA_GEFORCE_GT440},
2330  {"NVC1", CARD_NVIDIA_GEFORCE_GT420},
2331  {"NVC0", CARD_NVIDIA_GEFORCE_GTX480},
2332  /* Tesla */
2333  {"NVAF", CARD_NVIDIA_GEFORCE_GT320M},
2334  {"NVAC", CARD_NVIDIA_GEFORCE_8200},
2335  {"NVAA", CARD_NVIDIA_GEFORCE_8200}, /* 8100 */
2336  {"NVA8", CARD_NVIDIA_GEFORCE_210},
2337  {"NVA5", CARD_NVIDIA_GEFORCE_GT220},
2338  {"NVA3", CARD_NVIDIA_GEFORCE_GT240},
2339  {"NVA0", CARD_NVIDIA_GEFORCE_GTX280},
2340  {"NV98", CARD_NVIDIA_GEFORCE_9200},
2341  {"NV96", CARD_NVIDIA_GEFORCE_9400GT},
2342  {"NV94", CARD_NVIDIA_GEFORCE_9600GT},
2343  {"NV92", CARD_NVIDIA_GEFORCE_9800GT},
2344  {"NV86", CARD_NVIDIA_GEFORCE_8500GT},
2345  {"NV84", CARD_NVIDIA_GEFORCE_8600GT},
2346  {"NV50", CARD_NVIDIA_GEFORCE_8800GTX},
2347  /* Curie */
2348  {"NV68", CARD_NVIDIA_GEFORCE_6200}, /* 7050 */
2349  {"NV67", CARD_NVIDIA_GEFORCE_6200}, /* 7000M */
2350  {"NV63", CARD_NVIDIA_GEFORCE_6200}, /* 7100 */
2351  {"NV4E", CARD_NVIDIA_GEFORCE_6200}, /* 6100 Go / 6150 Go */
2352  {"NV4C", CARD_NVIDIA_GEFORCE_6200}, /* 6150SE */
2353  {"NV4B", CARD_NVIDIA_GEFORCE_7600},
2354  {"NV4A", CARD_NVIDIA_GEFORCE_6200},
2355  {"NV49", CARD_NVIDIA_GEFORCE_7800GT}, /* 7900 */
2356  {"NV47", CARD_NVIDIA_GEFORCE_7800GT},
2357  {"NV46", CARD_NVIDIA_GEFORCE_7400},
2358  {"NV45", CARD_NVIDIA_GEFORCE_6800},
2359  {"NV44", CARD_NVIDIA_GEFORCE_6200},
2360  {"NV43", CARD_NVIDIA_GEFORCE_6600GT},
2361  {"NV42", CARD_NVIDIA_GEFORCE_6800},
2362  {"NV41", CARD_NVIDIA_GEFORCE_6800},
2363  {"NV40", CARD_NVIDIA_GEFORCE_6800},
2364  /* Rankine */
2365  {"NV38", CARD_NVIDIA_GEFORCEFX_5800}, /* FX 5950 Ultra */
2366  {"NV36", CARD_NVIDIA_GEFORCEFX_5800}, /* FX 5700/5750 */
2367  {"NV35", CARD_NVIDIA_GEFORCEFX_5800}, /* FX 5900 */
2368  {"NV34", CARD_NVIDIA_GEFORCEFX_5200},
2369  {"NV31", CARD_NVIDIA_GEFORCEFX_5600},
2370  {"NV30", CARD_NVIDIA_GEFORCEFX_5800},
2371  /* Kelvin */
2372  {"nv28", CARD_NVIDIA_GEFORCE4_TI4200},
2373  {"nv25", CARD_NVIDIA_GEFORCE4_TI4200},
2374  {"nv20", CARD_NVIDIA_GEFORCE3},
2375  /* Celsius */
2376  {"nv1F", CARD_NVIDIA_GEFORCE4_MX}, /* GF4 MX IGP */
2377  {"nv1A", CARD_NVIDIA_GEFORCE2}, /* GF2 IGP */
2378  {"nv18", CARD_NVIDIA_GEFORCE4_MX},
2379  {"nv17", CARD_NVIDIA_GEFORCE4_MX},
2380  {"nv16", CARD_NVIDIA_GEFORCE2},
2381  {"nv15", CARD_NVIDIA_GEFORCE2},
2382  {"nv11", CARD_NVIDIA_GEFORCE2_MX},
2383  {"nv10", CARD_NVIDIA_GEFORCE},
2384  /* Fahrenheit */
2385  {"nv05", CARD_NVIDIA_RIVA_TNT2},
2386  {"nv04", CARD_NVIDIA_RIVA_TNT},
2387  {"nv03", CARD_NVIDIA_RIVA_128},
2388 },
2389 cards_vmware[] =
2390 {
2391  {"SVGA3D", CARD_VMWARE_SVGA3D},
2392 };
2393 
2394 static const struct gl_vendor_selection
2395 {
2397  const char *description; /* Description of the card selector i.e. Apple OS/X Intel */
2398  const struct wined3d_renderer_table *cards; /* To be used as cards[], pointer to the first member in an array */
2399  size_t cards_size; /* Number of entries in the array above */
2400 }
2402 {
2403  {GL_VENDOR_APPLE, "Apple OSX AMD/ATI binary driver", cards_amd_binary, ARRAY_SIZE(cards_amd_binary)},
2404  {GL_VENDOR_FGLRX, "AMD/ATI binary driver", cards_amd_binary, ARRAY_SIZE(cards_amd_binary)},
2405  {GL_VENDOR_MESA, "Mesa AMD/ATI driver", cards_amd_mesa, ARRAY_SIZE(cards_amd_mesa)},
2406 },
2408 {
2409  {GL_VENDOR_APPLE, "Apple OSX NVidia binary driver", cards_nvidia_binary, ARRAY_SIZE(cards_nvidia_binary)},
2410  {GL_VENDOR_MESA, "Mesa Nouveau driver", cards_nvidia_mesa, ARRAY_SIZE(cards_nvidia_mesa)},
2411  {GL_VENDOR_NVIDIA, "Nvidia binary driver", cards_nvidia_binary, ARRAY_SIZE(cards_nvidia_binary)},
2412 },
2414 {
2415  {GL_VENDOR_MESA, "VMware driver", cards_vmware, ARRAY_SIZE(cards_vmware)},
2416 },
2418 {
2419  {GL_VENDOR_APPLE, "Apple OSX Intel binary driver", cards_intel, ARRAY_SIZE(cards_intel)},
2420  {GL_VENDOR_MESA, "Mesa Intel driver", cards_intel, ARRAY_SIZE(cards_intel)},
2421 };
2422 
2423 static const enum wined3d_pci_device
2425 {
2426  CARD_NVIDIA_RIVA_128, /* D3D5 */
2427  CARD_NVIDIA_RIVA_TNT, /* D3D6 */
2428  CARD_NVIDIA_GEFORCE, /* D3D7 */
2429  CARD_NVIDIA_GEFORCE3, /* D3D8 */
2430  CARD_NVIDIA_GEFORCEFX_5800, /* D3D9_SM2 */
2431  CARD_NVIDIA_GEFORCE_6800, /* D3D9_SM3 */
2432  CARD_NVIDIA_GEFORCE_8800GTX, /* D3D10 */
2433  CARD_NVIDIA_GEFORCE_GTX470, /* D3D11 */
2434 },
2436 {
2437  CARD_AMD_RAGE_128PRO, /* D3D5 */
2438  CARD_AMD_RAGE_128PRO, /* D3D6 */
2439  CARD_AMD_RADEON_7200, /* D3D7 */
2440  CARD_AMD_RADEON_8500, /* D3D8 */
2441  CARD_AMD_RADEON_9500, /* D3D9_SM2 */
2442  CARD_AMD_RADEON_X1600, /* D3D9_SM3 */
2443  CARD_AMD_RADEON_HD2900, /* D3D10 */
2444  CARD_AMD_RADEON_HD5600, /* D3D11 */
2445 },
2447 {
2448  CARD_INTEL_845G, /* D3D5 */
2449  CARD_INTEL_845G, /* D3D6 */
2450  CARD_INTEL_845G, /* D3D7 */
2451  CARD_INTEL_915G, /* D3D8 */
2452  CARD_INTEL_915G, /* D3D9_SM2 */
2453  CARD_INTEL_945G, /* D3D9_SM3 */
2454  CARD_INTEL_G45, /* D3D10 */
2455  CARD_INTEL_IVBD, /* D3D11 */
2456 };
2460 
2462  unsigned int table_size, enum wined3d_gl_vendor gl_vendor, const char *gl_renderer)
2463 {
2464  unsigned int i, j;
2465 
2466  for (i = 0; i < table_size; ++i)
2467  {
2468  if (table[i].gl_vendor != gl_vendor)
2469  continue;
2470 
2471  TRACE("Applying card selector \"%s\".\n", table[i].description);
2472 
2473  for (j = 0; j < table[i].cards_size; ++j)
2474  {
2475  if (strstr(gl_renderer, table[i].cards[j].renderer))
2476  return table[i].cards[j].id;
2477  }
2478  return PCI_DEVICE_NONE;
2479  }
2480  FIXME("Couldn't find a suitable card selector for GL vendor %04x (using GL_RENDERER %s)\n",
2481  gl_vendor, debugstr_a(gl_renderer));
2482 
2483  return PCI_DEVICE_NONE;
2484 }
2485 
2486 static const struct
2487 {
2489  const char *description; /* Description of the card selector i.e. Apple OS/X Intel */
2491  unsigned int gl_vendor_count;
2492  const enum wined3d_pci_device *card_fallback; /* An array with D3D_LEVEL_COUNT elements */
2493 }
2495 {
2497  sizeof(amd_gl_vendor_table) / sizeof(*amd_gl_vendor_table),
2500  sizeof(nvidia_gl_vendor_table) / sizeof(*nvidia_gl_vendor_table),
2503  sizeof(vmware_gl_vendor_table) / sizeof(*vmware_gl_vendor_table),
2506  sizeof(intel_gl_vendor_table) / sizeof(*intel_gl_vendor_table),
2508 };
2509 
2510 
2512  DWORD glsl_version, const char *gl_renderer, enum wined3d_gl_vendor *gl_vendor, enum wined3d_pci_vendor *card_vendor)
2513 {
2514  /* A Direct3D device object contains the PCI id (vendor + device) of the
2515  * videocard which is used for rendering. Various applications use this
2516  * information to get a rough estimation of the features of the card and
2517  * some might use it for enabling 3d effects only on certain types of
2518  * videocards. In some cases games might even use it to work around bugs
2519  * which happen on certain videocards/driver combinations. The problem is
2520  * that OpenGL only exposes a rendering string containing the name of the
2521  * videocard and not the PCI id.
2522  *
2523  * Various games depend on the PCI id, so somehow we need to provide one.
2524  * A simple option is to parse the renderer string and translate this to
2525  * the right PCI id. This is a lot of work because there are more than 200
2526  * GPUs just for Nvidia. Various cards share the same renderer string, so
2527  * the amount of code might be 'small' but there are quite a number of
2528  * exceptions which would make this a pain to maintain. Another way would
2529  * be to query the PCI id from the operating system (assuming this is the
2530  * videocard which is used for rendering which is not always the case).
2531  * This would work but it is not very portable. Second it would not work
2532  * well in, let's say, a remote X situation in which the amount of 3d
2533  * features which can be used is limited.
2534  *
2535  * As said most games only use the PCI id to get an indication of the
2536  * capabilities of the card. It doesn't really matter if the given id is
2537  * the correct one if we return the id of a card with similar 3d features.
2538  *
2539  * The code below checks the OpenGL capabilities of a videocard and matches
2540  * that to a certain level of Direct3D functionality. Once a card passes
2541  * the Direct3D9 check, we know that the card (in case of Nvidia) is at
2542  * least a GeforceFX. To give a better estimate we do a basic check on the
2543  * renderer string but if that won't pass we return a default card. This
2544  * way is better than maintaining a full card database as even without a
2545  * full database we can return a card with similar features. Second the
2546  * size of the database can be made quite small because when you know what
2547  * type of 3d functionality a card has, you know to which GPU family the
2548  * GPU must belong. Because of this you only have to check a small part of
2549  * the renderer string to distinguish between different models from that
2550  * family.
2551  *
2552  * The code also selects a default amount of video memory which we will
2553  * use for an estimation of the amount of free texture memory. In case of
2554  * real D3D the amount of texture memory includes video memory and system
2555  * memory (to be specific AGP memory or in case of PCIE TurboCache /
2556  * HyperMemory). We don't know how much system memory can be addressed by
2557  * the system but we can make a reasonable estimation about the amount of
2558  * video memory. If the value is slightly wrong it doesn't matter as we
2559  * didn't include AGP-like memory which makes the amount of addressable
2560  * memory higher and second OpenGL isn't that critical it moves to system
2561  * memory behind our backs if really needed. Note that the amount of video
2562  * memory can be overruled using a registry setting. */
2563 
2564  unsigned int i;
2565  enum wined3d_d3d_level d3d_level = d3d_level_from_caps(shader_caps, fragment_caps, glsl_version);
2567 
2568  for (i = 0; i < (sizeof(card_vendor_table) / sizeof(*card_vendor_table)); ++i)
2569  {
2570  if (card_vendor_table[i].card_vendor != *card_vendor)
2571  continue;
2572 
2573  TRACE("Applying card selector \"%s\".\n", card_vendor_table[i].description);
2575  card_vendor_table[i].gl_vendor_count, *gl_vendor, gl_renderer);
2576  if (device != PCI_DEVICE_NONE)
2577  return device;
2578 
2579  TRACE("Unrecognized renderer %s, falling back to default.\n", debugstr_a(gl_renderer));
2580  return card_vendor_table[i].card_fallback[d3d_level];
2581  }
2582 
2583  FIXME("No card selector available for card vendor %04x (using GL_RENDERER %s).\n",
2584  *card_vendor, debugstr_a(gl_renderer));
2585 
2586  /* Default to generic Nvidia hardware based on the supported OpenGL extensions. */
2587  *card_vendor = HW_VENDOR_NVIDIA;
2588  return card_fallback_nvidia[d3d_level];
2589 }
2590 
2591 static const struct wined3d_vertex_pipe_ops *select_vertex_implementation(const struct wined3d_gl_info *gl_info,
2592  const struct wined3d_shader_backend_ops *shader_backend_ops)
2593 {
2594  if (shader_backend_ops == &glsl_shader_backend && gl_info->supported[ARB_VERTEX_SHADER])
2595  return &glsl_vertex_pipe;
2596  return &ffp_vertex_pipe;
2597 }
2598 
2599 static const struct fragment_pipeline *select_fragment_implementation(const struct wined3d_gl_info *gl_info,
2600  const struct wined3d_shader_backend_ops *shader_backend_ops)
2601 {
2602  if (shader_backend_ops == &glsl_shader_backend && gl_info->supported[ARB_FRAGMENT_SHADER])
2603  return &glsl_fragment_pipe;
2604  if (gl_info->supported[ARB_FRAGMENT_PROGRAM])
2605  return &arbfp_fragment_pipeline;
2606  if (gl_info->supported[ATI_FRAGMENT_SHADER])
2607  return &atifs_fragment_pipeline;
2608  if (gl_info->supported[NV_REGISTER_COMBINERS] && gl_info->supported[NV_TEXTURE_SHADER2])
2609  return &nvts_fragment_pipeline;
2610  if (gl_info->supported[NV_REGISTER_COMBINERS])
2611  return &nvrc_fragment_pipeline;
2612  return &ffp_fragment_pipeline;
2613 }
2614 
2615 static const struct wined3d_shader_backend_ops *select_shader_backend(const struct wined3d_gl_info *gl_info)
2616 {
2617  BOOL glsl = wined3d_settings.glslRequested && gl_info->glsl_version >= MAKEDWORD_VERSION(1, 20);
2618 
2619  if (glsl && gl_info->supported[ARB_VERTEX_SHADER] && gl_info->supported[ARB_FRAGMENT_SHADER])
2620  return &glsl_shader_backend;
2621  if (gl_info->supported[ARB_VERTEX_PROGRAM] && gl_info->supported[ARB_FRAGMENT_PROGRAM])
2623  if (glsl && (gl_info->supported[ARB_VERTEX_SHADER] || gl_info->supported[ARB_FRAGMENT_SHADER]))
2624  return &glsl_shader_backend;
2625  if (gl_info->supported[ARB_VERTEX_PROGRAM] || gl_info->supported[ARB_FRAGMENT_PROGRAM])
2627  return &none_shader_backend;
2628 }
2629 
2630 static void parse_extension_string(struct wined3d_gl_info *gl_info, const char *extensions,
2631  const struct wined3d_extension_map *map, UINT entry_count)
2632 {
2633  while (*extensions)
2634  {
2635  const char *start;
2636  size_t len;
2637  UINT i;
2638 
2639  while (isspace(*extensions))
2640  ++extensions;
2641  start = extensions;
2642  while (!isspace(*extensions) && *extensions)
2643  ++extensions;
2644 
2645  len = extensions - start;
2646  if (!len)
2647  continue;
2648 
2649  TRACE("- %s.\n", debugstr_an(start, len));
2650 
2651  for (i = 0; i < entry_count; ++i)
2652  {
2653  if (len == strlen(map[i].extension_string)
2654  && !memcmp(start, map[i].extension_string, len))
2655  {
2656  TRACE(" FOUND: %s support.\n", map[i].extension_string);
2657  gl_info->supported[map[i].extension] = TRUE;
2658  break;
2659  }
2660  }
2661  }
2662 }
2663 
2664 static void enumerate_gl_extensions(struct wined3d_gl_info *gl_info,
2665  const struct wined3d_extension_map *map, unsigned int map_entries_count)
2666 {
2667  const char *gl_extension_name;
2668  unsigned int i, j;
2669  GLint extensions_count;
2670 
2671  gl_info->gl_ops.gl.p_glGetIntegerv(GL_NUM_EXTENSIONS, &extensions_count);
2672  for (i = 0; i < extensions_count; ++i)
2673  {
2674  gl_extension_name = (const char *)GL_EXTCALL(glGetStringi(GL_EXTENSIONS, i));
2675  TRACE("- %s.\n", debugstr_a(gl_extension_name));
2676  for (j = 0; j < map_entries_count; ++j)
2677  {
2678  if (!strcmp(gl_extension_name, map[j].extension_string))
2679  {
2680  TRACE("FOUND: %s support.\n", map[j].extension_string);
2681  gl_info->supported[map[j].extension] = TRUE;
2682  break;
2683  }
2684  }
2685  }
2686 }
2687 
2688 static void load_gl_funcs(struct wined3d_gl_info *gl_info)
2689 {
2690 #define USE_GL_FUNC(pfn) gl_info->gl_ops.ext.p_##pfn = (void *)wglGetProcAddress(#pfn);
2691  /* GL_APPLE_fence */
2692  USE_GL_FUNC(glDeleteFencesAPPLE)
2693  USE_GL_FUNC(glFinishFenceAPPLE)
2694  USE_GL_FUNC(glFinishObjectAPPLE)
2695  USE_GL_FUNC(glGenFencesAPPLE)
2696  USE_GL_FUNC(glIsFenceAPPLE)
2697  USE_GL_FUNC(glSetFenceAPPLE)
2698  USE_GL_FUNC(glTestFenceAPPLE)
2699  USE_GL_FUNC(glTestObjectAPPLE)
2700  /* GL_APPLE_flush_buffer_range */
2701  USE_GL_FUNC(glBufferParameteriAPPLE)
2702  USE_GL_FUNC(glFlushMappedBufferRangeAPPLE)
2703  /* GL_ARB_base_instance */
2704  USE_GL_FUNC(glDrawArraysInstancedBaseInstance)
2705  USE_GL_FUNC(glDrawElementsInstancedBaseVertexBaseInstance)
2706  /* GL_ARB_blend_func_extended */
2707  USE_GL_FUNC(glBindFragDataLocationIndexed)
2708  USE_GL_FUNC(glGetFragDataIndex)
2709  /* GL_ARB_clear_buffer_object */
2710  USE_GL_FUNC(glClearBufferData)
2711  USE_GL_FUNC(glClearBufferSubData)
2712  /* GL_ARB_clear_texture */
2713  USE_GL_FUNC(glClearTexImage)
2714  USE_GL_FUNC(glClearTexSubImage)
2715  /* GL_ARB_clip_control */
2716  USE_GL_FUNC(glClipControl)
2717  /* GL_ARB_color_buffer_float */
2718  USE_GL_FUNC(glClampColorARB)
2719  /* GL_ARB_compute_shader */
2720  USE_GL_FUNC(glDispatchCompute)
2721  USE_GL_FUNC(glDispatchComputeIndirect)
2722  /* GL_ARB_copy_buffer */
2723  USE_GL_FUNC(glCopyBufferSubData)
2724  /* GL_ARB_copy_image */
2725  USE_GL_FUNC(glCopyImageSubData)
2726  /* GL_ARB_debug_output */
2727  USE_GL_FUNC(glDebugMessageCallbackARB)
2728  USE_GL_FUNC(glDebugMessageControlARB)
2729  USE_GL_FUNC(glDebugMessageInsertARB)
2730  USE_GL_FUNC(glGetDebugMessageLogARB)
2731  /* GL_ARB_draw_buffers */
2732  USE_GL_FUNC(glDrawBuffersARB)
2733  /* GL_ARB_draw_elements_base_vertex */
2734  USE_GL_FUNC(glDrawElementsBaseVertex)
2735  USE_GL_FUNC(glDrawElementsInstancedBaseVertex)
2736  USE_GL_FUNC(glDrawRangeElementsBaseVertex)
2737  USE_GL_FUNC(glMultiDrawElementsBaseVertex)
2738  /* GL_ARB_draw_indirect */
2739  USE_GL_FUNC(glDrawArraysIndirect)
2740  USE_GL_FUNC(glDrawElementsIndirect)
2741  /* GL_ARB_draw_instanced */
2742  USE_GL_FUNC(glDrawArraysInstancedARB)
2743  USE_GL_FUNC(glDrawElementsInstancedARB)
2744  /* GL_ARB_ES2_compatibility */
2745  USE_GL_FUNC(glReleaseShaderCompiler)
2746  USE_GL_FUNC(glShaderBinary)
2747  USE_GL_FUNC(glGetShaderPrecisionFormat)
2748  USE_GL_FUNC(glDepthRangef)
2749  USE_GL_FUNC(glClearDepthf)
2750  /* GL_ARB_framebuffer_object */
2751  USE_GL_FUNC(glBindFramebuffer)
2752  USE_GL_FUNC(glBindRenderbuffer)
2753  USE_GL_FUNC(glBlitFramebuffer)
2754  USE_GL_FUNC(glCheckFramebufferStatus)
2755  USE_GL_FUNC(glDeleteFramebuffers)
2756  USE_GL_FUNC(glDeleteRenderbuffers)
2757  USE_GL_FUNC(glFramebufferRenderbuffer)
2758  USE_GL_FUNC(glFramebufferTexture)
2759  USE_GL_FUNC(glFramebufferTexture1D)
2760  USE_GL_FUNC(glFramebufferTexture2D)
2761  USE_GL_FUNC(glFramebufferTexture3D)
2762  USE_GL_FUNC(glFramebufferTextureLayer)
2763  USE_GL_FUNC(glGenFramebuffers)
2764  USE_GL_FUNC(glGenRenderbuffers)
2765  USE_GL_FUNC(glGenerateMipmap)
2766  USE_GL_FUNC(glGetFramebufferAttachmentParameteriv)
2767  USE_GL_FUNC(glGetRenderbufferParameteriv)
2768  USE_GL_FUNC(glIsFramebuffer)
2769  USE_GL_FUNC(glIsRenderbuffer)
2770  USE_GL_FUNC(glRenderbufferStorage)
2771  USE_GL_FUNC(glRenderbufferStorageMultisample)
2772  /* GL_ARB_geometry_shader4 */
2773  USE_GL_FUNC(glFramebufferTextureARB)
2774  USE_GL_FUNC(glFramebufferTextureFaceARB)
2775  USE_GL_FUNC(glFramebufferTextureLayerARB)
2776  USE_GL_FUNC(glProgramParameteriARB)
2777  /* GL_ARB_instanced_arrays */
2778  USE_GL_FUNC(glVertexAttribDivisorARB)
2779  /* GL_ARB_internalformat_query */
2780  USE_GL_FUNC(glGetInternalformativ)
2781  /* GL_ARB_internalformat_query2 */
2782  USE_GL_FUNC(glGetInternalformati64v)
2783  /* GL_ARB_map_buffer_range */
2784  USE_GL_FUNC(glFlushMappedBufferRange)
2785  USE_GL_FUNC(glMapBufferRange)
2786  /* GL_ARB_multisample */
2787  USE_GL_FUNC(glSampleCoverageARB)
2788  /* GL_ARB_multitexture */
2801  /* GL_ARB_occlusion_query */
2802  USE_GL_FUNC(glBeginQueryARB)
2803  USE_GL_FUNC(glDeleteQueriesARB)
2804  USE_GL_FUNC(glEndQueryARB)
2805  USE_GL_FUNC(glGenQueriesARB)
2806  USE_GL_FUNC(glGetQueryivARB)
2807  USE_GL_FUNC(glGetQueryObjectivARB)
2808  USE_GL_FUNC(glGetQueryObjectuivARB)
2809  USE_GL_FUNC(glIsQueryARB)
2810  /* GL_ARB_point_parameters */
2811  USE_GL_FUNC(glPointParameterfARB)
2812  USE_GL_FUNC(glPointParameterfvARB)
2813  /* GL_ARB_provoking_vertex */
2814  USE_GL_FUNC(glProvokingVertex)
2815  /* GL_ARB_sampler_objects */
2816  USE_GL_FUNC(glGenSamplers)
2817  USE_GL_FUNC(glDeleteSamplers)
2818  USE_GL_FUNC(glIsSampler)
2819  USE_GL_FUNC(glBindSampler)
2820  USE_GL_FUNC(glSamplerParameteri)
2821  USE_GL_FUNC(glSamplerParameterf)
2822  USE_GL_FUNC(glSamplerParameteriv)
2823  USE_GL_FUNC(glSamplerParameterfv)
2824  USE_GL_FUNC(glSamplerParameterIiv)
2825  USE_GL_FUNC(glSamplerParameterIuiv)
2826  USE_GL_FUNC(glGetSamplerParameteriv)
2827  USE_GL_FUNC(glGetSamplerParameterfv)
2828  USE_GL_FUNC(glGetSamplerParameterIiv)
2829  USE_GL_FUNC(glGetSamplerParameterIuiv)
2830  /* GL_ARB_shader_atomic_counters */
2831  USE_GL_FUNC(glGetActiveAtomicCounterBufferiv)
2832  /* GL_ARB_shader_image_load_store */
2833  USE_GL_FUNC(glBindImageTexture)
2834  USE_GL_FUNC(glMemoryBarrier)
2835  /* GL_ARB_shader_objects */
2836  USE_GL_FUNC(glAttachObjectARB)
2837  USE_GL_FUNC(glBindAttribLocationARB)
2838  USE_GL_FUNC(glCompileShaderARB)
2839  USE_GL_FUNC(glCreateProgramObjectARB)
2840  USE_GL_FUNC(glCreateShaderObjectARB)
2841  USE_GL_FUNC(glDeleteObjectARB)
2842  USE_GL_FUNC(glDetachObjectARB)
2843  USE_GL_FUNC(glGetActiveUniformARB)
2844  USE_GL_FUNC(glGetAttachedObjectsARB)
2845  USE_GL_FUNC(glGetAttribLocationARB)
2846  USE_GL_FUNC(glGetHandleARB)
2847  USE_GL_FUNC(glGetInfoLogARB)
2848  USE_GL_FUNC(glGetObjectParameterfvARB)
2849  USE_GL_FUNC(glGetObjectParameterivARB)
2850  USE_GL_FUNC(glGetShaderSourceARB)
2851  USE_GL_FUNC(glGetUniformLocationARB)
2852  USE_GL_FUNC(glGetUniformfvARB)
2853  USE_GL_FUNC(glGetUniformivARB)
2854  USE_GL_FUNC(glLinkProgramARB)
2855  USE_GL_FUNC(glShaderSourceARB)
2856  USE_GL_FUNC(glUniform1fARB)
2857  USE_GL_FUNC(glUniform1fvARB)
2858  USE_GL_FUNC(glUniform1iARB)
2859  USE_GL_FUNC(glUniform1ivARB)
2860  USE_GL_FUNC(glUniform2fARB)
2861  USE_GL_FUNC(glUniform2fvARB)
2862  USE_GL_FUNC(glUniform2iARB)
2863  USE_GL_FUNC(glUniform2ivARB)
2864  USE_GL_FUNC(glUniform3fARB)
2865  USE_GL_FUNC(glUniform3fvARB)
2866  USE_GL_FUNC(glUniform3iARB)
2867  USE_GL_FUNC(glUniform3ivARB)
2868  USE_GL_FUNC(glUniform4fARB)
2869  USE_GL_FUNC(glUniform4fvARB)
2870  USE_GL_FUNC(glUniform4iARB)
2871  USE_GL_FUNC(glUniform4ivARB)
2872  USE_GL_FUNC(glUniformMatrix2fvARB)
2873  USE_GL_FUNC(glUniformMatrix3fvARB)
2874  USE_GL_FUNC(glUniformMatrix4fvARB)
2875  USE_GL_FUNC(glUseProgramObjectARB)
2876  USE_GL_FUNC(glValidateProgramARB)
2877  /* GL_ARB_shader_storage_buffer_object */
2878  USE_GL_FUNC(glShaderStorageBlockBinding)
2879  /* GL_ARB_sync */
2880  USE_GL_FUNC(glClientWaitSync)
2881  USE_GL_FUNC(glDeleteSync)
2882  USE_GL_FUNC(glFenceSync)
2883  USE_GL_FUNC(glGetInteger64v)
2884  USE_GL_FUNC(glGetSynciv)
2885  USE_GL_FUNC(glIsSync)
2886  USE_GL_FUNC(glWaitSync)
2887  /* GL_ARB_tessellation_shader */
2888  USE_GL_FUNC(glPatchParameteri)
2889  USE_GL_FUNC(glPatchParameterfv)
2890  /* GL_ARB_texture_buffer_object */
2891  USE_GL_FUNC(glTexBufferARB)
2892  /* GL_ARB_texture_buffer_range */
2893  USE_GL_FUNC(glTexBufferRange)
2894  /* GL_ARB_texture_compression */
2895  USE_GL_FUNC(glCompressedTexImage2DARB)
2896  USE_GL_FUNC(glCompressedTexImage3DARB)
2897  USE_GL_FUNC(glCompressedTexSubImage2DARB)
2898  USE_GL_FUNC(glCompressedTexSubImage3DARB)
2899  USE_GL_FUNC(glGetCompressedTexImageARB)
2900  /* GL_ARB_texture_storage */
2901  USE_GL_FUNC(glTexStorage1D)
2902  USE_GL_FUNC(glTexStorage2D)
2903  USE_GL_FUNC(glTexStorage3D)
2904  /* GL_ARB_texture_view */
2905  USE_GL_FUNC(glTextureView)
2906  /* GL_ARB_timer_query */
2907  USE_GL_FUNC(glQueryCounter)
2908  USE_GL_FUNC(glGetQueryObjectui64v)
2909  /* GL_ARB_transform_feedback2 */
2910  USE_GL_FUNC(glBindTransformFeedback);
2911  USE_GL_FUNC(glDeleteTransformFeedbacks);
2912  USE_GL_FUNC(glDrawTransformFeedback);
2913  USE_GL_FUNC(glGenTransformFeedbacks);
2914  USE_GL_FUNC(glIsTransformFeedback);
2915  USE_GL_FUNC(glPauseTransformFeedback);
2916  USE_GL_FUNC(glResumeTransformFeedback);
2917  /* GL_ARB_transform_feedback3 */
2918  USE_GL_FUNC(glBeginQueryIndexed);
2919  USE_GL_FUNC(glDrawTransformFeedbackStream);
2920  USE_GL_FUNC(glEndQueryIndexed);
2921  USE_GL_FUNC(glGetQueryIndexediv);
2922  /* GL_ARB_uniform_buffer_object */
2923  USE_GL_FUNC(glBindBufferBase)
2924  USE_GL_FUNC(glBindBufferRange)
2925  USE_GL_FUNC(glGetActiveUniformBlockName)
2926  USE_GL_FUNC(glGetActiveUniformBlockiv)
2927  USE_GL_FUNC(glGetActiveUniformName)
2928  USE_GL_FUNC(glGetActiveUniformsiv)
2929  USE_GL_FUNC(glGetIntegeri_v)
2930  USE_GL_FUNC(glGetUniformBlockIndex)
2931  USE_GL_FUNC(glGetUniformIndices)
2932  USE_GL_FUNC(glUniformBlockBinding)
2933  /* GL_ARB_vertex_blend */
2934  USE_GL_FUNC(glVertexBlendARB)
2935  USE_GL_FUNC(glWeightPointerARB)
2936  USE_GL_FUNC(glWeightbvARB)
2937  USE_GL_FUNC(glWeightdvARB)
2938  USE_GL_FUNC(glWeightfvARB)
2939  USE_GL_FUNC(glWeightivARB)
2940  USE_GL_FUNC(glWeightsvARB)
2941  USE_GL_FUNC(glWeightubvARB)
2942  USE_GL_FUNC(glWeightuivARB)
2943  USE_GL_FUNC(glWeightusvARB)
2944  /* GL_ARB_vertex_buffer_object */
2945  USE_GL_FUNC(glBindBufferARB)
2946  USE_GL_FUNC(glBufferDataARB)
2947  USE_GL_FUNC(glBufferSubDataARB)
2948  USE_GL_FUNC(glDeleteBuffersARB)
2949  USE_GL_FUNC(glGenBuffersARB)
2950  USE_GL_FUNC(glGetBufferParameterivARB)
2951  USE_GL_FUNC(glGetBufferPointervARB)
2952  USE_GL_FUNC(glGetBufferSubDataARB)
2953  USE_GL_FUNC(glIsBufferARB)
2954  USE_GL_FUNC(glMapBufferARB)
2955  USE_GL_FUNC(glUnmapBufferARB)
2956  /* GL_ARB_vertex_program */
2957  USE_GL_FUNC(glBindProgramARB)
2958  USE_GL_FUNC(glDeleteProgramsARB)
2959  USE_GL_FUNC(glDisableVertexAttribArrayARB)
2960  USE_GL_FUNC(glEnableVertexAttribArrayARB)
2961  USE_GL_FUNC(glGenProgramsARB)
2962  USE_GL_FUNC(glGetProgramivARB)
2963  USE_GL_FUNC(glProgramEnvParameter4fvARB)
2964  USE_GL_FUNC(glProgramLocalParameter4fvARB)
2965  USE_GL_FUNC(glProgramStringARB)
2966  USE_GL_FUNC(glVertexAttrib1dARB)
2967  USE_GL_FUNC(glVertexAttrib1dvARB)
2968  USE_GL_FUNC(glVertexAttrib1fARB)
2969  USE_GL_FUNC(glVertexAttrib1fvARB)
2970  USE_GL_FUNC(glVertexAttrib1sARB)
2971  USE_GL_FUNC(glVertexAttrib1svARB)
2972  USE_GL_FUNC(glVertexAttrib2dARB)
2973  USE_GL_FUNC(glVertexAttrib2dvARB)
2974  USE_GL_FUNC(glVertexAttrib2fARB)
2975  USE_GL_FUNC(glVertexAttrib2fvARB)
2976  USE_GL_FUNC(glVertexAttrib2sARB)
2977  USE_GL_FUNC(glVertexAttrib2svARB)
2978  USE_GL_FUNC(glVertexAttrib3dARB)
2979  USE_GL_FUNC(glVertexAttrib3dvARB)
2980  USE_GL_FUNC(glVertexAttrib3fARB)
2981  USE_GL_FUNC(glVertexAttrib3fvARB)
2982  USE_GL_FUNC(glVertexAttrib3sARB)
2983  USE_GL_FUNC(glVertexAttrib3svARB)
2984  USE_GL_FUNC(glVertexAttrib4NbvARB)
2985  USE_GL_FUNC(glVertexAttrib4NivARB)
2986  USE_GL_FUNC(glVertexAttrib4NsvARB)
2987  USE_GL_FUNC(glVertexAttrib4NubARB)
2988  USE_GL_FUNC(glVertexAttrib4NubvARB)
2989  USE_GL_FUNC(glVertexAttrib4NuivARB)
2990  USE_GL_FUNC(glVertexAttrib4NusvARB)
2991  USE_GL_FUNC(glVertexAttrib4bvARB)
2992  USE_GL_FUNC(glVertexAttrib4dARB)
2993  USE_GL_FUNC(glVertexAttrib4dvARB)
2994  USE_GL_FUNC(glVertexAttrib4fARB)
2995  USE_GL_FUNC(glVertexAttrib4fvARB)
2996  USE_GL_FUNC(glVertexAttrib4ivARB)
2997  USE_GL_FUNC(glVertexAttrib4sARB)
2998  USE_GL_FUNC(glVertexAttrib4svARB)
2999  USE_GL_FUNC(glVertexAttrib4ubvARB)
3000  USE_GL_FUNC(glVertexAttrib4uivARB)
3001  USE_GL_FUNC(glVertexAttrib4usvARB)
3002  USE_GL_FUNC(glVertexAttribPointerARB)
3003  /* GL_ARB_viewport_array */
3004  USE_GL_FUNC(glDepthRangeArrayv)
3005  USE_GL_FUNC(glDepthRangeIndexed)
3006  USE_GL_FUNC(glGetDoublei_v)
3007  USE_GL_FUNC(glGetFloati_v)
3008  USE_GL_FUNC(glScissorArrayv)
3009  USE_GL_FUNC(glScissorIndexed)
3010  USE_GL_FUNC(glScissorIndexedv)
3011  USE_GL_FUNC(glViewportArrayv)
3012  USE_GL_FUNC(glViewportIndexedf)
3013  USE_GL_FUNC(glViewportIndexedfv)
3014  /* GL_ATI_fragment_shader */
3015  USE_GL_FUNC(glAlphaFragmentOp1ATI)
3016  USE_GL_FUNC(glAlphaFragmentOp2ATI)
3017  USE_GL_FUNC(glAlphaFragmentOp3ATI)
3018  USE_GL_FUNC(glBeginFragmentShaderATI)
3019  USE_GL_FUNC(glBindFragmentShaderATI)
3020  USE_GL_FUNC(glColorFragmentOp1ATI)
3021  USE_GL_FUNC(glColorFragmentOp2ATI)
3022  USE_GL_FUNC(glColorFragmentOp3ATI)
3023  USE_GL_FUNC(glDeleteFragmentShaderATI)
3024  USE_GL_FUNC(glEndFragmentShaderATI)
3025  USE_GL_FUNC(glGenFragmentShadersATI)
3026  USE_GL_FUNC(glPassTexCoordATI)
3027  USE_GL_FUNC(glSampleMapATI)
3028  USE_GL_FUNC(glSetFragmentShaderConstantATI)
3029  /* GL_ATI_separate_stencil */
3030  USE_GL_FUNC(glStencilOpSeparateATI)
3031  USE_GL_FUNC(glStencilFuncSeparateATI)
3032  /* GL_EXT_blend_color */
3033  USE_GL_FUNC(glBlendColorEXT)
3034  /* GL_EXT_blend_equation_separate */
3035  USE_GL_FUNC(glBlendFuncSeparateEXT)
3036  /* GL_EXT_blend_func_separate */
3037  USE_GL_FUNC(glBlendEquationSeparateEXT)
3038  /* GL_EXT_blend_minmax */
3039  USE_GL_FUNC(glBlendEquationEXT)
3040  /* GL_EXT_depth_bounds_test */
3041  USE_GL_FUNC(glDepthBoundsEXT)
3042  /* GL_EXT_draw_buffers2 */
3043  USE_GL_FUNC(glColorMaskIndexedEXT)
3044  USE_GL_FUNC(glDisableIndexedEXT)
3045  USE_GL_FUNC(glEnableIndexedEXT)
3046  USE_GL_FUNC(glGetBooleanIndexedvEXT)
3047  USE_GL_FUNC(glGetIntegerIndexedvEXT)
3048  USE_GL_FUNC(glIsEnabledIndexedEXT)
3049  /* GL_EXT_fog_coord */
3050  USE_GL_FUNC(glFogCoordPointerEXT)
3051  USE_GL_FUNC(glFogCoorddEXT)
3052  USE_GL_FUNC(glFogCoorddvEXT)
3053  USE_GL_FUNC(glFogCoordfEXT)
3054  USE_GL_FUNC(glFogCoordfvEXT)
3055  /* GL_EXT_framebuffer_blit */
3056  USE_GL_FUNC(glBlitFramebufferEXT)
3057  /* GL_EXT_framebuffer_multisample */
3058  USE_GL_FUNC(glRenderbufferStorageMultisampleEXT)
3059  /* GL_EXT_framebuffer_object */
3060  USE_GL_FUNC(glBindFramebufferEXT)
3061  USE_GL_FUNC(glBindRenderbufferEXT)
3062  USE_GL_FUNC(glCheckFramebufferStatusEXT)
3063  USE_GL_FUNC(glDeleteFramebuffersEXT)
3064  USE_GL_FUNC(glDeleteRenderbuffersEXT)
3065  USE_GL_FUNC(glFramebufferRenderbufferEXT)
3066  USE_GL_FUNC(glFramebufferTexture1DEXT)
3067  USE_GL_FUNC(glFramebufferTexture2DEXT)
3068  USE_GL_FUNC(glFramebufferTexture3DEXT)
3069  USE_GL_FUNC(glGenFramebuffersEXT)
3070  USE_GL_FUNC(glGenRenderbuffersEXT)
3071  USE_GL_FUNC(glGenerateMipmapEXT)
3072  USE_GL_FUNC(glGetFramebufferAttachmentParameterivEXT)
3073  USE_GL_FUNC(glGetRenderbufferParameterivEXT)
3074  USE_GL_FUNC(glIsFramebufferEXT)
3075  USE_GL_FUNC(glIsRenderbufferEXT)
3076  USE_GL_FUNC(glRenderbufferStorageEXT)
3077  /* GL_EXT_gpu_program_parameters */
3078  USE_GL_FUNC(glProgramEnvParameters4fvEXT)
3079  USE_GL_FUNC(glProgramLocalParameters4fvEXT)
3080  /* GL_EXT_gpu_shader4 */
3081  USE_GL_FUNC(glBindFragDataLocationEXT)
3082  USE_GL_FUNC(glGetFragDataLocationEXT)
3083  USE_GL_FUNC(glGetUniformuivEXT)
3084  USE_GL_FUNC(glGetVertexAttribIivEXT)
3085  USE_GL_FUNC(glGetVertexAttribIuivEXT)
3086  USE_GL_FUNC(glUniform1uiEXT)
3087  USE_GL_FUNC(glUniform1uivEXT)
3088  USE_GL_FUNC(glUniform2uiEXT)
3089  USE_GL_FUNC(glUniform2uivEXT)
3090  USE_GL_FUNC(glUniform3uiEXT)
3091  USE_GL_FUNC(glUniform3uivEXT)
3092  USE_GL_FUNC(glUniform4uiEXT)
3093  USE_GL_FUNC(glUniform4uivEXT)
3094  USE_GL_FUNC(glVertexAttribI1iEXT)
3095  USE_GL_FUNC(glVertexAttribI1ivEXT)
3096  USE_GL_FUNC(glVertexAttribI1uiEXT)
3097  USE_GL_FUNC(glVertexAttribI1uivEXT)
3098  USE_GL_FUNC(glVertexAttribI2iEXT)
3099  USE_GL_FUNC(glVertexAttribI2ivEXT)
3100  USE_GL_FUNC(glVertexAttribI2uiEXT)
3101  USE_GL_FUNC(glVertexAttribI2uivEXT)
3102  USE_GL_FUNC(glVertexAttribI3iEXT)
3103  USE_GL_FUNC(glVertexAttribI3ivEXT)
3104  USE_GL_FUNC(glVertexAttribI3uiEXT)
3105  USE_GL_FUNC(glVertexAttribI3uivEXT)
3106  USE_GL_FUNC(glVertexAttribI4bvEXT)
3107  USE_GL_FUNC(glVertexAttribI4iEXT)
3108  USE_GL_FUNC(glVertexAttribI4ivEXT)
3109  USE_GL_FUNC(glVertexAttribI4svEXT)
3110  USE_GL_FUNC(glVertexAttribI4ubvEXT)
3111  USE_GL_FUNC(glVertexAttribI4uiEXT)
3112  USE_GL_FUNC(glVertexAttribI4uivEXT)
3113  USE_GL_FUNC(glVertexAttribI4usvEXT)
3114  USE_GL_FUNC(glVertexAttribIPointerEXT)
3115  /* GL_EXT_point_parameters */
3116  USE_GL_FUNC(glPointParameterfEXT)
3117  USE_GL_FUNC(glPointParameterfvEXT)
3118  /* GL_EXT_provoking_vertex */
3119  USE_GL_FUNC(glProvokingVertexEXT)
3120  /* GL_EXT_secondary_color */
3121  USE_GL_FUNC(glSecondaryColor3fEXT)
3122  USE_GL_FUNC(glSecondaryColor3fvEXT)
3123  USE_GL_FUNC(glSecondaryColor3ubEXT)
3124  USE_GL_FUNC(glSecondaryColor3ubvEXT)
3125  USE_GL_FUNC(glSecondaryColorPointerEXT)
3126  /* GL_EXT_stencil_two_side */
3127  USE_GL_FUNC(glActiveStencilFaceEXT)
3128  /* GL_EXT_texture3D */
3130  USE_GL_FUNC(glTexImage3DEXT)
3132  USE_GL_FUNC(glTexSubImage3DEXT)
3133  /* GL_NV_fence */
3134  USE_GL_FUNC(glDeleteFencesNV)
3135  USE_GL_FUNC(glFinishFenceNV)
3136  USE_GL_FUNC(glGenFencesNV)
3137  USE_GL_FUNC(glGetFenceivNV)
3138  USE_GL_FUNC(glIsFenceNV)
3139  USE_GL_FUNC(glSetFenceNV)
3140  USE_GL_FUNC(glTestFenceNV)
3141  /* GL_NV_half_float */
3142  USE_GL_FUNC(glColor3hNV)
3143  USE_GL_FUNC(glColor3hvNV)
3144  USE_GL_FUNC(glColor4hNV)
3145  USE_GL_FUNC(glColor4hvNV)
3146  USE_GL_FUNC(glFogCoordhNV)
3147  USE_GL_FUNC(glFogCoordhvNV)
3148  USE_GL_FUNC(glMultiTexCoord1hNV)
3149  USE_GL_FUNC(glMultiTexCoord1hvNV)
3150  USE_GL_FUNC(glMultiTexCoord2hNV)
3151  USE_GL_FUNC(glMultiTexCoord2hvNV)
3152  USE_GL_FUNC(glMultiTexCoord3hNV)
3153  USE_GL_FUNC(glMultiTexCoord3hvNV)
3154  USE_GL_FUNC(glMultiTexCoord4hNV)
3155  USE_GL_FUNC(glMultiTexCoord4hvNV)
3156  USE_GL_FUNC(glNormal3hNV)
3157  USE_GL_FUNC(glNormal3hvNV)
3158  USE_GL_FUNC(glSecondaryColor3hNV)
3159  USE_GL_FUNC(glSecondaryColor3hvNV)
3160  USE_GL_FUNC(glTexCoord1hNV)
3161  USE_GL_FUNC(glTexCoord1hvNV)
3162  USE_GL_FUNC(glTexCoord2hNV)
3163  USE_GL_FUNC(glTexCoord2hvNV)
3164  USE_GL_FUNC(glTexCoord3hNV)
3165  USE_GL_FUNC(glTexCoord3hvNV)
3166  USE_GL_FUNC(glTexCoord4hNV)
3167  USE_GL_FUNC(glTexCoord4hvNV)
3168  USE_GL_FUNC(glVertex2hNV)
3169  USE_GL_FUNC(glVertex2hvNV)
3170  USE_GL_FUNC(glVertex3hNV)
3171  USE_GL_FUNC(glVertex3hvNV)
3172  USE_GL_FUNC(glVertex4hNV)
3173  USE_GL_FUNC(glVertex4hvNV)
3174  USE_GL_FUNC(glVertexAttrib1hNV)
3175  USE_GL_FUNC(glVertexAttrib1hvNV)
3176  USE_GL_FUNC(glVertexAttrib2hNV)
3177  USE_GL_FUNC(glVertexAttrib2hvNV)
3178  USE_GL_FUNC(glVertexAttrib3hNV)
3179  USE_GL_FUNC(glVertexAttrib3hvNV)
3180  USE_GL_FUNC(glVertexAttrib4hNV)
3181  USE_GL_FUNC(glVertexAttrib4hvNV)
3182  USE_GL_FUNC(glVertexAttribs1hvNV)
3183  USE_GL_FUNC(glVertexAttribs2hvNV)
3184  USE_GL_FUNC(glVertexAttribs3hvNV)
3185  USE_GL_FUNC(glVertexAttribs4hvNV)
3186  USE_GL_FUNC(glVertexWeighthNV)
3187  USE_GL_FUNC(glVertexWeighthvNV)
3188  /* GL_NV_point_sprite */
3189  USE_GL_FUNC(glPointParameteriNV)
3190  USE_GL_FUNC(glPointParameterivNV)
3191  /* GL_NV_register_combiners */
3192  USE_GL_FUNC(glCombinerInputNV)
3193  USE_GL_FUNC(glCombinerOutputNV)
3194  USE_GL_FUNC(glCombinerParameterfNV)
3195  USE_GL_FUNC(glCombinerParameterfvNV)
3196  USE_GL_FUNC(glCombinerParameteriNV)
3197  USE_GL_FUNC(glCombinerParameterivNV)
3198  USE_GL_FUNC(glFinalCombinerInputNV)
3199  /* WGL extensions */
3200  USE_GL_FUNC(wglChoosePixelFormatARB)
3201  USE_GL_FUNC(wglGetExtensionsStringARB)
3202  USE_GL_FUNC(wglGetPixelFormatAttribfvARB)
3203  USE_GL_FUNC(wglGetPixelFormatAttribivARB)
3204  USE_GL_FUNC(wglQueryCurrentRendererIntegerWINE)
3205  USE_GL_FUNC(wglQueryCurrentRendererStringWINE)
3206  USE_GL_FUNC(wglQueryRendererIntegerWINE)
3207  USE_GL_FUNC(wglQueryRendererStringWINE)
3208  USE_GL_FUNC(wglSetPixelFormatWINE)
3209  USE_GL_FUNC(wglSwapIntervalEXT)
3210 
3211  /* Newer core functions */
3212  USE_GL_FUNC(glActiveTexture) /* OpenGL 1.3 */
3213  USE_GL_FUNC(glAttachShader) /* OpenGL 2.0 */
3214  USE_GL_FUNC(glBeginQuery) /* OpenGL 1.5 */
3215  USE_GL_FUNC(glBeginTransformFeedback) /* OpenGL 3.0 */
3216  USE_GL_FUNC(glBindAttribLocation) /* OpenGL 2.0 */
3217  USE_GL_FUNC(glBindBuffer) /* OpenGL 1.5 */
3218  USE_GL_FUNC(glBindFragDataLocation) /* OpenGL 3.0 */
3219  USE_GL_FUNC(glBindVertexArray) /* OpenGL 3.0 */
3220  USE_GL_FUNC(glBlendColor) /* OpenGL 1.4 */
3221  USE_GL_FUNC(glBlendEquation) /* OpenGL 1.4 */
3222  USE_GL_FUNC(glBlendEquationSeparate) /* OpenGL 2.0 */
3223  USE_GL_FUNC(glBlendFuncSeparate) /* OpenGL 1.4 */
3224  USE_GL_FUNC(glBufferData) /* OpenGL 1.5 */
3225  USE_GL_FUNC(glBufferSubData) /* OpenGL 1.5 */
3226  USE_GL_FUNC(glColorMaski) /* OpenGL 3.0 */
3227  USE_GL_FUNC(glCompileShader) /* OpenGL 2.0 */
3228  USE_GL_FUNC(glCompressedTexImage2D) /* OpenGL 1.3 */
3229  USE_GL_FUNC(glCompressedTexImage3D) /* OpenGL 1.3 */
3230  USE_GL_FUNC(glCompressedTexSubImage2D) /* OpenGL 1.3 */
3231  USE_GL_FUNC(glCompressedTexSubImage3D) /* OpenGL 1.3 */
3232  USE_GL_FUNC(glCreateProgram) /* OpenGL 2.0 */
3233  USE_GL_FUNC(glCreateShader) /* OpenGL 2.0 */
3234  USE_GL_FUNC(glDebugMessageCallback) /* OpenGL 4.3 */
3235  USE_GL_FUNC(glDebugMessageControl) /* OpenGL 4.3 */
3236  USE_GL_FUNC(glDebugMessageInsert) /* OpenGL 4.3 */
3237  USE_GL_FUNC(glDeleteBuffers) /* OpenGL 1.5 */
3238  USE_GL_FUNC(glDeleteProgram) /* OpenGL 2.0 */
3239  USE_GL_FUNC(glDeleteQueries) /* OpenGL 1.5 */
3240  USE_GL_FUNC(glDeleteShader) /* OpenGL 2.0 */
3241  USE_GL_FUNC(glDeleteVertexArrays) /* OpenGL 3.0 */
3242  USE_GL_FUNC(glDetachShader) /* OpenGL 2.0 */
3243  USE_GL_FUNC(glDisablei) /* OpenGL 3.0 */
3244  USE_GL_FUNC(glDisableVertexAttribArray) /* OpenGL 2.0 */
3245  USE_GL_FUNC(glDrawArraysInstanced) /* OpenGL 3.1 */
3246  USE_GL_FUNC(glDrawBuffers) /* OpenGL 2.0 */
3247  USE_GL_FUNC(glDrawElementsInstanced) /* OpenGL 3.1 */
3248  USE_GL_FUNC(glEnablei) /* OpenGL 3.0 */
3249  USE_GL_FUNC(glEnableVertexAttribArray) /* OpenGL 2.0 */
3250  USE_GL_FUNC(glEndQuery) /* OpenGL 1.5 */
3251  USE_GL_FUNC(glEndTransformFeedback) /* OpenGL 3.0 */
3252  USE_GL_FUNC(glFramebufferTexture) /* OpenGL 3.2 */
3253  USE_GL_FUNC(glGenBuffers) /* OpenGL 1.5 */
3254  USE_GL_FUNC(glGenQueries) /* OpenGL 1.5 */
3255  USE_GL_FUNC(glGenVertexArrays) /* OpenGL 3.0 */
3256  USE_GL_FUNC(glGetActiveUniform) /* OpenGL 2.0 */
3257  USE_GL_FUNC(glGetAttachedShaders) /* OpenGL 2.0 */
3258  USE_GL_FUNC(glGetAttribLocation) /* OpenGL 2.0 */
3259  USE_GL_FUNC(glGetBooleani_v) /* OpenGL 3.0 */
3260  USE_GL_FUNC(glGetBufferSubData) /* OpenGL 1.5 */
3261  USE_GL_FUNC(glGetCompressedTexImage) /* OpenGL 1.3 */
3262  USE_GL_FUNC(glGetDebugMessageLog) /* OpenGL 4.3 */
3263  USE_GL_FUNC(glGetIntegeri_v) /* OpenGL 3.0 */
3264  USE_GL_FUNC(glGetProgramInfoLog) /* OpenGL 2.0 */
3265  USE_GL_FUNC(glGetProgramiv) /* OpenGL 2.0 */
3266  USE_GL_FUNC(glGetQueryiv) /* OpenGL 1.5 */
3267  USE_GL_FUNC(glGetQueryObjectuiv) /* OpenGL 1.5 */
3268  USE_GL_FUNC(glGetShaderInfoLog) /* OpenGL 2.0 */
3269  USE_GL_FUNC(glGetShaderiv) /* OpenGL 2.0 */
3270  USE_GL_FUNC(glGetShaderSource) /* OpenGL 2.0 */
3271  USE_GL_FUNC(glGetStringi) /* OpenGL 3.0 */
3272  USE_GL_FUNC(glGetUniformfv) /* OpenGL 2.0 */
3273  USE_GL_FUNC(glGetUniformiv) /* OpenGL 2.0 */
3274  USE_GL_FUNC(glGetUniformLocation) /* OpenGL 2.0 */
3275  USE_GL_FUNC(glIsEnabledi) /* OpenGL 3.0 */
3276  USE_GL_FUNC(glLinkProgram) /* OpenGL 2.0 */
3277  USE_GL_FUNC(glMapBuffer) /* OpenGL 1.5 */
3278  USE_GL_FUNC(glPointParameteri) /* OpenGL 1.4 */
3279  USE_GL_FUNC(glPointParameteriv) /* OpenGL 1.4 */
3280  USE_GL_FUNC(glShaderSource) /* OpenGL 2.0 */
3281  USE_GL_FUNC(glStencilFuncSeparate) /* OpenGL 2.0 */
3282  USE_GL_FUNC(glStencilOpSeparate) /* OpenGL 2.0 */
3283  USE_GL_FUNC(glTexBuffer) /* OpenGL 3.1 */
3284  USE_GL_FUNC(glTexImage3D) /* OpenGL 1.2 */
3285  USE_GL_FUNC(glTexSubImage3D) /* OpenGL 1.2 */
3286  USE_GL_FUNC(glTransformFeedbackVaryings)/* OpenGL 3.0 */
3287  USE_GL_FUNC(glUniform1f) /* OpenGL 2.0 */
3288  USE_GL_FUNC(glUniform1fv) /* OpenGL 2.0 */
3289  USE_GL_FUNC(glUniform1i) /* OpenGL 2.0 */
3290  USE_GL_FUNC(glUniform1iv) /* OpenGL 2.0 */
3291  USE_GL_FUNC(glUniform2f) /* OpenGL 2.0 */
3292  USE_GL_FUNC(glUniform2fv) /* OpenGL 2.0 */
3293  USE_GL_FUNC(glUniform2i) /* OpenGL 2.0 */
3294  USE_GL_FUNC(glUniform2iv) /* OpenGL 2.0 */
3295  USE_GL_FUNC(glUniform3f) /* OpenGL 2.0 */
3296  USE_GL_FUNC(glUniform3fv) /* OpenGL 2.0 */
3297  USE_GL_FUNC(glUniform3i) /* OpenGL 2.0 */
3298  USE_GL_FUNC(glUniform3iv) /* OpenGL 2.0 */
3299  USE_GL_FUNC(glUniform4f) /* OpenGL 2.0 */
3300  USE_GL_FUNC(glUniform4fv) /* OpenGL 2.0 */
3301  USE_GL_FUNC(glUniform4i) /* OpenGL 2.0 */
3302  USE_GL_FUNC(glUniform4iv) /* OpenGL 2.0 */
3303  USE_GL_FUNC(glUniformMatrix2fv) /* OpenGL 2.0 */
3304  USE_GL_FUNC(glUniformMatrix3fv) /* OpenGL 2.0 */
3305  USE_GL_FUNC(glUniformMatrix4fv) /* OpenGL 2.0 */
3306  USE_GL_FUNC(glUnmapBuffer) /* OpenGL 1.5 */
3307  USE_GL_FUNC(glUseProgram) /* OpenGL 2.0 */
3308  USE_GL_FUNC(glValidateProgram) /* OpenGL 2.0 */
3309  USE_GL_FUNC(glVertexAttrib1f) /* OpenGL 2.0 */
3310  USE_GL_FUNC(glVertexAttrib1fv) /* OpenGL 2.0 */
3311  USE_GL_FUNC(glVertexAttrib2f) /* OpenGL 2.0 */
3312  USE_GL_FUNC(glVertexAttrib2fv) /* OpenGL 2.0 */
3313  USE_GL_FUNC(glVertexAttrib3f) /* OpenGL 2.0 */
3314  USE_GL_FUNC(glVertexAttrib3fv) /* OpenGL 2.0 */
3315  USE_GL_FUNC(glVertexAttrib4f) /* OpenGL 2.0 */
3316  USE_GL_FUNC(glVertexAttrib4fv) /* OpenGL 2.0 */
3317  USE_GL_FUNC(glVertexAttrib4Nsv) /* OpenGL 2.0 */
3318  USE_GL_FUNC(glVertexAttrib4Nub) /* OpenGL 2.0 */
3319  USE_GL_FUNC(glVertexAttrib4Nubv) /* OpenGL 2.0 */
3320  USE_GL_FUNC(glVertexAttrib4Nusv) /* OpenGL 2.0 */
3321  USE_GL_FUNC(glVertexAttrib4sv) /* OpenGL 2.0 */
3322  USE_GL_FUNC(glVertexAttrib4ubv) /* OpenGL 2.0 */
3323  USE_GL_FUNC(glVertexAttribDivisor) /* OpenGL 3.3 */
3324  USE_GL_FUNC(glVertexAttribIPointer) /* OpenGL 3.0 */
3325  USE_GL_FUNC(glVertexAttribPointer) /* OpenGL 2.0 */
3326 #undef USE_GL_FUNC
3327 
3328 #ifndef USE_WIN32_OPENGL
3329  /* hack: use the functions directly from the TEB table to bypass the thunks */
3330  /* note that we still need the above wglGetProcAddress calls to initialize the table */
3331  gl_info->gl_ops.ext = ((struct opengl_funcs *)NtCurrentTeb()->glTable)->ext;
3332 #endif
3333 
3334 #define MAP_GL_FUNCTION(core_func, ext_func) \
3335  do \
3336  { \
3337  if (!gl_info->gl_ops.ext.p_##core_func) \
3338  gl_info->gl_ops.ext.p_##core_func = gl_info->gl_ops.ext.p_##ext_func; \
3339  } while (0)
3340 #define MAP_GL_FUNCTION_CAST(core_func, ext_func) \
3341  do \
3342  { \
3343  if (!gl_info->gl_ops.ext.p_##core_func) \
3344  gl_info->gl_ops.ext.p_##core_func = (void *)gl_info->gl_ops.ext.p_##ext_func; \
3345  } while (0)
3346 
3348  MAP_GL_FUNCTION(glAttachShader, glAttachObjectARB);
3349  MAP_GL_FUNCTION(glBeginQuery, glBeginQueryARB);
3350  MAP_GL_FUNCTION(glBindAttribLocation, glBindAttribLocationARB);
3351  MAP_GL_FUNCTION(glBindBuffer, glBindBufferARB);
3352  MAP_GL_FUNCTION(glBindFragDataLocation, glBindFragDataLocationEXT);
3353  MAP_GL_FUNCTION(glBlendColor, glBlendColorEXT);
3354  MAP_GL_FUNCTION(glBlendEquation, glBlendEquationEXT);
3355  MAP_GL_FUNCTION(glBlendEquationSeparate, glBlendEquationSeparateEXT);
3356  MAP_GL_FUNCTION(glBlendFuncSeparate, glBlendFuncSeparateEXT);
3357  MAP_GL_FUNCTION(glBufferData, glBufferDataARB);
3358  MAP_GL_FUNCTION(glBufferSubData, glBufferSubDataARB);
3359  MAP_GL_FUNCTION(glColorMaski, glColorMaskIndexedEXT);
3360  MAP_GL_FUNCTION(glCompileShader, glCompileShaderARB);
3361  MAP_GL_FUNCTION(glCompressedTexImage2D, glCompressedTexImage2DARB);
3362  MAP_GL_FUNCTION(glCompressedTexImage3D, glCompressedTexImage3DARB);
3363  MAP_GL_FUNCTION(glCompressedTexSubImage2D, glCompressedTexSubImage2DARB);
3364  MAP_GL_FUNCTION(glCompressedTexSubImage3D, glCompressedTexSubImage3DARB);
3365  MAP_GL_FUNCTION(glCreateProgram, glCreateProgramObjectARB);
3366  MAP_GL_FUNCTION(glCreateShader, glCreateShaderObjectARB);
3367  MAP_GL_FUNCTION(glDebugMessageCallback, glDebugMessageCallbackARB);
3368  MAP_GL_FUNCTION(glDebugMessageControl, glDebugMessageControlARB);
3369  MAP_GL_FUNCTION(glDebugMessageInsert, glDebugMessageInsertARB);
3370  MAP_GL_FUNCTION(glDeleteBuffers, glDeleteBuffersARB);
3371  MAP_GL_FUNCTION(glDeleteProgram, glDeleteObjectARB);
3372  MAP_GL_FUNCTION(glDeleteQueries, glDeleteQueriesARB);
3373  MAP_GL_FUNCTION(glDeleteShader, glDeleteObjectARB);
3374  MAP_GL_FUNCTION(glDetachShader, glDetachObjectARB);
3375  MAP_GL_FUNCTION(glDisablei, glDisableIndexedEXT);
3376  MAP_GL_FUNCTION(glDisableVertexAttribArray, glDisableVertexAttribArrayARB);
3377  MAP_GL_FUNCTION(glDrawArraysInstanced, glDrawArraysInstancedARB);
3378  MAP_GL_FUNCTION(glDrawBuffers, glDrawBuffersARB);
3379  MAP_GL_FUNCTION(glDrawElementsInstanced, glDrawElementsInstancedARB);
3380  MAP_GL_FUNCTION(glEnablei, glEnableIndexedEXT);
3381  MAP_GL_FUNCTION(glEnableVertexAttribArray, glEnableVertexAttribArrayARB);
3382  MAP_GL_FUNCTION(glEndQuery, glEndQueryARB);
3383  MAP_GL_FUNCTION(glFramebufferTexture, glFramebufferTextureARB);
3384  MAP_GL_FUNCTION(glGenBuffers, glGenBuffersARB);
3385  MAP_GL_FUNCTION(glGenQueries, glGenQueriesARB);
3386  MAP_GL_FUNCTION(glGetActiveUniform, glGetActiveUniformARB);
3387  MAP_GL_FUNCTION(glGetAttachedShaders, glGetAttachedObjectsARB);
3388  MAP_GL_FUNCTION(glGetAttribLocation, glGetAttribLocationARB);
3389  MAP_GL_FUNCTION(glGetBooleani_v, glGetBooleanIndexedvEXT);
3390  MAP_GL_FUNCTION(glGetBufferSubData, glGetBufferSubDataARB);
3391  MAP_GL_FUNCTION(glGetCompressedTexImage, glGetCompressedTexImageARB);
3392  MAP_GL_FUNCTION(glGetDebugMessageLog, glGetDebugMessageLogARB);
3393  MAP_GL_FUNCTION(glGetIntegeri_v, glGetIntegerIndexedvEXT);
3394  MAP_GL_FUNCTION(glGetProgramInfoLog, glGetInfoLogARB);
3395  MAP_GL_FUNCTION(glGetProgramiv, glGetObjectParameterivARB);
3396  MAP_GL_FUNCTION(glGetQueryiv, glGetQueryivARB);
3397  MAP_GL_FUNCTION(glGetQueryObjectuiv, glGetQueryObjectuivARB);
3398  MAP_GL_FUNCTION(glGetShaderInfoLog, glGetInfoLogARB);
3399  MAP_GL_FUNCTION(glGetShaderiv, glGetObjectParameterivARB);
3400  MAP_GL_FUNCTION(glGetShaderSource, glGetShaderSourceARB);
3401  MAP_GL_FUNCTION(glGetUniformfv, glGetUniformfvARB);
3402  MAP_GL_FUNCTION(glGetUniformiv, glGetUniformivARB);
3403  MAP_GL_FUNCTION(glGetUniformLocation, glGetUniformLocationARB);
3404  MAP_GL_FUNCTION(glIsEnabledi, glIsEnabledIndexedEXT);
3405  MAP_GL_FUNCTION(glLinkProgram, glLinkProgramARB);
3406  MAP_GL_FUNCTION(glMapBuffer, glMapBufferARB);
3407  MAP_GL_FUNCTION_CAST(glShaderSource, glShaderSourceARB);
3408  MAP_GL_FUNCTION(glTexBuffer, glTexBufferARB);
3409  MAP_GL_FUNCTION_CAST(glTexImage3D, glTexImage3DEXT);
3410  MAP_GL_FUNCTION(glTexSubImage3D, glTexSubImage3DEXT);
3411  MAP_GL_FUNCTION(glUniform1f, glUniform1fARB);
3412  MAP_GL_FUNCTION(glUniform1fv, glUniform1fvARB);
3413  MAP_GL_FUNCTION(glUniform1i, glUniform1iARB);
3414  MAP_GL_FUNCTION(glUniform1iv, glUniform1ivARB);
3415  MAP_GL_FUNCTION(glUniform2f, glUniform2fARB);
3416  MAP_GL_FUNCTION(glUniform2fv, glUniform2fvARB);
3417  MAP_GL_FUNCTION(glUniform2i, glUniform2iARB);
3418  MAP_GL_FUNCTION(glUniform2iv, glUniform2ivARB);
3419  MAP_GL_FUNCTION(glUniform3f, glUniform3fARB);
3420  MAP_GL_FUNCTION(glUniform3fv, glUniform3fvARB);
3421  MAP_GL_FUNCTION(glUniform3i, glUniform3iARB);
3422  MAP_GL_FUNCTION(glUniform3iv, glUniform3ivARB);
3423  MAP_GL_FUNCTION(glUniform4f, glUniform4fARB);
3424  MAP_GL_FUNCTION(glUniform4fv, glUniform4fvARB);
3425  MAP_GL_FUNCTION(glUniform4i, glUniform4iARB);
3426  MAP_GL_FUNCTION(glUniform4iv, glUniform4ivARB);
3427  MAP_GL_FUNCTION(glUniformMatrix2fv, glUniformMatrix2fvARB);
3428  MAP_GL_FUNCTION(glUniformMatrix3fv, glUniformMatrix3fvARB);
3429  MAP_GL_FUNCTION(glUniformMatrix4fv, glUniformMatrix4fvARB);
3430  MAP_GL_FUNCTION(glUnmapBuffer, glUnmapBufferARB);
3431  MAP_GL_FUNCTION(glUseProgram, glUseProgramObjectARB);
3432  MAP_GL_FUNCTION(glValidateProgram, glValidateProgramARB);
3433  MAP_GL_FUNCTION(glVertexAttrib1f, glVertexAttrib1fARB);
3434  MAP_GL_FUNCTION(glVertexAttrib1fv, glVertexAttrib1fvARB);
3435  MAP_GL_FUNCTION(glVertexAttrib2f, glVertexAttrib2fARB);
3436  MAP_GL_FUNCTION(glVertexAttrib2fv, glVertexAttrib2fvARB);
3437  MAP_GL_FUNCTION(glVertexAttrib3f, glVertexAttrib3fARB);
3438  MAP_GL_FUNCTION(glVertexAttrib3fv, glVertexAttrib3fvARB);
3439  MAP_GL_FUNCTION(glVertexAttrib4f, glVertexAttrib4fARB);
3440  MAP_GL_FUNCTION(glVertexAttrib4fv, glVertexAttrib4fvARB);
3441  MAP_GL_FUNCTION(glVertexAttrib4Nsv, glVertexAttrib4NsvARB);
3442  MAP_GL_FUNCTION(glVertexAttrib4Nub, glVertexAttrib4NubARB);
3443  MAP_GL_FUNCTION(glVertexAttrib4Nubv, glVertexAttrib4NubvARB);
3444  MAP_GL_FUNCTION(glVertexAttrib4Nusv, glVertexAttrib4NusvARB);
3445  MAP_GL_FUNCTION(glVertexAttrib4sv, glVertexAttrib4svARB);
3446  MAP_GL_FUNCTION(glVertexAttrib4ubv, glVertexAttrib4ubvARB);
3447  MAP_GL_FUNCTION(glVertexAttribDivisor, glVertexAttribDivisorARB);
3448  MAP_GL_FUNCTION(glVertexAttribIPointer, glVertexAttribIPointerEXT);
3449  MAP_GL_FUNCTION(glVertexAttribPointer, glVertexAttribPointerARB);
3450 #undef MAP_GL_FUNCTION
3451 #undef MAP_GL_FUNCTION_CAST
3452 }
3453 
3454 static void wined3d_adapter_init_limits(struct wined3d_gl_info *gl_info)
3455 {
3456  unsigned int i, sampler_count;
3457  GLfloat gl_floatv[2];
3458  GLint gl_max;
3459 
3460  gl_info->limits.blends = 1;
3461  gl_info->limits.buffers = 1;
3462  gl_info->limits.textures = 0;
3463  gl_info->limits.texture_coords = 0;
3464  for (i = 0; i < WINED3D_SHADER_TYPE_COUNT; ++i)
3465  {
3466  gl_info->limits.uniform_blocks[i] = 0;
3467  gl_info->limits.samplers[i] = 0;
3468  }
3469  gl_info->limits.samplers[WINED3D_SHADER_TYPE_PIXEL] = 1;
3470  gl_info->limits.combined_samplers = gl_info->limits.samplers[WINED3D_SHADER_TYPE_PIXEL];
3471  gl_info->limits.graphics_samplers = gl_info->limits.combined_samplers;
3472  gl_info->limits.vertex_attribs = 16;
3473  gl_info->limits.texture_buffer_offset_alignment = 1;
3474  gl_info->limits.glsl_vs_float_constants = 0;
3475  gl_info->limits.glsl_ps_float_constants = 0;
3476  gl_info->limits.arb_vs_float_constants = 0;
3477  gl_info->limits.arb_vs_native_constants = 0;
3478  gl_info->limits.arb_vs_instructions = 0;
3479  gl_info->limits.arb_vs_temps = 0;
3480  gl_info->limits.arb_ps_float_constants = 0;
3481  gl_info->limits.arb_ps_local_constants = 0;
3482  gl_info->limits.arb_ps_instructions = 0;
3483  gl_info->limits.arb_ps_temps = 0;
3484 
3485  gl_info->gl_ops.gl.p_glGetIntegerv(GL_MAX_CLIP_DISTANCES, &gl_max);
3486  gl_info->limits.user_clip_distances = min(MAX_CLIP_DISTANCES, gl_max);
3487  TRACE("Clip plane support - max planes %d.\n", gl_max);
3488 
3489  if (gl_info->supported[WINED3D_GL_LEGACY_CONTEXT])
3490  {
3491  gl_info->gl_ops.gl.p_glGetIntegerv(GL_MAX_LIGHTS, &gl_max);
3492  gl_info->limits.lights = gl_max;
3493  TRACE("Light support - max lights %d.\n", gl_max);
3494  }
3495 
3496  gl_info->gl_ops.gl.p_glGetIntegerv(GL_MAX_TEXTURE_SIZE, &gl_max);
3497  gl_info->limits.texture_size = gl_max;
3498  TRACE("Maximum texture size support - max texture size %d.\n", gl_max);
3499 
3500  gl_info->gl_ops.gl.p_glGetFloatv(gl_info->supported[WINED3D_GL_LEGACY_CONTEXT]
3502  gl_info->limits.pointsize_min = gl_floatv[0];
3503  gl_info->limits.pointsize_max = gl_floatv[1];
3504  TRACE("Maximum point size support - max point size %f.\n", gl_floatv[1]);
3505 
3506  if (gl_info->supported[ARB_MAP_BUFFER_ALIGNMENT])
3507  {
3508  gl_info->gl_ops.gl.p_glGetIntegerv(GL_MIN_MAP_BUFFER_ALIGNMENT, &gl_max);
3509  TRACE("Minimum buffer map alignment: %d.\n", gl_max);
3510  }
3511  else
3512  {
3513  WARN_(d3d_perf)("Driver doesn't guarantee a minimum buffer map alignment.\n");
3514  }
3515  if (gl_info->supported[NV_REGISTER_COMBINERS])
3516  {
3517  gl_info->gl_ops.gl.p_glGetIntegerv(GL_MAX_GENERAL_COMBINERS_NV, &gl_max);
3518  gl_info->limits.general_combiners = gl_max;
3519  TRACE("Max general combiners: %d.\n", gl_max);
3520  }
3522  {
3523  gl_info->gl_ops.gl.p_glGetIntegerv(GL_MAX_DRAW_BUFFERS_ARB, &gl_max);
3524  gl_info->limits.buffers = gl_max;
3525  TRACE("Max draw buffers: %u.\n", gl_max);
3526  }
3527  if (gl_info->supported[ARB_BLEND_FUNC_EXTENDED])
3528  {
3529  gl_info->gl_ops.gl.p_glGetIntegerv(GL_MAX_DUAL_SOURCE_DRAW_BUFFERS, &gl_max);
3530  gl_info->limits.dual_buffers = gl_max;
3531  TRACE("Max dual source draw buffers: %u.\n", gl_max);
3532  }
3533  if (gl_info->supported[ARB_MULTITEXTURE])
3534  {
3535  if (gl_info->supported[WINED3D_GL_LEGACY_CONTEXT])
3536  {
3537  gl_info->gl_ops.gl.p_glGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB, &gl_max);
3538  gl_info->limits.textures = min(MAX_TEXTURES, gl_max);
3539  TRACE("Max textures: %d.\n", gl_info->limits.textures);
3540 
3541  if (gl_info->supported[ARB_FRAGMENT_PROGRAM])
3542  {
3543  gl_info->gl_ops.gl.p_glGetIntegerv(GL_MAX_TEXTURE_COORDS_ARB, &gl_max);
3544  gl_info->limits.texture_coords = min(MAX_TEXTURES, gl_max);
3545  }
3546  else
3547  {
3548  gl_info->limits.texture_coords = gl_info->limits.textures;
3549  }
3550  TRACE("Max texture coords: %d.\n", gl_info->limits.texture_coords);
3551  }
3552 
3553  if (gl_info->supported[ARB_FRAGMENT_PROGRAM] || gl_info->supported[ARB_FRAGMENT_SHADER])
3554  {
3555  gl_info->gl_ops.gl.p_glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, &gl_max);
3556  gl_info->limits.samplers[WINED3D_SHADER_TYPE_PIXEL] = gl_max;
3557  }
3558  else
3559  {
3560  gl_info->limits.samplers[WINED3D_SHADER_TYPE_PIXEL] = gl_info->limits.textures;
3561  }
3562  TRACE("Max fragment samplers: %d.\n", gl_info->limits.samplers[WINED3D_SHADER_TYPE_PIXEL]);
3563 
3564  if (gl_info->supported[ARB_VERTEX_SHADER])
3565  {
3566  unsigned int vertex_sampler_count;
3567 
3568  gl_info->gl_ops.gl.p_glGetIntegerv(GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB, &gl_max);
3569  vertex_sampler_count = gl_info->limits.samplers[WINED3D_SHADER_TYPE_VERTEX] = gl_max;
3570  gl_info->gl_ops.gl.p_glGetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB, &gl_max);
3571  gl_info->limits.combined_samplers = gl_max;
3572  gl_info->gl_ops.gl.p_glGetIntegerv(GL_MAX_VERTEX_ATTRIBS_ARB, &gl_max);
3573  gl_info->limits.vertex_attribs = gl_max;
3574 
3575  /* Loading GLSL sampler uniforms is much simpler if we can assume that the sampler setup
3576  * is known at shader link time. In a vertex shader + pixel shader combination this isn't
3577  * an issue because then the sampler setup only depends on the two shaders. If a pixel
3578  * shader is used with fixed function vertex processing we're fine too because fixed function
3579  * vertex processing doesn't use any samplers. If fixed function fragment processing is
3580  * used we have to make sure that all vertex sampler setups are valid together with all
3581  * possible fixed function fragment processing setups. This is true if vsamplers + MAX_TEXTURES
3582  * <= max_samplers. This is true on all d3d9 cards that support vtf(gf 6 and gf7 cards).
3583  * dx9 radeon cards do not support vertex texture fetch. DX10 cards have 128 samplers, and
3584  * dx9 is limited to 8 fixed function texture stages and 4 vertex samplers. DX10 does not have
3585  * a fixed function pipeline anymore.
3586  *
3587  * So this is just a check to check that our assumption holds true. If not, write a warning
3588  * and reduce the number of vertex samplers or probably disable vertex texture fetch. */
3589  if (vertex_sampler_count && gl_info->limits.combined_samplers < 12
3590  && MAX_TEXTURES + vertex_sampler_count > gl_info->limits.combined_samplers)
3591  {
3592  FIXME("OpenGL implementation supports %u vertex samplers and %u total samplers.\n",
3593  vertex_sampler_count, gl_info->limits.combined_samplers);
3594  FIXME("Expected vertex samplers + MAX_TEXTURES(=8) > combined_samplers.\n");
3595  if (gl_info->limits.combined_samplers > MAX_TEXTURES)
3596  vertex_sampler_count = gl_info->limits.combined_samplers - MAX_TEXTURES;
3597  else
3598  vertex_sampler_count = 0;
3599  gl_info->limits.samplers[WINED3D_SHADER_TYPE_VERTEX] = vertex_sampler_count;
3600  }
3601  }
3602  else
3603  {
3604  gl_info->limits.combined_samplers = gl_info->limits.samplers[WINED3D_SHADER_TYPE_PIXEL];
3605  }
3606  TRACE("Max vertex samplers: %u.\n", gl_info->limits.samplers[WINED3D_SHADER_TYPE_VERTEX]);
3607  TRACE("Max combined samplers: %u.\n", gl_info->limits.combined_samplers);
3608  TRACE("Max vertex attributes: %u.\n", gl_info->limits.vertex_attribs);
3609  }
3610  else
3611  {
3612  gl_info->limits.textures = 1;
3613  gl_info->limits.texture_coords = 1;
3614  }
3615 
3616  if (gl_info->supported[ARB_VERTEX_BLEND])
3617  {
3618  gl_info->gl_ops.gl.p_glGetIntegerv(GL_MAX_VERTEX_UNITS_ARB, &gl_max);
3619  gl_info->limits.blends = gl_max;
3620  TRACE("Max blends: %u.\n", gl_info->limits.blends);
3621  }
3622  if (gl_info->supported[EXT_TEXTURE3D])
3623  {
3624  gl_info->gl_ops.gl.p_glGetIntegerv(GL_MAX_3D_TEXTURE_SIZE_EXT, &gl_max);
3625  gl_info->limits.texture3d_size = gl_max;
3626  TRACE("Max texture3D size: %d.\n", gl_info->limits.texture3d_size);
3627  }
3629  {
3630  gl_info->gl_ops.gl.p_glGetIntegerv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &gl_max);
3631  gl_info->limits.anisotropy = gl_max;
3632  TRACE("Max anisotropy: %d.\n", gl_info->limits.anisotropy);
3633  }
3634  if (gl_info->supported[ARB_FRAGMENT_PROGRAM])
3635  {
3637  gl_info->limits.arb_ps_float_constants = gl_max;
3638  TRACE("Max ARB_FRAGMENT_PROGRAM float constants: %d.\n", gl_info->limits.arb_ps_float_constants);
3640  gl_info->limits.arb_ps_native_constants = gl_max;
3641  TRACE("Max ARB_FRAGMENT_PROGRAM native float constants: %d.\n",
3642  gl_info->limits.arb_ps_native_constants);
3644  gl_info->limits.arb_ps_temps = gl_max;
3645  TRACE("Max ARB_FRAGMENT_PROGRAM native temporaries: %d.\n", gl_info->limits.arb_ps_temps);
3647  gl_info->limits.arb_ps_instructions = gl_max;
3648  TRACE("Max ARB_FRAGMENT_PROGRAM native instructions: %d.\n", gl_info->limits.arb_ps_instructions);
3650  gl_info->limits.arb_ps_local_constants = gl_max;
3651  TRACE("Max ARB_FRAGMENT_PROGRAM local parameters: %d.\n", gl_info->limits.arb_ps_instructions);
3652  }
3653  if (gl_info->supported[ARB_VERTEX_PROGRAM])
3654  {
3656  gl_info->limits.arb_vs_float_constants = gl_max;
3657  TRACE("Max ARB_VERTEX_PROGRAM float constants: %d.\n", gl_info->limits.arb_vs_float_constants);
3659  gl_info->limits.arb_vs_native_constants = gl_max;
3660  TRACE("Max ARB_VERTEX_PROGRAM native float constants: %d.\n",
3661  gl_info->limits.arb_vs_native_constants);
3663  gl_info->limits.arb_vs_temps = gl_max;
3664  TRACE("Max ARB_VERTEX_PROGRAM native temporaries: %d.\n", gl_info->limits.arb_vs_temps);
3666  gl_info->limits.arb_vs_instructions = gl_max;
3667  TRACE("Max ARB_VERTEX_PROGRAM native instructions: %d.\n", gl_info->limits.arb_vs_instructions);
3668  }
3669  if (gl_info->supported[ARB_VERTEX_SHADER])
3670  {
3671  gl_info->gl_ops.gl.p_glGetIntegerv(GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB, &gl_max);
3672  gl_info->limits.glsl_vs_float_constants = gl_max / 4;
3673  TRACE("Max ARB_VERTEX_SHADER float constants: %u.\n", gl_info->limits.glsl_vs_float_constants);
3674 
3675  if (gl_info->supported[ARB_UNIFORM_BUFFER_OBJECT])
3676  {
3677  gl_info->gl_ops.gl.p_glGetIntegerv(GL_MAX_VERTEX_UNIFORM_BLOCKS, &gl_max);
3678  gl_info->limits.uniform_blocks[WINED3D_SHADER_TYPE_VERTEX] = min(gl_max, WINED3D_MAX_CBS);
3679  TRACE("Max vertex uniform blocks: %u (%d).\n",
3680  gl_info->limits.uniform_blocks[WINED3D_SHADER_TYPE_VERTEX], gl_max);
3681  }
3682  }
3683  if (gl_info->supported[ARB_TESSELLATION_SHADER])
3684  {
3685  gl_info->gl_ops.gl.p_glGetIntegerv(GL_MAX_TESS_CONTROL_UNIFORM_BLOCKS, &gl_max);
3686  gl_info->limits.uniform_blocks[WINED3D_SHADER_TYPE_HULL] = min(gl_max, WINED3D_MAX_CBS);
3687  TRACE("Max hull uniform blocks: %u (%d).\n",
3688  gl_info->limits.uniform_blocks[WINED3D_SHADER_TYPE_HULL], gl_max);
3689  gl_info->gl_ops.gl.p_glGetIntegerv(GL_MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS, &gl_max);
3690  gl_info->limits.samplers[WINED3D_SHADER_TYPE_HULL] = gl_max;
3691  TRACE("Max hull samplers: %u.\n", gl_info->limits.samplers[WINED3D_SHADER_TYPE_HULL]);
3692 
3693  gl_info->gl_ops.gl.p_glGetIntegerv(GL_MAX_TESS_EVALUATION_UNIFORM_BLOCKS, &gl_max);
3694  gl_info->limits.uniform_blocks[WINED3D_SHADER_TYPE_DOMAIN] = min(gl_max, WINED3D_MAX_CBS);
3695  TRACE("Max domain uniform blocks: %u (%d).\n",
3696  gl_info->limits