2 * Copyright 2002-2004 Jason Edmeades
3 * Copyright 2003-2004 Raphael Junqueira
4 * Copyright 2004 Christian Costa
5 * Copyright 2005 Oliver Stieber
6 * Copyright 2007-2008 Stefan Dösinger for CodeWeavers
7 * Copyright 2009-2011 Henri Verbeet for CodeWeavers
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
25 #include "wine/port.h"
29 #include "wined3d_private.h"
32 WINE_DEFAULT_DEBUG_CHANNEL(d3d
);
33 WINE_DECLARE_DEBUG_CHANNEL(d3d_perf
);
34 WINE_DECLARE_DEBUG_CHANNEL(winediag
);
36 #define WINE_DEFAULT_VIDMEM (64 * 1024 * 1024)
37 #define DEFAULT_REFRESH_RATE 0
39 /* The driver names reflect the lowest GPU supported
40 * by a certain driver, so DRIVER_AMD_R300 supports
41 * R3xx, R4xx and R5xx GPUs. */
42 enum wined3d_display_driver
44 DRIVER_AMD_RAGE_128PRO
,
54 DRIVER_NVIDIA_GEFORCE2MX
,
55 DRIVER_NVIDIA_GEFORCEFX
,
56 DRIVER_NVIDIA_GEFORCE6
,
57 DRIVER_NVIDIA_GEFORCE8
,
62 enum wined3d_driver_model
71 enum wined3d_gl_vendor
80 enum wined3d_d3d_level
86 WINED3D_D3D_LEVEL_9_SM2
,
87 WINED3D_D3D_LEVEL_9_SM3
,
90 WINED3D_D3D_LEVEL_COUNT
93 /* The d3d device ID */
94 static const GUID IID_D3DDEVICE_D3DUID
= { 0xaeb2cdd4, 0x6e41, 0x43ea, { 0x94,0x1c,0x83,0x61,0xcc,0x76,0x07,0x81 } };
96 /* Extension detection */
97 struct wined3d_extension_map
99 const char *extension_string
;
100 enum wined3d_gl_extension extension
;
103 static const struct wined3d_extension_map gl_extension_map
[] =
106 {"GL_APPLE_fence", APPLE_FENCE
},
107 {"GL_APPLE_float_pixels", APPLE_FLOAT_PIXELS
},
108 {"GL_APPLE_flush_buffer_range", APPLE_FLUSH_BUFFER_RANGE
},
109 {"GL_APPLE_ycbcr_422", APPLE_YCBCR_422
},
112 {"GL_ARB_blend_func_extended", ARB_BLEND_FUNC_EXTENDED
},
113 {"GL_ARB_clip_control", ARB_CLIP_CONTROL
},
114 {"GL_ARB_color_buffer_float", ARB_COLOR_BUFFER_FLOAT
},
115 {"GL_ARB_copy_buffer", ARB_COPY_BUFFER
},
116 {"GL_ARB_debug_output", ARB_DEBUG_OUTPUT
},
117 {"GL_ARB_depth_buffer_float", ARB_DEPTH_BUFFER_FLOAT
},
118 {"GL_ARB_depth_texture", ARB_DEPTH_TEXTURE
},
119 {"GL_ARB_derivative_control", ARB_DERIVATIVE_CONTROL
},
120 {"GL_ARB_draw_buffers", ARB_DRAW_BUFFERS
},
121 {"GL_ARB_draw_elements_base_vertex", ARB_DRAW_ELEMENTS_BASE_VERTEX
},
122 {"GL_ARB_draw_instanced", ARB_DRAW_INSTANCED
},
123 {"GL_ARB_ES2_compatibility", ARB_ES2_COMPATIBILITY
},
124 {"GL_ARB_explicit_attrib_location", ARB_EXPLICIT_ATTRIB_LOCATION
},
125 {"GL_ARB_fragment_coord_conventions", ARB_FRAGMENT_COORD_CONVENTIONS
},
126 {"GL_ARB_fragment_program", ARB_FRAGMENT_PROGRAM
},
127 {"GL_ARB_fragment_shader", ARB_FRAGMENT_SHADER
},
128 {"GL_ARB_framebuffer_object", ARB_FRAMEBUFFER_OBJECT
},
129 {"GL_ARB_framebuffer_sRGB", ARB_FRAMEBUFFER_SRGB
},
130 {"GL_ARB_geometry_shader4", ARB_GEOMETRY_SHADER4
},
131 {"GL_ARB_half_float_pixel", ARB_HALF_FLOAT_PIXEL
},
132 {"GL_ARB_half_float_vertex", ARB_HALF_FLOAT_VERTEX
},
133 {"GL_ARB_instanced_arrays", ARB_INSTANCED_ARRAYS
},
134 {"GL_ARB_internalformat_query", ARB_INTERNALFORMAT_QUERY
},
135 {"GL_ARB_internalformat_query2", ARB_INTERNALFORMAT_QUERY2
},
136 {"GL_ARB_map_buffer_alignment", ARB_MAP_BUFFER_ALIGNMENT
},
137 {"GL_ARB_map_buffer_range", ARB_MAP_BUFFER_RANGE
},
138 {"GL_ARB_multisample", ARB_MULTISAMPLE
},
139 {"GL_ARB_multitexture", ARB_MULTITEXTURE
},
140 {"GL_ARB_occlusion_query", ARB_OCCLUSION_QUERY
},
141 {"GL_ARB_pixel_buffer_object", ARB_PIXEL_BUFFER_OBJECT
},
142 {"GL_ARB_point_parameters", ARB_POINT_PARAMETERS
},
143 {"GL_ARB_point_sprite", ARB_POINT_SPRITE
},
144 {"GL_ARB_provoking_vertex", ARB_PROVOKING_VERTEX
},
145 {"GL_ARB_sampler_objects", ARB_SAMPLER_OBJECTS
},
146 {"GL_ARB_shader_bit_encoding", ARB_SHADER_BIT_ENCODING
},
147 {"GL_ARB_shader_texture_lod", ARB_SHADER_TEXTURE_LOD
},
148 {"GL_ARB_shading_language_100", ARB_SHADING_LANGUAGE_100
},
149 {"GL_ARB_shadow", ARB_SHADOW
},
150 {"GL_ARB_sync", ARB_SYNC
},
151 {"GL_ARB_texture_border_clamp", ARB_TEXTURE_BORDER_CLAMP
},
152 {"GL_ARB_texture_compression", ARB_TEXTURE_COMPRESSION
},
153 {"GL_ARB_texture_compression_bptc", ARB_TEXTURE_COMPRESSION_BPTC
},
154 {"GL_ARB_texture_compression_rgtc", ARB_TEXTURE_COMPRESSION_RGTC
},
155 {"GL_ARB_texture_cube_map", ARB_TEXTURE_CUBE_MAP
},
156 {"GL_ARB_texture_env_combine", ARB_TEXTURE_ENV_COMBINE
},
157 {"GL_ARB_texture_env_dot3", ARB_TEXTURE_ENV_DOT3
},
158 {"GL_ARB_texture_float", ARB_TEXTURE_FLOAT
},
159 {"GL_ARB_texture_mirrored_repeat", ARB_TEXTURE_MIRRORED_REPEAT
},
160 {"GL_ARB_texture_mirror_clamp_to_edge", ARB_TEXTURE_MIRROR_CLAMP_TO_EDGE
},
161 {"GL_ARB_texture_non_power_of_two", ARB_TEXTURE_NON_POWER_OF_TWO
},
162 {"GL_ARB_texture_query_levels", ARB_TEXTURE_QUERY_LEVELS
},
163 {"GL_ARB_texture_rectangle", ARB_TEXTURE_RECTANGLE
},
164 {"GL_ARB_texture_rg", ARB_TEXTURE_RG
},
165 {"GL_ARB_texture_rgb10_a2ui", ARB_TEXTURE_RGB10_A2UI
},
166 {"GL_ARB_texture_storage", ARB_TEXTURE_STORAGE
},
167 {"GL_ARB_texture_swizzle", ARB_TEXTURE_SWIZZLE
},
168 {"GL_ARB_texture_view", ARB_TEXTURE_VIEW
},
169 {"GL_ARB_timer_query", ARB_TIMER_QUERY
},
170 {"GL_ARB_uniform_buffer_object", ARB_UNIFORM_BUFFER_OBJECT
},
171 {"GL_ARB_vertex_array_bgra", ARB_VERTEX_ARRAY_BGRA
},
172 {"GL_ARB_vertex_blend", ARB_VERTEX_BLEND
},
173 {"GL_ARB_vertex_buffer_object", ARB_VERTEX_BUFFER_OBJECT
},
174 {"GL_ARB_vertex_program", ARB_VERTEX_PROGRAM
},
175 {"GL_ARB_vertex_shader", ARB_VERTEX_SHADER
},
176 {"GL_ARB_vertex_type_2_10_10_10_rev", ARB_VERTEX_TYPE_2_10_10_10_REV
},
177 {"GL_ARB_viewport_array", ARB_VIEWPORT_ARRAY
},
180 {"GL_ATI_fragment_shader", ATI_FRAGMENT_SHADER
},
181 {"GL_ATI_separate_stencil", ATI_SEPARATE_STENCIL
},
182 {"GL_ATI_texture_compression_3dc", ATI_TEXTURE_COMPRESSION_3DC
},
183 {"GL_ATI_texture_env_combine3", ATI_TEXTURE_ENV_COMBINE3
},
184 {"GL_ATI_texture_mirror_once", ATI_TEXTURE_MIRROR_ONCE
},
187 {"GL_EXT_blend_color", EXT_BLEND_COLOR
},
188 {"GL_EXT_blend_equation_separate", EXT_BLEND_EQUATION_SEPARATE
},
189 {"GL_EXT_blend_func_separate", EXT_BLEND_FUNC_SEPARATE
},
190 {"GL_EXT_blend_minmax", EXT_BLEND_MINMAX
},
191 {"GL_EXT_blend_subtract", EXT_BLEND_SUBTRACT
},
192 {"GL_EXT_depth_bounds_test", EXT_DEPTH_BOUNDS_TEST
},
193 {"GL_EXT_draw_buffers2", EXT_DRAW_BUFFERS2
},
194 {"GL_EXT_fog_coord", EXT_FOG_COORD
},
195 {"GL_EXT_framebuffer_blit", EXT_FRAMEBUFFER_BLIT
},
196 {"GL_EXT_framebuffer_multisample", EXT_FRAMEBUFFER_MULTISAMPLE
},
197 {"GL_EXT_framebuffer_object", EXT_FRAMEBUFFER_OBJECT
},
198 {"GL_EXT_gpu_program_parameters", EXT_GPU_PROGRAM_PARAMETERS
},
199 {"GL_EXT_gpu_shader4", EXT_GPU_SHADER4
},
200 {"GL_EXT_packed_depth_stencil", EXT_PACKED_DEPTH_STENCIL
},
201 {"GL_EXT_packed_float", EXT_PACKED_FLOAT
},
202 {"GL_EXT_point_parameters", EXT_POINT_PARAMETERS
},
203 {"GL_EXT_provoking_vertex", EXT_PROVOKING_VERTEX
},
204 {"GL_EXT_secondary_color", EXT_SECONDARY_COLOR
},
205 {"GL_EXT_stencil_two_side", EXT_STENCIL_TWO_SIDE
},
206 {"GL_EXT_stencil_wrap", EXT_STENCIL_WRAP
},
207 {"GL_EXT_texture3D", EXT_TEXTURE3D
},
208 {"GL_EXT_texture_array", EXT_TEXTURE_ARRAY
},
209 {"GL_EXT_texture_compression_rgtc", EXT_TEXTURE_COMPRESSION_RGTC
},
210 {"GL_EXT_texture_compression_s3tc", EXT_TEXTURE_COMPRESSION_S3TC
},
211 {"GL_EXT_texture_env_combine", EXT_TEXTURE_ENV_COMBINE
},
212 {"GL_EXT_texture_env_dot3", EXT_TEXTURE_ENV_DOT3
},
213 {"GL_EXT_texture_filter_anisotropic", EXT_TEXTURE_FILTER_ANISOTROPIC
},
214 {"GL_EXT_texture_integer", EXT_TEXTURE_INTEGER
},
215 {"GL_EXT_texture_lod_bias", EXT_TEXTURE_LOD_BIAS
},
216 {"GL_EXT_texture_mirror_clamp", EXT_TEXTURE_MIRROR_CLAMP
},
217 {"GL_EXT_texture_snorm", EXT_TEXTURE_SNORM
},
218 {"GL_EXT_texture_sRGB", EXT_TEXTURE_SRGB
},
219 {"GL_EXT_texture_sRGB_decode", EXT_TEXTURE_SRGB_DECODE
},
220 {"GL_EXT_vertex_array_bgra", EXT_VERTEX_ARRAY_BGRA
},
223 {"GL_NV_fence", NV_FENCE
},
224 {"GL_NV_fog_distance", NV_FOG_DISTANCE
},
225 {"GL_NV_fragment_program", NV_FRAGMENT_PROGRAM
},
226 {"GL_NV_fragment_program2", NV_FRAGMENT_PROGRAM2
},
227 {"GL_NV_fragment_program_option", NV_FRAGMENT_PROGRAM_OPTION
},
228 {"GL_NV_half_float", NV_HALF_FLOAT
},
229 {"GL_NV_light_max_exponent", NV_LIGHT_MAX_EXPONENT
},
230 {"GL_NV_point_sprite", NV_POINT_SPRITE
},
231 {"GL_NV_register_combiners", NV_REGISTER_COMBINERS
},
232 {"GL_NV_register_combiners2", NV_REGISTER_COMBINERS2
},
233 {"GL_NV_texgen_reflection", NV_TEXGEN_REFLECTION
},
234 {"GL_NV_texture_env_combine4", NV_TEXTURE_ENV_COMBINE4
},
235 {"GL_NV_texture_shader", NV_TEXTURE_SHADER
},
236 {"GL_NV_texture_shader2", NV_TEXTURE_SHADER2
},
237 {"GL_NV_vertex_program", NV_VERTEX_PROGRAM
},
238 {"GL_NV_vertex_program1_1", NV_VERTEX_PROGRAM1_1
},
239 {"GL_NV_vertex_program2", NV_VERTEX_PROGRAM2
},
240 {"GL_NV_vertex_program2_option", NV_VERTEX_PROGRAM2_OPTION
},
241 {"GL_NV_vertex_program3", NV_VERTEX_PROGRAM3
},
244 {"GL_SGIS_generate_mipmap", SGIS_GENERATE_MIPMAP
},
247 static const struct wined3d_extension_map wgl_extension_map
[] =
249 {"WGL_ARB_pixel_format", WGL_ARB_PIXEL_FORMAT
},
250 {"WGL_EXT_swap_control", WGL_EXT_SWAP_CONTROL
},
251 {"WGL_WINE_pixel_format_passthrough", WGL_WINE_PIXEL_FORMAT_PASSTHROUGH
},
252 {"WGL_WINE_query_renderer", WGL_WINE_QUERY_RENDERER
},
255 /**********************************************************
256 * Utility functions follow
257 **********************************************************/
259 const struct min_lookup minMipLookup
[] =
261 /* NONE POINT LINEAR */
262 {{GL_NEAREST
, GL_NEAREST
, GL_NEAREST
}}, /* NONE */
263 {{GL_NEAREST
, GL_NEAREST_MIPMAP_NEAREST
, GL_NEAREST_MIPMAP_LINEAR
}}, /* POINT*/
264 {{GL_LINEAR
, GL_LINEAR_MIPMAP_NEAREST
, GL_LINEAR_MIPMAP_LINEAR
}}, /* LINEAR */
267 const GLenum magLookup
[] =
269 /* NONE POINT LINEAR */
270 GL_NEAREST
, GL_NEAREST
, GL_LINEAR
,
273 static void wined3d_caps_gl_ctx_destroy(const struct wined3d_caps_gl_ctx
*ctx
)
275 const struct wined3d_gl_info
*gl_info
= ctx
->gl_info
;
277 TRACE("Destroying caps GL context.\n");
279 /* Both glDeleteProgram and glDeleteBuffers silently ignore 0 IDs but
280 * this function might be called before the relevant function pointers
281 * in gl_info are initialized. */
282 if (ctx
->test_program_id
|| ctx
->test_vbo
)
284 GL_EXTCALL(glDeleteProgram(ctx
->test_program_id
));
285 GL_EXTCALL(glDeleteBuffers(1, &ctx
->test_vbo
));
288 if (!wglMakeCurrent(NULL
, NULL
))
289 ERR("Failed to disable caps GL context.\n");
291 if (!wglDeleteContext(ctx
->gl_ctx
))
293 DWORD err
= GetLastError();
294 ERR("wglDeleteContext(%p) failed, last error %#x.\n", ctx
->gl_ctx
, err
);
297 wined3d_release_dc(ctx
->wnd
, ctx
->dc
);
298 DestroyWindow(ctx
->wnd
);
300 if (ctx
->restore_gl_ctx
&& !wglMakeCurrent(ctx
->restore_dc
, ctx
->restore_gl_ctx
))
301 ERR("Failed to restore previous GL context.\n");
304 static BOOL
wined3d_caps_gl_ctx_create_attribs(struct wined3d_caps_gl_ctx
*caps_gl_ctx
,
305 struct wined3d_gl_info
*gl_info
)
309 if (!(gl_info
->p_wglCreateContextAttribsARB
= (void *)wglGetProcAddress("wglCreateContextAttribsARB")))
312 if (!(new_ctx
= context_create_wgl_attribs(gl_info
, caps_gl_ctx
->dc
, NULL
)))
314 gl_info
->p_wglCreateContextAttribsARB
= NULL
;
318 if (!wglMakeCurrent(caps_gl_ctx
->dc
, new_ctx
))
320 ERR("Failed to make new context current, last error %#x.\n", GetLastError());
321 if (!wglDeleteContext(new_ctx
))
322 ERR("Failed to delete new context, last error %#x.\n", GetLastError());
323 gl_info
->p_wglCreateContextAttribsARB
= NULL
;
327 if (!wglDeleteContext(caps_gl_ctx
->gl_ctx
))
328 ERR("Failed to delete old context, last error %#x.\n", GetLastError());
329 caps_gl_ctx
->gl_ctx
= new_ctx
;
334 static BOOL
wined3d_caps_gl_ctx_create(struct wined3d_adapter
*adapter
, struct wined3d_caps_gl_ctx
*ctx
)
336 PIXELFORMATDESCRIPTOR pfd
;
339 TRACE("getting context...\n");
341 ctx
->restore_dc
= wglGetCurrentDC();
342 ctx
->restore_gl_ctx
= wglGetCurrentContext();
344 /* We need a fake window as a hdc retrieved using GetDC(0) can't be used for much GL purposes. */
345 ctx
->wnd
= CreateWindowA(WINED3D_OPENGL_WINDOW_CLASS_NAME
, "WineD3D fake window",
346 WS_OVERLAPPEDWINDOW
, 10, 10, 10, 10, NULL
, NULL
, NULL
, NULL
);
349 ERR("Failed to create a window.\n");
353 ctx
->dc
= GetDC(ctx
->wnd
);
356 ERR("Failed to get a DC.\n");
360 /* PixelFormat selection */
361 ZeroMemory(&pfd
, sizeof(pfd
));
362 pfd
.nSize
= sizeof(pfd
);
364 pfd
.dwFlags
= PFD_SUPPORT_OPENGL
| PFD_DOUBLEBUFFER
| PFD_DRAW_TO_WINDOW
; /* PFD_GENERIC_ACCELERATED */
365 pfd
.iPixelType
= PFD_TYPE_RGBA
;
367 pfd
.iLayerType
= PFD_MAIN_PLANE
;
369 if (!(iPixelFormat
= ChoosePixelFormat(ctx
->dc
, &pfd
)))
371 /* If this happens something is very wrong as ChoosePixelFormat barely fails. */
372 ERR("Failed to find a suitable pixel format.\n");
375 DescribePixelFormat(ctx
->dc
, iPixelFormat
, sizeof(pfd
), &pfd
);
376 SetPixelFormat(ctx
->dc
, iPixelFormat
, &pfd
);
378 /* Create a GL context. */
379 if (!(ctx
->gl_ctx
= wglCreateContext(ctx
->dc
)))
381 WARN("Failed to create default context for capabilities initialization.\n");
385 /* Make it the current GL context. */
386 if (!wglMakeCurrent(ctx
->dc
, ctx
->gl_ctx
))
388 ERR("Failed to make caps GL context current.\n");
392 ctx
->gl_info
= &adapter
->gl_info
;
396 if (ctx
->gl_ctx
) wglDeleteContext(ctx
->gl_ctx
);
398 if (ctx
->dc
) ReleaseDC(ctx
->wnd
, ctx
->dc
);
400 if (ctx
->wnd
) DestroyWindow(ctx
->wnd
);
402 if (ctx
->restore_gl_ctx
&& !wglMakeCurrent(ctx
->restore_dc
, ctx
->restore_gl_ctx
))
403 ERR("Failed to restore previous GL context.\n");
408 /* Adjust the amount of used texture memory */
409 UINT64
adapter_adjust_memory(struct wined3d_adapter
*adapter
, INT64 amount
)
411 adapter
->vram_bytes_used
+= amount
;
412 TRACE("Adjusted used adapter memory by 0x%s to 0x%s.\n",
413 wine_dbgstr_longlong(amount
),
414 wine_dbgstr_longlong(adapter
->vram_bytes_used
));
415 return adapter
->vram_bytes_used
;
418 static void wined3d_adapter_cleanup(struct wined3d_adapter
*adapter
)
420 HeapFree(GetProcessHeap(), 0, adapter
->gl_info
.formats
);
421 HeapFree(GetProcessHeap(), 0, adapter
->cfgs
);
424 ULONG CDECL
wined3d_incref(struct wined3d
*wined3d
)
426 ULONG refcount
= InterlockedIncrement(&wined3d
->ref
);
428 TRACE("%p increasing refcount to %u.\n", wined3d
, refcount
);
433 ULONG CDECL
wined3d_decref(struct wined3d
*wined3d
)
435 ULONG refcount
= InterlockedDecrement(&wined3d
->ref
);
437 TRACE("%p decreasing refcount to %u.\n", wined3d
, refcount
);
443 for (i
= 0; i
< wined3d
->adapter_count
; ++i
)
445 wined3d_adapter_cleanup(&wined3d
->adapters
[i
]);
447 HeapFree(GetProcessHeap(), 0, wined3d
);
453 /* Context activation is done by the caller. */
454 static BOOL
test_arb_vs_offset_limit(const struct wined3d_gl_info
*gl_info
)
458 static const char testcode
[] =
460 "PARAM C[66] = { program.env[0..65] };\n"
462 "PARAM zero = {0.0, 0.0, 0.0, 0.0};\n"
463 "ARL A0.x, zero.x;\n"
464 "MOV result.position, C[A0.x + 65];\n"
467 while (gl_info
->gl_ops
.gl
.p_glGetError());
468 GL_EXTCALL(glGenProgramsARB(1, &prog
));
470 ERR("Failed to create an ARB offset limit test program\n");
472 GL_EXTCALL(glBindProgramARB(GL_VERTEX_PROGRAM_ARB
, prog
));
473 GL_EXTCALL(glProgramStringARB(GL_VERTEX_PROGRAM_ARB
, GL_PROGRAM_FORMAT_ASCII_ARB
,
474 strlen(testcode
), testcode
));
475 if (gl_info
->gl_ops
.gl
.p_glGetError())
477 TRACE("OpenGL implementation does not allow indirect addressing offsets > 63\n");
478 TRACE("error: %s\n", debugstr_a((const char *)gl_info
->gl_ops
.gl
.p_glGetString(GL_PROGRAM_ERROR_STRING_ARB
)));
480 } else TRACE("OpenGL implementation allows offsets > 63\n");
482 GL_EXTCALL(glBindProgramARB(GL_VERTEX_PROGRAM_ARB
, 0));
483 GL_EXTCALL(glDeleteProgramsARB(1, &prog
));
484 checkGLcall("ARB vp offset limit test cleanup");
489 static BOOL
match_amd_r300_to_500(const struct wined3d_gl_info
*gl_info
, const char *gl_renderer
,
490 enum wined3d_gl_vendor gl_vendor
, enum wined3d_pci_vendor card_vendor
, enum wined3d_pci_device device
)
492 if (card_vendor
!= HW_VENDOR_AMD
) return FALSE
;
493 if (device
== CARD_AMD_RADEON_9500
) return TRUE
;
494 if (device
== CARD_AMD_RADEON_X700
) return TRUE
;
495 if (device
== CARD_AMD_RADEON_X1600
) return TRUE
;
499 static BOOL
match_geforce5(const struct wined3d_gl_info
*gl_info
, const char *gl_renderer
,
500 enum wined3d_gl_vendor gl_vendor
, enum wined3d_pci_vendor card_vendor
, enum wined3d_pci_device device
)
502 if (card_vendor
== HW_VENDOR_NVIDIA
)
504 if (device
== CARD_NVIDIA_GEFORCEFX_5200
||
505 device
== CARD_NVIDIA_GEFORCEFX_5600
||
506 device
== CARD_NVIDIA_GEFORCEFX_5800
)
514 static BOOL
match_apple(const struct wined3d_gl_info
*gl_info
, const char *gl_renderer
,
515 enum wined3d_gl_vendor gl_vendor
, enum wined3d_pci_vendor card_vendor
, enum wined3d_pci_device device
)
517 /* MacOS has various specialities in the extensions it advertises. Some have to be loaded from
518 * the opengl 1.2+ core, while other extensions are advertised, but software emulated. So try to
519 * detect the Apple OpenGL implementation to apply some extension fixups afterwards.
521 * Detecting this isn't really easy. The vendor string doesn't mention Apple. Compile-time checks
522 * aren't sufficient either because a Linux binary may display on a macos X server via remote X11.
523 * So try to detect the GL implementation by looking at certain Apple extensions. Some extensions
524 * like client storage might be supported on other implementations too, but GL_APPLE_flush_render
525 * is specific to the Mac OS X window management, and GL_APPLE_ycbcr_422 is QuickTime specific. So
526 * the chance that other implementations support them is rather small since Win32 QuickTime uses
527 * DirectDraw, not OpenGL.
529 * This test has been moved into wined3d_guess_gl_vendor()
531 return gl_vendor
== GL_VENDOR_APPLE
;
534 /* Context activation is done by the caller. */
535 static void test_pbo_functionality(struct wined3d_gl_info
*gl_info
)
537 /* Some OpenGL implementations, namely Apple's Geforce 8 driver, advertises PBOs,
538 * but glTexSubImage from a PBO fails miserably, with the first line repeated over
539 * all the texture. This function detects this bug by its symptom and disables PBOs
542 * The test uploads a 4x4 texture via the PBO in the "native" format GL_BGRA,
543 * GL_UNSIGNED_INT_8_8_8_8_REV. This format triggers the bug, and it is what we use
544 * for D3DFMT_A8R8G8B8. Then the texture is read back without any PBO and the data
545 * read back is compared to the original. If they are equal PBOs are assumed to work,
546 * otherwise the PBO extension is disabled. */
548 static const unsigned int pattern
[] =
550 0x00000000, 0x000000ff, 0x0000ff00, 0x40ff0000,
551 0x80ffffff, 0x40ffff00, 0x00ff00ff, 0x0000ffff,
552 0x00ffff00, 0x00ff00ff, 0x0000ffff, 0x000000ff,
553 0x80ff00ff, 0x0000ffff, 0x00ff00ff, 0x40ff00ff
555 unsigned int check
[sizeof(pattern
) / sizeof(pattern
[0])];
557 /* No PBO -> No point in testing them. */
558 if (!gl_info
->supported
[ARB_PIXEL_BUFFER_OBJECT
]) return;
560 while (gl_info
->gl_ops
.gl
.p_glGetError());
561 gl_info
->gl_ops
.gl
.p_glGenTextures(1, &texture
);
562 gl_info
->gl_ops
.gl
.p_glBindTexture(GL_TEXTURE_2D
, texture
);
564 gl_info
->gl_ops
.gl
.p_glTexParameteri(GL_TEXTURE_2D
, GL_TEXTURE_MAX_LEVEL
, 0);
565 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);
566 checkGLcall("Specifying the PBO test texture");
568 GL_EXTCALL(glGenBuffers(1, &pbo
));
569 GL_EXTCALL(glBindBuffer(GL_PIXEL_UNPACK_BUFFER
, pbo
));
570 GL_EXTCALL(glBufferData(GL_PIXEL_UNPACK_BUFFER
, sizeof(pattern
), pattern
, GL_STREAM_DRAW
));
571 checkGLcall("Specifying the PBO test pbo");
573 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
);
574 checkGLcall("Loading the PBO test texture");
576 GL_EXTCALL(glBindBuffer(GL_PIXEL_UNPACK_BUFFER
, 0));
578 gl_info
->gl_ops
.gl
.p_glFinish(); /* just to be sure */
580 memset(check
, 0, sizeof(check
));
581 gl_info
->gl_ops
.gl
.p_glGetTexImage(GL_TEXTURE_2D
, 0, GL_BGRA
, GL_UNSIGNED_INT_8_8_8_8_REV
, check
);
582 checkGLcall("Reading back the PBO test texture");
584 gl_info
->gl_ops
.gl
.p_glDeleteTextures(1, &texture
);
585 GL_EXTCALL(glDeleteBuffers(1, &pbo
));
586 checkGLcall("PBO test cleanup");
588 if (memcmp(check
, pattern
, sizeof(check
)))
590 WARN_(d3d_perf
)("PBO test failed, read back data doesn't match original.\n"
591 "Disabling PBOs. This may result in slower performance.\n");
592 gl_info
->supported
[ARB_PIXEL_BUFFER_OBJECT
] = FALSE
;
596 TRACE("PBO test successful.\n");
600 static BOOL
match_apple_intel(const struct wined3d_gl_info
*gl_info
, const char *gl_renderer
,
601 enum wined3d_gl_vendor gl_vendor
, enum wined3d_pci_vendor card_vendor
, enum wined3d_pci_device device
)
603 return (card_vendor
== HW_VENDOR_INTEL
) && (gl_vendor
== GL_VENDOR_APPLE
);
606 static BOOL
match_apple_nonr500ati(const struct wined3d_gl_info
*gl_info
, const char *gl_renderer
,
607 enum wined3d_gl_vendor gl_vendor
, enum wined3d_pci_vendor card_vendor
, enum wined3d_pci_device device
)
609 if (gl_vendor
!= GL_VENDOR_APPLE
) return FALSE
;
610 if (card_vendor
!= HW_VENDOR_AMD
) return FALSE
;
611 if (device
== CARD_AMD_RADEON_X1600
) return FALSE
;
615 static BOOL
match_dx10_capable(const struct wined3d_gl_info
*gl_info
, const char *gl_renderer
,
616 enum wined3d_gl_vendor gl_vendor
, enum wined3d_pci_vendor card_vendor
, enum wined3d_pci_device device
)
618 /* DX9 cards support 40 single float varyings in hardware, most drivers report 32. ATI misreports
619 * 44 varyings. So assume that if we have more than 44 varyings we have a dx10 card.
620 * This detection is for the gl_ClipPos varying quirk. If a d3d9 card really supports more than 44
621 * varyings and we subtract one in dx9 shaders it's not going to hurt us because the dx9 limit is
624 * dx10 cards usually have 64 varyings */
625 return gl_info
->limits
.glsl_varyings
> 44;
628 static BOOL
match_not_dx10_capable(const struct wined3d_gl_info
*gl_info
, const char *gl_renderer
,
629 enum wined3d_gl_vendor gl_vendor
, enum wined3d_pci_vendor card_vendor
, enum wined3d_pci_device device
)
631 return !match_dx10_capable(gl_info
, gl_renderer
, gl_vendor
, card_vendor
, device
);
634 /* A GL context is provided by the caller */
635 static BOOL
match_allows_spec_alpha(const struct wined3d_gl_info
*gl_info
, const char *gl_renderer
,
636 enum wined3d_gl_vendor gl_vendor
, enum wined3d_pci_vendor card_vendor
, enum wined3d_pci_device device
)
641 if (!gl_info
->supported
[EXT_SECONDARY_COLOR
])
644 while (gl_info
->gl_ops
.gl
.p_glGetError());
645 GL_EXTCALL(glSecondaryColorPointerEXT
)(4, GL_UNSIGNED_BYTE
, 4, data
);
646 error
= gl_info
->gl_ops
.gl
.p_glGetError();
648 if (error
== GL_NO_ERROR
)
650 TRACE("GL Implementation accepts 4 component specular color pointers\n");
655 TRACE("GL implementation does not accept 4 component specular colors, error %s\n",
656 debug_glerror(error
));
661 /* A GL context is provided by the caller */
662 static BOOL
match_broken_nv_clip(const struct wined3d_gl_info
*gl_info
, const char *gl_renderer
,
663 enum wined3d_gl_vendor gl_vendor
, enum wined3d_pci_vendor card_vendor
, enum wined3d_pci_device device
)
668 static const char testcode
[] =
670 "OPTION NV_vertex_program2;\n"
671 "MOV result.clip[0], 0.0;\n"
672 "MOV result.position, 0.0;\n"
675 if (!gl_info
->supported
[NV_VERTEX_PROGRAM2_OPTION
]) return FALSE
;
677 while (gl_info
->gl_ops
.gl
.p_glGetError());
679 GL_EXTCALL(glGenProgramsARB(1, &prog
));
682 ERR("Failed to create the NVvp clip test program\n");
685 GL_EXTCALL(glBindProgramARB(GL_VERTEX_PROGRAM_ARB
, prog
));
686 GL_EXTCALL(glProgramStringARB(GL_VERTEX_PROGRAM_ARB
, GL_PROGRAM_FORMAT_ASCII_ARB
,
687 strlen(testcode
), testcode
));
688 gl_info
->gl_ops
.gl
.p_glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB
, &pos
);
691 WARN("GL_NV_vertex_program2_option result.clip[] test failed\n");
692 TRACE("error: %s\n", debugstr_a((const char *)gl_info
->gl_ops
.gl
.p_glGetString(GL_PROGRAM_ERROR_STRING_ARB
)));
694 while (gl_info
->gl_ops
.gl
.p_glGetError());
696 else TRACE("GL_NV_vertex_program2_option result.clip[] test passed\n");
698 GL_EXTCALL(glBindProgramARB(GL_VERTEX_PROGRAM_ARB
, 0));
699 GL_EXTCALL(glDeleteProgramsARB(1, &prog
));
700 checkGLcall("GL_NV_vertex_program2_option result.clip[] test cleanup");
705 /* Context activation is done by the caller. */
706 static BOOL
match_fbo_tex_update(const struct wined3d_gl_info
*gl_info
, const char *gl_renderer
,
707 enum wined3d_gl_vendor gl_vendor
, enum wined3d_pci_vendor card_vendor
, enum wined3d_pci_device device
)
709 char data
[4 * 4 * 4];
713 if (wined3d_settings
.offscreen_rendering_mode
!= ORM_FBO
) return FALSE
;
715 memset(data
, 0xcc, sizeof(data
));
717 gl_info
->gl_ops
.gl
.p_glGenTextures(1, &tex
);
718 gl_info
->gl_ops
.gl
.p_glBindTexture(GL_TEXTURE_2D
, tex
);
719 gl_info
->gl_ops
.gl
.p_glTexParameteri(GL_TEXTURE_2D
, GL_TEXTURE_MIN_FILTER
, GL_NEAREST
);
720 gl_info
->gl_ops
.gl
.p_glTexParameteri(GL_TEXTURE_2D
, GL_TEXTURE_MAG_FILTER
, GL_NEAREST
);
721 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
);
722 checkGLcall("glTexImage2D");
724 gl_info
->fbo_ops
.glGenFramebuffers(1, &fbo
);
725 gl_info
->fbo_ops
.glBindFramebuffer(GL_FRAMEBUFFER
, fbo
);
726 gl_info
->fbo_ops
.glFramebufferTexture2D(GL_FRAMEBUFFER
, GL_COLOR_ATTACHMENT0
, GL_TEXTURE_2D
, tex
, 0);
727 checkGLcall("glFramebufferTexture2D");
729 status
= gl_info
->fbo_ops
.glCheckFramebufferStatus(GL_FRAMEBUFFER
);
730 if (status
!= GL_FRAMEBUFFER_COMPLETE
) ERR("FBO status %#x\n", status
);
731 checkGLcall("glCheckFramebufferStatus");
733 memset(data
, 0x11, sizeof(data
));
734 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
);
735 checkGLcall("glTexSubImage2D");
737 gl_info
->gl_ops
.gl
.p_glClearColor(0.996f
, 0.729f
, 0.745f
, 0.792f
);
738 gl_info
->gl_ops
.gl
.p_glClear(GL_COLOR_BUFFER_BIT
);
739 checkGLcall("glClear");
741 gl_info
->gl_ops
.gl
.p_glGetTexImage(GL_TEXTURE_2D
, 0, GL_BGRA
, GL_UNSIGNED_INT_8_8_8_8_REV
, data
);
742 checkGLcall("glGetTexImage");
744 gl_info
->fbo_ops
.glFramebufferTexture2D(GL_FRAMEBUFFER
, GL_COLOR_ATTACHMENT0
, GL_TEXTURE_2D
, 0, 0);
745 gl_info
->fbo_ops
.glBindFramebuffer(GL_FRAMEBUFFER
, 0);
746 gl_info
->gl_ops
.gl
.p_glBindTexture(GL_TEXTURE_2D
, 0);
747 checkGLcall("glBindTexture");
749 gl_info
->fbo_ops
.glDeleteFramebuffers(1, &fbo
);
750 gl_info
->gl_ops
.gl
.p_glDeleteTextures(1, &tex
);
751 checkGLcall("glDeleteTextures");
753 return *(DWORD
*)data
== 0x11111111;
756 /* Context activation is done by the caller. */
757 static BOOL
match_broken_rgba16(const struct wined3d_gl_info
*gl_info
, const char *gl_renderer
,
758 enum wined3d_gl_vendor gl_vendor
, enum wined3d_pci_vendor card_vendor
, enum wined3d_pci_device device
)
760 /* GL_RGBA16 uses GL_RGBA8 internally on Geforce 7 and older cards.
761 * This leads to graphical bugs in Half Life 2 and Unreal engine games. */
765 gl_info
->gl_ops
.gl
.p_glGenTextures(1, &tex
);
766 gl_info
->gl_ops
.gl
.p_glBindTexture(GL_TEXTURE_2D
, tex
);
767 gl_info
->gl_ops
.gl
.p_glTexImage2D(GL_TEXTURE_2D
, 0, GL_RGBA16
, 4, 4, 0, GL_RGBA
, GL_UNSIGNED_SHORT
, NULL
);
768 checkGLcall("glTexImage2D");
770 gl_info
->gl_ops
.gl
.p_glGetTexLevelParameteriv(GL_TEXTURE_2D
, 0, GL_TEXTURE_RED_SIZE
, &size
);
771 checkGLcall("glGetTexLevelParameteriv");
772 TRACE("Real color depth is %d\n", size
);
774 gl_info
->gl_ops
.gl
.p_glBindTexture(GL_TEXTURE_2D
, 0);
775 checkGLcall("glBindTexture");
776 gl_info
->gl_ops
.gl
.p_glDeleteTextures(1, &tex
);
777 checkGLcall("glDeleteTextures");
782 static BOOL
match_fglrx(const struct wined3d_gl_info
*gl_info
, const char *gl_renderer
,
783 enum wined3d_gl_vendor gl_vendor
, enum wined3d_pci_vendor card_vendor
, enum wined3d_pci_device device
)
785 return gl_vendor
== GL_VENDOR_FGLRX
;
788 static BOOL
match_r200(const struct wined3d_gl_info
*gl_info
, const char *gl_renderer
,
789 enum wined3d_gl_vendor gl_vendor
, enum wined3d_pci_vendor card_vendor
, enum wined3d_pci_device device
)
791 if (card_vendor
!= HW_VENDOR_AMD
) return FALSE
;
792 if (device
== CARD_AMD_RADEON_8500
) return TRUE
;
796 static BOOL
match_broken_arb_fog(const struct wined3d_gl_info
*gl_info
, const char *gl_renderer
,
797 enum wined3d_gl_vendor gl_vendor
, enum wined3d_pci_vendor card_vendor
, enum wined3d_pci_device device
)
802 float color
[4] = {0.0f
, 1.0f
, 0.0f
, 0.0f
};
805 static const char program_code
[] =
807 "OPTION ARB_fog_linear;\n"
808 "MOV result.color, {1.0, 0.0, 0.0, 0.0};\n"
811 if (wined3d_settings
.offscreen_rendering_mode
!= ORM_FBO
)
813 if (!gl_info
->supported
[ARB_FRAGMENT_PROGRAM
])
816 gl_info
->gl_ops
.gl
.p_glGenTextures(1, &tex
);
817 gl_info
->gl_ops
.gl
.p_glBindTexture(GL_TEXTURE_2D
, tex
);
818 gl_info
->gl_ops
.gl
.p_glTexParameteri(GL_TEXTURE_2D
, GL_TEXTURE_MIN_FILTER
, GL_NEAREST
);
819 gl_info
->gl_ops
.gl
.p_glTexParameteri(GL_TEXTURE_2D
, GL_TEXTURE_MAG_FILTER
, GL_NEAREST
);
820 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
);
821 checkGLcall("glTexImage2D");
823 gl_info
->fbo_ops
.glGenFramebuffers(1, &fbo
);
824 gl_info
->fbo_ops
.glBindFramebuffer(GL_FRAMEBUFFER
, fbo
);
825 gl_info
->fbo_ops
.glFramebufferTexture2D(GL_FRAMEBUFFER
, GL_COLOR_ATTACHMENT0
, GL_TEXTURE_2D
, tex
, 0);
826 checkGLcall("glFramebufferTexture2D");
828 status
= gl_info
->fbo_ops
.glCheckFramebufferStatus(GL_FRAMEBUFFER
);
829 if (status
!= GL_FRAMEBUFFER_COMPLETE
) ERR("FBO status %#x\n", status
);
830 checkGLcall("glCheckFramebufferStatus");
832 gl_info
->gl_ops
.gl
.p_glClearColor(0.0f
, 0.0f
, 1.0f
, 0.0f
);
833 gl_info
->gl_ops
.gl
.p_glClear(GL_COLOR_BUFFER_BIT
);
834 checkGLcall("glClear");
835 gl_info
->gl_ops
.gl
.p_glViewport(0, 0, 4, 1);
836 checkGLcall("glViewport");
838 gl_info
->gl_ops
.gl
.p_glEnable(GL_FOG
);
839 gl_info
->gl_ops
.gl
.p_glFogf(GL_FOG_START
, 0.5f
);
840 gl_info
->gl_ops
.gl
.p_glFogf(GL_FOG_END
, 0.5f
);
841 gl_info
->gl_ops
.gl
.p_glFogi(GL_FOG_MODE
, GL_LINEAR
);
842 gl_info
->gl_ops
.gl
.p_glHint(GL_FOG_HINT
, GL_NICEST
);
843 gl_info
->gl_ops
.gl
.p_glFogfv(GL_FOG_COLOR
, color
);
844 checkGLcall("fog setup");
846 GL_EXTCALL(glGenProgramsARB(1, &prog
));
847 GL_EXTCALL(glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB
, prog
));
848 GL_EXTCALL(glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB
, GL_PROGRAM_FORMAT_ASCII_ARB
,
849 strlen(program_code
), program_code
));
850 gl_info
->gl_ops
.gl
.p_glEnable(GL_FRAGMENT_PROGRAM_ARB
);
851 checkGLcall("Test fragment program setup");
853 gl_info
->gl_ops
.gl
.p_glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB
, &err_pos
);
856 const char *error_str
;
857 error_str
= (const char *)gl_info
->gl_ops
.gl
.p_glGetString(GL_PROGRAM_ERROR_STRING_ARB
);
858 FIXME("Fog test program error at position %d: %s\n\n", err_pos
, debugstr_a(error_str
));
861 gl_info
->gl_ops
.gl
.p_glBegin(GL_TRIANGLE_STRIP
);
862 gl_info
->gl_ops
.gl
.p_glVertex3f(-1.0f
, -1.0f
, 0.0f
);
863 gl_info
->gl_ops
.gl
.p_glVertex3f( 1.0f
, -1.0f
, 1.0f
);
864 gl_info
->gl_ops
.gl
.p_glVertex3f(-1.0f
, 1.0f
, 0.0f
);
865 gl_info
->gl_ops
.gl
.p_glVertex3f( 1.0f
, 1.0f
, 1.0f
);
866 gl_info
->gl_ops
.gl
.p_glEnd();
867 checkGLcall("ARBfp fog test draw");
869 gl_info
->gl_ops
.gl
.p_glGetTexImage(GL_TEXTURE_2D
, 0, GL_BGRA
, GL_UNSIGNED_INT_8_8_8_8_REV
, data
);
870 checkGLcall("glGetTexImage");
871 data
[0] &= 0x00ffffff;
872 data
[1] &= 0x00ffffff;
873 data
[2] &= 0x00ffffff;
874 data
[3] &= 0x00ffffff;
876 gl_info
->fbo_ops
.glBindFramebuffer(GL_FRAMEBUFFER
, 0);
877 gl_info
->gl_ops
.gl
.p_glBindTexture(GL_TEXTURE_2D
, 0);
879 gl_info
->fbo_ops
.glDeleteFramebuffers(1, &fbo
);
880 gl_info
->gl_ops
.gl
.p_glDeleteTextures(1, &tex
);
881 gl_info
->gl_ops
.gl
.p_glDisable(GL_FOG
);
882 GL_EXTCALL(glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB
, 0));
883 gl_info
->gl_ops
.gl
.p_glDisable(GL_FRAGMENT_PROGRAM_ARB
);
884 GL_EXTCALL(glDeleteProgramsARB(1, &prog
));
885 checkGLcall("ARBfp fog test teardown");
887 TRACE("Fog test data: %08x %08x %08x %08x\n", data
[0], data
[1], data
[2], data
[3]);
888 return data
[0] != 0x00ff0000 || data
[3] != 0x0000ff00;
891 static void quirk_apple_glsl_constants(struct wined3d_gl_info
*gl_info
)
893 /* MacOS needs uniforms for relative addressing offsets. This can accumulate to quite a few uniforms.
894 * Beyond that the general uniform isn't optimal, so reserve a number of uniforms. 12 vec4's should
895 * allow 48 different offsets or other helper immediate values. */
896 TRACE("Reserving 12 GLSL constants for compiler private use.\n");
897 gl_info
->reserved_glsl_constants
= max(gl_info
->reserved_glsl_constants
, 12);
900 static void quirk_amd_dx9(struct wined3d_gl_info
*gl_info
)
902 /* MacOS advertises GL_ARB_texture_non_power_of_two on ATI r500 and earlier cards, although
903 * these cards only support GL_ARB_texture_rectangle(D3DPTEXTURECAPS_NONPOW2CONDITIONAL).
904 * If real NP2 textures are used, the driver falls back to software. We could just remove the
905 * extension and use GL_ARB_texture_rectangle instead, but texture_rectangle is inconvenient
906 * due to the non-normalized texture coordinates. Thus set an internal extension flag,
907 * GL_WINE_normalized_texrect, which signals the code that it can use non power of two textures
908 * as per GL_ARB_texture_non_power_of_two, but has to stick to the texture_rectangle limits.
910 * fglrx doesn't advertise GL_ARB_texture_non_power_of_two, but it advertises opengl 2.0 which
911 * has this extension promoted to core. The extension loading code sets this extension supported
912 * due to that, so this code works on fglrx as well. */
913 if(gl_info
->supported
[ARB_TEXTURE_NON_POWER_OF_TWO
])
915 TRACE("GL_ARB_texture_non_power_of_two advertised on R500 or earlier card, removing.\n");
916 gl_info
->supported
[ARB_TEXTURE_NON_POWER_OF_TWO
] = FALSE
;
917 gl_info
->supported
[WINED3D_GL_NORMALIZED_TEXRECT
] = TRUE
;
921 static void quirk_no_np2(struct wined3d_gl_info
*gl_info
)
923 /* The nVidia GeForceFX series reports OpenGL 2.0 capabilities with the latest drivers versions, but
924 * doesn't explicitly advertise the ARB_tex_npot extension in the GL extension string.
925 * This usually means that ARB_tex_npot is supported in hardware as long as the application is staying
926 * within the limits enforced by the ARB_texture_rectangle extension. This however is not true for the
927 * FX series, which instantly falls back to a slower software path as soon as ARB_tex_npot is used.
928 * We therefore completely remove ARB_tex_npot from the list of supported extensions.
930 * Note that wine_normalized_texrect can't be used in this case because internally it uses ARB_tex_npot,
931 * triggering the software fallback. There is not much we can do here apart from disabling the
932 * software-emulated extension and re-enable ARB_tex_rect (which was previously disabled
933 * in wined3d_adapter_init_gl_caps).
934 * This fixup removes performance problems on both the FX 5900 and FX 5700 (e.g. for framebuffer
935 * post-processing effects in the game "Max Payne 2").
936 * The behaviour can be verified through a simple test app attached in bugreport #14724. */
937 TRACE("GL_ARB_texture_non_power_of_two advertised through OpenGL 2.0 on NV FX card, removing.\n");
938 gl_info
->supported
[ARB_TEXTURE_NON_POWER_OF_TWO
] = FALSE
;
939 gl_info
->supported
[ARB_TEXTURE_RECTANGLE
] = TRUE
;
942 static void quirk_texcoord_w(struct wined3d_gl_info
*gl_info
)
944 /* The Intel GPUs on MacOS set the .w register of texcoords to 0.0 by default, which causes problems
945 * with fixed function fragment processing. Ideally this flag should be detected with a test shader
946 * and OpenGL feedback mode, but some GL implementations (MacOS ATI at least, probably all MacOS ones)
947 * do not like vertex shaders in feedback mode and return an error, even though it should be valid
948 * according to the spec.
950 * We don't want to enable this on all cards, as it adds an extra instruction per texcoord used. This
951 * makes the shader slower and eats instruction slots which should be available to the d3d app.
953 * ATI Radeon HD 2xxx cards on MacOS have the issue. Instead of checking for the buggy cards, blacklist
954 * all radeon cards on Macs and whitelist the good ones. That way we're prepared for the future. If
955 * this workaround is activated on cards that do not need it, it won't break things, just affect
956 * performance negatively. */
957 TRACE("Enabling vertex texture coord fixes in vertex shaders.\n");
958 gl_info
->quirks
|= WINED3D_QUIRK_SET_TEXCOORD_W
;
961 static void quirk_clip_varying(struct wined3d_gl_info
*gl_info
)
963 gl_info
->quirks
|= WINED3D_QUIRK_GLSL_CLIP_VARYING
;
966 static void quirk_allows_specular_alpha(struct wined3d_gl_info
*gl_info
)
968 gl_info
->quirks
|= WINED3D_QUIRK_ALLOWS_SPECULAR_ALPHA
;
971 static void quirk_disable_nvvp_clip(struct wined3d_gl_info
*gl_info
)
973 gl_info
->quirks
|= WINED3D_QUIRK_NV_CLIP_BROKEN
;
976 static void quirk_fbo_tex_update(struct wined3d_gl_info
*gl_info
)
978 gl_info
->quirks
|= WINED3D_QUIRK_FBO_TEX_UPDATE
;
981 static void quirk_broken_rgba16(struct wined3d_gl_info
*gl_info
)
983 gl_info
->quirks
|= WINED3D_QUIRK_BROKEN_RGBA16
;
986 static void quirk_infolog_spam(struct wined3d_gl_info
*gl_info
)
988 gl_info
->quirks
|= WINED3D_QUIRK_INFO_LOG_SPAM
;
991 static void quirk_limited_tex_filtering(struct wined3d_gl_info
*gl_info
)
993 /* Nvidia GeForce 6xxx and 7xxx support accelerated VTF only on a few
994 selected texture formats. They are apparently the only DX9 class GPUs
996 Also, DX9-era GPUs are somewhat limited with float textures
997 filtering and blending. */
998 gl_info
->quirks
|= WINED3D_QUIRK_LIMITED_TEX_FILTERING
;
1001 static void quirk_r200_constants(struct wined3d_gl_info
*gl_info
)
1003 /* The Mesa r200 driver (and there is no other driver for this GPU Wine would run on)
1004 * loads some fog parameters (start, end, exponent, but not the color) into the
1007 * Apparently the fog hardware is only able to handle linear fog with a range of 0.0;1.0,
1008 * and it is the responsibility of the vertex pipeline to handle non-linear fog and
1009 * linear fog with start and end other than 0.0 and 1.0. */
1010 TRACE("Reserving 1 ARB constant for compiler private use.\n");
1011 gl_info
->reserved_arb_constants
= max(gl_info
->reserved_arb_constants
, 1);
1014 static void quirk_broken_arb_fog(struct wined3d_gl_info
*gl_info
)
1016 gl_info
->quirks
|= WINED3D_QUIRK_BROKEN_ARB_FOG
;
1021 BOOL (*match
)(const struct wined3d_gl_info
*gl_info
, const char *gl_renderer
,
1022 enum wined3d_gl_vendor gl_vendor
, enum wined3d_pci_vendor card_vendor
, enum wined3d_pci_device device
);
1023 void (*apply
)(struct wined3d_gl_info
*gl_info
);
1024 const char *description
;
1027 static const struct driver_quirk quirk_table
[] =
1030 match_amd_r300_to_500
,
1032 "AMD normalized texrect quirk"
1036 quirk_apple_glsl_constants
,
1037 "Apple GLSL uniform override"
1042 "Geforce 5 NP2 disable"
1047 "Init texcoord .w for Apple Intel GPU driver"
1050 match_apple_nonr500ati
,
1052 "Init texcoord .w for Apple ATI >= r600 GPU driver"
1057 "Reserved varying for gl_ClipPos"
1060 /* GL_EXT_secondary_color does not allow 4 component secondary colors, but most
1061 * GL implementations accept it. The Mac GL is the only implementation known to
1064 * If we can pass 4 component specular colors, do it, because (a) we don't have
1065 * to screw around with the data, and (b) the D3D fixed function vertex pipeline
1066 * passes specular alpha to the pixel shader if any is used. Otherwise the
1067 * specular alpha is used to pass the fog coordinate, which we pass to opengl
1068 * via GL_EXT_fog_coord.
1070 match_allows_spec_alpha
,
1071 quirk_allows_specular_alpha
,
1072 "Allow specular alpha quirk"
1075 match_broken_nv_clip
,
1076 quirk_disable_nvvp_clip
,
1077 "Apple NV_vertex_program clip bug quirk"
1080 match_fbo_tex_update
,
1081 quirk_fbo_tex_update
,
1082 "FBO rebind for attachment updates"
1085 match_broken_rgba16
,
1086 quirk_broken_rgba16
,
1087 "True RGBA16 is not available"
1092 "Not printing GLSL infolog"
1095 match_not_dx10_capable
,
1096 quirk_limited_tex_filtering
,
1097 "Texture filtering, blending and VTF support is limited"
1101 quirk_r200_constants
,
1102 "r200 vertex shader constants"
1105 match_broken_arb_fog
,
1106 quirk_broken_arb_fog
,
1107 "ARBfp fogstart == fogend workaround"
1111 /* Certain applications (Steam) complain if we report an outdated driver version. In general,
1112 * reporting a driver version is moot because we are not the Windows driver, and we have different
1113 * bugs, features, etc.
1115 * The driver version has the form "x.y.z.w".
1117 * "x" is the Windows version the driver is meant for:
1124 * "y" is the maximum Direct3D version the driver supports.
1125 * y -> d3d version mapping:
1134 * "z" is the subversion number.
1136 * "w" is the vendor specific driver build number.
1139 struct driver_version_information
1141 enum wined3d_display_driver driver
;
1142 enum wined3d_driver_model driver_model
;
1143 const char *driver_name
; /* name of Windows driver */
1144 WORD version
; /* version word ('y'), contained in low word of DriverVersion.HighPart */
1145 WORD subversion
; /* subversion word ('z'), contained in high word of DriverVersion.LowPart */
1146 WORD build
; /* build number ('w'), contained in low word of DriverVersion.LowPart */
1149 /* The driver version table contains driver information for different devices on several OS versions. */
1150 static const struct driver_version_information driver_version_table
[] =
1153 * - Radeon HD2x00 (R600) and up supported by current drivers.
1154 * - Radeon 9500 (R300) - X1*00 (R5xx) supported up to Catalyst 9.3 (Linux) and 10.2 (XP/Vista/Win7)
1155 * - Radeon 7xxx (R100) - 9250 (RV250) supported up to Catalyst 6.11 (XP)
1156 * - Rage 128 supported up to XP, latest official build 6.13.3279 dated October 2001 */
1157 {DRIVER_AMD_RAGE_128PRO
, DRIVER_MODEL_NT5X
, "ati2dvaa.dll", 13, 3279, 0},
1158 {DRIVER_AMD_R100
, DRIVER_MODEL_NT5X
, "ati2dvag.dll", 14, 10, 6614},
1159 {DRIVER_AMD_R300
, DRIVER_MODEL_NT5X
, "ati2dvag.dll", 14, 10, 6764},
1160 {DRIVER_AMD_R600
, DRIVER_MODEL_NT5X
, "ati2dvag.dll", 17, 10, 1280},
1161 {DRIVER_AMD_R300
, DRIVER_MODEL_NT6X
, "atiumdag.dll", 14, 10, 741 },
1162 {DRIVER_AMD_R600
, DRIVER_MODEL_NT6X
, "atiumdag.dll", 17, 10, 1280},
1165 * The drivers are unified but not all versions support all GPUs. At some point the 2k/xp
1166 * drivers used ialmrnt5.dll for GMA800/GMA900 but at some point the file was renamed to
1167 * igxprd32.dll but the GMA800 driver was never updated. */
1168 {DRIVER_INTEL_GMA800
, DRIVER_MODEL_NT5X
, "ialmrnt5.dll", 14, 10, 3889},
1169 {DRIVER_INTEL_GMA900
, DRIVER_MODEL_NT5X
, "igxprd32.dll", 14, 10, 4764},
1170 {DRIVER_INTEL_GMA950
, DRIVER_MODEL_NT5X
, "igxprd32.dll", 14, 10, 4926},
1171 {DRIVER_INTEL_GMA3000
, DRIVER_MODEL_NT5X
, "igxprd32.dll", 14, 10, 5218},
1172 {DRIVER_INTEL_GMA950
, DRIVER_MODEL_NT6X
, "igdumd32.dll", 14, 10, 1504},
1173 {DRIVER_INTEL_GMA3000
, DRIVER_MODEL_NT6X
, "igdumd32.dll", 15, 10, 1666},
1174 {DRIVER_INTEL_HD4000
, DRIVER_MODEL_NT6X
, "igdumdim32.dll", 19, 15, 4352},
1177 * - Geforce8 and newer is supported by the current 340.52 driver on XP-Win8
1178 * - Geforce6 and 7 support is up to 307.83 on XP-Win8
1179 * - GeforceFX support is up to 173.x on <= XP
1180 * - Geforce2MX/3/4 up to 96.x on <= XP
1181 * - TNT/Geforce1/2 up to 71.x on <= XP
1182 * All version numbers used below are from the Linux nvidia drivers. */
1183 {DRIVER_NVIDIA_TNT
, DRIVER_MODEL_NT5X
, "nv4_disp.dll", 14, 10, 7186},
1184 {DRIVER_NVIDIA_GEFORCE2MX
, DRIVER_MODEL_NT5X
, "nv4_disp.dll", 14, 10, 9371},
1185 {DRIVER_NVIDIA_GEFORCEFX
, DRIVER_MODEL_NT5X
, "nv4_disp.dll", 14, 11, 7516},
1186 {DRIVER_NVIDIA_GEFORCE6
, DRIVER_MODEL_NT5X
, "nv4_disp.dll", 18, 13, 783},
1187 {DRIVER_NVIDIA_GEFORCE8
, DRIVER_MODEL_NT5X
, "nv4_disp.dll", 18, 13, 4052},
1188 {DRIVER_NVIDIA_GEFORCE6
, DRIVER_MODEL_NT6X
, "nvd3dum.dll", 18, 13, 783},
1189 {DRIVER_NVIDIA_GEFORCE8
, DRIVER_MODEL_NT6X
, "nvd3dum.dll", 18, 13, 4052},
1192 {DRIVER_VMWARE
, DRIVER_MODEL_NT5X
, "vm3dum.dll", 14, 1, 1134},
1195 struct gpu_description
1197 WORD vendor
; /* reported PCI card vendor ID */
1198 WORD card
; /* reported PCI card device ID */
1199 const char *description
; /* Description of the card e.g. NVIDIA RIVA TNT */
1200 enum wined3d_display_driver driver
;
1201 unsigned int vidmem
;
1204 /* The amount of video memory stored in the gpu description table is the minimum amount of video memory
1205 * found on a board containing a specific GPU. */
1206 static const struct gpu_description gpu_description_table
[] =
1209 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_RIVA_128
, "NVIDIA RIVA 128", DRIVER_NVIDIA_TNT
, 4 },
1210 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_RIVA_TNT
, "NVIDIA RIVA TNT", DRIVER_NVIDIA_TNT
, 16 },
1211 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_RIVA_TNT2
, "NVIDIA RIVA TNT2/TNT2 Pro", DRIVER_NVIDIA_TNT
, 32 },
1212 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE
, "NVIDIA GeForce 256", DRIVER_NVIDIA_TNT
, 32 },
1213 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE2
, "NVIDIA GeForce2 GTS/GeForce2 Pro", DRIVER_NVIDIA_TNT
, 32 },
1214 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE2_MX
, "NVIDIA GeForce2 MX/MX 400", DRIVER_NVIDIA_GEFORCE2MX
,32 },
1215 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE3
, "NVIDIA GeForce3", DRIVER_NVIDIA_GEFORCE2MX
,64 },
1216 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE4_MX
, "NVIDIA GeForce4 MX 460", DRIVER_NVIDIA_GEFORCE2MX
,64 },
1217 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE4_TI4200
, "NVIDIA GeForce4 Ti 4200", DRIVER_NVIDIA_GEFORCE2MX
,64, },
1218 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCEFX_5200
, "NVIDIA GeForce FX 5200", DRIVER_NVIDIA_GEFORCEFX
, 64 },
1219 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCEFX_5600
, "NVIDIA GeForce FX 5600", DRIVER_NVIDIA_GEFORCEFX
, 128 },
1220 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCEFX_5800
, "NVIDIA GeForce FX 5800", DRIVER_NVIDIA_GEFORCEFX
, 256 },
1221 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_6200
, "NVIDIA GeForce 6200", DRIVER_NVIDIA_GEFORCE6
, 64 },
1222 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_6600GT
, "NVIDIA GeForce 6600 GT", DRIVER_NVIDIA_GEFORCE6
, 128 },
1223 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_6800
, "NVIDIA GeForce 6800", DRIVER_NVIDIA_GEFORCE6
, 128 },
1224 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_7300
, "NVIDIA GeForce Go 7300", DRIVER_NVIDIA_GEFORCE6
, 256 },
1225 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_7400
, "NVIDIA GeForce Go 7400", DRIVER_NVIDIA_GEFORCE6
, 256 },
1226 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_7600
, "NVIDIA GeForce 7600 GT", DRIVER_NVIDIA_GEFORCE6
, 256 },
1227 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_7800GT
, "NVIDIA GeForce 7800 GT", DRIVER_NVIDIA_GEFORCE6
, 256 },
1228 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_8200
, "NVIDIA GeForce 8200", DRIVER_NVIDIA_GEFORCE8
, 512 },
1229 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_8300GS
, "NVIDIA GeForce 8300 GS", DRIVER_NVIDIA_GEFORCE8
, 128 },
1230 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_8400GS
, "NVIDIA GeForce 8400 GS", DRIVER_NVIDIA_GEFORCE8
, 128 },
1231 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_8500GT
, "NVIDIA GeForce 8500 GT", DRIVER_NVIDIA_GEFORCE8
, 256 },
1232 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_8600GT
, "NVIDIA GeForce 8600 GT", DRIVER_NVIDIA_GEFORCE8
, 256 },
1233 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_8600MGT
, "NVIDIA GeForce 8600M GT", DRIVER_NVIDIA_GEFORCE8
, 512 },
1234 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_8800GTS
, "NVIDIA GeForce 8800 GTS", DRIVER_NVIDIA_GEFORCE8
, 320 },
1235 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_8800GTX
, "NVIDIA GeForce 8800 GTX", DRIVER_NVIDIA_GEFORCE8
, 768 },
1236 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_9200
, "NVIDIA GeForce 9200", DRIVER_NVIDIA_GEFORCE8
, 256 },
1237 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_9300
, "NVIDIA GeForce 9300", DRIVER_NVIDIA_GEFORCE8
, 256 },
1238 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_9400M
, "NVIDIA GeForce 9400M", DRIVER_NVIDIA_GEFORCE8
, 256 },
1239 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_9400GT
, "NVIDIA GeForce 9400 GT", DRIVER_NVIDIA_GEFORCE8
, 256 },
1240 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_9500GT
, "NVIDIA GeForce 9500 GT", DRIVER_NVIDIA_GEFORCE8
, 256 },
1241 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_9600GT
, "NVIDIA GeForce 9600 GT", DRIVER_NVIDIA_GEFORCE8
, 512 },
1242 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_9700MGT
, "NVIDIA GeForce 9700M GT", DRIVER_NVIDIA_GEFORCE8
, 512 },
1243 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_9800GT
, "NVIDIA GeForce 9800 GT", DRIVER_NVIDIA_GEFORCE8
, 512 },
1244 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_210
, "NVIDIA GeForce 210", DRIVER_NVIDIA_GEFORCE8
, 512 },
1245 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT220
, "NVIDIA GeForce GT 220", DRIVER_NVIDIA_GEFORCE8
, 512 },
1246 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT240
, "NVIDIA GeForce GT 240", DRIVER_NVIDIA_GEFORCE8
, 512 },
1247 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTS250
, "NVIDIA GeForce GTS 250", DRIVER_NVIDIA_GEFORCE8
, 1024},
1248 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX260
, "NVIDIA GeForce GTX 260", DRIVER_NVIDIA_GEFORCE8
, 1024},
1249 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX275
, "NVIDIA GeForce GTX 275", DRIVER_NVIDIA_GEFORCE8
, 896 },
1250 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX280
, "NVIDIA GeForce GTX 280", DRIVER_NVIDIA_GEFORCE8
, 1024},
1251 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_315M
, "NVIDIA GeForce 315M", DRIVER_NVIDIA_GEFORCE8
, 512 },
1252 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_320M
, "NVIDIA GeForce 320M", DRIVER_NVIDIA_GEFORCE8
, 256},
1253 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT320M
, "NVIDIA GeForce GT 320M", DRIVER_NVIDIA_GEFORCE8
, 1024},
1254 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT325M
, "NVIDIA GeForce GT 325M", DRIVER_NVIDIA_GEFORCE8
, 1024},
1255 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT330
, "NVIDIA GeForce GT 330", DRIVER_NVIDIA_GEFORCE8
, 1024},
1256 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTS350M
, "NVIDIA GeForce GTS 350M", DRIVER_NVIDIA_GEFORCE8
, 1024},
1257 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_410M
, "NVIDIA GeForce 410M", DRIVER_NVIDIA_GEFORCE8
, 512},
1258 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT420
, "NVIDIA GeForce GT 420", DRIVER_NVIDIA_GEFORCE8
, 2048},
1259 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT425M
, "NVIDIA GeForce GT 425M", DRIVER_NVIDIA_GEFORCE8
, 1024},
1260 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT430
, "NVIDIA GeForce GT 430", DRIVER_NVIDIA_GEFORCE8
, 1024},
1261 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT440
, "NVIDIA GeForce GT 440", DRIVER_NVIDIA_GEFORCE8
, 1024},
1262 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTS450
, "NVIDIA GeForce GTS 450", DRIVER_NVIDIA_GEFORCE8
, 1024},
1263 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX460
, "NVIDIA GeForce GTX 460", DRIVER_NVIDIA_GEFORCE8
, 768 },
1264 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX460M
, "NVIDIA GeForce GTX 460M", DRIVER_NVIDIA_GEFORCE8
, 1536},
1265 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX465
, "NVIDIA GeForce GTX 465", DRIVER_NVIDIA_GEFORCE8
, 1024},
1266 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX470
, "NVIDIA GeForce GTX 470", DRIVER_NVIDIA_GEFORCE8
, 1280},
1267 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX480
, "NVIDIA GeForce GTX 480", DRIVER_NVIDIA_GEFORCE8
, 1536},
1268 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT520
, "NVIDIA GeForce GT 520", DRIVER_NVIDIA_GEFORCE8
, 1024},
1269 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT540M
, "NVIDIA GeForce GT 540M", DRIVER_NVIDIA_GEFORCE8
, 1024},
1270 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX550
, "NVIDIA GeForce GTX 550 Ti", DRIVER_NVIDIA_GEFORCE8
, 1024},
1271 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT555M
, "NVIDIA GeForce GT 555M", DRIVER_NVIDIA_GEFORCE8
, 1024},
1272 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX560TI
, "NVIDIA GeForce GTX 560 Ti", DRIVER_NVIDIA_GEFORCE8
, 1024},
1273 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX560
, "NVIDIA GeForce GTX 560", DRIVER_NVIDIA_GEFORCE8
, 1024},
1274 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX570
, "NVIDIA GeForce GTX 570", DRIVER_NVIDIA_GEFORCE8
, 1280},
1275 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX580
, "NVIDIA GeForce GTX 580", DRIVER_NVIDIA_GEFORCE8
, 1536},
1276 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT610
, "NVIDIA GeForce GT 610", DRIVER_NVIDIA_GEFORCE8
, 1024},
1277 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT630
, "NVIDIA GeForce GT 630", DRIVER_NVIDIA_GEFORCE8
, 1024},
1278 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT630M
, "NVIDIA GeForce GT 630M", DRIVER_NVIDIA_GEFORCE8
, 1024},
1279 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT640M
, "NVIDIA GeForce GT 640M", DRIVER_NVIDIA_GEFORCE8
, 1024},
1280 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT650M
, "NVIDIA GeForce GT 650M", DRIVER_NVIDIA_GEFORCE8
, 2048},
1281 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX650
, "NVIDIA GeForce GTX 650", DRIVER_NVIDIA_GEFORCE8
, 1024},
1282 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX650TI
, "NVIDIA GeForce GTX 650 Ti", DRIVER_NVIDIA_GEFORCE8
, 1024},
1283 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX660
, "NVIDIA GeForce GTX 660", DRIVER_NVIDIA_GEFORCE8
, 2048},
1284 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX660M
, "NVIDIA GeForce GTX 660M", DRIVER_NVIDIA_GEFORCE8
, 2048},
1285 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX660TI
, "NVIDIA GeForce GTX 660 Ti", DRIVER_NVIDIA_GEFORCE8
, 2048},
1286 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX670
, "NVIDIA GeForce GTX 670", DRIVER_NVIDIA_GEFORCE8
, 2048},
1287 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX670MX
, "NVIDIA GeForce GTX 670MX", DRIVER_NVIDIA_GEFORCE8
, 3072},
1288 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX675MX
, "NVIDIA GeForce GTX 675MX", DRIVER_NVIDIA_GEFORCE8
, 4096},
1289 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX680
, "NVIDIA GeForce GTX 680", DRIVER_NVIDIA_GEFORCE8
, 2048},
1290 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX690
, "NVIDIA GeForce GTX 690", DRIVER_NVIDIA_GEFORCE8
, 2048},
1291 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT730
, "NVIDIA GeForce GT 730", DRIVER_NVIDIA_GEFORCE8
, 2048},
1292 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT730M
, "NVIDIA GeForce GT 730M", DRIVER_NVIDIA_GEFORCE8
, 1024},
1293 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT740M
, "NVIDIA GeForce GT 740M", DRIVER_NVIDIA_GEFORCE8
, 2048},
1294 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT750M
, "NVIDIA GeForce GT 750M", DRIVER_NVIDIA_GEFORCE8
, 1024},
1295 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX750
, "NVIDIA GeForce GTX 750", DRIVER_NVIDIA_GEFORCE8
, 1024},
1296 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX750TI
, "NVIDIA GeForce GTX 750 Ti", DRIVER_NVIDIA_GEFORCE8
, 2048},
1297 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX760
, "NVIDIA GeForce GTX 760", DRIVER_NVIDIA_GEFORCE8
, 2048},
1298 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX760TI
, "NVIDIA GeForce GTX 760 Ti", DRIVER_NVIDIA_GEFORCE8
, 2048},
1299 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX765M
, "NVIDIA GeForce GTX 765M", DRIVER_NVIDIA_GEFORCE8
, 2048},
1300 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX770M
, "NVIDIA GeForce GTX 770M", DRIVER_NVIDIA_GEFORCE8
, 3072},
1301 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX770
, "NVIDIA GeForce GTX 770", DRIVER_NVIDIA_GEFORCE8
, 2048},
1302 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX780
, "NVIDIA GeForce GTX 780", DRIVER_NVIDIA_GEFORCE8
, 3072},
1303 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX780TI
, "NVIDIA GeForce GTX 780 Ti", DRIVER_NVIDIA_GEFORCE8
, 3072},
1304 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTXTITAN
, "NVIDIA GeForce GTX TITAN", DRIVER_NVIDIA_GEFORCE8
, 6144},
1305 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTXTITANB
, "NVIDIA GeForce GTX TITAN Black", DRIVER_NVIDIA_GEFORCE8
, 6144},
1306 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTXTITANX
, "NVIDIA GeForce GTX TITAN X", DRIVER_NVIDIA_GEFORCE8
, 12288},
1307 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTXTITANZ
, "NVIDIA GeForce GTX TITAN Z", DRIVER_NVIDIA_GEFORCE8
, 12288},
1308 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_820M
, "NVIDIA GeForce 820M", DRIVER_NVIDIA_GEFORCE8
, 2048},
1309 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_830M
, "NVIDIA GeForce 830M", DRIVER_NVIDIA_GEFORCE8
, 2048},
1310 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_840M
, "NVIDIA GeForce 840M", DRIVER_NVIDIA_GEFORCE8
, 2048},
1311 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_845M
, "NVIDIA GeForce 845M", DRIVER_NVIDIA_GEFORCE8
, 2048},
1312 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX850M
, "NVIDIA GeForce GTX 850M", DRIVER_NVIDIA_GEFORCE8
, 2048},
1313 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX860M
, "NVIDIA GeForce GTX 860M", DRIVER_NVIDIA_GEFORCE8
, 2048},
1314 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX870M
, "NVIDIA GeForce GTX 870M", DRIVER_NVIDIA_GEFORCE8
, 3072},
1315 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX880M
, "NVIDIA GeForce GTX 880M", DRIVER_NVIDIA_GEFORCE8
, 4096},
1316 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX950
, "NVIDIA GeForce GTX 950", DRIVER_NVIDIA_GEFORCE8
, 2048},
1317 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX950M
, "NVIDIA GeForce GTX 950M", DRIVER_NVIDIA_GEFORCE8
, 4096},
1318 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX960
, "NVIDIA GeForce GTX 960", DRIVER_NVIDIA_GEFORCE8
, 4096},
1319 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX960M
, "NVIDIA GeForce GTX 960M", DRIVER_NVIDIA_GEFORCE8
, 2048},
1320 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX970
, "NVIDIA GeForce GTX 970", DRIVER_NVIDIA_GEFORCE8
, 4096},
1321 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX970M
, "NVIDIA GeForce GTX 970M", DRIVER_NVIDIA_GEFORCE8
, 3072},
1322 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX980
, "NVIDIA GeForce GTX 980", DRIVER_NVIDIA_GEFORCE8
, 4096},
1323 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX980TI
, "NVIDIA GeForce GTX 980 Ti", DRIVER_NVIDIA_GEFORCE8
, 6144},
1324 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX1060
, "NVIDIA GeForce GTX 1060", DRIVER_NVIDIA_GEFORCE8
, 6144},
1325 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX1070
, "NVIDIA GeForce GTX 1070", DRIVER_NVIDIA_GEFORCE8
, 8192},
1326 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX1080
, "NVIDIA GeForce GTX 1080", DRIVER_NVIDIA_GEFORCE8
, 8192},
1329 {HW_VENDOR_AMD
, CARD_AMD_RAGE_128PRO
, "ATI Rage Fury", DRIVER_AMD_RAGE_128PRO
, 16 },
1330 {HW_VENDOR_AMD
, CARD_AMD_RADEON_7200
, "ATI RADEON 7200 SERIES", DRIVER_AMD_R100
, 32 },
1331 {HW_VENDOR_AMD
, CARD_AMD_RADEON_8500
, "ATI RADEON 8500 SERIES", DRIVER_AMD_R100
, 64 },
1332 {HW_VENDOR_AMD
, CARD_AMD_RADEON_9500
, "ATI Radeon 9500", DRIVER_AMD_R300
, 64 },
1333 {HW_VENDOR_AMD
, CARD_AMD_RADEON_XPRESS_200M
, "ATI RADEON XPRESS 200M Series", DRIVER_AMD_R300
, 64 },
1334 {HW_VENDOR_AMD
, CARD_AMD_RADEON_X700
, "ATI Radeon X700 SE", DRIVER_AMD_R300
, 128 },
1335 {HW_VENDOR_AMD
, CARD_AMD_RADEON_X1600
, "ATI Radeon X1600 Series", DRIVER_AMD_R300
, 128 },
1336 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD2350
, "ATI Mobility Radeon HD 2350", DRIVER_AMD_R600
, 256 },
1337 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD2600
, "ATI Mobility Radeon HD 2600", DRIVER_AMD_R600
, 256 },
1338 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD2900
, "ATI Radeon HD 2900 XT", DRIVER_AMD_R600
, 512 },
1339 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD3200
, "ATI Radeon HD 3200 Graphics", DRIVER_AMD_R600
, 128 },
1340 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD3850
, "ATI Radeon HD 3850 AGP", DRIVER_AMD_R600
, 512 },
1341 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD4200M
, "ATI Mobility Radeon HD 4200", DRIVER_AMD_R600
, 256 },
1342 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD4350
, "ATI Radeon HD 4350", DRIVER_AMD_R600
, 256 },
1343 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD4600
, "ATI Radeon HD 4600 Series", DRIVER_AMD_R600
, 512 },
1344 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD4700
, "ATI Radeon HD 4700 Series", DRIVER_AMD_R600
, 512 },
1345 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD4800
, "ATI Radeon HD 4800 Series", DRIVER_AMD_R600
, 512 },
1346 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD5400
, "ATI Radeon HD 5400 Series", DRIVER_AMD_R600
, 512 },
1347 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD5600
, "ATI Radeon HD 5600 Series", DRIVER_AMD_R600
, 512 },
1348 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD5700
, "ATI Radeon HD 5700 Series", DRIVER_AMD_R600
, 512 },
1349 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD5800
, "ATI Radeon HD 5800 Series", DRIVER_AMD_R600
, 1024},
1350 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD5900
, "ATI Radeon HD 5900 Series", DRIVER_AMD_R600
, 1024},
1351 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD6300
, "AMD Radeon HD 6300 series Graphics", DRIVER_AMD_R600
, 1024},
1352 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD6400
, "AMD Radeon HD 6400 Series", DRIVER_AMD_R600
, 1024},
1353 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD6410D
, "AMD Radeon HD 6410D", DRIVER_AMD_R600
, 1024},
1354 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD6480G
, "AMD Radeon HD 6480G", DRIVER_AMD_R600
, 512 },
1355 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD6550D
, "AMD Radeon HD 6550D", DRIVER_AMD_R600
, 1024},
1356 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD6600
, "AMD Radeon HD 6600 Series", DRIVER_AMD_R600
, 1024},
1357 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD6600M
, "AMD Radeon HD 6600M Series", DRIVER_AMD_R600
, 512 },
1358 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD6700
, "AMD Radeon HD 6700 Series", DRIVER_AMD_R600
, 1024},
1359 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD6800
, "AMD Radeon HD 6800 Series", DRIVER_AMD_R600
, 1024},
1360 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD6900
, "AMD Radeon HD 6900 Series", DRIVER_AMD_R600
, 2048},
1361 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD7660D
, "AMD Radeon HD 7660D", DRIVER_AMD_R600
, 2048},
1362 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD7700
, "AMD Radeon HD 7700 Series", DRIVER_AMD_R600
, 1024},
1363 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD7800
, "AMD Radeon HD 7800 Series", DRIVER_AMD_R600
, 2048},
1364 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD7900
, "AMD Radeon HD 7900 Series", DRIVER_AMD_R600
, 2048},
1365 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD8600M
, "AMD Radeon HD 8600M Series", DRIVER_AMD_R600
, 1024},
1366 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD8670
, "AMD Radeon HD 8670", DRIVER_AMD_R600
, 2048},
1367 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD8770
, "AMD Radeon HD 8770", DRIVER_AMD_R600
, 2048},
1368 {HW_VENDOR_AMD
, CARD_AMD_RADEON_R3
, "AMD Radeon HD 8400 / R3 Series", DRIVER_AMD_R600
, 2048},
1369 {HW_VENDOR_AMD
, CARD_AMD_RADEON_R7
, "AMD Radeon(TM) R7 Graphics", DRIVER_AMD_R600
, 2048},
1370 {HW_VENDOR_AMD
, CARD_AMD_RADEON_R9
, "AMD Radeon R9 290", DRIVER_AMD_R600
, 4096},
1373 {HW_VENDOR_VMWARE
, CARD_VMWARE_SVGA3D
, "VMware SVGA 3D (Microsoft Corporation - WDDM)", DRIVER_VMWARE
, 1024},
1376 {HW_VENDOR_INTEL
, CARD_INTEL_830M
, "Intel(R) 82830M Graphics Controller", DRIVER_INTEL_GMA800
, 32 },
1377 {HW_VENDOR_INTEL
, CARD_INTEL_855GM
, "Intel(R) 82852/82855 GM/GME Graphics Controller", DRIVER_INTEL_GMA800
, 32 },
1378 {HW_VENDOR_INTEL
, CARD_INTEL_845G
, "Intel(R) 845G", DRIVER_INTEL_GMA800
, 32 },
1379 {HW_VENDOR_INTEL
, CARD_INTEL_865G
, "Intel(R) 82865G Graphics Controller", DRIVER_INTEL_GMA800
, 32 },
1380 {HW_VENDOR_INTEL
, CARD_INTEL_915G
, "Intel(R) 82915G/GV/910GL Express Chipset Family", DRIVER_INTEL_GMA900
, 64 },
1381 {HW_VENDOR_INTEL
, CARD_INTEL_E7221G
, "Intel(R) E7221G", DRIVER_INTEL_GMA900
, 64 },
1382 {HW_VENDOR_INTEL
, CARD_INTEL_915GM
, "Mobile Intel(R) 915GM/GMS,910GML Express Chipset Family", DRIVER_INTEL_GMA900
, 64 },
1383 {HW_VENDOR_INTEL
, CARD_INTEL_945G
, "Intel(R) 945G", DRIVER_INTEL_GMA950
, 64 },
1384 {HW_VENDOR_INTEL
, CARD_INTEL_945GM
, "Mobile Intel(R) 945GM Express Chipset Family", DRIVER_INTEL_GMA950
, 64 },
1385 {HW_VENDOR_INTEL
, CARD_INTEL_945GME
, "Intel(R) 945GME", DRIVER_INTEL_GMA950
, 64 },
1386 {HW_VENDOR_INTEL
, CARD_INTEL_Q35
, "Intel(R) Q35", DRIVER_INTEL_GMA950
, 64 },
1387 {HW_VENDOR_INTEL
, CARD_INTEL_G33
, "Intel(R) G33", DRIVER_INTEL_GMA950
, 64 },
1388 {HW_VENDOR_INTEL
, CARD_INTEL_Q33
, "Intel(R) Q33", DRIVER_INTEL_GMA950
, 64 },
1389 {HW_VENDOR_INTEL
, CARD_INTEL_PNVG
, "Intel(R) IGD", DRIVER_INTEL_GMA950
, 64 },
1390 {HW_VENDOR_INTEL
, CARD_INTEL_PNVM
, "Intel(R) IGD", DRIVER_INTEL_GMA950
, 64 },
1391 {HW_VENDOR_INTEL
, CARD_INTEL_965Q
, "Intel(R) 965Q", DRIVER_INTEL_GMA3000
, 128},
1392 {HW_VENDOR_INTEL
, CARD_INTEL_965G
, "Intel(R) 965G", DRIVER_INTEL_GMA3000
, 128},
1393 {HW_VENDOR_INTEL
, CARD_INTEL_946GZ
, "Intel(R) 946GZ", DRIVER_INTEL_GMA3000
, 128},
1394 {HW_VENDOR_INTEL
, CARD_INTEL_965GM
, "Mobile Intel(R) 965 Express Chipset Family", DRIVER_INTEL_GMA3000
, 128},
1395 {HW_VENDOR_INTEL
, CARD_INTEL_965GME
, "Intel(R) 965GME", DRIVER_INTEL_GMA3000
, 128},
1396 {HW_VENDOR_INTEL
, CARD_INTEL_GM45
, "Mobile Intel(R) GM45 Express Chipset Family", DRIVER_INTEL_GMA3000
, 512},
1397 {HW_VENDOR_INTEL
, CARD_INTEL_IGD
, "Intel(R) Integrated Graphics Device", DRIVER_INTEL_GMA3000
, 512},
1398 {HW_VENDOR_INTEL
, CARD_INTEL_G45
, "Intel(R) G45/G43", DRIVER_INTEL_GMA3000
, 512},
1399 {HW_VENDOR_INTEL
, CARD_INTEL_Q45
, "Intel(R) Q45/Q43", DRIVER_INTEL_GMA3000
, 512},
1400 {HW_VENDOR_INTEL
, CARD_INTEL_G41
, "Intel(R) G41", DRIVER_INTEL_GMA3000
, 512},
1401 {HW_VENDOR_INTEL
, CARD_INTEL_B43
, "Intel(R) B43", DRIVER_INTEL_GMA3000
, 512},
1402 {HW_VENDOR_INTEL
, CARD_INTEL_ILKD
, "Intel(R) HD Graphics", DRIVER_INTEL_GMA3000
, 1536},
1403 {HW_VENDOR_INTEL
, CARD_INTEL_ILKM
, "Intel(R) HD Graphics", DRIVER_INTEL_GMA3000
, 1536},
1404 {HW_VENDOR_INTEL
, CARD_INTEL_SNBD
, "Intel(R) HD Graphics 3000", DRIVER_INTEL_GMA3000
, 1536},
1405 {HW_VENDOR_INTEL
, CARD_INTEL_SNBM
, "Intel(R) HD Graphics 3000", DRIVER_INTEL_GMA3000
, 1536},
1406 {HW_VENDOR_INTEL
, CARD_INTEL_SNBS
, "Intel(R) HD Graphics Family", DRIVER_INTEL_GMA3000
, 1536},
1407 {HW_VENDOR_INTEL
, CARD_INTEL_IVBD
, "Intel(R) HD Graphics 4000", DRIVER_INTEL_HD4000
, 1536},
1408 {HW_VENDOR_INTEL
, CARD_INTEL_IVBM
, "Intel(R) HD Graphics 4000", DRIVER_INTEL_HD4000
, 1536},
1409 {HW_VENDOR_INTEL
, CARD_INTEL_IVBS
, "Intel(R) HD Graphics Family", DRIVER_INTEL_HD4000
, 1536},
1410 {HW_VENDOR_INTEL
, CARD_INTEL_HWD
, "Intel(R) HD Graphics 4600", DRIVER_INTEL_HD4000
, 1536},
1411 {HW_VENDOR_INTEL
, CARD_INTEL_HWM
, "Intel(R) HD Graphics 4600", DRIVER_INTEL_HD4000
, 1536},
1412 {HW_VENDOR_INTEL
, CARD_INTEL_HD5300
, "Intel(R) HD Graphics 5300", DRIVER_INTEL_HD4000
, 2048},
1413 {HW_VENDOR_INTEL
, CARD_INTEL_HD5500
, "Intel(R) HD Graphics 5500", DRIVER_INTEL_HD4000
, 2048},
1414 {HW_VENDOR_INTEL
, CARD_INTEL_HD5600
, "Intel(R) HD Graphics 5600", DRIVER_INTEL_HD4000
, 2048},
1415 {HW_VENDOR_INTEL
, CARD_INTEL_HD6000
, "Intel(R) HD Graphics 6000", DRIVER_INTEL_HD4000
, 2048},
1416 {HW_VENDOR_INTEL
, CARD_INTEL_I6100
, "Intel(R) Iris(TM) Graphics 6100", DRIVER_INTEL_HD4000
, 2048},
1417 {HW_VENDOR_INTEL
, CARD_INTEL_IP6200
, "Intel(R) Iris(TM) Pro Graphics 6200", DRIVER_INTEL_HD4000
, 2048},
1418 {HW_VENDOR_INTEL
, CARD_INTEL_IPP6300
, "Intel(R) Iris(TM) Pro Graphics P6300", DRIVER_INTEL_HD4000
, 2048},
1419 {HW_VENDOR_INTEL
, CARD_INTEL_HD510_1
, "Intel(R) HD Graphics 510", DRIVER_INTEL_HD4000
, 2048},
1420 {HW_VENDOR_INTEL
, CARD_INTEL_HD510_2
, "Intel(R) HD Graphics 510", DRIVER_INTEL_HD4000
, 2048},
1421 {HW_VENDOR_INTEL
, CARD_INTEL_HD510_3
, "Intel(R) HD Graphics 510", DRIVER_INTEL_HD4000
, 2048},
1422 {HW_VENDOR_INTEL
, CARD_INTEL_HD515
, "Intel(R) HD Graphics 515", DRIVER_INTEL_HD4000
, 2048},
1423 {HW_VENDOR_INTEL
, CARD_INTEL_HD520_1
, "Intel(R) HD Graphics 520", DRIVER_INTEL_HD4000
, 2048},
1424 {HW_VENDOR_INTEL
, CARD_INTEL_HD520_2
, "Intel(R) HD Graphics 520", DRIVER_INTEL_HD4000
, 2048},
1425 {HW_VENDOR_INTEL
, CARD_INTEL_HD530_1
, "Intel(R) HD Graphics 530", DRIVER_INTEL_HD4000
, 2048},
1426 {HW_VENDOR_INTEL
, CARD_INTEL_HD530_2
, "Intel(R) HD Graphics 530", DRIVER_INTEL_HD4000
, 2048},
1427 {HW_VENDOR_INTEL
, CARD_INTEL_HDP530
, "Intel(R) HD Graphics P530", DRIVER_INTEL_HD4000
, 2048},
1428 {HW_VENDOR_INTEL
, CARD_INTEL_I540
, "Intel(R) Iris(TM) Graphics 540", DRIVER_INTEL_HD4000
, 2048},
1429 {HW_VENDOR_INTEL
, CARD_INTEL_I550
, "Intel(R) Iris(TM) Graphics 550", DRIVER_INTEL_HD4000
, 2048},
1430 {HW_VENDOR_INTEL
, CARD_INTEL_I555
, "Intel(R) Iris(TM) Graphics 555", DRIVER_INTEL_HD4000
, 2048},
1431 {HW_VENDOR_INTEL
, CARD_INTEL_IP555
, "Intel(R) Iris(TM) Graphics P555", DRIVER_INTEL_HD4000
, 2048},
1432 {HW_VENDOR_INTEL
, CARD_INTEL_IP580_1
, "Intel(R) Iris(TM) Pro Graphics 580", DRIVER_INTEL_HD4000
, 2048},
1433 {HW_VENDOR_INTEL
, CARD_INTEL_IP580_2
, "Intel(R) Iris(TM) Pro Graphics 580", DRIVER_INTEL_HD4000
, 2048},
1434 {HW_VENDOR_INTEL
, CARD_INTEL_IPP580_1
, "Intel(R) Iris(TM) Pro Graphics P580", DRIVER_INTEL_HD4000
, 2048},
1435 {HW_VENDOR_INTEL
, CARD_INTEL_IPP580_2
, "Intel(R) Iris(TM) Pro Graphics P580", DRIVER_INTEL_HD4000
, 2048},
1438 static const struct driver_version_information
*get_driver_version_info(enum wined3d_display_driver driver
,
1439 enum wined3d_driver_model driver_model
)
1443 TRACE("Looking up version info for driver=%d driver_model=%d\n", driver
, driver_model
);
1444 for (i
= 0; i
< (sizeof(driver_version_table
) / sizeof(driver_version_table
[0])); i
++)
1446 const struct driver_version_information
*entry
= &driver_version_table
[i
];
1448 if (entry
->driver
== driver
&& (driver_model
== DRIVER_MODEL_GENERIC
1449 || entry
->driver_model
== driver_model
))
1451 TRACE("Found driver \"%s\", version %u, subversion %u, build %u.\n",
1452 entry
->driver_name
, entry
->version
, entry
->subversion
, entry
->build
);
1459 static const struct gpu_description
*get_gpu_description(enum wined3d_pci_vendor vendor
,
1460 enum wined3d_pci_device device
)
1464 for (i
= 0; i
< (sizeof(gpu_description_table
) / sizeof(*gpu_description_table
)); ++i
)
1466 if (vendor
== gpu_description_table
[i
].vendor
&& device
== gpu_description_table
[i
].card
)
1467 return &gpu_description_table
[i
];
1473 static const struct gpu_description
*query_gpu_description(const struct wined3d_gl_info
*gl_info
, UINT64
*vram_bytes
)
1475 enum wined3d_pci_vendor vendor
= PCI_VENDOR_NONE
;
1476 enum wined3d_pci_device device
= PCI_DEVICE_NONE
;
1477 const struct gpu_description
*gpu_description
;
1478 static unsigned int once
;
1480 if (gl_info
->supported
[WGL_WINE_QUERY_RENDERER
])
1484 if (GL_EXTCALL(wglQueryCurrentRendererIntegerWINE(WGL_RENDERER_VENDOR_ID_WINE
, &value
)))
1486 if (GL_EXTCALL(wglQueryCurrentRendererIntegerWINE(WGL_RENDERER_DEVICE_ID_WINE
, &value
)))
1488 if (GL_EXTCALL(wglQueryCurrentRendererIntegerWINE(WGL_RENDERER_VIDEO_MEMORY_WINE
, &value
)))
1489 *vram_bytes
= (UINT64
)value
* 1024 * 1024;
1490 TRACE("Card reports vendor PCI ID 0x%04x, device PCI ID 0x%04x, 0x%s bytes of video memory.\n",
1491 vendor
, device
, wine_dbgstr_longlong(*vram_bytes
));
1494 if (wined3d_settings
.pci_vendor_id
!= PCI_VENDOR_NONE
)
1496 vendor
= wined3d_settings
.pci_vendor_id
;
1497 TRACE("Overriding vendor PCI ID with 0x%04x.\n", vendor
);
1500 if (wined3d_settings
.pci_device_id
!= PCI_DEVICE_NONE
)
1502 device
= wined3d_settings
.pci_device_id
;
1503 TRACE("Overriding device PCI ID with 0x%04x.\n", device
);
1506 if (wined3d_settings
.emulated_textureram
)
1508 *vram_bytes
= wined3d_settings
.emulated_textureram
;
1509 TRACE("Overriding amount of video memory with 0x%s bytes.\n",
1510 wine_dbgstr_longlong(*vram_bytes
));
1513 if (!(gpu_description
= get_gpu_description(vendor
, device
))
1514 && (wined3d_settings
.pci_vendor_id
!= PCI_VENDOR_NONE
1515 || wined3d_settings
.pci_device_id
!= PCI_DEVICE_NONE
) && !once
++)
1516 ERR_(winediag
)("Invalid GPU override %04x:%04x specified, ignoring.\n", vendor
, device
);
1518 return gpu_description
;
1521 static void init_driver_info(struct wined3d_driver_info
*driver_info
,
1522 const struct gpu_description
*gpu_desc
, UINT64 vram_bytes
)
1524 OSVERSIONINFOW os_version
;
1525 WORD driver_os_version
;
1526 enum wined3d_display_driver driver
;
1527 enum wined3d_driver_model driver_model
;
1528 const struct driver_version_information
*version_info
;
1530 memset(&os_version
, 0, sizeof(os_version
));
1531 os_version
.dwOSVersionInfoSize
= sizeof(os_version
);
1532 if (!GetVersionExW(&os_version
))
1534 ERR("Failed to get OS version, reporting 2000/XP.\n");
1535 driver_os_version
= 6;
1536 driver_model
= DRIVER_MODEL_NT5X
;
1540 TRACE("OS version %u.%u.\n", os_version
.dwMajorVersion
, os_version
.dwMinorVersion
);
1541 switch (os_version
.dwMajorVersion
)
1544 /* If needed we could distinguish between 9x and NT4, but this code won't make
1545 * sense for NT4 since it had no way to obtain this info through DirectDraw 3.0.
1547 driver_os_version
= 4;
1548 driver_model
= DRIVER_MODEL_WIN9X
;
1552 driver_os_version
= 6;
1553 driver_model
= DRIVER_MODEL_NT5X
;
1557 if (os_version
.dwMinorVersion
== 0)
1559 driver_os_version
= 7;
1560 driver_model
= DRIVER_MODEL_NT6X
;
1562 else if (os_version
.dwMinorVersion
== 1)
1564 driver_os_version
= 8;
1565 driver_model
= DRIVER_MODEL_NT6X
;
1569 if (os_version
.dwMinorVersion
> 2)
1571 FIXME("Unhandled OS version %u.%u, reporting Win 8.\n",
1572 os_version
.dwMajorVersion
, os_version
.dwMinorVersion
);
1574 driver_os_version
= 9;
1575 driver_model
= DRIVER_MODEL_NT6X
;
1580 driver_os_version
= 10;
1581 driver_model
= DRIVER_MODEL_NT6X
;
1585 FIXME("Unhandled OS version %u.%u, reporting 2000/XP.\n",
1586 os_version
.dwMajorVersion
, os_version
.dwMinorVersion
);
1587 driver_os_version
= 6;
1588 driver_model
= DRIVER_MODEL_NT5X
;
1593 driver_info
->vendor
= gpu_desc
->vendor
;
1594 driver_info
->device
= gpu_desc
->card
;
1595 driver_info
->description
= gpu_desc
->description
;
1596 driver_info
->vram_bytes
= vram_bytes
? vram_bytes
: (UINT64
)gpu_desc
->vidmem
* 1024 * 1024;
1597 driver
= gpu_desc
->driver
;
1600 * Diablo 2 crashes when the amount of video memory is greater than 0x7fffffff.
1601 * In order to avoid this application bug we limit the amount of video memory
1602 * to LONG_MAX for older Windows versions.
1604 if (driver_model
< DRIVER_MODEL_NT6X
&& driver_info
->vram_bytes
> LONG_MAX
)
1606 TRACE("Limiting amount of video memory to %#lx bytes for OS version older than Vista.\n", LONG_MAX
);
1607 driver_info
->vram_bytes
= LONG_MAX
;
1610 /* Try to obtain driver version information for the current Windows version. This fails in
1612 * - the gpu is not available on the currently selected OS version:
1613 * - Geforce GTX480 on Win98. When running applications in compatibility mode on Windows,
1614 * version information for the current Windows version is returned instead of faked info.
1615 * We do the same and assume the default Windows version to emulate is WinXP.
1617 * - Videocard is a Riva TNT but winver is set to win7 (there are no drivers for this beast)
1618 * For now return the XP driver info. Perhaps later on we should return VESA.
1620 * - the gpu is not in our database (can happen when the user overrides the vendor_id / device_id)
1621 * This could be an indication that our database is not up to date, so this should be fixed.
1623 if ((version_info
= get_driver_version_info(driver
, driver_model
))
1624 || (version_info
= get_driver_version_info(driver
, DRIVER_MODEL_GENERIC
)))
1626 driver_info
->name
= version_info
->driver_name
;
1627 driver_info
->version_high
= MAKEDWORD_VERSION(driver_os_version
, version_info
->version
);
1628 driver_info
->version_low
= MAKEDWORD_VERSION(version_info
->subversion
, version_info
->build
);
1632 ERR("No driver version info found for device %04x:%04x, driver model %#x.\n",
1633 driver_info
->vendor
, driver_info
->device
, driver_model
);
1634 driver_info
->name
= "Display";
1635 driver_info
->version_high
= MAKEDWORD_VERSION(driver_os_version
, 15);
1636 driver_info
->version_low
= MAKEDWORD_VERSION(8, 6); /* Nvidia RIVA TNT, arbitrary */
1639 TRACE("Reporting (fake) driver version 0x%08x-0x%08x.\n",
1640 driver_info
->version_high
, driver_info
->version_low
);
1643 /* Context activation is done by the caller. */
1644 static void fixup_extensions(struct wined3d_gl_info
*gl_info
, const char *gl_renderer
,
1645 enum wined3d_gl_vendor gl_vendor
, enum wined3d_pci_vendor card_vendor
, enum wined3d_pci_device device
)
1649 for (i
= 0; i
< (sizeof(quirk_table
) / sizeof(*quirk_table
)); ++i
)
1651 if (!quirk_table
[i
].match(gl_info
, gl_renderer
, gl_vendor
, card_vendor
, device
)) continue;
1652 TRACE("Applying driver quirk \"%s\".\n", quirk_table
[i
].description
);
1653 quirk_table
[i
].apply(gl_info
);
1656 /* Find out if PBOs work as they are supposed to. */
1657 test_pbo_functionality(gl_info
);
1660 static DWORD
wined3d_parse_gl_version(const char *gl_version
)
1662 const char *ptr
= gl_version
;
1667 ERR("Invalid OpenGL major version %d.\n", major
);
1669 while (isdigit(*ptr
)) ++ptr
;
1671 ERR("Invalid OpenGL version string %s.\n", debugstr_a(gl_version
));
1675 TRACE("Found OpenGL version %d.%d.\n", major
, minor
);
1677 return MAKEDWORD_VERSION(major
, minor
);
1680 static enum wined3d_gl_vendor
wined3d_guess_gl_vendor(const struct wined3d_gl_info
*gl_info
,
1681 const char *gl_vendor_string
, const char *gl_renderer
)
1683 /* MacOS has various specialities in the extensions it advertises. Some have to be loaded from
1684 * the opengl 1.2+ core, while other extensions are advertised, but software emulated. So try to
1685 * detect the Apple OpenGL implementation to apply some extension fixups afterwards.
1687 * Detecting this isn't really easy. The vendor string doesn't mention Apple. Compile-time checks
1688 * aren't sufficient either because a Linux binary may display on a macos X server via remote X11.
1689 * So try to detect the GL implementation by looking at certain Apple extensions. Some extensions
1690 * like client storage might be supported on other implementations too, but GL_APPLE_flush_render
1691 * is specific to the Mac OS X window management, and GL_APPLE_ycbcr_422 is QuickTime specific. So
1692 * the chance that other implementations support them is rather small since Win32 QuickTime uses
1693 * DirectDraw, not OpenGL. */
1694 if (gl_info
->supported
[APPLE_FENCE
] && gl_info
->supported
[APPLE_YCBCR_422
])
1695 return GL_VENDOR_APPLE
;
1697 if (strstr(gl_vendor_string
, "NVIDIA"))
1698 return GL_VENDOR_NVIDIA
;
1700 if (strstr(gl_vendor_string
, "ATI"))
1701 return GL_VENDOR_FGLRX
;
1703 if (strstr(gl_vendor_string
, "Mesa")
1704 || strstr(gl_vendor_string
, "X.Org")
1705 || strstr(gl_vendor_string
, "Advanced Micro Devices, Inc.")
1706 || strstr(gl_vendor_string
, "DRI R300 Project")
1707 || strstr(gl_vendor_string
, "Tungsten Graphics, Inc")
1708 || strstr(gl_vendor_string
, "VMware, Inc.")
1709 || strstr(gl_vendor_string
, "Intel")
1710 || strstr(gl_renderer
, "Mesa")
1711 || strstr(gl_renderer
, "Gallium")
1712 || strstr(gl_renderer
, "Intel"))
1713 return GL_VENDOR_MESA
;
1715 FIXME("Received unrecognized GL_VENDOR %s. Returning GL_VENDOR_UNKNOWN.\n",
1716 debugstr_a(gl_vendor_string
));
1718 return GL_VENDOR_UNKNOWN
;
1721 static enum wined3d_pci_vendor
wined3d_guess_card_vendor(const char *gl_vendor_string
, const char *gl_renderer
)
1723 if (strstr(gl_vendor_string
, "NVIDIA")
1724 || strstr(gl_vendor_string
, "Nouveau")
1725 || strstr(gl_vendor_string
, "nouveau"))
1726 return HW_VENDOR_NVIDIA
;
1728 if (strstr(gl_vendor_string
, "ATI")
1729 || strstr(gl_vendor_string
, "Advanced Micro Devices, Inc.")
1730 || strstr(gl_vendor_string
, "X.Org R300 Project")
1731 || strstr(gl_renderer
, "AMD")
1732 || strstr(gl_renderer
, "R100")
1733 || strstr(gl_renderer
, "R200")
1734 || strstr(gl_renderer
, "R300")
1735 || strstr(gl_renderer
, "R600")
1736 || strstr(gl_renderer
, "R700"))
1737 return HW_VENDOR_AMD
;
1739 if (strstr(gl_vendor_string
, "Intel(R)")
1740 /* Intel switched from Intel(R) to Intel® recently, so just match Intel. */
1741 || strstr(gl_renderer
, "Intel")
1742 || strstr(gl_renderer
, "i915")
1743 || strstr(gl_vendor_string
, "Intel Inc."))
1744 return HW_VENDOR_INTEL
;
1746 if (strstr(gl_renderer
, "SVGA3D"))
1747 return HW_VENDOR_VMWARE
;
1749 if (strstr(gl_vendor_string
, "Mesa")
1750 || strstr(gl_vendor_string
, "Brian Paul")
1751 || strstr(gl_vendor_string
, "Tungsten Graphics, Inc")
1752 || strstr(gl_vendor_string
, "VMware, Inc."))
1753 return HW_VENDOR_SOFTWARE
;
1755 FIXME("Received unrecognized GL_VENDOR %s. Returning HW_VENDOR_NVIDIA.\n", debugstr_a(gl_vendor_string
));
1757 return HW_VENDOR_NVIDIA
;
1760 static enum wined3d_d3d_level
d3d_level_from_caps(const struct shader_caps
*shader_caps
, const struct fragment_caps
*fragment_caps
, DWORD glsl_version
)
1762 if (shader_caps
->vs_version
>= 5)
1763 return WINED3D_D3D_LEVEL_11
;
1764 if (shader_caps
->vs_version
== 4)
1765 return WINED3D_D3D_LEVEL_10
;
1766 if (shader_caps
->vs_version
== 3)
1768 /* wined3d with default settings at the moment doesn't expose SM4+ on
1770 if (glsl_version
>= MAKEDWORD_VERSION(4, 30))
1771 return WINED3D_D3D_LEVEL_11
;
1772 if (glsl_version
>= MAKEDWORD_VERSION(1, 30))
1773 return WINED3D_D3D_LEVEL_10
;
1774 return WINED3D_D3D_LEVEL_9_SM3
;
1776 if (shader_caps
->vs_version
== 2)
1777 return WINED3D_D3D_LEVEL_9_SM2
;
1778 if (shader_caps
->vs_version
== 1)
1779 return WINED3D_D3D_LEVEL_8
;
1781 if (fragment_caps
->TextureOpCaps
& WINED3DTEXOPCAPS_DOTPRODUCT3
)
1782 return WINED3D_D3D_LEVEL_7
;
1783 if (fragment_caps
->MaxSimultaneousTextures
> 1)
1784 return WINED3D_D3D_LEVEL_6
;
1786 return WINED3D_D3D_LEVEL_5
;
1789 static const struct wined3d_renderer_table
1791 const char *renderer
;
1792 enum wined3d_pci_device id
;
1794 cards_nvidia_binary
[] =
1797 {"GTX 1080", CARD_NVIDIA_GEFORCE_GTX1080
}, /* GeForce 1000 - highend */
1798 {"GTX 1070", CARD_NVIDIA_GEFORCE_GTX1070
}, /* GeForce 1000 - highend */
1799 {"GTX 1060", CARD_NVIDIA_GEFORCE_GTX1060
}, /* GeForce 1000 - midend high */
1800 {"GTX 980 Ti", CARD_NVIDIA_GEFORCE_GTX980TI
}, /* GeForce 900 - highend */
1801 {"GTX 980", CARD_NVIDIA_GEFORCE_GTX980
}, /* GeForce 900 - highend */
1802 {"GTX 970M", CARD_NVIDIA_GEFORCE_GTX970M
}, /* GeForce 900 - highend mobile*/
1803 {"GTX 970", CARD_NVIDIA_GEFORCE_GTX970
}, /* GeForce 900 - highend */
1804 {"GTX TITAN X", CARD_NVIDIA_GEFORCE_GTXTITANX
}, /* Geforce 900 - highend */
1805 {"GTX 960M", CARD_NVIDIA_GEFORCE_GTX960M
}, /* GeForce 900 - midend high mobile */
1806 {"GTX 960", CARD_NVIDIA_GEFORCE_GTX960
}, /* GeForce 900 - midend high */
1807 {"GTX 950M", CARD_NVIDIA_GEFORCE_GTX950M
}, /* GeForce 900 - midend mobile */
1808 {"GTX 950", CARD_NVIDIA_GEFORCE_GTX950
}, /* GeForce 900 - midend */
1809 {"GTX 880M", CARD_NVIDIA_GEFORCE_GTX880M
}, /* GeForce 800 - mobile */
1810 {"GTX 870M", CARD_NVIDIA_GEFORCE_GTX870M
}, /* GeForce 800 - mobile */
1811 {"GTX 860M", CARD_NVIDIA_GEFORCE_GTX860M
}, /* GeForce 800 - mobile */
1812 {"GTX 850M", CARD_NVIDIA_GEFORCE_GTX850M
}, /* GeForce 800 - mobile */
1813 {"GeForce 845M", CARD_NVIDIA_GEFORCE_845M
}, /* GeForce 800 - mobile */
1814 {"GeForce 840M", CARD_NVIDIA_GEFORCE_840M
}, /* GeForce 800 - mobile */
1815 {"GeForce 830M", CARD_NVIDIA_GEFORCE_830M
}, /* GeForce 800 - mobile */
1816 {"GeForce 820M", CARD_NVIDIA_GEFORCE_820M
}, /* GeForce 800 - mobile */
1817 {"GTX 780 Ti", CARD_NVIDIA_GEFORCE_GTX780TI
}, /* Geforce 700 - highend */
1818 {"GTX TITAN Black", CARD_NVIDIA_GEFORCE_GTXTITANB
}, /* Geforce 700 - highend */
1819 {"GTX TITAN Z", CARD_NVIDIA_GEFORCE_GTXTITANZ
}, /* Geforce 700 - highend */
1820 {"GTX TITAN", CARD_NVIDIA_GEFORCE_GTXTITAN
}, /* Geforce 700 - highend */
1821 {"GTX 780", CARD_NVIDIA_GEFORCE_GTX780
}, /* Geforce 700 - highend */
1822 {"GTX 770M", CARD_NVIDIA_GEFORCE_GTX770M
}, /* Geforce 700 - midend high mobile */
1823 {"GTX 770", CARD_NVIDIA_GEFORCE_GTX770
}, /* Geforce 700 - highend */
1824 {"GTX 765M", CARD_NVIDIA_GEFORCE_GTX765M
}, /* Geforce 700 - midend high mobile */
1825 {"GTX 760 Ti", CARD_NVIDIA_GEFORCE_GTX760TI
}, /* Geforce 700 - midend high */
1826 {"GTX 760", CARD_NVIDIA_GEFORCE_GTX760
}, /* Geforce 700 - midend high */
1827 {"GTX 750 Ti", CARD_NVIDIA_GEFORCE_GTX750TI
}, /* Geforce 700 - midend */
1828 {"GTX 750", CARD_NVIDIA_GEFORCE_GTX750
}, /* Geforce 700 - midend */
1829 {"GT 750M", CARD_NVIDIA_GEFORCE_GT750M
}, /* Geforce 700 - midend mobile */
1830 {"GT 740M", CARD_NVIDIA_GEFORCE_GT740M
}, /* Geforce 700 - midend mobile */
1831 {"GT 730M", CARD_NVIDIA_GEFORCE_GT730M
}, /* Geforce 700 - midend mobile */
1832 {"GT 730", CARD_NVIDIA_GEFORCE_GT730
}, /* Geforce 700 - lowend */
1833 {"GTX 690", CARD_NVIDIA_GEFORCE_GTX690
}, /* Geforce 600 - highend */
1834 {"GTX 680", CARD_NVIDIA_GEFORCE_GTX680
}, /* Geforce 600 - highend */
1835 {"GTX 675MX", CARD_NVIDIA_GEFORCE_GTX675MX
}, /* Geforce 600 - highend */
1836 {"GTX 670MX", CARD_NVIDIA_GEFORCE_GTX670MX
}, /* Geforce 600 - highend */
1837 {"GTX 670", CARD_NVIDIA_GEFORCE_GTX670
}, /* Geforce 600 - midend high */
1838 {"GTX 660 Ti", CARD_NVIDIA_GEFORCE_GTX660TI
}, /* Geforce 600 - midend high */
1839 {"GTX 660M", CARD_NVIDIA_GEFORCE_GTX660M
}, /* Geforce 600 - midend high mobile */
1840 {"GTX 660", CARD_NVIDIA_GEFORCE_GTX660
}, /* Geforce 600 - midend high */
1841 {"GTX 650 Ti", CARD_NVIDIA_GEFORCE_GTX650TI
}, /* Geforce 600 - lowend */
1842 {"GTX 650", CARD_NVIDIA_GEFORCE_GTX650
}, /* Geforce 600 - lowend */
1843 {"GT 650M", CARD_NVIDIA_GEFORCE_GT650M
}, /* Geforce 600 - midend mobile */
1844 {"GT 640M", CARD_NVIDIA_GEFORCE_GT640M
}, /* Geforce 600 - midend mobile */
1845 {"GT 630M", CARD_NVIDIA_GEFORCE_GT630M
}, /* Geforce 600 - midend mobile */
1846 {"GT 630", CARD_NVIDIA_GEFORCE_GT630
}, /* Geforce 600 - lowend */
1847 {"GT 610", CARD_NVIDIA_GEFORCE_GT610
}, /* Geforce 600 - lowend */
1848 {"GTX 580", CARD_NVIDIA_GEFORCE_GTX580
}, /* Geforce 500 - highend */
1849 {"GTX 570", CARD_NVIDIA_GEFORCE_GTX570
}, /* Geforce 500 - midend high */
1850 {"GTX 560 Ti", CARD_NVIDIA_GEFORCE_GTX560TI
}, /* Geforce 500 - midend */
1851 {"GTX 560", CARD_NVIDIA_GEFORCE_GTX560
}, /* Geforce 500 - midend */
1852 {"GT 555M", CARD_NVIDIA_GEFORCE_GT555M
}, /* Geforce 500 - midend mobile */
1853 {"GTX 550 Ti", CARD_NVIDIA_GEFORCE_GTX550
}, /* Geforce 500 - midend */
1854 {"GT 540M", CARD_NVIDIA_GEFORCE_GT540M
}, /* Geforce 500 - midend mobile */
1855 {"GT 520", CARD_NVIDIA_GEFORCE_GT520
}, /* Geforce 500 - lowend */
1856 {"GTX 480", CARD_NVIDIA_GEFORCE_GTX480
}, /* Geforce 400 - highend */
1857 {"GTX 470", CARD_NVIDIA_GEFORCE_GTX470
}, /* Geforce 400 - midend high */
1859 {"GTX 465", CARD_NVIDIA_GEFORCE_GTX465
}, /* Geforce 400 - midend */
1860 {"GTX 460M", CARD_NVIDIA_GEFORCE_GTX460M
}, /* Geforce 400 - highend mobile */
1861 {"GTX 460", CARD_NVIDIA_GEFORCE_GTX460
}, /* Geforce 400 - midend */
1862 {"GTS 450", CARD_NVIDIA_GEFORCE_GTS450
}, /* Geforce 400 - midend low */
1863 {"GT 440", CARD_NVIDIA_GEFORCE_GT440
}, /* Geforce 400 - lowend */
1864 {"GT 430", CARD_NVIDIA_GEFORCE_GT430
}, /* Geforce 400 - lowend */
1865 {"GT 425M", CARD_NVIDIA_GEFORCE_GT425M
}, /* Geforce 400 - lowend mobile */
1866 {"GT 420", CARD_NVIDIA_GEFORCE_GT420
}, /* Geforce 400 - lowend */
1867 {"410M", CARD_NVIDIA_GEFORCE_410M
}, /* Geforce 400 - lowend mobile */
1868 {"GT 330", CARD_NVIDIA_GEFORCE_GT330
}, /* Geforce 300 - highend */
1869 {"GTS 360M", CARD_NVIDIA_GEFORCE_GTS350M
}, /* Geforce 300 - highend mobile */
1870 {"GTS 350M", CARD_NVIDIA_GEFORCE_GTS350M
}, /* Geforce 300 - highend mobile */
1871 {"GT 330M", CARD_NVIDIA_GEFORCE_GT325M
}, /* Geforce 300 - midend mobile */
1872 {"GT 325M", CARD_NVIDIA_GEFORCE_GT325M
}, /* Geforce 300 - midend mobile */
1873 {"GT 320M", CARD_NVIDIA_GEFORCE_GT320M
}, /* Geforce 300 - midend mobile */
1874 {"320M", CARD_NVIDIA_GEFORCE_320M
}, /* Geforce 300 - midend mobile */
1875 {"315M", CARD_NVIDIA_GEFORCE_315M
}, /* Geforce 300 - midend mobile */
1876 {"GTX 295", CARD_NVIDIA_GEFORCE_GTX280
}, /* Geforce 200 - highend */
1877 {"GTX 285", CARD_NVIDIA_GEFORCE_GTX280
}, /* Geforce 200 - highend */
1878 {"GTX 280", CARD_NVIDIA_GEFORCE_GTX280
}, /* Geforce 200 - highend */
1879 {"GTX 275", CARD_NVIDIA_GEFORCE_GTX275
}, /* Geforce 200 - midend high */
1880 {"GTX 260", CARD_NVIDIA_GEFORCE_GTX260
}, /* Geforce 200 - midend */
1881 {"GTS 250", CARD_NVIDIA_GEFORCE_GTS250
}, /* Geforce 200 - midend */
1882 {"GT 240", CARD_NVIDIA_GEFORCE_GT240
}, /* Geforce 200 - midend */
1883 {"GT 220", CARD_NVIDIA_GEFORCE_GT220
}, /* Geforce 200 - lowend */
1884 {"GeForce 310", CARD_NVIDIA_GEFORCE_210
}, /* Geforce 200 - lowend */
1885 {"GeForce 305", CARD_NVIDIA_GEFORCE_210
}, /* Geforce 200 - lowend */
1886 {"GeForce 210", CARD_NVIDIA_GEFORCE_210
}, /* Geforce 200 - lowend */
1887 {"G 210", CARD_NVIDIA_GEFORCE_210
}, /* Geforce 200 - lowend */
1888 {"GTS 150", CARD_NVIDIA_GEFORCE_9800GT
}, /* Geforce 9 - highend / Geforce 200 - midend */
1889 {"9800", CARD_NVIDIA_GEFORCE_9800GT
}, /* Geforce 9 - highend / Geforce 200 - midend */
1890 {"9700M GT", CARD_NVIDIA_GEFORCE_9700MGT
}, /* Geforce 9 - midend */
1891 {"GT 140", CARD_NVIDIA_GEFORCE_9600GT
}, /* Geforce 9 - midend */
1892 {"9600", CARD_NVIDIA_GEFORCE_9600GT
}, /* Geforce 9 - midend */
1893 {"GT 130", CARD_NVIDIA_GEFORCE_9500GT
}, /* Geforce 9 - midend low / Geforce 200 - low */
1894 {"GT 120", CARD_NVIDIA_GEFORCE_9500GT
}, /* Geforce 9 - midend low / Geforce 200 - low */
1895 {"9500", CARD_NVIDIA_GEFORCE_9500GT
}, /* Geforce 9 - midend low / Geforce 200 - low */
1896 {"9400M", CARD_NVIDIA_GEFORCE_9400M
}, /* Geforce 9 - lowend */
1897 {"9400", CARD_NVIDIA_GEFORCE_9400GT
}, /* Geforce 9 - lowend */
1898 {"9300", CARD_NVIDIA_GEFORCE_9300
}, /* Geforce 9 - lowend low */
1899 {"9200", CARD_NVIDIA_GEFORCE_9200
}, /* Geforce 9 - lowend low */
1900 {"9100", CARD_NVIDIA_GEFORCE_9200
}, /* Geforce 9 - lowend low */
1901 {"G 100", CARD_NVIDIA_GEFORCE_9200
}, /* Geforce 9 - lowend low */
1902 {"8800 GTX", CARD_NVIDIA_GEFORCE_8800GTX
}, /* Geforce 8 - highend high */
1903 {"8800", CARD_NVIDIA_GEFORCE_8800GTS
}, /* Geforce 8 - highend */
1904 {"8600M", CARD_NVIDIA_GEFORCE_8600MGT
}, /* Geforce 8 - midend mobile */
1905 {"8600 M", CARD_NVIDIA_GEFORCE_8600MGT
}, /* Geforce 8 - midend mobile */
1906 {"8700", CARD_NVIDIA_GEFORCE_8600GT
}, /* Geforce 8 - midend */
1907 {"8600", CARD_NVIDIA_GEFORCE_8600GT
}, /* Geforce 8 - midend */
1908 {"8500", CARD_NVIDIA_GEFORCE_8500GT
}, /* Geforce 8 - mid-lowend */
1909 {"8400", CARD_NVIDIA_GEFORCE_8400GS
}, /* Geforce 8 - mid-lowend */
1910 {"8300", CARD_NVIDIA_GEFORCE_8300GS
}, /* Geforce 8 - lowend */
1911 {"8200", CARD_NVIDIA_GEFORCE_8200
}, /* Geforce 8 - lowend */
1912 {"8100", CARD_NVIDIA_GEFORCE_8200
}, /* Geforce 8 - lowend */
1913 /* Direct 3D 9 SM3 */
1914 {"Quadro FX 5", CARD_NVIDIA_GEFORCE_7800GT
}, /* Geforce 7 - highend */
1915 {"Quadro FX 4", CARD_NVIDIA_GEFORCE_7800GT
}, /* Geforce 7 - highend */
1916 {"7950", CARD_NVIDIA_GEFORCE_7800GT
}, /* Geforce 7 - highend */
1917 {"7900", CARD_NVIDIA_GEFORCE_7800GT
}, /* Geforce 7 - highend */
1918 {"7800", CARD_NVIDIA_GEFORCE_7800GT
}, /* Geforce 7 - highend */
1919 {"7700", CARD_NVIDIA_GEFORCE_7600
}, /* Geforce 7 - midend */
1920 {"7600", CARD_NVIDIA_GEFORCE_7600
}, /* Geforce 7 - midend */
1921 {"7400", CARD_NVIDIA_GEFORCE_7400
}, /* Geforce 7 - lower medium */
1922 {"7300", CARD_NVIDIA_GEFORCE_7300
}, /* Geforce 7 - lowend */
1923 {"6800", CARD_NVIDIA_GEFORCE_6800
}, /* Geforce 6 - highend */
1924 {"6700", CARD_NVIDIA_GEFORCE_6600GT
}, /* Geforce 6 - midend */
1925 {"6610", CARD_NVIDIA_GEFORCE_6600GT
}, /* Geforce 6 - midend */
1926 {"6600", CARD_NVIDIA_GEFORCE_6600GT
}, /* Geforce 6 - midend */
1927 /* Direct 3D 9 SM2 */
1928 {"Quadro FX", CARD_NVIDIA_GEFORCEFX_5800
}, /* GeforceFX - highend */
1929 {"5950", CARD_NVIDIA_GEFORCEFX_5800
}, /* GeforceFX - highend */
1930 {"5900", CARD_NVIDIA_GEFORCEFX_5800
}, /* GeforceFX - highend */
1931 {"5800", CARD_NVIDIA_GEFORCEFX_5800
}, /* GeforceFX - highend */
1932 {"5750", CARD_NVIDIA_GEFORCEFX_5600
}, /* GeforceFX - midend */
1933 {"5700", CARD_NVIDIA_GEFORCEFX_5600
}, /* GeforceFX - midend */
1934 {"5650", CARD_NVIDIA_GEFORCEFX_5600
}, /* GeforceFX - midend */
1935 {"5600", CARD_NVIDIA_GEFORCEFX_5600
}, /* GeforceFX - midend */
1936 {"5500", CARD_NVIDIA_GEFORCEFX_5200
}, /* GeforceFX - lowend */
1937 {"5300", CARD_NVIDIA_GEFORCEFX_5200
}, /* GeforceFX - lowend */
1938 {"5250", CARD_NVIDIA_GEFORCEFX_5200
}, /* GeforceFX - lowend */
1939 {"5200", CARD_NVIDIA_GEFORCEFX_5200
}, /* GeforceFX - lowend */
1940 {"5100", CARD_NVIDIA_GEFORCEFX_5200
}, /* GeforceFX - lowend */
1942 {"Quadro4", CARD_NVIDIA_GEFORCE4_TI4200
},
1943 {"GeForce4 Ti", CARD_NVIDIA_GEFORCE4_TI4200
}, /* Geforce4 Ti4200/Ti4400/Ti4600/Ti4800 */
1945 {"GeForce4 MX", CARD_NVIDIA_GEFORCE4_MX
}, /* MX420/MX440/MX460/MX4000 */
1946 {"Quadro2 MXR", CARD_NVIDIA_GEFORCE2_MX
},
1947 {"GeForce2 MX", CARD_NVIDIA_GEFORCE2_MX
}, /* Geforce2 standard/MX100/MX200/MX400 */
1948 {"Quadro2", CARD_NVIDIA_GEFORCE2
},
1949 {"GeForce2", CARD_NVIDIA_GEFORCE2
}, /* Geforce2 GTS/Pro/Ti/Ultra */
1951 {"TNT2", CARD_NVIDIA_RIVA_TNT2
}, /* Riva TNT2 standard/M64/Pro/Ultra */
1953 /* See http://developer.amd.com/resources/hardware-drivers/ati-catalyst-pc-vendor-id-1002-li/
1955 * Beware: renderer string do not match exact card model,
1956 * eg HD 4800 is returned for multiple cards, even for RV790 based ones. */
1957 cards_amd_binary
[] =
1959 /* Southern Islands */
1960 {"HD 7900", CARD_AMD_RADEON_HD7900
},
1961 {"HD 7800", CARD_AMD_RADEON_HD7800
},
1962 {"HD 7700", CARD_AMD_RADEON_HD7700
},
1963 /* Northern Islands */
1964 {"HD 6970", CARD_AMD_RADEON_HD6900
},
1965 {"HD 6900", CARD_AMD_RADEON_HD6900
},
1966 {"HD 6800", CARD_AMD_RADEON_HD6800
},
1967 {"HD 6770M", CARD_AMD_RADEON_HD6600M
},
1968 {"HD 6750M", CARD_AMD_RADEON_HD6600M
},
1969 {"HD 6700", CARD_AMD_RADEON_HD6700
},
1970 {"HD 6670", CARD_AMD_RADEON_HD6600
},
1971 {"HD 6630M", CARD_AMD_RADEON_HD6600M
},
1972 {"HD 6600M", CARD_AMD_RADEON_HD6600M
},
1973 {"HD 6600", CARD_AMD_RADEON_HD6600
},
1974 {"HD 6570", CARD_AMD_RADEON_HD6600
},
1975 {"HD 6500M", CARD_AMD_RADEON_HD6600M
},
1976 {"HD 6500", CARD_AMD_RADEON_HD6600
},
1977 {"HD 6480G", CARD_AMD_RADEON_HD6480G
},
1978 {"HD 6400", CARD_AMD_RADEON_HD6400
},
1979 {"HD 6300", CARD_AMD_RADEON_HD6300
},
1980 {"HD 6200", CARD_AMD_RADEON_HD6300
},
1982 {"HD 5870", CARD_AMD_RADEON_HD5800
}, /* Radeon EG CYPRESS PRO */
1983 {"HD 5850", CARD_AMD_RADEON_HD5800
}, /* Radeon EG CYPRESS XT */
1984 {"HD 5800", CARD_AMD_RADEON_HD5800
}, /* Radeon EG CYPRESS HD58xx generic renderer string */
1985 {"HD 5770", CARD_AMD_RADEON_HD5700
}, /* Radeon EG JUNIPER XT */
1986 {"HD 5750", CARD_AMD_RADEON_HD5700
}, /* Radeon EG JUNIPER LE */
1987 {"HD 5700", CARD_AMD_RADEON_HD5700
}, /* Radeon EG JUNIPER HD57xx generic renderer string */
1988 {"HD 5670", CARD_AMD_RADEON_HD5600
}, /* Radeon EG REDWOOD XT */
1989 {"HD 5570", CARD_AMD_RADEON_HD5600
}, /* Radeon EG REDWOOD PRO mapped to HD5600 series */
1990 {"HD 5550", CARD_AMD_RADEON_HD5600
}, /* Radeon EG REDWOOD LE mapped to HD5600 series */
1991 {"HD 5450", CARD_AMD_RADEON_HD5400
}, /* Radeon EG CEDAR PRO */
1992 {"HD 5000", CARD_AMD_RADEON_HD5600
}, /* Defaulting to HD 5600 */
1994 {"HD 4890", CARD_AMD_RADEON_HD4800
}, /* Radeon RV790 */
1995 {"HD 4870", CARD_AMD_RADEON_HD4800
}, /* Radeon RV770 */
1996 {"HD 4850", CARD_AMD_RADEON_HD4800
}, /* Radeon RV770 */
1997 {"HD 4830", CARD_AMD_RADEON_HD4800
}, /* Radeon RV770 */
1998 {"HD 4800", CARD_AMD_RADEON_HD4800
}, /* Radeon RV7xx HD48xx generic renderer string */
1999 {"HD 4770", CARD_AMD_RADEON_HD4700
}, /* Radeon RV740 */
2000 {"HD 4700", CARD_AMD_RADEON_HD4700
}, /* Radeon RV7xx HD47xx generic renderer string */
2001 {"HD 4670", CARD_AMD_RADEON_HD4600
}, /* Radeon RV730 */
2002 {"HD 4650", CARD_AMD_RADEON_HD4600
}, /* Radeon RV730 */
2003 {"HD 4600", CARD_AMD_RADEON_HD4600
}, /* Radeon RV730 */
2004 {"HD 4550", CARD_AMD_RADEON_HD4350
}, /* Radeon RV710 */
2005 {"HD 4350", CARD_AMD_RADEON_HD4350
}, /* Radeon RV710 */
2006 /* R600/R700 integrated */
2007 {"HD 4200M", CARD_AMD_RADEON_HD4200M
},
2008 {"HD 3300", CARD_AMD_RADEON_HD3200
},
2009 {"HD 3200", CARD_AMD_RADEON_HD3200
},
2010 {"HD 3100", CARD_AMD_RADEON_HD3200
},
2012 {"HD 3870", CARD_AMD_RADEON_HD2900
}, /* HD2900/HD3800 - highend */
2013 {"HD 3850", CARD_AMD_RADEON_HD2900
}, /* HD2900/HD3800 - highend */
2014 {"HD 2900", CARD_AMD_RADEON_HD2900
}, /* HD2900/HD3800 - highend */
2015 {"HD 3830", CARD_AMD_RADEON_HD2600
}, /* China-only midend */
2016 {"HD 3690", CARD_AMD_RADEON_HD2600
}, /* HD2600/HD3600 - midend */
2017 {"HD 3650", CARD_AMD_RADEON_HD2600
}, /* HD2600/HD3600 - midend */
2018 {"HD 2600", CARD_AMD_RADEON_HD2600
}, /* HD2600/HD3600 - midend */
2019 {"HD 3470", CARD_AMD_RADEON_HD2350
}, /* HD2350/HD2400/HD3400 - lowend */
2020 {"HD 3450", CARD_AMD_RADEON_HD2350
}, /* HD2350/HD2400/HD3400 - lowend */
2021 {"HD 3430", CARD_AMD_RADEON_HD2350
}, /* HD2350/HD2400/HD3400 - lowend */
2022 {"HD 3400", CARD_AMD_RADEON_HD2350
}, /* HD2350/HD2400/HD3400 - lowend */
2023 {"HD 2400", CARD_AMD_RADEON_HD2350
}, /* HD2350/HD2400/HD3400 - lowend */
2024 {"HD 2350", CARD_AMD_RADEON_HD2350
}, /* HD2350/HD2400/HD3400 - lowend */
2026 {"X1950", CARD_AMD_RADEON_X1600
},
2027 {"X1900", CARD_AMD_RADEON_X1600
},
2028 {"X1800", CARD_AMD_RADEON_X1600
},
2029 {"X1650", CARD_AMD_RADEON_X1600
},
2030 {"X1600", CARD_AMD_RADEON_X1600
},
2031 /* Radeon R4xx + X1300/X1400/X1450/X1550/X2300/X2500/HD2300 (lowend R5xx)
2032 * Note X2300/X2500/HD2300 are R5xx GPUs with a 2xxx naming but they are still DX9-only */
2033 {"HD 2300", CARD_AMD_RADEON_X700
},
2034 {"X2500", CARD_AMD_RADEON_X700
},
2035 {"X2300", CARD_AMD_RADEON_X700
},
2036 {"X1550", CARD_AMD_RADEON_X700
},
2037 {"X1450", CARD_AMD_RADEON_X700
},
2038 {"X1400", CARD_AMD_RADEON_X700
},
2039 {"X1300", CARD_AMD_RADEON_X700
},
2040 {"X850", CARD_AMD_RADEON_X700
},
2041 {"X800", CARD_AMD_RADEON_X700
},
2042 {"X700", CARD_AMD_RADEON_X700
},
2043 /* Radeon Xpress Series - onboard, DX9b, Shader 2.0, 300-400 MHz */
2044 {"Radeon Xpress", CARD_AMD_RADEON_XPRESS_200M
},
2049 {"Iris Pro Graphics P580", CARD_INTEL_IPP580_1
},
2050 {"Skylake", CARD_INTEL_HD520_1
},
2052 {"Iris Pro P6300", CARD_INTEL_IPP6300
},
2053 {"Iris Pro 6200", CARD_INTEL_IP6200
},
2054 {"Iris 6100", CARD_INTEL_I6100
},
2055 {"Iris(TM) Graphics 6100", CARD_INTEL_I6100
}, /* MacOS */
2057 {"Haswell Mobile", CARD_INTEL_HWM
},
2058 {"Iris OpenGL Engine", CARD_INTEL_HWM
}, /* MacOS */
2060 {"Ivybridge Server", CARD_INTEL_IVBS
},
2061 {"Ivybridge Mobile", CARD_INTEL_IVBM
},
2062 {"Ivybridge Desktop", CARD_INTEL_IVBD
},
2063 {"HD Graphics 4000", CARD_INTEL_IVBD
}, /* MacOS */
2065 {"Sandybridge Server", CARD_INTEL_SNBS
},
2066 {"Sandybridge Mobile", CARD_INTEL_SNBM
},
2067 {"Sandybridge Desktop", CARD_INTEL_SNBD
},
2069 {"Ironlake Mobile", CARD_INTEL_ILKM
},
2070 {"Ironlake Desktop", CARD_INTEL_ILKD
},
2072 {"B43", CARD_INTEL_B43
},
2073 {"G41", CARD_INTEL_G41
},
2074 {"G45", CARD_INTEL_G45
},
2075 {"Q45", CARD_INTEL_Q45
},
2076 {"Integrated Graphics Device", CARD_INTEL_IGD
},
2077 {"GM45", CARD_INTEL_GM45
},
2079 {"965GME", CARD_INTEL_965GME
},
2080 {"965GM", CARD_INTEL_965GM
},
2081 {"X3100", CARD_INTEL_965GM
}, /* MacOS */
2082 {"946GZ", CARD_INTEL_946GZ
},
2083 {"965G", CARD_INTEL_965G
},
2084 {"965Q", CARD_INTEL_965Q
},
2086 {"Pineview M", CARD_INTEL_PNVM
},
2087 {"Pineview G", CARD_INTEL_PNVG
},
2088 {"IGD", CARD_INTEL_PNVG
},
2089 {"Q33", CARD_INTEL_Q33
},
2090 {"G33", CARD_INTEL_G33
},
2091 {"Q35", CARD_INTEL_Q35
},
2092 {"945GME", CARD_INTEL_945GME
},
2093 {"945GM", CARD_INTEL_945GM
},
2094 {"GMA 950", CARD_INTEL_945GM
}, /* MacOS */
2095 {"945G", CARD_INTEL_945G
},
2097 {"915GM", CARD_INTEL_915GM
},
2098 {"E7221G", CARD_INTEL_E7221G
},
2099 {"915G", CARD_INTEL_915G
},
2101 {"865G", CARD_INTEL_865G
},
2102 {"845G", CARD_INTEL_845G
},
2103 {"855GM", CARD_INTEL_855GM
},
2104 {"830M", CARD_INTEL_830M
},
2106 /* 20101109 - These are never returned by current Gallium radeon
2107 * drivers: R700, RV790, R680, RV535, RV516, R410, RS485, RV360, RV351.
2109 * These are returned but not handled: RC410, RV380. */
2113 {"HAWAII", CARD_AMD_RADEON_R9
},
2114 {"KAVERI", CARD_AMD_RADEON_R7
},
2115 {"KABINI", CARD_AMD_RADEON_R3
},
2116 {"BONAIRE", CARD_AMD_RADEON_HD8770
},
2117 /* Southern Islands */
2118 {"OLAND", CARD_AMD_RADEON_HD8670
},
2119 {"HAINAN", CARD_AMD_RADEON_HD8600M
},
2120 {"TAHITI", CARD_AMD_RADEON_HD7900
},
2121 {"PITCAIRN", CARD_AMD_RADEON_HD7800
},
2122 {"CAPE VERDE", CARD_AMD_RADEON_HD7700
},
2123 /* Northern Islands */
2124 {"ARUBA", CARD_AMD_RADEON_HD7660D
},
2125 {"CAYMAN", CARD_AMD_RADEON_HD6900
},
2126 {"BARTS", CARD_AMD_RADEON_HD6800
},
2127 {"TURKS", CARD_AMD_RADEON_HD6600
},
2128 {"SUMO2", CARD_AMD_RADEON_HD6410D
}, /* SUMO2 first, because we do a strstr(). */
2129 {"SUMO", CARD_AMD_RADEON_HD6550D
},
2130 {"CAICOS", CARD_AMD_RADEON_HD6400
},
2131 {"PALM", CARD_AMD_RADEON_HD6300
},
2133 {"HEMLOCK", CARD_AMD_RADEON_HD5900
},
2134 {"CYPRESS", CARD_AMD_RADEON_HD5800
},
2135 {"JUNIPER", CARD_AMD_RADEON_HD5700
},
2136 {"REDWOOD", CARD_AMD_RADEON_HD5600
},
2137 {"CEDAR", CARD_AMD_RADEON_HD5400
},
2139 {"R700", CARD_AMD_RADEON_HD4800
},
2140 {"RV790", CARD_AMD_RADEON_HD4800
},
2141 {"RV770", CARD_AMD_RADEON_HD4800
},
2142 {"RV740", CARD_AMD_RADEON_HD4700
},
2143 {"RV730", CARD_AMD_RADEON_HD4600
},
2144 {"RV710", CARD_AMD_RADEON_HD4350
},
2145 /* R600/R700 integrated */
2146 {"RS880", CARD_AMD_RADEON_HD4200M
},
2147 {"RS780", CARD_AMD_RADEON_HD3200
},
2149 {"R680", CARD_AMD_RADEON_HD2900
},
2150 {"R600", CARD_AMD_RADEON_HD2900
},
2151 {"RV670", CARD_AMD_RADEON_HD3850
},
2152 {"RV635", CARD_AMD_RADEON_HD2600
},
2153 {"RV630", CARD_AMD_RADEON_HD2600
},
2154 {"RV620", CARD_AMD_RADEON_HD2350
},
2155 {"RV610", CARD_AMD_RADEON_HD2350
},
2157 {"R580", CARD_AMD_RADEON_X1600
},
2158 {"R520", CARD_AMD_RADEON_X1600
},
2159 {"RV570", CARD_AMD_RADEON_X1600
},
2160 {"RV560", CARD_AMD_RADEON_X1600
},
2161 {"RV535", CARD_AMD_RADEON_X1600
},
2162 {"RV530", CARD_AMD_RADEON_X1600
},
2163 {"RV516", CARD_AMD_RADEON_X700
},
2164 {"RV515", CARD_AMD_RADEON_X700
},
2166 {"R481", CARD_AMD_RADEON_X700
},
2167 {"R480", CARD_AMD_RADEON_X700
},
2168 {"R430", CARD_AMD_RADEON_X700
},
2169 {"R423", CARD_AMD_RADEON_X700
},
2170 {"R420", CARD_AMD_RADEON_X700
},
2171 {"R410", CARD_AMD_RADEON_X700
},
2172 {"RV410", CARD_AMD_RADEON_X700
},
2173 /* Radeon Xpress - onboard, DX9b, Shader 2.0, 300-400 MHz */
2174 {"RS740", CARD_AMD_RADEON_XPRESS_200M
},
2175 {"RS690", CARD_AMD_RADEON_XPRESS_200M
},
2176 {"RS600", CARD_AMD_RADEON_XPRESS_200M
},
2177 {"RS485", CARD_AMD_RADEON_XPRESS_200M
},
2178 {"RS482", CARD_AMD_RADEON_XPRESS_200M
},
2179 {"RS480", CARD_AMD_RADEON_XPRESS_200M
},
2180 {"RS400", CARD_AMD_RADEON_XPRESS_200M
},
2182 {"R360", CARD_AMD_RADEON_9500
},
2183 {"R350", CARD_AMD_RADEON_9500
},
2184 {"R300", CARD_AMD_RADEON_9500
},
2185 {"RV370", CARD_AMD_RADEON_9500
},
2186 {"RV360", CARD_AMD_RADEON_9500
},
2187 {"RV351", CARD_AMD_RADEON_9500
},
2188 {"RV350", CARD_AMD_RADEON_9500
},
2190 cards_nvidia_mesa
[] =
2193 {"NV124", CARD_NVIDIA_GEFORCE_GTX970
},
2194 {"NV120", CARD_NVIDIA_GEFORCE_GTX980TI
},
2195 {"NV118", CARD_NVIDIA_GEFORCE_840M
},
2196 {"NV117", CARD_NVIDIA_GEFORCE_GTX750
},
2198 {"NV108", CARD_NVIDIA_GEFORCE_GT740M
},
2199 {"NVF1", CARD_NVIDIA_GEFORCE_GTX780TI
},
2200 {"NVF0", CARD_NVIDIA_GEFORCE_GTX780
},
2201 {"NVE6", CARD_NVIDIA_GEFORCE_GTX770M
},
2202 {"NVE4", CARD_NVIDIA_GEFORCE_GTX680
}, /* 690 / 675MX / 760TI */
2204 {"NVD9", CARD_NVIDIA_GEFORCE_GT520
},
2205 {"NVD7", CARD_NVIDIA_GEFORCE_820M
},
2206 {"NVCF", CARD_NVIDIA_GEFORCE_GTX550
},
2207 {"NVCE", CARD_NVIDIA_GEFORCE_GTX560
},
2208 {"NVC8", CARD_NVIDIA_GEFORCE_GTX570
},
2209 {"NVC4", CARD_NVIDIA_GEFORCE_GTX460
},
2210 {"NVC3", CARD_NVIDIA_GEFORCE_GT440
},
2211 {"NVC1", CARD_NVIDIA_GEFORCE_GT420
},
2212 {"NVC0", CARD_NVIDIA_GEFORCE_GTX480
},
2214 {"NVAF", CARD_NVIDIA_GEFORCE_GT320M
},
2215 {"NVAC", CARD_NVIDIA_GEFORCE_8200
},
2216 {"NVAA", CARD_NVIDIA_GEFORCE_8200
}, /* 8100 */
2217 {"NVA8", CARD_NVIDIA_GEFORCE_210
},
2218 {"NVA5", CARD_NVIDIA_GEFORCE_GT220
},
2219 {"NVA3", CARD_NVIDIA_GEFORCE_GT240
},
2220 {"NVA0", CARD_NVIDIA_GEFORCE_GTX280
},
2221 {"NV98", CARD_NVIDIA_GEFORCE_9200
},
2222 {"NV96", CARD_NVIDIA_GEFORCE_9400GT
},
2223 {"NV94", CARD_NVIDIA_GEFORCE_9600GT
},
2224 {"NV92", CARD_NVIDIA_GEFORCE_9800GT
},
2225 {"NV86", CARD_NVIDIA_GEFORCE_8500GT
},
2226 {"NV84", CARD_NVIDIA_GEFORCE_8600GT
},
2227 {"NV50", CARD_NVIDIA_GEFORCE_8800GTX
},
2229 {"NV68", CARD_NVIDIA_GEFORCE_6200
}, /* 7050 */
2230 {"NV67", CARD_NVIDIA_GEFORCE_6200
}, /* 7000M */
2231 {"NV63", CARD_NVIDIA_GEFORCE_6200
}, /* 7100 */
2232 {"NV4E", CARD_NVIDIA_GEFORCE_6200
}, /* 6100 Go / 6150 Go */
2233 {"NV4C", CARD_NVIDIA_GEFORCE_6200
}, /* 6150SE */
2234 {"NV4B", CARD_NVIDIA_GEFORCE_7600
},
2235 {"NV4A", CARD_NVIDIA_GEFORCE_6200
},
2236 {"NV49", CARD_NVIDIA_GEFORCE_7800GT
}, /* 7900 */
2237 {"NV47", CARD_NVIDIA_GEFORCE_7800GT
},
2238 {"NV46", CARD_NVIDIA_GEFORCE_7400
},
2239 {"NV45", CARD_NVIDIA_GEFORCE_6800
},
2240 {"NV44", CARD_NVIDIA_GEFORCE_6200
},
2241 {"NV43", CARD_NVIDIA_GEFORCE_6600GT
},
2242 {"NV42", CARD_NVIDIA_GEFORCE_6800
},
2243 {"NV41", CARD_NVIDIA_GEFORCE_6800
},
2244 {"NV40", CARD_NVIDIA_GEFORCE_6800
},
2246 {"NV38", CARD_NVIDIA_GEFORCEFX_5800
}, /* FX 5950 Ultra */
2247 {"NV36", CARD_NVIDIA_GEFORCEFX_5800
}, /* FX 5700/5750 */
2248 {"NV35", CARD_NVIDIA_GEFORCEFX_5800
}, /* FX 5900 */
2249 {"NV34", CARD_NVIDIA_GEFORCEFX_5200
},
2250 {"NV31", CARD_NVIDIA_GEFORCEFX_5600
},
2251 {"NV30", CARD_NVIDIA_GEFORCEFX_5800
},
2253 {"nv28", CARD_NVIDIA_GEFORCE4_TI4200
},
2254 {"nv25", CARD_NVIDIA_GEFORCE4_TI4200
},
2255 {"nv20", CARD_NVIDIA_GEFORCE3
},
2257 {"nv1F", CARD_NVIDIA_GEFORCE4_MX
}, /* GF4 MX IGP */
2258 {"nv1A", CARD_NVIDIA_GEFORCE2
}, /* GF2 IGP */
2259 {"nv18", CARD_NVIDIA_GEFORCE4_MX
},
2260 {"nv17", CARD_NVIDIA_GEFORCE4_MX
},
2261 {"nv16", CARD_NVIDIA_GEFORCE2
},
2262 {"nv15", CARD_NVIDIA_GEFORCE2
},
2263 {"nv11", CARD_NVIDIA_GEFORCE2_MX
},
2264 {"nv10", CARD_NVIDIA_GEFORCE
},
2266 {"nv05", CARD_NVIDIA_RIVA_TNT2
},
2267 {"nv04", CARD_NVIDIA_RIVA_TNT
},
2268 {"nv03", CARD_NVIDIA_RIVA_128
},
2272 {"SVGA3D", CARD_VMWARE_SVGA3D
},
2275 static const struct gl_vendor_selection
2277 enum wined3d_gl_vendor gl_vendor
;
2278 const char *description
; /* Description of the card selector i.e. Apple OS/X Intel */
2279 const struct wined3d_renderer_table
*cards
; /* To be used as cards[], pointer to the first member in an array */
2280 size_t cards_size
; /* Number of entries in the array above */
2282 amd_gl_vendor_table
[] =
2284 {GL_VENDOR_APPLE
, "Apple OSX AMD/ATI binary driver", cards_amd_binary
, ARRAY_SIZE(cards_amd_binary
)},
2285 {GL_VENDOR_FGLRX
, "AMD/ATI binary driver", cards_amd_binary
, ARRAY_SIZE(cards_amd_binary
)},
2286 {GL_VENDOR_MESA
, "Mesa AMD/ATI driver", cards_amd_mesa
, ARRAY_SIZE(cards_amd_mesa
)},
2288 nvidia_gl_vendor_table
[] =
2290 {GL_VENDOR_APPLE
, "Apple OSX NVidia binary driver", cards_nvidia_binary
, ARRAY_SIZE(cards_nvidia_binary
)},
2291 {GL_VENDOR_MESA
, "Mesa Nouveau driver", cards_nvidia_mesa
, ARRAY_SIZE(cards_nvidia_mesa
)},
2292 {GL_VENDOR_NVIDIA
, "Nvidia binary driver", cards_nvidia_binary
, ARRAY_SIZE(cards_nvidia_binary
)},
2294 vmware_gl_vendor_table
[] =
2296 {GL_VENDOR_MESA
, "VMware driver", cards_vmware
, ARRAY_SIZE(cards_vmware
)},
2298 intel_gl_vendor_table
[] =
2300 {GL_VENDOR_APPLE
, "Apple OSX Intel binary driver", cards_intel
, ARRAY_SIZE(cards_intel
)},
2301 {GL_VENDOR_MESA
, "Mesa Intel driver", cards_intel
, ARRAY_SIZE(cards_intel
)},
2304 static const enum wined3d_pci_device
2305 card_fallback_nvidia
[] =
2307 CARD_NVIDIA_RIVA_128
, /* D3D5 */
2308 CARD_NVIDIA_RIVA_TNT
, /* D3D6 */
2309 CARD_NVIDIA_GEFORCE
, /* D3D7 */
2310 CARD_NVIDIA_GEFORCE3
, /* D3D8 */
2311 CARD_NVIDIA_GEFORCEFX_5800
, /* D3D9_SM2 */
2312 CARD_NVIDIA_GEFORCE_6800
, /* D3D9_SM3 */
2313 CARD_NVIDIA_GEFORCE_8800GTX
, /* D3D10 */
2314 CARD_NVIDIA_GEFORCE_GTX470
, /* D3D11 */
2316 card_fallback_amd
[] =
2318 CARD_AMD_RAGE_128PRO
, /* D3D5 */
2319 CARD_AMD_RAGE_128PRO
, /* D3D6 */
2320 CARD_AMD_RADEON_7200
, /* D3D7 */
2321 CARD_AMD_RADEON_8500
, /* D3D8 */
2322 CARD_AMD_RADEON_9500
, /* D3D9_SM2 */
2323 CARD_AMD_RADEON_X1600
, /* D3D9_SM3 */
2324 CARD_AMD_RADEON_HD2900
, /* D3D10 */
2325 CARD_AMD_RADEON_HD5600
, /* D3D11 */
2327 card_fallback_intel
[] =
2329 CARD_INTEL_845G
, /* D3D5 */
2330 CARD_INTEL_845G
, /* D3D6 */
2331 CARD_INTEL_845G
, /* D3D7 */
2332 CARD_INTEL_915G
, /* D3D8 */
2333 CARD_INTEL_915G
, /* D3D9_SM2 */
2334 CARD_INTEL_945G
, /* D3D9_SM3 */
2335 CARD_INTEL_G45
, /* D3D10 */
2336 CARD_INTEL_IVBD
, /* D3D11 */
2338 C_ASSERT(ARRAY_SIZE(card_fallback_nvidia
) == WINED3D_D3D_LEVEL_COUNT
);
2339 C_ASSERT(ARRAY_SIZE(card_fallback_amd
) == WINED3D_D3D_LEVEL_COUNT
);
2340 C_ASSERT(ARRAY_SIZE(card_fallback_intel
) == WINED3D_D3D_LEVEL_COUNT
);
2342 static enum wined3d_pci_device
select_card_handler(const struct gl_vendor_selection
*table
,
2343 unsigned int table_size
, enum wined3d_gl_vendor gl_vendor
, const char *gl_renderer
)
2347 for (i
= 0; i
< table_size
; ++i
)
2349 if (table
[i
].gl_vendor
!= gl_vendor
)
2352 TRACE("Applying card selector \"%s\".\n", table
[i
].description
);
2354 for (j
= 0; j
< table
[i
].cards_size
; ++j
)
2356 if (strstr(gl_renderer
, table
[i
].cards
[j
].renderer
))
2357 return table
[i
].cards
[j
].id
;
2359 return PCI_DEVICE_NONE
;
2361 FIXME("Couldn't find a suitable card selector for GL vendor %04x (using GL_RENDERER %s)\n",
2362 gl_vendor
, debugstr_a(gl_renderer
));
2364 return PCI_DEVICE_NONE
;
2369 enum wined3d_pci_vendor card_vendor
;
2370 const char *description
; /* Description of the card selector i.e. Apple OS/X Intel */
2371 const struct gl_vendor_selection
*gl_vendor_selection
;
2372 unsigned int gl_vendor_count
;
2373 const enum wined3d_pci_device
*card_fallback
; /* An array with D3D_LEVEL_COUNT elements */
2375 card_vendor_table
[] =
2377 {HW_VENDOR_AMD
, "AMD", amd_gl_vendor_table
,
2378 sizeof(amd_gl_vendor_table
) / sizeof(*amd_gl_vendor_table
),
2380 {HW_VENDOR_NVIDIA
, "Nvidia", nvidia_gl_vendor_table
,
2381 sizeof(nvidia_gl_vendor_table
) / sizeof(*nvidia_gl_vendor_table
),
2382 card_fallback_nvidia
},
2383 {HW_VENDOR_VMWARE
, "VMware", vmware_gl_vendor_table
,
2384 sizeof(vmware_gl_vendor_table
) / sizeof(*vmware_gl_vendor_table
),
2386 {HW_VENDOR_INTEL
, "Intel", intel_gl_vendor_table
,
2387 sizeof(intel_gl_vendor_table
) / sizeof(*intel_gl_vendor_table
),
2388 card_fallback_intel
},
2392 static enum wined3d_pci_device
wined3d_guess_card(const struct shader_caps
*shader_caps
, const struct fragment_caps
*fragment_caps
,
2393 DWORD glsl_version
, const char *gl_renderer
, enum wined3d_gl_vendor
*gl_vendor
, enum wined3d_pci_vendor
*card_vendor
)
2395 /* A Direct3D device object contains the PCI id (vendor + device) of the
2396 * videocard which is used for rendering. Various applications use this
2397 * information to get a rough estimation of the features of the card and
2398 * some might use it for enabling 3d effects only on certain types of
2399 * videocards. In some cases games might even use it to work around bugs
2400 * which happen on certain videocards/driver combinations. The problem is
2401 * that OpenGL only exposes a rendering string containing the name of the
2402 * videocard and not the PCI id.
2404 * Various games depend on the PCI id, so somehow we need to provide one.
2405 * A simple option is to parse the renderer string and translate this to
2406 * the right PCI id. This is a lot of work because there are more than 200
2407 * GPUs just for Nvidia. Various cards share the same renderer string, so
2408 * the amount of code might be 'small' but there are quite a number of
2409 * exceptions which would make this a pain to maintain. Another way would
2410 * be to query the PCI id from the operating system (assuming this is the
2411 * videocard which is used for rendering which is not always the case).
2412 * This would work but it is not very portable. Second it would not work
2413 * well in, let's say, a remote X situation in which the amount of 3d
2414 * features which can be used is limited.
2416 * As said most games only use the PCI id to get an indication of the
2417 * capabilities of the card. It doesn't really matter if the given id is
2418 * the correct one if we return the id of a card with similar 3d features.
2420 * The code below checks the OpenGL capabilities of a videocard and matches
2421 * that to a certain level of Direct3D functionality. Once a card passes
2422 * the Direct3D9 check, we know that the card (in case of Nvidia) is at
2423 * least a GeforceFX. To give a better estimate we do a basic check on the
2424 * renderer string but if that won't pass we return a default card. This
2425 * way is better than maintaining a full card database as even without a
2426 * full database we can return a card with similar features. Second the
2427 * size of the database can be made quite small because when you know what
2428 * type of 3d functionality a card has, you know to which GPU family the
2429 * GPU must belong. Because of this you only have to check a small part of
2430 * the renderer string to distinguish between different models from that
2433 * The code also selects a default amount of video memory which we will
2434 * use for an estimation of the amount of free texture memory. In case of
2435 * real D3D the amount of texture memory includes video memory and system
2436 * memory (to be specific AGP memory or in case of PCIE TurboCache /
2437 * HyperMemory). We don't know how much system memory can be addressed by
2438 * the system but we can make a reasonable estimation about the amount of
2439 * video memory. If the value is slightly wrong it doesn't matter as we
2440 * didn't include AGP-like memory which makes the amount of addressable
2441 * memory higher and second OpenGL isn't that critical it moves to system
2442 * memory behind our backs if really needed. Note that the amount of video
2443 * memory can be overruled using a registry setting. */
2446 enum wined3d_d3d_level d3d_level
= d3d_level_from_caps(shader_caps
, fragment_caps
, glsl_version
);
2447 enum wined3d_pci_device device
;
2449 for (i
= 0; i
< (sizeof(card_vendor_table
) / sizeof(*card_vendor_table
)); ++i
)
2451 if (card_vendor_table
[i
].card_vendor
!= *card_vendor
)
2454 TRACE("Applying card selector \"%s\".\n", card_vendor_table
[i
].description
);
2455 device
= select_card_handler(card_vendor_table
[i
].gl_vendor_selection
,
2456 card_vendor_table
[i
].gl_vendor_count
, *gl_vendor
, gl_renderer
);
2457 if (device
!= PCI_DEVICE_NONE
)
2460 TRACE("Unrecognized renderer %s, falling back to default.\n", debugstr_a(gl_renderer
));
2461 return card_vendor_table
[i
].card_fallback
[d3d_level
];
2464 FIXME("No card selector available for card vendor %04x (using GL_RENDERER %s).\n",
2465 *card_vendor
, debugstr_a(gl_renderer
));
2467 /* Default to generic Nvidia hardware based on the supported OpenGL extensions. */
2468 *card_vendor
= HW_VENDOR_NVIDIA
;
2469 return card_fallback_nvidia
[d3d_level
];
2472 static const struct wined3d_vertex_pipe_ops
*select_vertex_implementation(const struct wined3d_gl_info
*gl_info
,
2473 const struct wined3d_shader_backend_ops
*shader_backend_ops
)
2475 if (shader_backend_ops
== &glsl_shader_backend
)
2476 return &glsl_vertex_pipe
;
2477 return &ffp_vertex_pipe
;
2480 static const struct fragment_pipeline
*select_fragment_implementation(const struct wined3d_gl_info
*gl_info
,
2481 const struct wined3d_shader_backend_ops
*shader_backend_ops
)
2483 if (shader_backend_ops
== &glsl_shader_backend
)
2484 return &glsl_fragment_pipe
;
2485 if (shader_backend_ops
== &arb_program_shader_backend
&& gl_info
->supported
[ARB_FRAGMENT_PROGRAM
])
2486 return &arbfp_fragment_pipeline
;
2487 if (gl_info
->supported
[ATI_FRAGMENT_SHADER
])
2488 return &atifs_fragment_pipeline
;
2489 if (gl_info
->supported
[NV_REGISTER_COMBINERS
] && gl_info
->supported
[NV_TEXTURE_SHADER2
])
2490 return &nvts_fragment_pipeline
;
2491 if (gl_info
->supported
[NV_REGISTER_COMBINERS
])
2492 return &nvrc_fragment_pipeline
;
2493 return &ffp_fragment_pipeline
;
2496 static const struct wined3d_shader_backend_ops
*select_shader_backend(const struct wined3d_gl_info
*gl_info
)
2498 BOOL glsl
= wined3d_settings
.glslRequested
&& gl_info
->glsl_version
>= MAKEDWORD_VERSION(1, 20);
2500 if (glsl
&& gl_info
->supported
[ARB_FRAGMENT_SHADER
])
2501 return &glsl_shader_backend
;
2502 if (glsl
&& gl_info
->supported
[ARB_VERTEX_SHADER
])
2504 /* Geforce4 cards support GLSL but for vertex shaders only. Further
2505 * its reported GLSL caps are wrong. This combined with the fact that
2506 * GLSL won't offer more features or performance, use ARB shaders only
2508 if (gl_info
->supported
[NV_VERTEX_PROGRAM
] && !gl_info
->supported
[NV_VERTEX_PROGRAM2
])
2509 return &arb_program_shader_backend
;
2510 return &glsl_shader_backend
;
2512 if (gl_info
->supported
[ARB_VERTEX_PROGRAM
] || gl_info
->supported
[ARB_FRAGMENT_PROGRAM
])
2513 return &arb_program_shader_backend
;
2514 return &none_shader_backend
;
2517 static const struct blit_shader
*select_blit_implementation(const struct wined3d_gl_info
*gl_info
,
2518 const struct wined3d_shader_backend_ops
*shader_backend_ops
)
2520 if ((shader_backend_ops
== &glsl_shader_backend
2521 || shader_backend_ops
== &arb_program_shader_backend
)
2522 && gl_info
->supported
[ARB_FRAGMENT_PROGRAM
])
2527 static void parse_extension_string(struct wined3d_gl_info
*gl_info
, const char *extensions
,
2528 const struct wined3d_extension_map
*map
, UINT entry_count
)
2536 while (isspace(*extensions
))
2539 while (!isspace(*extensions
) && *extensions
)
2542 len
= extensions
- start
;
2546 TRACE("- %s.\n", debugstr_an(start
, len
));
2548 for (i
= 0; i
< entry_count
; ++i
)
2550 if (len
== strlen(map
[i
].extension_string
)
2551 && !memcmp(start
, map
[i
].extension_string
, len
))
2553 TRACE(" FOUND: %s support.\n", map
[i
].extension_string
);
2554 gl_info
->supported
[map
[i
].extension
] = TRUE
;
2561 static void enumerate_gl_extensions(struct wined3d_gl_info
*gl_info
,
2562 const struct wined3d_extension_map
*map
, unsigned int map_entries_count
)
2564 const char *gl_extension_name
;
2566 GLint extensions_count
;
2568 gl_info
->gl_ops
.gl
.p_glGetIntegerv(GL_NUM_EXTENSIONS
, &extensions_count
);
2569 for (i
= 0; i
< extensions_count
; ++i
)
2571 gl_extension_name
= (const char *)GL_EXTCALL(glGetStringi(GL_EXTENSIONS
, i
));
2572 TRACE("- %s.\n", debugstr_a(gl_extension_name
));
2573 for (j
= 0; j
< map_entries_count
; ++j
)
2575 if (!strcmp(gl_extension_name
, map
[j
].extension_string
))
2577 TRACE("FOUND: %s support.\n", map
[j
].extension_string
);
2578 gl_info
->supported
[map
[j
].extension
] = TRUE
;
2585 static void load_gl_funcs(struct wined3d_gl_info
*gl_info
)
2587 #define USE_GL_FUNC(pfn) gl_info->gl_ops.ext.p_##pfn = (void *)wglGetProcAddress(#pfn);
2588 /* GL_APPLE_fence */
2589 USE_GL_FUNC(glDeleteFencesAPPLE
)
2590 USE_GL_FUNC(glFinishFenceAPPLE
)
2591 USE_GL_FUNC(glFinishObjectAPPLE
)
2592 USE_GL_FUNC(glGenFencesAPPLE
)
2593 USE_GL_FUNC(glIsFenceAPPLE
)
2594 USE_GL_FUNC(glSetFenceAPPLE
)
2595 USE_GL_FUNC(glTestFenceAPPLE
)
2596 USE_GL_FUNC(glTestObjectAPPLE
)
2597 /* GL_APPLE_flush_buffer_range */
2598 USE_GL_FUNC(glBufferParameteriAPPLE
)
2599 USE_GL_FUNC(glFlushMappedBufferRangeAPPLE
)
2600 /* GL_ARB_blend_func_extended */
2601 USE_GL_FUNC(glBindFragDataLocationIndexed
)
2602 USE_GL_FUNC(glGetFragDataIndex
)
2603 /* GL_ARB_clip_control */
2604 USE_GL_FUNC(glClipControl
)
2605 /* GL_ARB_color_buffer_float */
2606 USE_GL_FUNC(glClampColorARB
)
2607 /* GL_ARB_copy_buffer */
2608 USE_GL_FUNC(glCopyBufferSubData
)
2609 /* GL_ARB_debug_output */
2610 USE_GL_FUNC(glDebugMessageCallbackARB
)
2611 USE_GL_FUNC(glDebugMessageControlARB
)
2612 USE_GL_FUNC(glDebugMessageInsertARB
)
2613 USE_GL_FUNC(glGetDebugMessageLogARB
)
2614 /* GL_ARB_draw_buffers */
2615 USE_GL_FUNC(glDrawBuffersARB
)
2616 /* GL_ARB_draw_elements_base_vertex */
2617 USE_GL_FUNC(glDrawElementsBaseVertex
)
2618 USE_GL_FUNC(glDrawElementsInstancedBaseVertex
)
2619 USE_GL_FUNC(glDrawRangeElementsBaseVertex
)
2620 USE_GL_FUNC(glMultiDrawElementsBaseVertex
)
2621 /* GL_ARB_draw_instanced */
2622 USE_GL_FUNC(glDrawArraysInstancedARB
)
2623 USE_GL_FUNC(glDrawElementsInstancedARB
)
2624 /* GL_ARB_ES2_compatibility */
2625 USE_GL_FUNC(glReleaseShaderCompiler
)
2626 USE_GL_FUNC(glShaderBinary
)
2627 USE_GL_FUNC(glGetShaderPrecisionFormat
)
2628 USE_GL_FUNC(glDepthRangef
)
2629 USE_GL_FUNC(glClearDepthf
)
2630 /* GL_ARB_framebuffer_object */
2631 USE_GL_FUNC(glBindFramebuffer
)
2632 USE_GL_FUNC(glBindRenderbuffer
)
2633 USE_GL_FUNC(glBlitFramebuffer
)
2634 USE_GL_FUNC(glCheckFramebufferStatus
)
2635 USE_GL_FUNC(glDeleteFramebuffers
)
2636 USE_GL_FUNC(glDeleteRenderbuffers
)
2637 USE_GL_FUNC(glFramebufferRenderbuffer
)
2638 USE_GL_FUNC(glFramebufferTexture1D
)
2639 USE_GL_FUNC(glFramebufferTexture2D
)
2640 USE_GL_FUNC(glFramebufferTexture3D
)
2641 USE_GL_FUNC(glFramebufferTextureLayer
)
2642 USE_GL_FUNC(glGenFramebuffers
)
2643 USE_GL_FUNC(glGenRenderbuffers
)
2644 USE_GL_FUNC(glGenerateMipmap
)
2645 USE_GL_FUNC(glGetFramebufferAttachmentParameteriv
)
2646 USE_GL_FUNC(glGetRenderbufferParameteriv
)
2647 USE_GL_FUNC(glIsFramebuffer
)
2648 USE_GL_FUNC(glIsRenderbuffer
)
2649 USE_GL_FUNC(glRenderbufferStorage
)
2650 USE_GL_FUNC(glRenderbufferStorageMultisample
)
2651 /* GL_ARB_geometry_shader4 */
2652 USE_GL_FUNC(glFramebufferTextureARB
)
2653 USE_GL_FUNC(glFramebufferTextureFaceARB
)
2654 USE_GL_FUNC(glFramebufferTextureLayerARB
)
2655 USE_GL_FUNC(glProgramParameteriARB
)
2656 /* GL_ARB_instanced_arrays */
2657 USE_GL_FUNC(glVertexAttribDivisorARB
)
2658 /* GL_ARB_internalformat_query */
2659 USE_GL_FUNC(glGetInternalformativ
)
2660 /* GL_ARB_internalformat_query2 */
2661 USE_GL_FUNC(glGetInternalformati64v
)
2662 /* GL_ARB_map_buffer_range */
2663 USE_GL_FUNC(glFlushMappedBufferRange
)
2664 USE_GL_FUNC(glMapBufferRange
)
2665 /* GL_ARB_multisample */
2666 USE_GL_FUNC(glSampleCoverageARB
)
2667 /* GL_ARB_multitexture */
2668 USE_GL_FUNC(glActiveTextureARB
)
2669 USE_GL_FUNC(glClientActiveTextureARB
)
2670 USE_GL_FUNC(glMultiTexCoord1fARB
)
2671 USE_GL_FUNC(glMultiTexCoord1fvARB
)
2672 USE_GL_FUNC(glMultiTexCoord2fARB
)
2673 USE_GL_FUNC(glMultiTexCoord2fvARB
)
2674 USE_GL_FUNC(glMultiTexCoord2svARB
)
2675 USE_GL_FUNC(glMultiTexCoord3fARB
)
2676 USE_GL_FUNC(glMultiTexCoord3fvARB
)
2677 USE_GL_FUNC(glMultiTexCoord4fARB
)
2678 USE_GL_FUNC(glMultiTexCoord4fvARB
)
2679 USE_GL_FUNC(glMultiTexCoord4svARB
)
2680 /* GL_ARB_occlusion_query */
2681 USE_GL_FUNC(glBeginQueryARB
)
2682 USE_GL_FUNC(glDeleteQueriesARB
)
2683 USE_GL_FUNC(glEndQueryARB
)
2684 USE_GL_FUNC(glGenQueriesARB
)
2685 USE_GL_FUNC(glGetQueryivARB
)
2686 USE_GL_FUNC(glGetQueryObjectivARB
)
2687 USE_GL_FUNC(glGetQueryObjectuivARB
)
2688 USE_GL_FUNC(glIsQueryARB
)
2689 /* GL_ARB_point_parameters */
2690 USE_GL_FUNC(glPointParameterfARB
)
2691 USE_GL_FUNC(glPointParameterfvARB
)
2692 /* GL_ARB_provoking_vertex */
2693 USE_GL_FUNC(glProvokingVertex
)
2694 /* GL_ARB_sampler_objects */
2695 USE_GL_FUNC(glGenSamplers
)
2696 USE_GL_FUNC(glDeleteSamplers
)
2697 USE_GL_FUNC(glIsSampler
)
2698 USE_GL_FUNC(glBindSampler
)
2699 USE_GL_FUNC(glSamplerParameteri
)
2700 USE_GL_FUNC(glSamplerParameterf
)
2701 USE_GL_FUNC(glSamplerParameteriv
)
2702 USE_GL_FUNC(glSamplerParameterfv
)
2703 USE_GL_FUNC(glSamplerParameterIiv
)
2704 USE_GL_FUNC(glSamplerParameterIuiv
)
2705 USE_GL_FUNC(glGetSamplerParameteriv
)
2706 USE_GL_FUNC(glGetSamplerParameterfv
)
2707 USE_GL_FUNC(glGetSamplerParameterIiv
)
2708 USE_GL_FUNC(glGetSamplerParameterIuiv
)
2709 /* GL_ARB_shader_objects */
2710 USE_GL_FUNC(glAttachObjectARB
)
2711 USE_GL_FUNC(glBindAttribLocationARB
)
2712 USE_GL_FUNC(glCompileShaderARB
)
2713 USE_GL_FUNC(glCreateProgramObjectARB
)
2714 USE_GL_FUNC(glCreateShaderObjectARB
)
2715 USE_GL_FUNC(glDeleteObjectARB
)
2716 USE_GL_FUNC(glDetachObjectARB
)
2717 USE_GL_FUNC(glGetActiveUniformARB
)
2718 USE_GL_FUNC(glGetAttachedObjectsARB
)
2719 USE_GL_FUNC(glGetAttribLocationARB
)
2720 USE_GL_FUNC(glGetHandleARB
)
2721 USE_GL_FUNC(glGetInfoLogARB
)
2722 USE_GL_FUNC(glGetObjectParameterfvARB
)
2723 USE_GL_FUNC(glGetObjectParameterivARB
)
2724 USE_GL_FUNC(glGetShaderSourceARB
)
2725 USE_GL_FUNC(glGetUniformLocationARB
)
2726 USE_GL_FUNC(glGetUniformfvARB
)
2727 USE_GL_FUNC(glGetUniformivARB
)
2728 USE_GL_FUNC(glLinkProgramARB
)
2729 USE_GL_FUNC(glShaderSourceARB
)
2730 USE_GL_FUNC(glUniform1fARB
)
2731 USE_GL_FUNC(glUniform1fvARB
)
2732 USE_GL_FUNC(glUniform1iARB
)
2733 USE_GL_FUNC(glUniform1ivARB
)
2734 USE_GL_FUNC(glUniform2fARB
)
2735 USE_GL_FUNC(glUniform2fvARB
)
2736 USE_GL_FUNC(glUniform2iARB
)
2737 USE_GL_FUNC(glUniform2ivARB
)
2738 USE_GL_FUNC(glUniform3fARB
)
2739 USE_GL_FUNC(glUniform3fvARB
)
2740 USE_GL_FUNC(glUniform3iARB
)
2741 USE_GL_FUNC(glUniform3ivARB
)
2742 USE_GL_FUNC(glUniform4fARB
)
2743 USE_GL_FUNC(glUniform4fvARB
)
2744 USE_GL_FUNC(glUniform4iARB
)
2745 USE_GL_FUNC(glUniform4ivARB
)
2746 USE_GL_FUNC(glUniformMatrix2fvARB
)
2747 USE_GL_FUNC(glUniformMatrix3fvARB
)
2748 USE_GL_FUNC(glUniformMatrix4fvARB
)
2749 USE_GL_FUNC(glUseProgramObjectARB
)
2750 USE_GL_FUNC(glValidateProgramARB
)
2752 USE_GL_FUNC(glClientWaitSync
)
2753 USE_GL_FUNC(glDeleteSync
)
2754 USE_GL_FUNC(glFenceSync
)
2755 USE_GL_FUNC(glGetInteger64v
)
2756 USE_GL_FUNC(glGetSynciv
)
2757 USE_GL_FUNC(glIsSync
)
2758 USE_GL_FUNC(glWaitSync
)
2759 /* GL_ARB_texture_compression */
2760 USE_GL_FUNC(glCompressedTexImage2DARB
)
2761 USE_GL_FUNC(glCompressedTexImage3DARB
)
2762 USE_GL_FUNC(glCompressedTexSubImage2DARB
)
2763 USE_GL_FUNC(glCompressedTexSubImage3DARB
)
2764 USE_GL_FUNC(glGetCompressedTexImageARB
)
2765 /* GL_ARB_texture_storage */
2766 USE_GL_FUNC(glTexStorage1D
)
2767 USE_GL_FUNC(glTexStorage2D
)
2768 USE_GL_FUNC(glTexStorage3D
)
2769 /* GL_ARB_texture_view */
2770 USE_GL_FUNC(glTextureView
)
2771 /* GL_ARB_timer_query */
2772 USE_GL_FUNC(glQueryCounter
)
2773 USE_GL_FUNC(glGetQueryObjectui64v
)
2774 /* GL_ARB_uniform_buffer_object */
2775 USE_GL_FUNC(glBindBufferBase
)
2776 USE_GL_FUNC(glBindBufferRange
)
2777 USE_GL_FUNC(glGetActiveUniformBlockName
)
2778 USE_GL_FUNC(glGetActiveUniformBlockiv
)
2779 USE_GL_FUNC(glGetActiveUniformName
)
2780 USE_GL_FUNC(glGetActiveUniformsiv
)
2781 USE_GL_FUNC(glGetIntegeri_v
)
2782 USE_GL_FUNC(glGetUniformBlockIndex
)
2783 USE_GL_FUNC(glGetUniformIndices
)
2784 USE_GL_FUNC(glUniformBlockBinding
)
2785 /* GL_ARB_vertex_blend */
2786 USE_GL_FUNC(glVertexBlendARB
)
2787 USE_GL_FUNC(glWeightPointerARB
)
2788 USE_GL_FUNC(glWeightbvARB
)
2789 USE_GL_FUNC(glWeightdvARB
)
2790 USE_GL_FUNC(glWeightfvARB
)
2791 USE_GL_FUNC(glWeightivARB
)
2792 USE_GL_FUNC(glWeightsvARB
)
2793 USE_GL_FUNC(glWeightubvARB
)
2794 USE_GL_FUNC(glWeightuivARB
)
2795 USE_GL_FUNC(glWeightusvARB
)
2796 /* GL_ARB_vertex_buffer_object */
2797 USE_GL_FUNC(glBindBufferARB
)
2798 USE_GL_FUNC(glBufferDataARB
)
2799 USE_GL_FUNC(glBufferSubDataARB
)
2800 USE_GL_FUNC(glDeleteBuffersARB
)
2801 USE_GL_FUNC(glGenBuffersARB
)
2802 USE_GL_FUNC(glGetBufferParameterivARB
)
2803 USE_GL_FUNC(glGetBufferPointervARB
)
2804 USE_GL_FUNC(glGetBufferSubDataARB
)
2805 USE_GL_FUNC(glIsBufferARB
)
2806 USE_GL_FUNC(glMapBufferARB
)
2807 USE_GL_FUNC(glUnmapBufferARB
)
2808 /* GL_ARB_vertex_program */
2809 USE_GL_FUNC(glBindProgramARB
)
2810 USE_GL_FUNC(glDeleteProgramsARB
)
2811 USE_GL_FUNC(glDisableVertexAttribArrayARB
)
2812 USE_GL_FUNC(glEnableVertexAttribArrayARB
)
2813 USE_GL_FUNC(glGenProgramsARB
)
2814 USE_GL_FUNC(glGetProgramivARB
)
2815 USE_GL_FUNC(glProgramEnvParameter4fvARB
)
2816 USE_GL_FUNC(glProgramLocalParameter4fvARB
)
2817 USE_GL_FUNC(glProgramStringARB
)
2818 USE_GL_FUNC(glVertexAttrib1dARB
)
2819 USE_GL_FUNC(glVertexAttrib1dvARB
)
2820 USE_GL_FUNC(glVertexAttrib1fARB
)
2821 USE_GL_FUNC(glVertexAttrib1fvARB
)
2822 USE_GL_FUNC(glVertexAttrib1sARB
)
2823 USE_GL_FUNC(glVertexAttrib1svARB
)
2824 USE_GL_FUNC(glVertexAttrib2dARB
)
2825 USE_GL_FUNC(glVertexAttrib2dvARB
)
2826 USE_GL_FUNC(glVertexAttrib2fARB
)
2827 USE_GL_FUNC(glVertexAttrib2fvARB
)
2828 USE_GL_FUNC(glVertexAttrib2sARB
)
2829 USE_GL_FUNC(glVertexAttrib2svARB
)
2830 USE_GL_FUNC(glVertexAttrib3dARB
)
2831 USE_GL_FUNC(glVertexAttrib3dvARB
)
2832 USE_GL_FUNC(glVertexAttrib3fARB
)
2833 USE_GL_FUNC(glVertexAttrib3fvARB
)
2834 USE_GL_FUNC(glVertexAttrib3sARB
)
2835 USE_GL_FUNC(glVertexAttrib3svARB
)
2836 USE_GL_FUNC(glVertexAttrib4NbvARB
)
2837 USE_GL_FUNC(glVertexAttrib4NivARB
)
2838 USE_GL_FUNC(glVertexAttrib4NsvARB
)
2839 USE_GL_FUNC(glVertexAttrib4NubARB
)
2840 USE_GL_FUNC(glVertexAttrib4NubvARB
)
2841 USE_GL_FUNC(glVertexAttrib4NuivARB
)
2842 USE_GL_FUNC(glVertexAttrib4NusvARB
)
2843 USE_GL_FUNC(glVertexAttrib4bvARB
)
2844 USE_GL_FUNC(glVertexAttrib4dARB
)
2845 USE_GL_FUNC(glVertexAttrib4dvARB
)
2846 USE_GL_FUNC(glVertexAttrib4fARB
)
2847 USE_GL_FUNC(glVertexAttrib4fvARB
)
2848 USE_GL_FUNC(glVertexAttrib4ivARB
)
2849 USE_GL_FUNC(glVertexAttrib4sARB
)
2850 USE_GL_FUNC(glVertexAttrib4svARB
)
2851 USE_GL_FUNC(glVertexAttrib4ubvARB
)
2852 USE_GL_FUNC(glVertexAttrib4uivARB
)
2853 USE_GL_FUNC(glVertexAttrib4usvARB
)
2854 USE_GL_FUNC(glVertexAttribPointerARB
)
2855 /* GL_ARB_viewport_array */
2856 USE_GL_FUNC(glDepthRangeArrayv
)
2857 USE_GL_FUNC(glDepthRangeIndexed
)
2858 USE_GL_FUNC(glGetDoublei_v
)
2859 USE_GL_FUNC(glGetFloati_v
)
2860 USE_GL_FUNC(glScissorArrayv
)
2861 USE_GL_FUNC(glScissorIndexed
)
2862 USE_GL_FUNC(glScissorIndexedv
)
2863 USE_GL_FUNC(glViewportArrayv
)
2864 USE_GL_FUNC(glViewportIndexedf
)
2865 USE_GL_FUNC(glViewportIndexedfv
)
2866 /* GL_ATI_fragment_shader */
2867 USE_GL_FUNC(glAlphaFragmentOp1ATI
)
2868 USE_GL_FUNC(glAlphaFragmentOp2ATI
)
2869 USE_GL_FUNC(glAlphaFragmentOp3ATI
)
2870 USE_GL_FUNC(glBeginFragmentShaderATI
)
2871 USE_GL_FUNC(glBindFragmentShaderATI
)
2872 USE_GL_FUNC(glColorFragmentOp1ATI
)
2873 USE_GL_FUNC(glColorFragmentOp2ATI
)
2874 USE_GL_FUNC(glColorFragmentOp3ATI
)
2875 USE_GL_FUNC(glDeleteFragmentShaderATI
)
2876 USE_GL_FUNC(glEndFragmentShaderATI
)
2877 USE_GL_FUNC(glGenFragmentShadersATI
)
2878 USE_GL_FUNC(glPassTexCoordATI
)
2879 USE_GL_FUNC(glSampleMapATI
)
2880 USE_GL_FUNC(glSetFragmentShaderConstantATI
)
2881 /* GL_ATI_separate_stencil */
2882 USE_GL_FUNC(glStencilOpSeparateATI
)
2883 USE_GL_FUNC(glStencilFuncSeparateATI
)
2884 /* GL_EXT_blend_color */
2885 USE_GL_FUNC(glBlendColorEXT
)
2886 /* GL_EXT_blend_equation_separate */
2887 USE_GL_FUNC(glBlendFuncSeparateEXT
)
2888 /* GL_EXT_blend_func_separate */
2889 USE_GL_FUNC(glBlendEquationSeparateEXT
)
2890 /* GL_EXT_blend_minmax */
2891 USE_GL_FUNC(glBlendEquationEXT
)
2892 /* GL_EXT_depth_bounds_test */
2893 USE_GL_FUNC(glDepthBoundsEXT
)
2894 /* GL_EXT_draw_buffers2 */
2895 USE_GL_FUNC(glColorMaskIndexedEXT
)
2896 USE_GL_FUNC(glDisableIndexedEXT
)
2897 USE_GL_FUNC(glEnableIndexedEXT
)
2898 USE_GL_FUNC(glGetBooleanIndexedvEXT
)
2899 USE_GL_FUNC(glGetIntegerIndexedvEXT
)
2900 USE_GL_FUNC(glIsEnabledIndexedEXT
)
2901 /* GL_EXT_fog_coord */
2902 USE_GL_FUNC(glFogCoordPointerEXT
)
2903 USE_GL_FUNC(glFogCoorddEXT
)
2904 USE_GL_FUNC(glFogCoorddvEXT
)
2905 USE_GL_FUNC(glFogCoordfEXT
)
2906 USE_GL_FUNC(glFogCoordfvEXT
)
2907 /* GL_EXT_framebuffer_blit */
2908 USE_GL_FUNC(glBlitFramebufferEXT
)
2909 /* GL_EXT_framebuffer_multisample */
2910 USE_GL_FUNC(glRenderbufferStorageMultisampleEXT
)
2911 /* GL_EXT_framebuffer_object */
2912 USE_GL_FUNC(glBindFramebufferEXT
)
2913 USE_GL_FUNC(glBindRenderbufferEXT
)
2914 USE_GL_FUNC(glCheckFramebufferStatusEXT
)
2915 USE_GL_FUNC(glDeleteFramebuffersEXT
)
2916 USE_GL_FUNC(glDeleteRenderbuffersEXT
)
2917 USE_GL_FUNC(glFramebufferRenderbufferEXT
)
2918 USE_GL_FUNC(glFramebufferTexture1DEXT
)
2919 USE_GL_FUNC(glFramebufferTexture2DEXT
)
2920 USE_GL_FUNC(glFramebufferTexture3DEXT
)
2921 USE_GL_FUNC(glGenFramebuffersEXT
)
2922 USE_GL_FUNC(glGenRenderbuffersEXT
)
2923 USE_GL_FUNC(glGenerateMipmapEXT
)
2924 USE_GL_FUNC(glGetFramebufferAttachmentParameterivEXT
)
2925 USE_GL_FUNC(glGetRenderbufferParameterivEXT
)
2926 USE_GL_FUNC(glIsFramebufferEXT
)
2927 USE_GL_FUNC(glIsRenderbufferEXT
)
2928 USE_GL_FUNC(glRenderbufferStorageEXT
)
2929 /* GL_EXT_gpu_program_parameters */
2930 USE_GL_FUNC(glProgramEnvParameters4fvEXT
)
2931 USE_GL_FUNC(glProgramLocalParameters4fvEXT
)
2932 /* GL_EXT_gpu_shader4 */
2933 USE_GL_FUNC(glBindFragDataLocationEXT
)
2934 USE_GL_FUNC(glGetFragDataLocationEXT
)
2935 USE_GL_FUNC(glGetUniformuivEXT
)
2936 USE_GL_FUNC(glGetVertexAttribIivEXT
)
2937 USE_GL_FUNC(glGetVertexAttribIuivEXT
)
2938 USE_GL_FUNC(glUniform1uiEXT
)
2939 USE_GL_FUNC(glUniform1uivEXT
)
2940 USE_GL_FUNC(glUniform2uiEXT
)
2941 USE_GL_FUNC(glUniform2uivEXT
)
2942 USE_GL_FUNC(glUniform3uiEXT
)
2943 USE_GL_FUNC(glUniform3uivEXT
)
2944 USE_GL_FUNC(glUniform4uiEXT
)
2945 USE_GL_FUNC(glUniform4uivEXT
)
2946 USE_GL_FUNC(glVertexAttribI1iEXT
)
2947 USE_GL_FUNC(glVertexAttribI1ivEXT
)
2948 USE_GL_FUNC(glVertexAttribI1uiEXT
)
2949 USE_GL_FUNC(glVertexAttribI1uivEXT
)
2950 USE_GL_FUNC(glVertexAttribI2iEXT
)
2951 USE_GL_FUNC(glVertexAttribI2ivEXT
)
2952 USE_GL_FUNC(glVertexAttribI2uiEXT
)
2953 USE_GL_FUNC(glVertexAttribI2uivEXT
)
2954 USE_GL_FUNC(glVertexAttribI3iEXT
)
2955 USE_GL_FUNC(glVertexAttribI3ivEXT
)
2956 USE_GL_FUNC(glVertexAttribI3uiEXT
)
2957 USE_GL_FUNC(glVertexAttribI3uivEXT
)
2958 USE_GL_FUNC(glVertexAttribI4bvEXT
)
2959 USE_GL_FUNC(glVertexAttribI4iEXT
)
2960 USE_GL_FUNC(glVertexAttribI4ivEXT
)
2961 USE_GL_FUNC(glVertexAttribI4svEXT
)
2962 USE_GL_FUNC(glVertexAttribI4ubvEXT
)
2963 USE_GL_FUNC(glVertexAttribI4uiEXT
)
2964 USE_GL_FUNC(glVertexAttribI4uivEXT
)
2965 USE_GL_FUNC(glVertexAttribI4usvEXT
)
2966 USE_GL_FUNC(glVertexAttribIPointerEXT
)
2967 /* GL_EXT_point_parameters */
2968 USE_GL_FUNC(glPointParameterfEXT
)
2969 USE_GL_FUNC(glPointParameterfvEXT
)
2970 /* GL_EXT_provoking_vertex */
2971 USE_GL_FUNC(glProvokingVertexEXT
)
2972 /* GL_EXT_secondary_color */
2973 USE_GL_FUNC(glSecondaryColor3fEXT
)
2974 USE_GL_FUNC(glSecondaryColor3fvEXT
)
2975 USE_GL_FUNC(glSecondaryColor3ubEXT
)
2976 USE_GL_FUNC(glSecondaryColor3ubvEXT
)
2977 USE_GL_FUNC(glSecondaryColorPointerEXT
)
2978 /* GL_EXT_stencil_two_side */
2979 USE_GL_FUNC(glActiveStencilFaceEXT
)
2980 /* GL_EXT_texture3D */
2981 USE_GL_FUNC(glTexImage3D
)
2982 USE_GL_FUNC(glTexImage3DEXT
)
2983 USE_GL_FUNC(glTexSubImage3D
)
2984 USE_GL_FUNC(glTexSubImage3DEXT
)
2986 USE_GL_FUNC(glDeleteFencesNV
)
2987 USE_GL_FUNC(glFinishFenceNV
)
2988 USE_GL_FUNC(glGenFencesNV
)
2989 USE_GL_FUNC(glGetFenceivNV
)
2990 USE_GL_FUNC(glIsFenceNV
)
2991 USE_GL_FUNC(glSetFenceNV
)
2992 USE_GL_FUNC(glTestFenceNV
)
2993 /* GL_NV_half_float */
2994 USE_GL_FUNC(glColor3hNV
)
2995 USE_GL_FUNC(glColor3hvNV
)
2996 USE_GL_FUNC(glColor4hNV
)
2997 USE_GL_FUNC(glColor4hvNV
)
2998 USE_GL_FUNC(glFogCoordhNV
)
2999 USE_GL_FUNC(glFogCoordhvNV
)
3000 USE_GL_FUNC(glMultiTexCoord1hNV
)
3001 USE_GL_FUNC(glMultiTexCoord1hvNV
)
3002 USE_GL_FUNC(glMultiTexCoord2hNV
)
3003 USE_GL_FUNC(glMultiTexCoord2hvNV
)
3004 USE_GL_FUNC(glMultiTexCoord3hNV
)
3005 USE_GL_FUNC(glMultiTexCoord3hvNV
)
3006 USE_GL_FUNC(glMultiTexCoord4hNV
)
3007 USE_GL_FUNC(glMultiTexCoord4hvNV
)
3008 USE_GL_FUNC(glNormal3hNV
)
3009 USE_GL_FUNC(glNormal3hvNV
)
3010 USE_GL_FUNC(glSecondaryColor3hNV
)
3011 USE_GL_FUNC(glSecondaryColor3hvNV
)
3012 USE_GL_FUNC(glTexCoord1hNV
)
3013 USE_GL_FUNC(glTexCoord1hvNV
)
3014 USE_GL_FUNC(glTexCoord2hNV
)
3015 USE_GL_FUNC(glTexCoord2hvNV
)
3016 USE_GL_FUNC(glTexCoord3hNV
)
3017 USE_GL_FUNC(glTexCoord3hvNV
)
3018 USE_GL_FUNC(glTexCoord4hNV
)
3019 USE_GL_FUNC(glTexCoord4hvNV
)
3020 USE_GL_FUNC(glVertex2hNV
)
3021 USE_GL_FUNC(glVertex2hvNV
)
3022 USE_GL_FUNC(glVertex3hNV
)
3023 USE_GL_FUNC(glVertex3hvNV
)
3024 USE_GL_FUNC(glVertex4hNV
)
3025 USE_GL_FUNC(glVertex4hvNV
)
3026 USE_GL_FUNC(glVertexAttrib1hNV
)
3027 USE_GL_FUNC(glVertexAttrib1hvNV
)
3028 USE_GL_FUNC(glVertexAttrib2hNV
)
3029 USE_GL_FUNC(glVertexAttrib2hvNV
)
3030 USE_GL_FUNC(glVertexAttrib3hNV
)
3031 USE_GL_FUNC(glVertexAttrib3hvNV
)
3032 USE_GL_FUNC(glVertexAttrib4hNV
)
3033 USE_GL_FUNC(glVertexAttrib4hvNV
)
3034 USE_GL_FUNC(glVertexAttribs1hvNV
)
3035 USE_GL_FUNC(glVertexAttribs2hvNV
)
3036 USE_GL_FUNC(glVertexAttribs3hvNV
)
3037 USE_GL_FUNC(glVertexAttribs4hvNV
)
3038 USE_GL_FUNC(glVertexWeighthNV
)
3039 USE_GL_FUNC(glVertexWeighthvNV
)
3040 /* GL_NV_point_sprite */
3041 USE_GL_FUNC(glPointParameteriNV
)
3042 USE_GL_FUNC(glPointParameterivNV
)
3043 /* GL_NV_register_combiners */
3044 USE_GL_FUNC(glCombinerInputNV
)
3045 USE_GL_FUNC(glCombinerOutputNV
)
3046 USE_GL_FUNC(glCombinerParameterfNV
)
3047 USE_GL_FUNC(glCombinerParameterfvNV
)
3048 USE_GL_FUNC(glCombinerParameteriNV
)
3049 USE_GL_FUNC(glCombinerParameterivNV
)
3050 USE_GL_FUNC(glFinalCombinerInputNV
)
3051 /* WGL extensions */
3052 USE_GL_FUNC(wglChoosePixelFormatARB
)
3053 USE_GL_FUNC(wglGetExtensionsStringARB
)
3054 USE_GL_FUNC(wglGetPixelFormatAttribfvARB
)
3055 USE_GL_FUNC(wglGetPixelFormatAttribivARB
)
3056 USE_GL_FUNC(wglQueryCurrentRendererIntegerWINE
)
3057 USE_GL_FUNC(wglQueryCurrentRendererStringWINE
)
3058 USE_GL_FUNC(wglQueryRendererIntegerWINE
)
3059 USE_GL_FUNC(wglQueryRendererStringWINE
)
3060 USE_GL_FUNC(wglSetPixelFormatWINE
)
3061 USE_GL_FUNC(wglSwapIntervalEXT
)
3063 /* Newer core functions */
3064 USE_GL_FUNC(glActiveTexture
) /* OpenGL 1.3 */
3065 USE_GL_FUNC(glAttachShader
) /* OpenGL 2.0 */
3066 USE_GL_FUNC(glBeginQuery
) /* OpenGL 1.5 */
3067 USE_GL_FUNC(glBindAttribLocation
) /* OpenGL 2.0 */
3068 USE_GL_FUNC(glBindBuffer
) /* OpenGL 1.5 */
3069 USE_GL_FUNC(glBindVertexArray
) /* OpenGL 3.0 */
3070 USE_GL_FUNC(glBlendColor
) /* OpenGL 1.4 */
3071 USE_GL_FUNC(glBlendEquation
) /* OpenGL 1.4 */
3072 USE_GL_FUNC(glBlendEquationSeparate
) /* OpenGL 2.0 */
3073 USE_GL_FUNC(glBlendFuncSeparate
) /* OpenGL 1.4 */
3074 USE_GL_FUNC(glBufferData
) /* OpenGL 1.5 */
3075 USE_GL_FUNC(glBufferSubData
) /* OpenGL 1.5 */
3076 USE_GL_FUNC(glColorMaski
) /* OpenGL 3.0 */
3077 USE_GL_FUNC(glCompileShader
) /* OpenGL 2.0 */
3078 USE_GL_FUNC(glCompressedTexImage2D
) /* OpenGL 1.3 */
3079 USE_GL_FUNC(glCompressedTexImage3D
) /* OpenGL 1.3 */
3080 USE_GL_FUNC(glCompressedTexSubImage2D
) /* OpenGL 1.3 */
3081 USE_GL_FUNC(glCompressedTexSubImage3D
) /* OpenGL 1.3 */
3082 USE_GL_FUNC(glCreateProgram
) /* OpenGL 2.0 */
3083 USE_GL_FUNC(glCreateShader
) /* OpenGL 2.0 */
3084 USE_GL_FUNC(glDebugMessageCallback
) /* OpenGL 4.3 */
3085 USE_GL_FUNC(glDebugMessageControl
) /* OpenGL 4.3 */
3086 USE_GL_FUNC(glDebugMessageInsert
) /* OpenGL 4.3 */
3087 USE_GL_FUNC(glDeleteBuffers
) /* OpenGL 1.5 */
3088 USE_GL_FUNC(glDeleteProgram
) /* OpenGL 2.0 */
3089 USE_GL_FUNC(glDeleteQueries
) /* OpenGL 1.5 */
3090 USE_GL_FUNC(glDeleteShader
) /* OpenGL 2.0 */
3091 USE_GL_FUNC(glDeleteVertexArrays
) /* OpenGL 3.0 */
3092 USE_GL_FUNC(glDetachShader
) /* OpenGL 2.0 */
3093 USE_GL_FUNC(glDisablei
) /* OpenGL 3.0 */
3094 USE_GL_FUNC(glDisableVertexAttribArray
) /* OpenGL 2.0 */
3095 USE_GL_FUNC(glDrawArraysInstanced
) /* OpenGL 3.1 */
3096 USE_GL_FUNC(glDrawBuffers
) /* OpenGL 2.0 */
3097 USE_GL_FUNC(glDrawElementsInstanced
) /* OpenGL 3.1 */
3098 USE_GL_FUNC(glEnablei
) /* OpenGL 3.0 */
3099 USE_GL_FUNC(glEnableVertexAttribArray
) /* OpenGL 2.0 */
3100 USE_GL_FUNC(glEndQuery
) /* OpenGL 1.5 */
3101 USE_GL_FUNC(glGenBuffers
) /* OpenGL 1.5 */
3102 USE_GL_FUNC(glGenQueries
) /* OpenGL 1.5 */
3103 USE_GL_FUNC(glGenVertexArrays
) /* OpenGL 3.0 */
3104 USE_GL_FUNC(glGetActiveUniform
) /* OpenGL 2.0 */
3105 USE_GL_FUNC(glGetAttachedShaders
) /* OpenGL 2.0 */
3106 USE_GL_FUNC(glGetAttribLocation
) /* OpenGL 2.0 */
3107 USE_GL_FUNC(glGetBooleani_v
) /* OpenGL 3.0 */
3108 USE_GL_FUNC(glGetBufferSubData
) /* OpenGL 1.5 */
3109 USE_GL_FUNC(glGetCompressedTexImage
) /* OpenGL 1.3 */
3110 USE_GL_FUNC(glGetDebugMessageLog
) /* OpenGL 4.3 */
3111 USE_GL_FUNC(glGetIntegeri_v
) /* OpenGL 3.0 */
3112 USE_GL_FUNC(glGetProgramInfoLog
) /* OpenGL 2.0 */
3113 USE_GL_FUNC(glGetProgramiv
) /* OpenGL 2.0 */
3114 USE_GL_FUNC(glGetQueryiv
) /* OpenGL 1.5 */
3115 USE_GL_FUNC(glGetQueryObjectuiv
) /* OpenGL 1.5 */
3116 USE_GL_FUNC(glGetShaderInfoLog
) /* OpenGL 2.0 */
3117 USE_GL_FUNC(glGetShaderiv
) /* OpenGL 2.0 */
3118 USE_GL_FUNC(glGetShaderSource
) /* OpenGL 2.0 */
3119 USE_GL_FUNC(glGetStringi
) /* OpenGL 3.0 */
3120 USE_GL_FUNC(glGetUniformfv
) /* OpenGL 2.0 */
3121 USE_GL_FUNC(glGetUniformiv
) /* OpenGL 2.0 */
3122 USE_GL_FUNC(glGetUniformLocation
) /* OpenGL 2.0 */
3123 USE_GL_FUNC(glIsEnabledi
) /* OpenGL 3.0 */
3124 USE_GL_FUNC(glLinkProgram
) /* OpenGL 2.0 */
3125 USE_GL_FUNC(glMapBuffer
) /* OpenGL 1.5 */
3126 USE_GL_FUNC(glPointParameteri
) /* OpenGL 1.4 */
3127 USE_GL_FUNC(glPointParameteriv
) /* OpenGL 1.4 */
3128 USE_GL_FUNC(glShaderSource
) /* OpenGL 2.0 */
3129 USE_GL_FUNC(glStencilFuncSeparate
) /* OpenGL 2.0 */
3130 USE_GL_FUNC(glStencilOpSeparate
) /* OpenGL 2.0 */
3131 USE_GL_FUNC(glTexImage3D
) /* OpenGL 1.2 */
3132 USE_GL_FUNC(glTexSubImage3D
) /* OpenGL 1.2 */
3133 USE_GL_FUNC(glUniform1f
) /* OpenGL 2.0 */
3134 USE_GL_FUNC(glUniform1fv
) /* OpenGL 2.0 */
3135 USE_GL_FUNC(glUniform1i
) /* OpenGL 2.0 */
3136 USE_GL_FUNC(glUniform1iv
) /* OpenGL 2.0 */
3137 USE_GL_FUNC(glUniform2f
) /* OpenGL 2.0 */
3138 USE_GL_FUNC(glUniform2fv
) /* OpenGL 2.0 */
3139 USE_GL_FUNC(glUniform2i
) /* OpenGL 2.0 */
3140 USE_GL_FUNC(glUniform2iv
) /* OpenGL 2.0 */
3141 USE_GL_FUNC(glUniform3f
) /* OpenGL 2.0 */
3142 USE_GL_FUNC(glUniform3fv
) /* OpenGL 2.0 */
3143 USE_GL_FUNC(glUniform3i
) /* OpenGL 2.0 */
3144 USE_GL_FUNC(glUniform3iv
) /* OpenGL 2.0 */
3145 USE_GL_FUNC(glUniform4f
) /* OpenGL 2.0 */
3146 USE_GL_FUNC(glUniform4fv
) /* OpenGL 2.0 */
3147 USE_GL_FUNC(glUniform4i
) /* OpenGL 2.0 */
3148 USE_GL_FUNC(glUniform4iv
) /* OpenGL 2.0 */
3149 USE_GL_FUNC(glUniformMatrix2fv
) /* OpenGL 2.0 */
3150 USE_GL_FUNC(glUniformMatrix3fv
) /* OpenGL 2.0 */
3151 USE_GL_FUNC(glUniformMatrix4fv
) /* OpenGL 2.0 */
3152 USE_GL_FUNC(glUnmapBuffer
) /* OpenGL 1.5 */
3153 USE_GL_FUNC(glUseProgram
) /* OpenGL 2.0 */
3154 USE_GL_FUNC(glValidateProgram
) /* OpenGL 2.0 */
3155 USE_GL_FUNC(glVertexAttrib1f
) /* OpenGL 2.0 */
3156 USE_GL_FUNC(glVertexAttrib1fv
) /* OpenGL 2.0 */
3157 USE_GL_FUNC(glVertexAttrib2f
) /* OpenGL 2.0 */
3158 USE_GL_FUNC(glVertexAttrib2fv
) /* OpenGL 2.0 */
3159 USE_GL_FUNC(glVertexAttrib3f
) /* OpenGL 2.0 */
3160 USE_GL_FUNC(glVertexAttrib3fv
) /* OpenGL 2.0 */
3161 USE_GL_FUNC(glVertexAttrib4f
) /* OpenGL 2.0 */
3162 USE_GL_FUNC(glVertexAttrib4fv
) /* OpenGL 2.0 */
3163 USE_GL_FUNC(glVertexAttrib4Nsv
) /* OpenGL 2.0 */
3164 USE_GL_FUNC(glVertexAttrib4Nub
) /* OpenGL 2.0 */
3165 USE_GL_FUNC(glVertexAttrib4Nubv
) /* OpenGL 2.0 */
3166 USE_GL_FUNC(glVertexAttrib4Nusv
) /* OpenGL 2.0 */
3167 USE_GL_FUNC(glVertexAttrib4sv
) /* OpenGL 2.0 */
3168 USE_GL_FUNC(glVertexAttrib4ubv
) /* OpenGL 2.0 */
3169 USE_GL_FUNC(glVertexAttribDivisor
) /* OpenGL 3.3 */
3170 USE_GL_FUNC(glVertexAttribIPointer
) /* OpenGL 3.0 */
3171 USE_GL_FUNC(glVertexAttribPointer
) /* OpenGL 2.0 */
3174 #ifndef USE_WIN32_OPENGL
3175 /* hack: use the functions directly from the TEB table to bypass the thunks */
3176 /* note that we still need the above wglGetProcAddress calls to initialize the table */
3177 gl_info
->gl_ops
.ext
= ((struct opengl_funcs
*)NtCurrentTeb()->glTable
)->ext
;
3180 #define MAP_GL_FUNCTION(core_func, ext_func) \
3183 if (!gl_info->gl_ops.ext.p_##core_func) \
3184 gl_info->gl_ops.ext.p_##core_func = gl_info->gl_ops.ext.p_##ext_func; \
3186 #define MAP_GL_FUNCTION_CAST(core_func, ext_func) \
3189 if (!gl_info->gl_ops.ext.p_##core_func) \
3190 gl_info->gl_ops.ext.p_##core_func = (void *)gl_info->gl_ops.ext.p_##ext_func; \
3193 MAP_GL_FUNCTION(glActiveTexture
, glActiveTextureARB
);
3194 MAP_GL_FUNCTION(glAttachShader
, glAttachObjectARB
);
3195 MAP_GL_FUNCTION(glBeginQuery
, glBeginQueryARB
);
3196 MAP_GL_FUNCTION(glBindAttribLocation
, glBindAttribLocationARB
);
3197 MAP_GL_FUNCTION(glBindBuffer
, glBindBufferARB
);
3198 MAP_GL_FUNCTION(glBlendColor
, glBlendColorEXT
);
3199 MAP_GL_FUNCTION(glBlendEquation
, glBlendEquationEXT
);
3200 MAP_GL_FUNCTION(glBlendEquationSeparate
, glBlendEquationSeparateEXT
);
3201 MAP_GL_FUNCTION(glBlendFuncSeparate
, glBlendFuncSeparateEXT
);
3202 MAP_GL_FUNCTION(glBufferData
, glBufferDataARB
);
3203 MAP_GL_FUNCTION(glBufferSubData
, glBufferSubDataARB
);
3204 MAP_GL_FUNCTION(glColorMaski
, glColorMaskIndexedEXT
);
3205 MAP_GL_FUNCTION(glCompileShader
, glCompileShaderARB
);
3206 MAP_GL_FUNCTION(glCompressedTexImage2D
, glCompressedTexImage2DARB
);
3207 MAP_GL_FUNCTION(glCompressedTexImage3D
, glCompressedTexImage3DARB
);
3208 MAP_GL_FUNCTION(glCompressedTexSubImage2D
, glCompressedTexSubImage2DARB
);
3209 MAP_GL_FUNCTION(glCompressedTexSubImage3D
, glCompressedTexSubImage3DARB
);
3210 MAP_GL_FUNCTION(glCreateProgram
, glCreateProgramObjectARB
);
3211 MAP_GL_FUNCTION(glCreateShader
, glCreateShaderObjectARB
);
3212 MAP_GL_FUNCTION(glDebugMessageCallback
, glDebugMessageCallbackARB
);
3213 MAP_GL_FUNCTION(glDebugMessageControl
, glDebugMessageControlARB
);
3214 MAP_GL_FUNCTION(glDebugMessageInsert
, glDebugMessageInsertARB
);
3215 MAP_GL_FUNCTION(glDeleteBuffers
, glDeleteBuffersARB
);
3216 MAP_GL_FUNCTION(glDeleteProgram
, glDeleteObjectARB
);
3217 MAP_GL_FUNCTION(glDeleteQueries
, glDeleteQueriesARB
);
3218 MAP_GL_FUNCTION(glDeleteShader
, glDeleteObjectARB
);
3219 MAP_GL_FUNCTION(glDetachShader
, glDetachObjectARB
);
3220 MAP_GL_FUNCTION(glDisablei
, glDisableIndexedEXT
);
3221 MAP_GL_FUNCTION(glDisableVertexAttribArray
, glDisableVertexAttribArrayARB
);
3222 MAP_GL_FUNCTION(glDrawArraysInstanced
, glDrawArraysInstancedARB
);
3223 MAP_GL_FUNCTION(glDrawBuffers
, glDrawBuffersARB
);
3224 MAP_GL_FUNCTION(glDrawElementsInstanced
, glDrawElementsInstancedARB
);
3225 MAP_GL_FUNCTION(glEnablei
, glEnableIndexedEXT
);
3226 MAP_GL_FUNCTION(glEnableVertexAttribArray
, glEnableVertexAttribArrayARB
);
3227 MAP_GL_FUNCTION(glEndQuery
, glEndQueryARB
);
3228 MAP_GL_FUNCTION(glGenBuffers
, glGenBuffersARB
);
3229 MAP_GL_FUNCTION(glGenQueries
, glGenQueriesARB
);
3230 MAP_GL_FUNCTION(glGetActiveUniform
, glGetActiveUniformARB
);
3231 MAP_GL_FUNCTION(glGetAttachedShaders
, glGetAttachedObjectsARB
);
3232 MAP_GL_FUNCTION(glGetAttribLocation
, glGetAttribLocationARB
);
3233 MAP_GL_FUNCTION(glGetBooleani_v
, glGetBooleanIndexedvEXT
);
3234 MAP_GL_FUNCTION(glGetBufferSubData
, glGetBufferSubDataARB
);
3235 MAP_GL_FUNCTION(glGetCompressedTexImage
, glGetCompressedTexImageARB
);
3236 MAP_GL_FUNCTION(glGetDebugMessageLog
, glGetDebugMessageLogARB
);
3237 MAP_GL_FUNCTION(glGetIntegeri_v
, glGetIntegerIndexedvEXT
);
3238 MAP_GL_FUNCTION(glGetProgramInfoLog
, glGetInfoLogARB
);
3239 MAP_GL_FUNCTION(glGetProgramiv
, glGetObjectParameterivARB
);
3240 MAP_GL_FUNCTION(glGetQueryiv
, glGetQueryivARB
);
3241 MAP_GL_FUNCTION(glGetQueryObjectuiv
, glGetQueryObjectuivARB
);
3242 MAP_GL_FUNCTION(glGetShaderInfoLog
, glGetInfoLogARB
);
3243 MAP_GL_FUNCTION(glGetShaderiv
, glGetObjectParameterivARB
);
3244 MAP_GL_FUNCTION(glGetShaderSource
, glGetShaderSourceARB
);
3245 MAP_GL_FUNCTION(glGetUniformfv
, glGetUniformfvARB
);
3246 MAP_GL_FUNCTION(glGetUniformiv
, glGetUniformivARB
);
3247 MAP_GL_FUNCTION(glGetUniformLocation
, glGetUniformLocationARB
);
3248 MAP_GL_FUNCTION(glIsEnabledi
, glIsEnabledIndexedEXT
);
3249 MAP_GL_FUNCTION(glLinkProgram
, glLinkProgramARB
);
3250 MAP_GL_FUNCTION(glMapBuffer
, glMapBufferARB
);
3251 MAP_GL_FUNCTION_CAST(glShaderSource
, glShaderSourceARB
);
3252 MAP_GL_FUNCTION_CAST(glTexImage3D
, glTexImage3DEXT
);
3253 MAP_GL_FUNCTION(glTexSubImage3D
, glTexSubImage3DEXT
);
3254 MAP_GL_FUNCTION(glUniform1f
, glUniform1fARB
);
3255 MAP_GL_FUNCTION(glUniform1fv
, glUniform1fvARB
);
3256 MAP_GL_FUNCTION(glUniform1i
, glUniform1iARB
);
3257 MAP_GL_FUNCTION(glUniform1iv
, glUniform1ivARB
);
3258 MAP_GL_FUNCTION(glUniform2f
, glUniform2fARB
);
3259 MAP_GL_FUNCTION(glUniform2fv
, glUniform2fvARB
);
3260 MAP_GL_FUNCTION(glUniform2i
, glUniform2iARB
);
3261 MAP_GL_FUNCTION(glUniform2iv
, glUniform2ivARB
);
3262 MAP_GL_FUNCTION(glUniform3f
, glUniform3fARB
);
3263 MAP_GL_FUNCTION(glUniform3fv
, glUniform3fvARB
);
3264 MAP_GL_FUNCTION(glUniform3i
, glUniform3iARB
);
3265 MAP_GL_FUNCTION(glUniform3iv
, glUniform3ivARB
);
3266 MAP_GL_FUNCTION(glUniform4f
, glUniform4fARB
);
3267 MAP_GL_FUNCTION(glUniform4fv
, glUniform4fvARB
);
3268 MAP_GL_FUNCTION(glUniform4i
, glUniform4iARB
);
3269 MAP_GL_FUNCTION(glUniform4iv
, glUniform4ivARB
);
3270 MAP_GL_FUNCTION(glUniformMatrix2fv
, glUniformMatrix2fvARB
);
3271 MAP_GL_FUNCTION(glUniformMatrix3fv
, glUniformMatrix3fvARB
);
3272 MAP_GL_FUNCTION(glUniformMatrix4fv
, glUniformMatrix4fvARB
);
3273 MAP_GL_FUNCTION(glUnmapBuffer
, glUnmapBufferARB
);
3274 MAP_GL_FUNCTION(glUseProgram
, glUseProgramObjectARB
);
3275 MAP_GL_FUNCTION(glValidateProgram
, glValidateProgramARB
);
3276 MAP_GL_FUNCTION(glVertexAttrib1f
, glVertexAttrib1fARB
);
3277 MAP_GL_FUNCTION(glVertexAttrib1fv
, glVertexAttrib1fvARB
);
3278 MAP_GL_FUNCTION(glVertexAttrib2f
, glVertexAttrib2fARB
);
3279 MAP_GL_FUNCTION(glVertexAttrib2fv
, glVertexAttrib2fvARB
);
3280 MAP_GL_FUNCTION(glVertexAttrib3f
, glVertexAttrib3fARB
);
3281 MAP_GL_FUNCTION(glVertexAttrib3fv
, glVertexAttrib3fvARB
);
3282 MAP_GL_FUNCTION(glVertexAttrib4f
, glVertexAttrib4fARB
);
3283 MAP_GL_FUNCTION(glVertexAttrib4fv
, glVertexAttrib4fvARB
);
3284 MAP_GL_FUNCTION(glVertexAttrib4Nsv
, glVertexAttrib4NsvARB
);
3285 MAP_GL_FUNCTION(glVertexAttrib4Nub
, glVertexAttrib4NubARB
);
3286 MAP_GL_FUNCTION(glVertexAttrib4Nubv
, glVertexAttrib4NubvARB
);
3287 MAP_GL_FUNCTION(glVertexAttrib4Nusv
, glVertexAttrib4NusvARB
);
3288 MAP_GL_FUNCTION(glVertexAttrib4sv
, glVertexAttrib4svARB
);
3289 MAP_GL_FUNCTION(glVertexAttrib4ubv
, glVertexAttrib4ubvARB
);
3290 MAP_GL_FUNCTION(glVertexAttribDivisor
, glVertexAttribDivisorARB
);
3291 MAP_GL_FUNCTION(glVertexAttribIPointer
, glVertexAttribIPointerEXT
);
3292 MAP_GL_FUNCTION(glVertexAttribPointer
, glVertexAttribPointerARB
);
3293 #undef MAP_GL_FUNCTION
3294 #undef MAP_GL_FUNCTION_CAST
3297 static void wined3d_adapter_init_limits(struct wined3d_gl_info
*gl_info
)
3299 GLfloat gl_floatv
[2];
3302 gl_info
->limits
.blends
= 1;
3303 gl_info
->limits
.buffers
= 1;
3304 gl_info
->limits
.textures
= 1;
3305 gl_info
->limits
.texture_coords
= 1;
3306 gl_info
->limits
.vertex_uniform_blocks
= 0;
3307 gl_info
->limits
.geometry_uniform_blocks
= 0;
3308 gl_info
->limits
.fragment_uniform_blocks
= 0;
3309 gl_info
->limits
.fragment_samplers
= 1;
3310 gl_info
->limits
.vertex_samplers
= 0;
3311 gl_info
->limits
.combined_samplers
= gl_info
->limits
.fragment_samplers
+ gl_info
->limits
.vertex_samplers
;
3312 gl_info
->limits
.vertex_attribs
= 16;
3313 gl_info
->limits
.glsl_vs_float_constants
= 0;
3314 gl_info
->limits
.glsl_ps_float_constants
= 0;
3315 gl_info
->limits
.arb_vs_float_constants
= 0;
3316 gl_info
->limits
.arb_vs_native_constants
= 0;
3317 gl_info
->limits
.arb_vs_instructions
= 0;
3318 gl_info
->limits
.arb_vs_temps
= 0;
3319 gl_info
->limits
.arb_ps_float_constants
= 0;
3320 gl_info
->limits
.arb_ps_local_constants
= 0;
3321 gl_info
->limits
.arb_ps_instructions
= 0;
3322 gl_info
->limits
.arb_ps_temps
= 0;
3324 gl_info
->gl_ops
.gl
.p_glGetIntegerv(GL_MAX_CLIP_DISTANCES
, &gl_max
);
3325 gl_info
->limits
.user_clip_distances
= min(MAX_CLIP_DISTANCES
, gl_max
);
3326 TRACE("Clip plane support - max planes %d.\n", gl_max
);
3328 gl_info
->gl_ops
.gl
.p_glGetIntegerv(GL_MAX_LIGHTS
, &gl_max
);
3329 gl_info
->limits
.lights
= gl_max
;
3330 TRACE("Light support - max lights %d.\n", gl_max
);
3332 gl_info
->gl_ops
.gl
.p_glGetIntegerv(GL_MAX_TEXTURE_SIZE
, &gl_max
);
3333 gl_info
->limits
.texture_size
= gl_max
;
3334 TRACE("Maximum texture size support - max texture size %d.\n", gl_max
);
3336 gl_info
->gl_ops
.gl
.p_glGetFloatv(GL_ALIASED_POINT_SIZE_RANGE
, gl_floatv
);
3337 gl_info
->limits
.pointsize_min
= gl_floatv
[0];
3338 gl_info
->limits
.pointsize_max
= gl_floatv
[1];
3339 TRACE("Maximum point size support - max point size %f.\n", gl_floatv
[1]);
3341 if (gl_info
->supported
[ARB_MAP_BUFFER_ALIGNMENT
])
3343 gl_info
->gl_ops
.gl
.p_glGetIntegerv(GL_MIN_MAP_BUFFER_ALIGNMENT
, &gl_max
);
3344 TRACE("Minimum buffer map alignment: %d.\n", gl_max
);
3348 WARN_(d3d_perf
)("Driver doesn't guarantee a minimum buffer map alignment.\n");
3350 if (gl_info
->supported
[NV_REGISTER_COMBINERS
])
3352 gl_info
->gl_ops
.gl
.p_glGetIntegerv(GL_MAX_GENERAL_COMBINERS_NV
, &gl_max
);
3353 gl_info
->limits
.general_combiners
= gl_max
;
3354 TRACE("Max general combiners: %d.\n", gl_max
);
3356 if (gl_info
->supported
[ARB_DRAW_BUFFERS
] && wined3d_settings
.offscreen_rendering_mode
== ORM_FBO
)
3358 gl_info
->gl_ops
.gl
.p_glGetIntegerv(GL_MAX_DRAW_BUFFERS_ARB
, &gl_max
);
3359 gl_info
->limits
.buffers
= gl_max
;
3360 TRACE("Max draw buffers: %u.\n", gl_max
);
3362 if (gl_info
->supported
[ARB_MULTITEXTURE
])
3364 gl_info
->gl_ops
.gl
.p_glGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB
, &gl_max
);
3365 gl_info
->limits
.textures
= min(MAX_TEXTURES
, gl_max
);
3366 TRACE("Max textures: %d.\n", gl_info
->limits
.textures
);
3368 if (gl_info
->supported
[ARB_FRAGMENT_PROGRAM
])
3371 gl_info
->gl_ops
.gl
.p_glGetIntegerv(GL_MAX_TEXTURE_COORDS_ARB
, &gl_max
);
3372 gl_info
->limits
.texture_coords
= min(MAX_TEXTURES
, gl_max
);
3373 gl_info
->gl_ops
.gl
.p_glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS_ARB
, &tmp
);
3374 gl_info
->limits
.fragment_samplers
= min(MAX_FRAGMENT_SAMPLERS
, tmp
);
3378 gl_info
->limits
.texture_coords
= max(gl_info
->limits
.texture_coords
, gl_max
);
3379 gl_info
->limits
.fragment_samplers
= max(gl_info
->limits
.fragment_samplers
, gl_max
);
3381 TRACE("Max texture coords: %d.\n", gl_info
->limits
.texture_coords
);
3382 TRACE("Max fragment samplers: %d.\n", gl_info
->limits
.fragment_samplers
);
3384 if (gl_info
->supported
[ARB_VERTEX_SHADER
])
3387 gl_info
->gl_ops
.gl
.p_glGetIntegerv(GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB
, &tmp
);
3388 gl_info
->limits
.vertex_samplers
= tmp
;
3389 gl_info
->gl_ops
.gl
.p_glGetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB
, &tmp
);
3390 gl_info
->limits
.combined_samplers
= tmp
;
3391 gl_info
->gl_ops
.gl
.p_glGetIntegerv(GL_MAX_VERTEX_ATTRIBS_ARB
, &tmp
);
3392 gl_info
->limits
.vertex_attribs
= tmp
;
3394 /* Loading GLSL sampler uniforms is much simpler if we can assume that the sampler setup
3395 * is known at shader link time. In a vertex shader + pixel shader combination this isn't
3396 * an issue because then the sampler setup only depends on the two shaders. If a pixel
3397 * shader is used with fixed function vertex processing we're fine too because fixed function
3398 * vertex processing doesn't use any samplers. If fixed function fragment processing is
3399 * used we have to make sure that all vertex sampler setups are valid together with all
3400 * possible fixed function fragment processing setups. This is true if vsamplers + MAX_TEXTURES
3401 * <= max_samplers. This is true on all d3d9 cards that support vtf(gf 6 and gf7 cards).
3402 * dx9 radeon cards do not support vertex texture fetch. DX10 cards have 128 samplers, and
3403 * dx9 is limited to 8 fixed function texture stages and 4 vertex samplers. DX10 does not have
3404 * a fixed function pipeline anymore.
3406 * So this is just a check to check that our assumption holds true. If not, write a warning
3407 * and reduce the number of vertex samplers or probably disable vertex texture fetch. */
3408 if (gl_info
->limits
.vertex_samplers
&& gl_info
->limits
.combined_samplers
< 12
3409 && MAX_TEXTURES
+ gl_info
->limits
.vertex_samplers
> gl_info
->limits
.combined_samplers
)
3411 FIXME("OpenGL implementation supports %u vertex samplers and %u total samplers.\n",
3412 gl_info
->limits
.vertex_samplers
, gl_info
->limits
.combined_samplers
);
3413 FIXME("Expected vertex samplers + MAX_TEXTURES(=8) > combined_samplers.\n");
3414 if (gl_info
->limits
.combined_samplers
> MAX_TEXTURES
)
3415 gl_info
->limits
.vertex_samplers
= gl_info
->limits
.combined_samplers
- MAX_TEXTURES
;
3417 gl_info
->limits
.vertex_samplers
= 0;
3422 gl_info
->limits
.combined_samplers
= gl_info
->limits
.fragment_samplers
;
3424 TRACE("Max vertex samplers: %u.\n", gl_info
->limits
.vertex_samplers
);
3425 TRACE("Max combined samplers: %u.\n", gl_info
->limits
.combined_samplers
);
3427 if (gl_info
->supported
[ARB_VERTEX_BLEND
])
3429 gl_info
->gl_ops
.gl
.p_glGetIntegerv(GL_MAX_VERTEX_UNITS_ARB
, &gl_max
);
3430 gl_info
->limits
.blends
= gl_max
;
3431 TRACE("Max blends: %u.\n", gl_info
->limits
.blends
);
3433 if (gl_info
->supported
[EXT_TEXTURE3D
])
3435 gl_info
->gl_ops
.gl
.p_glGetIntegerv(GL_MAX_3D_TEXTURE_SIZE_EXT
, &gl_max
);
3436 gl_info
->limits
.texture3d_size
= gl_max
;
3437 TRACE("Max texture3D size: %d.\n", gl_info
->limits
.texture3d_size
);
3439 if (gl_info
->supported
[EXT_TEXTURE_FILTER_ANISOTROPIC
])
3441 gl_info
->gl_ops
.gl
.p_glGetIntegerv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT
, &gl_max
);
3442 gl_info
->limits
.anisotropy
= gl_max
;
3443 TRACE("Max anisotropy: %d.\n", gl_info
->limits
.anisotropy
);
3445 if (gl_info
->supported
[ARB_FRAGMENT_PROGRAM
])
3447 GL_EXTCALL(glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB
, GL_MAX_PROGRAM_ENV_PARAMETERS_ARB
, &gl_max
));
3448 gl_info
->limits
.arb_ps_float_constants
= gl_max
;
3449 TRACE("Max ARB_FRAGMENT_PROGRAM float constants: %d.\n", gl_info
->limits
.arb_ps_float_constants
);
3450 GL_EXTCALL(glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB
, GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB
, &gl_max
));
3451 gl_info
->limits
.arb_ps_native_constants
= gl_max
;
3452 TRACE("Max ARB_FRAGMENT_PROGRAM native float constants: %d.\n",
3453 gl_info
->limits
.arb_ps_native_constants
);
3454 GL_EXTCALL(glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB
, GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB
, &gl_max
));
3455 gl_info
->limits
.arb_ps_temps
= gl_max
;
3456 TRACE("Max ARB_FRAGMENT_PROGRAM native temporaries: %d.\n", gl_info
->limits
.arb_ps_temps
);
3457 GL_EXTCALL(glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB
, GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB
, &gl_max
));
3458 gl_info
->limits
.arb_ps_instructions
= gl_max
;
3459 TRACE("Max ARB_FRAGMENT_PROGRAM native instructions: %d.\n", gl_info
->limits
.arb_ps_instructions
);
3460 GL_EXTCALL(glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB
, GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB
, &gl_max
));
3461 gl_info
->limits
.arb_ps_local_constants
= gl_max
;
3462 TRACE("Max ARB_FRAGMENT_PROGRAM local parameters: %d.\n", gl_info
->limits
.arb_ps_instructions
);
3464 if (gl_info
->supported
[ARB_VERTEX_PROGRAM
])
3466 GL_EXTCALL(glGetProgramivARB(GL_VERTEX_PROGRAM_ARB
, GL_MAX_PROGRAM_ENV_PARAMETERS_ARB
, &gl_max
));
3467 gl_info
->limits
.arb_vs_float_constants
= gl_max
;
3468 TRACE("Max ARB_VERTEX_PROGRAM float constants: %d.\n", gl_info
->limits
.arb_vs_float_constants
);
3469 GL_EXTCALL(glGetProgramivARB(GL_VERTEX_PROGRAM_ARB
, GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB
, &gl_max
));
3470 gl_info
->limits
.arb_vs_native_constants
= gl_max
;
3471 TRACE("Max ARB_VERTEX_PROGRAM native float constants: %d.\n",
3472 gl_info
->limits
.arb_vs_native_constants
);
3473 GL_EXTCALL(glGetProgramivARB(GL_VERTEX_PROGRAM_ARB
, GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB
, &gl_max
));
3474 gl_info
->limits
.arb_vs_temps
= gl_max
;
3475 TRACE("Max ARB_VERTEX_PROGRAM native temporaries: %d.\n", gl_info
->limits
.arb_vs_temps
);
3476 GL_EXTCALL(glGetProgramivARB(GL_VERTEX_PROGRAM_ARB
, GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB
, &gl_max
));
3477 gl_info
->limits
.arb_vs_instructions
= gl_max
;
3478 TRACE("Max ARB_VERTEX_PROGRAM native instructions: %d.\n", gl_info
->limits
.arb_vs_instructions
);
3480 if (gl_info
->supported
[ARB_VERTEX_SHADER
])
3482 gl_info
->gl_ops
.gl
.p_glGetIntegerv(GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB
, &gl_max
);
3483 gl_info
->limits
.glsl_vs_float_constants
= gl_max
/ 4;
3484 TRACE("Max ARB_VERTEX_SHADER float constants: %u.\n", gl_info
->limits
.glsl_vs_float_constants
);
3486 if (gl_info
->supported
[ARB_UNIFORM_BUFFER_OBJECT
])
3488 gl_info
->gl_ops
.gl
.p_glGetIntegerv(GL_MAX_VERTEX_UNIFORM_BLOCKS
, &gl_max
);
3489 gl_info
->limits
.vertex_uniform_blocks
= min(gl_max
, WINED3D_MAX_CBS
);
3490 TRACE("Max vertex uniform blocks: %u (%d).\n", gl_info
->limits
.vertex_uniform_blocks
, gl_max
);
3493 if (gl_info
->supported
[ARB_GEOMETRY_SHADER4
] && gl_info
->supported
[ARB_UNIFORM_BUFFER_OBJECT
])
3495 gl_info
->gl_ops
.gl
.p_glGetIntegerv(GL_MAX_GEOMETRY_UNIFORM_BLOCKS
, &gl_max
);
3496 gl_info
->limits
.geometry_uniform_blocks
= min(gl_max
, WINED3D_MAX_CBS
);
3497 TRACE("Max geometry uniform blocks: %u (%d).\n", gl_info
->limits
.geometry_uniform_blocks
, gl_max
);
3499 if (gl_info
->supported
[ARB_FRAGMENT_SHADER
])
3501 gl_info
->gl_ops
.gl
.p_glGetIntegerv(GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB
, &gl_max
);
3502 gl_info
->limits
.glsl_ps_float_constants
= gl_max
/ 4;
3503 TRACE("Max ARB_FRAGMENT_SHADER float constants: %u.\n", gl_info
->limits
.glsl_ps_float_constants
);
3504 gl_info
->gl_ops
.gl
.p_glGetIntegerv(GL_MAX_VARYING_FLOATS_ARB
, &gl_max
);
3505 gl_info
->limits
.glsl_varyings
= gl_max
;
3506 TRACE("Max GLSL varyings: %u (%u 4 component varyings).\n", gl_max
, gl_max
/ 4);
3508 if (gl_info
->supported
[ARB_UNIFORM_BUFFER_OBJECT
])
3510 gl_info
->gl_ops
.gl
.p_glGetIntegerv(GL_MAX_FRAGMENT_UNIFORM_BLOCKS
, &gl_max
);
3511 gl_info
->limits
.fragment_uniform_blocks
= min(gl_max
, WINED3D_MAX_CBS
);
3512 TRACE("Max fragment uniform blocks: %u (%d).\n", gl_info
->limits
.fragment_uniform_blocks
, gl_max
);
3515 if (gl_info
->supported
[ARB_UNIFORM_BUFFER_OBJECT
])
3517 gl_info
->gl_ops
.gl
.p_glGetIntegerv(GL_MAX_COMBINED_UNIFORM_BLOCKS
, &gl_max
);
3518 TRACE("Max combined uniform blocks: %d.\n", gl_max
);
3519 gl_info
->gl_ops
.gl
.p_glGetIntegerv(GL_MAX_UNIFORM_BUFFER_BINDINGS
, &gl_max
);
3520 TRACE("Max uniform buffer bindings: %d.\n", gl_max
);
3523 if (gl_info
->supported
[NV_LIGHT_MAX_EXPONENT
])
3524 gl_info
->gl_ops
.gl
.p_glGetFloatv(GL_MAX_SHININESS_NV
, &gl_info
->limits
.shininess
);
3526 gl_info
->limits
.shininess
= 128.0f
;
3528 if ((gl_info
->supported
[ARB_FRAMEBUFFER_OBJECT
] || gl_info
->supported
[EXT_FRAMEBUFFER_MULTISAMPLE
])
3529 && wined3d_settings
.allow_multisampling
)
3531 gl_info
->gl_ops
.gl
.p_glGetIntegerv(GL_MAX_SAMPLES
, &gl_max
);
3532 gl_info
->limits
.samples
= gl_max
;
3536 /* Context activation is done by the caller. */
3537 static BOOL
wined3d_adapter_init_gl_caps(struct wined3d_adapter
*adapter
, DWORD wined3d_creation_flags
)
3541 enum wined3d_gl_extension extension
;
3542 DWORD min_gl_version
;
3546 {EXT_TEXTURE3D
, MAKEDWORD_VERSION(1, 2)},
3547 {ARB_MULTISAMPLE
, MAKEDWORD_VERSION(1, 3)},
3548 {ARB_MULTITEXTURE
, MAKEDWORD_VERSION(1, 3)},
3549 {ARB_TEXTURE_BORDER_CLAMP
, MAKEDWORD_VERSION(1, 3)},
3550 {ARB_TEXTURE_COMPRESSION
, MAKEDWORD_VERSION(1, 3)},
3551 {ARB_TEXTURE_CUBE_MAP
, MAKEDWORD_VERSION(1, 3)},
3552 {ARB_DEPTH_TEXTURE
, MAKEDWORD_VERSION(1, 4)},
3553 {ARB_POINT_PARAMETERS
, MAKEDWORD_VERSION(1, 4)},
3554 {ARB_SHADOW
, MAKEDWORD_VERSION(1, 4)},
3555 {ARB_TEXTURE_MIRRORED_REPEAT
, MAKEDWORD_VERSION(1, 4)},
3556 {EXT_BLEND_COLOR
, MAKEDWORD_VERSION(1, 4)},
3557 {EXT_BLEND_FUNC_SEPARATE
, MAKEDWORD_VERSION(1, 4)},
3558 {EXT_BLEND_MINMAX
, MAKEDWORD_VERSION(1, 4)},
3559 {EXT_BLEND_SUBTRACT
, MAKEDWORD_VERSION(1, 4)},
3560 {EXT_STENCIL_WRAP
, MAKEDWORD_VERSION(1, 4)},
3561 {NV_POINT_SPRITE
, MAKEDWORD_VERSION(1, 4)},
3562 {ARB_OCCLUSION_QUERY
, MAKEDWORD_VERSION(1, 5)},
3563 {ARB_VERTEX_BUFFER_OBJECT
, MAKEDWORD_VERSION(1, 5)},
3564 {ARB_DRAW_BUFFERS
, MAKEDWORD_VERSION(2, 0)},
3565 {ARB_FRAGMENT_SHADER
, MAKEDWORD_VERSION(2, 0)},
3566 {ARB_SHADING_LANGUAGE_100
, MAKEDWORD_VERSION(2, 0)},
3567 {ARB_TEXTURE_NON_POWER_OF_TWO
, MAKEDWORD_VERSION(2, 0)},
3568 {ARB_VERTEX_SHADER
, MAKEDWORD_VERSION(2, 0)},
3569 {EXT_BLEND_EQUATION_SEPARATE
, MAKEDWORD_VERSION(2, 0)},
3570 {ARB_PIXEL_BUFFER_OBJECT
, MAKEDWORD_VERSION(2, 1)},
3571 {EXT_TEXTURE_SRGB
, MAKEDWORD_VERSION(2, 1)},
3572 {ARB_COLOR_BUFFER_FLOAT
, MAKEDWORD_VERSION(3, 0)},
3573 {ARB_DEPTH_BUFFER_FLOAT
, MAKEDWORD_VERSION(3, 0)},
3574 {ARB_FRAMEBUFFER_OBJECT
, MAKEDWORD_VERSION(3, 0)},
3575 {ARB_FRAMEBUFFER_SRGB
, MAKEDWORD_VERSION(3, 0)},
3576 {ARB_HALF_FLOAT_PIXEL
, MAKEDWORD_VERSION(3, 0)},
3577 {ARB_HALF_FLOAT_VERTEX
, MAKEDWORD_VERSION(3, 0)},
3578 {ARB_MAP_BUFFER_RANGE
, MAKEDWORD_VERSION(3, 0)},
3579 {ARB_TEXTURE_COMPRESSION_RGTC
, MAKEDWORD_VERSION(3, 0)},
3580 {ARB_TEXTURE_FLOAT
, MAKEDWORD_VERSION(3, 0)},
3581 {ARB_TEXTURE_RG
, MAKEDWORD_VERSION(3, 0)},
3582 {EXT_DRAW_BUFFERS2
, MAKEDWORD_VERSION(3, 0)},
3583 {EXT_PACKED_FLOAT
, MAKEDWORD_VERSION(3, 0)},
3584 {EXT_TEXTURE_ARRAY
, MAKEDWORD_VERSION(3, 0)},
3585 {EXT_TEXTURE_INTEGER
, MAKEDWORD_VERSION(3, 0)},
3586 /* We don't want to enable EXT_GPU_SHADER4: even though similar
3587 * functionality is available in core GL 3.0 / GLSL 1.30, it's different
3588 * enough that reusing the same flag for the new features hurts more
3590 /* EXT_framebuffer_object, EXT_framebuffer_blit,
3591 * EXT_framebuffer_multisample and EXT_packed_depth_stencil
3592 * are integrated into ARB_framebuffer_object. */
3594 {ARB_COPY_BUFFER
, MAKEDWORD_VERSION(3, 1)},
3595 {ARB_DRAW_INSTANCED
, MAKEDWORD_VERSION(3, 1)},
3596 {ARB_UNIFORM_BUFFER_OBJECT
, MAKEDWORD_VERSION(3, 1)},
3597 {EXT_TEXTURE_SNORM
, MAKEDWORD_VERSION(3, 1)},
3598 /* We don't need or want GL_ARB_texture_rectangle (core in 3.1). */
3600 {ARB_DRAW_ELEMENTS_BASE_VERTEX
, MAKEDWORD_VERSION(3, 2)},
3601 /* ARB_geometry_shader4 exposes a somewhat different API compared to 3.2
3602 * core geometry shaders so it's not really correct to expose the
3603 * extension for core-only support. */
3604 {ARB_FRAGMENT_COORD_CONVENTIONS
, MAKEDWORD_VERSION(3, 2)},
3605 {ARB_PROVOKING_VERTEX
, MAKEDWORD_VERSION(3, 2)},
3606 {ARB_SYNC
, MAKEDWORD_VERSION(3, 2)},
3607 {ARB_VERTEX_ARRAY_BGRA
, MAKEDWORD_VERSION(3, 2)},
3609 {ARB_BLEND_FUNC_EXTENDED
, MAKEDWORD_VERSION(3, 3)},
3610 {ARB_EXPLICIT_ATTRIB_LOCATION
, MAKEDWORD_VERSION(3, 3)},
3611 {ARB_INSTANCED_ARRAYS
, MAKEDWORD_VERSION(3, 3)},
3612 {ARB_SAMPLER_OBJECTS
, MAKEDWORD_VERSION(3, 3)},
3613 {ARB_SHADER_BIT_ENCODING
, MAKEDWORD_VERSION(3, 3)},
3614 {ARB_TEXTURE_RGB10_A2UI
, MAKEDWORD_VERSION(3, 3)},
3615 {ARB_TEXTURE_SWIZZLE
, MAKEDWORD_VERSION(3, 3)},
3616 {ARB_TIMER_QUERY
, MAKEDWORD_VERSION(3, 3)},
3617 {ARB_VERTEX_TYPE_2_10_10_10_REV
, MAKEDWORD_VERSION(3, 3)},
3619 {ARB_ES2_COMPATIBILITY
, MAKEDWORD_VERSION(4, 1)},
3620 {ARB_VIEWPORT_ARRAY
, MAKEDWORD_VERSION(4, 1)},
3622 {ARB_INTERNALFORMAT_QUERY
, MAKEDWORD_VERSION(4, 2)},
3623 {ARB_MAP_BUFFER_ALIGNMENT
, MAKEDWORD_VERSION(4, 2)},
3624 {ARB_TEXTURE_COMPRESSION_BPTC
, MAKEDWORD_VERSION(4, 2)},
3625 {ARB_TEXTURE_STORAGE
, MAKEDWORD_VERSION(4, 2)},
3627 {ARB_DEBUG_OUTPUT
, MAKEDWORD_VERSION(4, 3)},
3628 {ARB_INTERNALFORMAT_QUERY2
, MAKEDWORD_VERSION(4, 3)},
3629 {ARB_TEXTURE_QUERY_LEVELS
, MAKEDWORD_VERSION(4, 3)},
3630 {ARB_TEXTURE_VIEW
, MAKEDWORD_VERSION(4, 3)},
3632 {ARB_CLIP_CONTROL
, MAKEDWORD_VERSION(4, 5)},
3633 {ARB_DERIVATIVE_CONTROL
, MAKEDWORD_VERSION(4, 5)},
3635 struct wined3d_driver_info
*driver_info
= &adapter
->driver_info
;
3636 const char *gl_vendor_str
, *gl_renderer_str
, *gl_version_str
;
3637 struct wined3d_gl_info
*gl_info
= &adapter
->gl_info
;
3638 const struct gpu_description
*gpu_description
;
3639 struct wined3d_vertex_caps vertex_caps
;
3640 struct fragment_caps fragment_caps
;
3641 struct shader_caps shader_caps
;
3642 const char *WGL_Extensions
= NULL
;
3643 enum wined3d_gl_vendor gl_vendor
;
3644 DWORD gl_version
, gl_ext_emul_mask
;
3645 UINT64 vram_bytes
= 0;
3648 GLint context_profile
= 0;
3650 TRACE("adapter %p.\n", adapter
);
3652 gl_renderer_str
= (const char *)gl_info
->gl_ops
.gl
.p_glGetString(GL_RENDERER
);
3653 TRACE("GL_RENDERER: %s.\n", debugstr_a(gl_renderer_str
));
3654 if (!gl_renderer_str
)
3656 ERR("Received a NULL GL_RENDERER.\n");
3660 gl_vendor_str
= (const char *)gl_info
->gl_ops
.gl
.p_glGetString(GL_VENDOR
);
3661 TRACE("GL_VENDOR: %s.\n", debugstr_a(gl_vendor_str
));
3664 ERR("Received a NULL GL_VENDOR.\n");
3668 /* Parse the GL_VERSION field into major and minor information */
3669 gl_version_str
= (const char *)gl_info
->gl_ops
.gl
.p_glGetString(GL_VERSION
);
3670 TRACE("GL_VERSION: %s.\n", debugstr_a(gl_version_str
));
3671 if (!gl_version_str
)
3673 ERR("Received a NULL GL_VERSION.\n");
3676 gl_version
= wined3d_parse_gl_version(gl_version_str
);
3678 load_gl_funcs(gl_info
);
3680 memset(gl_info
->supported
, 0, sizeof(gl_info
->supported
));
3681 gl_info
->supported
[WINED3D_GL_EXT_NONE
] = TRUE
;
3683 if (gl_version
>= MAKEDWORD_VERSION(3, 2))
3685 gl_info
->gl_ops
.gl
.p_glGetIntegerv(GL_CONTEXT_PROFILE_MASK
, &context_profile
);
3686 checkGLcall("Querying context profile");
3688 if (context_profile
& GL_CONTEXT_CORE_PROFILE_BIT
)
3689 TRACE("Got a core profile context.\n");
3691 gl_info
->supported
[WINED3D_GL_LEGACY_CONTEXT
] = TRUE
;
3693 TRACE("GL extensions reported:\n");
3694 if (gl_info
->supported
[WINED3D_GL_LEGACY_CONTEXT
])
3696 const char *gl_extensions
= (const char *)gl_info
->gl_ops
.gl
.p_glGetString(GL_EXTENSIONS
);
3700 ERR("Received a NULL GL_EXTENSIONS.\n");
3703 parse_extension_string(gl_info
, gl_extensions
, gl_extension_map
,
3704 sizeof(gl_extension_map
) / sizeof(*gl_extension_map
));
3708 enumerate_gl_extensions(gl_info
, gl_extension_map
,
3709 sizeof(gl_extension_map
) / sizeof(*gl_extension_map
));
3712 hdc
= wglGetCurrentDC();
3713 /* Not all GL drivers might offer WGL extensions e.g. VirtualBox. */
3714 if (GL_EXTCALL(wglGetExtensionsStringARB
))
3715 WGL_Extensions
= (const char *)GL_EXTCALL(wglGetExtensionsStringARB(hdc
));
3716 if (!WGL_Extensions
)
3717 WARN("WGL extensions not supported.\n");
3719 parse_extension_string(gl_info
, WGL_Extensions
, wgl_extension_map
,
3720 sizeof(wgl_extension_map
) / sizeof(*wgl_extension_map
));
3722 for (i
= 0; i
< ARRAY_SIZE(core_extensions
); ++i
)
3724 if (!gl_info
->supported
[core_extensions
[i
].extension
]
3725 && gl_version
>= core_extensions
[i
].min_gl_version
)
3727 for (j
= 0; j
< ARRAY_SIZE(gl_extension_map
); ++j
)
3728 if (gl_extension_map
[j
].extension
== core_extensions
[i
].extension
)
3731 if (j
< ARRAY_SIZE(gl_extension_map
))
3733 TRACE("GL CORE: %s support.\n", gl_extension_map
[j
].extension_string
);
3734 gl_info
->supported
[core_extensions
[i
].extension
] = TRUE
;
3738 FIXME("GL extension %u not in the GL extensions map.\n", core_extensions
[i
].extension
);
3743 if (gl_info
->supported
[EXT_BLEND_MINMAX
] || gl_info
->supported
[EXT_BLEND_SUBTRACT
])
3744 gl_info
->supported
[WINED3D_GL_BLEND_EQUATION
] = TRUE
;
3746 if (gl_version
>= MAKEDWORD_VERSION(2, 0))
3747 gl_info
->supported
[WINED3D_GL_VERSION_2_0
] = TRUE
;
3748 if (gl_version
>= MAKEDWORD_VERSION(3, 2))
3749 gl_info
->supported
[WINED3D_GL_VERSION_3_2
] = TRUE
;
3750 if (gl_version
>= MAKEDWORD_VERSION(4, 3))
3751 gl_info
->supported
[WINED3D_GL_VERSION_4_3
] = TRUE
;
3753 /* All the points are actually point sprites in core contexts, the APIs from
3754 * ARB_point_sprite are not supported anymore. */
3755 if (!gl_info
->supported
[WINED3D_GL_LEGACY_CONTEXT
])
3756 gl_info
->supported
[ARB_POINT_SPRITE
] = FALSE
;
3758 if (gl_info
->supported
[APPLE_FENCE
])
3760 /* GL_NV_fence and GL_APPLE_fence provide the same functionality basically.
3761 * The apple extension interacts with some other apple exts. Disable the NV
3762 * extension if the apple one is support to prevent confusion in other parts
3764 gl_info
->supported
[NV_FENCE
] = FALSE
;
3766 if (gl_info
->supported
[APPLE_FLOAT_PIXELS
])
3768 /* GL_APPLE_float_pixels == GL_ARB_texture_float + GL_ARB_half_float_pixel
3770 * The enums are the same:
3771 * GL_RGBA16F_ARB = GL_RGBA_FLOAT16_APPLE = 0x881a
3772 * GL_RGB16F_ARB = GL_RGB_FLOAT16_APPLE = 0x881b
3773 * GL_RGBA32F_ARB = GL_RGBA_FLOAT32_APPLE = 0x8814
3774 * GL_RGB32F_ARB = GL_RGB_FLOAT32_APPLE = 0x8815
3775 * GL_HALF_FLOAT_ARB = GL_HALF_APPLE = 0x140b
3777 if (!gl_info
->supported
[ARB_TEXTURE_FLOAT
])
3779 TRACE(" IMPLIED: GL_ARB_texture_float support (by GL_APPLE_float_pixels).\n");
3780 gl_info
->supported
[ARB_TEXTURE_FLOAT
] = TRUE
;
3782 if (!gl_info
->supported
[ARB_HALF_FLOAT_PIXEL
])
3784 TRACE(" IMPLIED: GL_ARB_half_float_pixel support (by GL_APPLE_float_pixels).\n");
3785 gl_info
->supported
[ARB_HALF_FLOAT_PIXEL
] = TRUE
;
3788 if (gl_info
->supported
[ARB_MAP_BUFFER_RANGE
])
3790 /* GL_ARB_map_buffer_range and GL_APPLE_flush_buffer_range provide the same
3791 * functionality. Prefer the ARB extension */
3792 gl_info
->supported
[APPLE_FLUSH_BUFFER_RANGE
] = FALSE
;
3794 if (gl_info
->supported
[ARB_TEXTURE_CUBE_MAP
])
3796 TRACE(" IMPLIED: NVIDIA (NV) Texture Gen Reflection support.\n");
3797 gl_info
->supported
[NV_TEXGEN_REFLECTION
] = TRUE
;
3799 if (!gl_info
->supported
[ARB_VERTEX_ARRAY_BGRA
] && gl_info
->supported
[EXT_VERTEX_ARRAY_BGRA
])
3801 TRACE(" IMPLIED: ARB_vertex_array_bgra support (by EXT_vertex_array_bgra).\n");
3802 gl_info
->supported
[ARB_VERTEX_ARRAY_BGRA
] = TRUE
;
3804 if (!gl_info
->supported
[EXT_TEXTURE_COMPRESSION_RGTC
] && gl_info
->supported
[ARB_TEXTURE_COMPRESSION_RGTC
])
3806 TRACE(" IMPLIED: EXT_texture_compression_rgtc support (by ARB_texture_compression_rgtc).\n");
3807 gl_info
->supported
[EXT_TEXTURE_COMPRESSION_RGTC
] = TRUE
;
3809 if (!gl_info
->supported
[ARB_TEXTURE_COMPRESSION_RGTC
] && gl_info
->supported
[EXT_TEXTURE_COMPRESSION_RGTC
])
3811 TRACE(" IMPLIED: ARB_texture_compression_rgtc support (by EXT_texture_compression_rgtc).\n");
3812 gl_info
->supported
[ARB_TEXTURE_COMPRESSION_RGTC
] = TRUE
;
3814 if (gl_info
->supported
[ARB_TEXTURE_COMPRESSION_RGTC
] && !gl_info
->supported
[ARB_TEXTURE_RG
])
3816 TRACE("ARB_texture_rg not supported, disabling ARB_texture_compression_rgtc.\n");
3817 gl_info
->supported
[ARB_TEXTURE_COMPRESSION_RGTC
] = FALSE
;
3819 if (gl_info
->supported
[NV_TEXTURE_SHADER2
])
3821 if (gl_info
->supported
[NV_REGISTER_COMBINERS
])
3823 /* Also disable ATI_FRAGMENT_SHADER if register combiners and texture_shader2
3824 * are supported. The nv extensions provide the same functionality as the
3825 * ATI one, and a bit more(signed pixelformats). */
3826 gl_info
->supported
[ATI_FRAGMENT_SHADER
] = FALSE
;
3829 if (gl_info
->supported
[ARB_TEXTURE_NON_POWER_OF_TWO
])
3831 /* If we have full NP2 texture support, disable
3832 * GL_ARB_texture_rectangle because we will never use it.
3833 * This saves a few redundant glDisable calls. */
3834 gl_info
->supported
[ARB_TEXTURE_RECTANGLE
] = FALSE
;
3836 if (gl_info
->supported
[ATI_FRAGMENT_SHADER
])
3838 /* Disable NV_register_combiners and fragment shader if this is supported.
3839 * generally the NV extensions are preferred over the ATI ones, and this
3840 * extension is disabled if register_combiners and texture_shader2 are both
3841 * supported. So we reach this place only if we have incomplete NV dxlevel 8
3842 * fragment processing support. */
3843 gl_info
->supported
[NV_REGISTER_COMBINERS
] = FALSE
;
3844 gl_info
->supported
[NV_REGISTER_COMBINERS2
] = FALSE
;
3845 gl_info
->supported
[NV_TEXTURE_SHADER
] = FALSE
;
3846 gl_info
->supported
[NV_TEXTURE_SHADER2
] = FALSE
;
3848 if (gl_info
->supported
[NV_HALF_FLOAT
])
3850 /* GL_ARB_half_float_vertex is a subset of GL_NV_half_float. */
3851 gl_info
->supported
[ARB_HALF_FLOAT_VERTEX
] = TRUE
;
3853 if (gl_info
->supported
[ARB_FRAMEBUFFER_SRGB
] && !gl_info
->supported
[EXT_TEXTURE_SRGB_DECODE
])
3855 /* Current wined3d sRGB infrastructure requires EXT_texture_sRGB_decode
3856 * for GL_ARB_framebuffer_sRGB support (without EXT_texture_sRGB_decode
3857 * we never render to sRGB surfaces). */
3858 gl_info
->supported
[ARB_FRAMEBUFFER_SRGB
] = FALSE
;
3860 if (gl_info
->supported
[ARB_OCCLUSION_QUERY
])
3864 GL_EXTCALL(glGetQueryiv(GL_SAMPLES_PASSED
, GL_QUERY_COUNTER_BITS
, &counter_bits
));
3865 TRACE("Occlusion query counter has %d bits.\n", counter_bits
);
3867 gl_info
->supported
[ARB_OCCLUSION_QUERY
] = FALSE
;
3869 if (gl_info
->supported
[ARB_TIMER_QUERY
])
3873 GL_EXTCALL(glGetQueryiv(GL_TIMESTAMP
, GL_QUERY_COUNTER_BITS
, &counter_bits
));
3874 TRACE("Timestamp query counter has %d bits.\n", counter_bits
);
3876 gl_info
->supported
[ARB_TIMER_QUERY
] = FALSE
;
3878 if (gl_info
->supported
[ARB_VIEWPORT_ARRAY
])
3880 GLint subpixel_bits
;
3882 gl_info
->gl_ops
.gl
.p_glGetIntegerv(GL_VIEWPORT_SUBPIXEL_BITS
, &subpixel_bits
);
3883 TRACE("Viewport supports %d subpixel bits.\n", subpixel_bits
);
3884 if (subpixel_bits
< 8)
3885 gl_info
->supported
[ARB_VIEWPORT_ARRAY
] = FALSE
;
3887 if (gl_info
->supported
[ARB_CLIP_CONTROL
] && !gl_info
->supported
[ARB_VIEWPORT_ARRAY
])
3889 /* When using ARB_clip_control we need the float viewport parameters
3890 * introduced by ARB_viewport_array to take care of the shifted pixel
3892 TRACE("Disabling ARB_clip_control because ARB_viewport_array is not supported.\n");
3893 gl_info
->supported
[ARB_CLIP_CONTROL
] = FALSE
;
3895 if (!gl_info
->supported
[ATI_TEXTURE_MIRROR_ONCE
] && gl_info
->supported
[EXT_TEXTURE_MIRROR_CLAMP
])
3897 TRACE(" IMPLIED: ATI_texture_mirror_once support (by EXT_texture_mirror_clamp).\n");
3898 gl_info
->supported
[ATI_TEXTURE_MIRROR_ONCE
] = TRUE
;
3900 if (!gl_info
->supported
[ARB_TEXTURE_MIRROR_CLAMP_TO_EDGE
] && gl_info
->supported
[ATI_TEXTURE_MIRROR_ONCE
])
3902 TRACE(" IMPLIED: ARB_texture_mirror_clamp_to_edge support (by ATI_texture_mirror_once).\n");
3903 gl_info
->supported
[ARB_TEXTURE_MIRROR_CLAMP_TO_EDGE
] = TRUE
;
3905 if (gl_info
->supported
[ARB_TEXTURE_STORAGE
] && gl_info
->supported
[APPLE_YCBCR_422
])
3907 /* AFAIK APPLE_ycbcr_422 is only available in legacy contexts so we shouldn't ever hit this. */
3908 FIXME("Disabling APPLE_ycbcr_422 because of ARB_texture_storage.\n");
3909 gl_info
->supported
[APPLE_YCBCR_422
] = FALSE
;
3912 wined3d_adapter_init_limits(gl_info
);
3914 if (gl_info
->supported
[ARB_VERTEX_PROGRAM
] && test_arb_vs_offset_limit(gl_info
))
3915 gl_info
->quirks
|= WINED3D_QUIRK_ARB_VS_OFFSET_LIMIT
;
3917 if (gl_info
->supported
[ARB_SHADING_LANGUAGE_100
])
3919 const char *str
= (const char *)gl_info
->gl_ops
.gl
.p_glGetString(GL_SHADING_LANGUAGE_VERSION_ARB
);
3920 unsigned int major
, minor
;
3922 TRACE("GLSL version string: %s.\n", debugstr_a(str
));
3924 /* The format of the GLSL version string is "major.minor[.release] [vendor info]". */
3925 sscanf(str
, "%u.%u", &major
, &minor
);
3926 gl_info
->glsl_version
= MAKEDWORD_VERSION(major
, minor
);
3929 checkGLcall("extension detection");
3931 adapter
->shader_backend
= select_shader_backend(gl_info
);
3932 adapter
->vertex_pipe
= select_vertex_implementation(gl_info
, adapter
->shader_backend
);
3933 adapter
->fragment_pipe
= select_fragment_implementation(gl_info
, adapter
->shader_backend
);
3934 adapter
->blitter
= select_blit_implementation(gl_info
, adapter
->shader_backend
);
3936 adapter
->shader_backend
->shader_get_caps(gl_info
, &shader_caps
);
3937 adapter
->d3d_info
.vs_clipping
= shader_caps
.wined3d_caps
& WINED3D_SHADER_CAP_VS_CLIPPING
;
3938 adapter
->d3d_info
.limits
.vs_version
= shader_caps
.vs_version
;
3939 adapter
->d3d_info
.limits
.hs_version
= shader_caps
.hs_version
;
3940 adapter
->d3d_info
.limits
.ds_version
= shader_caps
.ds_version
;
3941 adapter
->d3d_info
.limits
.gs_version
= shader_caps
.gs_version
;
3942 adapter
->d3d_info
.limits
.ps_version
= shader_caps
.ps_version
;
3943 adapter
->d3d_info
.limits
.cs_version
= shader_caps
.cs_version
;
3944 adapter
->d3d_info
.limits
.vs_uniform_count
= shader_caps
.vs_uniform_count
;
3945 adapter
->d3d_info
.limits
.ps_uniform_count
= shader_caps
.ps_uniform_count
;
3946 adapter
->d3d_info
.limits
.varying_count
= shader_caps
.varying_count
;
3948 adapter
->vertex_pipe
->vp_get_caps(gl_info
, &vertex_caps
);
3949 adapter
->d3d_info
.xyzrhw
= vertex_caps
.xyzrhw
;
3950 adapter
->d3d_info
.ffp_generic_attributes
= vertex_caps
.ffp_generic_attributes
;
3951 adapter
->d3d_info
.limits
.ffp_vertex_blend_matrices
= vertex_caps
.max_vertex_blend_matrices
;
3952 adapter
->d3d_info
.emulated_flatshading
= vertex_caps
.emulated_flatshading
;
3954 adapter
->fragment_pipe
->get_caps(gl_info
, &fragment_caps
);
3955 adapter
->d3d_info
.limits
.ffp_blend_stages
= fragment_caps
.MaxTextureBlendStages
;
3956 adapter
->d3d_info
.limits
.ffp_textures
= fragment_caps
.MaxSimultaneousTextures
;
3957 adapter
->d3d_info
.shader_color_key
= fragment_caps
.wined3d_caps
& WINED3D_FRAGMENT_CAP_COLOR_KEY
;
3958 adapter
->d3d_info
.wined3d_creation_flags
= wined3d_creation_flags
;
3959 TRACE("Max texture stages: %u.\n", adapter
->d3d_info
.limits
.ffp_blend_stages
);
3961 adapter
->d3d_info
.valid_rt_mask
= 0;
3962 for (i
= 0; i
< gl_info
->limits
.buffers
; ++i
)
3963 adapter
->d3d_info
.valid_rt_mask
|= (1u << i
);
3965 if (!adapter
->d3d_info
.shader_color_key
)
3967 /* We do not want to deal with re-creating immutable texture storage for color keying emulation. */
3968 WARN("Disabling ARB_texture_storage because fragment pipe doesn't support color keying.\n");
3969 gl_info
->supported
[ARB_TEXTURE_STORAGE
] = FALSE
;
3972 if (gl_info
->supported
[ARB_FRAMEBUFFER_OBJECT
])
3974 gl_info
->fbo_ops
.glIsRenderbuffer
= gl_info
->gl_ops
.ext
.p_glIsRenderbuffer
;
3975 gl_info
->fbo_ops
.glBindRenderbuffer
= gl_info
->gl_ops
.ext
.p_glBindRenderbuffer
;
3976 gl_info
->fbo_ops
.glDeleteRenderbuffers
= gl_info
->gl_ops
.ext
.p_glDeleteRenderbuffers
;
3977 gl_info
->fbo_ops
.glGenRenderbuffers
= gl_info
->gl_ops
.ext
.p_glGenRenderbuffers
;
3978 gl_info
->fbo_ops
.glRenderbufferStorage
= gl_info
->gl_ops
.ext
.p_glRenderbufferStorage
;
3979 gl_info
->fbo_ops
.glRenderbufferStorageMultisample
= gl_info
->gl_ops
.ext
.p_glRenderbufferStorageMultisample
;
3980 gl_info
->fbo_ops
.glGetRenderbufferParameteriv
= gl_info
->gl_ops
.ext
.p_glGetRenderbufferParameteriv
;
3981 gl_info
->fbo_ops
.glIsFramebuffer
= gl_info
->gl_ops
.ext
.p_glIsFramebuffer
;
3982 gl_info
->fbo_ops
.glBindFramebuffer
= gl_info
->gl_ops
.ext
.p_glBindFramebuffer
;
3983 gl_info
->fbo_ops
.glDeleteFramebuffers
= gl_info
->gl_ops
.ext
.p_glDeleteFramebuffers
;
3984 gl_info
->fbo_ops
.glGenFramebuffers
= gl_info
->gl_ops
.ext
.p_glGenFramebuffers
;
3985 gl_info
->fbo_ops
.glCheckFramebufferStatus
= gl_info
->gl_ops
.ext
.p_glCheckFramebufferStatus
;
3986 gl_info
->fbo_ops
.glFramebufferTexture1D
= gl_info
->gl_ops
.ext
.p_glFramebufferTexture1D
;
3987 gl_info
->fbo_ops
.glFramebufferTexture2D
= gl_info
->gl_ops
.ext
.p_glFramebufferTexture2D
;
3988 gl_info
->fbo_ops
.glFramebufferTexture3D
= gl_info
->gl_ops
.ext
.p_glFramebufferTexture3D
;
3989 gl_info
->fbo_ops
.glFramebufferTextureLayer
= gl_info
->gl_ops
.ext
.p_glFramebufferTextureLayer
;
3990 gl_info
->fbo_ops
.glFramebufferRenderbuffer
= gl_info
->gl_ops
.ext
.p_glFramebufferRenderbuffer
;
3991 gl_info
->fbo_ops
.glGetFramebufferAttachmentParameteriv
3992 = gl_info
->gl_ops
.ext
.p_glGetFramebufferAttachmentParameteriv
;
3993 gl_info
->fbo_ops
.glBlitFramebuffer
= gl_info
->gl_ops
.ext
.p_glBlitFramebuffer
;
3994 gl_info
->fbo_ops
.glGenerateMipmap
= gl_info
->gl_ops
.ext
.p_glGenerateMipmap
;
3998 if (gl_info
->supported
[EXT_FRAMEBUFFER_OBJECT
])
4000 gl_info
->fbo_ops
.glIsRenderbuffer
= gl_info
->gl_ops
.ext
.p_glIsRenderbufferEXT
;
4001 gl_info
->fbo_ops
.glBindRenderbuffer
= gl_info
->gl_ops
.ext
.p_glBindRenderbufferEXT
;
4002 gl_info
->fbo_ops
.glDeleteRenderbuffers
= gl_info
->gl_ops
.ext
.p_glDeleteRenderbuffersEXT
;
4003 gl_info
->fbo_ops
.glGenRenderbuffers
= gl_info
->gl_ops
.ext
.p_glGenRenderbuffersEXT
;
4004 gl_info
->fbo_ops
.glRenderbufferStorage
= gl_info
->gl_ops
.ext
.p_glRenderbufferStorageEXT
;
4005 gl_info
->fbo_ops
.glGetRenderbufferParameteriv
= gl_info
->gl_ops
.ext
.p_glGetRenderbufferParameterivEXT
;
4006 gl_info
->fbo_ops
.glIsFramebuffer
= gl_info
->gl_ops
.ext
.p_glIsFramebufferEXT
;
4007 gl_info
->fbo_ops
.glBindFramebuffer
= gl_info
->gl_ops
.ext
.p_glBindFramebufferEXT
;
4008 gl_info
->fbo_ops
.glDeleteFramebuffers
= gl_info
->gl_ops
.ext
.p_glDeleteFramebuffersEXT
;
4009 gl_info
->fbo_ops
.glGenFramebuffers
= gl_info
->gl_ops
.ext
.p_glGenFramebuffersEXT
;
4010 gl_info
->fbo_ops
.glCheckFramebufferStatus
= gl_info
->gl_ops
.ext
.p_glCheckFramebufferStatusEXT
;
4011 gl_info
->fbo_ops
.glFramebufferTexture1D
= gl_info
->gl_ops
.ext
.p_glFramebufferTexture1DEXT
;
4012 gl_info
->fbo_ops
.glFramebufferTexture2D
= gl_info
->gl_ops
.ext
.p_glFramebufferTexture2DEXT
;
4013 gl_info
->fbo_ops
.glFramebufferTexture3D
= gl_info
->gl_ops
.ext
.p_glFramebufferTexture3DEXT
;
4014 gl_info
->fbo_ops
.glFramebufferRenderbuffer
= gl_info
->gl_ops
.ext
.p_glFramebufferRenderbufferEXT
;
4015 gl_info
->fbo_ops
.glGetFramebufferAttachmentParameteriv
4016 = gl_info
->gl_ops
.ext
.p_glGetFramebufferAttachmentParameterivEXT
;
4017 gl_info
->fbo_ops
.glGenerateMipmap
= gl_info
->gl_ops
.ext
.p_glGenerateMipmapEXT
;
4019 else if (wined3d_settings
.offscreen_rendering_mode
== ORM_FBO
)
4021 WARN_(d3d_perf
)("Framebuffer objects not supported, falling back to backbuffer offscreen rendering mode.\n");
4022 wined3d_settings
.offscreen_rendering_mode
= ORM_BACKBUFFER
;
4025 if (gl_info
->supported
[ARB_GEOMETRY_SHADER4
])
4027 gl_info
->fbo_ops
.glFramebufferTextureLayer
= gl_info
->gl_ops
.ext
.p_glFramebufferTextureLayerARB
;
4029 if (gl_info
->supported
[EXT_FRAMEBUFFER_BLIT
])
4031 gl_info
->fbo_ops
.glBlitFramebuffer
= gl_info
->gl_ops
.ext
.p_glBlitFramebufferEXT
;
4033 if (gl_info
->supported
[EXT_FRAMEBUFFER_MULTISAMPLE
])
4035 gl_info
->fbo_ops
.glRenderbufferStorageMultisample
4036 = gl_info
->gl_ops
.ext
.p_glRenderbufferStorageMultisampleEXT
;
4040 gl_info
->wrap_lookup
[WINED3D_TADDRESS_WRAP
- WINED3D_TADDRESS_WRAP
] = GL_REPEAT
;
4041 gl_info
->wrap_lookup
[WINED3D_TADDRESS_MIRROR
- WINED3D_TADDRESS_WRAP
] =
4042 gl_info
->supported
[ARB_TEXTURE_MIRRORED_REPEAT
] ? GL_MIRRORED_REPEAT_ARB
: GL_REPEAT
;
4043 gl_info
->wrap_lookup
[WINED3D_TADDRESS_CLAMP
- WINED3D_TADDRESS_WRAP
] = GL_CLAMP_TO_EDGE
;
4044 gl_info
->wrap_lookup
[WINED3D_TADDRESS_BORDER
- WINED3D_TADDRESS_WRAP
] =
4045 gl_info
->supported
[ARB_TEXTURE_BORDER_CLAMP
] ? GL_CLAMP_TO_BORDER_ARB
: GL_REPEAT
;
4046 gl_info
->wrap_lookup
[WINED3D_TADDRESS_MIRROR_ONCE
- WINED3D_TADDRESS_WRAP
] =
4047 gl_info
->supported
[ARB_TEXTURE_MIRROR_CLAMP_TO_EDGE
] ? GL_MIRROR_CLAMP_TO_EDGE
: GL_REPEAT
;
4049 if (!gl_info
->supported
[WINED3D_GL_LEGACY_CONTEXT
])
4053 GL_EXTCALL(glGenVertexArrays(1, &vao
));
4054 GL_EXTCALL(glBindVertexArray(vao
));
4055 checkGLcall("creating VAO");
4058 gl_vendor
= wined3d_guess_gl_vendor(gl_info
, gl_vendor_str
, gl_renderer_str
);
4059 TRACE("Guessed GL vendor %#x.\n", gl_vendor
);
4061 if (!(gpu_description
= query_gpu_description(gl_info
, &vram_bytes
)))
4063 static const struct gpu_description default_gpu_description
=
4064 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_RIVA_128
, "Direct3D HAL", DRIVER_UNKNOWN
, WINE_DEFAULT_VIDMEM
};
4065 enum wined3d_pci_vendor vendor
;
4066 enum wined3d_pci_device device
;
4068 vendor
= wined3d_guess_card_vendor(gl_vendor_str
, gl_renderer_str
);
4069 TRACE("Guessed vendor PCI ID 0x%04x.\n", vendor
);
4071 device
= wined3d_guess_card(&shader_caps
, &fragment_caps
, gl_info
->glsl_version
,
4072 gl_renderer_str
, &gl_vendor
, &vendor
);
4073 TRACE("Guessed device PCI ID 0x%04x.\n", device
);
4075 if (!(gpu_description
= get_gpu_description(vendor
, device
)))
4077 ERR("Card %04x:%04x not found in driver DB.\n", vendor
, device
);
4078 gpu_description
= &default_gpu_description
;
4081 fixup_extensions(gl_info
, gl_renderer_str
, gl_vendor
, gpu_description
->vendor
, gpu_description
->card
);
4082 init_driver_info(driver_info
, gpu_description
, vram_bytes
);
4084 gl_ext_emul_mask
= adapter
->vertex_pipe
->vp_get_emul_mask(gl_info
)
4085 | adapter
->fragment_pipe
->get_emul_mask(gl_info
);
4086 if (gl_ext_emul_mask
& GL_EXT_EMUL_ARB_MULTITEXTURE
)
4087 install_gl_compat_wrapper(gl_info
, ARB_MULTITEXTURE
);
4088 if (gl_ext_emul_mask
& GL_EXT_EMUL_EXT_FOG_COORD
)
4089 install_gl_compat_wrapper(gl_info
, EXT_FOG_COORD
);
4094 UINT CDECL
wined3d_get_adapter_count(const struct wined3d
*wined3d
)
4096 TRACE("wined3d %p, reporting %u adapters.\n",
4097 wined3d
, wined3d
->adapter_count
);
4099 return wined3d
->adapter_count
;
4102 HRESULT CDECL
wined3d_register_software_device(struct wined3d
*wined3d
, void *init_function
)
4104 FIXME("wined3d %p, init_function %p stub!\n", wined3d
, init_function
);
4109 HRESULT CDECL
wined3d_get_output_desc(const struct wined3d
*wined3d
, unsigned int adapter_idx
,
4110 struct wined3d_output_desc
*desc
)
4112 enum wined3d_display_rotation rotation
;
4113 const struct wined3d_adapter
*adapter
;
4114 struct wined3d_display_mode mode
;
4118 TRACE("wined3d %p, adapter_idx %u, desc %p.\n", wined3d
, adapter_idx
, desc
);
4120 if (adapter_idx
>= wined3d
->adapter_count
)
4121 return WINED3DERR_INVALIDCALL
;
4123 adapter
= &wined3d
->adapters
[adapter_idx
];
4124 if (!(monitor
= MonitorFromPoint(adapter
->monitor_position
, MONITOR_DEFAULTTOPRIMARY
)))
4125 return WINED3DERR_INVALIDCALL
;
4127 if (FAILED(hr
= wined3d_get_adapter_display_mode(wined3d
, adapter_idx
, &mode
, &rotation
)))
4130 memcpy(desc
->device_name
, adapter
->DeviceName
, sizeof(desc
->device_name
));
4131 SetRect(&desc
->desktop_rect
, 0, 0, mode
.width
, mode
.height
);
4132 OffsetRect(&desc
->desktop_rect
, adapter
->monitor_position
.x
, adapter
->monitor_position
.y
);
4133 /* FIXME: We should get this from EnumDisplayDevices() when the adapters
4135 desc
->attached_to_desktop
= TRUE
;
4136 desc
->rotation
= rotation
;
4137 desc
->monitor
= monitor
;
4142 /* FIXME: GetAdapterModeCount and EnumAdapterModes currently only returns modes
4143 of the same bpp but different resolutions */
4145 /* Note: dx9 supplies a format. Calls from d3d8 supply WINED3DFMT_UNKNOWN */
4146 UINT CDECL
wined3d_get_adapter_mode_count(const struct wined3d
*wined3d
, UINT adapter_idx
,
4147 enum wined3d_format_id format_id
, enum wined3d_scanline_ordering scanline_ordering
)
4149 const struct wined3d_adapter
*adapter
;
4150 const struct wined3d_format
*format
;
4156 TRACE("wined3d %p, adapter_idx %u, format %s, scanline_ordering %#x.\n",
4157 wined3d
, adapter_idx
, debug_d3dformat(format_id
), scanline_ordering
);
4159 if (adapter_idx
>= wined3d
->adapter_count
)
4162 adapter
= &wined3d
->adapters
[adapter_idx
];
4163 format
= wined3d_get_format(&adapter
->gl_info
, format_id
);
4164 format_bits
= format
->byte_count
* CHAR_BIT
;
4166 memset(&mode
, 0, sizeof(mode
));
4167 mode
.dmSize
= sizeof(mode
);
4169 while (EnumDisplaySettingsExW(adapter
->DeviceName
, j
++, &mode
, 0))
4171 if (mode
.dmFields
& DM_DISPLAYFLAGS
)
4173 if (scanline_ordering
== WINED3D_SCANLINE_ORDERING_PROGRESSIVE
4174 && (mode
.u2
.dmDisplayFlags
& DM_INTERLACED
))
4177 if (scanline_ordering
== WINED3D_SCANLINE_ORDERING_INTERLACED
4178 && !(mode
.u2
.dmDisplayFlags
& DM_INTERLACED
))
4182 if (format_id
== WINED3DFMT_UNKNOWN
)
4184 /* This is for d3d8, do not enumerate P8 here. */
4185 if (mode
.dmBitsPerPel
== 32 || mode
.dmBitsPerPel
== 16) ++i
;
4187 else if (mode
.dmBitsPerPel
== format_bits
)
4193 TRACE("Returning %u matching modes (out of %u total) for adapter %u.\n", i
, j
, adapter_idx
);
4198 /* Note: dx9 supplies a format. Calls from d3d8 supply WINED3DFMT_UNKNOWN */
4199 HRESULT CDECL
wined3d_enum_adapter_modes(const struct wined3d
*wined3d
, UINT adapter_idx
,
4200 enum wined3d_format_id format_id
, enum wined3d_scanline_ordering scanline_ordering
,
4201 UINT mode_idx
, struct wined3d_display_mode
*mode
)
4203 const struct wined3d_adapter
*adapter
;
4204 const struct wined3d_format
*format
;
4210 TRACE("wined3d %p, adapter_idx %u, format %s, scanline_ordering %#x, mode_idx %u, mode %p.\n",
4211 wined3d
, adapter_idx
, debug_d3dformat(format_id
), scanline_ordering
, mode_idx
, mode
);
4213 if (!mode
|| adapter_idx
>= wined3d
->adapter_count
)
4214 return WINED3DERR_INVALIDCALL
;
4216 adapter
= &wined3d
->adapters
[adapter_idx
];
4217 format
= wined3d_get_format(&adapter
->gl_info
, format_id
);
4218 format_bits
= format
->byte_count
* CHAR_BIT
;
4220 memset(&m
, 0, sizeof(m
));
4221 m
.dmSize
= sizeof(m
);
4223 while (i
<= mode_idx
)
4225 if (!EnumDisplaySettingsExW(adapter
->DeviceName
, j
++, &m
, 0))
4227 WARN("Invalid mode_idx %u.\n", mode_idx
);
4228 return WINED3DERR_INVALIDCALL
;
4231 if (m
.dmFields
& DM_DISPLAYFLAGS
)
4233 if (scanline_ordering
== WINED3D_SCANLINE_ORDERING_PROGRESSIVE
4234 && (m
.u2
.dmDisplayFlags
& DM_INTERLACED
))
4237 if (scanline_ordering
== WINED3D_SCANLINE_ORDERING_INTERLACED
4238 && !(m
.u2
.dmDisplayFlags
& DM_INTERLACED
))
4242 if (format_id
== WINED3DFMT_UNKNOWN
)
4244 /* This is for d3d8, do not enumerate P8 here. */
4245 if (m
.dmBitsPerPel
== 32 || m
.dmBitsPerPel
== 16) ++i
;
4247 else if (m
.dmBitsPerPel
== format_bits
)
4253 mode
->width
= m
.dmPelsWidth
;
4254 mode
->height
= m
.dmPelsHeight
;
4255 mode
->refresh_rate
= DEFAULT_REFRESH_RATE
;
4256 if (m
.dmFields
& DM_DISPLAYFREQUENCY
)
4257 mode
->refresh_rate
= m
.dmDisplayFrequency
;
4259 if (format_id
== WINED3DFMT_UNKNOWN
)
4260 mode
->format_id
= pixelformat_for_depth(m
.dmBitsPerPel
);
4262 mode
->format_id
= format_id
;
4264 if (!(m
.dmFields
& DM_DISPLAYFLAGS
))
4265 mode
->scanline_ordering
= WINED3D_SCANLINE_ORDERING_UNKNOWN
;
4266 else if (m
.u2
.dmDisplayFlags
& DM_INTERLACED
)
4267 mode
->scanline_ordering
= WINED3D_SCANLINE_ORDERING_INTERLACED
;
4269 mode
->scanline_ordering
= WINED3D_SCANLINE_ORDERING_PROGRESSIVE
;
4271 TRACE("%ux%u@%u %u bpp, %s %#x.\n", mode
->width
, mode
->height
, mode
->refresh_rate
,
4272 m
.dmBitsPerPel
, debug_d3dformat(mode
->format_id
), mode
->scanline_ordering
);
4277 HRESULT CDECL
wined3d_find_closest_matching_adapter_mode(const struct wined3d
*wined3d
,
4278 unsigned int adapter_idx
, struct wined3d_display_mode
*mode
)
4280 unsigned int i
, j
, mode_count
, matching_mode_count
, closest
;
4281 struct wined3d_display_mode
**matching_modes
;
4282 struct wined3d_display_mode
*modes
;
4285 TRACE("wined3d %p, adapter_idx %u, mode %p.\n", wined3d
, adapter_idx
, mode
);
4287 if (!(mode_count
= wined3d_get_adapter_mode_count(wined3d
, adapter_idx
,
4288 mode
->format_id
, WINED3D_SCANLINE_ORDERING_UNKNOWN
)))
4290 WARN("Adapter has 0 matching modes.\n");
4294 if (!(modes
= wined3d_calloc(mode_count
, sizeof(*modes
))))
4295 return E_OUTOFMEMORY
;
4296 if (!(matching_modes
= wined3d_calloc(mode_count
, sizeof(*matching_modes
))))
4298 HeapFree(GetProcessHeap(), 0, modes
);
4299 return E_OUTOFMEMORY
;
4302 for (i
= 0; i
< mode_count
; ++i
)
4304 if (FAILED(hr
= wined3d_enum_adapter_modes(wined3d
, adapter_idx
,
4305 mode
->format_id
, WINED3D_SCANLINE_ORDERING_UNKNOWN
, i
, &modes
[i
])))
4307 HeapFree(GetProcessHeap(), 0, matching_modes
);
4308 HeapFree(GetProcessHeap(), 0, modes
);
4311 matching_modes
[i
] = &modes
[i
];
4314 matching_mode_count
= mode_count
;
4316 if (mode
->scanline_ordering
!= WINED3D_SCANLINE_ORDERING_UNKNOWN
)
4318 for (i
= 0, j
= 0; i
< matching_mode_count
; ++i
)
4320 if (matching_modes
[i
]->scanline_ordering
== mode
->scanline_ordering
)
4321 matching_modes
[j
++] = matching_modes
[i
];
4324 matching_mode_count
= j
;
4327 if (mode
->refresh_rate
)
4329 for (i
= 0, j
= 0; i
< matching_mode_count
; ++i
)
4331 if (matching_modes
[i
]->refresh_rate
== mode
->refresh_rate
)
4332 matching_modes
[j
++] = matching_modes
[i
];
4335 matching_mode_count
= j
;
4338 if (!mode
->width
|| !mode
->height
)
4340 struct wined3d_display_mode current_mode
;
4341 if (FAILED(hr
= wined3d_get_adapter_display_mode(wined3d
, adapter_idx
,
4342 ¤t_mode
, NULL
)))
4344 HeapFree(GetProcessHeap(), 0, matching_modes
);
4345 HeapFree(GetProcessHeap(), 0, modes
);
4348 mode
->width
= current_mode
.width
;
4349 mode
->height
= current_mode
.height
;
4353 for (i
= 0, j
= 0; i
< matching_mode_count
; ++i
)
4355 unsigned int d
= abs(mode
->width
- matching_modes
[i
]->width
)
4356 + abs(mode
->height
- matching_modes
[i
]->height
);
4365 *mode
= *matching_modes
[j
];
4367 HeapFree(GetProcessHeap(), 0, matching_modes
);
4368 HeapFree(GetProcessHeap(), 0, modes
);
4370 TRACE("Returning %ux%u@%u %s %#x.\n", mode
->width
, mode
->height
,
4371 mode
->refresh_rate
, debug_d3dformat(mode
->format_id
),
4372 mode
->scanline_ordering
);
4377 HRESULT CDECL
wined3d_get_adapter_display_mode(const struct wined3d
*wined3d
, UINT adapter_idx
,
4378 struct wined3d_display_mode
*mode
, enum wined3d_display_rotation
*rotation
)
4380 const struct wined3d_adapter
*adapter
;
4383 TRACE("wined3d %p, adapter_idx %u, display_mode %p, rotation %p.\n",
4384 wined3d
, adapter_idx
, mode
, rotation
);
4386 if (!mode
|| adapter_idx
>= wined3d
->adapter_count
)
4387 return WINED3DERR_INVALIDCALL
;
4389 adapter
= &wined3d
->adapters
[adapter_idx
];
4391 memset(&m
, 0, sizeof(m
));
4392 m
.dmSize
= sizeof(m
);
4394 EnumDisplaySettingsExW(adapter
->DeviceName
, ENUM_CURRENT_SETTINGS
, &m
, 0);
4395 mode
->width
= m
.dmPelsWidth
;
4396 mode
->height
= m
.dmPelsHeight
;
4397 mode
->refresh_rate
= DEFAULT_REFRESH_RATE
;
4398 if (m
.dmFields
& DM_DISPLAYFREQUENCY
)
4399 mode
->refresh_rate
= m
.dmDisplayFrequency
;
4400 mode
->format_id
= pixelformat_for_depth(m
.dmBitsPerPel
);
4402 /* Lie about the format. X11 can't change the color depth, and some apps
4403 * are pretty angry if they SetDisplayMode from 24 to 16 bpp and find out
4404 * that GetDisplayMode still returns 24 bpp. This should probably be
4405 * handled in winex11 instead. */
4406 if (adapter
->screen_format
&& adapter
->screen_format
!= mode
->format_id
)
4408 WARN("Overriding format %s with stored format %s.\n",
4409 debug_d3dformat(mode
->format_id
),
4410 debug_d3dformat(adapter
->screen_format
));
4411 mode
->format_id
= adapter
->screen_format
;
4414 if (!(m
.dmFields
& DM_DISPLAYFLAGS
))
4415 mode
->scanline_ordering
= WINED3D_SCANLINE_ORDERING_UNKNOWN
;
4416 else if (m
.u2
.dmDisplayFlags
& DM_INTERLACED
)
4417 mode
->scanline_ordering
= WINED3D_SCANLINE_ORDERING_INTERLACED
;
4419 mode
->scanline_ordering
= WINED3D_SCANLINE_ORDERING_PROGRESSIVE
;
4423 switch (m
.u1
.s2
.dmDisplayOrientation
)
4426 *rotation
= WINED3D_DISPLAY_ROTATION_0
;
4429 *rotation
= WINED3D_DISPLAY_ROTATION_90
;
4432 *rotation
= WINED3D_DISPLAY_ROTATION_180
;
4435 *rotation
= WINED3D_DISPLAY_ROTATION_270
;
4438 FIXME("Unhandled display rotation %#x.\n", m
.u1
.s2
.dmDisplayOrientation
);
4439 *rotation
= WINED3D_DISPLAY_ROTATION_UNSPECIFIED
;
4444 TRACE("Returning %ux%u@%u %s %#x.\n", mode
->width
, mode
->height
,
4445 mode
->refresh_rate
, debug_d3dformat(mode
->format_id
),
4446 mode
->scanline_ordering
);
4450 HRESULT CDECL
wined3d_set_adapter_display_mode(struct wined3d
*wined3d
,
4451 UINT adapter_idx
, const struct wined3d_display_mode
*mode
)
4453 struct wined3d_adapter
*adapter
;
4454 DEVMODEW new_mode
, current_mode
;
4457 enum wined3d_format_id new_format_id
;
4459 TRACE("wined3d %p, adapter_idx %u, mode %p.\n", wined3d
, adapter_idx
, mode
);
4461 if (adapter_idx
>= wined3d
->adapter_count
)
4462 return WINED3DERR_INVALIDCALL
;
4463 adapter
= &wined3d
->adapters
[adapter_idx
];
4465 memset(&new_mode
, 0, sizeof(new_mode
));
4466 new_mode
.dmSize
= sizeof(new_mode
);
4467 memset(¤t_mode
, 0, sizeof(current_mode
));
4468 current_mode
.dmSize
= sizeof(current_mode
);
4471 const struct wined3d_format
*format
;
4473 TRACE("mode %ux%u@%u %s %#x.\n", mode
->width
, mode
->height
, mode
->refresh_rate
,
4474 debug_d3dformat(mode
->format_id
), mode
->scanline_ordering
);
4476 format
= wined3d_get_format(&adapter
->gl_info
, mode
->format_id
);
4478 new_mode
.dmFields
= DM_BITSPERPEL
| DM_PELSWIDTH
| DM_PELSHEIGHT
;
4479 new_mode
.dmBitsPerPel
= format
->byte_count
* CHAR_BIT
;
4480 new_mode
.dmPelsWidth
= mode
->width
;
4481 new_mode
.dmPelsHeight
= mode
->height
;
4483 new_mode
.dmDisplayFrequency
= mode
->refresh_rate
;
4484 if (mode
->refresh_rate
)
4485 new_mode
.dmFields
|= DM_DISPLAYFREQUENCY
;
4487 if (mode
->scanline_ordering
!= WINED3D_SCANLINE_ORDERING_UNKNOWN
)
4489 new_mode
.dmFields
|= DM_DISPLAYFLAGS
;
4490 if (mode
->scanline_ordering
== WINED3D_SCANLINE_ORDERING_INTERLACED
)
4491 new_mode
.u2
.dmDisplayFlags
|= DM_INTERLACED
;
4493 new_format_id
= mode
->format_id
;
4497 if (!EnumDisplaySettingsW(adapter
->DeviceName
, ENUM_REGISTRY_SETTINGS
, &new_mode
))
4499 ERR("Failed to read mode from registry.\n");
4500 return WINED3DERR_NOTAVAILABLE
;
4502 new_format_id
= pixelformat_for_depth(new_mode
.dmBitsPerPel
);
4505 /* Only change the mode if necessary. */
4506 if (!EnumDisplaySettingsW(adapter
->DeviceName
, ENUM_CURRENT_SETTINGS
, ¤t_mode
))
4508 ERR("Failed to get current display mode.\n");
4510 else if (current_mode
.dmPelsWidth
== new_mode
.dmPelsWidth
4511 && current_mode
.dmPelsHeight
== new_mode
.dmPelsHeight
4512 && current_mode
.dmBitsPerPel
== new_mode
.dmBitsPerPel
4513 && (current_mode
.dmDisplayFrequency
== new_mode
.dmDisplayFrequency
4514 || !(new_mode
.dmFields
& DM_DISPLAYFREQUENCY
))
4515 && (current_mode
.u2
.dmDisplayFlags
== new_mode
.u2
.dmDisplayFlags
4516 || !(new_mode
.dmFields
& DM_DISPLAYFLAGS
)))
4518 TRACE("Skipping redundant mode setting call.\n");
4522 ret
= ChangeDisplaySettingsExW(adapter
->DeviceName
, &new_mode
, NULL
, CDS_FULLSCREEN
, NULL
);
4523 if (ret
!= DISP_CHANGE_SUCCESSFUL
)
4525 if (new_mode
.dmFields
& DM_DISPLAYFREQUENCY
)
4527 WARN("ChangeDisplaySettingsExW failed, trying without the refresh rate.\n");
4528 new_mode
.dmFields
&= ~DM_DISPLAYFREQUENCY
;
4529 new_mode
.dmDisplayFrequency
= 0;
4530 ret
= ChangeDisplaySettingsExW(adapter
->DeviceName
, &new_mode
, NULL
, CDS_FULLSCREEN
, NULL
);
4532 if (ret
!= DISP_CHANGE_SUCCESSFUL
)
4533 return WINED3DERR_NOTAVAILABLE
;
4536 /* Store the new values. */
4537 adapter
->screen_format
= new_format_id
;
4539 /* And finally clip mouse to our screen. */
4540 SetRect(&clip_rc
, 0, 0, new_mode
.dmPelsWidth
, new_mode
.dmPelsHeight
);
4541 ClipCursor(&clip_rc
);
4546 /* NOTE: due to structure differences between dx8 and dx9 D3DADAPTER_IDENTIFIER,
4547 and fields being inserted in the middle, a new structure is used in place */
4548 HRESULT CDECL
wined3d_get_adapter_identifier(const struct wined3d
*wined3d
,
4549 UINT adapter_idx
, DWORD flags
, struct wined3d_adapter_identifier
*identifier
)
4551 const struct wined3d_adapter
*adapter
;
4554 TRACE("wined3d %p, adapter_idx %u, flags %#x, identifier %p.\n",
4555 wined3d
, adapter_idx
, flags
, identifier
);
4557 if (adapter_idx
>= wined3d
->adapter_count
)
4558 return WINED3DERR_INVALIDCALL
;
4560 adapter
= &wined3d
->adapters
[adapter_idx
];
4562 if (identifier
->driver_size
)
4564 const char *name
= adapter
->driver_info
.name
;
4565 len
= min(strlen(name
), identifier
->driver_size
- 1);
4566 memcpy(identifier
->driver
, name
, len
);
4567 memset(&identifier
->driver
[len
], 0, identifier
->driver_size
- len
);
4570 if (identifier
->description_size
)
4572 const char *description
= adapter
->driver_info
.description
;
4573 len
= min(strlen(description
), identifier
->description_size
- 1);
4574 memcpy(identifier
->description
, description
, len
);
4575 memset(&identifier
->description
[len
], 0, identifier
->description_size
- len
);
4578 /* Note that d3d8 doesn't supply a device name. */
4579 if (identifier
->device_name_size
)
4581 if (!WideCharToMultiByte(CP_ACP
, 0, adapter
->DeviceName
, -1, identifier
->device_name
,
4582 identifier
->device_name_size
, NULL
, NULL
))
4584 ERR("Failed to convert device name, last error %#x.\n", GetLastError());
4585 return WINED3DERR_INVALIDCALL
;
4589 identifier
->driver_version
.u
.HighPart
= adapter
->driver_info
.version_high
;
4590 identifier
->driver_version
.u
.LowPart
= adapter
->driver_info
.version_low
;
4591 identifier
->vendor_id
= adapter
->driver_info
.vendor
;
4592 identifier
->device_id
= adapter
->driver_info
.device
;
4593 identifier
->subsystem_id
= 0;
4594 identifier
->revision
= 0;
4595 memcpy(&identifier
->device_identifier
, &IID_D3DDEVICE_D3DUID
, sizeof(identifier
->device_identifier
));
4596 identifier
->whql_level
= (flags
& WINED3DENUM_NO_WHQL_LEVEL
) ? 0 : 1;
4597 memcpy(&identifier
->adapter_luid
, &adapter
->luid
, sizeof(identifier
->adapter_luid
));
4598 identifier
->video_memory
= min(~(SIZE_T
)0, adapter
->vram_bytes
);
4603 HRESULT CDECL
wined3d_get_adapter_raster_status(const struct wined3d
*wined3d
, UINT adapter_idx
,
4604 struct wined3d_raster_status
*raster_status
)
4606 LONGLONG freq_per_frame
, freq_per_line
;
4607 LARGE_INTEGER counter
, freq_per_sec
;
4608 struct wined3d_display_mode mode
;
4612 FIXME("wined3d %p, adapter_idx %u, raster_status %p semi-stub!\n",
4613 wined3d
, adapter_idx
, raster_status
);
4615 WARN("wined3d %p, adapter_idx %u, raster_status %p semi-stub!\n",
4616 wined3d
, adapter_idx
, raster_status
);
4618 /* Obtaining the raster status is a widely implemented but optional
4619 * feature. When this method returns OK StarCraft 2 expects the
4620 * raster_status->InVBlank value to actually change over time.
4621 * And Endless Alice Crysis doesn't care even if this method fails.
4622 * Thus this method returns OK and fakes raster_status by
4623 * QueryPerformanceCounter. */
4625 if (!QueryPerformanceCounter(&counter
) || !QueryPerformanceFrequency(&freq_per_sec
))
4626 return WINED3DERR_INVALIDCALL
;
4627 if (FAILED(wined3d_get_adapter_display_mode(wined3d
, adapter_idx
, &mode
, NULL
)))
4628 return WINED3DERR_INVALIDCALL
;
4629 if (mode
.refresh_rate
== DEFAULT_REFRESH_RATE
)
4630 mode
.refresh_rate
= 60;
4632 freq_per_frame
= freq_per_sec
.QuadPart
/ mode
.refresh_rate
;
4633 /* Assume 20 scan lines in the vertical blank. */
4634 freq_per_line
= freq_per_frame
/ (mode
.height
+ 20);
4635 raster_status
->scan_line
= (counter
.QuadPart
% freq_per_frame
) / freq_per_line
;
4636 if (raster_status
->scan_line
< mode
.height
)
4637 raster_status
->in_vblank
= FALSE
;
4640 raster_status
->scan_line
= 0;
4641 raster_status
->in_vblank
= TRUE
;
4644 TRACE("Returning fake value, in_vblank %u, scan_line %u.\n",
4645 raster_status
->in_vblank
, raster_status
->scan_line
);
4650 static BOOL
wined3d_check_pixel_format_color(const struct wined3d_gl_info
*gl_info
,
4651 const struct wined3d_pixel_format
*cfg
, const struct wined3d_format
*format
)
4653 /* Float formats need FBOs. If FBOs are used this function isn't called */
4654 if (format
->flags
[WINED3D_GL_RES_TYPE_TEX_2D
] & WINED3DFMT_FLAG_FLOAT
)
4657 /* Probably a RGBA_float or color index mode. */
4658 if (cfg
->iPixelType
!= WGL_TYPE_RGBA_ARB
)
4661 if (cfg
->redSize
< format
->red_size
4662 || cfg
->greenSize
< format
->green_size
4663 || cfg
->blueSize
< format
->blue_size
4664 || cfg
->alphaSize
< format
->alpha_size
)
4670 static BOOL
wined3d_check_pixel_format_depth(const struct wined3d_gl_info
*gl_info
,
4671 const struct wined3d_pixel_format
*cfg
, const struct wined3d_format
*format
)
4673 BOOL lockable
= FALSE
;
4675 /* Float formats need FBOs. If FBOs are used this function isn't called */
4676 if (format
->flags
[WINED3D_GL_RES_TYPE_TEX_2D
] & WINED3DFMT_FLAG_FLOAT
)
4679 if ((format
->id
== WINED3DFMT_D16_LOCKABLE
) || (format
->id
== WINED3DFMT_D32_FLOAT
))
4682 /* On some modern cards like the Geforce8/9, GLX doesn't offer some
4683 * depth/stencil formats which D3D9 reports. We can safely report
4684 * "compatible" formats (e.g. D24 can be used for D16) as long as we
4685 * aren't dealing with a lockable format. This also helps D3D <= 7 as they
4686 * expect D16 which isn't offered without this on Geforce8 cards. */
4687 if (!(cfg
->depthSize
== format
->depth_size
|| (!lockable
&& cfg
->depthSize
> format
->depth_size
)))
4690 /* Some cards like Intel i915 ones only offer D24S8 but lots of games also
4691 * need a format without stencil. We can allow a mismatch if the format
4692 * doesn't have any stencil bits. If it does have stencil bits the size
4693 * must match, or stencil wrapping would break. */
4694 if (format
->stencil_size
&& cfg
->stencilSize
!= format
->stencil_size
)
4700 HRESULT CDECL
wined3d_check_depth_stencil_match(const struct wined3d
*wined3d
,
4701 UINT adapter_idx
, enum wined3d_device_type device_type
, enum wined3d_format_id adapter_format_id
,
4702 enum wined3d_format_id render_target_format_id
, enum wined3d_format_id depth_stencil_format_id
)
4704 const struct wined3d_format
*rt_format
;
4705 const struct wined3d_format
*ds_format
;
4706 const struct wined3d_adapter
*adapter
;
4708 TRACE("wined3d %p, adapter_idx %u, device_type %s,\n"
4709 "adapter_format %s, render_target_format %s, depth_stencil_format %s.\n",
4710 wined3d
, adapter_idx
, debug_d3ddevicetype(device_type
), debug_d3dformat(adapter_format_id
),
4711 debug_d3dformat(render_target_format_id
), debug_d3dformat(depth_stencil_format_id
));
4713 if (adapter_idx
>= wined3d
->adapter_count
)
4714 return WINED3DERR_INVALIDCALL
;
4716 adapter
= &wined3d
->adapters
[adapter_idx
];
4717 rt_format
= wined3d_get_format(&adapter
->gl_info
, render_target_format_id
);
4718 ds_format
= wined3d_get_format(&adapter
->gl_info
, depth_stencil_format_id
);
4719 if (wined3d_settings
.offscreen_rendering_mode
== ORM_FBO
)
4721 if ((rt_format
->flags
[WINED3D_GL_RES_TYPE_TEX_2D
] & WINED3DFMT_FLAG_RENDERTARGET
)
4722 && (ds_format
->flags
[WINED3D_GL_RES_TYPE_TEX_2D
] & (WINED3DFMT_FLAG_DEPTH
| WINED3DFMT_FLAG_STENCIL
)))
4724 TRACE("Formats match.\n");
4730 const struct wined3d_pixel_format
*cfgs
;
4731 unsigned int cfg_count
;
4734 cfgs
= adapter
->cfgs
;
4735 cfg_count
= adapter
->cfg_count
;
4736 for (i
= 0; i
< cfg_count
; ++i
)
4738 if (wined3d_check_pixel_format_color(&adapter
->gl_info
, &cfgs
[i
], rt_format
)
4739 && wined3d_check_pixel_format_depth(&adapter
->gl_info
, &cfgs
[i
], ds_format
))
4741 TRACE("Formats match.\n");
4747 TRACE("Unsupported format pair: %s and %s.\n",
4748 debug_d3dformat(render_target_format_id
),
4749 debug_d3dformat(depth_stencil_format_id
));
4751 return WINED3DERR_NOTAVAILABLE
;
4754 HRESULT CDECL
wined3d_check_device_multisample_type(const struct wined3d
*wined3d
, UINT adapter_idx
,
4755 enum wined3d_device_type device_type
, enum wined3d_format_id surface_format_id
, BOOL windowed
,
4756 enum wined3d_multisample_type multisample_type
, DWORD
*quality_levels
)
4758 const struct wined3d_gl_info
*gl_info
= &wined3d
->adapters
[adapter_idx
].gl_info
;
4759 const struct wined3d_format
*format
= wined3d_get_format(gl_info
, surface_format_id
);
4760 HRESULT hr
= WINED3D_OK
;
4762 TRACE("wined3d %p, adapter_idx %u, device_type %s, surface_format %s, "
4763 "windowed %#x, multisample_type %#x, quality_levels %p.\n",
4764 wined3d
, adapter_idx
, debug_d3ddevicetype(device_type
), debug_d3dformat(surface_format_id
),
4765 windowed
, multisample_type
, quality_levels
);
4767 if (adapter_idx
>= wined3d
->adapter_count
)
4768 return WINED3DERR_INVALIDCALL
;
4769 if (surface_format_id
== WINED3DFMT_UNKNOWN
)
4770 return WINED3DERR_INVALIDCALL
;
4771 if (multisample_type
< WINED3D_MULTISAMPLE_NONE
)
4772 return WINED3DERR_INVALIDCALL
;
4773 if (multisample_type
> WINED3D_MULTISAMPLE_16_SAMPLES
)
4775 FIXME("multisample_type %u not handled yet.\n", multisample_type
);
4776 return WINED3DERR_NOTAVAILABLE
;
4779 if (multisample_type
&& !(format
->multisample_types
& 1u << (multisample_type
- 1)))
4780 hr
= WINED3DERR_NOTAVAILABLE
;
4782 if (SUCCEEDED(hr
) || (multisample_type
== WINED3D_MULTISAMPLE_NON_MASKABLE
&& format
->multisample_types
))
4786 if (multisample_type
== WINED3D_MULTISAMPLE_NON_MASKABLE
)
4787 *quality_levels
= wined3d_popcount(format
->multisample_types
);
4789 *quality_levels
= 1;
4794 TRACE("Returning not supported.\n");
4798 /* Check if the given DisplayFormat + DepthStencilFormat combination is valid for the Adapter */
4799 static BOOL
CheckDepthStencilCapability(const struct wined3d_adapter
*adapter
,
4800 const struct wined3d_format
*display_format
, const struct wined3d_format
*ds_format
,
4801 enum wined3d_gl_resource_type gl_type
)
4803 /* Only allow depth/stencil formats */
4804 if (!(ds_format
->depth_size
|| ds_format
->stencil_size
)) return FALSE
;
4806 /* Blacklist formats not supported on Windows */
4807 switch (ds_format
->id
)
4809 case WINED3DFMT_S1_UINT_D15_UNORM
: /* Breaks the shadowvol2 dx7 sdk sample */
4810 case WINED3DFMT_S4X4_UINT_D24_UNORM
:
4811 TRACE("[FAILED] - not supported on windows.\n");
4818 if (wined3d_settings
.offscreen_rendering_mode
== ORM_FBO
)
4820 /* With FBOs WGL limitations do not apply, but the format needs to be FBO attachable */
4821 if (ds_format
->flags
[gl_type
] & (WINED3DFMT_FLAG_DEPTH
| WINED3DFMT_FLAG_STENCIL
))
4828 /* Walk through all WGL pixel formats to find a match */
4829 for (i
= 0; i
< adapter
->cfg_count
; ++i
)
4831 const struct wined3d_pixel_format
*cfg
= &adapter
->cfgs
[i
];
4832 if (wined3d_check_pixel_format_color(&adapter
->gl_info
, cfg
, display_format
)
4833 && wined3d_check_pixel_format_depth(&adapter
->gl_info
, cfg
, ds_format
))
4841 /* Check the render target capabilities of a format */
4842 static BOOL
CheckRenderTargetCapability(const struct wined3d_adapter
*adapter
,
4843 const struct wined3d_format
*adapter_format
, const struct wined3d_format
*check_format
,
4844 enum wined3d_gl_resource_type gl_type
)
4846 /* Filter out non-RT formats */
4847 if (!(check_format
->flags
[gl_type
] & WINED3DFMT_FLAG_RENDERTARGET
))
4849 if (wined3d_settings
.offscreen_rendering_mode
== ORM_BACKBUFFER
)
4851 const struct wined3d_pixel_format
*cfgs
= adapter
->cfgs
;
4854 /* In backbuffer mode the front and backbuffer share the same WGL
4855 * pixelformat. The format must match in RGB, alpha is allowed to be
4856 * different. (Only the backbuffer can have alpha.) */
4857 if (adapter_format
->red_size
!= check_format
->red_size
4858 || adapter_format
->green_size
!= check_format
->green_size
4859 || adapter_format
->blue_size
!= check_format
->blue_size
)
4861 TRACE("[FAILED]\n");
4865 /* Check if there is a WGL pixel format matching the requirements, the format should also be window
4866 * drawable (not offscreen; e.g. Nvidia offers R5G6B5 for pbuffers even when X is running at 24bit) */
4867 for (i
= 0; i
< adapter
->cfg_count
; ++i
)
4869 if (cfgs
[i
].windowDrawable
4870 && wined3d_check_pixel_format_color(&adapter
->gl_info
, &cfgs
[i
], check_format
))
4872 TRACE("Pixel format %d is compatible with format %s.\n",
4873 cfgs
[i
].iPixelFormat
, debug_d3dformat(check_format
->id
));
4878 else if(wined3d_settings
.offscreen_rendering_mode
== ORM_FBO
)
4880 /* For now return TRUE for FBOs until we have some proper checks.
4881 * Note that this function will only be called when the format is around for texturing. */
4887 static BOOL
CheckSurfaceCapability(const struct wined3d_adapter
*adapter
,
4888 const struct wined3d_format
*adapter_format
,
4889 const struct wined3d_format
*check_format
, BOOL no3d
)
4893 switch (check_format
->id
)
4895 case WINED3DFMT_B8G8R8_UNORM
:
4896 TRACE("[FAILED] - Not enumerated on Windows.\n");
4898 case WINED3DFMT_B8G8R8A8_UNORM
:
4899 case WINED3DFMT_B8G8R8X8_UNORM
:
4900 case WINED3DFMT_B5G6R5_UNORM
:
4901 case WINED3DFMT_B5G5R5X1_UNORM
:
4902 case WINED3DFMT_B5G5R5A1_UNORM
:
4903 case WINED3DFMT_B4G4R4A4_UNORM
:
4904 case WINED3DFMT_B2G3R3_UNORM
:
4905 case WINED3DFMT_A8_UNORM
:
4906 case WINED3DFMT_B2G3R3A8_UNORM
:
4907 case WINED3DFMT_B4G4R4X4_UNORM
:
4908 case WINED3DFMT_R10G10B10A2_UNORM
:
4909 case WINED3DFMT_R8G8B8A8_UNORM
:
4910 case WINED3DFMT_R8G8B8X8_UNORM
:
4911 case WINED3DFMT_R16G16_UNORM
:
4912 case WINED3DFMT_B10G10R10A2_UNORM
:
4913 case WINED3DFMT_R16G16B16A16_UNORM
:
4914 case WINED3DFMT_P8_UINT
:
4918 TRACE("[FAILED] - Not available on GDI surfaces.\n");
4923 /* All formats that are supported for textures are supported for surfaces
4925 if (check_format
->flags
[WINED3D_GL_RES_TYPE_TEX_2D
] & WINED3DFMT_FLAG_TEXTURE
)
4927 /* All depth stencil formats are supported on surfaces */
4928 if (CheckDepthStencilCapability(adapter
, adapter_format
, check_format
, WINED3D_GL_RES_TYPE_TEX_2D
))
4930 if (CheckDepthStencilCapability(adapter
, adapter_format
, check_format
, WINED3D_GL_RES_TYPE_RB
))
4933 /* If opengl can't process the format natively, the blitter may be able to convert it */
4934 if (adapter
->blitter
->blit_supported(&adapter
->gl_info
, &adapter
->d3d_info
,
4935 WINED3D_BLIT_OP_COLOR_BLIT
,
4936 NULL
, WINED3D_POOL_DEFAULT
, 0, check_format
,
4937 NULL
, WINED3D_POOL_DEFAULT
, 0, adapter_format
))
4943 /* Reject other formats */
4944 TRACE("[FAILED]\n");
4948 /* OpenGL supports mipmapping on all formats. Wrapping is unsupported, but we
4949 * have to report mipmapping so we cannot reject WRAPANDMIP. Tests show that
4950 * Windows reports WRAPANDMIP on unfilterable surfaces as well, apparently to
4951 * show that wrapping is supported. The lack of filtering will sort out the
4952 * mipmapping capability anyway.
4954 * For now lets report this on all formats, but in the future we may want to
4955 * restrict it to some should applications need that. */
4956 HRESULT CDECL
wined3d_check_device_format(const struct wined3d
*wined3d
, UINT adapter_idx
,
4957 enum wined3d_device_type device_type
, enum wined3d_format_id adapter_format_id
, DWORD usage
,
4958 enum wined3d_resource_type resource_type
, enum wined3d_format_id check_format_id
)
4960 const struct wined3d_adapter
*adapter
= &wined3d
->adapters
[adapter_idx
];
4961 const struct wined3d_gl_info
*gl_info
= &adapter
->gl_info
;
4962 const struct wined3d_format
*adapter_format
= wined3d_get_format(gl_info
, adapter_format_id
);
4963 const struct wined3d_format
*format
= wined3d_get_format(gl_info
, check_format_id
);
4964 DWORD format_flags
= 0;
4965 DWORD allowed_usage
;
4966 enum wined3d_gl_resource_type gl_type
;
4968 TRACE("wined3d %p, adapter_idx %u, device_type %s, adapter_format %s, usage %s, %s,\n"
4969 "resource_type %s, check_format %s.\n",
4970 wined3d
, adapter_idx
, debug_d3ddevicetype(device_type
), debug_d3dformat(adapter_format_id
),
4971 debug_d3dusage(usage
), debug_d3dusagequery(usage
), debug_d3dresourcetype(resource_type
),
4972 debug_d3dformat(check_format_id
));
4974 if (adapter_idx
>= wined3d
->adapter_count
)
4975 return WINED3DERR_INVALIDCALL
;
4977 switch (resource_type
)
4979 case WINED3D_RTYPE_TEXTURE_2D
:
4980 allowed_usage
= WINED3DUSAGE_DEPTHSTENCIL
4981 | WINED3DUSAGE_RENDERTARGET
4982 | WINED3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING
;
4983 if (usage
& WINED3DUSAGE_RENDERTARGET
)
4984 allowed_usage
|= WINED3DUSAGE_QUERY_SRGBWRITE
;
4985 if (!(usage
& WINED3DUSAGE_TEXTURE
))
4987 if (!CheckSurfaceCapability(adapter
, adapter_format
, format
, wined3d
->flags
& WINED3D_NO3D
))
4989 TRACE("[FAILED] - Not supported for plain surfaces.\n");
4990 return WINED3DERR_NOTAVAILABLE
;
4993 gl_type
= WINED3D_GL_RES_TYPE_RB
;
4996 allowed_usage
|= WINED3DUSAGE_AUTOGENMIPMAP
4997 | WINED3DUSAGE_DYNAMIC
4998 | WINED3DUSAGE_LEGACY_CUBEMAP
4999 | WINED3DUSAGE_SOFTWAREPROCESSING
5000 | WINED3DUSAGE_TEXTURE
5001 | WINED3DUSAGE_QUERY_FILTER
5002 | WINED3DUSAGE_QUERY_LEGACYBUMPMAP
5003 | WINED3DUSAGE_QUERY_SRGBREAD
5004 | WINED3DUSAGE_QUERY_SRGBWRITE
5005 | WINED3DUSAGE_QUERY_VERTEXTEXTURE
5006 | WINED3DUSAGE_QUERY_WRAPANDMIP
;
5007 gl_type
= WINED3D_GL_RES_TYPE_TEX_2D
;
5008 if (usage
& WINED3DUSAGE_LEGACY_CUBEMAP
)
5010 allowed_usage
&= ~(WINED3DUSAGE_DEPTHSTENCIL
| WINED3DUSAGE_QUERY_LEGACYBUMPMAP
);
5011 gl_type
= WINED3D_GL_RES_TYPE_TEX_CUBE
;
5013 else if ((usage
& WINED3DUSAGE_DEPTHSTENCIL
)
5014 && (format
->flags
[WINED3D_GL_RES_TYPE_TEX_2D
] & WINED3DFMT_FLAG_SHADOW
)
5015 && !gl_info
->supported
[ARB_SHADOW
])
5017 TRACE("[FAILED] - No shadow sampler support.\n");
5018 return WINED3DERR_NOTAVAILABLE
;
5022 case WINED3D_RTYPE_TEXTURE_3D
:
5023 allowed_usage
= WINED3DUSAGE_DYNAMIC
5024 | WINED3DUSAGE_SOFTWAREPROCESSING
5025 | WINED3DUSAGE_TEXTURE
5026 | WINED3DUSAGE_QUERY_FILTER
5027 | WINED3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING
5028 | WINED3DUSAGE_QUERY_SRGBREAD
5029 | WINED3DUSAGE_QUERY_SRGBWRITE
5030 | WINED3DUSAGE_QUERY_VERTEXTEXTURE
5031 | WINED3DUSAGE_QUERY_WRAPANDMIP
;
5032 gl_type
= WINED3D_GL_RES_TYPE_TEX_3D
;
5036 FIXME("Unhandled resource type %s.\n", debug_d3dresourcetype(resource_type
));
5037 return WINED3DERR_NOTAVAILABLE
;
5040 if ((usage
& allowed_usage
) != usage
)
5042 TRACE("Requested usage %#x, but resource type %s only allows %#x.\n",
5043 usage
, debug_d3dresourcetype(resource_type
), allowed_usage
);
5044 return WINED3DERR_NOTAVAILABLE
;
5047 if (usage
& WINED3DUSAGE_TEXTURE
)
5048 format_flags
|= WINED3DFMT_FLAG_TEXTURE
;
5049 if (usage
& WINED3DUSAGE_QUERY_FILTER
)
5050 format_flags
|= WINED3DFMT_FLAG_FILTERING
;
5051 if (usage
& WINED3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING
)
5052 format_flags
|= WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING
;
5053 if (usage
& WINED3DUSAGE_QUERY_SRGBREAD
)
5054 format_flags
|= WINED3DFMT_FLAG_SRGB_READ
;
5055 if (usage
& WINED3DUSAGE_QUERY_SRGBWRITE
)
5056 format_flags
|= WINED3DFMT_FLAG_SRGB_WRITE
;
5057 if (usage
& WINED3DUSAGE_QUERY_VERTEXTEXTURE
)
5058 format_flags
|= WINED3DFMT_FLAG_VTF
;
5059 if (usage
& WINED3DUSAGE_QUERY_LEGACYBUMPMAP
)
5060 format_flags
|= WINED3DFMT_FLAG_BUMPMAP
;
5062 if ((format
->flags
[gl_type
] & format_flags
) != format_flags
)
5064 TRACE("Requested format flags %#x, but format %s only has %#x.\n",
5065 format_flags
, debug_d3dformat(check_format_id
), format
->flags
[gl_type
]);
5066 return WINED3DERR_NOTAVAILABLE
;
5069 if ((format_flags
& WINED3DFMT_FLAG_TEXTURE
) && (wined3d
->flags
& WINED3D_NO3D
))
5071 TRACE("Requested texturing support, but wined3d was created with WINED3D_NO3D.\n");
5072 return WINED3DERR_NOTAVAILABLE
;
5075 if ((usage
& WINED3DUSAGE_DEPTHSTENCIL
)
5076 && !CheckDepthStencilCapability(adapter
, adapter_format
, format
, gl_type
))
5078 TRACE("Requested WINED3DUSAGE_DEPTHSTENCIL, but format %s is not supported for depth / stencil buffers.\n",
5079 debug_d3dformat(check_format_id
));
5080 return WINED3DERR_NOTAVAILABLE
;
5083 if ((usage
& WINED3DUSAGE_RENDERTARGET
)
5084 && !CheckRenderTargetCapability(adapter
, adapter_format
, format
, gl_type
))
5086 TRACE("Requested WINED3DUSAGE_RENDERTARGET, but format %s is not supported for render targets.\n",
5087 debug_d3dformat(check_format_id
));
5088 return WINED3DERR_NOTAVAILABLE
;
5091 if ((usage
& WINED3DUSAGE_AUTOGENMIPMAP
) && !gl_info
->supported
[SGIS_GENERATE_MIPMAP
])
5093 TRACE("No WINED3DUSAGE_AUTOGENMIPMAP support, returning WINED3DOK_NOAUTOGEN.\n");
5094 return WINED3DOK_NOAUTOGEN
;
5100 UINT CDECL
wined3d_calculate_format_pitch(const struct wined3d
*wined3d
, UINT adapter_idx
,
5101 enum wined3d_format_id format_id
, UINT width
)
5103 const struct wined3d_gl_info
*gl_info
;
5104 unsigned int row_pitch
, slice_pitch
;
5106 TRACE("wined3d %p, adapter_idx %u, format_id %s, width %u.\n",
5107 wined3d
, adapter_idx
, debug_d3dformat(format_id
), width
);
5109 if (adapter_idx
>= wined3d
->adapter_count
)
5112 gl_info
= &wined3d
->adapters
[adapter_idx
].gl_info
;
5113 wined3d_format_calculate_pitch(wined3d_get_format(gl_info
, format_id
),
5114 1, width
, 1, &row_pitch
, &slice_pitch
);
5119 HRESULT CDECL
wined3d_check_device_format_conversion(const struct wined3d
*wined3d
, UINT adapter_idx
,
5120 enum wined3d_device_type device_type
, enum wined3d_format_id src_format
, enum wined3d_format_id dst_format
)
5122 FIXME("wined3d %p, adapter_idx %u, device_type %s, src_format %s, dst_format %s stub!\n",
5123 wined3d
, adapter_idx
, debug_d3ddevicetype(device_type
), debug_d3dformat(src_format
),
5124 debug_d3dformat(dst_format
));
5129 HRESULT CDECL
wined3d_check_device_type(const struct wined3d
*wined3d
, UINT adapter_idx
,
5130 enum wined3d_device_type device_type
, enum wined3d_format_id display_format
,
5131 enum wined3d_format_id backbuffer_format
, BOOL windowed
)
5133 BOOL present_conversion
= wined3d
->flags
& WINED3D_PRESENT_CONVERSION
;
5135 TRACE("wined3d %p, adapter_idx %u, device_type %s, display_format %s, backbuffer_format %s, windowed %#x.\n",
5136 wined3d
, adapter_idx
, debug_d3ddevicetype(device_type
), debug_d3dformat(display_format
),
5137 debug_d3dformat(backbuffer_format
), windowed
);
5139 if (adapter_idx
>= wined3d
->adapter_count
)
5140 return WINED3DERR_INVALIDCALL
;
5142 /* The task of this function is to check whether a certain display / backbuffer format
5143 * combination is available on the given adapter. In fullscreen mode microsoft specified
5144 * that the display format shouldn't provide alpha and that ignoring alpha the backbuffer
5145 * and display format should match exactly.
5146 * In windowed mode format conversion can occur and this depends on the driver. */
5148 /* There are only 4 display formats. */
5149 if (!(display_format
== WINED3DFMT_B5G6R5_UNORM
5150 || display_format
== WINED3DFMT_B5G5R5X1_UNORM
5151 || display_format
== WINED3DFMT_B8G8R8X8_UNORM
5152 || display_format
== WINED3DFMT_B10G10R10A2_UNORM
))
5154 TRACE("Format %s is not supported as display format.\n", debug_d3dformat(display_format
));
5155 return WINED3DERR_NOTAVAILABLE
;
5160 /* If the requested display format is not available, don't continue. */
5161 if (!wined3d_get_adapter_mode_count(wined3d
, adapter_idx
,
5162 display_format
, WINED3D_SCANLINE_ORDERING_UNKNOWN
))
5164 TRACE("No available modes for display format %s.\n", debug_d3dformat(display_format
));
5165 return WINED3DERR_NOTAVAILABLE
;
5168 present_conversion
= FALSE
;
5170 else if (display_format
== WINED3DFMT_B10G10R10A2_UNORM
)
5172 /* WINED3DFMT_B10G10R10A2_UNORM is only allowed in fullscreen mode. */
5173 TRACE("Unsupported format combination %s / %s in windowed mode.\n",
5174 debug_d3dformat(display_format
), debug_d3dformat(backbuffer_format
));
5175 return WINED3DERR_NOTAVAILABLE
;
5178 if (present_conversion
)
5180 /* Use the display format as back buffer format if the latter is
5181 * WINED3DFMT_UNKNOWN. */
5182 if (backbuffer_format
== WINED3DFMT_UNKNOWN
)
5183 backbuffer_format
= display_format
;
5185 if (FAILED(wined3d_check_device_format_conversion(wined3d
, adapter_idx
,
5186 device_type
, backbuffer_format
, display_format
)))
5188 TRACE("Format conversion from %s to %s not supported.\n",
5189 debug_d3dformat(backbuffer_format
), debug_d3dformat(display_format
));
5190 return WINED3DERR_NOTAVAILABLE
;
5195 /* When format conversion from the back buffer format to the display
5196 * format is not allowed, only a limited number of combinations are
5199 if (display_format
== WINED3DFMT_B5G6R5_UNORM
&& backbuffer_format
!= WINED3DFMT_B5G6R5_UNORM
)
5201 TRACE("Unsupported format combination %s / %s.\n",
5202 debug_d3dformat(display_format
), debug_d3dformat(backbuffer_format
));
5203 return WINED3DERR_NOTAVAILABLE
;
5206 if (display_format
== WINED3DFMT_B5G5R5X1_UNORM
5207 && !(backbuffer_format
== WINED3DFMT_B5G5R5X1_UNORM
|| backbuffer_format
== WINED3DFMT_B5G5R5A1_UNORM
))
5209 TRACE("Unsupported format combination %s / %s.\n",
5210 debug_d3dformat(display_format
), debug_d3dformat(backbuffer_format
));
5211 return WINED3DERR_NOTAVAILABLE
;
5214 if (display_format
== WINED3DFMT_B8G8R8X8_UNORM
5215 && !(backbuffer_format
== WINED3DFMT_B8G8R8X8_UNORM
|| backbuffer_format
== WINED3DFMT_B8G8R8A8_UNORM
))
5217 TRACE("Unsupported format combination %s / %s.\n",
5218 debug_d3dformat(display_format
), debug_d3dformat(backbuffer_format
));
5219 return WINED3DERR_NOTAVAILABLE
;
5222 if (display_format
== WINED3DFMT_B10G10R10A2_UNORM
5223 && backbuffer_format
!= WINED3DFMT_B10G10R10A2_UNORM
)
5225 TRACE("Unsupported format combination %s / %s.\n",
5226 debug_d3dformat(display_format
), debug_d3dformat(backbuffer_format
));
5227 return WINED3DERR_NOTAVAILABLE
;
5231 /* Validate that the back buffer format is usable for render targets. */
5232 if (FAILED(wined3d_check_device_format(wined3d
, adapter_idx
, device_type
, display_format
,
5233 WINED3DUSAGE_RENDERTARGET
, WINED3D_RTYPE_TEXTURE_2D
, backbuffer_format
)))
5235 TRACE("Format %s not allowed for render targets.\n", debug_d3dformat(backbuffer_format
));
5236 return WINED3DERR_NOTAVAILABLE
;
5242 HRESULT CDECL
wined3d_get_device_caps(const struct wined3d
*wined3d
, UINT adapter_idx
,
5243 enum wined3d_device_type device_type
, WINED3DCAPS
*caps
)
5245 const struct wined3d_adapter
*adapter
= &wined3d
->adapters
[adapter_idx
];
5246 const struct wined3d_gl_info
*gl_info
= &adapter
->gl_info
;
5247 struct shader_caps shader_caps
;
5248 struct fragment_caps fragment_caps
;
5249 struct wined3d_vertex_caps vertex_caps
;
5250 DWORD ckey_caps
, blit_caps
, fx_caps
;
5252 TRACE("wined3d %p, adapter_idx %u, device_type %s, caps %p.\n",
5253 wined3d
, adapter_idx
, debug_d3ddevicetype(device_type
), caps
);
5255 if (adapter_idx
>= wined3d
->adapter_count
)
5256 return WINED3DERR_INVALIDCALL
;
5258 caps
->DeviceType
= (device_type
== WINED3D_DEVICE_TYPE_HAL
) ? WINED3D_DEVICE_TYPE_HAL
: WINED3D_DEVICE_TYPE_REF
;
5259 caps
->AdapterOrdinal
= adapter_idx
;
5262 caps
->Caps2
= WINED3DCAPS2_CANRENDERWINDOWED
|
5263 WINED3DCAPS2_FULLSCREENGAMMA
|
5264 WINED3DCAPS2_DYNAMICTEXTURES
;
5265 if (gl_info
->supported
[SGIS_GENERATE_MIPMAP
])
5266 caps
->Caps2
|= WINED3DCAPS2_CANAUTOGENMIPMAP
;
5268 caps
->Caps3
= WINED3DCAPS3_ALPHA_FULLSCREEN_FLIP_OR_DISCARD
|
5269 WINED3DCAPS3_COPY_TO_VIDMEM
|
5270 WINED3DCAPS3_COPY_TO_SYSTEMMEM
;
5272 caps
->PresentationIntervals
= WINED3DPRESENT_INTERVAL_IMMEDIATE
|
5273 WINED3DPRESENT_INTERVAL_ONE
;
5275 caps
->CursorCaps
= WINED3DCURSORCAPS_COLOR
|
5276 WINED3DCURSORCAPS_LOWRES
;
5278 caps
->DevCaps
= WINED3DDEVCAPS_FLOATTLVERTEX
|
5279 WINED3DDEVCAPS_EXECUTESYSTEMMEMORY
|
5280 WINED3DDEVCAPS_TLVERTEXSYSTEMMEMORY
|
5281 WINED3DDEVCAPS_TLVERTEXVIDEOMEMORY
|
5282 WINED3DDEVCAPS_DRAWPRIMTLVERTEX
|
5283 WINED3DDEVCAPS_HWTRANSFORMANDLIGHT
|
5284 WINED3DDEVCAPS_EXECUTEVIDEOMEMORY
|
5285 WINED3DDEVCAPS_PUREDEVICE
|
5286 WINED3DDEVCAPS_HWRASTERIZATION
|
5287 WINED3DDEVCAPS_TEXTUREVIDEOMEMORY
|
5288 WINED3DDEVCAPS_TEXTURESYSTEMMEMORY
|
5289 WINED3DDEVCAPS_CANRENDERAFTERFLIP
|
5290 WINED3DDEVCAPS_DRAWPRIMITIVES2
|
5291 WINED3DDEVCAPS_DRAWPRIMITIVES2EX
;
5293 caps
->PrimitiveMiscCaps
= WINED3DPMISCCAPS_CULLNONE
|
5294 WINED3DPMISCCAPS_CULLCCW
|
5295 WINED3DPMISCCAPS_CULLCW
|
5296 WINED3DPMISCCAPS_COLORWRITEENABLE
|
5297 WINED3DPMISCCAPS_CLIPTLVERTS
|
5298 WINED3DPMISCCAPS_CLIPPLANESCALEDPOINTS
|
5299 WINED3DPMISCCAPS_MASKZ
|
5300 WINED3DPMISCCAPS_MRTPOSTPIXELSHADERBLENDING
;
5302 WINED3DPMISCCAPS_NULLREFERENCE
5303 WINED3DPMISCCAPS_FOGANDSPECULARALPHA
5304 WINED3DPMISCCAPS_MRTINDEPENDENTBITDEPTHS
5305 WINED3DPMISCCAPS_FOGVERTEXCLAMPED */
5307 if (gl_info
->supported
[WINED3D_GL_BLEND_EQUATION
])
5308 caps
->PrimitiveMiscCaps
|= WINED3DPMISCCAPS_BLENDOP
;
5309 if (gl_info
->supported
[EXT_BLEND_EQUATION_SEPARATE
] && gl_info
->supported
[EXT_BLEND_FUNC_SEPARATE
])
5310 caps
->PrimitiveMiscCaps
|= WINED3DPMISCCAPS_SEPARATEALPHABLEND
;
5311 if (gl_info
->supported
[EXT_DRAW_BUFFERS2
])
5312 caps
->PrimitiveMiscCaps
|= WINED3DPMISCCAPS_INDEPENDENTWRITEMASKS
;
5313 if (gl_info
->supported
[ARB_FRAMEBUFFER_SRGB
])
5314 caps
->PrimitiveMiscCaps
|= WINED3DPMISCCAPS_POSTBLENDSRGBCONVERT
;
5316 caps
->RasterCaps
= WINED3DPRASTERCAPS_DITHER
|
5317 WINED3DPRASTERCAPS_PAT
|
5318 WINED3DPRASTERCAPS_WFOG
|
5319 WINED3DPRASTERCAPS_ZFOG
|
5320 WINED3DPRASTERCAPS_FOGVERTEX
|
5321 WINED3DPRASTERCAPS_FOGTABLE
|
5322 WINED3DPRASTERCAPS_STIPPLE
|
5323 WINED3DPRASTERCAPS_SUBPIXEL
|
5324 WINED3DPRASTERCAPS_ZTEST
|
5325 WINED3DPRASTERCAPS_SCISSORTEST
|
5326 WINED3DPRASTERCAPS_SLOPESCALEDEPTHBIAS
|
5327 WINED3DPRASTERCAPS_DEPTHBIAS
;
5329 if (gl_info
->supported
[EXT_TEXTURE_FILTER_ANISOTROPIC
])
5331 caps
->RasterCaps
|= WINED3DPRASTERCAPS_ANISOTROPY
|
5332 WINED3DPRASTERCAPS_ZBIAS
|
5333 WINED3DPRASTERCAPS_MIPMAPLODBIAS
;
5336 caps
->ZCmpCaps
= WINED3DPCMPCAPS_ALWAYS
|
5337 WINED3DPCMPCAPS_EQUAL
|
5338 WINED3DPCMPCAPS_GREATER
|
5339 WINED3DPCMPCAPS_GREATEREQUAL
|
5340 WINED3DPCMPCAPS_LESS
|
5341 WINED3DPCMPCAPS_LESSEQUAL
|
5342 WINED3DPCMPCAPS_NEVER
|
5343 WINED3DPCMPCAPS_NOTEQUAL
;
5345 /* WINED3DPBLENDCAPS_BOTHINVSRCALPHA and WINED3DPBLENDCAPS_BOTHSRCALPHA
5346 * are legacy settings for srcblend only. */
5347 caps
->SrcBlendCaps
= WINED3DPBLENDCAPS_BOTHINVSRCALPHA
|
5348 WINED3DPBLENDCAPS_BOTHSRCALPHA
|
5349 WINED3DPBLENDCAPS_DESTALPHA
|
5350 WINED3DPBLENDCAPS_DESTCOLOR
|
5351 WINED3DPBLENDCAPS_INVDESTALPHA
|
5352 WINED3DPBLENDCAPS_INVDESTCOLOR
|
5353 WINED3DPBLENDCAPS_INVSRCALPHA
|
5354 WINED3DPBLENDCAPS_INVSRCCOLOR
|
5355 WINED3DPBLENDCAPS_ONE
|
5356 WINED3DPBLENDCAPS_SRCALPHA
|
5357 WINED3DPBLENDCAPS_SRCALPHASAT
|
5358 WINED3DPBLENDCAPS_SRCCOLOR
|
5359 WINED3DPBLENDCAPS_ZERO
;
5361 caps
->DestBlendCaps
= WINED3DPBLENDCAPS_DESTALPHA
|
5362 WINED3DPBLENDCAPS_DESTCOLOR
|
5363 WINED3DPBLENDCAPS_INVDESTALPHA
|
5364 WINED3DPBLENDCAPS_INVDESTCOLOR
|
5365 WINED3DPBLENDCAPS_INVSRCALPHA
|
5366 WINED3DPBLENDCAPS_INVSRCCOLOR
|
5367 WINED3DPBLENDCAPS_ONE
|
5368 WINED3DPBLENDCAPS_SRCALPHA
|
5369 WINED3DPBLENDCAPS_SRCCOLOR
|
5370 WINED3DPBLENDCAPS_ZERO
;
5372 if (gl_info
->supported
[ARB_BLEND_FUNC_EXTENDED
])
5373 caps
->DestBlendCaps
|= WINED3DPBLENDCAPS_SRCALPHASAT
;
5375 if (gl_info
->supported
[EXT_BLEND_COLOR
])
5377 caps
->SrcBlendCaps
|= WINED3DPBLENDCAPS_BLENDFACTOR
;
5378 caps
->DestBlendCaps
|= WINED3DPBLENDCAPS_BLENDFACTOR
;
5382 caps
->AlphaCmpCaps
= WINED3DPCMPCAPS_ALWAYS
|
5383 WINED3DPCMPCAPS_EQUAL
|
5384 WINED3DPCMPCAPS_GREATER
|
5385 WINED3DPCMPCAPS_GREATEREQUAL
|
5386 WINED3DPCMPCAPS_LESS
|
5387 WINED3DPCMPCAPS_LESSEQUAL
|
5388 WINED3DPCMPCAPS_NEVER
|
5389 WINED3DPCMPCAPS_NOTEQUAL
;
5391 caps
->ShadeCaps
= WINED3DPSHADECAPS_SPECULARGOURAUDRGB
|
5392 WINED3DPSHADECAPS_COLORGOURAUDRGB
|
5393 WINED3DPSHADECAPS_ALPHAFLATBLEND
|
5394 WINED3DPSHADECAPS_ALPHAGOURAUDBLEND
|
5395 WINED3DPSHADECAPS_COLORFLATRGB
|
5396 WINED3DPSHADECAPS_FOGFLAT
|
5397 WINED3DPSHADECAPS_FOGGOURAUD
|
5398 WINED3DPSHADECAPS_SPECULARFLATRGB
;
5400 caps
->TextureCaps
= WINED3DPTEXTURECAPS_ALPHA
|
5401 WINED3DPTEXTURECAPS_ALPHAPALETTE
|
5402 WINED3DPTEXTURECAPS_TRANSPARENCY
|
5403 WINED3DPTEXTURECAPS_BORDER
|
5404 WINED3DPTEXTURECAPS_MIPMAP
|
5405 WINED3DPTEXTURECAPS_PROJECTED
|
5406 WINED3DPTEXTURECAPS_PERSPECTIVE
;
5408 if (!gl_info
->supported
[ARB_TEXTURE_NON_POWER_OF_TWO
])
5410 caps
->TextureCaps
|= WINED3DPTEXTURECAPS_POW2
;
5411 if (gl_info
->supported
[WINED3D_GL_NORMALIZED_TEXRECT
] || gl_info
->supported
[ARB_TEXTURE_RECTANGLE
])
5412 caps
->TextureCaps
|= WINED3DPTEXTURECAPS_NONPOW2CONDITIONAL
;
5415 if (gl_info
->supported
[EXT_TEXTURE3D
])
5417 caps
->TextureCaps
|= WINED3DPTEXTURECAPS_VOLUMEMAP
|
5418 WINED3DPTEXTURECAPS_MIPVOLUMEMAP
;
5419 if (!gl_info
->supported
[ARB_TEXTURE_NON_POWER_OF_TWO
])
5421 caps
->TextureCaps
|= WINED3DPTEXTURECAPS_VOLUMEMAP_POW2
;
5425 if (gl_info
->supported
[ARB_TEXTURE_CUBE_MAP
])
5427 caps
->TextureCaps
|= WINED3DPTEXTURECAPS_CUBEMAP
|
5428 WINED3DPTEXTURECAPS_MIPCUBEMAP
;
5429 if (!gl_info
->supported
[ARB_TEXTURE_NON_POWER_OF_TWO
])
5431 caps
->TextureCaps
|= WINED3DPTEXTURECAPS_CUBEMAP_POW2
;
5435 caps
->TextureFilterCaps
= WINED3DPTFILTERCAPS_MAGFLINEAR
|
5436 WINED3DPTFILTERCAPS_MAGFPOINT
|
5437 WINED3DPTFILTERCAPS_MINFLINEAR
|
5438 WINED3DPTFILTERCAPS_MINFPOINT
|
5439 WINED3DPTFILTERCAPS_MIPFLINEAR
|
5440 WINED3DPTFILTERCAPS_MIPFPOINT
|
5441 WINED3DPTFILTERCAPS_LINEAR
|
5442 WINED3DPTFILTERCAPS_LINEARMIPLINEAR
|
5443 WINED3DPTFILTERCAPS_LINEARMIPNEAREST
|
5444 WINED3DPTFILTERCAPS_MIPLINEAR
|
5445 WINED3DPTFILTERCAPS_MIPNEAREST
|
5446 WINED3DPTFILTERCAPS_NEAREST
;
5448 if (gl_info
->supported
[EXT_TEXTURE_FILTER_ANISOTROPIC
])
5450 caps
->TextureFilterCaps
|= WINED3DPTFILTERCAPS_MAGFANISOTROPIC
|
5451 WINED3DPTFILTERCAPS_MINFANISOTROPIC
;
5454 if (gl_info
->supported
[ARB_TEXTURE_CUBE_MAP
])
5456 caps
->CubeTextureFilterCaps
= WINED3DPTFILTERCAPS_MAGFLINEAR
|
5457 WINED3DPTFILTERCAPS_MAGFPOINT
|
5458 WINED3DPTFILTERCAPS_MINFLINEAR
|
5459 WINED3DPTFILTERCAPS_MINFPOINT
|
5460 WINED3DPTFILTERCAPS_MIPFLINEAR
|
5461 WINED3DPTFILTERCAPS_MIPFPOINT
|
5462 WINED3DPTFILTERCAPS_LINEAR
|
5463 WINED3DPTFILTERCAPS_LINEARMIPLINEAR
|
5464 WINED3DPTFILTERCAPS_LINEARMIPNEAREST
|
5465 WINED3DPTFILTERCAPS_MIPLINEAR
|
5466 WINED3DPTFILTERCAPS_MIPNEAREST
|
5467 WINED3DPTFILTERCAPS_NEAREST
;
5469 if (gl_info
->supported
[EXT_TEXTURE_FILTER_ANISOTROPIC
])
5471 caps
->CubeTextureFilterCaps
|= WINED3DPTFILTERCAPS_MAGFANISOTROPIC
|
5472 WINED3DPTFILTERCAPS_MINFANISOTROPIC
;
5477 caps
->CubeTextureFilterCaps
= 0;
5480 if (gl_info
->supported
[EXT_TEXTURE3D
])
5482 caps
->VolumeTextureFilterCaps
= WINED3DPTFILTERCAPS_MAGFLINEAR
|
5483 WINED3DPTFILTERCAPS_MAGFPOINT
|
5484 WINED3DPTFILTERCAPS_MINFLINEAR
|
5485 WINED3DPTFILTERCAPS_MINFPOINT
|
5486 WINED3DPTFILTERCAPS_MIPFLINEAR
|
5487 WINED3DPTFILTERCAPS_MIPFPOINT
|
5488 WINED3DPTFILTERCAPS_LINEAR
|
5489 WINED3DPTFILTERCAPS_LINEARMIPLINEAR
|
5490 WINED3DPTFILTERCAPS_LINEARMIPNEAREST
|
5491 WINED3DPTFILTERCAPS_MIPLINEAR
|
5492 WINED3DPTFILTERCAPS_MIPNEAREST
|
5493 WINED3DPTFILTERCAPS_NEAREST
;
5497 caps
->VolumeTextureFilterCaps
= 0;
5500 caps
->TextureAddressCaps
= WINED3DPTADDRESSCAPS_INDEPENDENTUV
|
5501 WINED3DPTADDRESSCAPS_CLAMP
|
5502 WINED3DPTADDRESSCAPS_WRAP
;
5504 if (gl_info
->supported
[ARB_TEXTURE_BORDER_CLAMP
])
5506 caps
->TextureAddressCaps
|= WINED3DPTADDRESSCAPS_BORDER
;
5508 if (gl_info
->supported
[ARB_TEXTURE_MIRRORED_REPEAT
])
5510 caps
->TextureAddressCaps
|= WINED3DPTADDRESSCAPS_MIRROR
;
5512 if (gl_info
->supported
[ARB_TEXTURE_MIRROR_CLAMP_TO_EDGE
])
5514 caps
->TextureAddressCaps
|= WINED3DPTADDRESSCAPS_MIRRORONCE
;
5517 if (gl_info
->supported
[EXT_TEXTURE3D
])
5519 caps
->VolumeTextureAddressCaps
= WINED3DPTADDRESSCAPS_INDEPENDENTUV
|
5520 WINED3DPTADDRESSCAPS_CLAMP
|
5521 WINED3DPTADDRESSCAPS_WRAP
;
5522 if (gl_info
->supported
[ARB_TEXTURE_BORDER_CLAMP
])
5524 caps
->VolumeTextureAddressCaps
|= WINED3DPTADDRESSCAPS_BORDER
;
5526 if (gl_info
->supported
[ARB_TEXTURE_MIRRORED_REPEAT
])
5528 caps
->VolumeTextureAddressCaps
|= WINED3DPTADDRESSCAPS_MIRROR
;
5530 if (gl_info
->supported
[ARB_TEXTURE_MIRROR_CLAMP_TO_EDGE
])
5532 caps
->VolumeTextureAddressCaps
|= WINED3DPTADDRESSCAPS_MIRRORONCE
;
5537 caps
->VolumeTextureAddressCaps
= 0;
5540 caps
->LineCaps
= WINED3DLINECAPS_TEXTURE
|
5541 WINED3DLINECAPS_ZTEST
|
5542 WINED3DLINECAPS_BLEND
|
5543 WINED3DLINECAPS_ALPHACMP
|
5544 WINED3DLINECAPS_FOG
;
5545 /* WINED3DLINECAPS_ANTIALIAS is not supported on Windows, and dx and gl seem to have a different
5546 * idea how generating the smoothing alpha values works; the result is different
5549 caps
->MaxTextureWidth
= gl_info
->limits
.texture_size
;
5550 caps
->MaxTextureHeight
= gl_info
->limits
.texture_size
;
5552 if (gl_info
->supported
[EXT_TEXTURE3D
])
5553 caps
->MaxVolumeExtent
= gl_info
->limits
.texture3d_size
;
5555 caps
->MaxVolumeExtent
= 0;
5557 caps
->MaxTextureRepeat
= 32768;
5558 caps
->MaxTextureAspectRatio
= gl_info
->limits
.texture_size
;
5559 caps
->MaxVertexW
= 1.0f
;
5561 caps
->GuardBandLeft
= 0.0f
;
5562 caps
->GuardBandTop
= 0.0f
;
5563 caps
->GuardBandRight
= 0.0f
;
5564 caps
->GuardBandBottom
= 0.0f
;
5566 caps
->ExtentsAdjust
= 0.0f
;
5568 caps
->StencilCaps
= WINED3DSTENCILCAPS_DECRSAT
|
5569 WINED3DSTENCILCAPS_INCRSAT
|
5570 WINED3DSTENCILCAPS_INVERT
|
5571 WINED3DSTENCILCAPS_KEEP
|
5572 WINED3DSTENCILCAPS_REPLACE
|
5573 WINED3DSTENCILCAPS_ZERO
;
5574 if (gl_info
->supported
[EXT_STENCIL_WRAP
])
5576 caps
->StencilCaps
|= WINED3DSTENCILCAPS_DECR
|
5577 WINED3DSTENCILCAPS_INCR
;
5579 if (gl_info
->supported
[WINED3D_GL_VERSION_2_0
] || gl_info
->supported
[EXT_STENCIL_TWO_SIDE
]
5580 || gl_info
->supported
[ATI_SEPARATE_STENCIL
])
5582 caps
->StencilCaps
|= WINED3DSTENCILCAPS_TWOSIDED
;
5585 caps
->MaxAnisotropy
= gl_info
->limits
.anisotropy
;
5586 caps
->MaxPointSize
= gl_info
->limits
.pointsize_max
;
5588 caps
->MaxPrimitiveCount
= 0x555555; /* Taken from an AMD Radeon HD 5700 (Evergreen) GPU. */
5589 caps
->MaxVertexIndex
= 0xffffff; /* Taken from an AMD Radeon HD 5700 (Evergreen) GPU. */
5590 caps
->MaxStreams
= MAX_STREAMS
;
5591 caps
->MaxStreamStride
= 1024;
5593 /* d3d9.dll sets D3DDEVCAPS2_CAN_STRETCHRECT_FROM_TEXTURES here because StretchRects is implemented in d3d9 */
5594 caps
->DevCaps2
= WINED3DDEVCAPS2_STREAMOFFSET
|
5595 WINED3DDEVCAPS2_VERTEXELEMENTSCANSHARESTREAMOFFSET
;
5596 caps
->MaxNpatchTessellationLevel
= 0;
5597 caps
->MasterAdapterOrdinal
= 0;
5598 caps
->AdapterOrdinalInGroup
= 0;
5599 caps
->NumberOfAdaptersInGroup
= 1;
5601 caps
->NumSimultaneousRTs
= gl_info
->limits
.buffers
;
5603 caps
->StretchRectFilterCaps
= WINED3DPTFILTERCAPS_MINFPOINT
|
5604 WINED3DPTFILTERCAPS_MAGFPOINT
|
5605 WINED3DPTFILTERCAPS_MINFLINEAR
|
5606 WINED3DPTFILTERCAPS_MAGFLINEAR
;
5607 caps
->VertexTextureFilterCaps
= 0;
5609 adapter
->shader_backend
->shader_get_caps(&adapter
->gl_info
, &shader_caps
);
5610 adapter
->fragment_pipe
->get_caps(&adapter
->gl_info
, &fragment_caps
);
5611 adapter
->vertex_pipe
->vp_get_caps(&adapter
->gl_info
, &vertex_caps
);
5613 /* Add shader misc caps. Only some of them belong to the shader parts of the pipeline */
5614 caps
->PrimitiveMiscCaps
|= fragment_caps
.PrimitiveMiscCaps
;
5616 caps
->VertexShaderVersion
= shader_caps
.vs_version
;
5617 caps
->MaxVertexShaderConst
= shader_caps
.vs_uniform_count
;
5619 caps
->PixelShaderVersion
= shader_caps
.ps_version
;
5620 caps
->PixelShader1xMaxValue
= shader_caps
.ps_1x_max_value
;
5622 caps
->TextureOpCaps
= fragment_caps
.TextureOpCaps
;
5623 caps
->MaxTextureBlendStages
= fragment_caps
.MaxTextureBlendStages
;
5624 caps
->MaxSimultaneousTextures
= fragment_caps
.MaxSimultaneousTextures
;
5626 caps
->MaxUserClipPlanes
= vertex_caps
.max_user_clip_planes
;
5627 caps
->MaxActiveLights
= vertex_caps
.max_active_lights
;
5628 caps
->MaxVertexBlendMatrices
= vertex_caps
.max_vertex_blend_matrices
;
5629 caps
->MaxVertexBlendMatrixIndex
= vertex_caps
.max_vertex_blend_matrix_index
;
5630 caps
->VertexProcessingCaps
= vertex_caps
.vertex_processing_caps
;
5631 caps
->FVFCaps
= vertex_caps
.fvf_caps
;
5632 caps
->RasterCaps
|= vertex_caps
.raster_caps
;
5634 /* The following caps are shader specific, but they are things we cannot detect, or which
5635 * are the same among all shader models. So to avoid code duplication set the shader version
5636 * specific, but otherwise constant caps here
5638 if (caps
->VertexShaderVersion
>= 3)
5640 /* Where possible set the caps based on OpenGL extensions and if they
5641 * aren't set (in case of software rendering) use the VS 3.0 from
5642 * MSDN or else if there's OpenGL spec use a hardcoded value minimum
5644 caps
->VS20Caps
.caps
= WINED3DVS20CAPS_PREDICATION
;
5645 /* VS 3.0 requires MAX_DYNAMICFLOWCONTROLDEPTH (24) */
5646 caps
->VS20Caps
.dynamic_flow_control_depth
= WINED3DVS20_MAX_DYNAMICFLOWCONTROLDEPTH
;
5647 caps
->VS20Caps
.temp_count
= max(32, adapter
->gl_info
.limits
.arb_vs_temps
);
5648 /* level of nesting in loops / if-statements; VS 3.0 requires MAX (4) */
5649 caps
->VS20Caps
.static_flow_control_depth
= WINED3DVS20_MAX_STATICFLOWCONTROLDEPTH
;
5651 caps
->MaxVShaderInstructionsExecuted
= 65535; /* VS 3.0 needs at least 65535, some cards even use 2^32-1 */
5652 caps
->MaxVertexShader30InstructionSlots
= max(512, adapter
->gl_info
.limits
.arb_vs_instructions
);
5653 caps
->VertexTextureFilterCaps
= WINED3DPTFILTERCAPS_MINFPOINT
| WINED3DPTFILTERCAPS_MAGFPOINT
;
5655 else if (caps
->VertexShaderVersion
== 2)
5657 caps
->VS20Caps
.caps
= 0;
5658 caps
->VS20Caps
.dynamic_flow_control_depth
= WINED3DVS20_MIN_DYNAMICFLOWCONTROLDEPTH
;
5659 caps
->VS20Caps
.temp_count
= max(12, adapter
->gl_info
.limits
.arb_vs_temps
);
5660 caps
->VS20Caps
.static_flow_control_depth
= 1;
5662 caps
->MaxVShaderInstructionsExecuted
= 65535;
5663 caps
->MaxVertexShader30InstructionSlots
= 0;
5667 caps
->VS20Caps
.caps
= 0;
5668 caps
->VS20Caps
.dynamic_flow_control_depth
= 0;
5669 caps
->VS20Caps
.temp_count
= 0;
5670 caps
->VS20Caps
.static_flow_control_depth
= 0;
5672 caps
->MaxVShaderInstructionsExecuted
= 0;
5673 caps
->MaxVertexShader30InstructionSlots
= 0;
5676 if (caps
->PixelShaderVersion
>= 3)
5678 /* Where possible set the caps based on OpenGL extensions and if they
5679 * aren't set (in case of software rendering) use the PS 3.0 from
5680 * MSDN or else if there's OpenGL spec use a hardcoded value minimum
5683 /* Caps is more or less undocumented on MSDN but it appears to be
5684 * used for PS20Caps based on results from R9600/FX5900/Geforce6800
5685 * cards from Windows */
5686 caps
->PS20Caps
.caps
= WINED3DPS20CAPS_ARBITRARYSWIZZLE
|
5687 WINED3DPS20CAPS_GRADIENTINSTRUCTIONS
|
5688 WINED3DPS20CAPS_PREDICATION
|
5689 WINED3DPS20CAPS_NODEPENDENTREADLIMIT
|
5690 WINED3DPS20CAPS_NOTEXINSTRUCTIONLIMIT
;
5691 /* PS 3.0 requires MAX_DYNAMICFLOWCONTROLDEPTH (24) */
5692 caps
->PS20Caps
.dynamic_flow_control_depth
= WINED3DPS20_MAX_DYNAMICFLOWCONTROLDEPTH
;
5693 caps
->PS20Caps
.temp_count
= max(32, adapter
->gl_info
.limits
.arb_ps_temps
);
5694 /* PS 3.0 requires MAX_STATICFLOWCONTROLDEPTH (4) */
5695 caps
->PS20Caps
.static_flow_control_depth
= WINED3DPS20_MAX_STATICFLOWCONTROLDEPTH
;
5696 /* PS 3.0 requires MAX_NUMINSTRUCTIONSLOTS (512) */
5697 caps
->PS20Caps
.instruction_slot_count
= WINED3DPS20_MAX_NUMINSTRUCTIONSLOTS
;
5699 caps
->MaxPShaderInstructionsExecuted
= 65535;
5700 caps
->MaxPixelShader30InstructionSlots
= max(WINED3DMIN30SHADERINSTRUCTIONS
,
5701 adapter
->gl_info
.limits
.arb_ps_instructions
);
5703 else if(caps
->PixelShaderVersion
== 2)
5705 /* Below we assume PS2.0 specs, not extended 2.0a(GeforceFX)/2.0b(Radeon R3xx) ones */
5706 caps
->PS20Caps
.caps
= 0;
5707 caps
->PS20Caps
.dynamic_flow_control_depth
= 0; /* WINED3DVS20_MIN_DYNAMICFLOWCONTROLDEPTH = 0 */
5708 caps
->PS20Caps
.temp_count
= max(12, adapter
->gl_info
.limits
.arb_ps_temps
);
5709 caps
->PS20Caps
.static_flow_control_depth
= WINED3DPS20_MIN_STATICFLOWCONTROLDEPTH
; /* Minimum: 1 */
5710 /* Minimum number (64 ALU + 32 Texture), a GeforceFX uses 512 */
5711 caps
->PS20Caps
.instruction_slot_count
= WINED3DPS20_MIN_NUMINSTRUCTIONSLOTS
;
5713 caps
->MaxPShaderInstructionsExecuted
= 512; /* Minimum value, a GeforceFX uses 1024 */
5714 caps
->MaxPixelShader30InstructionSlots
= 0;
5718 caps
->PS20Caps
.caps
= 0;
5719 caps
->PS20Caps
.dynamic_flow_control_depth
= 0;
5720 caps
->PS20Caps
.temp_count
= 0;
5721 caps
->PS20Caps
.static_flow_control_depth
= 0;
5722 caps
->PS20Caps
.instruction_slot_count
= 0;
5724 caps
->MaxPShaderInstructionsExecuted
= 0;
5725 caps
->MaxPixelShader30InstructionSlots
= 0;
5728 if (caps
->VertexShaderVersion
>= 2)
5730 /* OpenGL supports all the formats below, perhaps not always
5731 * without conversion, but it supports them.
5732 * Further GLSL doesn't seem to have an official unsigned type so
5733 * don't advertise it yet as I'm not sure how we handle it.
5734 * We might need to add some clamping in the shader engine to
5736 * TODO: WINED3DDTCAPS_USHORT2N, WINED3DDTCAPS_USHORT4N, WINED3DDTCAPS_UDEC3, WINED3DDTCAPS_DEC3N */
5737 caps
->DeclTypes
= WINED3DDTCAPS_UBYTE4
|
5738 WINED3DDTCAPS_UBYTE4N
|
5739 WINED3DDTCAPS_SHORT2N
|
5740 WINED3DDTCAPS_SHORT4N
;
5741 if (gl_info
->supported
[ARB_HALF_FLOAT_VERTEX
])
5743 caps
->DeclTypes
|= WINED3DDTCAPS_FLOAT16_2
|
5744 WINED3DDTCAPS_FLOAT16_4
;
5749 caps
->DeclTypes
= 0;
5752 /* Set DirectDraw helper Caps */
5753 ckey_caps
= WINEDDCKEYCAPS_DESTBLT
|
5754 WINEDDCKEYCAPS_SRCBLT
;
5755 fx_caps
= WINEDDFXCAPS_BLTALPHA
|
5756 WINEDDFXCAPS_BLTMIRRORLEFTRIGHT
|
5757 WINEDDFXCAPS_BLTMIRRORUPDOWN
|
5758 WINEDDFXCAPS_BLTROTATION90
|
5759 WINEDDFXCAPS_BLTSHRINKX
|
5760 WINEDDFXCAPS_BLTSHRINKXN
|
5761 WINEDDFXCAPS_BLTSHRINKY
|
5762 WINEDDFXCAPS_BLTSHRINKYN
|
5763 WINEDDFXCAPS_BLTSTRETCHX
|
5764 WINEDDFXCAPS_BLTSTRETCHXN
|
5765 WINEDDFXCAPS_BLTSTRETCHY
|
5766 WINEDDFXCAPS_BLTSTRETCHYN
;
5767 blit_caps
= WINEDDCAPS_BLT
|
5768 WINEDDCAPS_BLTCOLORFILL
|
5769 WINEDDCAPS_BLTDEPTHFILL
|
5770 WINEDDCAPS_BLTSTRETCH
|
5771 WINEDDCAPS_CANBLTSYSMEM
|
5772 WINEDDCAPS_CANCLIP
|
5773 WINEDDCAPS_CANCLIPSTRETCHED
|
5774 WINEDDCAPS_COLORKEY
|
5775 WINEDDCAPS_COLORKEYHWASSIST
|
5776 WINEDDCAPS_ALIGNBOUNDARYSRC
;
5778 /* Fill the ddraw caps structure */
5779 caps
->ddraw_caps
.caps
= WINEDDCAPS_GDI
|
5780 WINEDDCAPS_PALETTE
|
5782 caps
->ddraw_caps
.caps2
= WINEDDCAPS2_CERTIFIED
|
5783 WINEDDCAPS2_NOPAGELOCKREQUIRED
|
5784 WINEDDCAPS2_PRIMARYGAMMA
|
5785 WINEDDCAPS2_WIDESURFACES
|
5786 WINEDDCAPS2_CANRENDERWINDOWED
;
5787 caps
->ddraw_caps
.color_key_caps
= ckey_caps
;
5788 caps
->ddraw_caps
.fx_caps
= fx_caps
;
5789 caps
->ddraw_caps
.svb_caps
= blit_caps
;
5790 caps
->ddraw_caps
.svb_color_key_caps
= ckey_caps
;
5791 caps
->ddraw_caps
.svb_fx_caps
= fx_caps
;
5792 caps
->ddraw_caps
.vsb_caps
= blit_caps
;
5793 caps
->ddraw_caps
.vsb_color_key_caps
= ckey_caps
;
5794 caps
->ddraw_caps
.vsb_fx_caps
= fx_caps
;
5795 caps
->ddraw_caps
.ssb_caps
= blit_caps
;
5796 caps
->ddraw_caps
.ssb_color_key_caps
= ckey_caps
;
5797 caps
->ddraw_caps
.ssb_fx_caps
= fx_caps
;
5799 caps
->ddraw_caps
.dds_caps
= WINEDDSCAPS_ALPHA
|
5800 WINEDDSCAPS_BACKBUFFER
|
5802 WINEDDSCAPS_FRONTBUFFER
|
5803 WINEDDSCAPS_OFFSCREENPLAIN
|
5804 WINEDDSCAPS_PALETTE
|
5805 WINEDDSCAPS_PRIMARYSURFACE
|
5806 WINEDDSCAPS_SYSTEMMEMORY
|
5807 WINEDDSCAPS_VIDEOMEMORY
|
5808 WINEDDSCAPS_VISIBLE
;
5810 if (!(wined3d
->flags
& WINED3D_NO3D
))
5812 caps
->ddraw_caps
.dds_caps
|= WINEDDSCAPS_3DDEVICE
|
5813 WINEDDSCAPS_MIPMAP
|
5814 WINEDDSCAPS_TEXTURE
|
5815 WINEDDSCAPS_ZBUFFER
;
5816 caps
->ddraw_caps
.caps
|= WINEDDCAPS_3D
;
5822 HRESULT CDECL
wined3d_device_create(struct wined3d
*wined3d
, UINT adapter_idx
, enum wined3d_device_type device_type
,
5823 HWND focus_window
, DWORD flags
, BYTE surface_alignment
, struct wined3d_device_parent
*device_parent
,
5824 struct wined3d_device
**device
)
5826 struct wined3d_device
*object
;
5829 TRACE("wined3d %p, adapter_idx %u, device_type %#x, focus_window %p, flags %#x, surface_alignment %u, device_parent %p, device %p.\n",
5830 wined3d
, adapter_idx
, device_type
, focus_window
, flags
, surface_alignment
, device_parent
, device
);
5832 /* Validate the adapter number. If no adapters are available(no GL), ignore the adapter
5833 * number and create a device without a 3D adapter for 2D only operation. */
5834 if (wined3d
->adapter_count
&& adapter_idx
>= wined3d
->adapter_count
)
5835 return WINED3DERR_INVALIDCALL
;
5837 object
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*object
));
5839 return E_OUTOFMEMORY
;
5841 hr
= device_init(object
, wined3d
, adapter_idx
, device_type
,
5842 focus_window
, flags
, surface_alignment
, device_parent
);
5845 WARN("Failed to initialize device, hr %#x.\n", hr
);
5846 HeapFree(GetProcessHeap(), 0, object
);
5850 TRACE("Created device %p.\n", object
);
5853 device_parent
->ops
->wined3d_device_created(device_parent
, *device
);
5858 static void WINE_GLAPI
invalid_func(const void *data
)
5860 ERR("Invalid vertex attribute function called.\n");
5864 static void WINE_GLAPI
invalid_texcoord_func(GLenum unit
, const void *data
)
5866 ERR("Invalid texcoord function called.\n");
5870 static void WINE_GLAPI
invalid_generic_attrib_func(GLuint idx
, const void *data
)
5872 ERR("Invalid attribute function called.\n");
5876 /* Helper functions for providing vertex data to OpenGL. The arrays are
5877 * initialised based on the extension detection and are used in
5878 * draw_primitive_immediate_mode(). */
5879 static void WINE_GLAPI
position_d3dcolor(const void *data
)
5881 DWORD pos
= *((const DWORD
*)data
);
5883 FIXME("Add a test for fixed function position from d3dcolor type.\n");
5884 context_get_current()->gl_info
->gl_ops
.gl
.p_glVertex4s(D3DCOLOR_B_R(pos
),
5890 static void WINE_GLAPI
position_float4(const void *data
)
5892 const GLfloat
*pos
= data
;
5894 if (pos
[3] != 0.0f
&& pos
[3] != 1.0f
)
5896 float w
= 1.0f
/ pos
[3];
5898 context_get_current()->gl_info
->gl_ops
.gl
.p_glVertex4f(pos
[0] * w
, pos
[1] * w
, pos
[2] * w
, w
);
5902 context_get_current()->gl_info
->gl_ops
.gl
.p_glVertex3fv(pos
);
5906 static void WINE_GLAPI
diffuse_d3dcolor(const void *data
)
5908 DWORD diffuseColor
= *((const DWORD
*)data
);
5910 context_get_current()->gl_info
->gl_ops
.gl
.p_glColor4ub(D3DCOLOR_B_R(diffuseColor
),
5911 D3DCOLOR_B_G(diffuseColor
),
5912 D3DCOLOR_B_B(diffuseColor
),
5913 D3DCOLOR_B_A(diffuseColor
));
5916 static void WINE_GLAPI
specular_d3dcolor(const void *data
)
5918 DWORD specularColor
= *((const DWORD
*)data
);
5921 D3DCOLOR_B_R(specularColor
),
5922 D3DCOLOR_B_G(specularColor
),
5923 D3DCOLOR_B_B(specularColor
)
5926 context_get_current()->gl_info
->gl_ops
.ext
.p_glSecondaryColor3ubvEXT(d
);
5929 static void WINE_GLAPI
warn_no_specular_func(const void *data
)
5931 WARN("GL_EXT_secondary_color not supported.\n");
5934 static void WINE_GLAPI
generic_d3dcolor(GLuint idx
, const void *data
)
5936 DWORD color
= *((const DWORD
*)data
);
5938 context_get_current()->gl_info
->gl_ops
.ext
.p_glVertexAttrib4Nub(idx
,
5939 D3DCOLOR_B_R(color
), D3DCOLOR_B_G(color
),
5940 D3DCOLOR_B_B(color
), D3DCOLOR_B_A(color
));
5943 static void WINE_GLAPI
generic_short2n(GLuint idx
, const void *data
)
5945 const GLshort s
[] = {((const GLshort
*)data
)[0], ((const GLshort
*)data
)[1], 0, 1};
5947 context_get_current()->gl_info
->gl_ops
.ext
.p_glVertexAttrib4Nsv(idx
, s
);
5950 static void WINE_GLAPI
generic_ushort2n(GLuint idx
, const void *data
)
5952 const GLushort s
[] = {((const GLushort
*)data
)[0], ((const GLushort
*)data
)[1], 0, 1};
5954 context_get_current()->gl_info
->gl_ops
.ext
.p_glVertexAttrib4Nusv(idx
, s
);
5957 static void WINE_GLAPI
generic_float16_2(GLuint idx
, const void *data
)
5959 float x
= float_16_to_32(((const unsigned short *)data
) + 0);
5960 float y
= float_16_to_32(((const unsigned short *)data
) + 1);
5962 context_get_current()->gl_info
->gl_ops
.ext
.p_glVertexAttrib2f(idx
, x
, y
);
5965 static void WINE_GLAPI
generic_float16_4(GLuint idx
, const void *data
)
5967 float x
= float_16_to_32(((const unsigned short *)data
) + 0);
5968 float y
= float_16_to_32(((const unsigned short *)data
) + 1);
5969 float z
= float_16_to_32(((const unsigned short *)data
) + 2);
5970 float w
= float_16_to_32(((const unsigned short *)data
) + 3);
5972 context_get_current()->gl_info
->gl_ops
.ext
.p_glVertexAttrib4f(idx
, x
, y
, z
, w
);
5975 static void wined3d_adapter_init_ffp_attrib_ops(struct wined3d_adapter
*adapter
)
5977 const struct wined3d_gl_info
*gl_info
= &adapter
->gl_info
;
5978 struct wined3d_d3d_info
*d3d_info
= &adapter
->d3d_info
;
5979 struct wined3d_ffp_attrib_ops
*ops
= &d3d_info
->ffp_attrib_ops
;
5982 for (i
= 0; i
< WINED3D_FFP_EMIT_COUNT
; ++i
)
5984 ops
->position
[i
] = invalid_func
;
5985 ops
->diffuse
[i
] = invalid_func
;
5986 ops
->specular
[i
] = invalid_func
;
5987 ops
->normal
[i
] = invalid_func
;
5988 ops
->texcoord
[i
] = invalid_texcoord_func
;
5989 ops
->generic
[i
] = invalid_generic_attrib_func
;
5992 ops
->position
[WINED3D_FFP_EMIT_FLOAT3
] = (wined3d_ffp_attrib_func
)gl_info
->gl_ops
.gl
.p_glVertex3fv
;
5993 if (!d3d_info
->xyzrhw
)
5994 ops
->position
[WINED3D_FFP_EMIT_FLOAT4
] = position_float4
;
5996 ops
->position
[WINED3D_FFP_EMIT_FLOAT4
] = (wined3d_ffp_attrib_func
)gl_info
->gl_ops
.gl
.p_glVertex4fv
;
5997 ops
->position
[WINED3D_FFP_EMIT_D3DCOLOR
] = position_d3dcolor
;
5998 ops
->position
[WINED3D_FFP_EMIT_SHORT4
] = (wined3d_ffp_attrib_func
)gl_info
->gl_ops
.gl
.p_glVertex2sv
;
6000 ops
->diffuse
[WINED3D_FFP_EMIT_FLOAT3
] = (wined3d_ffp_attrib_func
)gl_info
->gl_ops
.gl
.p_glColor3fv
;
6001 ops
->diffuse
[WINED3D_FFP_EMIT_FLOAT4
] = (wined3d_ffp_attrib_func
)gl_info
->gl_ops
.gl
.p_glColor4fv
;
6002 ops
->diffuse
[WINED3D_FFP_EMIT_D3DCOLOR
] = diffuse_d3dcolor
;
6003 ops
->diffuse
[WINED3D_FFP_EMIT_UBYTE4N
] = (wined3d_ffp_attrib_func
)gl_info
->gl_ops
.gl
.p_glColor4ubv
;
6004 ops
->diffuse
[WINED3D_FFP_EMIT_SHORT4N
] = (wined3d_ffp_attrib_func
)gl_info
->gl_ops
.gl
.p_glColor4sv
;
6005 ops
->diffuse
[WINED3D_FFP_EMIT_USHORT4N
] = (wined3d_ffp_attrib_func
)gl_info
->gl_ops
.gl
.p_glColor4usv
;
6007 /* No 4 component entry points here. */
6008 if (gl_info
->supported
[EXT_SECONDARY_COLOR
])
6009 ops
->specular
[WINED3D_FFP_EMIT_FLOAT3
] = (wined3d_ffp_attrib_func
)GL_EXTCALL(glSecondaryColor3fvEXT
);
6011 ops
->specular
[WINED3D_FFP_EMIT_FLOAT3
] = warn_no_specular_func
;
6012 if (gl_info
->supported
[EXT_SECONDARY_COLOR
])
6013 ops
->specular
[WINED3D_FFP_EMIT_D3DCOLOR
] = specular_d3dcolor
;
6015 ops
->specular
[WINED3D_FFP_EMIT_D3DCOLOR
] = warn_no_specular_func
;
6017 /* Only 3 component entry points here. Test how others behave. Float4
6018 * normals are used by one of our tests, trying to pass it to the pixel
6019 * shader, which fails on Windows. */
6020 ops
->normal
[WINED3D_FFP_EMIT_FLOAT3
] = (wined3d_ffp_attrib_func
)gl_info
->gl_ops
.gl
.p_glNormal3fv
;
6021 /* Just ignore the 4th value. */
6022 ops
->normal
[WINED3D_FFP_EMIT_FLOAT4
] = (wined3d_ffp_attrib_func
)gl_info
->gl_ops
.gl
.p_glNormal3fv
;
6024 ops
->texcoord
[WINED3D_FFP_EMIT_FLOAT1
] = (wined3d_ffp_texcoord_func
)gl_info
->gl_ops
.ext
.p_glMultiTexCoord1fvARB
;
6025 ops
->texcoord
[WINED3D_FFP_EMIT_FLOAT2
] = (wined3d_ffp_texcoord_func
)gl_info
->gl_ops
.ext
.p_glMultiTexCoord2fvARB
;
6026 ops
->texcoord
[WINED3D_FFP_EMIT_FLOAT3
] = (wined3d_ffp_texcoord_func
)gl_info
->gl_ops
.ext
.p_glMultiTexCoord3fvARB
;
6027 ops
->texcoord
[WINED3D_FFP_EMIT_FLOAT4
] = (wined3d_ffp_texcoord_func
)gl_info
->gl_ops
.ext
.p_glMultiTexCoord4fvARB
;
6028 ops
->texcoord
[WINED3D_FFP_EMIT_SHORT2
] = (wined3d_ffp_texcoord_func
)gl_info
->gl_ops
.ext
.p_glMultiTexCoord2svARB
;
6029 ops
->texcoord
[WINED3D_FFP_EMIT_SHORT4
] = (wined3d_ffp_texcoord_func
)gl_info
->gl_ops
.ext
.p_glMultiTexCoord4svARB
;
6030 if (gl_info
->supported
[NV_HALF_FLOAT
])
6032 /* Not supported by ARB_HALF_FLOAT_VERTEX, so check for NV_HALF_FLOAT. */
6033 ops
->texcoord
[WINED3D_FFP_EMIT_FLOAT16_2
] =
6034 (wined3d_ffp_texcoord_func
)gl_info
->gl_ops
.ext
.p_glMultiTexCoord2hvNV
;
6035 ops
->texcoord
[WINED3D_FFP_EMIT_FLOAT16_4
] =
6036 (wined3d_ffp_texcoord_func
)gl_info
->gl_ops
.ext
.p_glMultiTexCoord4hvNV
;
6039 ops
->generic
[WINED3D_FFP_EMIT_FLOAT1
] = (wined3d_generic_attrib_func
)gl_info
->gl_ops
.ext
.p_glVertexAttrib1fv
;
6040 ops
->generic
[WINED3D_FFP_EMIT_FLOAT2
] = (wined3d_generic_attrib_func
)gl_info
->gl_ops
.ext
.p_glVertexAttrib2fv
;
6041 ops
->generic
[WINED3D_FFP_EMIT_FLOAT3
] = (wined3d_generic_attrib_func
)gl_info
->gl_ops
.ext
.p_glVertexAttrib3fv
;
6042 ops
->generic
[WINED3D_FFP_EMIT_FLOAT4
] = (wined3d_generic_attrib_func
)gl_info
->gl_ops
.ext
.p_glVertexAttrib4fv
;
6043 if (gl_info
->supported
[ARB_VERTEX_ARRAY_BGRA
])
6044 ops
->generic
[WINED3D_FFP_EMIT_D3DCOLOR
] = generic_d3dcolor
;
6046 ops
->generic
[WINED3D_FFP_EMIT_D3DCOLOR
] =
6047 (wined3d_generic_attrib_func
)gl_info
->gl_ops
.ext
.p_glVertexAttrib4Nubv
;
6048 ops
->generic
[WINED3D_FFP_EMIT_UBYTE4
] = (wined3d_generic_attrib_func
)gl_info
->gl_ops
.ext
.p_glVertexAttrib4ubv
;
6049 ops
->generic
[WINED3D_FFP_EMIT_SHORT2
] = (wined3d_generic_attrib_func
)gl_info
->gl_ops
.ext
.p_glVertexAttrib2sv
;
6050 ops
->generic
[WINED3D_FFP_EMIT_SHORT4
] = (wined3d_generic_attrib_func
)gl_info
->gl_ops
.ext
.p_glVertexAttrib4sv
;
6051 ops
->generic
[WINED3D_FFP_EMIT_UBYTE4N
] = (wined3d_generic_attrib_func
)gl_info
->gl_ops
.ext
.p_glVertexAttrib4Nubv
;
6052 ops
->generic
[WINED3D_FFP_EMIT_SHORT2N
] = generic_short2n
;
6053 ops
->generic
[WINED3D_FFP_EMIT_SHORT4N
] = (wined3d_generic_attrib_func
)gl_info
->gl_ops
.ext
.p_glVertexAttrib4Nsv
;
6054 ops
->generic
[WINED3D_FFP_EMIT_USHORT2N
] = generic_ushort2n
;
6055 ops
->generic
[WINED3D_FFP_EMIT_USHORT4N
] = (wined3d_generic_attrib_func
)gl_info
->gl_ops
.ext
.p_glVertexAttrib4Nusv
;
6056 if (gl_info
->supported
[NV_HALF_FLOAT
] && gl_info
->supported
[NV_VERTEX_PROGRAM
])
6058 ops
->generic
[WINED3D_FFP_EMIT_FLOAT16_2
] =
6059 (wined3d_generic_attrib_func
)gl_info
->gl_ops
.ext
.p_glVertexAttrib2hvNV
;
6060 ops
->generic
[WINED3D_FFP_EMIT_FLOAT16_4
] =
6061 (wined3d_generic_attrib_func
)gl_info
->gl_ops
.ext
.p_glVertexAttrib4hvNV
;
6065 ops
->generic
[WINED3D_FFP_EMIT_FLOAT16_2
] = generic_float16_2
;
6066 ops
->generic
[WINED3D_FFP_EMIT_FLOAT16_4
] = generic_float16_4
;
6070 static void wined3d_adapter_init_fb_cfgs(struct wined3d_adapter
*adapter
, HDC dc
)
6072 const struct wined3d_gl_info
*gl_info
= &adapter
->gl_info
;
6075 if (gl_info
->supported
[WGL_ARB_PIXEL_FORMAT
])
6077 UINT attrib_count
= 0;
6083 attribute
= WGL_NUMBER_PIXEL_FORMATS_ARB
;
6084 GL_EXTCALL(wglGetPixelFormatAttribivARB(dc
, 0, 0, 1, &attribute
, &cfg_count
));
6086 adapter
->cfgs
= wined3d_calloc(cfg_count
, sizeof(*adapter
->cfgs
));
6087 attribs
[attrib_count
++] = WGL_RED_BITS_ARB
;
6088 attribs
[attrib_count
++] = WGL_GREEN_BITS_ARB
;
6089 attribs
[attrib_count
++] = WGL_BLUE_BITS_ARB
;
6090 attribs
[attrib_count
++] = WGL_ALPHA_BITS_ARB
;
6091 attribs
[attrib_count
++] = WGL_COLOR_BITS_ARB
;
6092 attribs
[attrib_count
++] = WGL_DEPTH_BITS_ARB
;
6093 attribs
[attrib_count
++] = WGL_STENCIL_BITS_ARB
;
6094 attribs
[attrib_count
++] = WGL_DRAW_TO_WINDOW_ARB
;
6095 attribs
[attrib_count
++] = WGL_PIXEL_TYPE_ARB
;
6096 attribs
[attrib_count
++] = WGL_DOUBLE_BUFFER_ARB
;
6097 attribs
[attrib_count
++] = WGL_AUX_BUFFERS_ARB
;
6099 for (i
= 0, adapter
->cfg_count
= 0; i
< cfg_count
; ++i
)
6101 struct wined3d_pixel_format
*cfg
= &adapter
->cfgs
[adapter
->cfg_count
];
6102 int format_id
= i
+ 1;
6104 if (!GL_EXTCALL(wglGetPixelFormatAttribivARB(dc
, format_id
, 0, attrib_count
, attribs
, values
)))
6107 cfg
->iPixelFormat
= format_id
;
6108 cfg
->redSize
= values
[0];
6109 cfg
->greenSize
= values
[1];
6110 cfg
->blueSize
= values
[2];
6111 cfg
->alphaSize
= values
[3];
6112 cfg
->colorSize
= values
[4];
6113 cfg
->depthSize
= values
[5];
6114 cfg
->stencilSize
= values
[6];
6115 cfg
->windowDrawable
= values
[7];
6116 cfg
->iPixelType
= values
[8];
6117 cfg
->doubleBuffer
= values
[9];
6118 cfg
->auxBuffers
= values
[10];
6120 cfg
->numSamples
= 0;
6121 /* Check multisample support. */
6122 if (gl_info
->supported
[ARB_MULTISAMPLE
])
6124 int attribs
[2] = {WGL_SAMPLE_BUFFERS_ARB
, WGL_SAMPLES_ARB
};
6127 if (GL_EXTCALL(wglGetPixelFormatAttribivARB(dc
, format_id
, 0, 2, attribs
, values
)))
6129 /* values[0] = WGL_SAMPLE_BUFFERS_ARB which tells whether
6130 * multisampling is supported. values[1] = number of
6131 * multisample buffers. */
6133 cfg
->numSamples
= values
[1];
6137 TRACE("iPixelFormat=%d, iPixelType=%#x, doubleBuffer=%d, RGBA=%d/%d/%d/%d, "
6138 "depth=%d, stencil=%d, samples=%d, windowDrawable=%d\n",
6139 cfg
->iPixelFormat
, cfg
->iPixelType
, cfg
->doubleBuffer
,
6140 cfg
->redSize
, cfg
->greenSize
, cfg
->blueSize
, cfg
->alphaSize
,
6141 cfg
->depthSize
, cfg
->stencilSize
, cfg
->numSamples
, cfg
->windowDrawable
);
6143 ++adapter
->cfg_count
;
6150 cfg_count
= DescribePixelFormat(dc
, 0, 0, 0);
6151 adapter
->cfgs
= wined3d_calloc(cfg_count
, sizeof(*adapter
->cfgs
));
6153 for (i
= 0, adapter
->cfg_count
= 0; i
< cfg_count
; ++i
)
6155 struct wined3d_pixel_format
*cfg
= &adapter
->cfgs
[adapter
->cfg_count
];
6156 PIXELFORMATDESCRIPTOR pfd
;
6157 int format_id
= i
+ 1;
6159 if (!DescribePixelFormat(dc
, format_id
, sizeof(pfd
), &pfd
))
6162 /* We only want HW acceleration using an OpenGL ICD driver.
6163 * PFD_GENERIC_FORMAT = slow opengl 1.1 gdi software rendering.
6164 * PFD_GENERIC_ACCELERATED = partial hw acceleration using a MCD
6165 * driver (e.g. 3dfx minigl). */
6166 if (pfd
.dwFlags
& (PFD_GENERIC_FORMAT
| PFD_GENERIC_ACCELERATED
))
6168 TRACE("Skipping format %d because it isn't ICD accelerated.\n", format_id
);
6172 cfg
->iPixelFormat
= format_id
;
6173 cfg
->redSize
= pfd
.cRedBits
;
6174 cfg
->greenSize
= pfd
.cGreenBits
;
6175 cfg
->blueSize
= pfd
.cBlueBits
;
6176 cfg
->alphaSize
= pfd
.cAlphaBits
;
6177 cfg
->colorSize
= pfd
.cColorBits
;
6178 cfg
->depthSize
= pfd
.cDepthBits
;
6179 cfg
->stencilSize
= pfd
.cStencilBits
;
6180 cfg
->windowDrawable
= (pfd
.dwFlags
& PFD_DRAW_TO_WINDOW
) ? 1 : 0;
6181 cfg
->iPixelType
= (pfd
.iPixelType
== PFD_TYPE_RGBA
) ? WGL_TYPE_RGBA_ARB
: WGL_TYPE_COLORINDEX_ARB
;
6182 cfg
->doubleBuffer
= (pfd
.dwFlags
& PFD_DOUBLEBUFFER
) ? 1 : 0;
6183 cfg
->auxBuffers
= pfd
.cAuxBuffers
;
6184 cfg
->numSamples
= 0;
6186 TRACE("iPixelFormat=%d, iPixelType=%#x, doubleBuffer=%d, RGBA=%d/%d/%d/%d, "
6187 "depth=%d, stencil=%d, windowDrawable=%d\n",
6188 cfg
->iPixelFormat
, cfg
->iPixelType
, cfg
->doubleBuffer
,
6189 cfg
->redSize
, cfg
->greenSize
, cfg
->blueSize
, cfg
->alphaSize
,
6190 cfg
->depthSize
, cfg
->stencilSize
, cfg
->windowDrawable
);
6192 ++adapter
->cfg_count
;
6197 static BOOL
wined3d_adapter_init(struct wined3d_adapter
*adapter
, UINT ordinal
, DWORD wined3d_creation_flags
)
6199 static const DWORD supported_gl_versions
[] =
6201 MAKEDWORD_VERSION(3, 2),
6202 MAKEDWORD_VERSION(1, 0),
6204 struct wined3d_gl_info
*gl_info
= &adapter
->gl_info
;
6205 struct wined3d_caps_gl_ctx caps_gl_ctx
= {0};
6207 DISPLAY_DEVICEW display_device
;
6209 TRACE("adapter %p, ordinal %u.\n", adapter
, ordinal
);
6211 adapter
->ordinal
= ordinal
;
6213 /* Dynamically load all GL core functions */
6214 #ifdef USE_WIN32_OPENGL
6216 HMODULE mod_gl
= GetModuleHandleA("opengl32.dll");
6217 #define USE_GL_FUNC(f) gl_info->gl_ops.gl.p_##f = (void *)GetProcAddress(mod_gl, #f);
6220 gl_info
->gl_ops
.wgl
.p_wglSwapBuffers
= (void *)GetProcAddress(mod_gl
, "wglSwapBuffers");
6221 gl_info
->gl_ops
.wgl
.p_wglGetPixelFormat
= (void *)GetProcAddress(mod_gl
, "wglGetPixelFormat");
6224 /* To bypass the opengl32 thunks retrieve functions from the WGL driver instead of opengl32 */
6226 HDC hdc
= GetDC( 0 );
6227 const struct opengl_funcs
*wgl_driver
= __wine_get_wgl_driver( hdc
, WINE_WGL_DRIVER_VERSION
);
6228 ReleaseDC( 0, hdc
);
6229 if (!wgl_driver
|| wgl_driver
== (void *)-1) return FALSE
;
6230 gl_info
->gl_ops
.wgl
= wgl_driver
->wgl
;
6231 gl_info
->gl_ops
.gl
= wgl_driver
->gl
;
6235 glEnableWINE
= gl_info
->gl_ops
.gl
.p_glEnable
;
6236 glDisableWINE
= gl_info
->gl_ops
.gl
.p_glDisable
;
6238 if (!AllocateLocallyUniqueId(&adapter
->luid
))
6240 ERR("Failed to set adapter LUID (%#x).\n", GetLastError());
6243 TRACE("Allocated LUID %08x:%08x for adapter %p.\n",
6244 adapter
->luid
.HighPart
, adapter
->luid
.LowPart
, adapter
);
6246 if (!wined3d_caps_gl_ctx_create(adapter
, &caps_gl_ctx
))
6248 ERR("Failed to get a GL context for adapter %p.\n", adapter
);
6252 for (i
= 0; i
< ARRAY_SIZE(supported_gl_versions
); ++i
)
6254 if (supported_gl_versions
[i
] <= wined3d_settings
.max_gl_version
)
6257 if (i
== ARRAY_SIZE(supported_gl_versions
))
6259 ERR_(winediag
)("Requested invalid GL version %u.%u.\n",
6260 wined3d_settings
.max_gl_version
>> 16, wined3d_settings
.max_gl_version
& 0xffff);
6261 i
= ARRAY_SIZE(supported_gl_versions
) - 1;
6264 for (; i
< ARRAY_SIZE(supported_gl_versions
); ++i
)
6266 gl_info
->selected_gl_version
= supported_gl_versions
[i
];
6268 if (wined3d_caps_gl_ctx_create_attribs(&caps_gl_ctx
, gl_info
))
6271 WARN("Couldn't create an OpenGL %u.%u context, trying fallback to a lower version.\n",
6272 supported_gl_versions
[i
] >> 16, supported_gl_versions
[i
] & 0xffff);
6275 if (!wined3d_adapter_init_gl_caps(adapter
, wined3d_creation_flags
))
6277 ERR("Failed to initialize GL caps for adapter %p.\n", adapter
);
6278 wined3d_caps_gl_ctx_destroy(&caps_gl_ctx
);
6282 wined3d_adapter_init_fb_cfgs(adapter
, caps_gl_ctx
.dc
);
6283 /* We haven't found any suitable formats. This should only happen in
6284 * case of GDI software rendering, which is pretty useless anyway. */
6285 if (!adapter
->cfg_count
)
6287 WARN("No suitable pixel formats found.\n");
6288 wined3d_caps_gl_ctx_destroy(&caps_gl_ctx
);
6289 HeapFree(GetProcessHeap(), 0, adapter
->cfgs
);
6293 if (!wined3d_adapter_init_format_info(adapter
, &caps_gl_ctx
))
6295 ERR("Failed to initialize GL format info.\n");
6296 wined3d_caps_gl_ctx_destroy(&caps_gl_ctx
);
6297 HeapFree(GetProcessHeap(), 0, adapter
->cfgs
);
6301 gl_info
->fixed_polyoffset_scale
= wined3d_adapter_find_polyoffset_scale(&caps_gl_ctx
, GL_DEPTH_COMPONENT
);
6302 if (gl_info
->supported
[ARB_DEPTH_BUFFER_FLOAT
])
6303 gl_info
->float_polyoffset_scale
= wined3d_adapter_find_polyoffset_scale(&caps_gl_ctx
, GL_DEPTH32F_STENCIL8
);
6305 adapter
->vram_bytes
= adapter
->driver_info
.vram_bytes
;
6306 adapter
->vram_bytes_used
= 0;
6307 TRACE("Emulating 0x%s bytes of video ram.\n", wine_dbgstr_longlong(adapter
->vram_bytes
));
6309 display_device
.cb
= sizeof(display_device
);
6310 EnumDisplayDevicesW(NULL
, ordinal
, &display_device
, 0);
6311 TRACE("DeviceName: %s\n", debugstr_w(display_device
.DeviceName
));
6312 strcpyW(adapter
->DeviceName
, display_device
.DeviceName
);
6314 wined3d_caps_gl_ctx_destroy(&caps_gl_ctx
);
6316 wined3d_adapter_init_ffp_attrib_ops(adapter
);
6321 static void wined3d_adapter_init_nogl(struct wined3d_adapter
*adapter
, UINT ordinal
)
6323 DISPLAY_DEVICEW display_device
;
6325 memset(adapter
, 0, sizeof(*adapter
));
6326 adapter
->ordinal
= ordinal
;
6328 adapter
->driver_info
.name
= "Display";
6329 adapter
->driver_info
.description
= "WineD3D DirectDraw Emulation";
6330 if (wined3d_settings
.emulated_textureram
)
6331 adapter
->vram_bytes
= wined3d_settings
.emulated_textureram
;
6333 adapter
->vram_bytes
= 128 * 1024 * 1024;
6335 initPixelFormatsNoGL(&adapter
->gl_info
);
6337 adapter
->vertex_pipe
= &none_vertex_pipe
;
6338 adapter
->fragment_pipe
= &none_fragment_pipe
;
6339 adapter
->shader_backend
= &none_shader_backend
;
6340 adapter
->blitter
= &cpu_blit
;
6342 display_device
.cb
= sizeof(display_device
);
6343 EnumDisplayDevicesW(NULL
, ordinal
, &display_device
, 0);
6344 TRACE("DeviceName: %s\n", debugstr_w(display_device
.DeviceName
));
6345 strcpyW(adapter
->DeviceName
, display_device
.DeviceName
);
6348 static void STDMETHODCALLTYPE
wined3d_null_wined3d_object_destroyed(void *parent
) {}
6350 const struct wined3d_parent_ops wined3d_null_parent_ops
=
6352 wined3d_null_wined3d_object_destroyed
,
6355 HRESULT
wined3d_init(struct wined3d
*wined3d
, DWORD flags
)
6358 wined3d
->flags
= flags
;
6360 TRACE("Initializing adapters.\n");
6362 if (flags
& WINED3D_NO3D
)
6364 wined3d_adapter_init_nogl(&wined3d
->adapters
[0], 0);
6365 wined3d
->adapter_count
= 1;
6369 if (!wined3d_adapter_init(&wined3d
->adapters
[0], 0, flags
))
6371 WARN("Failed to initialize adapter.\n");
6374 wined3d
->adapter_count
= 1;