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
,
53 DRIVER_NVIDIA_GEFORCE2MX
,
54 DRIVER_NVIDIA_GEFORCEFX
,
55 DRIVER_NVIDIA_GEFORCE6
,
56 DRIVER_NVIDIA_GEFORCE8
,
61 enum wined3d_driver_model
69 enum wined3d_gl_vendor
78 enum wined3d_d3d_level
84 WINED3D_D3D_LEVEL_9_SM2
,
85 WINED3D_D3D_LEVEL_9_SM3
,
88 WINED3D_D3D_LEVEL_COUNT
91 /* The d3d device ID */
92 static const GUID IID_D3DDEVICE_D3DUID
= { 0xaeb2cdd4, 0x6e41, 0x43ea, { 0x94,0x1c,0x83,0x61,0xcc,0x76,0x07,0x81 } };
94 /* Extension detection */
95 struct wined3d_extension_map
97 const char *extension_string
;
98 enum wined3d_gl_extension extension
;
101 static const struct wined3d_extension_map gl_extension_map
[] =
104 {"GL_APPLE_fence", APPLE_FENCE
},
105 {"GL_APPLE_float_pixels", APPLE_FLOAT_PIXELS
},
106 {"GL_APPLE_flush_buffer_range", APPLE_FLUSH_BUFFER_RANGE
},
107 {"GL_APPLE_ycbcr_422", APPLE_YCBCR_422
},
110 {"GL_ARB_blend_func_extended", ARB_BLEND_FUNC_EXTENDED
},
111 {"GL_ARB_color_buffer_float", ARB_COLOR_BUFFER_FLOAT
},
112 {"GL_ARB_copy_buffer", ARB_COPY_BUFFER
},
113 {"GL_ARB_debug_output", ARB_DEBUG_OUTPUT
},
114 {"GL_ARB_depth_buffer_float", ARB_DEPTH_BUFFER_FLOAT
},
115 {"GL_ARB_depth_texture", ARB_DEPTH_TEXTURE
},
116 {"GL_ARB_draw_buffers", ARB_DRAW_BUFFERS
},
117 {"GL_ARB_draw_elements_base_vertex", ARB_DRAW_ELEMENTS_BASE_VERTEX
},
118 {"GL_ARB_draw_instanced", ARB_DRAW_INSTANCED
},
119 {"GL_ARB_ES2_compatibility", ARB_ES2_COMPATIBILITY
},
120 {"GL_ARB_fragment_program", ARB_FRAGMENT_PROGRAM
},
121 {"GL_ARB_fragment_shader", ARB_FRAGMENT_SHADER
},
122 {"GL_ARB_framebuffer_object", ARB_FRAMEBUFFER_OBJECT
},
123 {"GL_ARB_framebuffer_sRGB", ARB_FRAMEBUFFER_SRGB
},
124 {"GL_ARB_geometry_shader4", ARB_GEOMETRY_SHADER4
},
125 {"GL_ARB_half_float_pixel", ARB_HALF_FLOAT_PIXEL
},
126 {"GL_ARB_half_float_vertex", ARB_HALF_FLOAT_VERTEX
},
127 {"GL_ARB_instanced_arrays", ARB_INSTANCED_ARRAYS
},
128 {"GL_ARB_internalformat_query", ARB_INTERNALFORMAT_QUERY
},
129 {"GL_ARB_internalformat_query2", ARB_INTERNALFORMAT_QUERY2
},
130 {"GL_ARB_map_buffer_alignment", ARB_MAP_BUFFER_ALIGNMENT
},
131 {"GL_ARB_map_buffer_range", ARB_MAP_BUFFER_RANGE
},
132 {"GL_ARB_multisample", ARB_MULTISAMPLE
},
133 {"GL_ARB_multitexture", ARB_MULTITEXTURE
},
134 {"GL_ARB_occlusion_query", ARB_OCCLUSION_QUERY
},
135 {"GL_ARB_pixel_buffer_object", ARB_PIXEL_BUFFER_OBJECT
},
136 {"GL_ARB_point_parameters", ARB_POINT_PARAMETERS
},
137 {"GL_ARB_point_sprite", ARB_POINT_SPRITE
},
138 {"GL_ARB_provoking_vertex", ARB_PROVOKING_VERTEX
},
139 {"GL_ARB_sampler_objects", ARB_SAMPLER_OBJECTS
},
140 {"GL_ARB_shader_bit_encoding", ARB_SHADER_BIT_ENCODING
},
141 {"GL_ARB_shader_texture_lod", ARB_SHADER_TEXTURE_LOD
},
142 {"GL_ARB_shading_language_100", ARB_SHADING_LANGUAGE_100
},
143 {"GL_ARB_shadow", ARB_SHADOW
},
144 {"GL_ARB_sync", ARB_SYNC
},
145 {"GL_ARB_texture_border_clamp", ARB_TEXTURE_BORDER_CLAMP
},
146 {"GL_ARB_texture_compression", ARB_TEXTURE_COMPRESSION
},
147 {"GL_ARB_texture_compression_rgtc", ARB_TEXTURE_COMPRESSION_RGTC
},
148 {"GL_ARB_texture_cube_map", ARB_TEXTURE_CUBE_MAP
},
149 {"GL_ARB_texture_env_combine", ARB_TEXTURE_ENV_COMBINE
},
150 {"GL_ARB_texture_env_dot3", ARB_TEXTURE_ENV_DOT3
},
151 {"GL_ARB_texture_float", ARB_TEXTURE_FLOAT
},
152 {"GL_ARB_texture_mirrored_repeat", ARB_TEXTURE_MIRRORED_REPEAT
},
153 {"GL_ARB_texture_mirror_clamp_to_edge", ARB_TEXTURE_MIRROR_CLAMP_TO_EDGE
},
154 {"GL_ARB_texture_non_power_of_two", ARB_TEXTURE_NON_POWER_OF_TWO
},
155 {"GL_ARB_texture_query_levels", ARB_TEXTURE_QUERY_LEVELS
},
156 {"GL_ARB_texture_rectangle", ARB_TEXTURE_RECTANGLE
},
157 {"GL_ARB_texture_rg", ARB_TEXTURE_RG
},
158 {"GL_ARB_texture_rgb10_a2ui", ARB_TEXTURE_RGB10_A2UI
},
159 {"GL_ARB_texture_swizzle", ARB_TEXTURE_SWIZZLE
},
160 {"GL_ARB_timer_query", ARB_TIMER_QUERY
},
161 {"GL_ARB_uniform_buffer_object", ARB_UNIFORM_BUFFER_OBJECT
},
162 {"GL_ARB_vertex_array_bgra", ARB_VERTEX_ARRAY_BGRA
},
163 {"GL_ARB_vertex_blend", ARB_VERTEX_BLEND
},
164 {"GL_ARB_vertex_buffer_object", ARB_VERTEX_BUFFER_OBJECT
},
165 {"GL_ARB_vertex_program", ARB_VERTEX_PROGRAM
},
166 {"GL_ARB_vertex_shader", ARB_VERTEX_SHADER
},
169 {"GL_ATI_fragment_shader", ATI_FRAGMENT_SHADER
},
170 {"GL_ATI_separate_stencil", ATI_SEPARATE_STENCIL
},
171 {"GL_ATI_texture_compression_3dc", ATI_TEXTURE_COMPRESSION_3DC
},
172 {"GL_ATI_texture_env_combine3", ATI_TEXTURE_ENV_COMBINE3
},
173 {"GL_ATI_texture_mirror_once", ATI_TEXTURE_MIRROR_ONCE
},
176 {"GL_EXT_blend_color", EXT_BLEND_COLOR
},
177 {"GL_EXT_blend_equation_separate", EXT_BLEND_EQUATION_SEPARATE
},
178 {"GL_EXT_blend_func_separate", EXT_BLEND_FUNC_SEPARATE
},
179 {"GL_EXT_blend_minmax", EXT_BLEND_MINMAX
},
180 {"GL_EXT_blend_subtract", EXT_BLEND_SUBTRACT
},
181 {"GL_EXT_depth_bounds_test", EXT_DEPTH_BOUNDS_TEST
},
182 {"GL_EXT_draw_buffers2", EXT_DRAW_BUFFERS2
},
183 {"GL_EXT_fog_coord", EXT_FOG_COORD
},
184 {"GL_EXT_framebuffer_blit", EXT_FRAMEBUFFER_BLIT
},
185 {"GL_EXT_framebuffer_multisample", EXT_FRAMEBUFFER_MULTISAMPLE
},
186 {"GL_EXT_framebuffer_object", EXT_FRAMEBUFFER_OBJECT
},
187 {"GL_EXT_gpu_program_parameters", EXT_GPU_PROGRAM_PARAMETERS
},
188 {"GL_EXT_gpu_shader4", EXT_GPU_SHADER4
},
189 {"GL_EXT_packed_depth_stencil", EXT_PACKED_DEPTH_STENCIL
},
190 {"GL_EXT_packed_float", EXT_PACKED_FLOAT
},
191 {"GL_EXT_point_parameters", EXT_POINT_PARAMETERS
},
192 {"GL_EXT_provoking_vertex", EXT_PROVOKING_VERTEX
},
193 {"GL_EXT_secondary_color", EXT_SECONDARY_COLOR
},
194 {"GL_EXT_stencil_two_side", EXT_STENCIL_TWO_SIDE
},
195 {"GL_EXT_stencil_wrap", EXT_STENCIL_WRAP
},
196 {"GL_EXT_texture3D", EXT_TEXTURE3D
},
197 {"GL_EXT_texture_array", EXT_TEXTURE_ARRAY
},
198 {"GL_EXT_texture_compression_rgtc", EXT_TEXTURE_COMPRESSION_RGTC
},
199 {"GL_EXT_texture_compression_s3tc", EXT_TEXTURE_COMPRESSION_S3TC
},
200 {"GL_EXT_texture_env_combine", EXT_TEXTURE_ENV_COMBINE
},
201 {"GL_EXT_texture_env_dot3", EXT_TEXTURE_ENV_DOT3
},
202 {"GL_EXT_texture_filter_anisotropic", EXT_TEXTURE_FILTER_ANISOTROPIC
},
203 {"GL_EXT_texture_integer", EXT_TEXTURE_INTEGER
},
204 {"GL_EXT_texture_lod_bias", EXT_TEXTURE_LOD_BIAS
},
205 {"GL_EXT_texture_mirror_clamp", EXT_TEXTURE_MIRROR_CLAMP
},
206 {"GL_EXT_texture_snorm", EXT_TEXTURE_SNORM
},
207 {"GL_EXT_texture_sRGB", EXT_TEXTURE_SRGB
},
208 {"GL_EXT_texture_sRGB_decode", EXT_TEXTURE_SRGB_DECODE
},
209 {"GL_EXT_vertex_array_bgra", EXT_VERTEX_ARRAY_BGRA
},
212 {"GL_NV_fence", NV_FENCE
},
213 {"GL_NV_fog_distance", NV_FOG_DISTANCE
},
214 {"GL_NV_fragment_program", NV_FRAGMENT_PROGRAM
},
215 {"GL_NV_fragment_program2", NV_FRAGMENT_PROGRAM2
},
216 {"GL_NV_fragment_program_option", NV_FRAGMENT_PROGRAM_OPTION
},
217 {"GL_NV_half_float", NV_HALF_FLOAT
},
218 {"GL_NV_light_max_exponent", NV_LIGHT_MAX_EXPONENT
},
219 {"GL_NV_point_sprite", NV_POINT_SPRITE
},
220 {"GL_NV_register_combiners", NV_REGISTER_COMBINERS
},
221 {"GL_NV_register_combiners2", NV_REGISTER_COMBINERS2
},
222 {"GL_NV_texgen_reflection", NV_TEXGEN_REFLECTION
},
223 {"GL_NV_texture_env_combine4", NV_TEXTURE_ENV_COMBINE4
},
224 {"GL_NV_texture_shader", NV_TEXTURE_SHADER
},
225 {"GL_NV_texture_shader2", NV_TEXTURE_SHADER2
},
226 {"GL_NV_vertex_program", NV_VERTEX_PROGRAM
},
227 {"GL_NV_vertex_program1_1", NV_VERTEX_PROGRAM1_1
},
228 {"GL_NV_vertex_program2", NV_VERTEX_PROGRAM2
},
229 {"GL_NV_vertex_program2_option", NV_VERTEX_PROGRAM2_OPTION
},
230 {"GL_NV_vertex_program3", NV_VERTEX_PROGRAM3
},
233 {"GL_SGIS_generate_mipmap", SGIS_GENERATE_MIPMAP
},
236 static const struct wined3d_extension_map wgl_extension_map
[] =
238 {"WGL_ARB_pixel_format", WGL_ARB_PIXEL_FORMAT
},
239 {"WGL_EXT_swap_control", WGL_EXT_SWAP_CONTROL
},
240 {"WGL_WINE_pixel_format_passthrough", WGL_WINE_PIXEL_FORMAT_PASSTHROUGH
},
241 {"WGL_WINE_query_renderer", WGL_WINE_QUERY_RENDERER
},
244 /**********************************************************
245 * Utility functions follow
246 **********************************************************/
248 const struct min_lookup minMipLookup
[] =
250 /* NONE POINT LINEAR */
251 {{GL_NEAREST
, GL_NEAREST
, GL_NEAREST
}}, /* NONE */
252 {{GL_NEAREST
, GL_NEAREST_MIPMAP_NEAREST
, GL_NEAREST_MIPMAP_LINEAR
}}, /* POINT*/
253 {{GL_LINEAR
, GL_LINEAR_MIPMAP_NEAREST
, GL_LINEAR_MIPMAP_LINEAR
}}, /* LINEAR */
256 const GLenum magLookup
[] =
258 /* NONE POINT LINEAR */
259 GL_NEAREST
, GL_NEAREST
, GL_LINEAR
,
262 static void wined3d_caps_gl_ctx_destroy(const struct wined3d_caps_gl_ctx
*ctx
)
264 const struct wined3d_gl_info
*gl_info
= ctx
->gl_info
;
266 TRACE("Destroying caps GL context.\n");
268 /* Both glDeleteProgram and glDeleteBuffers silently ignore 0 IDs but
269 * this function might be called before the relevant function pointers
270 * in gl_info are initialized. */
271 if (ctx
->test_program_id
|| ctx
->test_vbo
)
273 GL_EXTCALL(glDeleteProgram(ctx
->test_program_id
));
274 GL_EXTCALL(glDeleteBuffers(1, &ctx
->test_vbo
));
277 if (!wglMakeCurrent(NULL
, NULL
))
278 ERR("Failed to disable caps GL context.\n");
280 if (!wglDeleteContext(ctx
->gl_ctx
))
282 DWORD err
= GetLastError();
283 ERR("wglDeleteContext(%p) failed, last error %#x.\n", ctx
->gl_ctx
, err
);
286 wined3d_release_dc(ctx
->wnd
, ctx
->dc
);
287 DestroyWindow(ctx
->wnd
);
289 if (ctx
->restore_gl_ctx
&& !wglMakeCurrent(ctx
->restore_dc
, ctx
->restore_gl_ctx
))
290 ERR("Failed to restore previous GL context.\n");
293 static BOOL
wined3d_caps_gl_ctx_create_attribs(struct wined3d_caps_gl_ctx
*caps_gl_ctx
,
294 struct wined3d_gl_info
*gl_info
)
298 if (!(gl_info
->p_wglCreateContextAttribsARB
= (void *)wglGetProcAddress("wglCreateContextAttribsARB")))
301 if (!(new_ctx
= context_create_wgl_attribs(gl_info
, caps_gl_ctx
->dc
, NULL
)))
303 gl_info
->p_wglCreateContextAttribsARB
= NULL
;
307 if (!wglMakeCurrent(caps_gl_ctx
->dc
, new_ctx
))
309 ERR("Failed to make new context current, last error %#x.\n", GetLastError());
310 if (!wglDeleteContext(new_ctx
))
311 ERR("Failed to delete new context, last error %#x.\n", GetLastError());
312 gl_info
->p_wglCreateContextAttribsARB
= NULL
;
316 if (!wglDeleteContext(caps_gl_ctx
->gl_ctx
))
317 ERR("Failed to delete old context, last error %#x.\n", GetLastError());
318 caps_gl_ctx
->gl_ctx
= new_ctx
;
323 static BOOL
wined3d_caps_gl_ctx_create(struct wined3d_adapter
*adapter
, struct wined3d_caps_gl_ctx
*ctx
)
325 PIXELFORMATDESCRIPTOR pfd
;
328 TRACE("getting context...\n");
330 ctx
->restore_dc
= wglGetCurrentDC();
331 ctx
->restore_gl_ctx
= wglGetCurrentContext();
333 /* We need a fake window as a hdc retrieved using GetDC(0) can't be used for much GL purposes. */
334 ctx
->wnd
= CreateWindowA(WINED3D_OPENGL_WINDOW_CLASS_NAME
, "WineD3D fake window",
335 WS_OVERLAPPEDWINDOW
, 10, 10, 10, 10, NULL
, NULL
, NULL
, NULL
);
338 ERR("Failed to create a window.\n");
342 ctx
->dc
= GetDC(ctx
->wnd
);
345 ERR("Failed to get a DC.\n");
349 /* PixelFormat selection */
350 ZeroMemory(&pfd
, sizeof(pfd
));
351 pfd
.nSize
= sizeof(pfd
);
353 pfd
.dwFlags
= PFD_SUPPORT_OPENGL
| PFD_DOUBLEBUFFER
| PFD_DRAW_TO_WINDOW
; /* PFD_GENERIC_ACCELERATED */
354 pfd
.iPixelType
= PFD_TYPE_RGBA
;
356 pfd
.iLayerType
= PFD_MAIN_PLANE
;
358 if (!(iPixelFormat
= ChoosePixelFormat(ctx
->dc
, &pfd
)))
360 /* If this happens something is very wrong as ChoosePixelFormat barely fails. */
361 ERR("Failed to find a suitable pixel format.\n");
364 DescribePixelFormat(ctx
->dc
, iPixelFormat
, sizeof(pfd
), &pfd
);
365 SetPixelFormat(ctx
->dc
, iPixelFormat
, &pfd
);
367 /* Create a GL context. */
368 if (!(ctx
->gl_ctx
= wglCreateContext(ctx
->dc
)))
370 WARN("Failed to create default context for capabilities initialization.\n");
374 /* Make it the current GL context. */
375 if (!wglMakeCurrent(ctx
->dc
, ctx
->gl_ctx
))
377 ERR("Failed to make caps GL context current.\n");
381 ctx
->gl_info
= &adapter
->gl_info
;
385 if (ctx
->gl_ctx
) wglDeleteContext(ctx
->gl_ctx
);
387 if (ctx
->dc
) ReleaseDC(ctx
->wnd
, ctx
->dc
);
389 if (ctx
->wnd
) DestroyWindow(ctx
->wnd
);
391 if (ctx
->restore_gl_ctx
&& !wglMakeCurrent(ctx
->restore_dc
, ctx
->restore_gl_ctx
))
392 ERR("Failed to restore previous GL context.\n");
397 /* Adjust the amount of used texture memory */
398 UINT64
adapter_adjust_memory(struct wined3d_adapter
*adapter
, INT64 amount
)
400 adapter
->vram_bytes_used
+= amount
;
401 TRACE("Adjusted used adapter memory by 0x%s to 0x%s.\n",
402 wine_dbgstr_longlong(amount
),
403 wine_dbgstr_longlong(adapter
->vram_bytes_used
));
404 return adapter
->vram_bytes_used
;
407 static void wined3d_adapter_cleanup(struct wined3d_adapter
*adapter
)
409 HeapFree(GetProcessHeap(), 0, adapter
->gl_info
.formats
);
410 HeapFree(GetProcessHeap(), 0, adapter
->cfgs
);
413 ULONG CDECL
wined3d_incref(struct wined3d
*wined3d
)
415 ULONG refcount
= InterlockedIncrement(&wined3d
->ref
);
417 TRACE("%p increasing refcount to %u.\n", wined3d
, refcount
);
422 ULONG CDECL
wined3d_decref(struct wined3d
*wined3d
)
424 ULONG refcount
= InterlockedDecrement(&wined3d
->ref
);
426 TRACE("%p decreasing refcount to %u.\n", wined3d
, refcount
);
432 for (i
= 0; i
< wined3d
->adapter_count
; ++i
)
434 wined3d_adapter_cleanup(&wined3d
->adapters
[i
]);
436 HeapFree(GetProcessHeap(), 0, wined3d
);
442 /* Context activation is done by the caller. */
443 static BOOL
test_arb_vs_offset_limit(const struct wined3d_gl_info
*gl_info
)
447 static const char testcode
[] =
449 "PARAM C[66] = { program.env[0..65] };\n"
451 "PARAM zero = {0.0, 0.0, 0.0, 0.0};\n"
452 "ARL A0.x, zero.x;\n"
453 "MOV result.position, C[A0.x + 65];\n"
456 while (gl_info
->gl_ops
.gl
.p_glGetError());
457 GL_EXTCALL(glGenProgramsARB(1, &prog
));
459 ERR("Failed to create an ARB offset limit test program\n");
461 GL_EXTCALL(glBindProgramARB(GL_VERTEX_PROGRAM_ARB
, prog
));
462 GL_EXTCALL(glProgramStringARB(GL_VERTEX_PROGRAM_ARB
, GL_PROGRAM_FORMAT_ASCII_ARB
,
463 strlen(testcode
), testcode
));
464 if (gl_info
->gl_ops
.gl
.p_glGetError())
466 TRACE("OpenGL implementation does not allow indirect addressing offsets > 63\n");
467 TRACE("error: %s\n", debugstr_a((const char *)gl_info
->gl_ops
.gl
.p_glGetString(GL_PROGRAM_ERROR_STRING_ARB
)));
469 } else TRACE("OpenGL implementation allows offsets > 63\n");
471 GL_EXTCALL(glBindProgramARB(GL_VERTEX_PROGRAM_ARB
, 0));
472 GL_EXTCALL(glDeleteProgramsARB(1, &prog
));
473 checkGLcall("ARB vp offset limit test cleanup");
478 static BOOL
match_amd_r300_to_500(const struct wined3d_gl_info
*gl_info
, const char *gl_renderer
,
479 enum wined3d_gl_vendor gl_vendor
, enum wined3d_pci_vendor card_vendor
, enum wined3d_pci_device device
)
481 if (card_vendor
!= HW_VENDOR_AMD
) return FALSE
;
482 if (device
== CARD_AMD_RADEON_9500
) return TRUE
;
483 if (device
== CARD_AMD_RADEON_X700
) return TRUE
;
484 if (device
== CARD_AMD_RADEON_X1600
) return TRUE
;
488 static BOOL
match_geforce5(const struct wined3d_gl_info
*gl_info
, const char *gl_renderer
,
489 enum wined3d_gl_vendor gl_vendor
, enum wined3d_pci_vendor card_vendor
, enum wined3d_pci_device device
)
491 if (card_vendor
== HW_VENDOR_NVIDIA
)
493 if (device
== CARD_NVIDIA_GEFORCEFX_5200
||
494 device
== CARD_NVIDIA_GEFORCEFX_5600
||
495 device
== CARD_NVIDIA_GEFORCEFX_5800
)
503 static BOOL
match_apple(const struct wined3d_gl_info
*gl_info
, const char *gl_renderer
,
504 enum wined3d_gl_vendor gl_vendor
, enum wined3d_pci_vendor card_vendor
, enum wined3d_pci_device device
)
506 /* MacOS has various specialities in the extensions it advertises. Some have to be loaded from
507 * the opengl 1.2+ core, while other extensions are advertised, but software emulated. So try to
508 * detect the Apple OpenGL implementation to apply some extension fixups afterwards.
510 * Detecting this isn't really easy. The vendor string doesn't mention Apple. Compile-time checks
511 * aren't sufficient either because a Linux binary may display on a macos X server via remote X11.
512 * So try to detect the GL implementation by looking at certain Apple extensions. Some extensions
513 * like client storage might be supported on other implementations too, but GL_APPLE_flush_render
514 * is specific to the Mac OS X window management, and GL_APPLE_ycbcr_422 is QuickTime specific. So
515 * the chance that other implementations support them is rather small since Win32 QuickTime uses
516 * DirectDraw, not OpenGL.
518 * This test has been moved into wined3d_guess_gl_vendor()
520 if (gl_vendor
== GL_VENDOR_APPLE
)
527 /* Context activation is done by the caller. */
528 static void test_pbo_functionality(struct wined3d_gl_info
*gl_info
)
530 /* Some OpenGL implementations, namely Apple's Geforce 8 driver, advertises PBOs,
531 * but glTexSubImage from a PBO fails miserably, with the first line repeated over
532 * all the texture. This function detects this bug by its symptom and disables PBOs
535 * The test uploads a 4x4 texture via the PBO in the "native" format GL_BGRA,
536 * GL_UNSIGNED_INT_8_8_8_8_REV. This format triggers the bug, and it is what we use
537 * for D3DFMT_A8R8G8B8. Then the texture is read back without any PBO and the data
538 * read back is compared to the original. If they are equal PBOs are assumed to work,
539 * otherwise the PBO extension is disabled. */
541 static const unsigned int pattern
[] =
543 0x00000000, 0x000000ff, 0x0000ff00, 0x40ff0000,
544 0x80ffffff, 0x40ffff00, 0x00ff00ff, 0x0000ffff,
545 0x00ffff00, 0x00ff00ff, 0x0000ffff, 0x000000ff,
546 0x80ff00ff, 0x0000ffff, 0x00ff00ff, 0x40ff00ff
548 unsigned int check
[sizeof(pattern
) / sizeof(pattern
[0])];
550 /* No PBO -> No point in testing them. */
551 if (!gl_info
->supported
[ARB_PIXEL_BUFFER_OBJECT
]) return;
553 while (gl_info
->gl_ops
.gl
.p_glGetError());
554 gl_info
->gl_ops
.gl
.p_glGenTextures(1, &texture
);
555 gl_info
->gl_ops
.gl
.p_glBindTexture(GL_TEXTURE_2D
, texture
);
557 gl_info
->gl_ops
.gl
.p_glTexParameteri(GL_TEXTURE_2D
, GL_TEXTURE_MAX_LEVEL
, 0);
558 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);
559 checkGLcall("Specifying the PBO test texture");
561 GL_EXTCALL(glGenBuffers(1, &pbo
));
562 GL_EXTCALL(glBindBuffer(GL_PIXEL_UNPACK_BUFFER
, pbo
));
563 GL_EXTCALL(glBufferData(GL_PIXEL_UNPACK_BUFFER
, sizeof(pattern
), pattern
, GL_STREAM_DRAW
));
564 checkGLcall("Specifying the PBO test pbo");
566 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
);
567 checkGLcall("Loading the PBO test texture");
569 GL_EXTCALL(glBindBuffer(GL_PIXEL_UNPACK_BUFFER
, 0));
571 gl_info
->gl_ops
.gl
.p_glFinish(); /* just to be sure */
573 memset(check
, 0, sizeof(check
));
574 gl_info
->gl_ops
.gl
.p_glGetTexImage(GL_TEXTURE_2D
, 0, GL_BGRA
, GL_UNSIGNED_INT_8_8_8_8_REV
, check
);
575 checkGLcall("Reading back the PBO test texture");
577 gl_info
->gl_ops
.gl
.p_glDeleteTextures(1, &texture
);
578 GL_EXTCALL(glDeleteBuffers(1, &pbo
));
579 checkGLcall("PBO test cleanup");
581 if (memcmp(check
, pattern
, sizeof(check
)))
583 WARN_(d3d_perf
)("PBO test failed, read back data doesn't match original.\n"
584 "Disabling PBOs. This may result in slower performance.\n");
585 gl_info
->supported
[ARB_PIXEL_BUFFER_OBJECT
] = FALSE
;
589 TRACE("PBO test successful.\n");
593 static BOOL
match_apple_intel(const struct wined3d_gl_info
*gl_info
, const char *gl_renderer
,
594 enum wined3d_gl_vendor gl_vendor
, enum wined3d_pci_vendor card_vendor
, enum wined3d_pci_device device
)
596 return (card_vendor
== HW_VENDOR_INTEL
) && (gl_vendor
== GL_VENDOR_APPLE
);
599 static BOOL
match_apple_nonr500ati(const struct wined3d_gl_info
*gl_info
, const char *gl_renderer
,
600 enum wined3d_gl_vendor gl_vendor
, enum wined3d_pci_vendor card_vendor
, enum wined3d_pci_device device
)
602 if (gl_vendor
!= GL_VENDOR_APPLE
) return FALSE
;
603 if (card_vendor
!= HW_VENDOR_AMD
) return FALSE
;
604 if (device
== CARD_AMD_RADEON_X1600
) return FALSE
;
608 static BOOL
match_dx10_capable(const struct wined3d_gl_info
*gl_info
, const char *gl_renderer
,
609 enum wined3d_gl_vendor gl_vendor
, enum wined3d_pci_vendor card_vendor
, enum wined3d_pci_device device
)
611 /* DX9 cards support 40 single float varyings in hardware, most drivers report 32. ATI misreports
612 * 44 varyings. So assume that if we have more than 44 varyings we have a dx10 card.
613 * This detection is for the gl_ClipPos varying quirk. If a d3d9 card really supports more than 44
614 * varyings and we subtract one in dx9 shaders it's not going to hurt us because the dx9 limit is
617 * dx10 cards usually have 64 varyings */
618 return gl_info
->limits
.glsl_varyings
> 44;
621 static BOOL
match_not_dx10_capable(const struct wined3d_gl_info
*gl_info
, const char *gl_renderer
,
622 enum wined3d_gl_vendor gl_vendor
, enum wined3d_pci_vendor card_vendor
, enum wined3d_pci_device device
)
624 return !match_dx10_capable(gl_info
, gl_renderer
, gl_vendor
, card_vendor
, device
);
627 /* A GL context is provided by the caller */
628 static BOOL
match_allows_spec_alpha(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
)
634 if (!gl_info
->supported
[EXT_SECONDARY_COLOR
])
637 while (gl_info
->gl_ops
.gl
.p_glGetError());
638 GL_EXTCALL(glSecondaryColorPointerEXT
)(4, GL_UNSIGNED_BYTE
, 4, data
);
639 error
= gl_info
->gl_ops
.gl
.p_glGetError();
641 if (error
== GL_NO_ERROR
)
643 TRACE("GL Implementation accepts 4 component specular color pointers\n");
648 TRACE("GL implementation does not accept 4 component specular colors, error %s\n",
649 debug_glerror(error
));
654 /* A GL context is provided by the caller */
655 static BOOL
match_broken_nv_clip(const struct wined3d_gl_info
*gl_info
, const char *gl_renderer
,
656 enum wined3d_gl_vendor gl_vendor
, enum wined3d_pci_vendor card_vendor
, enum wined3d_pci_device device
)
661 static const char testcode
[] =
663 "OPTION NV_vertex_program2;\n"
664 "MOV result.clip[0], 0.0;\n"
665 "MOV result.position, 0.0;\n"
668 if (!gl_info
->supported
[NV_VERTEX_PROGRAM2_OPTION
]) return FALSE
;
670 while (gl_info
->gl_ops
.gl
.p_glGetError());
672 GL_EXTCALL(glGenProgramsARB(1, &prog
));
675 ERR("Failed to create the NVvp clip test program\n");
678 GL_EXTCALL(glBindProgramARB(GL_VERTEX_PROGRAM_ARB
, prog
));
679 GL_EXTCALL(glProgramStringARB(GL_VERTEX_PROGRAM_ARB
, GL_PROGRAM_FORMAT_ASCII_ARB
,
680 strlen(testcode
), testcode
));
681 gl_info
->gl_ops
.gl
.p_glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB
, &pos
);
684 WARN("GL_NV_vertex_program2_option result.clip[] test failed\n");
685 TRACE("error: %s\n", debugstr_a((const char *)gl_info
->gl_ops
.gl
.p_glGetString(GL_PROGRAM_ERROR_STRING_ARB
)));
687 while (gl_info
->gl_ops
.gl
.p_glGetError());
689 else TRACE("GL_NV_vertex_program2_option result.clip[] test passed\n");
691 GL_EXTCALL(glBindProgramARB(GL_VERTEX_PROGRAM_ARB
, 0));
692 GL_EXTCALL(glDeleteProgramsARB(1, &prog
));
693 checkGLcall("GL_NV_vertex_program2_option result.clip[] test cleanup");
698 /* Context activation is done by the caller. */
699 static BOOL
match_fbo_tex_update(const struct wined3d_gl_info
*gl_info
, const char *gl_renderer
,
700 enum wined3d_gl_vendor gl_vendor
, enum wined3d_pci_vendor card_vendor
, enum wined3d_pci_device device
)
702 char data
[4 * 4 * 4];
706 if (wined3d_settings
.offscreen_rendering_mode
!= ORM_FBO
) return FALSE
;
708 memset(data
, 0xcc, sizeof(data
));
710 gl_info
->gl_ops
.gl
.p_glGenTextures(1, &tex
);
711 gl_info
->gl_ops
.gl
.p_glBindTexture(GL_TEXTURE_2D
, tex
);
712 gl_info
->gl_ops
.gl
.p_glTexParameteri(GL_TEXTURE_2D
, GL_TEXTURE_MIN_FILTER
, GL_NEAREST
);
713 gl_info
->gl_ops
.gl
.p_glTexParameteri(GL_TEXTURE_2D
, GL_TEXTURE_MAG_FILTER
, GL_NEAREST
);
714 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
);
715 checkGLcall("glTexImage2D");
717 gl_info
->fbo_ops
.glGenFramebuffers(1, &fbo
);
718 gl_info
->fbo_ops
.glBindFramebuffer(GL_FRAMEBUFFER
, fbo
);
719 gl_info
->fbo_ops
.glFramebufferTexture2D(GL_FRAMEBUFFER
, GL_COLOR_ATTACHMENT0
, GL_TEXTURE_2D
, tex
, 0);
720 checkGLcall("glFramebufferTexture2D");
722 status
= gl_info
->fbo_ops
.glCheckFramebufferStatus(GL_FRAMEBUFFER
);
723 if (status
!= GL_FRAMEBUFFER_COMPLETE
) ERR("FBO status %#x\n", status
);
724 checkGLcall("glCheckFramebufferStatus");
726 memset(data
, 0x11, sizeof(data
));
727 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
);
728 checkGLcall("glTexSubImage2D");
730 gl_info
->gl_ops
.gl
.p_glClearColor(0.996f
, 0.729f
, 0.745f
, 0.792f
);
731 gl_info
->gl_ops
.gl
.p_glClear(GL_COLOR_BUFFER_BIT
);
732 checkGLcall("glClear");
734 gl_info
->gl_ops
.gl
.p_glGetTexImage(GL_TEXTURE_2D
, 0, GL_BGRA
, GL_UNSIGNED_INT_8_8_8_8_REV
, data
);
735 checkGLcall("glGetTexImage");
737 gl_info
->fbo_ops
.glFramebufferTexture2D(GL_FRAMEBUFFER
, GL_COLOR_ATTACHMENT0
, GL_TEXTURE_2D
, 0, 0);
738 gl_info
->fbo_ops
.glBindFramebuffer(GL_FRAMEBUFFER
, 0);
739 gl_info
->gl_ops
.gl
.p_glBindTexture(GL_TEXTURE_2D
, 0);
740 checkGLcall("glBindTexture");
742 gl_info
->fbo_ops
.glDeleteFramebuffers(1, &fbo
);
743 gl_info
->gl_ops
.gl
.p_glDeleteTextures(1, &tex
);
744 checkGLcall("glDeleteTextures");
746 return *(DWORD
*)data
== 0x11111111;
749 /* Context activation is done by the caller. */
750 static BOOL
match_broken_rgba16(const struct wined3d_gl_info
*gl_info
, const char *gl_renderer
,
751 enum wined3d_gl_vendor gl_vendor
, enum wined3d_pci_vendor card_vendor
, enum wined3d_pci_device device
)
753 /* GL_RGBA16 uses GL_RGBA8 internally on Geforce 7 and older cards.
754 * This leads to graphical bugs in Half Life 2 and Unreal engine games. */
758 gl_info
->gl_ops
.gl
.p_glGenTextures(1, &tex
);
759 gl_info
->gl_ops
.gl
.p_glBindTexture(GL_TEXTURE_2D
, tex
);
760 gl_info
->gl_ops
.gl
.p_glTexImage2D(GL_TEXTURE_2D
, 0, GL_RGBA16
, 4, 4, 0, GL_RGBA
, GL_UNSIGNED_SHORT
, NULL
);
761 checkGLcall("glTexImage2D");
763 gl_info
->gl_ops
.gl
.p_glGetTexLevelParameteriv(GL_TEXTURE_2D
, 0, GL_TEXTURE_RED_SIZE
, &size
);
764 checkGLcall("glGetTexLevelParameteriv");
765 TRACE("Real color depth is %d\n", size
);
767 gl_info
->gl_ops
.gl
.p_glBindTexture(GL_TEXTURE_2D
, 0);
768 checkGLcall("glBindTexture");
769 gl_info
->gl_ops
.gl
.p_glDeleteTextures(1, &tex
);
770 checkGLcall("glDeleteTextures");
775 static BOOL
match_fglrx(const struct wined3d_gl_info
*gl_info
, const char *gl_renderer
,
776 enum wined3d_gl_vendor gl_vendor
, enum wined3d_pci_vendor card_vendor
, enum wined3d_pci_device device
)
778 return gl_vendor
== GL_VENDOR_FGLRX
;
781 static BOOL
match_r200(const struct wined3d_gl_info
*gl_info
, const char *gl_renderer
,
782 enum wined3d_gl_vendor gl_vendor
, enum wined3d_pci_vendor card_vendor
, enum wined3d_pci_device device
)
784 if (card_vendor
!= HW_VENDOR_AMD
) return FALSE
;
785 if (device
== CARD_AMD_RADEON_8500
) return TRUE
;
789 static BOOL
match_broken_arb_fog(const struct wined3d_gl_info
*gl_info
, const char *gl_renderer
,
790 enum wined3d_gl_vendor gl_vendor
, enum wined3d_pci_vendor card_vendor
, enum wined3d_pci_device device
)
795 float color
[4] = {0.0f
, 1.0f
, 0.0f
, 0.0f
};
798 static const char program_code
[] =
800 "OPTION ARB_fog_linear;\n"
801 "MOV result.color, {1.0, 0.0, 0.0, 0.0};\n"
804 if (wined3d_settings
.offscreen_rendering_mode
!= ORM_FBO
)
806 if (!gl_info
->supported
[ARB_FRAGMENT_PROGRAM
])
809 gl_info
->gl_ops
.gl
.p_glGenTextures(1, &tex
);
810 gl_info
->gl_ops
.gl
.p_glBindTexture(GL_TEXTURE_2D
, tex
);
811 gl_info
->gl_ops
.gl
.p_glTexParameteri(GL_TEXTURE_2D
, GL_TEXTURE_MIN_FILTER
, GL_NEAREST
);
812 gl_info
->gl_ops
.gl
.p_glTexParameteri(GL_TEXTURE_2D
, GL_TEXTURE_MAG_FILTER
, GL_NEAREST
);
813 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
);
814 checkGLcall("glTexImage2D");
816 gl_info
->fbo_ops
.glGenFramebuffers(1, &fbo
);
817 gl_info
->fbo_ops
.glBindFramebuffer(GL_FRAMEBUFFER
, fbo
);
818 gl_info
->fbo_ops
.glFramebufferTexture2D(GL_FRAMEBUFFER
, GL_COLOR_ATTACHMENT0
, GL_TEXTURE_2D
, tex
, 0);
819 checkGLcall("glFramebufferTexture2D");
821 status
= gl_info
->fbo_ops
.glCheckFramebufferStatus(GL_FRAMEBUFFER
);
822 if (status
!= GL_FRAMEBUFFER_COMPLETE
) ERR("FBO status %#x\n", status
);
823 checkGLcall("glCheckFramebufferStatus");
825 gl_info
->gl_ops
.gl
.p_glClearColor(0.0f
, 0.0f
, 1.0f
, 0.0f
);
826 gl_info
->gl_ops
.gl
.p_glClear(GL_COLOR_BUFFER_BIT
);
827 checkGLcall("glClear");
828 gl_info
->gl_ops
.gl
.p_glViewport(0, 0, 4, 1);
829 checkGLcall("glViewport");
831 gl_info
->gl_ops
.gl
.p_glEnable(GL_FOG
);
832 gl_info
->gl_ops
.gl
.p_glFogf(GL_FOG_START
, 0.5f
);
833 gl_info
->gl_ops
.gl
.p_glFogf(GL_FOG_END
, 0.5f
);
834 gl_info
->gl_ops
.gl
.p_glFogi(GL_FOG_MODE
, GL_LINEAR
);
835 gl_info
->gl_ops
.gl
.p_glHint(GL_FOG_HINT
, GL_NICEST
);
836 gl_info
->gl_ops
.gl
.p_glFogfv(GL_FOG_COLOR
, color
);
837 checkGLcall("fog setup");
839 GL_EXTCALL(glGenProgramsARB(1, &prog
));
840 GL_EXTCALL(glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB
, prog
));
841 GL_EXTCALL(glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB
, GL_PROGRAM_FORMAT_ASCII_ARB
,
842 strlen(program_code
), program_code
));
843 gl_info
->gl_ops
.gl
.p_glEnable(GL_FRAGMENT_PROGRAM_ARB
);
844 checkGLcall("Test fragment program setup");
846 gl_info
->gl_ops
.gl
.p_glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB
, &err_pos
);
849 const char *error_str
;
850 error_str
= (const char *)gl_info
->gl_ops
.gl
.p_glGetString(GL_PROGRAM_ERROR_STRING_ARB
);
851 FIXME("Fog test program error at position %d: %s\n\n", err_pos
, debugstr_a(error_str
));
854 gl_info
->gl_ops
.gl
.p_glBegin(GL_TRIANGLE_STRIP
);
855 gl_info
->gl_ops
.gl
.p_glVertex3f(-1.0f
, -1.0f
, 0.0f
);
856 gl_info
->gl_ops
.gl
.p_glVertex3f( 1.0f
, -1.0f
, 1.0f
);
857 gl_info
->gl_ops
.gl
.p_glVertex3f(-1.0f
, 1.0f
, 0.0f
);
858 gl_info
->gl_ops
.gl
.p_glVertex3f( 1.0f
, 1.0f
, 1.0f
);
859 gl_info
->gl_ops
.gl
.p_glEnd();
860 checkGLcall("ARBfp fog test draw");
862 gl_info
->gl_ops
.gl
.p_glGetTexImage(GL_TEXTURE_2D
, 0, GL_BGRA
, GL_UNSIGNED_INT_8_8_8_8_REV
, data
);
863 checkGLcall("glGetTexImage");
864 data
[0] &= 0x00ffffff;
865 data
[1] &= 0x00ffffff;
866 data
[2] &= 0x00ffffff;
867 data
[3] &= 0x00ffffff;
869 gl_info
->fbo_ops
.glBindFramebuffer(GL_FRAMEBUFFER
, 0);
870 gl_info
->gl_ops
.gl
.p_glBindTexture(GL_TEXTURE_2D
, 0);
872 gl_info
->fbo_ops
.glDeleteFramebuffers(1, &fbo
);
873 gl_info
->gl_ops
.gl
.p_glDeleteTextures(1, &tex
);
874 gl_info
->gl_ops
.gl
.p_glDisable(GL_FOG
);
875 GL_EXTCALL(glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB
, 0));
876 gl_info
->gl_ops
.gl
.p_glDisable(GL_FRAGMENT_PROGRAM_ARB
);
877 GL_EXTCALL(glDeleteProgramsARB(1, &prog
));
878 checkGLcall("ARBfp fog test teardown");
880 TRACE("Fog test data: %08x %08x %08x %08x\n", data
[0], data
[1], data
[2], data
[3]);
881 return data
[0] != 0x00ff0000 || data
[3] != 0x0000ff00;
884 static void quirk_apple_glsl_constants(struct wined3d_gl_info
*gl_info
)
886 /* MacOS needs uniforms for relative addressing offsets. This can accumulate to quite a few uniforms.
887 * Beyond that the general uniform isn't optimal, so reserve a number of uniforms. 12 vec4's should
888 * allow 48 different offsets or other helper immediate values. */
889 TRACE("Reserving 12 GLSL constants for compiler private use.\n");
890 gl_info
->reserved_glsl_constants
= max(gl_info
->reserved_glsl_constants
, 12);
893 static void quirk_amd_dx9(struct wined3d_gl_info
*gl_info
)
895 /* MacOS advertises GL_ARB_texture_non_power_of_two on ATI r500 and earlier cards, although
896 * these cards only support GL_ARB_texture_rectangle(D3DPTEXTURECAPS_NONPOW2CONDITIONAL).
897 * If real NP2 textures are used, the driver falls back to software. We could just remove the
898 * extension and use GL_ARB_texture_rectangle instead, but texture_rectangle is inconvenient
899 * due to the non-normalized texture coordinates. Thus set an internal extension flag,
900 * GL_WINE_normalized_texrect, which signals the code that it can use non power of two textures
901 * as per GL_ARB_texture_non_power_of_two, but has to stick to the texture_rectangle limits.
903 * fglrx doesn't advertise GL_ARB_texture_non_power_of_two, but it advertises opengl 2.0 which
904 * has this extension promoted to core. The extension loading code sets this extension supported
905 * due to that, so this code works on fglrx as well. */
906 if(gl_info
->supported
[ARB_TEXTURE_NON_POWER_OF_TWO
])
908 TRACE("GL_ARB_texture_non_power_of_two advertised on R500 or earlier card, removing.\n");
909 gl_info
->supported
[ARB_TEXTURE_NON_POWER_OF_TWO
] = FALSE
;
910 gl_info
->supported
[WINED3D_GL_NORMALIZED_TEXRECT
] = TRUE
;
914 static void quirk_no_np2(struct wined3d_gl_info
*gl_info
)
916 /* The nVidia GeForceFX series reports OpenGL 2.0 capabilities with the latest drivers versions, but
917 * doesn't explicitly advertise the ARB_tex_npot extension in the GL extension string.
918 * This usually means that ARB_tex_npot is supported in hardware as long as the application is staying
919 * within the limits enforced by the ARB_texture_rectangle extension. This however is not true for the
920 * FX series, which instantly falls back to a slower software path as soon as ARB_tex_npot is used.
921 * We therefore completely remove ARB_tex_npot from the list of supported extensions.
923 * Note that wine_normalized_texrect can't be used in this case because internally it uses ARB_tex_npot,
924 * triggering the software fallback. There is not much we can do here apart from disabling the
925 * software-emulated extension and re-enable ARB_tex_rect (which was previously disabled
926 * in wined3d_adapter_init_gl_caps).
927 * This fixup removes performance problems on both the FX 5900 and FX 5700 (e.g. for framebuffer
928 * post-processing effects in the game "Max Payne 2").
929 * The behaviour can be verified through a simple test app attached in bugreport #14724. */
930 TRACE("GL_ARB_texture_non_power_of_two advertised through OpenGL 2.0 on NV FX card, removing.\n");
931 gl_info
->supported
[ARB_TEXTURE_NON_POWER_OF_TWO
] = FALSE
;
932 gl_info
->supported
[ARB_TEXTURE_RECTANGLE
] = TRUE
;
935 static void quirk_texcoord_w(struct wined3d_gl_info
*gl_info
)
937 /* The Intel GPUs on MacOS set the .w register of texcoords to 0.0 by default, which causes problems
938 * with fixed function fragment processing. Ideally this flag should be detected with a test shader
939 * and OpenGL feedback mode, but some GL implementations (MacOS ATI at least, probably all MacOS ones)
940 * do not like vertex shaders in feedback mode and return an error, even though it should be valid
941 * according to the spec.
943 * We don't want to enable this on all cards, as it adds an extra instruction per texcoord used. This
944 * makes the shader slower and eats instruction slots which should be available to the d3d app.
946 * ATI Radeon HD 2xxx cards on MacOS have the issue. Instead of checking for the buggy cards, blacklist
947 * all radeon cards on Macs and whitelist the good ones. That way we're prepared for the future. If
948 * this workaround is activated on cards that do not need it, it won't break things, just affect
949 * performance negatively. */
950 TRACE("Enabling vertex texture coord fixes in vertex shaders.\n");
951 gl_info
->quirks
|= WINED3D_QUIRK_SET_TEXCOORD_W
;
954 static void quirk_clip_varying(struct wined3d_gl_info
*gl_info
)
956 gl_info
->quirks
|= WINED3D_QUIRK_GLSL_CLIP_VARYING
;
959 static void quirk_allows_specular_alpha(struct wined3d_gl_info
*gl_info
)
961 gl_info
->quirks
|= WINED3D_QUIRK_ALLOWS_SPECULAR_ALPHA
;
964 static void quirk_disable_nvvp_clip(struct wined3d_gl_info
*gl_info
)
966 gl_info
->quirks
|= WINED3D_QUIRK_NV_CLIP_BROKEN
;
969 static void quirk_fbo_tex_update(struct wined3d_gl_info
*gl_info
)
971 gl_info
->quirks
|= WINED3D_QUIRK_FBO_TEX_UPDATE
;
974 static void quirk_broken_rgba16(struct wined3d_gl_info
*gl_info
)
976 gl_info
->quirks
|= WINED3D_QUIRK_BROKEN_RGBA16
;
979 static void quirk_infolog_spam(struct wined3d_gl_info
*gl_info
)
981 gl_info
->quirks
|= WINED3D_QUIRK_INFO_LOG_SPAM
;
984 static void quirk_limited_tex_filtering(struct wined3d_gl_info
*gl_info
)
986 /* Nvidia GeForce 6xxx and 7xxx support accelerated VTF only on a few
987 selected texture formats. They are apparently the only DX9 class GPUs
989 Also, DX9-era GPUs are somewhat limited with float textures
990 filtering and blending. */
991 gl_info
->quirks
|= WINED3D_QUIRK_LIMITED_TEX_FILTERING
;
994 static void quirk_r200_constants(struct wined3d_gl_info
*gl_info
)
996 /* The Mesa r200 driver (and there is no other driver for this GPU Wine would run on)
997 * loads some fog parameters (start, end, exponent, but not the color) into the
1000 * Apparently the fog hardware is only able to handle linear fog with a range of 0.0;1.0,
1001 * and it is the responsibility of the vertex pipeline to handle non-linear fog and
1002 * linear fog with start and end other than 0.0 and 1.0. */
1003 TRACE("Reserving 1 ARB constant for compiler private use.\n");
1004 gl_info
->reserved_arb_constants
= max(gl_info
->reserved_arb_constants
, 1);
1007 static void quirk_broken_arb_fog(struct wined3d_gl_info
*gl_info
)
1009 gl_info
->quirks
|= WINED3D_QUIRK_BROKEN_ARB_FOG
;
1014 BOOL (*match
)(const struct wined3d_gl_info
*gl_info
, const char *gl_renderer
,
1015 enum wined3d_gl_vendor gl_vendor
, enum wined3d_pci_vendor card_vendor
, enum wined3d_pci_device device
);
1016 void (*apply
)(struct wined3d_gl_info
*gl_info
);
1017 const char *description
;
1020 static const struct driver_quirk quirk_table
[] =
1023 match_amd_r300_to_500
,
1025 "AMD normalized texrect quirk"
1029 quirk_apple_glsl_constants
,
1030 "Apple GLSL uniform override"
1035 "Geforce 5 NP2 disable"
1040 "Init texcoord .w for Apple Intel GPU driver"
1043 match_apple_nonr500ati
,
1045 "Init texcoord .w for Apple ATI >= r600 GPU driver"
1050 "Reserved varying for gl_ClipPos"
1053 /* GL_EXT_secondary_color does not allow 4 component secondary colors, but most
1054 * GL implementations accept it. The Mac GL is the only implementation known to
1057 * If we can pass 4 component specular colors, do it, because (a) we don't have
1058 * to screw around with the data, and (b) the D3D fixed function vertex pipeline
1059 * passes specular alpha to the pixel shader if any is used. Otherwise the
1060 * specular alpha is used to pass the fog coordinate, which we pass to opengl
1061 * via GL_EXT_fog_coord.
1063 match_allows_spec_alpha
,
1064 quirk_allows_specular_alpha
,
1065 "Allow specular alpha quirk"
1068 match_broken_nv_clip
,
1069 quirk_disable_nvvp_clip
,
1070 "Apple NV_vertex_program clip bug quirk"
1073 match_fbo_tex_update
,
1074 quirk_fbo_tex_update
,
1075 "FBO rebind for attachment updates"
1078 match_broken_rgba16
,
1079 quirk_broken_rgba16
,
1080 "True RGBA16 is not available"
1085 "Not printing GLSL infolog"
1088 match_not_dx10_capable
,
1089 quirk_limited_tex_filtering
,
1090 "Texture filtering, blending and VTF support is limited"
1094 quirk_r200_constants
,
1095 "r200 vertex shader constants"
1098 match_broken_arb_fog
,
1099 quirk_broken_arb_fog
,
1100 "ARBfp fogstart == fogend workaround"
1104 /* Certain applications (Steam) complain if we report an outdated driver version. In general,
1105 * reporting a driver version is moot because we are not the Windows driver, and we have different
1106 * bugs, features, etc.
1108 * The driver version has the form "x.y.z.w".
1110 * "x" is the Windows version the driver is meant for:
1117 * "y" is the maximum Direct3D version the driver supports.
1118 * y -> d3d version mapping:
1127 * "z" is the subversion number.
1129 * "w" is the vendor specific driver build number.
1132 struct driver_version_information
1134 enum wined3d_display_driver driver
;
1135 enum wined3d_driver_model driver_model
;
1136 const char *driver_name
; /* name of Windows driver */
1137 WORD version
; /* version word ('y'), contained in low word of DriverVersion.HighPart */
1138 WORD subversion
; /* subversion word ('z'), contained in high word of DriverVersion.LowPart */
1139 WORD build
; /* build number ('w'), contained in low word of DriverVersion.LowPart */
1142 /* The driver version table contains driver information for different devices on several OS versions. */
1143 static const struct driver_version_information driver_version_table
[] =
1146 * - Radeon HD2x00 (R600) and up supported by current drivers.
1147 * - Radeon 9500 (R300) - X1*00 (R5xx) supported up to Catalyst 9.3 (Linux) and 10.2 (XP/Vista/Win7)
1148 * - Radeon 7xxx (R100) - 9250 (RV250) supported up to Catalyst 6.11 (XP)
1149 * - Rage 128 supported up to XP, latest official build 6.13.3279 dated October 2001 */
1150 {DRIVER_AMD_RAGE_128PRO
, DRIVER_MODEL_NT5X
, "ati2dvaa.dll", 13, 3279, 0},
1151 {DRIVER_AMD_R100
, DRIVER_MODEL_NT5X
, "ati2dvag.dll", 14, 10, 6614},
1152 {DRIVER_AMD_R300
, DRIVER_MODEL_NT5X
, "ati2dvag.dll", 14, 10, 6764},
1153 {DRIVER_AMD_R600
, DRIVER_MODEL_NT5X
, "ati2dvag.dll", 17, 10, 1280},
1154 {DRIVER_AMD_R300
, DRIVER_MODEL_NT6X
, "atiumdag.dll", 14, 10, 741 },
1155 {DRIVER_AMD_R600
, DRIVER_MODEL_NT6X
, "atiumdag.dll", 17, 10, 1280},
1158 * The drivers are unified but not all versions support all GPUs. At some point the 2k/xp
1159 * drivers used ialmrnt5.dll for GMA800/GMA900 but at some point the file was renamed to
1160 * igxprd32.dll but the GMA800 driver was never updated. */
1161 {DRIVER_INTEL_GMA800
, DRIVER_MODEL_NT5X
, "ialmrnt5.dll", 14, 10, 3889},
1162 {DRIVER_INTEL_GMA900
, DRIVER_MODEL_NT5X
, "igxprd32.dll", 14, 10, 4764},
1163 {DRIVER_INTEL_GMA950
, DRIVER_MODEL_NT5X
, "igxprd32.dll", 14, 10, 4926},
1164 {DRIVER_INTEL_GMA3000
, DRIVER_MODEL_NT5X
, "igxprd32.dll", 14, 10, 5218},
1165 {DRIVER_INTEL_GMA950
, DRIVER_MODEL_NT6X
, "igdumd32.dll", 14, 10, 1504},
1166 {DRIVER_INTEL_GMA3000
, DRIVER_MODEL_NT6X
, "igdumd32.dll", 15, 10, 1666},
1169 * - Geforce8 and newer is supported by the current 340.52 driver on XP-Win8
1170 * - Geforce6 and 7 support is up to 307.83 on XP-Win8
1171 * - GeforceFX support is up to 173.x on <= XP
1172 * - Geforce2MX/3/4 up to 96.x on <= XP
1173 * - TNT/Geforce1/2 up to 71.x on <= XP
1174 * All version numbers used below are from the Linux nvidia drivers. */
1175 {DRIVER_NVIDIA_TNT
, DRIVER_MODEL_NT5X
, "nv4_disp.dll", 14, 10, 7186},
1176 {DRIVER_NVIDIA_GEFORCE2MX
, DRIVER_MODEL_NT5X
, "nv4_disp.dll", 14, 10, 9371},
1177 {DRIVER_NVIDIA_GEFORCEFX
, DRIVER_MODEL_NT5X
, "nv4_disp.dll", 14, 11, 7516},
1178 {DRIVER_NVIDIA_GEFORCE6
, DRIVER_MODEL_NT5X
, "nv4_disp.dll", 18, 13, 783},
1179 {DRIVER_NVIDIA_GEFORCE8
, DRIVER_MODEL_NT5X
, "nv4_disp.dll", 18, 13, 4052},
1180 {DRIVER_NVIDIA_GEFORCE6
, DRIVER_MODEL_NT6X
, "nvd3dum.dll", 18, 13, 783},
1181 {DRIVER_NVIDIA_GEFORCE8
, DRIVER_MODEL_NT6X
, "nvd3dum.dll", 18, 13, 4052},
1184 {DRIVER_VMWARE
, DRIVER_MODEL_NT5X
, "vm3dum.dll", 14, 1, 1134},
1187 struct gpu_description
1189 WORD vendor
; /* reported PCI card vendor ID */
1190 WORD card
; /* reported PCI card device ID */
1191 const char *description
; /* Description of the card e.g. NVIDIA RIVA TNT */
1192 enum wined3d_display_driver driver
;
1193 unsigned int vidmem
;
1196 /* The amount of video memory stored in the gpu description table is the minimum amount of video memory
1197 * found on a board containing a specific GPU. */
1198 static const struct gpu_description gpu_description_table
[] =
1201 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_RIVA_128
, "NVIDIA RIVA 128", DRIVER_NVIDIA_TNT
, 4 },
1202 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_RIVA_TNT
, "NVIDIA RIVA TNT", DRIVER_NVIDIA_TNT
, 16 },
1203 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_RIVA_TNT2
, "NVIDIA RIVA TNT2/TNT2 Pro", DRIVER_NVIDIA_TNT
, 32 },
1204 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE
, "NVIDIA GeForce 256", DRIVER_NVIDIA_TNT
, 32 },
1205 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE2
, "NVIDIA GeForce2 GTS/GeForce2 Pro", DRIVER_NVIDIA_TNT
, 32 },
1206 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE2_MX
, "NVIDIA GeForce2 MX/MX 400", DRIVER_NVIDIA_GEFORCE2MX
,32 },
1207 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE3
, "NVIDIA GeForce3", DRIVER_NVIDIA_GEFORCE2MX
,64 },
1208 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE4_MX
, "NVIDIA GeForce4 MX 460", DRIVER_NVIDIA_GEFORCE2MX
,64 },
1209 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE4_TI4200
, "NVIDIA GeForce4 Ti 4200", DRIVER_NVIDIA_GEFORCE2MX
,64, },
1210 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCEFX_5200
, "NVIDIA GeForce FX 5200", DRIVER_NVIDIA_GEFORCEFX
, 64 },
1211 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCEFX_5600
, "NVIDIA GeForce FX 5600", DRIVER_NVIDIA_GEFORCEFX
, 128 },
1212 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCEFX_5800
, "NVIDIA GeForce FX 5800", DRIVER_NVIDIA_GEFORCEFX
, 256 },
1213 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_6200
, "NVIDIA GeForce 6200", DRIVER_NVIDIA_GEFORCE6
, 64 },
1214 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_6600GT
, "NVIDIA GeForce 6600 GT", DRIVER_NVIDIA_GEFORCE6
, 128 },
1215 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_6800
, "NVIDIA GeForce 6800", DRIVER_NVIDIA_GEFORCE6
, 128 },
1216 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_7300
, "NVIDIA GeForce Go 7300", DRIVER_NVIDIA_GEFORCE6
, 256 },
1217 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_7400
, "NVIDIA GeForce Go 7400", DRIVER_NVIDIA_GEFORCE6
, 256 },
1218 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_7600
, "NVIDIA GeForce 7600 GT", DRIVER_NVIDIA_GEFORCE6
, 256 },
1219 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_7800GT
, "NVIDIA GeForce 7800 GT", DRIVER_NVIDIA_GEFORCE6
, 256 },
1220 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_8200
, "NVIDIA GeForce 8200", DRIVER_NVIDIA_GEFORCE8
, 512 },
1221 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_8300GS
, "NVIDIA GeForce 8300 GS", DRIVER_NVIDIA_GEFORCE8
, 128 },
1222 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_8400GS
, "NVIDIA GeForce 8400 GS", DRIVER_NVIDIA_GEFORCE8
, 128 },
1223 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_8500GT
, "NVIDIA GeForce 8500 GT", DRIVER_NVIDIA_GEFORCE8
, 256 },
1224 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_8600GT
, "NVIDIA GeForce 8600 GT", DRIVER_NVIDIA_GEFORCE8
, 256 },
1225 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_8600MGT
, "NVIDIA GeForce 8600M GT", DRIVER_NVIDIA_GEFORCE8
, 512 },
1226 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_8800GTS
, "NVIDIA GeForce 8800 GTS", DRIVER_NVIDIA_GEFORCE8
, 320 },
1227 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_8800GTX
, "NVIDIA GeForce 8800 GTX", DRIVER_NVIDIA_GEFORCE8
, 768 },
1228 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_9200
, "NVIDIA GeForce 9200", DRIVER_NVIDIA_GEFORCE8
, 256 },
1229 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_9300
, "NVIDIA GeForce 9300", DRIVER_NVIDIA_GEFORCE8
, 256 },
1230 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_9400M
, "NVIDIA GeForce 9400M", DRIVER_NVIDIA_GEFORCE8
, 256 },
1231 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_9400GT
, "NVIDIA GeForce 9400 GT", DRIVER_NVIDIA_GEFORCE8
, 256 },
1232 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_9500GT
, "NVIDIA GeForce 9500 GT", DRIVER_NVIDIA_GEFORCE8
, 256 },
1233 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_9600GT
, "NVIDIA GeForce 9600 GT", DRIVER_NVIDIA_GEFORCE8
, 384 },
1234 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_9700MGT
, "NVIDIA GeForce 9700M GT", DRIVER_NVIDIA_GEFORCE8
, 512 },
1235 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_9800GT
, "NVIDIA GeForce 9800 GT", DRIVER_NVIDIA_GEFORCE8
, 512 },
1236 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_210
, "NVIDIA GeForce 210", DRIVER_NVIDIA_GEFORCE8
, 512 },
1237 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT220
, "NVIDIA GeForce GT 220", DRIVER_NVIDIA_GEFORCE8
, 512 },
1238 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT240
, "NVIDIA GeForce GT 240", DRIVER_NVIDIA_GEFORCE8
, 512 },
1239 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX260
, "NVIDIA GeForce GTX 260", DRIVER_NVIDIA_GEFORCE8
, 1024},
1240 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX275
, "NVIDIA GeForce GTX 275", DRIVER_NVIDIA_GEFORCE8
, 896 },
1241 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX280
, "NVIDIA GeForce GTX 280", DRIVER_NVIDIA_GEFORCE8
, 1024},
1242 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_315M
, "NVIDIA GeForce 315M", DRIVER_NVIDIA_GEFORCE8
, 512 },
1243 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_320M
, "NVIDIA GeForce 320M", DRIVER_NVIDIA_GEFORCE8
, 256},
1244 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT320M
, "NVIDIA GeForce GT 320M", DRIVER_NVIDIA_GEFORCE8
, 1024},
1245 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT325M
, "NVIDIA GeForce GT 325M", DRIVER_NVIDIA_GEFORCE8
, 1024},
1246 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT330
, "NVIDIA GeForce GT 330", DRIVER_NVIDIA_GEFORCE8
, 1024},
1247 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTS350M
, "NVIDIA GeForce GTS 350M", DRIVER_NVIDIA_GEFORCE8
, 1024},
1248 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_410M
, "NVIDIA GeForce 410M", DRIVER_NVIDIA_GEFORCE8
, 512},
1249 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT420
, "NVIDIA GeForce GT 420", DRIVER_NVIDIA_GEFORCE8
, 2048},
1250 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT425M
, "NVIDIA GeForce GT 425M", DRIVER_NVIDIA_GEFORCE8
, 1024},
1251 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT430
, "NVIDIA GeForce GT 430", DRIVER_NVIDIA_GEFORCE8
, 1024},
1252 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT440
, "NVIDIA GeForce GT 440", DRIVER_NVIDIA_GEFORCE8
, 1024},
1253 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTS450
, "NVIDIA GeForce GTS 450", DRIVER_NVIDIA_GEFORCE8
, 1024},
1254 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX460
, "NVIDIA GeForce GTX 460", DRIVER_NVIDIA_GEFORCE8
, 768 },
1255 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX460M
, "NVIDIA GeForce GTX 460M", DRIVER_NVIDIA_GEFORCE8
, 1536},
1256 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX465
, "NVIDIA GeForce GTX 465", DRIVER_NVIDIA_GEFORCE8
, 1024},
1257 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX470
, "NVIDIA GeForce GTX 470", DRIVER_NVIDIA_GEFORCE8
, 1280},
1258 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX480
, "NVIDIA GeForce GTX 480", DRIVER_NVIDIA_GEFORCE8
, 1536},
1259 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT520
, "NVIDIA GeForce GT 520", DRIVER_NVIDIA_GEFORCE8
, 1024},
1260 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT540M
, "NVIDIA GeForce GT 540M", DRIVER_NVIDIA_GEFORCE8
, 1024},
1261 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX550
, "NVIDIA GeForce GTX 550 Ti", DRIVER_NVIDIA_GEFORCE8
, 1024},
1262 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT555M
, "NVIDIA GeForce GT 555M", DRIVER_NVIDIA_GEFORCE8
, 1024},
1263 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX560TI
, "NVIDIA GeForce GTX 560 Ti", DRIVER_NVIDIA_GEFORCE8
, 1024},
1264 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX560
, "NVIDIA GeForce GTX 560", DRIVER_NVIDIA_GEFORCE8
, 1024},
1265 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX570
, "NVIDIA GeForce GTX 570", DRIVER_NVIDIA_GEFORCE8
, 1280},
1266 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX580
, "NVIDIA GeForce GTX 580", DRIVER_NVIDIA_GEFORCE8
, 1536},
1267 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT610
, "NVIDIA GeForce GT 610", DRIVER_NVIDIA_GEFORCE8
, 1024},
1268 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT630
, "NVIDIA GeForce GT 630", DRIVER_NVIDIA_GEFORCE8
, 1024},
1269 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT630M
, "NVIDIA GeForce GT 630M", DRIVER_NVIDIA_GEFORCE8
, 1024},
1270 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT640M
, "NVIDIA GeForce GT 640M", DRIVER_NVIDIA_GEFORCE8
, 1024},
1271 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT650M
, "NVIDIA GeForce GT 650M", DRIVER_NVIDIA_GEFORCE8
, 2048},
1272 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX650
, "NVIDIA GeForce GTX 650", DRIVER_NVIDIA_GEFORCE8
, 1024},
1273 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX650TI
, "NVIDIA GeForce GTX 650 Ti", DRIVER_NVIDIA_GEFORCE8
, 1024},
1274 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX660
, "NVIDIA GeForce GTX 660", DRIVER_NVIDIA_GEFORCE8
, 2048},
1275 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX660M
, "NVIDIA GeForce GTX 660M", DRIVER_NVIDIA_GEFORCE8
, 2048},
1276 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX660TI
, "NVIDIA GeForce GTX 660 Ti", DRIVER_NVIDIA_GEFORCE8
, 2048},
1277 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX670
, "NVIDIA GeForce GTX 670", DRIVER_NVIDIA_GEFORCE8
, 2048},
1278 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX670MX
, "NVIDIA GeForce GTX 670MX", DRIVER_NVIDIA_GEFORCE8
, 3072},
1279 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX680
, "NVIDIA GeForce GTX 680", DRIVER_NVIDIA_GEFORCE8
, 2048},
1280 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT750M
, "NVIDIA GeForce GT 750M", DRIVER_NVIDIA_GEFORCE8
, 1024},
1281 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX750
, "NVIDIA GeForce GTX 750", DRIVER_NVIDIA_GEFORCE8
, 1024},
1282 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX750TI
, "NVIDIA GeForce GTX 750 Ti", DRIVER_NVIDIA_GEFORCE8
, 2048},
1283 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX760
, "NVIDIA Geforce GTX 760", DRIVER_NVIDIA_GEFORCE8
, 2048},
1284 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX765M
, "NVIDIA GeForce GTX 765M", DRIVER_NVIDIA_GEFORCE8
, 2048},
1285 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX770M
, "NVIDIA GeForce GTX 770M", DRIVER_NVIDIA_GEFORCE8
, 3072},
1286 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX770
, "NVIDIA GeForce GTX 770", DRIVER_NVIDIA_GEFORCE8
, 2048},
1287 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX780
, "NVIDIA GeForce GTX 780", DRIVER_NVIDIA_GEFORCE8
, 3072},
1288 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX780TI
, "NVIDIA GeForce GTX 780 Ti", DRIVER_NVIDIA_GEFORCE8
, 3072},
1289 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTXTITAN
, "NVIDIA GeForce GTX TITAN", DRIVER_NVIDIA_GEFORCE8
, 6144},
1290 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTXTITANB
, "NVIDIA GeForce GTX TITAN Black", DRIVER_NVIDIA_GEFORCE8
, 6144},
1291 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTXTITANX
, "NVIDIA GeForce GTX TITAN X", DRIVER_NVIDIA_GEFORCE8
, 12288},
1292 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTXTITANZ
, "NVIDIA GeForce GTX TITAN Z", DRIVER_NVIDIA_GEFORCE8
, 12288},
1293 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_820M
, "NVIDIA GeForce 820M", DRIVER_NVIDIA_GEFORCE8
, 2048},
1294 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_830M
, "NVIDIA GeForce 830M", DRIVER_NVIDIA_GEFORCE8
, 2048},
1295 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_840M
, "NVIDIA GeForce 840M", DRIVER_NVIDIA_GEFORCE8
, 2048},
1296 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_845M
, "NVIDIA GeForce 845M", DRIVER_NVIDIA_GEFORCE8
, 2048},
1297 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX850M
, "NVIDIA GeForce GTX 850M", DRIVER_NVIDIA_GEFORCE8
, 2048},
1298 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX860M
, "NVIDIA GeForce GTX 860M", DRIVER_NVIDIA_GEFORCE8
, 2048},
1299 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX870M
, "NVIDIA GeForce GTX 870M", DRIVER_NVIDIA_GEFORCE8
, 3072},
1300 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX880M
, "NVIDIA GeForce GTX 880M", DRIVER_NVIDIA_GEFORCE8
, 4096},
1301 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX950
, "NVIDIA GeForce GTX 950", DRIVER_NVIDIA_GEFORCE8
, 2048},
1302 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX950M
, "NVIDIA GeForce GTX 950M", DRIVER_NVIDIA_GEFORCE8
, 4096},
1303 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX960
, "NVIDIA GeForce GTX 960", DRIVER_NVIDIA_GEFORCE8
, 4096},
1304 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX960M
, "NVIDIA GeForce GTX 960M", DRIVER_NVIDIA_GEFORCE8
, 2048},
1305 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX970
, "NVIDIA GeForce GTX 970", DRIVER_NVIDIA_GEFORCE8
, 4096},
1306 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX970M
, "NVIDIA GeForce GTX 970M", DRIVER_NVIDIA_GEFORCE8
, 3072},
1307 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX980
, "NVIDIA GeForce GTX 980", DRIVER_NVIDIA_GEFORCE8
, 4096},
1310 {HW_VENDOR_AMD
, CARD_AMD_RAGE_128PRO
, "ATI Rage Fury", DRIVER_AMD_RAGE_128PRO
, 16 },
1311 {HW_VENDOR_AMD
, CARD_AMD_RADEON_7200
, "ATI RADEON 7200 SERIES", DRIVER_AMD_R100
, 32 },
1312 {HW_VENDOR_AMD
, CARD_AMD_RADEON_8500
, "ATI RADEON 8500 SERIES", DRIVER_AMD_R100
, 64 },
1313 {HW_VENDOR_AMD
, CARD_AMD_RADEON_9500
, "ATI Radeon 9500", DRIVER_AMD_R300
, 64 },
1314 {HW_VENDOR_AMD
, CARD_AMD_RADEON_XPRESS_200M
, "ATI RADEON XPRESS 200M Series", DRIVER_AMD_R300
, 64 },
1315 {HW_VENDOR_AMD
, CARD_AMD_RADEON_X700
, "ATI Radeon X700 SE", DRIVER_AMD_R300
, 128 },
1316 {HW_VENDOR_AMD
, CARD_AMD_RADEON_X1600
, "ATI Radeon X1600 Series", DRIVER_AMD_R300
, 128 },
1317 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD2350
, "ATI Mobility Radeon HD 2350", DRIVER_AMD_R600
, 256 },
1318 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD2600
, "ATI Mobility Radeon HD 2600", DRIVER_AMD_R600
, 256 },
1319 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD2900
, "ATI Radeon HD 2900 XT", DRIVER_AMD_R600
, 512 },
1320 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD3200
, "ATI Radeon HD 3200 Graphics", DRIVER_AMD_R600
, 128 },
1321 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD3850
, "ATI Radeon HD 3850 AGP", DRIVER_AMD_R600
, 512 },
1322 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD4200M
, "ATI Mobility Radeon HD 4200", DRIVER_AMD_R600
, 256 },
1323 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD4350
, "ATI Radeon HD 4350", DRIVER_AMD_R600
, 256 },
1324 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD4600
, "ATI Radeon HD 4600 Series", DRIVER_AMD_R600
, 512 },
1325 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD4700
, "ATI Radeon HD 4700 Series", DRIVER_AMD_R600
, 512 },
1326 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD4800
, "ATI Radeon HD 4800 Series", DRIVER_AMD_R600
, 512 },
1327 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD5400
, "ATI Radeon HD 5400 Series", DRIVER_AMD_R600
, 512 },
1328 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD5600
, "ATI Radeon HD 5600 Series", DRIVER_AMD_R600
, 512 },
1329 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD5700
, "ATI Radeon HD 5700 Series", DRIVER_AMD_R600
, 512 },
1330 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD5800
, "ATI Radeon HD 5800 Series", DRIVER_AMD_R600
, 1024},
1331 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD5900
, "ATI Radeon HD 5900 Series", DRIVER_AMD_R600
, 1024},
1332 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD6300
, "AMD Radeon HD 6300 series Graphics", DRIVER_AMD_R600
, 1024},
1333 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD6400
, "AMD Radeon HD 6400 Series", DRIVER_AMD_R600
, 1024},
1334 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD6410D
, "AMD Radeon HD 6410D", DRIVER_AMD_R600
, 1024},
1335 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD6550D
, "AMD Radeon HD 6550D", DRIVER_AMD_R600
, 1024},
1336 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD6600
, "AMD Radeon HD 6600 Series", DRIVER_AMD_R600
, 1024},
1337 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD6600M
, "AMD Radeon HD 6600M Series", DRIVER_AMD_R600
, 512 },
1338 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD6700
, "AMD Radeon HD 6700 Series", DRIVER_AMD_R600
, 1024},
1339 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD6800
, "AMD Radeon HD 6800 Series", DRIVER_AMD_R600
, 1024},
1340 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD6900
, "AMD Radeon HD 6900 Series", DRIVER_AMD_R600
, 2048},
1341 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD7660D
, "AMD Radeon HD 7660D", DRIVER_AMD_R600
, 2048},
1342 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD7700
, "AMD Radeon HD 7700 Series", DRIVER_AMD_R600
, 1024},
1343 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD7800
, "AMD Radeon HD 7800 Series", DRIVER_AMD_R600
, 2048},
1344 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD7900
, "AMD Radeon HD 7900 Series", DRIVER_AMD_R600
, 2048},
1345 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD8600M
, "AMD Radeon HD 8600M Series", DRIVER_AMD_R600
, 1024},
1346 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD8670
, "AMD Radeon HD 8670", DRIVER_AMD_R600
, 2048},
1347 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD8770
, "AMD Radeon HD 8770", DRIVER_AMD_R600
, 2048},
1348 {HW_VENDOR_AMD
, CARD_AMD_RADEON_R3
, "AMD Radeon HD 8400 / R3 Series", DRIVER_AMD_R600
, 2048},
1349 {HW_VENDOR_AMD
, CARD_AMD_RADEON_R7
, "AMD Radeon(TM) R7 Graphics", DRIVER_AMD_R600
, 2048},
1350 {HW_VENDOR_AMD
, CARD_AMD_RADEON_R9
, "AMD Radeon R9 290", DRIVER_AMD_R600
, 4096},
1353 {HW_VENDOR_VMWARE
, CARD_VMWARE_SVGA3D
, "VMware SVGA 3D (Microsoft Corporation - WDDM)", DRIVER_VMWARE
, 1024},
1356 {HW_VENDOR_INTEL
, CARD_INTEL_830M
, "Intel(R) 82830M Graphics Controller", DRIVER_INTEL_GMA800
, 32 },
1357 {HW_VENDOR_INTEL
, CARD_INTEL_855GM
, "Intel(R) 82852/82855 GM/GME Graphics Controller", DRIVER_INTEL_GMA800
, 32 },
1358 {HW_VENDOR_INTEL
, CARD_INTEL_845G
, "Intel(R) 845G", DRIVER_INTEL_GMA800
, 32 },
1359 {HW_VENDOR_INTEL
, CARD_INTEL_865G
, "Intel(R) 82865G Graphics Controller", DRIVER_INTEL_GMA800
, 32 },
1360 {HW_VENDOR_INTEL
, CARD_INTEL_915G
, "Intel(R) 82915G/GV/910GL Express Chipset Family", DRIVER_INTEL_GMA900
, 64 },
1361 {HW_VENDOR_INTEL
, CARD_INTEL_E7221G
, "Intel(R) E7221G", DRIVER_INTEL_GMA900
, 64 },
1362 {HW_VENDOR_INTEL
, CARD_INTEL_915GM
, "Mobile Intel(R) 915GM/GMS,910GML Express Chipset Family", DRIVER_INTEL_GMA900
, 64 },
1363 {HW_VENDOR_INTEL
, CARD_INTEL_945G
, "Intel(R) 945G", DRIVER_INTEL_GMA950
, 64 },
1364 {HW_VENDOR_INTEL
, CARD_INTEL_945GM
, "Mobile Intel(R) 945GM Express Chipset Family", DRIVER_INTEL_GMA950
, 64 },
1365 {HW_VENDOR_INTEL
, CARD_INTEL_945GME
, "Intel(R) 945GME", DRIVER_INTEL_GMA950
, 64 },
1366 {HW_VENDOR_INTEL
, CARD_INTEL_Q35
, "Intel(R) Q35", DRIVER_INTEL_GMA950
, 64 },
1367 {HW_VENDOR_INTEL
, CARD_INTEL_G33
, "Intel(R) G33", DRIVER_INTEL_GMA950
, 64 },
1368 {HW_VENDOR_INTEL
, CARD_INTEL_Q33
, "Intel(R) Q33", DRIVER_INTEL_GMA950
, 64 },
1369 {HW_VENDOR_INTEL
, CARD_INTEL_PNVG
, "Intel(R) IGD", DRIVER_INTEL_GMA950
, 64 },
1370 {HW_VENDOR_INTEL
, CARD_INTEL_PNVM
, "Intel(R) IGD", DRIVER_INTEL_GMA950
, 64 },
1371 {HW_VENDOR_INTEL
, CARD_INTEL_965Q
, "Intel(R) 965Q", DRIVER_INTEL_GMA3000
, 128},
1372 {HW_VENDOR_INTEL
, CARD_INTEL_965G
, "Intel(R) 965G", DRIVER_INTEL_GMA3000
, 128},
1373 {HW_VENDOR_INTEL
, CARD_INTEL_946GZ
, "Intel(R) 946GZ", DRIVER_INTEL_GMA3000
, 128},
1374 {HW_VENDOR_INTEL
, CARD_INTEL_965GM
, "Mobile Intel(R) 965 Express Chipset Family", DRIVER_INTEL_GMA3000
, 128},
1375 {HW_VENDOR_INTEL
, CARD_INTEL_965GME
, "Intel(R) 965GME", DRIVER_INTEL_GMA3000
, 128},
1376 {HW_VENDOR_INTEL
, CARD_INTEL_GM45
, "Mobile Intel(R) GM45 Express Chipset Family", DRIVER_INTEL_GMA3000
, 512},
1377 {HW_VENDOR_INTEL
, CARD_INTEL_IGD
, "Intel(R) Integrated Graphics Device", DRIVER_INTEL_GMA3000
, 512},
1378 {HW_VENDOR_INTEL
, CARD_INTEL_G45
, "Intel(R) G45/G43", DRIVER_INTEL_GMA3000
, 512},
1379 {HW_VENDOR_INTEL
, CARD_INTEL_Q45
, "Intel(R) Q45/Q43", DRIVER_INTEL_GMA3000
, 512},
1380 {HW_VENDOR_INTEL
, CARD_INTEL_G41
, "Intel(R) G41", DRIVER_INTEL_GMA3000
, 512},
1381 {HW_VENDOR_INTEL
, CARD_INTEL_B43
, "Intel(R) B43", DRIVER_INTEL_GMA3000
, 512},
1382 {HW_VENDOR_INTEL
, CARD_INTEL_ILKD
, "Intel(R) Ironlake Desktop", DRIVER_INTEL_GMA3000
, 1024},
1383 {HW_VENDOR_INTEL
, CARD_INTEL_ILKM
, "Intel(R) Ironlake Mobile", DRIVER_INTEL_GMA3000
, 1024},
1384 {HW_VENDOR_INTEL
, CARD_INTEL_SNBD
, "Intel(R) Sandybridge Desktop", DRIVER_INTEL_GMA3000
, 1024},
1385 {HW_VENDOR_INTEL
, CARD_INTEL_SNBM
, "Intel(R) Sandybridge Mobile", DRIVER_INTEL_GMA3000
, 1024},
1386 {HW_VENDOR_INTEL
, CARD_INTEL_SNBS
, "Intel(R) Sandybridge Server", DRIVER_INTEL_GMA3000
, 1024},
1387 {HW_VENDOR_INTEL
, CARD_INTEL_IVBD
, "Intel(R) Ivybridge Desktop", DRIVER_INTEL_GMA3000
, 1024},
1388 {HW_VENDOR_INTEL
, CARD_INTEL_IVBM
, "Intel(R) Ivybridge Mobile", DRIVER_INTEL_GMA3000
, 1024},
1389 {HW_VENDOR_INTEL
, CARD_INTEL_IVBS
, "Intel(R) Ivybridge Server", DRIVER_INTEL_GMA3000
, 1024},
1390 {HW_VENDOR_INTEL
, CARD_INTEL_HWM
, "Intel(R) Haswell Mobile", DRIVER_INTEL_GMA3000
, 1024},
1393 static const struct driver_version_information
*get_driver_version_info(enum wined3d_display_driver driver
,
1394 enum wined3d_driver_model driver_model
)
1398 TRACE("Looking up version info for driver=%d driver_model=%d\n", driver
, driver_model
);
1399 for (i
= 0; i
< (sizeof(driver_version_table
) / sizeof(driver_version_table
[0])); i
++)
1401 const struct driver_version_information
*entry
= &driver_version_table
[i
];
1403 if (entry
->driver
== driver
&& entry
->driver_model
== driver_model
)
1405 TRACE("Found driver \"%s\", version %u, subversion %u, build %u.\n",
1406 entry
->driver_name
, entry
->version
, entry
->subversion
, entry
->build
);
1413 static const struct gpu_description
*get_gpu_description(enum wined3d_pci_vendor vendor
,
1414 enum wined3d_pci_device device
)
1418 for (i
= 0; i
< (sizeof(gpu_description_table
) / sizeof(*gpu_description_table
)); ++i
)
1420 if (vendor
== gpu_description_table
[i
].vendor
&& device
== gpu_description_table
[i
].card
)
1421 return &gpu_description_table
[i
];
1427 static const struct gpu_description
*query_gpu_description(const struct wined3d_gl_info
*gl_info
, UINT64
*vram_bytes
)
1429 enum wined3d_pci_vendor vendor
= PCI_VENDOR_NONE
;
1430 enum wined3d_pci_device device
= PCI_DEVICE_NONE
;
1431 const struct gpu_description
*gpu_description
;
1432 static unsigned int once
;
1434 if (gl_info
->supported
[WGL_WINE_QUERY_RENDERER
])
1438 if (GL_EXTCALL(wglQueryCurrentRendererIntegerWINE(WGL_RENDERER_VENDOR_ID_WINE
, &value
)))
1440 if (GL_EXTCALL(wglQueryCurrentRendererIntegerWINE(WGL_RENDERER_DEVICE_ID_WINE
, &value
)))
1442 if (GL_EXTCALL(wglQueryCurrentRendererIntegerWINE(WGL_RENDERER_VIDEO_MEMORY_WINE
, &value
)))
1443 *vram_bytes
= (UINT64
)value
* 1024 * 1024;
1444 TRACE("Card reports vendor PCI ID 0x%04x, device PCI ID 0x%04x, 0x%s bytes of video memory.\n",
1445 vendor
, device
, wine_dbgstr_longlong(*vram_bytes
));
1448 if (wined3d_settings
.pci_vendor_id
!= PCI_VENDOR_NONE
)
1450 vendor
= wined3d_settings
.pci_vendor_id
;
1451 TRACE("Overriding vendor PCI ID with 0x%04x.\n", vendor
);
1454 if (wined3d_settings
.pci_device_id
!= PCI_DEVICE_NONE
)
1456 device
= wined3d_settings
.pci_device_id
;
1457 TRACE("Overriding device PCI ID with 0x%04x.\n", device
);
1460 if (wined3d_settings
.emulated_textureram
)
1462 *vram_bytes
= wined3d_settings
.emulated_textureram
;
1463 TRACE("Overriding amount of video memory with 0x%s bytes.\n",
1464 wine_dbgstr_longlong(*vram_bytes
));
1467 if (!(gpu_description
= get_gpu_description(vendor
, device
))
1468 && (wined3d_settings
.pci_vendor_id
!= PCI_VENDOR_NONE
1469 || wined3d_settings
.pci_device_id
!= PCI_DEVICE_NONE
) && !once
++)
1470 ERR_(winediag
)("Invalid GPU override %04x:%04x specified, ignoring.\n", vendor
, device
);
1472 return gpu_description
;
1475 static void init_driver_info(struct wined3d_driver_info
*driver_info
,
1476 const struct gpu_description
*gpu_desc
, UINT64 vram_bytes
)
1478 OSVERSIONINFOW os_version
;
1479 WORD driver_os_version
;
1480 enum wined3d_display_driver driver
;
1481 enum wined3d_driver_model driver_model
;
1482 const struct driver_version_information
*version_info
;
1484 memset(&os_version
, 0, sizeof(os_version
));
1485 os_version
.dwOSVersionInfoSize
= sizeof(os_version
);
1486 if (!GetVersionExW(&os_version
))
1488 ERR("Failed to get OS version, reporting 2000/XP.\n");
1489 driver_os_version
= 6;
1490 driver_model
= DRIVER_MODEL_NT5X
;
1494 TRACE("OS version %u.%u.\n", os_version
.dwMajorVersion
, os_version
.dwMinorVersion
);
1495 switch (os_version
.dwMajorVersion
)
1498 /* If needed we could distinguish between 9x and NT4, but this code won't make
1499 * sense for NT4 since it had no way to obtain this info through DirectDraw 3.0.
1501 driver_os_version
= 4;
1502 driver_model
= DRIVER_MODEL_WIN9X
;
1506 driver_os_version
= 6;
1507 driver_model
= DRIVER_MODEL_NT5X
;
1511 if (os_version
.dwMinorVersion
== 0)
1513 driver_os_version
= 7;
1514 driver_model
= DRIVER_MODEL_NT6X
;
1516 else if (os_version
.dwMinorVersion
== 1)
1518 driver_os_version
= 8;
1519 driver_model
= DRIVER_MODEL_NT6X
;
1523 if (os_version
.dwMinorVersion
> 2)
1525 FIXME("Unhandled OS version %u.%u, reporting Win 8.\n",
1526 os_version
.dwMajorVersion
, os_version
.dwMinorVersion
);
1528 driver_os_version
= 9;
1529 driver_model
= DRIVER_MODEL_NT6X
;
1534 driver_os_version
= 10;
1535 driver_model
= DRIVER_MODEL_NT6X
;
1539 FIXME("Unhandled OS version %u.%u, reporting 2000/XP.\n",
1540 os_version
.dwMajorVersion
, os_version
.dwMinorVersion
);
1541 driver_os_version
= 6;
1542 driver_model
= DRIVER_MODEL_NT5X
;
1547 driver_info
->vendor
= gpu_desc
->vendor
;
1548 driver_info
->device
= gpu_desc
->card
;
1549 driver_info
->description
= gpu_desc
->description
;
1550 driver_info
->vram_bytes
= vram_bytes
? vram_bytes
: (UINT64
)gpu_desc
->vidmem
* 1024 * 1024;
1551 driver
= gpu_desc
->driver
;
1554 * Diablo 2 crashes when the amount of video memory is greater than 0x7fffffff.
1555 * In order to avoid this application bug we limit the amount of video memory
1556 * to LONG_MAX for older Windows versions.
1558 if (driver_model
< DRIVER_MODEL_NT6X
&& driver_info
->vram_bytes
> LONG_MAX
)
1560 TRACE("Limiting amount of video memory to %#lx bytes for OS version older than Vista.\n", LONG_MAX
);
1561 driver_info
->vram_bytes
= LONG_MAX
;
1564 /* Try to obtain driver version information for the current Windows version. This fails in
1566 * - the gpu is not available on the currently selected OS version:
1567 * - Geforce GTX480 on Win98. When running applications in compatibility mode on Windows,
1568 * version information for the current Windows version is returned instead of faked info.
1569 * We do the same and assume the default Windows version to emulate is WinXP.
1571 * - Videocard is a Riva TNT but winver is set to win7 (there are no drivers for this beast)
1572 * For now return the XP driver info. Perhaps later on we should return VESA.
1574 * - the gpu is not in our database (can happen when the user overrides the vendor_id / device_id)
1575 * This could be an indication that our database is not up to date, so this should be fixed.
1577 if ((version_info
= get_driver_version_info(driver
, driver_model
))
1578 || (version_info
= get_driver_version_info(driver
, DRIVER_MODEL_NT5X
)))
1580 driver_info
->name
= version_info
->driver_name
;
1581 driver_info
->version_high
= MAKEDWORD_VERSION(driver_os_version
, version_info
->version
);
1582 driver_info
->version_low
= MAKEDWORD_VERSION(version_info
->subversion
, version_info
->build
);
1586 ERR("No driver version info found for device %04x:%04x, driver model %#x.\n",
1587 driver_info
->vendor
, driver_info
->device
, driver_model
);
1588 driver_info
->name
= "Display";
1589 driver_info
->version_high
= MAKEDWORD_VERSION(driver_os_version
, 15);
1590 driver_info
->version_low
= MAKEDWORD_VERSION(8, 6); /* Nvidia RIVA TNT, arbitrary */
1593 TRACE("Reporting (fake) driver version 0x%08x-0x%08x.\n",
1594 driver_info
->version_high
, driver_info
->version_low
);
1597 /* Context activation is done by the caller. */
1598 static void fixup_extensions(struct wined3d_gl_info
*gl_info
, const char *gl_renderer
,
1599 enum wined3d_gl_vendor gl_vendor
, enum wined3d_pci_vendor card_vendor
, enum wined3d_pci_device device
)
1603 for (i
= 0; i
< (sizeof(quirk_table
) / sizeof(*quirk_table
)); ++i
)
1605 if (!quirk_table
[i
].match(gl_info
, gl_renderer
, gl_vendor
, card_vendor
, device
)) continue;
1606 TRACE("Applying driver quirk \"%s\".\n", quirk_table
[i
].description
);
1607 quirk_table
[i
].apply(gl_info
);
1610 /* Find out if PBOs work as they are supposed to. */
1611 test_pbo_functionality(gl_info
);
1614 static DWORD
wined3d_parse_gl_version(const char *gl_version
)
1616 const char *ptr
= gl_version
;
1621 ERR("Invalid OpenGL major version %d.\n", major
);
1623 while (isdigit(*ptr
)) ++ptr
;
1625 ERR("Invalid OpenGL version string %s.\n", debugstr_a(gl_version
));
1629 TRACE("Found OpenGL version %d.%d.\n", major
, minor
);
1631 return MAKEDWORD_VERSION(major
, minor
);
1634 static enum wined3d_gl_vendor
wined3d_guess_gl_vendor(const struct wined3d_gl_info
*gl_info
,
1635 const char *gl_vendor_string
, const char *gl_renderer
)
1638 /* MacOS has various specialities in the extensions it advertises. Some have to be loaded from
1639 * the opengl 1.2+ core, while other extensions are advertised, but software emulated. So try to
1640 * detect the Apple OpenGL implementation to apply some extension fixups afterwards.
1642 * Detecting this isn't really easy. The vendor string doesn't mention Apple. Compile-time checks
1643 * aren't sufficient either because a Linux binary may display on a macos X server via remote X11.
1644 * So try to detect the GL implementation by looking at certain Apple extensions. Some extensions
1645 * like client storage might be supported on other implementations too, but GL_APPLE_flush_render
1646 * is specific to the Mac OS X window management, and GL_APPLE_ycbcr_422 is QuickTime specific. So
1647 * the chance that other implementations support them is rather small since Win32 QuickTime uses
1648 * DirectDraw, not OpenGL. */
1649 if (gl_info
->supported
[APPLE_FENCE
]
1650 && gl_info
->supported
[APPLE_YCBCR_422
])
1651 return GL_VENDOR_APPLE
;
1653 if (strstr(gl_vendor_string
, "NVIDIA"))
1654 return GL_VENDOR_NVIDIA
;
1656 if (strstr(gl_vendor_string
, "ATI"))
1657 return GL_VENDOR_FGLRX
;
1659 if (strstr(gl_vendor_string
, "Mesa")
1660 || strstr(gl_vendor_string
, "X.Org")
1661 || strstr(gl_vendor_string
, "Advanced Micro Devices, Inc.")
1662 || strstr(gl_vendor_string
, "DRI R300 Project")
1663 || strstr(gl_vendor_string
, "Tungsten Graphics, Inc")
1664 || strstr(gl_vendor_string
, "VMware, Inc.")
1665 || strstr(gl_vendor_string
, "Intel")
1666 || strstr(gl_renderer
, "Mesa")
1667 || strstr(gl_renderer
, "Gallium")
1668 || strstr(gl_renderer
, "Intel"))
1669 return GL_VENDOR_MESA
;
1671 FIXME("Received unrecognized GL_VENDOR %s. Returning GL_VENDOR_UNKNOWN.\n",
1672 debugstr_a(gl_vendor_string
));
1674 return GL_VENDOR_UNKNOWN
;
1677 static enum wined3d_pci_vendor
wined3d_guess_card_vendor(const char *gl_vendor_string
, const char *gl_renderer
)
1679 if (strstr(gl_vendor_string
, "NVIDIA")
1680 || strstr(gl_vendor_string
, "Nouveau")
1681 || strstr(gl_vendor_string
, "nouveau"))
1682 return HW_VENDOR_NVIDIA
;
1684 if (strstr(gl_vendor_string
, "ATI")
1685 || strstr(gl_vendor_string
, "Advanced Micro Devices, Inc.")
1686 || strstr(gl_vendor_string
, "X.Org R300 Project")
1687 || strstr(gl_renderer
, "AMD")
1688 || strstr(gl_renderer
, "R100")
1689 || strstr(gl_renderer
, "R200")
1690 || strstr(gl_renderer
, "R300")
1691 || strstr(gl_renderer
, "R600")
1692 || strstr(gl_renderer
, "R700"))
1693 return HW_VENDOR_AMD
;
1695 if (strstr(gl_vendor_string
, "Intel(R)")
1696 /* Intel switched from Intel(R) to Intel® recently, so just match Intel. */
1697 || strstr(gl_renderer
, "Intel")
1698 || strstr(gl_renderer
, "i915")
1699 || strstr(gl_vendor_string
, "Intel Inc."))
1700 return HW_VENDOR_INTEL
;
1702 if (strstr(gl_renderer
, "SVGA3D"))
1703 return HW_VENDOR_VMWARE
;
1705 if (strstr(gl_vendor_string
, "Mesa")
1706 || strstr(gl_vendor_string
, "Brian Paul")
1707 || strstr(gl_vendor_string
, "Tungsten Graphics, Inc")
1708 || strstr(gl_vendor_string
, "VMware, Inc."))
1709 return HW_VENDOR_SOFTWARE
;
1711 FIXME("Received unrecognized GL_VENDOR %s. Returning HW_VENDOR_NVIDIA.\n", debugstr_a(gl_vendor_string
));
1713 return HW_VENDOR_NVIDIA
;
1716 static enum wined3d_d3d_level
d3d_level_from_caps(const struct shader_caps
*shader_caps
, const struct fragment_caps
*fragment_caps
, DWORD glsl_version
)
1718 if (shader_caps
->vs_version
>= 5)
1719 return WINED3D_D3D_LEVEL_11
;
1720 if (shader_caps
->vs_version
== 4)
1722 /* No backed supports SM 5 at the moment */
1723 if (glsl_version
>= MAKEDWORD_VERSION(4, 00))
1724 return WINED3D_D3D_LEVEL_11
;
1725 return WINED3D_D3D_LEVEL_10
;
1727 if (shader_caps
->vs_version
== 3)
1729 /* Wine cannot use SM 4 on mesa drivers as the necessary functionality
1730 * is not exposed on compatibility contexts */
1731 if (glsl_version
>= MAKEDWORD_VERSION(1, 30))
1732 return WINED3D_D3D_LEVEL_10
;
1733 return WINED3D_D3D_LEVEL_9_SM3
;
1735 if (shader_caps
->vs_version
== 2)
1736 return WINED3D_D3D_LEVEL_9_SM2
;
1737 if (shader_caps
->vs_version
== 1)
1738 return WINED3D_D3D_LEVEL_8
;
1740 if (fragment_caps
->TextureOpCaps
& WINED3DTEXOPCAPS_DOTPRODUCT3
)
1741 return WINED3D_D3D_LEVEL_7
;
1742 if (fragment_caps
->MaxSimultaneousTextures
> 1)
1743 return WINED3D_D3D_LEVEL_6
;
1745 return WINED3D_D3D_LEVEL_5
;
1748 static const struct wined3d_renderer_table
1750 const char *renderer
;
1751 enum wined3d_pci_device id
;
1753 cards_nvidia_binary
[] =
1756 {"GTX 980", CARD_NVIDIA_GEFORCE_GTX980
}, /* GeForce 900 - highend */
1757 {"GTX 970M", CARD_NVIDIA_GEFORCE_GTX970M
}, /* GeForce 900 - highend mobile*/
1758 {"GTX 970", CARD_NVIDIA_GEFORCE_GTX970
}, /* GeForce 900 - highend */
1759 {"GTX TITAN X", CARD_NVIDIA_GEFORCE_GTXTITANX
}, /* Geforce 900 - highend */
1760 {"GTX 960M", CARD_NVIDIA_GEFORCE_GTX960M
}, /* GeForce 900 - midend high mobile */
1761 {"GTX 960", CARD_NVIDIA_GEFORCE_GTX960
}, /* GeForce 900 - midend high */
1762 {"GTX 950M", CARD_NVIDIA_GEFORCE_GTX950M
}, /* GeForce 900 - midend mobile */
1763 {"GTX 950", CARD_NVIDIA_GEFORCE_GTX950
}, /* GeForce 900 - midend */
1764 {"GTX 880M", CARD_NVIDIA_GEFORCE_GTX880M
}, /* GeForce 800 - mobile */
1765 {"GTX 870M", CARD_NVIDIA_GEFORCE_GTX870M
}, /* GeForce 800 - mobile */
1766 {"GTX 860M", CARD_NVIDIA_GEFORCE_GTX860M
}, /* GeForce 800 - mobile */
1767 {"GTX 850M", CARD_NVIDIA_GEFORCE_GTX850M
}, /* GeForce 800 - mobile */
1768 {"GeForce 845M", CARD_NVIDIA_GEFORCE_845M
}, /* GeForce 800 - mobile */
1769 {"GeForce 840M", CARD_NVIDIA_GEFORCE_840M
}, /* GeForce 800 - mobile */
1770 {"GeForce 830M", CARD_NVIDIA_GEFORCE_830M
}, /* GeForce 800 - mobile */
1771 {"GeForce 820M", CARD_NVIDIA_GEFORCE_820M
}, /* GeForce 800 - mobile */
1772 {"GTX 780 Ti", CARD_NVIDIA_GEFORCE_GTX780TI
}, /* Geforce 700 - highend */
1773 {"GTX TITAN Black", CARD_NVIDIA_GEFORCE_GTXTITANB
}, /* Geforce 700 - highend */
1774 {"GTX TITAN Z", CARD_NVIDIA_GEFORCE_GTXTITANZ
}, /* Geforce 700 - highend */
1775 {"GTX TITAN", CARD_NVIDIA_GEFORCE_GTXTITAN
}, /* Geforce 700 - highend */
1776 {"GTX 780", CARD_NVIDIA_GEFORCE_GTX780
}, /* Geforce 700 - highend */
1777 {"GTX 770M", CARD_NVIDIA_GEFORCE_GTX770M
}, /* Geforce 700 - midend high mobile */
1778 {"GTX 770", CARD_NVIDIA_GEFORCE_GTX770
}, /* Geforce 700 - highend */
1779 {"GTX 765M", CARD_NVIDIA_GEFORCE_GTX765M
}, /* Geforce 700 - midend high mobile */
1780 {"GTX 760", CARD_NVIDIA_GEFORCE_GTX760
}, /* Geforce 700 - midend high */
1781 {"GTX 750 Ti", CARD_NVIDIA_GEFORCE_GTX750TI
}, /* Geforce 700 - midend */
1782 {"GTX 750", CARD_NVIDIA_GEFORCE_GTX750
}, /* Geforce 700 - midend */
1783 {"GT 750M", CARD_NVIDIA_GEFORCE_GT750M
}, /* Geforce 700 - midend mobile */
1784 {"GTX 680", CARD_NVIDIA_GEFORCE_GTX680
}, /* Geforce 600 - highend */
1785 {"GTX 670MX", CARD_NVIDIA_GEFORCE_GTX670MX
}, /* Geforce 600 - highend */
1786 {"GTX 670", CARD_NVIDIA_GEFORCE_GTX670
}, /* Geforce 600 - midend high */
1787 {"GTX 660 Ti", CARD_NVIDIA_GEFORCE_GTX660TI
}, /* Geforce 600 - midend high */
1788 {"GTX 660M", CARD_NVIDIA_GEFORCE_GTX660M
}, /* Geforce 600 - midend high mobile */
1789 {"GTX 660", CARD_NVIDIA_GEFORCE_GTX660
}, /* Geforce 600 - midend high */
1790 {"GTX 650 Ti", CARD_NVIDIA_GEFORCE_GTX650TI
}, /* Geforce 600 - lowend */
1791 {"GTX 650", CARD_NVIDIA_GEFORCE_GTX650
}, /* Geforce 600 - lowend */
1792 {"GT 650M", CARD_NVIDIA_GEFORCE_GT650M
}, /* Geforce 600 - midend mobile */
1793 {"GT 640M", CARD_NVIDIA_GEFORCE_GT640M
}, /* Geforce 600 - midend mobile */
1794 {"GT 630M", CARD_NVIDIA_GEFORCE_GT630M
}, /* Geforce 600 - midend mobile */
1795 {"GT 630", CARD_NVIDIA_GEFORCE_GT630
}, /* Geforce 600 - lowend */
1796 {"GT 610", CARD_NVIDIA_GEFORCE_GT610
}, /* Geforce 600 - lowend */
1797 {"GTX 580", CARD_NVIDIA_GEFORCE_GTX580
}, /* Geforce 500 - highend */
1798 {"GTX 570", CARD_NVIDIA_GEFORCE_GTX570
}, /* Geforce 500 - midend high */
1799 {"GTX 560 Ti", CARD_NVIDIA_GEFORCE_GTX560TI
}, /* Geforce 500 - midend */
1800 {"GTX 560", CARD_NVIDIA_GEFORCE_GTX560
}, /* Geforce 500 - midend */
1801 {"GT 555M", CARD_NVIDIA_GEFORCE_GT555M
}, /* Geforce 500 - midend mobile */
1802 {"GTX 550 Ti", CARD_NVIDIA_GEFORCE_GTX550
}, /* Geforce 500 - midend */
1803 {"GT 540M", CARD_NVIDIA_GEFORCE_GT540M
}, /* Geforce 500 - midend mobile */
1804 {"GT 520", CARD_NVIDIA_GEFORCE_GT520
}, /* Geforce 500 - lowend */
1805 {"GTX 480", CARD_NVIDIA_GEFORCE_GTX480
}, /* Geforce 400 - highend */
1806 {"GTX 470", CARD_NVIDIA_GEFORCE_GTX470
}, /* Geforce 400 - midend high */
1808 {"GTX 465", CARD_NVIDIA_GEFORCE_GTX465
}, /* Geforce 400 - midend */
1809 {"GTX 460M", CARD_NVIDIA_GEFORCE_GTX460M
}, /* Geforce 400 - highend mobile */
1810 {"GTX 460", CARD_NVIDIA_GEFORCE_GTX460
}, /* Geforce 400 - midend */
1811 {"GTS 450", CARD_NVIDIA_GEFORCE_GTS450
}, /* Geforce 400 - midend low */
1812 {"GT 440", CARD_NVIDIA_GEFORCE_GT440
}, /* Geforce 400 - lowend */
1813 {"GT 430", CARD_NVIDIA_GEFORCE_GT430
}, /* Geforce 400 - lowend */
1814 {"GT 425M", CARD_NVIDIA_GEFORCE_GT425M
}, /* Geforce 400 - lowend mobile */
1815 {"GT 420", CARD_NVIDIA_GEFORCE_GT420
}, /* Geforce 400 - lowend */
1816 {"410M", CARD_NVIDIA_GEFORCE_410M
}, /* Geforce 400 - lowend mobile */
1817 {"GT 330", CARD_NVIDIA_GEFORCE_GT330
}, /* Geforce 300 - highend */
1818 {"GTS 360M", CARD_NVIDIA_GEFORCE_GTS350M
}, /* Geforce 300 - highend mobile */
1819 {"GTS 350M", CARD_NVIDIA_GEFORCE_GTS350M
}, /* Geforce 300 - highend mobile */
1820 {"GT 330M", CARD_NVIDIA_GEFORCE_GT325M
}, /* Geforce 300 - midend mobile */
1821 {"GT 325M", CARD_NVIDIA_GEFORCE_GT325M
}, /* Geforce 300 - midend mobile */
1822 {"GT 320M", CARD_NVIDIA_GEFORCE_GT320M
}, /* Geforce 300 - midend mobile */
1823 {"320M", CARD_NVIDIA_GEFORCE_320M
}, /* Geforce 300 - midend mobile */
1824 {"315M", CARD_NVIDIA_GEFORCE_315M
}, /* Geforce 300 - midend mobile */
1825 {"GTX 295", CARD_NVIDIA_GEFORCE_GTX280
}, /* Geforce 200 - highend */
1826 {"GTX 285", CARD_NVIDIA_GEFORCE_GTX280
}, /* Geforce 200 - highend */
1827 {"GTX 280", CARD_NVIDIA_GEFORCE_GTX280
}, /* Geforce 200 - highend */
1828 {"GTX 275", CARD_NVIDIA_GEFORCE_GTX275
}, /* Geforce 200 - midend high */
1829 {"GTX 260", CARD_NVIDIA_GEFORCE_GTX260
}, /* Geforce 200 - midend */
1830 {"GT 240", CARD_NVIDIA_GEFORCE_GT240
}, /* Geforce 200 - midend */
1831 {"GT 220", CARD_NVIDIA_GEFORCE_GT220
}, /* Geforce 200 - lowend */
1832 {"GeForce 310", CARD_NVIDIA_GEFORCE_210
}, /* Geforce 200 - lowend */
1833 {"GeForce 305", CARD_NVIDIA_GEFORCE_210
}, /* Geforce 200 - lowend */
1834 {"GeForce 210", CARD_NVIDIA_GEFORCE_210
}, /* Geforce 200 - lowend */
1835 {"G 210", CARD_NVIDIA_GEFORCE_210
}, /* Geforce 200 - lowend */
1836 {"GTS 250", CARD_NVIDIA_GEFORCE_9800GT
}, /* Geforce 9 - highend / Geforce 200 - midend */
1837 {"GTS 150", CARD_NVIDIA_GEFORCE_9800GT
}, /* Geforce 9 - highend / Geforce 200 - midend */
1838 {"9800", CARD_NVIDIA_GEFORCE_9800GT
}, /* Geforce 9 - highend / Geforce 200 - midend */
1839 {"9700M GT", CARD_NVIDIA_GEFORCE_9700MGT
}, /* Geforce 9 - midend */
1840 {"GT 140", CARD_NVIDIA_GEFORCE_9600GT
}, /* Geforce 9 - midend */
1841 {"9600", CARD_NVIDIA_GEFORCE_9600GT
}, /* Geforce 9 - midend */
1842 {"GT 130", CARD_NVIDIA_GEFORCE_9500GT
}, /* Geforce 9 - midend low / Geforce 200 - low */
1843 {"GT 120", CARD_NVIDIA_GEFORCE_9500GT
}, /* Geforce 9 - midend low / Geforce 200 - low */
1844 {"9500", CARD_NVIDIA_GEFORCE_9500GT
}, /* Geforce 9 - midend low / Geforce 200 - low */
1845 {"9400M", CARD_NVIDIA_GEFORCE_9400M
}, /* Geforce 9 - lowend */
1846 {"9400", CARD_NVIDIA_GEFORCE_9400GT
}, /* Geforce 9 - lowend */
1847 {"9300", CARD_NVIDIA_GEFORCE_9300
}, /* Geforce 9 - lowend low */
1848 {"9200", CARD_NVIDIA_GEFORCE_9200
}, /* Geforce 9 - lowend low */
1849 {"9100", CARD_NVIDIA_GEFORCE_9200
}, /* Geforce 9 - lowend low */
1850 {"G 100", CARD_NVIDIA_GEFORCE_9200
}, /* Geforce 9 - lowend low */
1851 {"8800 GTX", CARD_NVIDIA_GEFORCE_8800GTX
}, /* Geforce 8 - highend high */
1852 {"8800", CARD_NVIDIA_GEFORCE_8800GTS
}, /* Geforce 8 - highend */
1853 {"8600M", CARD_NVIDIA_GEFORCE_8600MGT
}, /* Geforce 8 - midend mobile */
1854 {"8600 M", CARD_NVIDIA_GEFORCE_8600MGT
}, /* Geforce 8 - midend mobile */
1855 {"8700", CARD_NVIDIA_GEFORCE_8600GT
}, /* Geforce 8 - midend */
1856 {"8600", CARD_NVIDIA_GEFORCE_8600GT
}, /* Geforce 8 - midend */
1857 {"8500", CARD_NVIDIA_GEFORCE_8500GT
}, /* Geforce 8 - mid-lowend */
1858 {"8400", CARD_NVIDIA_GEFORCE_8400GS
}, /* Geforce 8 - mid-lowend */
1859 {"8300", CARD_NVIDIA_GEFORCE_8300GS
}, /* Geforce 8 - lowend */
1860 {"8200", CARD_NVIDIA_GEFORCE_8200
}, /* Geforce 8 - lowend */
1861 {"8100", CARD_NVIDIA_GEFORCE_8200
}, /* Geforce 8 - lowend */
1862 /* Direct 3D 9 SM3 */
1863 {"Quadro FX 5", CARD_NVIDIA_GEFORCE_7800GT
}, /* Geforce 7 - highend */
1864 {"Quadro FX 4", CARD_NVIDIA_GEFORCE_7800GT
}, /* Geforce 7 - highend */
1865 {"7950", CARD_NVIDIA_GEFORCE_7800GT
}, /* Geforce 7 - highend */
1866 {"7900", CARD_NVIDIA_GEFORCE_7800GT
}, /* Geforce 7 - highend */
1867 {"7800", CARD_NVIDIA_GEFORCE_7800GT
}, /* Geforce 7 - highend */
1868 {"7700", CARD_NVIDIA_GEFORCE_7600
}, /* Geforce 7 - midend */
1869 {"7600", CARD_NVIDIA_GEFORCE_7600
}, /* Geforce 7 - midend */
1870 {"7400", CARD_NVIDIA_GEFORCE_7400
}, /* Geforce 7 - lower medium */
1871 {"7300", CARD_NVIDIA_GEFORCE_7300
}, /* Geforce 7 - lowend */
1872 {"6800", CARD_NVIDIA_GEFORCE_6800
}, /* Geforce 6 - highend */
1873 {"6700", CARD_NVIDIA_GEFORCE_6600GT
}, /* Geforce 6 - midend */
1874 {"6610", CARD_NVIDIA_GEFORCE_6600GT
}, /* Geforce 6 - midend */
1875 {"6600", CARD_NVIDIA_GEFORCE_6600GT
}, /* Geforce 6 - midend */
1876 /* Direct 3D 9 SM2 */
1877 {"Quadro FX", CARD_NVIDIA_GEFORCEFX_5800
}, /* GeforceFX - highend */
1878 {"5950", CARD_NVIDIA_GEFORCEFX_5800
}, /* GeforceFX - highend */
1879 {"5900", CARD_NVIDIA_GEFORCEFX_5800
}, /* GeforceFX - highend */
1880 {"5800", CARD_NVIDIA_GEFORCEFX_5800
}, /* GeforceFX - highend */
1881 {"5750", CARD_NVIDIA_GEFORCEFX_5600
}, /* GeforceFX - midend */
1882 {"5700", CARD_NVIDIA_GEFORCEFX_5600
}, /* GeforceFX - midend */
1883 {"5650", CARD_NVIDIA_GEFORCEFX_5600
}, /* GeforceFX - midend */
1884 {"5600", CARD_NVIDIA_GEFORCEFX_5600
}, /* GeforceFX - midend */
1885 {"5500", CARD_NVIDIA_GEFORCEFX_5200
}, /* GeforceFX - lowend */
1886 {"5300", CARD_NVIDIA_GEFORCEFX_5200
}, /* GeforceFX - lowend */
1887 {"5250", CARD_NVIDIA_GEFORCEFX_5200
}, /* GeforceFX - lowend */
1888 {"5200", CARD_NVIDIA_GEFORCEFX_5200
}, /* GeforceFX - lowend */
1889 {"5100", CARD_NVIDIA_GEFORCEFX_5200
}, /* GeforceFX - lowend */
1891 {"Quadro4", CARD_NVIDIA_GEFORCE4_TI4200
},
1892 {"GeForce4 Ti", CARD_NVIDIA_GEFORCE4_TI4200
}, /* Geforce4 Ti4200/Ti4400/Ti4600/Ti4800 */
1894 {"GeForce4 MX", CARD_NVIDIA_GEFORCE4_MX
}, /* MX420/MX440/MX460/MX4000 */
1895 {"Quadro2 MXR", CARD_NVIDIA_GEFORCE2_MX
},
1896 {"GeForce2 MX", CARD_NVIDIA_GEFORCE2_MX
}, /* Geforce2 standard/MX100/MX200/MX400 */
1897 {"Quadro2", CARD_NVIDIA_GEFORCE2
},
1898 {"GeForce2", CARD_NVIDIA_GEFORCE2
}, /* Geforce2 GTS/Pro/Ti/Ultra */
1900 {"TNT2", CARD_NVIDIA_RIVA_TNT2
}, /* Riva TNT2 standard/M64/Pro/Ultra */
1902 /* See http://developer.amd.com/resources/hardware-drivers/ati-catalyst-pc-vendor-id-1002-li/
1904 * Beware: renderer string do not match exact card model,
1905 * eg HD 4800 is returned for multiple cards, even for RV790 based ones. */
1906 cards_amd_binary
[] =
1908 /* Southern Islands */
1909 {"HD 7900", CARD_AMD_RADEON_HD7900
},
1910 {"HD 7800", CARD_AMD_RADEON_HD7800
},
1911 {"HD 7700", CARD_AMD_RADEON_HD7700
},
1912 /* Northern Islands */
1913 {"HD 6970", CARD_AMD_RADEON_HD6900
},
1914 {"HD 6900", CARD_AMD_RADEON_HD6900
},
1915 {"HD 6800", CARD_AMD_RADEON_HD6800
},
1916 {"HD 6770M", CARD_AMD_RADEON_HD6600M
},
1917 {"HD 6750M", CARD_AMD_RADEON_HD6600M
},
1918 {"HD 6700", CARD_AMD_RADEON_HD6700
},
1919 {"HD 6670", CARD_AMD_RADEON_HD6600
},
1920 {"HD 6630M", CARD_AMD_RADEON_HD6600M
},
1921 {"HD 6600M", CARD_AMD_RADEON_HD6600M
},
1922 {"HD 6600", CARD_AMD_RADEON_HD6600
},
1923 {"HD 6570", CARD_AMD_RADEON_HD6600
},
1924 {"HD 6500M", CARD_AMD_RADEON_HD6600M
},
1925 {"HD 6500", CARD_AMD_RADEON_HD6600
},
1926 {"HD 6400", CARD_AMD_RADEON_HD6400
},
1927 {"HD 6300", CARD_AMD_RADEON_HD6300
},
1928 {"HD 6200", CARD_AMD_RADEON_HD6300
},
1930 {"HD 5870", CARD_AMD_RADEON_HD5800
}, /* Radeon EG CYPRESS PRO */
1931 {"HD 5850", CARD_AMD_RADEON_HD5800
}, /* Radeon EG CYPRESS XT */
1932 {"HD 5800", CARD_AMD_RADEON_HD5800
}, /* Radeon EG CYPRESS HD58xx generic renderer string */
1933 {"HD 5770", CARD_AMD_RADEON_HD5700
}, /* Radeon EG JUNIPER XT */
1934 {"HD 5750", CARD_AMD_RADEON_HD5700
}, /* Radeon EG JUNIPER LE */
1935 {"HD 5700", CARD_AMD_RADEON_HD5700
}, /* Radeon EG JUNIPER HD57xx generic renderer string */
1936 {"HD 5670", CARD_AMD_RADEON_HD5600
}, /* Radeon EG REDWOOD XT */
1937 {"HD 5570", CARD_AMD_RADEON_HD5600
}, /* Radeon EG REDWOOD PRO mapped to HD5600 series */
1938 {"HD 5550", CARD_AMD_RADEON_HD5600
}, /* Radeon EG REDWOOD LE mapped to HD5600 series */
1939 {"HD 5450", CARD_AMD_RADEON_HD5400
}, /* Radeon EG CEDAR PRO */
1940 {"HD 5000", CARD_AMD_RADEON_HD5600
}, /* Defaulting to HD 5600 */
1942 {"HD 4890", CARD_AMD_RADEON_HD4800
}, /* Radeon RV790 */
1943 {"HD 4870", CARD_AMD_RADEON_HD4800
}, /* Radeon RV770 */
1944 {"HD 4850", CARD_AMD_RADEON_HD4800
}, /* Radeon RV770 */
1945 {"HD 4830", CARD_AMD_RADEON_HD4800
}, /* Radeon RV770 */
1946 {"HD 4800", CARD_AMD_RADEON_HD4800
}, /* Radeon RV7xx HD48xx generic renderer string */
1947 {"HD 4770", CARD_AMD_RADEON_HD4700
}, /* Radeon RV740 */
1948 {"HD 4700", CARD_AMD_RADEON_HD4700
}, /* Radeon RV7xx HD47xx generic renderer string */
1949 {"HD 4670", CARD_AMD_RADEON_HD4600
}, /* Radeon RV730 */
1950 {"HD 4650", CARD_AMD_RADEON_HD4600
}, /* Radeon RV730 */
1951 {"HD 4600", CARD_AMD_RADEON_HD4600
}, /* Radeon RV730 */
1952 {"HD 4550", CARD_AMD_RADEON_HD4350
}, /* Radeon RV710 */
1953 {"HD 4350", CARD_AMD_RADEON_HD4350
}, /* Radeon RV710 */
1954 /* R600/R700 integrated */
1955 {"HD 4200M", CARD_AMD_RADEON_HD4200M
},
1956 {"HD 3300", CARD_AMD_RADEON_HD3200
},
1957 {"HD 3200", CARD_AMD_RADEON_HD3200
},
1958 {"HD 3100", CARD_AMD_RADEON_HD3200
},
1960 {"HD 3870", CARD_AMD_RADEON_HD2900
}, /* HD2900/HD3800 - highend */
1961 {"HD 3850", CARD_AMD_RADEON_HD2900
}, /* HD2900/HD3800 - highend */
1962 {"HD 2900", CARD_AMD_RADEON_HD2900
}, /* HD2900/HD3800 - highend */
1963 {"HD 3830", CARD_AMD_RADEON_HD2600
}, /* China-only midend */
1964 {"HD 3690", CARD_AMD_RADEON_HD2600
}, /* HD2600/HD3600 - midend */
1965 {"HD 3650", CARD_AMD_RADEON_HD2600
}, /* HD2600/HD3600 - midend */
1966 {"HD 2600", CARD_AMD_RADEON_HD2600
}, /* HD2600/HD3600 - midend */
1967 {"HD 3470", CARD_AMD_RADEON_HD2350
}, /* HD2350/HD2400/HD3400 - lowend */
1968 {"HD 3450", CARD_AMD_RADEON_HD2350
}, /* HD2350/HD2400/HD3400 - lowend */
1969 {"HD 3430", CARD_AMD_RADEON_HD2350
}, /* HD2350/HD2400/HD3400 - lowend */
1970 {"HD 3400", CARD_AMD_RADEON_HD2350
}, /* HD2350/HD2400/HD3400 - lowend */
1971 {"HD 2400", CARD_AMD_RADEON_HD2350
}, /* HD2350/HD2400/HD3400 - lowend */
1972 {"HD 2350", CARD_AMD_RADEON_HD2350
}, /* HD2350/HD2400/HD3400 - lowend */
1974 {"X1950", CARD_AMD_RADEON_X1600
},
1975 {"X1900", CARD_AMD_RADEON_X1600
},
1976 {"X1800", CARD_AMD_RADEON_X1600
},
1977 {"X1650", CARD_AMD_RADEON_X1600
},
1978 {"X1600", CARD_AMD_RADEON_X1600
},
1979 /* Radeon R4xx + X1300/X1400/X1450/X1550/X2300/X2500/HD2300 (lowend R5xx)
1980 * Note X2300/X2500/HD2300 are R5xx GPUs with a 2xxx naming but they are still DX9-only */
1981 {"HD 2300", CARD_AMD_RADEON_X700
},
1982 {"X2500", CARD_AMD_RADEON_X700
},
1983 {"X2300", CARD_AMD_RADEON_X700
},
1984 {"X1550", CARD_AMD_RADEON_X700
},
1985 {"X1450", CARD_AMD_RADEON_X700
},
1986 {"X1400", CARD_AMD_RADEON_X700
},
1987 {"X1300", CARD_AMD_RADEON_X700
},
1988 {"X850", CARD_AMD_RADEON_X700
},
1989 {"X800", CARD_AMD_RADEON_X700
},
1990 {"X700", CARD_AMD_RADEON_X700
},
1991 /* Radeon Xpress Series - onboard, DX9b, Shader 2.0, 300-400 MHz */
1992 {"Radeon Xpress", CARD_AMD_RADEON_XPRESS_200M
},
1997 {"Haswell Mobile", CARD_INTEL_HWM
},
1999 {"Ivybridge Server", CARD_INTEL_IVBS
},
2000 {"Ivybridge Mobile", CARD_INTEL_IVBM
},
2001 {"Ivybridge Desktop", CARD_INTEL_IVBD
},
2002 {"HD Graphics 4000", CARD_INTEL_IVBD
}, /* MacOS */
2004 {"Sandybridge Server", CARD_INTEL_SNBS
},
2005 {"Sandybridge Mobile", CARD_INTEL_SNBM
},
2006 {"Sandybridge Desktop", CARD_INTEL_SNBD
},
2008 {"Ironlake Mobile", CARD_INTEL_ILKM
},
2009 {"Ironlake Desktop", CARD_INTEL_ILKD
},
2011 {"B43", CARD_INTEL_B43
},
2012 {"G41", CARD_INTEL_G41
},
2013 {"G45", CARD_INTEL_G45
},
2014 {"Q45", CARD_INTEL_Q45
},
2015 {"Integrated Graphics Device", CARD_INTEL_IGD
},
2016 {"GM45", CARD_INTEL_GM45
},
2018 {"965GME", CARD_INTEL_965GME
},
2019 {"965GM", CARD_INTEL_965GM
},
2020 {"X3100", CARD_INTEL_965GM
}, /* MacOS */
2021 {"946GZ", CARD_INTEL_946GZ
},
2022 {"965G", CARD_INTEL_965G
},
2023 {"965Q", CARD_INTEL_965Q
},
2025 {"Pineview M", CARD_INTEL_PNVM
},
2026 {"Pineview G", CARD_INTEL_PNVG
},
2027 {"IGD", CARD_INTEL_PNVG
},
2028 {"Q33", CARD_INTEL_Q33
},
2029 {"G33", CARD_INTEL_G33
},
2030 {"Q35", CARD_INTEL_Q35
},
2031 {"945GME", CARD_INTEL_945GME
},
2032 {"945GM", CARD_INTEL_945GM
},
2033 {"GMA 950", CARD_INTEL_945GM
}, /* MacOS */
2034 {"945G", CARD_INTEL_945G
},
2036 {"915GM", CARD_INTEL_915GM
},
2037 {"E7221G", CARD_INTEL_E7221G
},
2038 {"915G", CARD_INTEL_915G
},
2040 {"865G", CARD_INTEL_865G
},
2041 {"845G", CARD_INTEL_845G
},
2042 {"855GM", CARD_INTEL_855GM
},
2043 {"830M", CARD_INTEL_830M
},
2045 /* 20101109 - These are never returned by current Gallium radeon
2046 * drivers: R700, RV790, R680, RV535, RV516, R410, RS485, RV360, RV351.
2048 * These are returned but not handled: RC410, RV380. */
2052 {"HAWAII", CARD_AMD_RADEON_R9
},
2053 {"KAVERI", CARD_AMD_RADEON_R7
},
2054 {"KABINI", CARD_AMD_RADEON_R3
},
2055 {"BONAIRE", CARD_AMD_RADEON_HD8770
},
2056 /* Southern Islands */
2057 {"OLAND", CARD_AMD_RADEON_HD8670
},
2058 {"HAINAN", CARD_AMD_RADEON_HD8600M
},
2059 {"TAHITI", CARD_AMD_RADEON_HD7900
},
2060 {"PITCAIRN", CARD_AMD_RADEON_HD7800
},
2061 {"CAPE VERDE", CARD_AMD_RADEON_HD7700
},
2062 /* Northern Islands */
2063 {"ARUBA", CARD_AMD_RADEON_HD7660D
},
2064 {"CAYMAN", CARD_AMD_RADEON_HD6900
},
2065 {"BARTS", CARD_AMD_RADEON_HD6800
},
2066 {"TURKS", CARD_AMD_RADEON_HD6600
},
2067 {"SUMO2", CARD_AMD_RADEON_HD6410D
}, /* SUMO2 first, because we do a strstr(). */
2068 {"SUMO", CARD_AMD_RADEON_HD6550D
},
2069 {"CAICOS", CARD_AMD_RADEON_HD6400
},
2070 {"PALM", CARD_AMD_RADEON_HD6300
},
2072 {"HEMLOCK", CARD_AMD_RADEON_HD5900
},
2073 {"CYPRESS", CARD_AMD_RADEON_HD5800
},
2074 {"JUNIPER", CARD_AMD_RADEON_HD5700
},
2075 {"REDWOOD", CARD_AMD_RADEON_HD5600
},
2076 {"CEDAR", CARD_AMD_RADEON_HD5400
},
2078 {"R700", CARD_AMD_RADEON_HD4800
},
2079 {"RV790", CARD_AMD_RADEON_HD4800
},
2080 {"RV770", CARD_AMD_RADEON_HD4800
},
2081 {"RV740", CARD_AMD_RADEON_HD4700
},
2082 {"RV730", CARD_AMD_RADEON_HD4600
},
2083 {"RV710", CARD_AMD_RADEON_HD4350
},
2084 /* R600/R700 integrated */
2085 {"RS880", CARD_AMD_RADEON_HD4200M
},
2086 {"RS780", CARD_AMD_RADEON_HD3200
},
2088 {"R680", CARD_AMD_RADEON_HD2900
},
2089 {"R600", CARD_AMD_RADEON_HD2900
},
2090 {"RV670", CARD_AMD_RADEON_HD3850
},
2091 {"RV635", CARD_AMD_RADEON_HD2600
},
2092 {"RV630", CARD_AMD_RADEON_HD2600
},
2093 {"RV620", CARD_AMD_RADEON_HD2350
},
2094 {"RV610", CARD_AMD_RADEON_HD2350
},
2096 {"R580", CARD_AMD_RADEON_X1600
},
2097 {"R520", CARD_AMD_RADEON_X1600
},
2098 {"RV570", CARD_AMD_RADEON_X1600
},
2099 {"RV560", CARD_AMD_RADEON_X1600
},
2100 {"RV535", CARD_AMD_RADEON_X1600
},
2101 {"RV530", CARD_AMD_RADEON_X1600
},
2102 {"RV516", CARD_AMD_RADEON_X700
},
2103 {"RV515", CARD_AMD_RADEON_X700
},
2105 {"R481", CARD_AMD_RADEON_X700
},
2106 {"R480", CARD_AMD_RADEON_X700
},
2107 {"R430", CARD_AMD_RADEON_X700
},
2108 {"R423", CARD_AMD_RADEON_X700
},
2109 {"R420", CARD_AMD_RADEON_X700
},
2110 {"R410", CARD_AMD_RADEON_X700
},
2111 {"RV410", CARD_AMD_RADEON_X700
},
2112 /* Radeon Xpress - onboard, DX9b, Shader 2.0, 300-400 MHz */
2113 {"RS740", CARD_AMD_RADEON_XPRESS_200M
},
2114 {"RS690", CARD_AMD_RADEON_XPRESS_200M
},
2115 {"RS600", CARD_AMD_RADEON_XPRESS_200M
},
2116 {"RS485", CARD_AMD_RADEON_XPRESS_200M
},
2117 {"RS482", CARD_AMD_RADEON_XPRESS_200M
},
2118 {"RS480", CARD_AMD_RADEON_XPRESS_200M
},
2119 {"RS400", CARD_AMD_RADEON_XPRESS_200M
},
2121 {"R360", CARD_AMD_RADEON_9500
},
2122 {"R350", CARD_AMD_RADEON_9500
},
2123 {"R300", CARD_AMD_RADEON_9500
},
2124 {"RV370", CARD_AMD_RADEON_9500
},
2125 {"RV360", CARD_AMD_RADEON_9500
},
2126 {"RV351", CARD_AMD_RADEON_9500
},
2127 {"RV350", CARD_AMD_RADEON_9500
},
2129 cards_nvidia_mesa
[] =
2132 {"NV124", CARD_NVIDIA_GEFORCE_GTX970
},
2133 {"NV118", CARD_NVIDIA_GEFORCE_840M
},
2134 {"NV117", CARD_NVIDIA_GEFORCE_GTX750
},
2136 {"NVF1", CARD_NVIDIA_GEFORCE_GTX780TI
},
2137 {"NVF0", CARD_NVIDIA_GEFORCE_GTX780
},
2138 {"NVE6", CARD_NVIDIA_GEFORCE_GTX770M
},
2139 {"NVE4", CARD_NVIDIA_GEFORCE_GTX680
},
2141 {"NVD9", CARD_NVIDIA_GEFORCE_GT520
},
2142 {"NVD7", CARD_NVIDIA_GEFORCE_820M
},
2143 {"NVCF", CARD_NVIDIA_GEFORCE_GTX550
},
2144 {"NVCE", CARD_NVIDIA_GEFORCE_GTX560
},
2145 {"NVC8", CARD_NVIDIA_GEFORCE_GTX570
},
2146 {"NVC4", CARD_NVIDIA_GEFORCE_GTX460
},
2147 {"NVC3", CARD_NVIDIA_GEFORCE_GT440
},
2148 {"NVC1", CARD_NVIDIA_GEFORCE_GT420
},
2149 {"NVC0", CARD_NVIDIA_GEFORCE_GTX480
},
2151 {"NVAF", CARD_NVIDIA_GEFORCE_GT320M
},
2152 {"NVAC", CARD_NVIDIA_GEFORCE_8200
},
2153 {"NVAA", CARD_NVIDIA_GEFORCE_8200
}, /* 8100 */
2154 {"NVA8", CARD_NVIDIA_GEFORCE_210
},
2155 {"NVA5", CARD_NVIDIA_GEFORCE_GT220
},
2156 {"NVA3", CARD_NVIDIA_GEFORCE_GT240
},
2157 {"NVA0", CARD_NVIDIA_GEFORCE_GTX280
},
2158 {"NV98", CARD_NVIDIA_GEFORCE_9200
},
2159 {"NV96", CARD_NVIDIA_GEFORCE_9400GT
},
2160 {"NV94", CARD_NVIDIA_GEFORCE_9600GT
},
2161 {"NV92", CARD_NVIDIA_GEFORCE_9800GT
},
2162 {"NV86", CARD_NVIDIA_GEFORCE_8500GT
},
2163 {"NV84", CARD_NVIDIA_GEFORCE_8600GT
},
2164 {"NV50", CARD_NVIDIA_GEFORCE_8800GTX
},
2166 {"NV68", CARD_NVIDIA_GEFORCE_6200
}, /* 7050 */
2167 {"NV67", CARD_NVIDIA_GEFORCE_6200
}, /* 7000M */
2168 {"NV63", CARD_NVIDIA_GEFORCE_6200
}, /* 7100 */
2169 {"NV4E", CARD_NVIDIA_GEFORCE_6200
}, /* 6100 Go / 6150 Go */
2170 {"NV4C", CARD_NVIDIA_GEFORCE_6200
}, /* 6150SE */
2171 {"NV4B", CARD_NVIDIA_GEFORCE_7600
},
2172 {"NV4A", CARD_NVIDIA_GEFORCE_6200
},
2173 {"NV49", CARD_NVIDIA_GEFORCE_7800GT
}, /* 7900 */
2174 {"NV47", CARD_NVIDIA_GEFORCE_7800GT
},
2175 {"NV46", CARD_NVIDIA_GEFORCE_7400
},
2176 {"NV45", CARD_NVIDIA_GEFORCE_6800
},
2177 {"NV44", CARD_NVIDIA_GEFORCE_6200
},
2178 {"NV43", CARD_NVIDIA_GEFORCE_6600GT
},
2179 {"NV42", CARD_NVIDIA_GEFORCE_6800
},
2180 {"NV41", CARD_NVIDIA_GEFORCE_6800
},
2181 {"NV40", CARD_NVIDIA_GEFORCE_6800
},
2183 {"NV38", CARD_NVIDIA_GEFORCEFX_5800
}, /* FX 5950 Ultra */
2184 {"NV36", CARD_NVIDIA_GEFORCEFX_5800
}, /* FX 5700/5750 */
2185 {"NV35", CARD_NVIDIA_GEFORCEFX_5800
}, /* FX 5900 */
2186 {"NV34", CARD_NVIDIA_GEFORCEFX_5200
},
2187 {"NV31", CARD_NVIDIA_GEFORCEFX_5600
},
2188 {"NV30", CARD_NVIDIA_GEFORCEFX_5800
},
2190 {"nv28", CARD_NVIDIA_GEFORCE4_TI4200
},
2191 {"nv25", CARD_NVIDIA_GEFORCE4_TI4200
},
2192 {"nv20", CARD_NVIDIA_GEFORCE3
},
2194 {"nv1F", CARD_NVIDIA_GEFORCE4_MX
}, /* GF4 MX IGP */
2195 {"nv1A", CARD_NVIDIA_GEFORCE2
}, /* GF2 IGP */
2196 {"nv18", CARD_NVIDIA_GEFORCE4_MX
},
2197 {"nv17", CARD_NVIDIA_GEFORCE4_MX
},
2198 {"nv16", CARD_NVIDIA_GEFORCE2
},
2199 {"nv15", CARD_NVIDIA_GEFORCE2
},
2200 {"nv11", CARD_NVIDIA_GEFORCE2_MX
},
2201 {"nv10", CARD_NVIDIA_GEFORCE
},
2203 {"nv05", CARD_NVIDIA_RIVA_TNT2
},
2204 {"nv04", CARD_NVIDIA_RIVA_TNT
},
2205 {"nv03", CARD_NVIDIA_RIVA_128
},
2209 {"SVGA3D", CARD_VMWARE_SVGA3D
},
2212 static const struct gl_vendor_selection
2214 enum wined3d_gl_vendor gl_vendor
;
2215 const char *description
; /* Description of the card selector i.e. Apple OS/X Intel */
2216 const struct wined3d_renderer_table
*cards
; /* To be used as cards[], pointer to the first member in an array */
2217 size_t cards_size
; /* Number of entries in the array above */
2219 amd_gl_vendor_table
[] =
2221 {GL_VENDOR_APPLE
, "Apple OSX AMD/ATI binary driver", cards_amd_binary
, ARRAY_SIZE(cards_amd_binary
)},
2222 {GL_VENDOR_FGLRX
, "AMD/ATI binary driver", cards_amd_binary
, ARRAY_SIZE(cards_amd_binary
)},
2223 {GL_VENDOR_MESA
, "Mesa AMD/ATI driver", cards_amd_mesa
, ARRAY_SIZE(cards_amd_mesa
)},
2225 nvidia_gl_vendor_table
[] =
2227 {GL_VENDOR_APPLE
, "Apple OSX NVidia binary driver", cards_nvidia_binary
, ARRAY_SIZE(cards_nvidia_binary
)},
2228 {GL_VENDOR_MESA
, "Mesa Nouveau driver", cards_nvidia_mesa
, ARRAY_SIZE(cards_nvidia_mesa
)},
2229 {GL_VENDOR_NVIDIA
, "Nvidia binary driver", cards_nvidia_binary
, ARRAY_SIZE(cards_nvidia_binary
)},
2231 vmware_gl_vendor_table
[] =
2233 {GL_VENDOR_MESA
, "VMware driver", cards_vmware
, ARRAY_SIZE(cards_vmware
)},
2235 intel_gl_vendor_table
[] =
2237 {GL_VENDOR_APPLE
, "Apple OSX Intel binary driver", cards_intel
, ARRAY_SIZE(cards_intel
)},
2238 {GL_VENDOR_MESA
, "Mesa Intel driver", cards_intel
, ARRAY_SIZE(cards_intel
)},
2241 static const enum wined3d_pci_device
2242 card_fallback_nvidia
[] =
2244 CARD_NVIDIA_RIVA_128
, /* D3D5 */
2245 CARD_NVIDIA_RIVA_TNT
, /* D3D6 */
2246 CARD_NVIDIA_GEFORCE
, /* D3D7 */
2247 CARD_NVIDIA_GEFORCE3
, /* D3D8 */
2248 CARD_NVIDIA_GEFORCEFX_5800
, /* D3D9_SM2 */
2249 CARD_NVIDIA_GEFORCE_6800
, /* D3D9_SM3 */
2250 CARD_NVIDIA_GEFORCE_8800GTX
, /* D3D10 */
2251 CARD_NVIDIA_GEFORCE_GTX470
, /* D3D11 */
2253 card_fallback_amd
[] =
2255 CARD_AMD_RAGE_128PRO
, /* D3D5 */
2256 CARD_AMD_RAGE_128PRO
, /* D3D6 */
2257 CARD_AMD_RADEON_7200
, /* D3D7 */
2258 CARD_AMD_RADEON_8500
, /* D3D8 */
2259 CARD_AMD_RADEON_9500
, /* D3D9_SM2 */
2260 CARD_AMD_RADEON_X1600
, /* D3D9_SM3 */
2261 CARD_AMD_RADEON_HD2900
, /* D3D10 */
2262 CARD_AMD_RADEON_HD5600
, /* D3D11 */
2264 card_fallback_intel
[] =
2266 CARD_INTEL_845G
, /* D3D5 */
2267 CARD_INTEL_845G
, /* D3D6 */
2268 CARD_INTEL_845G
, /* D3D7 */
2269 CARD_INTEL_915G
, /* D3D8 */
2270 CARD_INTEL_915G
, /* D3D9_SM2 */
2271 CARD_INTEL_945G
, /* D3D9_SM3 */
2272 CARD_INTEL_G45
, /* D3D10 */
2273 CARD_INTEL_IVBD
, /* D3D11 */
2275 C_ASSERT(ARRAY_SIZE(card_fallback_nvidia
) == WINED3D_D3D_LEVEL_COUNT
);
2276 C_ASSERT(ARRAY_SIZE(card_fallback_amd
) == WINED3D_D3D_LEVEL_COUNT
);
2277 C_ASSERT(ARRAY_SIZE(card_fallback_intel
) == WINED3D_D3D_LEVEL_COUNT
);
2279 static enum wined3d_pci_device
select_card_handler(const struct gl_vendor_selection
*table
,
2280 unsigned int table_size
, enum wined3d_gl_vendor gl_vendor
, const char *gl_renderer
)
2284 for (i
= 0; i
< table_size
; ++i
)
2286 if (table
[i
].gl_vendor
!= gl_vendor
)
2289 TRACE("Applying card selector \"%s\".\n", table
[i
].description
);
2291 for (j
= 0; j
< table
[i
].cards_size
; ++j
)
2293 if (strstr(gl_renderer
, table
[i
].cards
[j
].renderer
))
2294 return table
[i
].cards
[j
].id
;
2296 return PCI_DEVICE_NONE
;
2298 FIXME("Couldn't find a suitable card selector for GL vendor %04x (using GL_RENDERER %s)\n",
2299 gl_vendor
, debugstr_a(gl_renderer
));
2301 return PCI_DEVICE_NONE
;
2306 enum wined3d_pci_vendor card_vendor
;
2307 const char *description
; /* Description of the card selector i.e. Apple OS/X Intel */
2308 const struct gl_vendor_selection
*gl_vendor_selection
;
2309 unsigned int gl_vendor_count
;
2310 const enum wined3d_pci_device
*card_fallback
; /* An array with D3D_LEVEL_COUNT elements */
2312 card_vendor_table
[] =
2314 {HW_VENDOR_AMD
, "AMD", amd_gl_vendor_table
,
2315 sizeof(amd_gl_vendor_table
) / sizeof(*amd_gl_vendor_table
),
2317 {HW_VENDOR_NVIDIA
, "Nvidia", nvidia_gl_vendor_table
,
2318 sizeof(nvidia_gl_vendor_table
) / sizeof(*nvidia_gl_vendor_table
),
2319 card_fallback_nvidia
},
2320 {HW_VENDOR_VMWARE
, "VMware", vmware_gl_vendor_table
,
2321 sizeof(vmware_gl_vendor_table
) / sizeof(*vmware_gl_vendor_table
),
2323 {HW_VENDOR_INTEL
, "Intel", intel_gl_vendor_table
,
2324 sizeof(intel_gl_vendor_table
) / sizeof(*intel_gl_vendor_table
),
2325 card_fallback_intel
},
2329 static enum wined3d_pci_device
wined3d_guess_card(const struct shader_caps
*shader_caps
, const struct fragment_caps
*fragment_caps
,
2330 DWORD glsl_version
, const char *gl_renderer
, enum wined3d_gl_vendor
*gl_vendor
, enum wined3d_pci_vendor
*card_vendor
)
2332 /* A Direct3D device object contains the PCI id (vendor + device) of the
2333 * videocard which is used for rendering. Various applications use this
2334 * information to get a rough estimation of the features of the card and
2335 * some might use it for enabling 3d effects only on certain types of
2336 * videocards. In some cases games might even use it to work around bugs
2337 * which happen on certain videocards/driver combinations. The problem is
2338 * that OpenGL only exposes a rendering string containing the name of the
2339 * videocard and not the PCI id.
2341 * Various games depend on the PCI id, so somehow we need to provide one.
2342 * A simple option is to parse the renderer string and translate this to
2343 * the right PCI id. This is a lot of work because there are more than 200
2344 * GPUs just for Nvidia. Various cards share the same renderer string, so
2345 * the amount of code might be 'small' but there are quite a number of
2346 * exceptions which would make this a pain to maintain. Another way would
2347 * be to query the PCI id from the operating system (assuming this is the
2348 * videocard which is used for rendering which is not always the case).
2349 * This would work but it is not very portable. Second it would not work
2350 * well in, let's say, a remote X situation in which the amount of 3d
2351 * features which can be used is limited.
2353 * As said most games only use the PCI id to get an indication of the
2354 * capabilities of the card. It doesn't really matter if the given id is
2355 * the correct one if we return the id of a card with similar 3d features.
2357 * The code below checks the OpenGL capabilities of a videocard and matches
2358 * that to a certain level of Direct3D functionality. Once a card passes
2359 * the Direct3D9 check, we know that the card (in case of Nvidia) is at
2360 * least a GeforceFX. To give a better estimate we do a basic check on the
2361 * renderer string but if that won't pass we return a default card. This
2362 * way is better than maintaining a full card database as even without a
2363 * full database we can return a card with similar features. Second the
2364 * size of the database can be made quite small because when you know what
2365 * type of 3d functionality a card has, you know to which GPU family the
2366 * GPU must belong. Because of this you only have to check a small part of
2367 * the renderer string to distinguish between different models from that
2370 * The code also selects a default amount of video memory which we will
2371 * use for an estimation of the amount of free texture memory. In case of
2372 * real D3D the amount of texture memory includes video memory and system
2373 * memory (to be specific AGP memory or in case of PCIE TurboCache /
2374 * HyperMemory). We don't know how much system memory can be addressed by
2375 * the system but we can make a reasonable estimation about the amount of
2376 * video memory. If the value is slightly wrong it doesn't matter as we
2377 * didn't include AGP-like memory which makes the amount of addressable
2378 * memory higher and second OpenGL isn't that critical it moves to system
2379 * memory behind our backs if really needed. Note that the amount of video
2380 * memory can be overruled using a registry setting. */
2383 enum wined3d_d3d_level d3d_level
= d3d_level_from_caps(shader_caps
, fragment_caps
, glsl_version
);
2384 enum wined3d_pci_device device
;
2386 for (i
= 0; i
< (sizeof(card_vendor_table
) / sizeof(*card_vendor_table
)); ++i
)
2388 if (card_vendor_table
[i
].card_vendor
!= *card_vendor
)
2391 TRACE("Applying card selector \"%s\".\n", card_vendor_table
[i
].description
);
2392 device
= select_card_handler(card_vendor_table
[i
].gl_vendor_selection
,
2393 card_vendor_table
[i
].gl_vendor_count
, *gl_vendor
, gl_renderer
);
2394 if (device
!= PCI_DEVICE_NONE
)
2397 TRACE("Unrecognized renderer %s, falling back to default.\n", debugstr_a(gl_renderer
));
2398 return card_vendor_table
[i
].card_fallback
[d3d_level
];
2401 FIXME("No card selector available for card vendor %04x (using GL_RENDERER %s).\n",
2402 *card_vendor
, debugstr_a(gl_renderer
));
2404 /* Default to generic Nvidia hardware based on the supported OpenGL extensions. */
2405 *card_vendor
= HW_VENDOR_NVIDIA
;
2406 return card_fallback_nvidia
[d3d_level
];
2409 static const struct wined3d_vertex_pipe_ops
*select_vertex_implementation(const struct wined3d_gl_info
*gl_info
,
2410 const struct wined3d_shader_backend_ops
*shader_backend_ops
)
2412 if (shader_backend_ops
== &glsl_shader_backend
)
2413 return &glsl_vertex_pipe
;
2414 return &ffp_vertex_pipe
;
2417 static const struct fragment_pipeline
*select_fragment_implementation(const struct wined3d_gl_info
*gl_info
,
2418 const struct wined3d_shader_backend_ops
*shader_backend_ops
)
2420 if (shader_backend_ops
== &glsl_shader_backend
)
2421 return &glsl_fragment_pipe
;
2422 if (shader_backend_ops
== &arb_program_shader_backend
&& gl_info
->supported
[ARB_FRAGMENT_PROGRAM
])
2423 return &arbfp_fragment_pipeline
;
2424 if (gl_info
->supported
[ATI_FRAGMENT_SHADER
])
2425 return &atifs_fragment_pipeline
;
2426 if (gl_info
->supported
[NV_REGISTER_COMBINERS
] && gl_info
->supported
[NV_TEXTURE_SHADER2
])
2427 return &nvts_fragment_pipeline
;
2428 if (gl_info
->supported
[NV_REGISTER_COMBINERS
])
2429 return &nvrc_fragment_pipeline
;
2430 return &ffp_fragment_pipeline
;
2433 static const struct wined3d_shader_backend_ops
*select_shader_backend(const struct wined3d_gl_info
*gl_info
)
2435 BOOL glsl
= wined3d_settings
.glslRequested
&& gl_info
->glsl_version
>= MAKEDWORD_VERSION(1, 20);
2437 if (glsl
&& gl_info
->supported
[ARB_FRAGMENT_SHADER
])
2438 return &glsl_shader_backend
;
2439 if (glsl
&& gl_info
->supported
[ARB_VERTEX_SHADER
])
2441 /* Geforce4 cards support GLSL but for vertex shaders only. Further
2442 * its reported GLSL caps are wrong. This combined with the fact that
2443 * GLSL won't offer more features or performance, use ARB shaders only
2445 if (gl_info
->supported
[NV_VERTEX_PROGRAM
] && !gl_info
->supported
[NV_VERTEX_PROGRAM2
])
2446 return &arb_program_shader_backend
;
2447 return &glsl_shader_backend
;
2449 if (gl_info
->supported
[ARB_VERTEX_PROGRAM
] || gl_info
->supported
[ARB_FRAGMENT_PROGRAM
])
2450 return &arb_program_shader_backend
;
2451 return &none_shader_backend
;
2454 static const struct blit_shader
*select_blit_implementation(const struct wined3d_gl_info
*gl_info
,
2455 const struct wined3d_shader_backend_ops
*shader_backend_ops
)
2457 if ((shader_backend_ops
== &glsl_shader_backend
2458 || shader_backend_ops
== &arb_program_shader_backend
)
2459 && gl_info
->supported
[ARB_FRAGMENT_PROGRAM
])
2464 static void parse_extension_string(struct wined3d_gl_info
*gl_info
, const char *extensions
,
2465 const struct wined3d_extension_map
*map
, UINT entry_count
)
2473 while (isspace(*extensions
))
2476 while (!isspace(*extensions
) && *extensions
)
2479 len
= extensions
- start
;
2483 TRACE("- %s.\n", debugstr_an(start
, len
));
2485 for (i
= 0; i
< entry_count
; ++i
)
2487 if (len
== strlen(map
[i
].extension_string
)
2488 && !memcmp(start
, map
[i
].extension_string
, len
))
2490 TRACE(" FOUND: %s support.\n", map
[i
].extension_string
);
2491 gl_info
->supported
[map
[i
].extension
] = TRUE
;
2498 static void enumerate_gl_extensions(struct wined3d_gl_info
*gl_info
,
2499 const struct wined3d_extension_map
*map
, unsigned int map_entries_count
)
2501 const char *gl_extension_name
;
2503 GLint extensions_count
;
2505 glGetIntegerv(GL_NUM_EXTENSIONS
, &extensions_count
);
2506 for (i
= 0; i
< extensions_count
; ++i
)
2508 gl_extension_name
= (const char *)GL_EXTCALL(glGetStringi(GL_EXTENSIONS
, i
));
2509 TRACE("- %s.\n", debugstr_a(gl_extension_name
));
2510 for (j
= 0; j
< map_entries_count
; ++j
)
2512 if (!strcmp(gl_extension_name
, map
[j
].extension_string
))
2514 TRACE("FOUND: %s support.\n", map
[j
].extension_string
);
2515 gl_info
->supported
[map
[j
].extension
] = TRUE
;
2522 static void load_gl_funcs(struct wined3d_gl_info
*gl_info
)
2524 #define USE_GL_FUNC(pfn) gl_info->gl_ops.ext.p_##pfn = (void *)wglGetProcAddress(#pfn);
2525 /* GL_APPLE_fence */
2526 USE_GL_FUNC(glDeleteFencesAPPLE
)
2527 USE_GL_FUNC(glFinishFenceAPPLE
)
2528 USE_GL_FUNC(glFinishObjectAPPLE
)
2529 USE_GL_FUNC(glGenFencesAPPLE
)
2530 USE_GL_FUNC(glIsFenceAPPLE
)
2531 USE_GL_FUNC(glSetFenceAPPLE
)
2532 USE_GL_FUNC(glTestFenceAPPLE
)
2533 USE_GL_FUNC(glTestObjectAPPLE
)
2534 /* GL_APPLE_flush_buffer_range */
2535 USE_GL_FUNC(glBufferParameteriAPPLE
)
2536 USE_GL_FUNC(glFlushMappedBufferRangeAPPLE
)
2537 /* GL_ARB_blend_func_extended */
2538 USE_GL_FUNC(glBindFragDataLocationIndexed
)
2539 USE_GL_FUNC(glGetFragDataIndex
)
2540 /* GL_ARB_color_buffer_float */
2541 USE_GL_FUNC(glClampColorARB
)
2542 /* GL_ARB_copy_buffer */
2543 USE_GL_FUNC(glCopyBufferSubData
)
2544 /* GL_ARB_debug_output */
2545 USE_GL_FUNC(glDebugMessageCallbackARB
)
2546 USE_GL_FUNC(glDebugMessageControlARB
)
2547 USE_GL_FUNC(glDebugMessageInsertARB
)
2548 USE_GL_FUNC(glGetDebugMessageLogARB
)
2549 /* GL_ARB_draw_buffers */
2550 USE_GL_FUNC(glDrawBuffersARB
)
2551 /* GL_ARB_draw_elements_base_vertex */
2552 USE_GL_FUNC(glDrawElementsBaseVertex
)
2553 USE_GL_FUNC(glDrawElementsInstancedBaseVertex
)
2554 USE_GL_FUNC(glDrawRangeElementsBaseVertex
)
2555 USE_GL_FUNC(glMultiDrawElementsBaseVertex
)
2556 /* GL_ARB_draw_instanced */
2557 USE_GL_FUNC(glDrawArraysInstancedARB
)
2558 USE_GL_FUNC(glDrawElementsInstancedARB
)
2559 /* GL_ARB_ES2_compatibility */
2560 USE_GL_FUNC(glReleaseShaderCompiler
)
2561 USE_GL_FUNC(glShaderBinary
)
2562 USE_GL_FUNC(glGetShaderPrecisionFormat
)
2563 USE_GL_FUNC(glDepthRangef
)
2564 USE_GL_FUNC(glClearDepthf
)
2565 /* GL_ARB_framebuffer_object */
2566 USE_GL_FUNC(glBindFramebuffer
)
2567 USE_GL_FUNC(glBindRenderbuffer
)
2568 USE_GL_FUNC(glBlitFramebuffer
)
2569 USE_GL_FUNC(glCheckFramebufferStatus
)
2570 USE_GL_FUNC(glDeleteFramebuffers
)
2571 USE_GL_FUNC(glDeleteRenderbuffers
)
2572 USE_GL_FUNC(glFramebufferRenderbuffer
)
2573 USE_GL_FUNC(glFramebufferTexture1D
)
2574 USE_GL_FUNC(glFramebufferTexture2D
)
2575 USE_GL_FUNC(glFramebufferTexture3D
)
2576 USE_GL_FUNC(glFramebufferTextureLayer
)
2577 USE_GL_FUNC(glGenFramebuffers
)
2578 USE_GL_FUNC(glGenRenderbuffers
)
2579 USE_GL_FUNC(glGenerateMipmap
)
2580 USE_GL_FUNC(glGetFramebufferAttachmentParameteriv
)
2581 USE_GL_FUNC(glGetRenderbufferParameteriv
)
2582 USE_GL_FUNC(glIsFramebuffer
)
2583 USE_GL_FUNC(glIsRenderbuffer
)
2584 USE_GL_FUNC(glRenderbufferStorage
)
2585 USE_GL_FUNC(glRenderbufferStorageMultisample
)
2586 /* GL_ARB_geometry_shader4 */
2587 USE_GL_FUNC(glFramebufferTextureARB
)
2588 USE_GL_FUNC(glFramebufferTextureFaceARB
)
2589 USE_GL_FUNC(glFramebufferTextureLayerARB
)
2590 USE_GL_FUNC(glProgramParameteriARB
)
2591 /* GL_ARB_instanced_arrays */
2592 USE_GL_FUNC(glVertexAttribDivisorARB
)
2593 /* GL_ARB_internalformat_query */
2594 USE_GL_FUNC(glGetInternalformativ
)
2595 /* GL_ARB_internalformat_query2 */
2596 USE_GL_FUNC(glGetInternalformati64v
)
2597 /* GL_ARB_map_buffer_range */
2598 USE_GL_FUNC(glFlushMappedBufferRange
)
2599 USE_GL_FUNC(glMapBufferRange
)
2600 /* GL_ARB_multisample */
2601 USE_GL_FUNC(glSampleCoverageARB
)
2602 /* GL_ARB_multitexture */
2603 USE_GL_FUNC(glActiveTextureARB
)
2604 USE_GL_FUNC(glClientActiveTextureARB
)
2605 USE_GL_FUNC(glMultiTexCoord1fARB
)
2606 USE_GL_FUNC(glMultiTexCoord1fvARB
)
2607 USE_GL_FUNC(glMultiTexCoord2fARB
)
2608 USE_GL_FUNC(glMultiTexCoord2fvARB
)
2609 USE_GL_FUNC(glMultiTexCoord2svARB
)
2610 USE_GL_FUNC(glMultiTexCoord3fARB
)
2611 USE_GL_FUNC(glMultiTexCoord3fvARB
)
2612 USE_GL_FUNC(glMultiTexCoord4fARB
)
2613 USE_GL_FUNC(glMultiTexCoord4fvARB
)
2614 USE_GL_FUNC(glMultiTexCoord4svARB
)
2615 /* GL_ARB_occlusion_query */
2616 USE_GL_FUNC(glBeginQueryARB
)
2617 USE_GL_FUNC(glDeleteQueriesARB
)
2618 USE_GL_FUNC(glEndQueryARB
)
2619 USE_GL_FUNC(glGenQueriesARB
)
2620 USE_GL_FUNC(glGetQueryivARB
)
2621 USE_GL_FUNC(glGetQueryObjectivARB
)
2622 USE_GL_FUNC(glGetQueryObjectuivARB
)
2623 USE_GL_FUNC(glIsQueryARB
)
2624 /* GL_ARB_point_parameters */
2625 USE_GL_FUNC(glPointParameterfARB
)
2626 USE_GL_FUNC(glPointParameterfvARB
)
2627 /* GL_ARB_provoking_vertex */
2628 USE_GL_FUNC(glProvokingVertex
)
2629 /* GL_ARB_sampler_objects */
2630 USE_GL_FUNC(glGenSamplers
)
2631 USE_GL_FUNC(glDeleteSamplers
)
2632 USE_GL_FUNC(glIsSampler
)
2633 USE_GL_FUNC(glBindSampler
)
2634 USE_GL_FUNC(glSamplerParameteri
)
2635 USE_GL_FUNC(glSamplerParameterf
)
2636 USE_GL_FUNC(glSamplerParameteriv
)
2637 USE_GL_FUNC(glSamplerParameterfv
)
2638 USE_GL_FUNC(glSamplerParameterIiv
)
2639 USE_GL_FUNC(glSamplerParameterIuiv
)
2640 USE_GL_FUNC(glGetSamplerParameteriv
)
2641 USE_GL_FUNC(glGetSamplerParameterfv
)
2642 USE_GL_FUNC(glGetSamplerParameterIiv
)
2643 USE_GL_FUNC(glGetSamplerParameterIuiv
)
2644 /* GL_ARB_shader_objects */
2645 USE_GL_FUNC(glAttachObjectARB
)
2646 USE_GL_FUNC(glBindAttribLocationARB
)
2647 USE_GL_FUNC(glCompileShaderARB
)
2648 USE_GL_FUNC(glCreateProgramObjectARB
)
2649 USE_GL_FUNC(glCreateShaderObjectARB
)
2650 USE_GL_FUNC(glDeleteObjectARB
)
2651 USE_GL_FUNC(glDetachObjectARB
)
2652 USE_GL_FUNC(glGetActiveUniformARB
)
2653 USE_GL_FUNC(glGetAttachedObjectsARB
)
2654 USE_GL_FUNC(glGetAttribLocationARB
)
2655 USE_GL_FUNC(glGetHandleARB
)
2656 USE_GL_FUNC(glGetInfoLogARB
)
2657 USE_GL_FUNC(glGetObjectParameterfvARB
)
2658 USE_GL_FUNC(glGetObjectParameterivARB
)
2659 USE_GL_FUNC(glGetShaderSourceARB
)
2660 USE_GL_FUNC(glGetUniformLocationARB
)
2661 USE_GL_FUNC(glGetUniformfvARB
)
2662 USE_GL_FUNC(glGetUniformivARB
)
2663 USE_GL_FUNC(glLinkProgramARB
)
2664 USE_GL_FUNC(glShaderSourceARB
)
2665 USE_GL_FUNC(glUniform1fARB
)
2666 USE_GL_FUNC(glUniform1fvARB
)
2667 USE_GL_FUNC(glUniform1iARB
)
2668 USE_GL_FUNC(glUniform1ivARB
)
2669 USE_GL_FUNC(glUniform2fARB
)
2670 USE_GL_FUNC(glUniform2fvARB
)
2671 USE_GL_FUNC(glUniform2iARB
)
2672 USE_GL_FUNC(glUniform2ivARB
)
2673 USE_GL_FUNC(glUniform3fARB
)
2674 USE_GL_FUNC(glUniform3fvARB
)
2675 USE_GL_FUNC(glUniform3iARB
)
2676 USE_GL_FUNC(glUniform3ivARB
)
2677 USE_GL_FUNC(glUniform4fARB
)
2678 USE_GL_FUNC(glUniform4fvARB
)
2679 USE_GL_FUNC(glUniform4iARB
)
2680 USE_GL_FUNC(glUniform4ivARB
)
2681 USE_GL_FUNC(glUniformMatrix2fvARB
)
2682 USE_GL_FUNC(glUniformMatrix3fvARB
)
2683 USE_GL_FUNC(glUniformMatrix4fvARB
)
2684 USE_GL_FUNC(glUseProgramObjectARB
)
2685 USE_GL_FUNC(glValidateProgramARB
)
2687 USE_GL_FUNC(glClientWaitSync
)
2688 USE_GL_FUNC(glDeleteSync
)
2689 USE_GL_FUNC(glFenceSync
)
2690 USE_GL_FUNC(glGetInteger64v
)
2691 USE_GL_FUNC(glGetSynciv
)
2692 USE_GL_FUNC(glIsSync
)
2693 USE_GL_FUNC(glWaitSync
)
2694 /* GL_ARB_texture_compression */
2695 USE_GL_FUNC(glCompressedTexImage2DARB
)
2696 USE_GL_FUNC(glCompressedTexImage3DARB
)
2697 USE_GL_FUNC(glCompressedTexSubImage2DARB
)
2698 USE_GL_FUNC(glCompressedTexSubImage3DARB
)
2699 USE_GL_FUNC(glGetCompressedTexImageARB
)
2700 /* GL_ARB_timer_query */
2701 USE_GL_FUNC(glQueryCounter
)
2702 USE_GL_FUNC(glGetQueryObjectui64v
)
2703 /* GL_ARB_uniform_buffer_object */
2704 USE_GL_FUNC(glBindBufferBase
)
2705 USE_GL_FUNC(glBindBufferRange
)
2706 USE_GL_FUNC(glGetActiveUniformBlockName
)
2707 USE_GL_FUNC(glGetActiveUniformBlockiv
)
2708 USE_GL_FUNC(glGetActiveUniformName
)
2709 USE_GL_FUNC(glGetActiveUniformsiv
)
2710 USE_GL_FUNC(glGetIntegeri_v
)
2711 USE_GL_FUNC(glGetUniformBlockIndex
)
2712 USE_GL_FUNC(glGetUniformIndices
)
2713 USE_GL_FUNC(glUniformBlockBinding
)
2714 /* GL_ARB_vertex_blend */
2715 USE_GL_FUNC(glVertexBlendARB
)
2716 USE_GL_FUNC(glWeightPointerARB
)
2717 USE_GL_FUNC(glWeightbvARB
)
2718 USE_GL_FUNC(glWeightdvARB
)
2719 USE_GL_FUNC(glWeightfvARB
)
2720 USE_GL_FUNC(glWeightivARB
)
2721 USE_GL_FUNC(glWeightsvARB
)
2722 USE_GL_FUNC(glWeightubvARB
)
2723 USE_GL_FUNC(glWeightuivARB
)
2724 USE_GL_FUNC(glWeightusvARB
)
2725 /* GL_ARB_vertex_buffer_object */
2726 USE_GL_FUNC(glBindBufferARB
)
2727 USE_GL_FUNC(glBufferDataARB
)
2728 USE_GL_FUNC(glBufferSubDataARB
)
2729 USE_GL_FUNC(glDeleteBuffersARB
)
2730 USE_GL_FUNC(glGenBuffersARB
)
2731 USE_GL_FUNC(glGetBufferParameterivARB
)
2732 USE_GL_FUNC(glGetBufferPointervARB
)
2733 USE_GL_FUNC(glGetBufferSubDataARB
)
2734 USE_GL_FUNC(glIsBufferARB
)
2735 USE_GL_FUNC(glMapBufferARB
)
2736 USE_GL_FUNC(glUnmapBufferARB
)
2737 /* GL_ARB_vertex_program */
2738 USE_GL_FUNC(glBindProgramARB
)
2739 USE_GL_FUNC(glDeleteProgramsARB
)
2740 USE_GL_FUNC(glDisableVertexAttribArrayARB
)
2741 USE_GL_FUNC(glEnableVertexAttribArrayARB
)
2742 USE_GL_FUNC(glGenProgramsARB
)
2743 USE_GL_FUNC(glGetProgramivARB
)
2744 USE_GL_FUNC(glProgramEnvParameter4fvARB
)
2745 USE_GL_FUNC(glProgramLocalParameter4fvARB
)
2746 USE_GL_FUNC(glProgramStringARB
)
2747 USE_GL_FUNC(glVertexAttrib1dARB
)
2748 USE_GL_FUNC(glVertexAttrib1dvARB
)
2749 USE_GL_FUNC(glVertexAttrib1fARB
)
2750 USE_GL_FUNC(glVertexAttrib1fvARB
)
2751 USE_GL_FUNC(glVertexAttrib1sARB
)
2752 USE_GL_FUNC(glVertexAttrib1svARB
)
2753 USE_GL_FUNC(glVertexAttrib2dARB
)
2754 USE_GL_FUNC(glVertexAttrib2dvARB
)
2755 USE_GL_FUNC(glVertexAttrib2fARB
)
2756 USE_GL_FUNC(glVertexAttrib2fvARB
)
2757 USE_GL_FUNC(glVertexAttrib2sARB
)
2758 USE_GL_FUNC(glVertexAttrib2svARB
)
2759 USE_GL_FUNC(glVertexAttrib3dARB
)
2760 USE_GL_FUNC(glVertexAttrib3dvARB
)
2761 USE_GL_FUNC(glVertexAttrib3fARB
)
2762 USE_GL_FUNC(glVertexAttrib3fvARB
)
2763 USE_GL_FUNC(glVertexAttrib3sARB
)
2764 USE_GL_FUNC(glVertexAttrib3svARB
)
2765 USE_GL_FUNC(glVertexAttrib4NbvARB
)
2766 USE_GL_FUNC(glVertexAttrib4NivARB
)
2767 USE_GL_FUNC(glVertexAttrib4NsvARB
)
2768 USE_GL_FUNC(glVertexAttrib4NubARB
)
2769 USE_GL_FUNC(glVertexAttrib4NubvARB
)
2770 USE_GL_FUNC(glVertexAttrib4NuivARB
)
2771 USE_GL_FUNC(glVertexAttrib4NusvARB
)
2772 USE_GL_FUNC(glVertexAttrib4bvARB
)
2773 USE_GL_FUNC(glVertexAttrib4dARB
)
2774 USE_GL_FUNC(glVertexAttrib4dvARB
)
2775 USE_GL_FUNC(glVertexAttrib4fARB
)
2776 USE_GL_FUNC(glVertexAttrib4fvARB
)
2777 USE_GL_FUNC(glVertexAttrib4ivARB
)
2778 USE_GL_FUNC(glVertexAttrib4sARB
)
2779 USE_GL_FUNC(glVertexAttrib4svARB
)
2780 USE_GL_FUNC(glVertexAttrib4ubvARB
)
2781 USE_GL_FUNC(glVertexAttrib4uivARB
)
2782 USE_GL_FUNC(glVertexAttrib4usvARB
)
2783 USE_GL_FUNC(glVertexAttribPointerARB
)
2784 /* GL_ATI_fragment_shader */
2785 USE_GL_FUNC(glAlphaFragmentOp1ATI
)
2786 USE_GL_FUNC(glAlphaFragmentOp2ATI
)
2787 USE_GL_FUNC(glAlphaFragmentOp3ATI
)
2788 USE_GL_FUNC(glBeginFragmentShaderATI
)
2789 USE_GL_FUNC(glBindFragmentShaderATI
)
2790 USE_GL_FUNC(glColorFragmentOp1ATI
)
2791 USE_GL_FUNC(glColorFragmentOp2ATI
)
2792 USE_GL_FUNC(glColorFragmentOp3ATI
)
2793 USE_GL_FUNC(glDeleteFragmentShaderATI
)
2794 USE_GL_FUNC(glEndFragmentShaderATI
)
2795 USE_GL_FUNC(glGenFragmentShadersATI
)
2796 USE_GL_FUNC(glPassTexCoordATI
)
2797 USE_GL_FUNC(glSampleMapATI
)
2798 USE_GL_FUNC(glSetFragmentShaderConstantATI
)
2799 /* GL_ATI_separate_stencil */
2800 USE_GL_FUNC(glStencilOpSeparateATI
)
2801 USE_GL_FUNC(glStencilFuncSeparateATI
)
2802 /* GL_EXT_blend_color */
2803 USE_GL_FUNC(glBlendColorEXT
)
2804 /* GL_EXT_blend_equation_separate */
2805 USE_GL_FUNC(glBlendFuncSeparateEXT
)
2806 /* GL_EXT_blend_func_separate */
2807 USE_GL_FUNC(glBlendEquationSeparateEXT
)
2808 /* GL_EXT_blend_minmax */
2809 USE_GL_FUNC(glBlendEquationEXT
)
2810 /* GL_EXT_depth_bounds_test */
2811 USE_GL_FUNC(glDepthBoundsEXT
)
2812 /* GL_EXT_draw_buffers2 */
2813 USE_GL_FUNC(glColorMaskIndexedEXT
)
2814 USE_GL_FUNC(glDisableIndexedEXT
)
2815 USE_GL_FUNC(glEnableIndexedEXT
)
2816 USE_GL_FUNC(glGetBooleanIndexedvEXT
)
2817 USE_GL_FUNC(glGetIntegerIndexedvEXT
)
2818 USE_GL_FUNC(glIsEnabledIndexedEXT
)
2819 /* GL_EXT_fog_coord */
2820 USE_GL_FUNC(glFogCoordPointerEXT
)
2821 USE_GL_FUNC(glFogCoorddEXT
)
2822 USE_GL_FUNC(glFogCoorddvEXT
)
2823 USE_GL_FUNC(glFogCoordfEXT
)
2824 USE_GL_FUNC(glFogCoordfvEXT
)
2825 /* GL_EXT_framebuffer_blit */
2826 USE_GL_FUNC(glBlitFramebufferEXT
)
2827 /* GL_EXT_framebuffer_multisample */
2828 USE_GL_FUNC(glRenderbufferStorageMultisampleEXT
)
2829 /* GL_EXT_framebuffer_object */
2830 USE_GL_FUNC(glBindFramebufferEXT
)
2831 USE_GL_FUNC(glBindRenderbufferEXT
)
2832 USE_GL_FUNC(glCheckFramebufferStatusEXT
)
2833 USE_GL_FUNC(glDeleteFramebuffersEXT
)
2834 USE_GL_FUNC(glDeleteRenderbuffersEXT
)
2835 USE_GL_FUNC(glFramebufferRenderbufferEXT
)
2836 USE_GL_FUNC(glFramebufferTexture1DEXT
)
2837 USE_GL_FUNC(glFramebufferTexture2DEXT
)
2838 USE_GL_FUNC(glFramebufferTexture3DEXT
)
2839 USE_GL_FUNC(glGenFramebuffersEXT
)
2840 USE_GL_FUNC(glGenRenderbuffersEXT
)
2841 USE_GL_FUNC(glGenerateMipmapEXT
)
2842 USE_GL_FUNC(glGetFramebufferAttachmentParameterivEXT
)
2843 USE_GL_FUNC(glGetRenderbufferParameterivEXT
)
2844 USE_GL_FUNC(glIsFramebufferEXT
)
2845 USE_GL_FUNC(glIsRenderbufferEXT
)
2846 USE_GL_FUNC(glRenderbufferStorageEXT
)
2847 /* GL_EXT_gpu_program_parameters */
2848 USE_GL_FUNC(glProgramEnvParameters4fvEXT
)
2849 USE_GL_FUNC(glProgramLocalParameters4fvEXT
)
2850 /* GL_EXT_gpu_shader4 */
2851 USE_GL_FUNC(glBindFragDataLocationEXT
)
2852 USE_GL_FUNC(glGetFragDataLocationEXT
)
2853 USE_GL_FUNC(glGetUniformuivEXT
)
2854 USE_GL_FUNC(glGetVertexAttribIivEXT
)
2855 USE_GL_FUNC(glGetVertexAttribIuivEXT
)
2856 USE_GL_FUNC(glUniform1uiEXT
)
2857 USE_GL_FUNC(glUniform1uivEXT
)
2858 USE_GL_FUNC(glUniform2uiEXT
)
2859 USE_GL_FUNC(glUniform2uivEXT
)
2860 USE_GL_FUNC(glUniform3uiEXT
)
2861 USE_GL_FUNC(glUniform3uivEXT
)
2862 USE_GL_FUNC(glUniform4uiEXT
)
2863 USE_GL_FUNC(glUniform4uivEXT
)
2864 USE_GL_FUNC(glVertexAttribI1iEXT
)
2865 USE_GL_FUNC(glVertexAttribI1ivEXT
)
2866 USE_GL_FUNC(glVertexAttribI1uiEXT
)
2867 USE_GL_FUNC(glVertexAttribI1uivEXT
)
2868 USE_GL_FUNC(glVertexAttribI2iEXT
)
2869 USE_GL_FUNC(glVertexAttribI2ivEXT
)
2870 USE_GL_FUNC(glVertexAttribI2uiEXT
)
2871 USE_GL_FUNC(glVertexAttribI2uivEXT
)
2872 USE_GL_FUNC(glVertexAttribI3iEXT
)
2873 USE_GL_FUNC(glVertexAttribI3ivEXT
)
2874 USE_GL_FUNC(glVertexAttribI3uiEXT
)
2875 USE_GL_FUNC(glVertexAttribI3uivEXT
)
2876 USE_GL_FUNC(glVertexAttribI4bvEXT
)
2877 USE_GL_FUNC(glVertexAttribI4iEXT
)
2878 USE_GL_FUNC(glVertexAttribI4ivEXT
)
2879 USE_GL_FUNC(glVertexAttribI4svEXT
)
2880 USE_GL_FUNC(glVertexAttribI4ubvEXT
)
2881 USE_GL_FUNC(glVertexAttribI4uiEXT
)
2882 USE_GL_FUNC(glVertexAttribI4uivEXT
)
2883 USE_GL_FUNC(glVertexAttribI4usvEXT
)
2884 USE_GL_FUNC(glVertexAttribIPointerEXT
)
2885 /* GL_EXT_point_parameters */
2886 USE_GL_FUNC(glPointParameterfEXT
)
2887 USE_GL_FUNC(glPointParameterfvEXT
)
2888 /* GL_EXT_provoking_vertex */
2889 USE_GL_FUNC(glProvokingVertexEXT
)
2890 /* GL_EXT_secondary_color */
2891 USE_GL_FUNC(glSecondaryColor3fEXT
)
2892 USE_GL_FUNC(glSecondaryColor3fvEXT
)
2893 USE_GL_FUNC(glSecondaryColor3ubEXT
)
2894 USE_GL_FUNC(glSecondaryColor3ubvEXT
)
2895 USE_GL_FUNC(glSecondaryColorPointerEXT
)
2896 /* GL_EXT_stencil_two_side */
2897 USE_GL_FUNC(glActiveStencilFaceEXT
)
2898 /* GL_EXT_texture3D */
2899 USE_GL_FUNC(glTexImage3D
)
2900 USE_GL_FUNC(glTexImage3DEXT
)
2901 USE_GL_FUNC(glTexSubImage3D
)
2902 USE_GL_FUNC(glTexSubImage3DEXT
)
2904 USE_GL_FUNC(glDeleteFencesNV
)
2905 USE_GL_FUNC(glFinishFenceNV
)
2906 USE_GL_FUNC(glGenFencesNV
)
2907 USE_GL_FUNC(glGetFenceivNV
)
2908 USE_GL_FUNC(glIsFenceNV
)
2909 USE_GL_FUNC(glSetFenceNV
)
2910 USE_GL_FUNC(glTestFenceNV
)
2911 /* GL_NV_half_float */
2912 USE_GL_FUNC(glColor3hNV
)
2913 USE_GL_FUNC(glColor3hvNV
)
2914 USE_GL_FUNC(glColor4hNV
)
2915 USE_GL_FUNC(glColor4hvNV
)
2916 USE_GL_FUNC(glFogCoordhNV
)
2917 USE_GL_FUNC(glFogCoordhvNV
)
2918 USE_GL_FUNC(glMultiTexCoord1hNV
)
2919 USE_GL_FUNC(glMultiTexCoord1hvNV
)
2920 USE_GL_FUNC(glMultiTexCoord2hNV
)
2921 USE_GL_FUNC(glMultiTexCoord2hvNV
)
2922 USE_GL_FUNC(glMultiTexCoord3hNV
)
2923 USE_GL_FUNC(glMultiTexCoord3hvNV
)
2924 USE_GL_FUNC(glMultiTexCoord4hNV
)
2925 USE_GL_FUNC(glMultiTexCoord4hvNV
)
2926 USE_GL_FUNC(glNormal3hNV
)
2927 USE_GL_FUNC(glNormal3hvNV
)
2928 USE_GL_FUNC(glSecondaryColor3hNV
)
2929 USE_GL_FUNC(glSecondaryColor3hvNV
)
2930 USE_GL_FUNC(glTexCoord1hNV
)
2931 USE_GL_FUNC(glTexCoord1hvNV
)
2932 USE_GL_FUNC(glTexCoord2hNV
)
2933 USE_GL_FUNC(glTexCoord2hvNV
)
2934 USE_GL_FUNC(glTexCoord3hNV
)
2935 USE_GL_FUNC(glTexCoord3hvNV
)
2936 USE_GL_FUNC(glTexCoord4hNV
)
2937 USE_GL_FUNC(glTexCoord4hvNV
)
2938 USE_GL_FUNC(glVertex2hNV
)
2939 USE_GL_FUNC(glVertex2hvNV
)
2940 USE_GL_FUNC(glVertex3hNV
)
2941 USE_GL_FUNC(glVertex3hvNV
)
2942 USE_GL_FUNC(glVertex4hNV
)
2943 USE_GL_FUNC(glVertex4hvNV
)
2944 USE_GL_FUNC(glVertexAttrib1hNV
)
2945 USE_GL_FUNC(glVertexAttrib1hvNV
)
2946 USE_GL_FUNC(glVertexAttrib2hNV
)
2947 USE_GL_FUNC(glVertexAttrib2hvNV
)
2948 USE_GL_FUNC(glVertexAttrib3hNV
)
2949 USE_GL_FUNC(glVertexAttrib3hvNV
)
2950 USE_GL_FUNC(glVertexAttrib4hNV
)
2951 USE_GL_FUNC(glVertexAttrib4hvNV
)
2952 USE_GL_FUNC(glVertexAttribs1hvNV
)
2953 USE_GL_FUNC(glVertexAttribs2hvNV
)
2954 USE_GL_FUNC(glVertexAttribs3hvNV
)
2955 USE_GL_FUNC(glVertexAttribs4hvNV
)
2956 USE_GL_FUNC(glVertexWeighthNV
)
2957 USE_GL_FUNC(glVertexWeighthvNV
)
2958 /* GL_NV_point_sprite */
2959 USE_GL_FUNC(glPointParameteriNV
)
2960 USE_GL_FUNC(glPointParameterivNV
)
2961 /* GL_NV_register_combiners */
2962 USE_GL_FUNC(glCombinerInputNV
)
2963 USE_GL_FUNC(glCombinerOutputNV
)
2964 USE_GL_FUNC(glCombinerParameterfNV
)
2965 USE_GL_FUNC(glCombinerParameterfvNV
)
2966 USE_GL_FUNC(glCombinerParameteriNV
)
2967 USE_GL_FUNC(glCombinerParameterivNV
)
2968 USE_GL_FUNC(glFinalCombinerInputNV
)
2969 /* WGL extensions */
2970 USE_GL_FUNC(wglChoosePixelFormatARB
)
2971 USE_GL_FUNC(wglGetExtensionsStringARB
)
2972 USE_GL_FUNC(wglGetPixelFormatAttribfvARB
)
2973 USE_GL_FUNC(wglGetPixelFormatAttribivARB
)
2974 USE_GL_FUNC(wglQueryCurrentRendererIntegerWINE
)
2975 USE_GL_FUNC(wglQueryCurrentRendererStringWINE
)
2976 USE_GL_FUNC(wglQueryRendererIntegerWINE
)
2977 USE_GL_FUNC(wglQueryRendererStringWINE
)
2978 USE_GL_FUNC(wglSetPixelFormatWINE
)
2979 USE_GL_FUNC(wglSwapIntervalEXT
)
2981 /* Newer core functions */
2982 USE_GL_FUNC(glActiveTexture
) /* OpenGL 1.3 */
2983 USE_GL_FUNC(glAttachShader
) /* OpenGL 2.0 */
2984 USE_GL_FUNC(glBeginQuery
) /* OpenGL 1.5 */
2985 USE_GL_FUNC(glBindAttribLocation
) /* OpenGL 2.0 */
2986 USE_GL_FUNC(glBindBuffer
) /* OpenGL 1.5 */
2987 USE_GL_FUNC(glBindVertexArray
) /* OpenGL 3.0 */
2988 USE_GL_FUNC(glBlendColor
) /* OpenGL 1.4 */
2989 USE_GL_FUNC(glBlendEquation
) /* OpenGL 1.4 */
2990 USE_GL_FUNC(glBlendEquationSeparate
) /* OpenGL 2.0 */
2991 USE_GL_FUNC(glBlendFuncSeparate
) /* OpenGL 1.4 */
2992 USE_GL_FUNC(glBufferData
) /* OpenGL 1.5 */
2993 USE_GL_FUNC(glBufferSubData
) /* OpenGL 1.5 */
2994 USE_GL_FUNC(glColorMaski
) /* OpenGL 3.0 */
2995 USE_GL_FUNC(glCompileShader
) /* OpenGL 2.0 */
2996 USE_GL_FUNC(glCompressedTexImage2D
) /* OpenGL 1.3 */
2997 USE_GL_FUNC(glCompressedTexImage3D
) /* OpenGL 1.3 */
2998 USE_GL_FUNC(glCompressedTexSubImage2D
) /* OpenGL 1.3 */
2999 USE_GL_FUNC(glCompressedTexSubImage3D
) /* OpenGL 1.3 */
3000 USE_GL_FUNC(glCreateProgram
) /* OpenGL 2.0 */
3001 USE_GL_FUNC(glCreateShader
) /* OpenGL 2.0 */
3002 USE_GL_FUNC(glDebugMessageCallback
) /* OpenGL 4.3 */
3003 USE_GL_FUNC(glDebugMessageControl
) /* OpenGL 4.3 */
3004 USE_GL_FUNC(glDebugMessageInsert
) /* OpenGL 4.3 */
3005 USE_GL_FUNC(glDeleteBuffers
) /* OpenGL 1.5 */
3006 USE_GL_FUNC(glDeleteProgram
) /* OpenGL 2.0 */
3007 USE_GL_FUNC(glDeleteQueries
) /* OpenGL 1.5 */
3008 USE_GL_FUNC(glDeleteShader
) /* OpenGL 2.0 */
3009 USE_GL_FUNC(glDeleteVertexArrays
) /* OpenGL 3.0 */
3010 USE_GL_FUNC(glDetachShader
) /* OpenGL 2.0 */
3011 USE_GL_FUNC(glDisableVertexAttribArray
) /* OpenGL 2.0 */
3012 USE_GL_FUNC(glDrawArraysInstanced
) /* OpenGL 3.1 */
3013 USE_GL_FUNC(glDrawBuffers
) /* OpenGL 2.0 */
3014 USE_GL_FUNC(glDrawElementsInstanced
) /* OpenGL 3.1 */
3015 USE_GL_FUNC(glEnableVertexAttribArray
) /* OpenGL 2.0 */
3016 USE_GL_FUNC(glEndQuery
) /* OpenGL 1.5 */
3017 USE_GL_FUNC(glGenBuffers
) /* OpenGL 1.5 */
3018 USE_GL_FUNC(glGenQueries
) /* OpenGL 1.5 */
3019 USE_GL_FUNC(glGenVertexArrays
) /* OpenGL 3.0 */
3020 USE_GL_FUNC(glGetActiveUniform
) /* OpenGL 2.0 */
3021 USE_GL_FUNC(glGetAttachedShaders
) /* OpenGL 2.0 */
3022 USE_GL_FUNC(glGetAttribLocation
) /* OpenGL 2.0 */
3023 USE_GL_FUNC(glGetBufferSubData
) /* OpenGL 1.5 */
3024 USE_GL_FUNC(glGetCompressedTexImage
) /* OpenGL 1.3 */
3025 USE_GL_FUNC(glGetDebugMessageLog
) /* OpenGL 4.3 */
3026 USE_GL_FUNC(glGetProgramInfoLog
) /* OpenGL 2.0 */
3027 USE_GL_FUNC(glGetProgramiv
) /* OpenGL 2.0 */
3028 USE_GL_FUNC(glGetQueryiv
) /* OpenGL 1.5 */
3029 USE_GL_FUNC(glGetQueryObjectuiv
) /* OpenGL 1.5 */
3030 USE_GL_FUNC(glGetShaderInfoLog
) /* OpenGL 2.0 */
3031 USE_GL_FUNC(glGetShaderiv
) /* OpenGL 2.0 */
3032 USE_GL_FUNC(glGetShaderSource
) /* OpenGL 2.0 */
3033 USE_GL_FUNC(glGetStringi
) /* OpenGL 3.0 */
3034 USE_GL_FUNC(glGetUniformfv
) /* OpenGL 2.0 */
3035 USE_GL_FUNC(glGetUniformiv
) /* OpenGL 2.0 */
3036 USE_GL_FUNC(glGetUniformLocation
) /* OpenGL 2.0 */
3037 USE_GL_FUNC(glLinkProgram
) /* OpenGL 2.0 */
3038 USE_GL_FUNC(glMapBuffer
) /* OpenGL 1.5 */
3039 USE_GL_FUNC(glPointParameteri
) /* OpenGL 1.4 */
3040 USE_GL_FUNC(glPointParameteriv
) /* OpenGL 1.4 */
3041 USE_GL_FUNC(glShaderSource
) /* OpenGL 2.0 */
3042 USE_GL_FUNC(glStencilFuncSeparate
) /* OpenGL 2.0 */
3043 USE_GL_FUNC(glStencilOpSeparate
) /* OpenGL 2.0 */
3044 USE_GL_FUNC(glTexImage3D
) /* OpenGL 1.2 */
3045 USE_GL_FUNC(glTexSubImage3D
) /* OpenGL 1.2 */
3046 USE_GL_FUNC(glUniform1f
) /* OpenGL 2.0 */
3047 USE_GL_FUNC(glUniform1fv
) /* OpenGL 2.0 */
3048 USE_GL_FUNC(glUniform1i
) /* OpenGL 2.0 */
3049 USE_GL_FUNC(glUniform1iv
) /* OpenGL 2.0 */
3050 USE_GL_FUNC(glUniform2f
) /* OpenGL 2.0 */
3051 USE_GL_FUNC(glUniform2fv
) /* OpenGL 2.0 */
3052 USE_GL_FUNC(glUniform2i
) /* OpenGL 2.0 */
3053 USE_GL_FUNC(glUniform2iv
) /* OpenGL 2.0 */
3054 USE_GL_FUNC(glUniform3f
) /* OpenGL 2.0 */
3055 USE_GL_FUNC(glUniform3fv
) /* OpenGL 2.0 */
3056 USE_GL_FUNC(glUniform3i
) /* OpenGL 2.0 */
3057 USE_GL_FUNC(glUniform3iv
) /* OpenGL 2.0 */
3058 USE_GL_FUNC(glUniform4f
) /* OpenGL 2.0 */
3059 USE_GL_FUNC(glUniform4fv
) /* OpenGL 2.0 */
3060 USE_GL_FUNC(glUniform4i
) /* OpenGL 2.0 */
3061 USE_GL_FUNC(glUniform4iv
) /* OpenGL 2.0 */
3062 USE_GL_FUNC(glUniformMatrix2fv
) /* OpenGL 2.0 */
3063 USE_GL_FUNC(glUniformMatrix3fv
) /* OpenGL 2.0 */
3064 USE_GL_FUNC(glUniformMatrix4fv
) /* OpenGL 2.0 */
3065 USE_GL_FUNC(glUnmapBuffer
) /* OpenGL 1.5 */
3066 USE_GL_FUNC(glUseProgram
) /* OpenGL 2.0 */
3067 USE_GL_FUNC(glValidateProgram
) /* OpenGL 2.0 */
3068 USE_GL_FUNC(glVertexAttrib1f
) /* OpenGL 2.0 */
3069 USE_GL_FUNC(glVertexAttrib1fv
) /* OpenGL 2.0 */
3070 USE_GL_FUNC(glVertexAttrib2f
) /* OpenGL 2.0 */
3071 USE_GL_FUNC(glVertexAttrib2fv
) /* OpenGL 2.0 */
3072 USE_GL_FUNC(glVertexAttrib3f
) /* OpenGL 2.0 */
3073 USE_GL_FUNC(glVertexAttrib3fv
) /* OpenGL 2.0 */
3074 USE_GL_FUNC(glVertexAttrib4f
) /* OpenGL 2.0 */
3075 USE_GL_FUNC(glVertexAttrib4fv
) /* OpenGL 2.0 */
3076 USE_GL_FUNC(glVertexAttrib4Nsv
) /* OpenGL 2.0 */
3077 USE_GL_FUNC(glVertexAttrib4Nubv
) /* OpenGL 2.0 */
3078 USE_GL_FUNC(glVertexAttrib4Nusv
) /* OpenGL 2.0 */
3079 USE_GL_FUNC(glVertexAttrib4sv
) /* OpenGL 2.0 */
3080 USE_GL_FUNC(glVertexAttrib4ubv
) /* OpenGL 2.0 */
3081 USE_GL_FUNC(glVertexAttribDivisor
) /* OpenGL 3.3 */
3082 USE_GL_FUNC(glVertexAttribPointer
) /* OpenGL 2.0 */
3085 #ifndef USE_WIN32_OPENGL
3086 /* hack: use the functions directly from the TEB table to bypass the thunks */
3087 /* note that we still need the above wglGetProcAddress calls to initialize the table */
3088 gl_info
->gl_ops
.ext
= ((struct opengl_funcs
*)NtCurrentTeb()->glTable
)->ext
;
3091 #define MAP_GL_FUNCTION(core_func, ext_func) \
3094 if (!gl_info->gl_ops.ext.p_##core_func) \
3095 gl_info->gl_ops.ext.p_##core_func = gl_info->gl_ops.ext.p_##ext_func; \
3097 #define MAP_GL_FUNCTION_CAST(core_func, ext_func) \
3100 if (!gl_info->gl_ops.ext.p_##core_func) \
3101 gl_info->gl_ops.ext.p_##core_func = (void *)gl_info->gl_ops.ext.p_##ext_func; \
3104 MAP_GL_FUNCTION(glActiveTexture
, glActiveTextureARB
);
3105 MAP_GL_FUNCTION(glAttachShader
, glAttachObjectARB
);
3106 MAP_GL_FUNCTION(glBeginQuery
, glBeginQueryARB
);
3107 MAP_GL_FUNCTION(glBindAttribLocation
, glBindAttribLocationARB
);
3108 MAP_GL_FUNCTION(glBindBuffer
, glBindBufferARB
);
3109 MAP_GL_FUNCTION(glBlendColor
, glBlendColorEXT
);
3110 MAP_GL_FUNCTION(glBlendEquation
, glBlendEquationEXT
);
3111 MAP_GL_FUNCTION(glBlendEquationSeparate
, glBlendEquationSeparateEXT
);
3112 MAP_GL_FUNCTION(glBlendFuncSeparate
, glBlendFuncSeparateEXT
);
3113 MAP_GL_FUNCTION(glBufferData
, glBufferDataARB
);
3114 MAP_GL_FUNCTION(glBufferSubData
, glBufferSubDataARB
);
3115 MAP_GL_FUNCTION(glColorMaski
, glColorMaskIndexedEXT
);
3116 MAP_GL_FUNCTION(glCompileShader
, glCompileShaderARB
);
3117 MAP_GL_FUNCTION(glCompressedTexImage2D
, glCompressedTexImage2DARB
);
3118 MAP_GL_FUNCTION(glCompressedTexImage3D
, glCompressedTexImage3DARB
);
3119 MAP_GL_FUNCTION(glCompressedTexSubImage2D
, glCompressedTexSubImage2DARB
);
3120 MAP_GL_FUNCTION(glCompressedTexSubImage3D
, glCompressedTexSubImage3DARB
);
3121 MAP_GL_FUNCTION(glCreateProgram
, glCreateProgramObjectARB
);
3122 MAP_GL_FUNCTION(glCreateShader
, glCreateShaderObjectARB
);
3123 MAP_GL_FUNCTION(glDebugMessageCallback
, glDebugMessageCallbackARB
);
3124 MAP_GL_FUNCTION(glDebugMessageControl
, glDebugMessageControlARB
);
3125 MAP_GL_FUNCTION(glDebugMessageInsert
, glDebugMessageInsertARB
);
3126 MAP_GL_FUNCTION(glDeleteBuffers
, glDeleteBuffersARB
);
3127 MAP_GL_FUNCTION(glDeleteProgram
, glDeleteObjectARB
);
3128 MAP_GL_FUNCTION(glDeleteQueries
, glDeleteQueriesARB
);
3129 MAP_GL_FUNCTION(glDeleteShader
, glDeleteObjectARB
);
3130 MAP_GL_FUNCTION(glDetachShader
, glDetachObjectARB
);
3131 MAP_GL_FUNCTION(glDisableVertexAttribArray
, glDisableVertexAttribArrayARB
);
3132 MAP_GL_FUNCTION(glDrawArraysInstanced
, glDrawArraysInstancedARB
);
3133 MAP_GL_FUNCTION(glDrawBuffers
, glDrawBuffersARB
);
3134 MAP_GL_FUNCTION(glDrawElementsInstanced
, glDrawElementsInstancedARB
);
3135 MAP_GL_FUNCTION(glEnableVertexAttribArray
, glEnableVertexAttribArrayARB
);
3136 MAP_GL_FUNCTION(glEndQuery
, glEndQueryARB
);
3137 MAP_GL_FUNCTION(glGenBuffers
, glGenBuffersARB
);
3138 MAP_GL_FUNCTION(glGenQueries
, glGenQueriesARB
);
3139 MAP_GL_FUNCTION(glGetActiveUniform
, glGetActiveUniformARB
);
3140 MAP_GL_FUNCTION(glGetAttachedShaders
, glGetAttachedObjectsARB
);
3141 MAP_GL_FUNCTION(glGetAttribLocation
, glGetAttribLocationARB
);
3142 MAP_GL_FUNCTION(glGetBufferSubData
, glGetBufferSubDataARB
);
3143 MAP_GL_FUNCTION(glGetCompressedTexImage
, glGetCompressedTexImageARB
);
3144 MAP_GL_FUNCTION(glGetDebugMessageLog
, glGetDebugMessageLogARB
);
3145 MAP_GL_FUNCTION(glGetProgramInfoLog
, glGetInfoLogARB
);
3146 MAP_GL_FUNCTION(glGetProgramiv
, glGetObjectParameterivARB
);
3147 MAP_GL_FUNCTION(glGetQueryiv
, glGetQueryivARB
);
3148 MAP_GL_FUNCTION(glGetQueryObjectuiv
, glGetQueryObjectuivARB
);
3149 MAP_GL_FUNCTION(glGetShaderInfoLog
, glGetInfoLogARB
);
3150 MAP_GL_FUNCTION(glGetShaderiv
, glGetObjectParameterivARB
);
3151 MAP_GL_FUNCTION(glGetShaderSource
, glGetShaderSourceARB
);
3152 MAP_GL_FUNCTION(glGetUniformfv
, glGetUniformfvARB
);
3153 MAP_GL_FUNCTION(glGetUniformiv
, glGetUniformivARB
);
3154 MAP_GL_FUNCTION(glGetUniformLocation
, glGetUniformLocationARB
);
3155 MAP_GL_FUNCTION(glLinkProgram
, glLinkProgramARB
);
3156 MAP_GL_FUNCTION(glMapBuffer
, glMapBufferARB
);
3157 MAP_GL_FUNCTION_CAST(glShaderSource
, glShaderSourceARB
);
3158 MAP_GL_FUNCTION_CAST(glTexImage3D
, glTexImage3DEXT
);
3159 MAP_GL_FUNCTION(glTexSubImage3D
, glTexSubImage3DEXT
);
3160 MAP_GL_FUNCTION(glUniform1f
, glUniform1fARB
);
3161 MAP_GL_FUNCTION(glUniform1fv
, glUniform1fvARB
);
3162 MAP_GL_FUNCTION(glUniform1i
, glUniform1iARB
);
3163 MAP_GL_FUNCTION(glUniform1iv
, glUniform1ivARB
);
3164 MAP_GL_FUNCTION(glUniform2f
, glUniform2fARB
);
3165 MAP_GL_FUNCTION(glUniform2fv
, glUniform2fvARB
);
3166 MAP_GL_FUNCTION(glUniform2i
, glUniform2iARB
);
3167 MAP_GL_FUNCTION(glUniform2iv
, glUniform2ivARB
);
3168 MAP_GL_FUNCTION(glUniform3f
, glUniform3fARB
);
3169 MAP_GL_FUNCTION(glUniform3fv
, glUniform3fvARB
);
3170 MAP_GL_FUNCTION(glUniform3i
, glUniform3iARB
);
3171 MAP_GL_FUNCTION(glUniform3iv
, glUniform3ivARB
);
3172 MAP_GL_FUNCTION(glUniform4f
, glUniform4fARB
);
3173 MAP_GL_FUNCTION(glUniform4fv
, glUniform4fvARB
);
3174 MAP_GL_FUNCTION(glUniform4i
, glUniform4iARB
);
3175 MAP_GL_FUNCTION(glUniform4iv
, glUniform4ivARB
);
3176 MAP_GL_FUNCTION(glUniformMatrix2fv
, glUniformMatrix2fvARB
);
3177 MAP_GL_FUNCTION(glUniformMatrix3fv
, glUniformMatrix3fvARB
);
3178 MAP_GL_FUNCTION(glUniformMatrix4fv
, glUniformMatrix4fvARB
);
3179 MAP_GL_FUNCTION(glUnmapBuffer
, glUnmapBufferARB
);
3180 MAP_GL_FUNCTION(glUseProgram
, glUseProgramObjectARB
);
3181 MAP_GL_FUNCTION(glValidateProgram
, glValidateProgramARB
);
3182 MAP_GL_FUNCTION(glVertexAttrib1f
, glVertexAttrib1fARB
);
3183 MAP_GL_FUNCTION(glVertexAttrib1fv
, glVertexAttrib1fvARB
);
3184 MAP_GL_FUNCTION(glVertexAttrib2f
, glVertexAttrib2fARB
);
3185 MAP_GL_FUNCTION(glVertexAttrib2fv
, glVertexAttrib2fvARB
);
3186 MAP_GL_FUNCTION(glVertexAttrib3f
, glVertexAttrib3fARB
);
3187 MAP_GL_FUNCTION(glVertexAttrib3fv
, glVertexAttrib3fvARB
);
3188 MAP_GL_FUNCTION(glVertexAttrib4f
, glVertexAttrib4fARB
);
3189 MAP_GL_FUNCTION(glVertexAttrib4fv
, glVertexAttrib4fvARB
);
3190 MAP_GL_FUNCTION(glVertexAttrib4Nsv
, glVertexAttrib4NsvARB
);
3191 MAP_GL_FUNCTION(glVertexAttrib4Nubv
, glVertexAttrib4NubvARB
);
3192 MAP_GL_FUNCTION(glVertexAttrib4Nusv
, glVertexAttrib4NusvARB
);
3193 MAP_GL_FUNCTION(glVertexAttrib4sv
, glVertexAttrib4svARB
);
3194 MAP_GL_FUNCTION(glVertexAttrib4ubv
, glVertexAttrib4ubvARB
);
3195 MAP_GL_FUNCTION(glVertexAttribDivisor
, glVertexAttribDivisorARB
);
3196 MAP_GL_FUNCTION(glVertexAttribPointer
, glVertexAttribPointerARB
);
3197 #undef MAP_GL_FUNCTION
3198 #undef MAP_GL_FUNCTION_CAST
3201 static void wined3d_adapter_init_limits(struct wined3d_gl_info
*gl_info
)
3203 GLfloat gl_floatv
[2];
3206 gl_info
->limits
.blends
= 1;
3207 gl_info
->limits
.buffers
= 1;
3208 gl_info
->limits
.textures
= 1;
3209 gl_info
->limits
.texture_coords
= 1;
3210 gl_info
->limits
.vertex_uniform_blocks
= 0;
3211 gl_info
->limits
.geometry_uniform_blocks
= 0;
3212 gl_info
->limits
.fragment_uniform_blocks
= 0;
3213 gl_info
->limits
.fragment_samplers
= 1;
3214 gl_info
->limits
.vertex_samplers
= 0;
3215 gl_info
->limits
.combined_samplers
= gl_info
->limits
.fragment_samplers
+ gl_info
->limits
.vertex_samplers
;
3216 gl_info
->limits
.vertex_attribs
= 16;
3217 gl_info
->limits
.glsl_vs_float_constants
= 0;
3218 gl_info
->limits
.glsl_ps_float_constants
= 0;
3219 gl_info
->limits
.arb_vs_float_constants
= 0;
3220 gl_info
->limits
.arb_vs_native_constants
= 0;
3221 gl_info
->limits
.arb_vs_instructions
= 0;
3222 gl_info
->limits
.arb_vs_temps
= 0;
3223 gl_info
->limits
.arb_ps_float_constants
= 0;
3224 gl_info
->limits
.arb_ps_local_constants
= 0;
3225 gl_info
->limits
.arb_ps_instructions
= 0;
3226 gl_info
->limits
.arb_ps_temps
= 0;
3228 gl_info
->gl_ops
.gl
.p_glGetIntegerv(GL_MAX_CLIP_PLANES
, &gl_max
);
3229 gl_info
->limits
.clipplanes
= min(WINED3DMAXUSERCLIPPLANES
, gl_max
);
3230 TRACE("Clip plane support - max planes %d.\n", gl_max
);
3232 gl_info
->gl_ops
.gl
.p_glGetIntegerv(GL_MAX_LIGHTS
, &gl_max
);
3233 gl_info
->limits
.lights
= gl_max
;
3234 TRACE("Light support - max lights %d.\n", gl_max
);
3236 gl_info
->gl_ops
.gl
.p_glGetIntegerv(GL_MAX_TEXTURE_SIZE
, &gl_max
);
3237 gl_info
->limits
.texture_size
= gl_max
;
3238 TRACE("Maximum texture size support - max texture size %d.\n", gl_max
);
3240 gl_info
->gl_ops
.gl
.p_glGetFloatv(GL_ALIASED_POINT_SIZE_RANGE
, gl_floatv
);
3241 gl_info
->limits
.pointsize_min
= gl_floatv
[0];
3242 gl_info
->limits
.pointsize_max
= gl_floatv
[1];
3243 TRACE("Maximum point size support - max point size %f.\n", gl_floatv
[1]);
3245 if (gl_info
->supported
[ARB_MAP_BUFFER_ALIGNMENT
])
3247 gl_info
->gl_ops
.gl
.p_glGetIntegerv(GL_MIN_MAP_BUFFER_ALIGNMENT
, &gl_max
);
3248 TRACE("Minimum buffer map alignment: %d.\n", gl_max
);
3252 WARN_(d3d_perf
)("Driver doesn't guarantee a minimum buffer map alignment.\n");
3254 if (gl_info
->supported
[NV_REGISTER_COMBINERS
])
3256 gl_info
->gl_ops
.gl
.p_glGetIntegerv(GL_MAX_GENERAL_COMBINERS_NV
, &gl_max
);
3257 gl_info
->limits
.general_combiners
= gl_max
;
3258 TRACE("Max general combiners: %d.\n", gl_max
);
3260 if (gl_info
->supported
[ARB_DRAW_BUFFERS
] && wined3d_settings
.offscreen_rendering_mode
== ORM_FBO
)
3262 gl_info
->gl_ops
.gl
.p_glGetIntegerv(GL_MAX_DRAW_BUFFERS_ARB
, &gl_max
);
3263 gl_info
->limits
.buffers
= gl_max
;
3264 TRACE("Max draw buffers: %u.\n", gl_max
);
3266 if (gl_info
->supported
[ARB_MULTITEXTURE
])
3268 gl_info
->gl_ops
.gl
.p_glGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB
, &gl_max
);
3269 gl_info
->limits
.textures
= min(MAX_TEXTURES
, gl_max
);
3270 TRACE("Max textures: %d.\n", gl_info
->limits
.textures
);
3272 if (gl_info
->supported
[ARB_FRAGMENT_PROGRAM
])
3275 gl_info
->gl_ops
.gl
.p_glGetIntegerv(GL_MAX_TEXTURE_COORDS_ARB
, &gl_max
);
3276 gl_info
->limits
.texture_coords
= min(MAX_TEXTURES
, gl_max
);
3277 gl_info
->gl_ops
.gl
.p_glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS_ARB
, &tmp
);
3278 gl_info
->limits
.fragment_samplers
= min(MAX_FRAGMENT_SAMPLERS
, tmp
);
3282 gl_info
->limits
.texture_coords
= max(gl_info
->limits
.texture_coords
, gl_max
);
3283 gl_info
->limits
.fragment_samplers
= max(gl_info
->limits
.fragment_samplers
, gl_max
);
3285 TRACE("Max texture coords: %d.\n", gl_info
->limits
.texture_coords
);
3286 TRACE("Max fragment samplers: %d.\n", gl_info
->limits
.fragment_samplers
);
3288 if (gl_info
->supported
[ARB_VERTEX_SHADER
])
3291 gl_info
->gl_ops
.gl
.p_glGetIntegerv(GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB
, &tmp
);
3292 gl_info
->limits
.vertex_samplers
= tmp
;
3293 gl_info
->gl_ops
.gl
.p_glGetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB
, &tmp
);
3294 gl_info
->limits
.combined_samplers
= tmp
;
3295 gl_info
->gl_ops
.gl
.p_glGetIntegerv(GL_MAX_VERTEX_ATTRIBS_ARB
, &tmp
);
3296 gl_info
->limits
.vertex_attribs
= tmp
;
3298 /* Loading GLSL sampler uniforms is much simpler if we can assume that the sampler setup
3299 * is known at shader link time. In a vertex shader + pixel shader combination this isn't
3300 * an issue because then the sampler setup only depends on the two shaders. If a pixel
3301 * shader is used with fixed function vertex processing we're fine too because fixed function
3302 * vertex processing doesn't use any samplers. If fixed function fragment processing is
3303 * used we have to make sure that all vertex sampler setups are valid together with all
3304 * possible fixed function fragment processing setups. This is true if vsamplers + MAX_TEXTURES
3305 * <= max_samplers. This is true on all d3d9 cards that support vtf(gf 6 and gf7 cards).
3306 * dx9 radeon cards do not support vertex texture fetch. DX10 cards have 128 samplers, and
3307 * dx9 is limited to 8 fixed function texture stages and 4 vertex samplers. DX10 does not have
3308 * a fixed function pipeline anymore.
3310 * So this is just a check to check that our assumption holds true. If not, write a warning
3311 * and reduce the number of vertex samplers or probably disable vertex texture fetch. */
3312 if (gl_info
->limits
.vertex_samplers
&& gl_info
->limits
.combined_samplers
< 12
3313 && MAX_TEXTURES
+ gl_info
->limits
.vertex_samplers
> gl_info
->limits
.combined_samplers
)
3315 FIXME("OpenGL implementation supports %u vertex samplers and %u total samplers.\n",
3316 gl_info
->limits
.vertex_samplers
, gl_info
->limits
.combined_samplers
);
3317 FIXME("Expected vertex samplers + MAX_TEXTURES(=8) > combined_samplers.\n");
3318 if (gl_info
->limits
.combined_samplers
> MAX_TEXTURES
)
3319 gl_info
->limits
.vertex_samplers
= gl_info
->limits
.combined_samplers
- MAX_TEXTURES
;
3321 gl_info
->limits
.vertex_samplers
= 0;
3326 gl_info
->limits
.combined_samplers
= gl_info
->limits
.fragment_samplers
;
3328 TRACE("Max vertex samplers: %u.\n", gl_info
->limits
.vertex_samplers
);
3329 TRACE("Max combined samplers: %u.\n", gl_info
->limits
.combined_samplers
);
3331 if (gl_info
->supported
[ARB_VERTEX_BLEND
])
3333 gl_info
->gl_ops
.gl
.p_glGetIntegerv(GL_MAX_VERTEX_UNITS_ARB
, &gl_max
);
3334 gl_info
->limits
.blends
= gl_max
;
3335 TRACE("Max blends: %u.\n", gl_info
->limits
.blends
);
3337 if (gl_info
->supported
[EXT_TEXTURE3D
])
3339 gl_info
->gl_ops
.gl
.p_glGetIntegerv(GL_MAX_3D_TEXTURE_SIZE_EXT
, &gl_max
);
3340 gl_info
->limits
.texture3d_size
= gl_max
;
3341 TRACE("Max texture3D size: %d.\n", gl_info
->limits
.texture3d_size
);
3343 if (gl_info
->supported
[EXT_TEXTURE_FILTER_ANISOTROPIC
])
3345 gl_info
->gl_ops
.gl
.p_glGetIntegerv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT
, &gl_max
);
3346 gl_info
->limits
.anisotropy
= gl_max
;
3347 TRACE("Max anisotropy: %d.\n", gl_info
->limits
.anisotropy
);
3349 if (gl_info
->supported
[ARB_FRAGMENT_PROGRAM
])
3351 GL_EXTCALL(glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB
, GL_MAX_PROGRAM_ENV_PARAMETERS_ARB
, &gl_max
));
3352 gl_info
->limits
.arb_ps_float_constants
= gl_max
;
3353 TRACE("Max ARB_FRAGMENT_PROGRAM float constants: %d.\n", gl_info
->limits
.arb_ps_float_constants
);
3354 GL_EXTCALL(glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB
, GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB
, &gl_max
));
3355 gl_info
->limits
.arb_ps_native_constants
= gl_max
;
3356 TRACE("Max ARB_FRAGMENT_PROGRAM native float constants: %d.\n",
3357 gl_info
->limits
.arb_ps_native_constants
);
3358 GL_EXTCALL(glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB
, GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB
, &gl_max
));
3359 gl_info
->limits
.arb_ps_temps
= gl_max
;
3360 TRACE("Max ARB_FRAGMENT_PROGRAM native temporaries: %d.\n", gl_info
->limits
.arb_ps_temps
);
3361 GL_EXTCALL(glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB
, GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB
, &gl_max
));
3362 gl_info
->limits
.arb_ps_instructions
= gl_max
;
3363 TRACE("Max ARB_FRAGMENT_PROGRAM native instructions: %d.\n", gl_info
->limits
.arb_ps_instructions
);
3364 GL_EXTCALL(glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB
, GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB
, &gl_max
));
3365 gl_info
->limits
.arb_ps_local_constants
= gl_max
;
3366 TRACE("Max ARB_FRAGMENT_PROGRAM local parameters: %d.\n", gl_info
->limits
.arb_ps_instructions
);
3368 if (gl_info
->supported
[ARB_VERTEX_PROGRAM
])
3370 GL_EXTCALL(glGetProgramivARB(GL_VERTEX_PROGRAM_ARB
, GL_MAX_PROGRAM_ENV_PARAMETERS_ARB
, &gl_max
));
3371 gl_info
->limits
.arb_vs_float_constants
= gl_max
;
3372 TRACE("Max ARB_VERTEX_PROGRAM float constants: %d.\n", gl_info
->limits
.arb_vs_float_constants
);
3373 GL_EXTCALL(glGetProgramivARB(GL_VERTEX_PROGRAM_ARB
, GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB
, &gl_max
));
3374 gl_info
->limits
.arb_vs_native_constants
= gl_max
;
3375 TRACE("Max ARB_VERTEX_PROGRAM native float constants: %d.\n",
3376 gl_info
->limits
.arb_vs_native_constants
);
3377 GL_EXTCALL(glGetProgramivARB(GL_VERTEX_PROGRAM_ARB
, GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB
, &gl_max
));
3378 gl_info
->limits
.arb_vs_temps
= gl_max
;
3379 TRACE("Max ARB_VERTEX_PROGRAM native temporaries: %d.\n", gl_info
->limits
.arb_vs_temps
);
3380 GL_EXTCALL(glGetProgramivARB(GL_VERTEX_PROGRAM_ARB
, GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB
, &gl_max
));
3381 gl_info
->limits
.arb_vs_instructions
= gl_max
;
3382 TRACE("Max ARB_VERTEX_PROGRAM native instructions: %d.\n", gl_info
->limits
.arb_vs_instructions
);
3384 if (gl_info
->supported
[ARB_VERTEX_SHADER
])
3386 gl_info
->gl_ops
.gl
.p_glGetIntegerv(GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB
, &gl_max
);
3387 gl_info
->limits
.glsl_vs_float_constants
= gl_max
/ 4;
3388 TRACE("Max ARB_VERTEX_SHADER float constants: %u.\n", gl_info
->limits
.glsl_vs_float_constants
);
3390 if (gl_info
->supported
[ARB_UNIFORM_BUFFER_OBJECT
])
3392 gl_info
->gl_ops
.gl
.p_glGetIntegerv(GL_MAX_VERTEX_UNIFORM_BLOCKS
, &gl_max
);
3393 gl_info
->limits
.vertex_uniform_blocks
= min(gl_max
, WINED3D_MAX_CBS
);
3394 TRACE("Max vertex uniform blocks: %u (%d).\n", gl_info
->limits
.vertex_uniform_blocks
, gl_max
);
3397 if (gl_info
->supported
[ARB_GEOMETRY_SHADER4
] && gl_info
->supported
[ARB_UNIFORM_BUFFER_OBJECT
])
3399 gl_info
->gl_ops
.gl
.p_glGetIntegerv(GL_MAX_GEOMETRY_UNIFORM_BLOCKS
, &gl_max
);
3400 gl_info
->limits
.geometry_uniform_blocks
= min(gl_max
, WINED3D_MAX_CBS
);
3401 TRACE("Max geometry uniform blocks: %u (%d).\n", gl_info
->limits
.geometry_uniform_blocks
, gl_max
);
3403 if (gl_info
->supported
[ARB_FRAGMENT_SHADER
])
3405 gl_info
->gl_ops
.gl
.p_glGetIntegerv(GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB
, &gl_max
);
3406 gl_info
->limits
.glsl_ps_float_constants
= gl_max
/ 4;
3407 TRACE("Max ARB_FRAGMENT_SHADER float constants: %u.\n", gl_info
->limits
.glsl_ps_float_constants
);
3408 gl_info
->gl_ops
.gl
.p_glGetIntegerv(GL_MAX_VARYING_FLOATS_ARB
, &gl_max
);
3409 gl_info
->limits
.glsl_varyings
= gl_max
;
3410 TRACE("Max GLSL varyings: %u (%u 4 component varyings).\n", gl_max
, gl_max
/ 4);
3412 if (gl_info
->supported
[ARB_UNIFORM_BUFFER_OBJECT
])
3414 gl_info
->gl_ops
.gl
.p_glGetIntegerv(GL_MAX_FRAGMENT_UNIFORM_BLOCKS
, &gl_max
);
3415 gl_info
->limits
.fragment_uniform_blocks
= min(gl_max
, WINED3D_MAX_CBS
);
3416 TRACE("Max fragment uniform blocks: %u (%d).\n", gl_info
->limits
.fragment_uniform_blocks
, gl_max
);
3419 if (gl_info
->supported
[ARB_UNIFORM_BUFFER_OBJECT
])
3421 gl_info
->gl_ops
.gl
.p_glGetIntegerv(GL_MAX_COMBINED_UNIFORM_BLOCKS
, &gl_max
);
3422 TRACE("Max combined uniform blocks: %d.\n", gl_max
);
3423 gl_info
->gl_ops
.gl
.p_glGetIntegerv(GL_MAX_UNIFORM_BUFFER_BINDINGS
, &gl_max
);
3424 TRACE("Max uniform buffer bindings: %d.\n", gl_max
);
3427 if (gl_info
->supported
[NV_LIGHT_MAX_EXPONENT
])
3428 gl_info
->gl_ops
.gl
.p_glGetFloatv(GL_MAX_SHININESS_NV
, &gl_info
->limits
.shininess
);
3430 gl_info
->limits
.shininess
= 128.0f
;
3432 if ((gl_info
->supported
[ARB_FRAMEBUFFER_OBJECT
] || gl_info
->supported
[EXT_FRAMEBUFFER_MULTISAMPLE
])
3433 && wined3d_settings
.allow_multisampling
)
3435 gl_info
->gl_ops
.gl
.p_glGetIntegerv(GL_MAX_SAMPLES
, &gl_max
);
3436 gl_info
->limits
.samples
= gl_max
;
3440 /* Context activation is done by the caller. */
3441 static BOOL
wined3d_adapter_init_gl_caps(struct wined3d_adapter
*adapter
, DWORD wined3d_creation_flags
)
3445 enum wined3d_gl_extension extension
;
3446 DWORD min_gl_version
;
3450 {EXT_TEXTURE3D
, MAKEDWORD_VERSION(1, 2)},
3451 {ARB_MULTISAMPLE
, MAKEDWORD_VERSION(1, 3)},
3452 {ARB_MULTITEXTURE
, MAKEDWORD_VERSION(1, 3)},
3453 {ARB_TEXTURE_BORDER_CLAMP
, MAKEDWORD_VERSION(1, 3)},
3454 {ARB_TEXTURE_COMPRESSION
, MAKEDWORD_VERSION(1, 3)},
3455 {ARB_TEXTURE_CUBE_MAP
, MAKEDWORD_VERSION(1, 3)},
3456 {ARB_DEPTH_TEXTURE
, MAKEDWORD_VERSION(1, 4)},
3457 {ARB_POINT_PARAMETERS
, MAKEDWORD_VERSION(1, 4)},
3458 {ARB_SHADOW
, MAKEDWORD_VERSION(1, 4)},
3459 {ARB_TEXTURE_MIRRORED_REPEAT
, MAKEDWORD_VERSION(1, 4)},
3460 {EXT_BLEND_COLOR
, MAKEDWORD_VERSION(1, 4)},
3461 {EXT_BLEND_FUNC_SEPARATE
, MAKEDWORD_VERSION(1, 4)},
3462 {EXT_BLEND_MINMAX
, MAKEDWORD_VERSION(1, 4)},
3463 {EXT_BLEND_SUBTRACT
, MAKEDWORD_VERSION(1, 4)},
3464 {EXT_STENCIL_WRAP
, MAKEDWORD_VERSION(1, 4)},
3465 {NV_POINT_SPRITE
, MAKEDWORD_VERSION(1, 4)},
3466 {ARB_OCCLUSION_QUERY
, MAKEDWORD_VERSION(1, 5)},
3467 {ARB_VERTEX_BUFFER_OBJECT
, MAKEDWORD_VERSION(1, 5)},
3468 {ARB_DRAW_BUFFERS
, MAKEDWORD_VERSION(2, 0)},
3469 {ARB_FRAGMENT_SHADER
, MAKEDWORD_VERSION(2, 0)},
3470 {ARB_SHADING_LANGUAGE_100
, MAKEDWORD_VERSION(2, 0)},
3471 {ARB_TEXTURE_NON_POWER_OF_TWO
, MAKEDWORD_VERSION(2, 0)},
3472 {ARB_VERTEX_SHADER
, MAKEDWORD_VERSION(2, 0)},
3473 {EXT_BLEND_EQUATION_SEPARATE
, MAKEDWORD_VERSION(2, 0)},
3474 {ARB_PIXEL_BUFFER_OBJECT
, MAKEDWORD_VERSION(2, 1)},
3475 {EXT_TEXTURE_SRGB
, MAKEDWORD_VERSION(2, 1)},
3476 {ARB_COLOR_BUFFER_FLOAT
, MAKEDWORD_VERSION(3, 0)},
3477 {ARB_DEPTH_BUFFER_FLOAT
, MAKEDWORD_VERSION(3, 0)},
3478 {ARB_FRAMEBUFFER_OBJECT
, MAKEDWORD_VERSION(3, 0)},
3479 {ARB_FRAMEBUFFER_SRGB
, MAKEDWORD_VERSION(3, 0)},
3480 {ARB_HALF_FLOAT_PIXEL
, MAKEDWORD_VERSION(3, 0)},
3481 {ARB_HALF_FLOAT_VERTEX
, MAKEDWORD_VERSION(3, 0)},
3482 {ARB_MAP_BUFFER_RANGE
, MAKEDWORD_VERSION(3, 0)},
3483 {ARB_TEXTURE_COMPRESSION_RGTC
, MAKEDWORD_VERSION(3, 0)},
3484 {ARB_TEXTURE_FLOAT
, MAKEDWORD_VERSION(3, 0)},
3485 {ARB_TEXTURE_RG
, MAKEDWORD_VERSION(3, 0)},
3486 {EXT_DRAW_BUFFERS2
, MAKEDWORD_VERSION(3, 0)},
3487 {EXT_PACKED_FLOAT
, MAKEDWORD_VERSION(3, 0)},
3488 {EXT_TEXTURE_ARRAY
, MAKEDWORD_VERSION(3, 0)},
3489 {EXT_TEXTURE_INTEGER
, MAKEDWORD_VERSION(3, 0)},
3490 /* We don't want to enable EXT_GPU_SHADER4: even though similar
3491 * functionality is available in core GL 3.0 / GLSL 1.30, it's different
3492 * enough that reusing the same flag for the new features hurts more
3494 /* EXT_framebuffer_object, EXT_framebuffer_blit,
3495 * EXT_framebuffer_multisample and EXT_packed_depth_stencil
3496 * are integrated into ARB_framebuffer_object. */
3498 {ARB_COPY_BUFFER
, MAKEDWORD_VERSION(3, 1)},
3499 {ARB_DRAW_INSTANCED
, MAKEDWORD_VERSION(3, 1)},
3500 {ARB_UNIFORM_BUFFER_OBJECT
, MAKEDWORD_VERSION(3, 1)},
3501 {EXT_TEXTURE_SNORM
, MAKEDWORD_VERSION(3, 1)},
3502 /* We don't need or want GL_ARB_texture_rectangle (core in 3.1). */
3504 {ARB_DRAW_ELEMENTS_BASE_VERTEX
, MAKEDWORD_VERSION(3, 2)},
3505 /* ARB_geometry_shader4 exposes a somewhat different API compared to 3.2
3506 * core geometry shaders so it's not really correct to expose the
3507 * extension for core-only support. */
3508 {ARB_PROVOKING_VERTEX
, MAKEDWORD_VERSION(3, 2)},
3509 {ARB_SYNC
, MAKEDWORD_VERSION(3, 2)},
3510 {ARB_VERTEX_ARRAY_BGRA
, MAKEDWORD_VERSION(3, 2)},
3512 {ARB_BLEND_FUNC_EXTENDED
, MAKEDWORD_VERSION(3, 3)},
3513 {ARB_INSTANCED_ARRAYS
, MAKEDWORD_VERSION(3, 3)},
3514 {ARB_SAMPLER_OBJECTS
, MAKEDWORD_VERSION(3, 3)},
3515 {ARB_SHADER_BIT_ENCODING
, MAKEDWORD_VERSION(3, 3)},
3516 {ARB_TEXTURE_RGB10_A2UI
, MAKEDWORD_VERSION(3, 3)},
3517 {ARB_TEXTURE_SWIZZLE
, MAKEDWORD_VERSION(3, 3)},
3518 {ARB_TIMER_QUERY
, MAKEDWORD_VERSION(3, 3)},
3520 {ARB_ES2_COMPATIBILITY
, MAKEDWORD_VERSION(4, 1)},
3522 {ARB_INTERNALFORMAT_QUERY
, MAKEDWORD_VERSION(4, 2)},
3523 {ARB_MAP_BUFFER_ALIGNMENT
, MAKEDWORD_VERSION(4, 2)},
3525 {ARB_DEBUG_OUTPUT
, MAKEDWORD_VERSION(4, 3)},
3526 {ARB_INTERNALFORMAT_QUERY2
, MAKEDWORD_VERSION(4, 3)},
3527 {ARB_TEXTURE_QUERY_LEVELS
, MAKEDWORD_VERSION(4, 3)},
3529 struct wined3d_driver_info
*driver_info
= &adapter
->driver_info
;
3530 const char *gl_vendor_str
, *gl_renderer_str
, *gl_version_str
;
3531 struct wined3d_gl_info
*gl_info
= &adapter
->gl_info
;
3532 const struct gpu_description
*gpu_description
;
3533 struct wined3d_vertex_caps vertex_caps
;
3534 struct fragment_caps fragment_caps
;
3535 struct shader_caps shader_caps
;
3536 const char *WGL_Extensions
= NULL
;
3537 enum wined3d_gl_vendor gl_vendor
;
3538 DWORD gl_version
, gl_ext_emul_mask
;
3539 UINT64 vram_bytes
= 0;
3542 GLint context_profile
= 0;
3544 TRACE("adapter %p.\n", adapter
);
3546 gl_renderer_str
= (const char *)gl_info
->gl_ops
.gl
.p_glGetString(GL_RENDERER
);
3547 TRACE("GL_RENDERER: %s.\n", debugstr_a(gl_renderer_str
));
3548 if (!gl_renderer_str
)
3550 ERR("Received a NULL GL_RENDERER.\n");
3554 gl_vendor_str
= (const char *)gl_info
->gl_ops
.gl
.p_glGetString(GL_VENDOR
);
3555 TRACE("GL_VENDOR: %s.\n", debugstr_a(gl_vendor_str
));
3558 ERR("Received a NULL GL_VENDOR.\n");
3562 /* Parse the GL_VERSION field into major and minor information */
3563 gl_version_str
= (const char *)gl_info
->gl_ops
.gl
.p_glGetString(GL_VERSION
);
3564 TRACE("GL_VERSION: %s.\n", debugstr_a(gl_version_str
));
3565 if (!gl_version_str
)
3567 ERR("Received a NULL GL_VERSION.\n");
3570 gl_version
= wined3d_parse_gl_version(gl_version_str
);
3572 load_gl_funcs(gl_info
);
3574 memset(gl_info
->supported
, 0, sizeof(gl_info
->supported
));
3575 gl_info
->supported
[WINED3D_GL_EXT_NONE
] = TRUE
;
3577 if (gl_version
>= MAKEDWORD_VERSION(3, 2))
3579 glGetIntegerv(GL_CONTEXT_PROFILE_MASK
, &context_profile
);
3580 checkGLcall("Querying context profile");
3582 if (context_profile
& GL_CONTEXT_CORE_PROFILE_BIT
)
3583 TRACE("Got a core profile context.\n");
3585 gl_info
->supported
[WINED3D_GL_LEGACY_CONTEXT
] = TRUE
;
3587 TRACE("GL extensions reported:\n");
3588 if (gl_info
->supported
[WINED3D_GL_LEGACY_CONTEXT
])
3590 const char *gl_extensions
= (const char *)gl_info
->gl_ops
.gl
.p_glGetString(GL_EXTENSIONS
);
3594 ERR("Received a NULL GL_EXTENSIONS.\n");
3597 parse_extension_string(gl_info
, gl_extensions
, gl_extension_map
,
3598 sizeof(gl_extension_map
) / sizeof(*gl_extension_map
));
3602 enumerate_gl_extensions(gl_info
, gl_extension_map
,
3603 sizeof(gl_extension_map
) / sizeof(*gl_extension_map
));
3606 hdc
= wglGetCurrentDC();
3607 /* Not all GL drivers might offer WGL extensions e.g. VirtualBox. */
3608 if (GL_EXTCALL(wglGetExtensionsStringARB
))
3609 WGL_Extensions
= (const char *)GL_EXTCALL(wglGetExtensionsStringARB(hdc
));
3610 if (!WGL_Extensions
)
3611 WARN("WGL extensions not supported.\n");
3613 parse_extension_string(gl_info
, WGL_Extensions
, wgl_extension_map
,
3614 sizeof(wgl_extension_map
) / sizeof(*wgl_extension_map
));
3616 for (i
= 0; i
< ARRAY_SIZE(core_extensions
); ++i
)
3618 if (!gl_info
->supported
[core_extensions
[i
].extension
]
3619 && gl_version
>= core_extensions
[i
].min_gl_version
)
3621 for (j
= 0; j
< ARRAY_SIZE(gl_extension_map
); ++j
)
3622 if (gl_extension_map
[j
].extension
== core_extensions
[i
].extension
)
3625 if (j
< ARRAY_SIZE(gl_extension_map
))
3627 TRACE("GL CORE: %s support.\n", gl_extension_map
[j
].extension_string
);
3628 gl_info
->supported
[core_extensions
[i
].extension
] = TRUE
;
3632 FIXME("GL extension %u not in the GL extensions map.\n", core_extensions
[i
].extension
);
3637 if (gl_info
->supported
[EXT_BLEND_MINMAX
] || gl_info
->supported
[EXT_BLEND_SUBTRACT
])
3638 gl_info
->supported
[WINED3D_GL_BLEND_EQUATION
] = TRUE
;
3640 if (gl_version
>= MAKEDWORD_VERSION(2, 0))
3641 gl_info
->supported
[WINED3D_GL_VERSION_2_0
] = TRUE
;
3642 if (gl_version
>= MAKEDWORD_VERSION(3, 2))
3643 gl_info
->supported
[WINED3D_GL_VERSION_3_2
] = TRUE
;
3644 if (gl_version
>= MAKEDWORD_VERSION(4, 3))
3645 gl_info
->supported
[WINED3D_GL_VERSION_4_3
] = TRUE
;
3647 /* All the points are actually point sprites in core contexts, the APIs from
3648 * ARB_point_sprite are not supported anymore. */
3649 if (!gl_info
->supported
[WINED3D_GL_LEGACY_CONTEXT
])
3650 gl_info
->supported
[ARB_POINT_SPRITE
] = FALSE
;
3652 if (gl_info
->supported
[APPLE_FENCE
])
3654 /* GL_NV_fence and GL_APPLE_fence provide the same functionality basically.
3655 * The apple extension interacts with some other apple exts. Disable the NV
3656 * extension if the apple one is support to prevent confusion in other parts
3658 gl_info
->supported
[NV_FENCE
] = FALSE
;
3660 if (gl_info
->supported
[APPLE_FLOAT_PIXELS
])
3662 /* GL_APPLE_float_pixels == GL_ARB_texture_float + GL_ARB_half_float_pixel
3664 * The enums are the same:
3665 * GL_RGBA16F_ARB = GL_RGBA_FLOAT16_APPLE = 0x881a
3666 * GL_RGB16F_ARB = GL_RGB_FLOAT16_APPLE = 0x881b
3667 * GL_RGBA32F_ARB = GL_RGBA_FLOAT32_APPLE = 0x8814
3668 * GL_RGB32F_ARB = GL_RGB_FLOAT32_APPLE = 0x8815
3669 * GL_HALF_FLOAT_ARB = GL_HALF_APPLE = 0x140b
3671 if (!gl_info
->supported
[ARB_TEXTURE_FLOAT
])
3673 TRACE(" IMPLIED: GL_ARB_texture_float support (by GL_APPLE_float_pixels).\n");
3674 gl_info
->supported
[ARB_TEXTURE_FLOAT
] = TRUE
;
3676 if (!gl_info
->supported
[ARB_HALF_FLOAT_PIXEL
])
3678 TRACE(" IMPLIED: GL_ARB_half_float_pixel support (by GL_APPLE_float_pixels).\n");
3679 gl_info
->supported
[ARB_HALF_FLOAT_PIXEL
] = TRUE
;
3682 if (gl_info
->supported
[ARB_MAP_BUFFER_RANGE
])
3684 /* GL_ARB_map_buffer_range and GL_APPLE_flush_buffer_range provide the same
3685 * functionality. Prefer the ARB extension */
3686 gl_info
->supported
[APPLE_FLUSH_BUFFER_RANGE
] = FALSE
;
3688 if (gl_info
->supported
[ARB_TEXTURE_CUBE_MAP
])
3690 TRACE(" IMPLIED: NVIDIA (NV) Texture Gen Reflection support.\n");
3691 gl_info
->supported
[NV_TEXGEN_REFLECTION
] = TRUE
;
3693 if (!gl_info
->supported
[ARB_VERTEX_ARRAY_BGRA
] && gl_info
->supported
[EXT_VERTEX_ARRAY_BGRA
])
3695 TRACE(" IMPLIED: ARB_vertex_array_bgra support (by EXT_vertex_array_bgra).\n");
3696 gl_info
->supported
[ARB_VERTEX_ARRAY_BGRA
] = TRUE
;
3698 if (!gl_info
->supported
[EXT_TEXTURE_COMPRESSION_RGTC
] && gl_info
->supported
[ARB_TEXTURE_COMPRESSION_RGTC
])
3700 TRACE(" IMPLIED: EXT_texture_compression_rgtc support (by ARB_texture_compression_rgtc).\n");
3701 gl_info
->supported
[EXT_TEXTURE_COMPRESSION_RGTC
] = TRUE
;
3703 if (!gl_info
->supported
[ARB_TEXTURE_COMPRESSION_RGTC
] && gl_info
->supported
[EXT_TEXTURE_COMPRESSION_RGTC
])
3705 TRACE(" IMPLIED: ARB_texture_compression_rgtc support (by EXT_texture_compression_rgtc).\n");
3706 gl_info
->supported
[ARB_TEXTURE_COMPRESSION_RGTC
] = TRUE
;
3708 if (gl_info
->supported
[ARB_TEXTURE_COMPRESSION_RGTC
] && !gl_info
->supported
[ARB_TEXTURE_RG
])
3710 TRACE("ARB_texture_rg not supported, disabling ARB_texture_compression_rgtc.\n");
3711 gl_info
->supported
[ARB_TEXTURE_COMPRESSION_RGTC
] = FALSE
;
3713 if (gl_info
->supported
[NV_TEXTURE_SHADER2
])
3715 if (gl_info
->supported
[NV_REGISTER_COMBINERS
])
3717 /* Also disable ATI_FRAGMENT_SHADER if register combiners and texture_shader2
3718 * are supported. The nv extensions provide the same functionality as the
3719 * ATI one, and a bit more(signed pixelformats). */
3720 gl_info
->supported
[ATI_FRAGMENT_SHADER
] = FALSE
;
3723 if (gl_info
->supported
[ARB_TEXTURE_NON_POWER_OF_TWO
])
3725 /* If we have full NP2 texture support, disable
3726 * GL_ARB_texture_rectangle because we will never use it.
3727 * This saves a few redundant glDisable calls. */
3728 gl_info
->supported
[ARB_TEXTURE_RECTANGLE
] = FALSE
;
3730 if (gl_info
->supported
[ATI_FRAGMENT_SHADER
])
3732 /* Disable NV_register_combiners and fragment shader if this is supported.
3733 * generally the NV extensions are preferred over the ATI ones, and this
3734 * extension is disabled if register_combiners and texture_shader2 are both
3735 * supported. So we reach this place only if we have incomplete NV dxlevel 8
3736 * fragment processing support. */
3737 gl_info
->supported
[NV_REGISTER_COMBINERS
] = FALSE
;
3738 gl_info
->supported
[NV_REGISTER_COMBINERS2
] = FALSE
;
3739 gl_info
->supported
[NV_TEXTURE_SHADER
] = FALSE
;
3740 gl_info
->supported
[NV_TEXTURE_SHADER2
] = FALSE
;
3742 if (gl_info
->supported
[NV_HALF_FLOAT
])
3744 /* GL_ARB_half_float_vertex is a subset of GL_NV_half_float. */
3745 gl_info
->supported
[ARB_HALF_FLOAT_VERTEX
] = TRUE
;
3747 if (gl_info
->supported
[ARB_FRAMEBUFFER_SRGB
] && !gl_info
->supported
[EXT_TEXTURE_SRGB_DECODE
])
3749 /* Current wined3d sRGB infrastructure requires EXT_texture_sRGB_decode
3750 * for GL_ARB_framebuffer_sRGB support (without EXT_texture_sRGB_decode
3751 * we never render to sRGB surfaces). */
3752 gl_info
->supported
[ARB_FRAMEBUFFER_SRGB
] = FALSE
;
3754 if (gl_info
->supported
[ARB_OCCLUSION_QUERY
])
3758 GL_EXTCALL(glGetQueryiv(GL_SAMPLES_PASSED
, GL_QUERY_COUNTER_BITS
, &counter_bits
));
3759 TRACE("Occlusion query counter has %d bits.\n", counter_bits
);
3761 gl_info
->supported
[ARB_OCCLUSION_QUERY
] = FALSE
;
3763 if (gl_info
->supported
[ARB_TIMER_QUERY
])
3767 GL_EXTCALL(glGetQueryiv(GL_TIMESTAMP
, GL_QUERY_COUNTER_BITS
, &counter_bits
));
3768 TRACE("Timestamp query counter has %d bits.\n", counter_bits
);
3770 gl_info
->supported
[ARB_TIMER_QUERY
] = FALSE
;
3772 if (!gl_info
->supported
[ATI_TEXTURE_MIRROR_ONCE
] && gl_info
->supported
[EXT_TEXTURE_MIRROR_CLAMP
])
3774 TRACE(" IMPLIED: ATI_texture_mirror_once support (by EXT_texture_mirror_clamp).\n");
3775 gl_info
->supported
[ATI_TEXTURE_MIRROR_ONCE
] = TRUE
;
3777 if (!gl_info
->supported
[ARB_TEXTURE_MIRROR_CLAMP_TO_EDGE
] && gl_info
->supported
[ATI_TEXTURE_MIRROR_ONCE
])
3779 TRACE(" IMPLIED: ARB_texture_mirror_clamp_to_edge support (by ATI_texture_mirror_once).\n");
3780 gl_info
->supported
[ARB_TEXTURE_MIRROR_CLAMP_TO_EDGE
] = TRUE
;
3783 wined3d_adapter_init_limits(gl_info
);
3785 if (gl_info
->supported
[ARB_VERTEX_PROGRAM
] && test_arb_vs_offset_limit(gl_info
))
3786 gl_info
->quirks
|= WINED3D_QUIRK_ARB_VS_OFFSET_LIMIT
;
3788 if (gl_info
->supported
[ARB_SHADING_LANGUAGE_100
])
3790 const char *str
= (const char *)gl_info
->gl_ops
.gl
.p_glGetString(GL_SHADING_LANGUAGE_VERSION_ARB
);
3791 unsigned int major
, minor
;
3793 TRACE("GLSL version string: %s.\n", debugstr_a(str
));
3795 /* The format of the GLSL version string is "major.minor[.release] [vendor info]". */
3796 sscanf(str
, "%u.%u", &major
, &minor
);
3797 gl_info
->glsl_version
= MAKEDWORD_VERSION(major
, minor
);
3800 checkGLcall("extension detection");
3802 adapter
->shader_backend
= select_shader_backend(gl_info
);
3803 adapter
->vertex_pipe
= select_vertex_implementation(gl_info
, adapter
->shader_backend
);
3804 adapter
->fragment_pipe
= select_fragment_implementation(gl_info
, adapter
->shader_backend
);
3805 adapter
->blitter
= select_blit_implementation(gl_info
, adapter
->shader_backend
);
3807 adapter
->shader_backend
->shader_get_caps(gl_info
, &shader_caps
);
3808 adapter
->d3d_info
.vs_clipping
= shader_caps
.wined3d_caps
& WINED3D_SHADER_CAP_VS_CLIPPING
;
3809 adapter
->d3d_info
.limits
.vs_version
= shader_caps
.vs_version
;
3810 adapter
->d3d_info
.limits
.hs_version
= shader_caps
.hs_version
;
3811 adapter
->d3d_info
.limits
.ds_version
= shader_caps
.ds_version
;
3812 adapter
->d3d_info
.limits
.gs_version
= shader_caps
.gs_version
;
3813 adapter
->d3d_info
.limits
.ps_version
= shader_caps
.ps_version
;
3814 adapter
->d3d_info
.limits
.vs_uniform_count
= shader_caps
.vs_uniform_count
;
3815 adapter
->d3d_info
.limits
.ps_uniform_count
= shader_caps
.ps_uniform_count
;
3816 adapter
->d3d_info
.limits
.varying_count
= shader_caps
.varying_count
;
3818 adapter
->vertex_pipe
->vp_get_caps(gl_info
, &vertex_caps
);
3819 adapter
->d3d_info
.xyzrhw
= vertex_caps
.xyzrhw
;
3820 adapter
->d3d_info
.ffp_generic_attributes
= vertex_caps
.ffp_generic_attributes
;
3821 adapter
->d3d_info
.limits
.ffp_vertex_blend_matrices
= vertex_caps
.max_vertex_blend_matrices
;
3822 adapter
->d3d_info
.emulated_flatshading
= vertex_caps
.emulated_flatshading
;
3824 adapter
->fragment_pipe
->get_caps(gl_info
, &fragment_caps
);
3825 adapter
->d3d_info
.limits
.ffp_blend_stages
= fragment_caps
.MaxTextureBlendStages
;
3826 adapter
->d3d_info
.limits
.ffp_textures
= fragment_caps
.MaxSimultaneousTextures
;
3827 adapter
->d3d_info
.shader_color_key
= fragment_caps
.wined3d_caps
& WINED3D_FRAGMENT_CAP_COLOR_KEY
;
3828 adapter
->d3d_info
.wined3d_creation_flags
= wined3d_creation_flags
;
3829 TRACE("Max texture stages: %u.\n", adapter
->d3d_info
.limits
.ffp_blend_stages
);
3831 if (gl_info
->supported
[ARB_FRAMEBUFFER_OBJECT
])
3833 gl_info
->fbo_ops
.glIsRenderbuffer
= gl_info
->gl_ops
.ext
.p_glIsRenderbuffer
;
3834 gl_info
->fbo_ops
.glBindRenderbuffer
= gl_info
->gl_ops
.ext
.p_glBindRenderbuffer
;
3835 gl_info
->fbo_ops
.glDeleteRenderbuffers
= gl_info
->gl_ops
.ext
.p_glDeleteRenderbuffers
;
3836 gl_info
->fbo_ops
.glGenRenderbuffers
= gl_info
->gl_ops
.ext
.p_glGenRenderbuffers
;
3837 gl_info
->fbo_ops
.glRenderbufferStorage
= gl_info
->gl_ops
.ext
.p_glRenderbufferStorage
;
3838 gl_info
->fbo_ops
.glRenderbufferStorageMultisample
= gl_info
->gl_ops
.ext
.p_glRenderbufferStorageMultisample
;
3839 gl_info
->fbo_ops
.glGetRenderbufferParameteriv
= gl_info
->gl_ops
.ext
.p_glGetRenderbufferParameteriv
;
3840 gl_info
->fbo_ops
.glIsFramebuffer
= gl_info
->gl_ops
.ext
.p_glIsFramebuffer
;
3841 gl_info
->fbo_ops
.glBindFramebuffer
= gl_info
->gl_ops
.ext
.p_glBindFramebuffer
;
3842 gl_info
->fbo_ops
.glDeleteFramebuffers
= gl_info
->gl_ops
.ext
.p_glDeleteFramebuffers
;
3843 gl_info
->fbo_ops
.glGenFramebuffers
= gl_info
->gl_ops
.ext
.p_glGenFramebuffers
;
3844 gl_info
->fbo_ops
.glCheckFramebufferStatus
= gl_info
->gl_ops
.ext
.p_glCheckFramebufferStatus
;
3845 gl_info
->fbo_ops
.glFramebufferTexture1D
= gl_info
->gl_ops
.ext
.p_glFramebufferTexture1D
;
3846 gl_info
->fbo_ops
.glFramebufferTexture2D
= gl_info
->gl_ops
.ext
.p_glFramebufferTexture2D
;
3847 gl_info
->fbo_ops
.glFramebufferTexture3D
= gl_info
->gl_ops
.ext
.p_glFramebufferTexture3D
;
3848 gl_info
->fbo_ops
.glFramebufferTextureLayer
= gl_info
->gl_ops
.ext
.p_glFramebufferTextureLayer
;
3849 gl_info
->fbo_ops
.glFramebufferRenderbuffer
= gl_info
->gl_ops
.ext
.p_glFramebufferRenderbuffer
;
3850 gl_info
->fbo_ops
.glGetFramebufferAttachmentParameteriv
3851 = gl_info
->gl_ops
.ext
.p_glGetFramebufferAttachmentParameteriv
;
3852 gl_info
->fbo_ops
.glBlitFramebuffer
= gl_info
->gl_ops
.ext
.p_glBlitFramebuffer
;
3853 gl_info
->fbo_ops
.glGenerateMipmap
= gl_info
->gl_ops
.ext
.p_glGenerateMipmap
;
3857 if (gl_info
->supported
[EXT_FRAMEBUFFER_OBJECT
])
3859 gl_info
->fbo_ops
.glIsRenderbuffer
= gl_info
->gl_ops
.ext
.p_glIsRenderbufferEXT
;
3860 gl_info
->fbo_ops
.glBindRenderbuffer
= gl_info
->gl_ops
.ext
.p_glBindRenderbufferEXT
;
3861 gl_info
->fbo_ops
.glDeleteRenderbuffers
= gl_info
->gl_ops
.ext
.p_glDeleteRenderbuffersEXT
;
3862 gl_info
->fbo_ops
.glGenRenderbuffers
= gl_info
->gl_ops
.ext
.p_glGenRenderbuffersEXT
;
3863 gl_info
->fbo_ops
.glRenderbufferStorage
= gl_info
->gl_ops
.ext
.p_glRenderbufferStorageEXT
;
3864 gl_info
->fbo_ops
.glGetRenderbufferParameteriv
= gl_info
->gl_ops
.ext
.p_glGetRenderbufferParameterivEXT
;
3865 gl_info
->fbo_ops
.glIsFramebuffer
= gl_info
->gl_ops
.ext
.p_glIsFramebufferEXT
;
3866 gl_info
->fbo_ops
.glBindFramebuffer
= gl_info
->gl_ops
.ext
.p_glBindFramebufferEXT
;
3867 gl_info
->fbo_ops
.glDeleteFramebuffers
= gl_info
->gl_ops
.ext
.p_glDeleteFramebuffersEXT
;
3868 gl_info
->fbo_ops
.glGenFramebuffers
= gl_info
->gl_ops
.ext
.p_glGenFramebuffersEXT
;
3869 gl_info
->fbo_ops
.glCheckFramebufferStatus
= gl_info
->gl_ops
.ext
.p_glCheckFramebufferStatusEXT
;
3870 gl_info
->fbo_ops
.glFramebufferTexture1D
= gl_info
->gl_ops
.ext
.p_glFramebufferTexture1DEXT
;
3871 gl_info
->fbo_ops
.glFramebufferTexture2D
= gl_info
->gl_ops
.ext
.p_glFramebufferTexture2DEXT
;
3872 gl_info
->fbo_ops
.glFramebufferTexture3D
= gl_info
->gl_ops
.ext
.p_glFramebufferTexture3DEXT
;
3873 gl_info
->fbo_ops
.glFramebufferRenderbuffer
= gl_info
->gl_ops
.ext
.p_glFramebufferRenderbufferEXT
;
3874 gl_info
->fbo_ops
.glGetFramebufferAttachmentParameteriv
3875 = gl_info
->gl_ops
.ext
.p_glGetFramebufferAttachmentParameterivEXT
;
3876 gl_info
->fbo_ops
.glGenerateMipmap
= gl_info
->gl_ops
.ext
.p_glGenerateMipmapEXT
;
3878 else if (wined3d_settings
.offscreen_rendering_mode
== ORM_FBO
)
3880 WARN_(d3d_perf
)("Framebuffer objects not supported, falling back to backbuffer offscreen rendering mode.\n");
3881 wined3d_settings
.offscreen_rendering_mode
= ORM_BACKBUFFER
;
3884 if (gl_info
->supported
[ARB_GEOMETRY_SHADER4
])
3886 gl_info
->fbo_ops
.glFramebufferTextureLayer
= gl_info
->gl_ops
.ext
.p_glFramebufferTextureLayerARB
;
3888 if (gl_info
->supported
[EXT_FRAMEBUFFER_BLIT
])
3890 gl_info
->fbo_ops
.glBlitFramebuffer
= gl_info
->gl_ops
.ext
.p_glBlitFramebufferEXT
;
3892 if (gl_info
->supported
[EXT_FRAMEBUFFER_MULTISAMPLE
])
3894 gl_info
->fbo_ops
.glRenderbufferStorageMultisample
3895 = gl_info
->gl_ops
.ext
.p_glRenderbufferStorageMultisampleEXT
;
3899 gl_info
->wrap_lookup
[WINED3D_TADDRESS_WRAP
- WINED3D_TADDRESS_WRAP
] = GL_REPEAT
;
3900 gl_info
->wrap_lookup
[WINED3D_TADDRESS_MIRROR
- WINED3D_TADDRESS_WRAP
] =
3901 gl_info
->supported
[ARB_TEXTURE_MIRRORED_REPEAT
] ? GL_MIRRORED_REPEAT_ARB
: GL_REPEAT
;
3902 gl_info
->wrap_lookup
[WINED3D_TADDRESS_CLAMP
- WINED3D_TADDRESS_WRAP
] = GL_CLAMP_TO_EDGE
;
3903 gl_info
->wrap_lookup
[WINED3D_TADDRESS_BORDER
- WINED3D_TADDRESS_WRAP
] =
3904 gl_info
->supported
[ARB_TEXTURE_BORDER_CLAMP
] ? GL_CLAMP_TO_BORDER_ARB
: GL_REPEAT
;
3905 gl_info
->wrap_lookup
[WINED3D_TADDRESS_MIRROR_ONCE
- WINED3D_TADDRESS_WRAP
] =
3906 gl_info
->supported
[ARB_TEXTURE_MIRROR_CLAMP_TO_EDGE
] ? GL_MIRROR_CLAMP_TO_EDGE
: GL_REPEAT
;
3908 adapter
->d3d_info
.valid_rt_mask
= 0;
3909 for (i
= 0; i
< gl_info
->limits
.buffers
; ++i
)
3910 adapter
->d3d_info
.valid_rt_mask
|= (1u << i
);
3912 if (!gl_info
->supported
[WINED3D_GL_LEGACY_CONTEXT
])
3916 GL_EXTCALL(glGenVertexArrays(1, &vao
));
3917 GL_EXTCALL(glBindVertexArray(vao
));
3918 checkGLcall("creating VAO");
3921 gl_vendor
= wined3d_guess_gl_vendor(gl_info
, gl_vendor_str
, gl_renderer_str
);
3922 TRACE("Guessed GL vendor %#x.\n", gl_vendor
);
3924 if (!(gpu_description
= query_gpu_description(gl_info
, &vram_bytes
)))
3926 static const struct gpu_description default_gpu_description
=
3927 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_RIVA_128
, "Direct3D HAL", DRIVER_UNKNOWN
, WINE_DEFAULT_VIDMEM
};
3928 enum wined3d_pci_vendor vendor
;
3929 enum wined3d_pci_device device
;
3931 vendor
= wined3d_guess_card_vendor(gl_vendor_str
, gl_renderer_str
);
3932 TRACE("Guessed vendor PCI ID 0x%04x.\n", vendor
);
3934 device
= wined3d_guess_card(&shader_caps
, &fragment_caps
, gl_info
->glsl_version
,
3935 gl_renderer_str
, &gl_vendor
, &vendor
);
3936 TRACE("Guessed device PCI ID 0x%04x.\n", device
);
3938 if (!(gpu_description
= get_gpu_description(vendor
, device
)))
3940 ERR("Card %04x:%04x not found in driver DB.\n", vendor
, device
);
3941 gpu_description
= &default_gpu_description
;
3944 fixup_extensions(gl_info
, gl_renderer_str
, gl_vendor
, gpu_description
->vendor
, gpu_description
->card
);
3945 init_driver_info(driver_info
, gpu_description
, vram_bytes
);
3947 gl_ext_emul_mask
= adapter
->vertex_pipe
->vp_get_emul_mask(gl_info
)
3948 | adapter
->fragment_pipe
->get_emul_mask(gl_info
);
3949 if (gl_ext_emul_mask
& GL_EXT_EMUL_ARB_MULTITEXTURE
)
3950 install_gl_compat_wrapper(gl_info
, ARB_MULTITEXTURE
);
3951 if (gl_ext_emul_mask
& GL_EXT_EMUL_EXT_FOG_COORD
)
3952 install_gl_compat_wrapper(gl_info
, EXT_FOG_COORD
);
3957 UINT CDECL
wined3d_get_adapter_count(const struct wined3d
*wined3d
)
3959 TRACE("wined3d %p, reporting %u adapters.\n",
3960 wined3d
, wined3d
->adapter_count
);
3962 return wined3d
->adapter_count
;
3965 HRESULT CDECL
wined3d_register_software_device(struct wined3d
*wined3d
, void *init_function
)
3967 FIXME("wined3d %p, init_function %p stub!\n", wined3d
, init_function
);
3972 HRESULT CDECL
wined3d_get_output_desc(const struct wined3d
*wined3d
, unsigned int adapter_idx
,
3973 struct wined3d_output_desc
*desc
)
3975 enum wined3d_display_rotation rotation
;
3976 const struct wined3d_adapter
*adapter
;
3977 struct wined3d_display_mode mode
;
3981 TRACE("wined3d %p, adapter_idx %u, desc %p.\n", wined3d
, adapter_idx
, desc
);
3983 if (adapter_idx
>= wined3d
->adapter_count
)
3984 return WINED3DERR_INVALIDCALL
;
3986 adapter
= &wined3d
->adapters
[adapter_idx
];
3987 if (!(monitor
= MonitorFromPoint(adapter
->monitor_position
, MONITOR_DEFAULTTOPRIMARY
)))
3988 return WINED3DERR_INVALIDCALL
;
3990 if (FAILED(hr
= wined3d_get_adapter_display_mode(wined3d
, adapter_idx
, &mode
, &rotation
)))
3993 memcpy(desc
->device_name
, adapter
->DeviceName
, sizeof(desc
->device_name
));
3994 SetRect(&desc
->desktop_rect
, 0, 0, mode
.width
, mode
.height
);
3995 OffsetRect(&desc
->desktop_rect
, adapter
->monitor_position
.x
, adapter
->monitor_position
.y
);
3996 /* FIXME: We should get this from EnumDisplayDevices() when the adapters
3998 desc
->attached_to_desktop
= TRUE
;
3999 desc
->rotation
= rotation
;
4000 desc
->monitor
= monitor
;
4005 /* FIXME: GetAdapterModeCount and EnumAdapterModes currently only returns modes
4006 of the same bpp but different resolutions */
4008 /* Note: dx9 supplies a format. Calls from d3d8 supply WINED3DFMT_UNKNOWN */
4009 UINT CDECL
wined3d_get_adapter_mode_count(const struct wined3d
*wined3d
, UINT adapter_idx
,
4010 enum wined3d_format_id format_id
, enum wined3d_scanline_ordering scanline_ordering
)
4012 const struct wined3d_adapter
*adapter
;
4013 const struct wined3d_format
*format
;
4019 TRACE("wined3d %p, adapter_idx %u, format %s, scanline_ordering %#x.\n",
4020 wined3d
, adapter_idx
, debug_d3dformat(format_id
), scanline_ordering
);
4022 if (adapter_idx
>= wined3d
->adapter_count
)
4025 adapter
= &wined3d
->adapters
[adapter_idx
];
4026 format
= wined3d_get_format(&adapter
->gl_info
, format_id
);
4027 format_bits
= format
->byte_count
* CHAR_BIT
;
4029 memset(&mode
, 0, sizeof(mode
));
4030 mode
.dmSize
= sizeof(mode
);
4032 while (EnumDisplaySettingsExW(adapter
->DeviceName
, j
++, &mode
, 0))
4034 if (mode
.dmFields
& DM_DISPLAYFLAGS
)
4036 if (scanline_ordering
== WINED3D_SCANLINE_ORDERING_PROGRESSIVE
4037 && (mode
.u2
.dmDisplayFlags
& DM_INTERLACED
))
4040 if (scanline_ordering
== WINED3D_SCANLINE_ORDERING_INTERLACED
4041 && !(mode
.u2
.dmDisplayFlags
& DM_INTERLACED
))
4045 if (format_id
== WINED3DFMT_UNKNOWN
)
4047 /* This is for d3d8, do not enumerate P8 here. */
4048 if (mode
.dmBitsPerPel
== 32 || mode
.dmBitsPerPel
== 16) ++i
;
4050 else if (mode
.dmBitsPerPel
== format_bits
)
4056 TRACE("Returning %u matching modes (out of %u total) for adapter %u.\n", i
, j
, adapter_idx
);
4061 /* Note: dx9 supplies a format. Calls from d3d8 supply WINED3DFMT_UNKNOWN */
4062 HRESULT CDECL
wined3d_enum_adapter_modes(const struct wined3d
*wined3d
, UINT adapter_idx
,
4063 enum wined3d_format_id format_id
, enum wined3d_scanline_ordering scanline_ordering
,
4064 UINT mode_idx
, struct wined3d_display_mode
*mode
)
4066 const struct wined3d_adapter
*adapter
;
4067 const struct wined3d_format
*format
;
4073 TRACE("wined3d %p, adapter_idx %u, format %s, scanline_ordering %#x, mode_idx %u, mode %p.\n",
4074 wined3d
, adapter_idx
, debug_d3dformat(format_id
), scanline_ordering
, mode_idx
, mode
);
4076 if (!mode
|| adapter_idx
>= wined3d
->adapter_count
)
4077 return WINED3DERR_INVALIDCALL
;
4079 adapter
= &wined3d
->adapters
[adapter_idx
];
4080 format
= wined3d_get_format(&adapter
->gl_info
, format_id
);
4081 format_bits
= format
->byte_count
* CHAR_BIT
;
4083 memset(&m
, 0, sizeof(m
));
4084 m
.dmSize
= sizeof(m
);
4086 while (i
<= mode_idx
)
4088 if (!EnumDisplaySettingsExW(adapter
->DeviceName
, j
++, &m
, 0))
4090 WARN("Invalid mode_idx %u.\n", mode_idx
);
4091 return WINED3DERR_INVALIDCALL
;
4094 if (m
.dmFields
& DM_DISPLAYFLAGS
)
4096 if (scanline_ordering
== WINED3D_SCANLINE_ORDERING_PROGRESSIVE
4097 && (m
.u2
.dmDisplayFlags
& DM_INTERLACED
))
4100 if (scanline_ordering
== WINED3D_SCANLINE_ORDERING_INTERLACED
4101 && !(m
.u2
.dmDisplayFlags
& DM_INTERLACED
))
4105 if (format_id
== WINED3DFMT_UNKNOWN
)
4107 /* This is for d3d8, do not enumerate P8 here. */
4108 if (m
.dmBitsPerPel
== 32 || m
.dmBitsPerPel
== 16) ++i
;
4110 else if (m
.dmBitsPerPel
== format_bits
)
4116 mode
->width
= m
.dmPelsWidth
;
4117 mode
->height
= m
.dmPelsHeight
;
4118 mode
->refresh_rate
= DEFAULT_REFRESH_RATE
;
4119 if (m
.dmFields
& DM_DISPLAYFREQUENCY
)
4120 mode
->refresh_rate
= m
.dmDisplayFrequency
;
4122 if (format_id
== WINED3DFMT_UNKNOWN
)
4123 mode
->format_id
= pixelformat_for_depth(m
.dmBitsPerPel
);
4125 mode
->format_id
= format_id
;
4127 if (!(m
.dmFields
& DM_DISPLAYFLAGS
))
4128 mode
->scanline_ordering
= WINED3D_SCANLINE_ORDERING_UNKNOWN
;
4129 else if (m
.u2
.dmDisplayFlags
& DM_INTERLACED
)
4130 mode
->scanline_ordering
= WINED3D_SCANLINE_ORDERING_INTERLACED
;
4132 mode
->scanline_ordering
= WINED3D_SCANLINE_ORDERING_PROGRESSIVE
;
4134 TRACE("%ux%u@%u %u bpp, %s %#x.\n", mode
->width
, mode
->height
, mode
->refresh_rate
,
4135 m
.dmBitsPerPel
, debug_d3dformat(mode
->format_id
), mode
->scanline_ordering
);
4140 HRESULT CDECL
wined3d_get_adapter_display_mode(const struct wined3d
*wined3d
, UINT adapter_idx
,
4141 struct wined3d_display_mode
*mode
, enum wined3d_display_rotation
*rotation
)
4143 const struct wined3d_adapter
*adapter
;
4146 TRACE("wined3d %p, adapter_idx %u, display_mode %p, rotation %p.\n",
4147 wined3d
, adapter_idx
, mode
, rotation
);
4149 if (!mode
|| adapter_idx
>= wined3d
->adapter_count
)
4150 return WINED3DERR_INVALIDCALL
;
4152 adapter
= &wined3d
->adapters
[adapter_idx
];
4154 memset(&m
, 0, sizeof(m
));
4155 m
.dmSize
= sizeof(m
);
4157 EnumDisplaySettingsExW(adapter
->DeviceName
, ENUM_CURRENT_SETTINGS
, &m
, 0);
4158 mode
->width
= m
.dmPelsWidth
;
4159 mode
->height
= m
.dmPelsHeight
;
4160 mode
->refresh_rate
= DEFAULT_REFRESH_RATE
;
4161 if (m
.dmFields
& DM_DISPLAYFREQUENCY
)
4162 mode
->refresh_rate
= m
.dmDisplayFrequency
;
4163 mode
->format_id
= pixelformat_for_depth(m
.dmBitsPerPel
);
4165 /* Lie about the format. X11 can't change the color depth, and some apps
4166 * are pretty angry if they SetDisplayMode from 24 to 16 bpp and find out
4167 * that GetDisplayMode still returns 24 bpp. This should probably be
4168 * handled in winex11 instead. */
4169 if (adapter
->screen_format
&& adapter
->screen_format
!= mode
->format_id
)
4171 WARN("Overriding format %s with stored format %s.\n",
4172 debug_d3dformat(mode
->format_id
),
4173 debug_d3dformat(adapter
->screen_format
));
4174 mode
->format_id
= adapter
->screen_format
;
4177 if (!(m
.dmFields
& DM_DISPLAYFLAGS
))
4178 mode
->scanline_ordering
= WINED3D_SCANLINE_ORDERING_UNKNOWN
;
4179 else if (m
.u2
.dmDisplayFlags
& DM_INTERLACED
)
4180 mode
->scanline_ordering
= WINED3D_SCANLINE_ORDERING_INTERLACED
;
4182 mode
->scanline_ordering
= WINED3D_SCANLINE_ORDERING_PROGRESSIVE
;
4186 switch (m
.u1
.s2
.dmDisplayOrientation
)
4189 *rotation
= WINED3D_DISPLAY_ROTATION_0
;
4192 *rotation
= WINED3D_DISPLAY_ROTATION_90
;
4195 *rotation
= WINED3D_DISPLAY_ROTATION_180
;
4198 *rotation
= WINED3D_DISPLAY_ROTATION_270
;
4201 FIXME("Unhandled display rotation %#x.\n", m
.u1
.s2
.dmDisplayOrientation
);
4202 *rotation
= WINED3D_DISPLAY_ROTATION_UNSPECIFIED
;
4207 TRACE("Returning %ux%u@%u %s %#x.\n", mode
->width
, mode
->height
,
4208 mode
->refresh_rate
, debug_d3dformat(mode
->format_id
),
4209 mode
->scanline_ordering
);
4213 HRESULT CDECL
wined3d_set_adapter_display_mode(struct wined3d
*wined3d
,
4214 UINT adapter_idx
, const struct wined3d_display_mode
*mode
)
4216 struct wined3d_adapter
*adapter
;
4217 DEVMODEW new_mode
, current_mode
;
4220 enum wined3d_format_id new_format_id
;
4222 TRACE("wined3d %p, adapter_idx %u, mode %p.\n", wined3d
, adapter_idx
, mode
);
4224 if (adapter_idx
>= wined3d
->adapter_count
)
4225 return WINED3DERR_INVALIDCALL
;
4226 adapter
= &wined3d
->adapters
[adapter_idx
];
4228 memset(&new_mode
, 0, sizeof(new_mode
));
4229 new_mode
.dmSize
= sizeof(new_mode
);
4230 memset(¤t_mode
, 0, sizeof(current_mode
));
4231 current_mode
.dmSize
= sizeof(current_mode
);
4234 const struct wined3d_format
*format
;
4236 TRACE("mode %ux%u@%u %s %#x.\n", mode
->width
, mode
->height
, mode
->refresh_rate
,
4237 debug_d3dformat(mode
->format_id
), mode
->scanline_ordering
);
4239 format
= wined3d_get_format(&adapter
->gl_info
, mode
->format_id
);
4241 new_mode
.dmFields
= DM_BITSPERPEL
| DM_PELSWIDTH
| DM_PELSHEIGHT
;
4242 new_mode
.dmBitsPerPel
= format
->byte_count
* CHAR_BIT
;
4243 new_mode
.dmPelsWidth
= mode
->width
;
4244 new_mode
.dmPelsHeight
= mode
->height
;
4246 new_mode
.dmDisplayFrequency
= mode
->refresh_rate
;
4247 if (mode
->refresh_rate
)
4248 new_mode
.dmFields
|= DM_DISPLAYFREQUENCY
;
4250 if (mode
->scanline_ordering
!= WINED3D_SCANLINE_ORDERING_UNKNOWN
)
4252 new_mode
.dmFields
|= DM_DISPLAYFLAGS
;
4253 if (mode
->scanline_ordering
== WINED3D_SCANLINE_ORDERING_INTERLACED
)
4254 new_mode
.u2
.dmDisplayFlags
|= DM_INTERLACED
;
4256 new_format_id
= mode
->format_id
;
4260 if (!EnumDisplaySettingsW(adapter
->DeviceName
, ENUM_REGISTRY_SETTINGS
, &new_mode
))
4262 ERR("Failed to read mode from registry.\n");
4263 return WINED3DERR_NOTAVAILABLE
;
4265 new_format_id
= pixelformat_for_depth(new_mode
.dmBitsPerPel
);
4268 /* Only change the mode if necessary. */
4269 if (!EnumDisplaySettingsW(adapter
->DeviceName
, ENUM_CURRENT_SETTINGS
, ¤t_mode
))
4271 ERR("Failed to get current display mode.\n");
4273 else if (current_mode
.dmPelsWidth
== new_mode
.dmPelsWidth
4274 && current_mode
.dmPelsHeight
== new_mode
.dmPelsHeight
4275 && current_mode
.dmBitsPerPel
== new_mode
.dmBitsPerPel
4276 && (current_mode
.dmDisplayFrequency
== new_mode
.dmDisplayFrequency
4277 || !(new_mode
.dmFields
& DM_DISPLAYFREQUENCY
))
4278 && (current_mode
.u2
.dmDisplayFlags
== new_mode
.u2
.dmDisplayFlags
4279 || !(new_mode
.dmFields
& DM_DISPLAYFLAGS
)))
4281 TRACE("Skipping redundant mode setting call.\n");
4285 ret
= ChangeDisplaySettingsExW(adapter
->DeviceName
, &new_mode
, NULL
, CDS_FULLSCREEN
, NULL
);
4286 if (ret
!= DISP_CHANGE_SUCCESSFUL
)
4288 if (new_mode
.dmFields
& DM_DISPLAYFREQUENCY
)
4290 WARN("ChangeDisplaySettingsExW failed, trying without the refresh rate.\n");
4291 new_mode
.dmFields
&= ~DM_DISPLAYFREQUENCY
;
4292 new_mode
.dmDisplayFrequency
= 0;
4293 ret
= ChangeDisplaySettingsExW(adapter
->DeviceName
, &new_mode
, NULL
, CDS_FULLSCREEN
, NULL
);
4295 if (ret
!= DISP_CHANGE_SUCCESSFUL
)
4296 return WINED3DERR_NOTAVAILABLE
;
4299 /* Store the new values. */
4300 adapter
->screen_format
= new_format_id
;
4302 /* And finally clip mouse to our screen. */
4303 SetRect(&clip_rc
, 0, 0, new_mode
.dmPelsWidth
, new_mode
.dmPelsHeight
);
4304 ClipCursor(&clip_rc
);
4309 /* NOTE: due to structure differences between dx8 and dx9 D3DADAPTER_IDENTIFIER,
4310 and fields being inserted in the middle, a new structure is used in place */
4311 HRESULT CDECL
wined3d_get_adapter_identifier(const struct wined3d
*wined3d
,
4312 UINT adapter_idx
, DWORD flags
, struct wined3d_adapter_identifier
*identifier
)
4314 const struct wined3d_adapter
*adapter
;
4317 TRACE("wined3d %p, adapter_idx %u, flags %#x, identifier %p.\n",
4318 wined3d
, adapter_idx
, flags
, identifier
);
4320 if (adapter_idx
>= wined3d
->adapter_count
)
4321 return WINED3DERR_INVALIDCALL
;
4323 adapter
= &wined3d
->adapters
[adapter_idx
];
4325 if (identifier
->driver_size
)
4327 const char *name
= adapter
->driver_info
.name
;
4328 len
= min(strlen(name
), identifier
->driver_size
- 1);
4329 memcpy(identifier
->driver
, name
, len
);
4330 memset(&identifier
->driver
[len
], 0, identifier
->driver_size
- len
);
4333 if (identifier
->description_size
)
4335 const char *description
= adapter
->driver_info
.description
;
4336 len
= min(strlen(description
), identifier
->description_size
- 1);
4337 memcpy(identifier
->description
, description
, len
);
4338 memset(&identifier
->description
[len
], 0, identifier
->description_size
- len
);
4341 /* Note that d3d8 doesn't supply a device name. */
4342 if (identifier
->device_name_size
)
4344 if (!WideCharToMultiByte(CP_ACP
, 0, adapter
->DeviceName
, -1, identifier
->device_name
,
4345 identifier
->device_name_size
, NULL
, NULL
))
4347 ERR("Failed to convert device name, last error %#x.\n", GetLastError());
4348 return WINED3DERR_INVALIDCALL
;
4352 identifier
->driver_version
.u
.HighPart
= adapter
->driver_info
.version_high
;
4353 identifier
->driver_version
.u
.LowPart
= adapter
->driver_info
.version_low
;
4354 identifier
->vendor_id
= adapter
->driver_info
.vendor
;
4355 identifier
->device_id
= adapter
->driver_info
.device
;
4356 identifier
->subsystem_id
= 0;
4357 identifier
->revision
= 0;
4358 memcpy(&identifier
->device_identifier
, &IID_D3DDEVICE_D3DUID
, sizeof(identifier
->device_identifier
));
4359 identifier
->whql_level
= (flags
& WINED3DENUM_NO_WHQL_LEVEL
) ? 0 : 1;
4360 memcpy(&identifier
->adapter_luid
, &adapter
->luid
, sizeof(identifier
->adapter_luid
));
4361 identifier
->video_memory
= min(~(SIZE_T
)0, adapter
->vram_bytes
);
4366 HRESULT CDECL
wined3d_get_adapter_raster_status(const struct wined3d
*wined3d
, UINT adapter_idx
,
4367 struct wined3d_raster_status
*raster_status
)
4369 LONGLONG freq_per_frame
, freq_per_line
;
4370 LARGE_INTEGER counter
, freq_per_sec
;
4371 struct wined3d_display_mode mode
;
4375 FIXME("wined3d %p, adapter_idx %u, raster_status %p semi-stub!\n",
4376 wined3d
, adapter_idx
, raster_status
);
4378 WARN("wined3d %p, adapter_idx %u, raster_status %p semi-stub!\n",
4379 wined3d
, adapter_idx
, raster_status
);
4381 /* Obtaining the raster status is a widely implemented but optional
4382 * feature. When this method returns OK StarCraft 2 expects the
4383 * raster_status->InVBlank value to actually change over time.
4384 * And Endless Alice Crysis doesn't care even if this method fails.
4385 * Thus this method returns OK and fakes raster_status by
4386 * QueryPerformanceCounter. */
4388 if (!QueryPerformanceCounter(&counter
) || !QueryPerformanceFrequency(&freq_per_sec
))
4389 return WINED3DERR_INVALIDCALL
;
4390 if (FAILED(wined3d_get_adapter_display_mode(wined3d
, adapter_idx
, &mode
, NULL
)))
4391 return WINED3DERR_INVALIDCALL
;
4392 if (mode
.refresh_rate
== DEFAULT_REFRESH_RATE
)
4393 mode
.refresh_rate
= 60;
4395 freq_per_frame
= freq_per_sec
.QuadPart
/ mode
.refresh_rate
;
4396 /* Assume 20 scan lines in the vertical blank. */
4397 freq_per_line
= freq_per_frame
/ (mode
.height
+ 20);
4398 raster_status
->scan_line
= (counter
.QuadPart
% freq_per_frame
) / freq_per_line
;
4399 if (raster_status
->scan_line
< mode
.height
)
4400 raster_status
->in_vblank
= FALSE
;
4403 raster_status
->scan_line
= 0;
4404 raster_status
->in_vblank
= TRUE
;
4407 TRACE("Returning fake value, in_vblank %u, scan_line %u.\n",
4408 raster_status
->in_vblank
, raster_status
->scan_line
);
4413 static BOOL
wined3d_check_pixel_format_color(const struct wined3d_gl_info
*gl_info
,
4414 const struct wined3d_pixel_format
*cfg
, const struct wined3d_format
*format
)
4416 /* Float formats need FBOs. If FBOs are used this function isn't called */
4417 if (format
->flags
[WINED3D_GL_RES_TYPE_TEX_2D
] & WINED3DFMT_FLAG_FLOAT
)
4420 /* Probably a RGBA_float or color index mode. */
4421 if (cfg
->iPixelType
!= WGL_TYPE_RGBA_ARB
)
4424 if (cfg
->redSize
< format
->red_size
4425 || cfg
->greenSize
< format
->green_size
4426 || cfg
->blueSize
< format
->blue_size
4427 || cfg
->alphaSize
< format
->alpha_size
)
4433 static BOOL
wined3d_check_pixel_format_depth(const struct wined3d_gl_info
*gl_info
,
4434 const struct wined3d_pixel_format
*cfg
, const struct wined3d_format
*format
)
4436 BOOL lockable
= FALSE
;
4438 /* Float formats need FBOs. If FBOs are used this function isn't called */
4439 if (format
->flags
[WINED3D_GL_RES_TYPE_TEX_2D
] & WINED3DFMT_FLAG_FLOAT
)
4442 if ((format
->id
== WINED3DFMT_D16_LOCKABLE
) || (format
->id
== WINED3DFMT_D32_FLOAT
))
4445 /* On some modern cards like the Geforce8/9, GLX doesn't offer some
4446 * dephth/stencil formats which D3D9 reports. We can safely report
4447 * "compatible" formats (e.g. D24 can be used for D16) as long as we
4448 * aren't dealing with a lockable format. This also helps D3D <= 7 as they
4449 * expect D16 which isn't offered without this on Geforce8 cards. */
4450 if (!(cfg
->depthSize
== format
->depth_size
|| (!lockable
&& cfg
->depthSize
> format
->depth_size
)))
4453 /* Some cards like Intel i915 ones only offer D24S8 but lots of games also
4454 * need a format without stencil. We can allow a mismatch if the format
4455 * doesn't have any stencil bits. If it does have stencil bits the size
4456 * must match, or stencil wrapping would break. */
4457 if (format
->stencil_size
&& cfg
->stencilSize
!= format
->stencil_size
)
4463 HRESULT CDECL
wined3d_check_depth_stencil_match(const struct wined3d
*wined3d
,
4464 UINT adapter_idx
, enum wined3d_device_type device_type
, enum wined3d_format_id adapter_format_id
,
4465 enum wined3d_format_id render_target_format_id
, enum wined3d_format_id depth_stencil_format_id
)
4467 const struct wined3d_format
*rt_format
;
4468 const struct wined3d_format
*ds_format
;
4469 const struct wined3d_adapter
*adapter
;
4471 TRACE("wined3d %p, adapter_idx %u, device_type %s,\n"
4472 "adapter_format %s, render_target_format %s, depth_stencil_format %s.\n",
4473 wined3d
, adapter_idx
, debug_d3ddevicetype(device_type
), debug_d3dformat(adapter_format_id
),
4474 debug_d3dformat(render_target_format_id
), debug_d3dformat(depth_stencil_format_id
));
4476 if (adapter_idx
>= wined3d
->adapter_count
)
4477 return WINED3DERR_INVALIDCALL
;
4479 adapter
= &wined3d
->adapters
[adapter_idx
];
4480 rt_format
= wined3d_get_format(&adapter
->gl_info
, render_target_format_id
);
4481 ds_format
= wined3d_get_format(&adapter
->gl_info
, depth_stencil_format_id
);
4482 if (wined3d_settings
.offscreen_rendering_mode
== ORM_FBO
)
4484 if ((rt_format
->flags
[WINED3D_GL_RES_TYPE_TEX_2D
] & WINED3DFMT_FLAG_RENDERTARGET
)
4485 && (ds_format
->flags
[WINED3D_GL_RES_TYPE_TEX_2D
] & (WINED3DFMT_FLAG_DEPTH
| WINED3DFMT_FLAG_STENCIL
)))
4487 TRACE("Formats match.\n");
4493 const struct wined3d_pixel_format
*cfgs
;
4494 unsigned int cfg_count
;
4497 cfgs
= adapter
->cfgs
;
4498 cfg_count
= adapter
->cfg_count
;
4499 for (i
= 0; i
< cfg_count
; ++i
)
4501 if (wined3d_check_pixel_format_color(&adapter
->gl_info
, &cfgs
[i
], rt_format
)
4502 && wined3d_check_pixel_format_depth(&adapter
->gl_info
, &cfgs
[i
], ds_format
))
4504 TRACE("Formats match.\n");
4510 TRACE("Unsupported format pair: %s and %s.\n",
4511 debug_d3dformat(render_target_format_id
),
4512 debug_d3dformat(depth_stencil_format_id
));
4514 return WINED3DERR_NOTAVAILABLE
;
4517 HRESULT CDECL
wined3d_check_device_multisample_type(const struct wined3d
*wined3d
, UINT adapter_idx
,
4518 enum wined3d_device_type device_type
, enum wined3d_format_id surface_format_id
, BOOL windowed
,
4519 enum wined3d_multisample_type multisample_type
, DWORD
*quality_levels
)
4521 const struct wined3d_gl_info
*gl_info
= &wined3d
->adapters
[adapter_idx
].gl_info
;
4522 const struct wined3d_format
*format
= wined3d_get_format(gl_info
, surface_format_id
);
4523 HRESULT hr
= WINED3D_OK
;
4525 TRACE("wined3d %p, adapter_idx %u, device_type %s, surface_format %s, "
4526 "windowed %#x, multisample_type %#x, quality_levels %p.\n",
4527 wined3d
, adapter_idx
, debug_d3ddevicetype(device_type
), debug_d3dformat(surface_format_id
),
4528 windowed
, multisample_type
, quality_levels
);
4530 if (adapter_idx
>= wined3d
->adapter_count
)
4531 return WINED3DERR_INVALIDCALL
;
4532 if (surface_format_id
== WINED3DFMT_UNKNOWN
)
4533 return WINED3DERR_INVALIDCALL
;
4534 if (multisample_type
< WINED3D_MULTISAMPLE_NONE
)
4535 return WINED3DERR_INVALIDCALL
;
4536 if (multisample_type
> WINED3D_MULTISAMPLE_16_SAMPLES
)
4538 FIXME("multisample_type %u not handled yet.\n", multisample_type
);
4539 return WINED3DERR_NOTAVAILABLE
;
4542 if (multisample_type
&& !(format
->multisample_types
& 1u << (multisample_type
- 1)))
4543 hr
= WINED3DERR_NOTAVAILABLE
;
4545 if (SUCCEEDED(hr
) || (multisample_type
== WINED3D_MULTISAMPLE_NON_MASKABLE
&& format
->multisample_types
))
4549 if (multisample_type
== WINED3D_MULTISAMPLE_NON_MASKABLE
)
4550 *quality_levels
= wined3d_popcount(format
->multisample_types
);
4552 *quality_levels
= 1;
4557 TRACE("Returning not supported.\n");
4561 /* Check if the given DisplayFormat + DepthStencilFormat combination is valid for the Adapter */
4562 static BOOL
CheckDepthStencilCapability(const struct wined3d_adapter
*adapter
,
4563 const struct wined3d_format
*display_format
, const struct wined3d_format
*ds_format
,
4564 enum wined3d_gl_resource_type gl_type
)
4566 /* Only allow depth/stencil formats */
4567 if (!(ds_format
->depth_size
|| ds_format
->stencil_size
)) return FALSE
;
4569 /* Blacklist formats not supported on Windows */
4570 switch (ds_format
->id
)
4572 case WINED3DFMT_S1_UINT_D15_UNORM
: /* Breaks the shadowvol2 dx7 sdk sample */
4573 case WINED3DFMT_S4X4_UINT_D24_UNORM
:
4574 TRACE("[FAILED] - not supported on windows.\n");
4581 if (wined3d_settings
.offscreen_rendering_mode
== ORM_FBO
)
4583 /* With FBOs WGL limitations do not apply, but the format needs to be FBO attachable */
4584 if (ds_format
->flags
[gl_type
] & (WINED3DFMT_FLAG_DEPTH
| WINED3DFMT_FLAG_STENCIL
))
4591 /* Walk through all WGL pixel formats to find a match */
4592 for (i
= 0; i
< adapter
->cfg_count
; ++i
)
4594 const struct wined3d_pixel_format
*cfg
= &adapter
->cfgs
[i
];
4595 if (wined3d_check_pixel_format_color(&adapter
->gl_info
, cfg
, display_format
)
4596 && wined3d_check_pixel_format_depth(&adapter
->gl_info
, cfg
, ds_format
))
4604 /* Check the render target capabilities of a format */
4605 static BOOL
CheckRenderTargetCapability(const struct wined3d_adapter
*adapter
,
4606 const struct wined3d_format
*adapter_format
, const struct wined3d_format
*check_format
,
4607 enum wined3d_gl_resource_type gl_type
)
4609 /* Filter out non-RT formats */
4610 if (!(check_format
->flags
[gl_type
] & WINED3DFMT_FLAG_RENDERTARGET
))
4612 if (wined3d_settings
.offscreen_rendering_mode
== ORM_BACKBUFFER
)
4614 const struct wined3d_pixel_format
*cfgs
= adapter
->cfgs
;
4617 /* In backbuffer mode the front and backbuffer share the same WGL
4618 * pixelformat. The format must match in RGB, alpha is allowed to be
4619 * different. (Only the backbuffer can have alpha.) */
4620 if (adapter_format
->red_size
!= check_format
->red_size
4621 || adapter_format
->green_size
!= check_format
->green_size
4622 || adapter_format
->blue_size
!= check_format
->blue_size
)
4624 TRACE("[FAILED]\n");
4628 /* Check if there is a WGL pixel format matching the requirements, the format should also be window
4629 * drawable (not offscreen; e.g. Nvidia offers R5G6B5 for pbuffers even when X is running at 24bit) */
4630 for (i
= 0; i
< adapter
->cfg_count
; ++i
)
4632 if (cfgs
[i
].windowDrawable
4633 && wined3d_check_pixel_format_color(&adapter
->gl_info
, &cfgs
[i
], check_format
))
4635 TRACE("Pixel format %d is compatible with format %s.\n",
4636 cfgs
[i
].iPixelFormat
, debug_d3dformat(check_format
->id
));
4641 else if(wined3d_settings
.offscreen_rendering_mode
== ORM_FBO
)
4643 /* For now return TRUE for FBOs until we have some proper checks.
4644 * Note that this function will only be called when the format is around for texturing. */
4650 static BOOL
CheckSurfaceCapability(const struct wined3d_adapter
*adapter
,
4651 const struct wined3d_format
*adapter_format
,
4652 const struct wined3d_format
*check_format
, BOOL no3d
)
4656 switch (check_format
->id
)
4658 case WINED3DFMT_B8G8R8_UNORM
:
4659 TRACE("[FAILED] - Not enumerated on Windows.\n");
4661 case WINED3DFMT_B8G8R8A8_UNORM
:
4662 case WINED3DFMT_B8G8R8X8_UNORM
:
4663 case WINED3DFMT_B5G6R5_UNORM
:
4664 case WINED3DFMT_B5G5R5X1_UNORM
:
4665 case WINED3DFMT_B5G5R5A1_UNORM
:
4666 case WINED3DFMT_B4G4R4A4_UNORM
:
4667 case WINED3DFMT_B2G3R3_UNORM
:
4668 case WINED3DFMT_A8_UNORM
:
4669 case WINED3DFMT_B2G3R3A8_UNORM
:
4670 case WINED3DFMT_B4G4R4X4_UNORM
:
4671 case WINED3DFMT_R10G10B10A2_UNORM
:
4672 case WINED3DFMT_R8G8B8A8_UNORM
:
4673 case WINED3DFMT_R8G8B8X8_UNORM
:
4674 case WINED3DFMT_R16G16_UNORM
:
4675 case WINED3DFMT_B10G10R10A2_UNORM
:
4676 case WINED3DFMT_R16G16B16A16_UNORM
:
4677 case WINED3DFMT_P8_UINT
:
4681 TRACE("[FAILED] - Not available on GDI surfaces.\n");
4686 /* All formats that are supported for textures are supported for surfaces
4688 if (check_format
->flags
[WINED3D_GL_RES_TYPE_TEX_2D
] & WINED3DFMT_FLAG_TEXTURE
)
4690 /* All depth stencil formats are supported on surfaces */
4691 if (CheckDepthStencilCapability(adapter
, adapter_format
, check_format
, WINED3D_GL_RES_TYPE_TEX_2D
))
4693 if (CheckDepthStencilCapability(adapter
, adapter_format
, check_format
, WINED3D_GL_RES_TYPE_RB
))
4696 /* If opengl can't process the format natively, the blitter may be able to convert it */
4697 if (adapter
->blitter
->blit_supported(&adapter
->gl_info
, &adapter
->d3d_info
,
4698 WINED3D_BLIT_OP_COLOR_BLIT
,
4699 NULL
, WINED3D_POOL_DEFAULT
, 0, check_format
,
4700 NULL
, WINED3D_POOL_DEFAULT
, 0, adapter_format
))
4706 /* Reject other formats */
4707 TRACE("[FAILED]\n");
4711 /* OpenGL supports mipmapping on all formats. Wrapping is unsupported, but we
4712 * have to report mipmapping so we cannot reject WRAPANDMIP. Tests show that
4713 * Windows reports WRAPANDMIP on unfilterable surfaces as well, apparently to
4714 * show that wrapping is supported. The lack of filtering will sort out the
4715 * mipmapping capability anyway.
4717 * For now lets report this on all formats, but in the future we may want to
4718 * restrict it to some should applications need that. */
4719 HRESULT CDECL
wined3d_check_device_format(const struct wined3d
*wined3d
, UINT adapter_idx
,
4720 enum wined3d_device_type device_type
, enum wined3d_format_id adapter_format_id
, DWORD usage
,
4721 enum wined3d_resource_type resource_type
, enum wined3d_format_id check_format_id
)
4723 const struct wined3d_adapter
*adapter
= &wined3d
->adapters
[adapter_idx
];
4724 const struct wined3d_gl_info
*gl_info
= &adapter
->gl_info
;
4725 const struct wined3d_format
*adapter_format
= wined3d_get_format(gl_info
, adapter_format_id
);
4726 const struct wined3d_format
*format
= wined3d_get_format(gl_info
, check_format_id
);
4727 DWORD format_flags
= 0;
4728 DWORD allowed_usage
;
4729 enum wined3d_gl_resource_type gl_type
;
4731 TRACE("wined3d %p, adapter_idx %u, device_type %s, adapter_format %s, usage %s, %s,\n"
4732 "resource_type %s, check_format %s.\n",
4733 wined3d
, adapter_idx
, debug_d3ddevicetype(device_type
), debug_d3dformat(adapter_format_id
),
4734 debug_d3dusage(usage
), debug_d3dusagequery(usage
), debug_d3dresourcetype(resource_type
),
4735 debug_d3dformat(check_format_id
));
4737 if (adapter_idx
>= wined3d
->adapter_count
)
4738 return WINED3DERR_INVALIDCALL
;
4740 switch (resource_type
)
4742 case WINED3D_RTYPE_TEXTURE_2D
:
4743 allowed_usage
= WINED3DUSAGE_DEPTHSTENCIL
4744 | WINED3DUSAGE_RENDERTARGET
4745 | WINED3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING
;
4746 if (usage
& WINED3DUSAGE_RENDERTARGET
)
4747 allowed_usage
|= WINED3DUSAGE_QUERY_SRGBWRITE
;
4748 if (!(usage
& WINED3DUSAGE_TEXTURE
))
4750 if (!CheckSurfaceCapability(adapter
, adapter_format
, format
, wined3d
->flags
& WINED3D_NO3D
))
4752 TRACE("[FAILED] - Not supported for plain surfaces.\n");
4753 return WINED3DERR_NOTAVAILABLE
;
4756 gl_type
= WINED3D_GL_RES_TYPE_RB
;
4759 allowed_usage
|= WINED3DUSAGE_AUTOGENMIPMAP
4760 | WINED3DUSAGE_DYNAMIC
4761 | WINED3DUSAGE_LEGACY_CUBEMAP
4762 | WINED3DUSAGE_SOFTWAREPROCESSING
4763 | WINED3DUSAGE_TEXTURE
4764 | WINED3DUSAGE_QUERY_FILTER
4765 | WINED3DUSAGE_QUERY_LEGACYBUMPMAP
4766 | WINED3DUSAGE_QUERY_SRGBREAD
4767 | WINED3DUSAGE_QUERY_SRGBWRITE
4768 | WINED3DUSAGE_QUERY_VERTEXTEXTURE
4769 | WINED3DUSAGE_QUERY_WRAPANDMIP
;
4770 gl_type
= WINED3D_GL_RES_TYPE_TEX_2D
;
4771 if (usage
& WINED3DUSAGE_LEGACY_CUBEMAP
)
4773 allowed_usage
&= ~(WINED3DUSAGE_DEPTHSTENCIL
| WINED3DUSAGE_QUERY_LEGACYBUMPMAP
);
4774 gl_type
= WINED3D_GL_RES_TYPE_TEX_CUBE
;
4776 else if ((usage
& WINED3DUSAGE_DEPTHSTENCIL
)
4777 && (format
->flags
[WINED3D_GL_RES_TYPE_TEX_2D
] & WINED3DFMT_FLAG_SHADOW
)
4778 && !gl_info
->supported
[ARB_SHADOW
])
4780 TRACE("[FAILED] - No shadow sampler support.\n");
4781 return WINED3DERR_NOTAVAILABLE
;
4785 case WINED3D_RTYPE_TEXTURE_3D
:
4786 allowed_usage
= WINED3DUSAGE_DYNAMIC
4787 | WINED3DUSAGE_SOFTWAREPROCESSING
4788 | WINED3DUSAGE_TEXTURE
4789 | WINED3DUSAGE_QUERY_FILTER
4790 | WINED3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING
4791 | WINED3DUSAGE_QUERY_SRGBREAD
4792 | WINED3DUSAGE_QUERY_SRGBWRITE
4793 | WINED3DUSAGE_QUERY_VERTEXTEXTURE
4794 | WINED3DUSAGE_QUERY_WRAPANDMIP
;
4795 gl_type
= WINED3D_GL_RES_TYPE_TEX_3D
;
4799 FIXME("Unhandled resource type %s.\n", debug_d3dresourcetype(resource_type
));
4800 return WINED3DERR_NOTAVAILABLE
;
4803 if ((usage
& allowed_usage
) != usage
)
4805 TRACE("Requested usage %#x, but resource type %s only allows %#x.\n",
4806 usage
, debug_d3dresourcetype(resource_type
), allowed_usage
);
4807 return WINED3DERR_NOTAVAILABLE
;
4810 if (usage
& WINED3DUSAGE_TEXTURE
)
4811 format_flags
|= WINED3DFMT_FLAG_TEXTURE
;
4812 if (usage
& WINED3DUSAGE_QUERY_FILTER
)
4813 format_flags
|= WINED3DFMT_FLAG_FILTERING
;
4814 if (usage
& WINED3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING
)
4815 format_flags
|= WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING
;
4816 if (usage
& WINED3DUSAGE_QUERY_SRGBREAD
)
4817 format_flags
|= WINED3DFMT_FLAG_SRGB_READ
;
4818 if (usage
& WINED3DUSAGE_QUERY_SRGBWRITE
)
4819 format_flags
|= WINED3DFMT_FLAG_SRGB_WRITE
;
4820 if (usage
& WINED3DUSAGE_QUERY_VERTEXTEXTURE
)
4821 format_flags
|= WINED3DFMT_FLAG_VTF
;
4822 if (usage
& WINED3DUSAGE_QUERY_LEGACYBUMPMAP
)
4823 format_flags
|= WINED3DFMT_FLAG_BUMPMAP
;
4825 if ((format
->flags
[gl_type
] & format_flags
) != format_flags
)
4827 TRACE("Requested format flags %#x, but format %s only has %#x.\n",
4828 format_flags
, debug_d3dformat(check_format_id
), format
->flags
[gl_type
]);
4829 return WINED3DERR_NOTAVAILABLE
;
4832 if ((format_flags
& WINED3DFMT_FLAG_TEXTURE
) && (wined3d
->flags
& WINED3D_NO3D
))
4834 TRACE("Requested texturing support, but wined3d was created with WINED3D_NO3D.\n");
4835 return WINED3DERR_NOTAVAILABLE
;
4838 if ((usage
& WINED3DUSAGE_DEPTHSTENCIL
)
4839 && !CheckDepthStencilCapability(adapter
, adapter_format
, format
, gl_type
))
4841 TRACE("Requested WINED3DUSAGE_DEPTHSTENCIL, but format %s is not supported for depth / stencil buffers.\n",
4842 debug_d3dformat(check_format_id
));
4843 return WINED3DERR_NOTAVAILABLE
;
4846 if ((usage
& WINED3DUSAGE_RENDERTARGET
)
4847 && !CheckRenderTargetCapability(adapter
, adapter_format
, format
, gl_type
))
4849 TRACE("Requested WINED3DUSAGE_RENDERTARGET, but format %s is not supported for render targets.\n",
4850 debug_d3dformat(check_format_id
));
4851 return WINED3DERR_NOTAVAILABLE
;
4854 if ((usage
& WINED3DUSAGE_AUTOGENMIPMAP
) && !gl_info
->supported
[SGIS_GENERATE_MIPMAP
])
4856 TRACE("No WINED3DUSAGE_AUTOGENMIPMAP support, returning WINED3DOK_NOAUTOGEN.\n");
4857 return WINED3DOK_NOAUTOGEN
;
4863 UINT CDECL
wined3d_calculate_format_pitch(const struct wined3d
*wined3d
, UINT adapter_idx
,
4864 enum wined3d_format_id format_id
, UINT width
)
4866 const struct wined3d_gl_info
*gl_info
;
4867 unsigned int row_pitch
, slice_pitch
;
4869 TRACE("wined3d %p, adapter_idx %u, format_id %s, width %u.\n",
4870 wined3d
, adapter_idx
, debug_d3dformat(format_id
), width
);
4872 if (adapter_idx
>= wined3d
->adapter_count
)
4875 gl_info
= &wined3d
->adapters
[adapter_idx
].gl_info
;
4876 wined3d_format_calculate_pitch(wined3d_get_format(gl_info
, format_id
),
4877 1, width
, 1, &row_pitch
, &slice_pitch
);
4882 HRESULT CDECL
wined3d_check_device_format_conversion(const struct wined3d
*wined3d
, UINT adapter_idx
,
4883 enum wined3d_device_type device_type
, enum wined3d_format_id src_format
, enum wined3d_format_id dst_format
)
4885 FIXME("wined3d %p, adapter_idx %u, device_type %s, src_format %s, dst_format %s stub!\n",
4886 wined3d
, adapter_idx
, debug_d3ddevicetype(device_type
), debug_d3dformat(src_format
),
4887 debug_d3dformat(dst_format
));
4892 HRESULT CDECL
wined3d_check_device_type(const struct wined3d
*wined3d
, UINT adapter_idx
,
4893 enum wined3d_device_type device_type
, enum wined3d_format_id display_format
,
4894 enum wined3d_format_id backbuffer_format
, BOOL windowed
)
4896 BOOL present_conversion
= wined3d
->flags
& WINED3D_PRESENT_CONVERSION
;
4898 TRACE("wined3d %p, adapter_idx %u, device_type %s, display_format %s, backbuffer_format %s, windowed %#x.\n",
4899 wined3d
, adapter_idx
, debug_d3ddevicetype(device_type
), debug_d3dformat(display_format
),
4900 debug_d3dformat(backbuffer_format
), windowed
);
4902 if (adapter_idx
>= wined3d
->adapter_count
)
4903 return WINED3DERR_INVALIDCALL
;
4905 /* The task of this function is to check whether a certain display / backbuffer format
4906 * combination is available on the given adapter. In fullscreen mode microsoft specified
4907 * that the display format shouldn't provide alpha and that ignoring alpha the backbuffer
4908 * and display format should match exactly.
4909 * In windowed mode format conversion can occur and this depends on the driver. */
4911 /* There are only 4 display formats. */
4912 if (!(display_format
== WINED3DFMT_B5G6R5_UNORM
4913 || display_format
== WINED3DFMT_B5G5R5X1_UNORM
4914 || display_format
== WINED3DFMT_B8G8R8X8_UNORM
4915 || display_format
== WINED3DFMT_B10G10R10A2_UNORM
))
4917 TRACE("Format %s is not supported as display format.\n", debug_d3dformat(display_format
));
4918 return WINED3DERR_NOTAVAILABLE
;
4923 /* If the requested display format is not available, don't continue. */
4924 if (!wined3d_get_adapter_mode_count(wined3d
, adapter_idx
,
4925 display_format
, WINED3D_SCANLINE_ORDERING_UNKNOWN
))
4927 TRACE("No available modes for display format %s.\n", debug_d3dformat(display_format
));
4928 return WINED3DERR_NOTAVAILABLE
;
4931 present_conversion
= FALSE
;
4933 else if (display_format
== WINED3DFMT_B10G10R10A2_UNORM
)
4935 /* WINED3DFMT_B10G10R10A2_UNORM is only allowed in fullscreen mode. */
4936 TRACE("Unsupported format combination %s / %s in windowed mode.\n",
4937 debug_d3dformat(display_format
), debug_d3dformat(backbuffer_format
));
4938 return WINED3DERR_NOTAVAILABLE
;
4941 if (present_conversion
)
4943 /* Use the display format as back buffer format if the latter is
4944 * WINED3DFMT_UNKNOWN. */
4945 if (backbuffer_format
== WINED3DFMT_UNKNOWN
)
4946 backbuffer_format
= display_format
;
4948 if (FAILED(wined3d_check_device_format_conversion(wined3d
, adapter_idx
,
4949 device_type
, backbuffer_format
, display_format
)))
4951 TRACE("Format conversion from %s to %s not supported.\n",
4952 debug_d3dformat(backbuffer_format
), debug_d3dformat(display_format
));
4953 return WINED3DERR_NOTAVAILABLE
;
4958 /* When format conversion from the back buffer format to the display
4959 * format is not allowed, only a limited number of combinations are
4962 if (display_format
== WINED3DFMT_B5G6R5_UNORM
&& backbuffer_format
!= WINED3DFMT_B5G6R5_UNORM
)
4964 TRACE("Unsupported format combination %s / %s.\n",
4965 debug_d3dformat(display_format
), debug_d3dformat(backbuffer_format
));
4966 return WINED3DERR_NOTAVAILABLE
;
4969 if (display_format
== WINED3DFMT_B5G5R5X1_UNORM
4970 && !(backbuffer_format
== WINED3DFMT_B5G5R5X1_UNORM
|| backbuffer_format
== WINED3DFMT_B5G5R5A1_UNORM
))
4972 TRACE("Unsupported format combination %s / %s.\n",
4973 debug_d3dformat(display_format
), debug_d3dformat(backbuffer_format
));
4974 return WINED3DERR_NOTAVAILABLE
;
4977 if (display_format
== WINED3DFMT_B8G8R8X8_UNORM
4978 && !(backbuffer_format
== WINED3DFMT_B8G8R8X8_UNORM
|| backbuffer_format
== WINED3DFMT_B8G8R8A8_UNORM
))
4980 TRACE("Unsupported format combination %s / %s.\n",
4981 debug_d3dformat(display_format
), debug_d3dformat(backbuffer_format
));
4982 return WINED3DERR_NOTAVAILABLE
;
4985 if (display_format
== WINED3DFMT_B10G10R10A2_UNORM
4986 && backbuffer_format
!= WINED3DFMT_B10G10R10A2_UNORM
)
4988 TRACE("Unsupported format combination %s / %s.\n",
4989 debug_d3dformat(display_format
), debug_d3dformat(backbuffer_format
));
4990 return WINED3DERR_NOTAVAILABLE
;
4994 /* Validate that the back buffer format is usable for render targets. */
4995 if (FAILED(wined3d_check_device_format(wined3d
, adapter_idx
, device_type
, display_format
,
4996 WINED3DUSAGE_RENDERTARGET
, WINED3D_RTYPE_TEXTURE_2D
, backbuffer_format
)))
4998 TRACE("Format %s not allowed for render targets.\n", debug_d3dformat(backbuffer_format
));
4999 return WINED3DERR_NOTAVAILABLE
;
5005 HRESULT CDECL
wined3d_get_device_caps(const struct wined3d
*wined3d
, UINT adapter_idx
,
5006 enum wined3d_device_type device_type
, WINED3DCAPS
*caps
)
5008 const struct wined3d_adapter
*adapter
= &wined3d
->adapters
[adapter_idx
];
5009 const struct wined3d_gl_info
*gl_info
= &adapter
->gl_info
;
5010 struct shader_caps shader_caps
;
5011 struct fragment_caps fragment_caps
;
5012 struct wined3d_vertex_caps vertex_caps
;
5013 DWORD ckey_caps
, blit_caps
, fx_caps
;
5015 TRACE("wined3d %p, adapter_idx %u, device_type %s, caps %p.\n",
5016 wined3d
, adapter_idx
, debug_d3ddevicetype(device_type
), caps
);
5018 if (adapter_idx
>= wined3d
->adapter_count
)
5019 return WINED3DERR_INVALIDCALL
;
5021 caps
->DeviceType
= (device_type
== WINED3D_DEVICE_TYPE_HAL
) ? WINED3D_DEVICE_TYPE_HAL
: WINED3D_DEVICE_TYPE_REF
;
5022 caps
->AdapterOrdinal
= adapter_idx
;
5025 caps
->Caps2
= WINED3DCAPS2_CANRENDERWINDOWED
|
5026 WINED3DCAPS2_FULLSCREENGAMMA
|
5027 WINED3DCAPS2_DYNAMICTEXTURES
;
5028 if (gl_info
->supported
[SGIS_GENERATE_MIPMAP
])
5029 caps
->Caps2
|= WINED3DCAPS2_CANAUTOGENMIPMAP
;
5031 caps
->Caps3
= WINED3DCAPS3_ALPHA_FULLSCREEN_FLIP_OR_DISCARD
|
5032 WINED3DCAPS3_COPY_TO_VIDMEM
|
5033 WINED3DCAPS3_COPY_TO_SYSTEMMEM
;
5035 caps
->PresentationIntervals
= WINED3DPRESENT_INTERVAL_IMMEDIATE
|
5036 WINED3DPRESENT_INTERVAL_ONE
;
5038 caps
->CursorCaps
= WINED3DCURSORCAPS_COLOR
|
5039 WINED3DCURSORCAPS_LOWRES
;
5041 caps
->DevCaps
= WINED3DDEVCAPS_FLOATTLVERTEX
|
5042 WINED3DDEVCAPS_EXECUTESYSTEMMEMORY
|
5043 WINED3DDEVCAPS_TLVERTEXSYSTEMMEMORY
|
5044 WINED3DDEVCAPS_TLVERTEXVIDEOMEMORY
|
5045 WINED3DDEVCAPS_DRAWPRIMTLVERTEX
|
5046 WINED3DDEVCAPS_HWTRANSFORMANDLIGHT
|
5047 WINED3DDEVCAPS_EXECUTEVIDEOMEMORY
|
5048 WINED3DDEVCAPS_PUREDEVICE
|
5049 WINED3DDEVCAPS_HWRASTERIZATION
|
5050 WINED3DDEVCAPS_TEXTUREVIDEOMEMORY
|
5051 WINED3DDEVCAPS_TEXTURESYSTEMMEMORY
|
5052 WINED3DDEVCAPS_CANRENDERAFTERFLIP
|
5053 WINED3DDEVCAPS_DRAWPRIMITIVES2
|
5054 WINED3DDEVCAPS_DRAWPRIMITIVES2EX
;
5056 caps
->PrimitiveMiscCaps
= WINED3DPMISCCAPS_CULLNONE
|
5057 WINED3DPMISCCAPS_CULLCCW
|
5058 WINED3DPMISCCAPS_CULLCW
|
5059 WINED3DPMISCCAPS_COLORWRITEENABLE
|
5060 WINED3DPMISCCAPS_CLIPTLVERTS
|
5061 WINED3DPMISCCAPS_CLIPPLANESCALEDPOINTS
|
5062 WINED3DPMISCCAPS_MASKZ
|
5063 WINED3DPMISCCAPS_MRTPOSTPIXELSHADERBLENDING
;
5065 WINED3DPMISCCAPS_NULLREFERENCE
5066 WINED3DPMISCCAPS_FOGANDSPECULARALPHA
5067 WINED3DPMISCCAPS_MRTINDEPENDENTBITDEPTHS
5068 WINED3DPMISCCAPS_FOGVERTEXCLAMPED */
5070 if (gl_info
->supported
[WINED3D_GL_BLEND_EQUATION
])
5071 caps
->PrimitiveMiscCaps
|= WINED3DPMISCCAPS_BLENDOP
;
5072 if (gl_info
->supported
[EXT_BLEND_EQUATION_SEPARATE
] && gl_info
->supported
[EXT_BLEND_FUNC_SEPARATE
])
5073 caps
->PrimitiveMiscCaps
|= WINED3DPMISCCAPS_SEPARATEALPHABLEND
;
5074 if (gl_info
->supported
[EXT_DRAW_BUFFERS2
])
5075 caps
->PrimitiveMiscCaps
|= WINED3DPMISCCAPS_INDEPENDENTWRITEMASKS
;
5076 if (gl_info
->supported
[ARB_FRAMEBUFFER_SRGB
])
5077 caps
->PrimitiveMiscCaps
|= WINED3DPMISCCAPS_POSTBLENDSRGBCONVERT
;
5079 caps
->RasterCaps
= WINED3DPRASTERCAPS_DITHER
|
5080 WINED3DPRASTERCAPS_PAT
|
5081 WINED3DPRASTERCAPS_WFOG
|
5082 WINED3DPRASTERCAPS_ZFOG
|
5083 WINED3DPRASTERCAPS_FOGVERTEX
|
5084 WINED3DPRASTERCAPS_FOGTABLE
|
5085 WINED3DPRASTERCAPS_STIPPLE
|
5086 WINED3DPRASTERCAPS_SUBPIXEL
|
5087 WINED3DPRASTERCAPS_ZTEST
|
5088 WINED3DPRASTERCAPS_SCISSORTEST
|
5089 WINED3DPRASTERCAPS_SLOPESCALEDEPTHBIAS
|
5090 WINED3DPRASTERCAPS_DEPTHBIAS
;
5092 if (gl_info
->supported
[EXT_TEXTURE_FILTER_ANISOTROPIC
])
5094 caps
->RasterCaps
|= WINED3DPRASTERCAPS_ANISOTROPY
|
5095 WINED3DPRASTERCAPS_ZBIAS
|
5096 WINED3DPRASTERCAPS_MIPMAPLODBIAS
;
5099 caps
->ZCmpCaps
= WINED3DPCMPCAPS_ALWAYS
|
5100 WINED3DPCMPCAPS_EQUAL
|
5101 WINED3DPCMPCAPS_GREATER
|
5102 WINED3DPCMPCAPS_GREATEREQUAL
|
5103 WINED3DPCMPCAPS_LESS
|
5104 WINED3DPCMPCAPS_LESSEQUAL
|
5105 WINED3DPCMPCAPS_NEVER
|
5106 WINED3DPCMPCAPS_NOTEQUAL
;
5108 /* WINED3DPBLENDCAPS_BOTHINVSRCALPHA and WINED3DPBLENDCAPS_BOTHSRCALPHA
5109 * are legacy settings for srcblend only. */
5110 caps
->SrcBlendCaps
= WINED3DPBLENDCAPS_BOTHINVSRCALPHA
|
5111 WINED3DPBLENDCAPS_BOTHSRCALPHA
|
5112 WINED3DPBLENDCAPS_DESTALPHA
|
5113 WINED3DPBLENDCAPS_DESTCOLOR
|
5114 WINED3DPBLENDCAPS_INVDESTALPHA
|
5115 WINED3DPBLENDCAPS_INVDESTCOLOR
|
5116 WINED3DPBLENDCAPS_INVSRCALPHA
|
5117 WINED3DPBLENDCAPS_INVSRCCOLOR
|
5118 WINED3DPBLENDCAPS_ONE
|
5119 WINED3DPBLENDCAPS_SRCALPHA
|
5120 WINED3DPBLENDCAPS_SRCALPHASAT
|
5121 WINED3DPBLENDCAPS_SRCCOLOR
|
5122 WINED3DPBLENDCAPS_ZERO
;
5124 caps
->DestBlendCaps
= WINED3DPBLENDCAPS_DESTALPHA
|
5125 WINED3DPBLENDCAPS_DESTCOLOR
|
5126 WINED3DPBLENDCAPS_INVDESTALPHA
|
5127 WINED3DPBLENDCAPS_INVDESTCOLOR
|
5128 WINED3DPBLENDCAPS_INVSRCALPHA
|
5129 WINED3DPBLENDCAPS_INVSRCCOLOR
|
5130 WINED3DPBLENDCAPS_ONE
|
5131 WINED3DPBLENDCAPS_SRCALPHA
|
5132 WINED3DPBLENDCAPS_SRCCOLOR
|
5133 WINED3DPBLENDCAPS_ZERO
;
5135 if (gl_info
->supported
[ARB_BLEND_FUNC_EXTENDED
])
5136 caps
->DestBlendCaps
|= WINED3DPBLENDCAPS_SRCALPHASAT
;
5138 if (gl_info
->supported
[EXT_BLEND_COLOR
])
5140 caps
->SrcBlendCaps
|= WINED3DPBLENDCAPS_BLENDFACTOR
;
5141 caps
->DestBlendCaps
|= WINED3DPBLENDCAPS_BLENDFACTOR
;
5145 caps
->AlphaCmpCaps
= WINED3DPCMPCAPS_ALWAYS
|
5146 WINED3DPCMPCAPS_EQUAL
|
5147 WINED3DPCMPCAPS_GREATER
|
5148 WINED3DPCMPCAPS_GREATEREQUAL
|
5149 WINED3DPCMPCAPS_LESS
|
5150 WINED3DPCMPCAPS_LESSEQUAL
|
5151 WINED3DPCMPCAPS_NEVER
|
5152 WINED3DPCMPCAPS_NOTEQUAL
;
5154 caps
->ShadeCaps
= WINED3DPSHADECAPS_SPECULARGOURAUDRGB
|
5155 WINED3DPSHADECAPS_COLORGOURAUDRGB
|
5156 WINED3DPSHADECAPS_ALPHAFLATBLEND
|
5157 WINED3DPSHADECAPS_ALPHAGOURAUDBLEND
|
5158 WINED3DPSHADECAPS_COLORFLATRGB
|
5159 WINED3DPSHADECAPS_FOGFLAT
|
5160 WINED3DPSHADECAPS_FOGGOURAUD
|
5161 WINED3DPSHADECAPS_SPECULARFLATRGB
;
5163 caps
->TextureCaps
= WINED3DPTEXTURECAPS_ALPHA
|
5164 WINED3DPTEXTURECAPS_ALPHAPALETTE
|
5165 WINED3DPTEXTURECAPS_TRANSPARENCY
|
5166 WINED3DPTEXTURECAPS_BORDER
|
5167 WINED3DPTEXTURECAPS_MIPMAP
|
5168 WINED3DPTEXTURECAPS_PROJECTED
|
5169 WINED3DPTEXTURECAPS_PERSPECTIVE
;
5171 if (!gl_info
->supported
[ARB_TEXTURE_NON_POWER_OF_TWO
])
5173 caps
->TextureCaps
|= WINED3DPTEXTURECAPS_POW2
;
5174 if (gl_info
->supported
[WINED3D_GL_NORMALIZED_TEXRECT
] || gl_info
->supported
[ARB_TEXTURE_RECTANGLE
])
5175 caps
->TextureCaps
|= WINED3DPTEXTURECAPS_NONPOW2CONDITIONAL
;
5178 if (gl_info
->supported
[EXT_TEXTURE3D
])
5180 caps
->TextureCaps
|= WINED3DPTEXTURECAPS_VOLUMEMAP
|
5181 WINED3DPTEXTURECAPS_MIPVOLUMEMAP
;
5182 if (!gl_info
->supported
[ARB_TEXTURE_NON_POWER_OF_TWO
])
5184 caps
->TextureCaps
|= WINED3DPTEXTURECAPS_VOLUMEMAP_POW2
;
5188 if (gl_info
->supported
[ARB_TEXTURE_CUBE_MAP
])
5190 caps
->TextureCaps
|= WINED3DPTEXTURECAPS_CUBEMAP
|
5191 WINED3DPTEXTURECAPS_MIPCUBEMAP
;
5192 if (!gl_info
->supported
[ARB_TEXTURE_NON_POWER_OF_TWO
])
5194 caps
->TextureCaps
|= WINED3DPTEXTURECAPS_CUBEMAP_POW2
;
5198 caps
->TextureFilterCaps
= WINED3DPTFILTERCAPS_MAGFLINEAR
|
5199 WINED3DPTFILTERCAPS_MAGFPOINT
|
5200 WINED3DPTFILTERCAPS_MINFLINEAR
|
5201 WINED3DPTFILTERCAPS_MINFPOINT
|
5202 WINED3DPTFILTERCAPS_MIPFLINEAR
|
5203 WINED3DPTFILTERCAPS_MIPFPOINT
|
5204 WINED3DPTFILTERCAPS_LINEAR
|
5205 WINED3DPTFILTERCAPS_LINEARMIPLINEAR
|
5206 WINED3DPTFILTERCAPS_LINEARMIPNEAREST
|
5207 WINED3DPTFILTERCAPS_MIPLINEAR
|
5208 WINED3DPTFILTERCAPS_MIPNEAREST
|
5209 WINED3DPTFILTERCAPS_NEAREST
;
5211 if (gl_info
->supported
[EXT_TEXTURE_FILTER_ANISOTROPIC
])
5213 caps
->TextureFilterCaps
|= WINED3DPTFILTERCAPS_MAGFANISOTROPIC
|
5214 WINED3DPTFILTERCAPS_MINFANISOTROPIC
;
5217 if (gl_info
->supported
[ARB_TEXTURE_CUBE_MAP
])
5219 caps
->CubeTextureFilterCaps
= WINED3DPTFILTERCAPS_MAGFLINEAR
|
5220 WINED3DPTFILTERCAPS_MAGFPOINT
|
5221 WINED3DPTFILTERCAPS_MINFLINEAR
|
5222 WINED3DPTFILTERCAPS_MINFPOINT
|
5223 WINED3DPTFILTERCAPS_MIPFLINEAR
|
5224 WINED3DPTFILTERCAPS_MIPFPOINT
|
5225 WINED3DPTFILTERCAPS_LINEAR
|
5226 WINED3DPTFILTERCAPS_LINEARMIPLINEAR
|
5227 WINED3DPTFILTERCAPS_LINEARMIPNEAREST
|
5228 WINED3DPTFILTERCAPS_MIPLINEAR
|
5229 WINED3DPTFILTERCAPS_MIPNEAREST
|
5230 WINED3DPTFILTERCAPS_NEAREST
;
5232 if (gl_info
->supported
[EXT_TEXTURE_FILTER_ANISOTROPIC
])
5234 caps
->CubeTextureFilterCaps
|= WINED3DPTFILTERCAPS_MAGFANISOTROPIC
|
5235 WINED3DPTFILTERCAPS_MINFANISOTROPIC
;
5240 caps
->CubeTextureFilterCaps
= 0;
5243 if (gl_info
->supported
[EXT_TEXTURE3D
])
5245 caps
->VolumeTextureFilterCaps
= WINED3DPTFILTERCAPS_MAGFLINEAR
|
5246 WINED3DPTFILTERCAPS_MAGFPOINT
|
5247 WINED3DPTFILTERCAPS_MINFLINEAR
|
5248 WINED3DPTFILTERCAPS_MINFPOINT
|
5249 WINED3DPTFILTERCAPS_MIPFLINEAR
|
5250 WINED3DPTFILTERCAPS_MIPFPOINT
|
5251 WINED3DPTFILTERCAPS_LINEAR
|
5252 WINED3DPTFILTERCAPS_LINEARMIPLINEAR
|
5253 WINED3DPTFILTERCAPS_LINEARMIPNEAREST
|
5254 WINED3DPTFILTERCAPS_MIPLINEAR
|
5255 WINED3DPTFILTERCAPS_MIPNEAREST
|
5256 WINED3DPTFILTERCAPS_NEAREST
;
5260 caps
->VolumeTextureFilterCaps
= 0;
5263 caps
->TextureAddressCaps
= WINED3DPTADDRESSCAPS_INDEPENDENTUV
|
5264 WINED3DPTADDRESSCAPS_CLAMP
|
5265 WINED3DPTADDRESSCAPS_WRAP
;
5267 if (gl_info
->supported
[ARB_TEXTURE_BORDER_CLAMP
])
5269 caps
->TextureAddressCaps
|= WINED3DPTADDRESSCAPS_BORDER
;
5271 if (gl_info
->supported
[ARB_TEXTURE_MIRRORED_REPEAT
])
5273 caps
->TextureAddressCaps
|= WINED3DPTADDRESSCAPS_MIRROR
;
5275 if (gl_info
->supported
[ARB_TEXTURE_MIRROR_CLAMP_TO_EDGE
])
5277 caps
->TextureAddressCaps
|= WINED3DPTADDRESSCAPS_MIRRORONCE
;
5280 if (gl_info
->supported
[EXT_TEXTURE3D
])
5282 caps
->VolumeTextureAddressCaps
= WINED3DPTADDRESSCAPS_INDEPENDENTUV
|
5283 WINED3DPTADDRESSCAPS_CLAMP
|
5284 WINED3DPTADDRESSCAPS_WRAP
;
5285 if (gl_info
->supported
[ARB_TEXTURE_BORDER_CLAMP
])
5287 caps
->VolumeTextureAddressCaps
|= WINED3DPTADDRESSCAPS_BORDER
;
5289 if (gl_info
->supported
[ARB_TEXTURE_MIRRORED_REPEAT
])
5291 caps
->VolumeTextureAddressCaps
|= WINED3DPTADDRESSCAPS_MIRROR
;
5293 if (gl_info
->supported
[ARB_TEXTURE_MIRROR_CLAMP_TO_EDGE
])
5295 caps
->VolumeTextureAddressCaps
|= WINED3DPTADDRESSCAPS_MIRRORONCE
;
5300 caps
->VolumeTextureAddressCaps
= 0;
5303 caps
->LineCaps
= WINED3DLINECAPS_TEXTURE
|
5304 WINED3DLINECAPS_ZTEST
|
5305 WINED3DLINECAPS_BLEND
|
5306 WINED3DLINECAPS_ALPHACMP
|
5307 WINED3DLINECAPS_FOG
;
5308 /* WINED3DLINECAPS_ANTIALIAS is not supported on Windows, and dx and gl seem to have a different
5309 * idea how generating the smoothing alpha values works; the result is different
5312 caps
->MaxTextureWidth
= gl_info
->limits
.texture_size
;
5313 caps
->MaxTextureHeight
= gl_info
->limits
.texture_size
;
5315 if (gl_info
->supported
[EXT_TEXTURE3D
])
5316 caps
->MaxVolumeExtent
= gl_info
->limits
.texture3d_size
;
5318 caps
->MaxVolumeExtent
= 0;
5320 caps
->MaxTextureRepeat
= 32768;
5321 caps
->MaxTextureAspectRatio
= gl_info
->limits
.texture_size
;
5322 caps
->MaxVertexW
= 1.0f
;
5324 caps
->GuardBandLeft
= 0.0f
;
5325 caps
->GuardBandTop
= 0.0f
;
5326 caps
->GuardBandRight
= 0.0f
;
5327 caps
->GuardBandBottom
= 0.0f
;
5329 caps
->ExtentsAdjust
= 0.0f
;
5331 caps
->StencilCaps
= WINED3DSTENCILCAPS_DECRSAT
|
5332 WINED3DSTENCILCAPS_INCRSAT
|
5333 WINED3DSTENCILCAPS_INVERT
|
5334 WINED3DSTENCILCAPS_KEEP
|
5335 WINED3DSTENCILCAPS_REPLACE
|
5336 WINED3DSTENCILCAPS_ZERO
;
5337 if (gl_info
->supported
[EXT_STENCIL_WRAP
])
5339 caps
->StencilCaps
|= WINED3DSTENCILCAPS_DECR
|
5340 WINED3DSTENCILCAPS_INCR
;
5342 if (gl_info
->supported
[WINED3D_GL_VERSION_2_0
] || gl_info
->supported
[EXT_STENCIL_TWO_SIDE
]
5343 || gl_info
->supported
[ATI_SEPARATE_STENCIL
])
5345 caps
->StencilCaps
|= WINED3DSTENCILCAPS_TWOSIDED
;
5348 caps
->MaxAnisotropy
= gl_info
->limits
.anisotropy
;
5349 caps
->MaxPointSize
= gl_info
->limits
.pointsize_max
;
5351 caps
->MaxPrimitiveCount
= 0x555555; /* Taken from an AMD Radeon HD 5700 (Evergreen) GPU. */
5352 caps
->MaxVertexIndex
= 0xffffff; /* Taken from an AMD Radeon HD 5700 (Evergreen) GPU. */
5353 caps
->MaxStreams
= MAX_STREAMS
;
5354 caps
->MaxStreamStride
= 1024;
5356 /* d3d9.dll sets D3DDEVCAPS2_CAN_STRETCHRECT_FROM_TEXTURES here because StretchRects is implemented in d3d9 */
5357 caps
->DevCaps2
= WINED3DDEVCAPS2_STREAMOFFSET
|
5358 WINED3DDEVCAPS2_VERTEXELEMENTSCANSHARESTREAMOFFSET
;
5359 caps
->MaxNpatchTessellationLevel
= 0;
5360 caps
->MasterAdapterOrdinal
= 0;
5361 caps
->AdapterOrdinalInGroup
= 0;
5362 caps
->NumberOfAdaptersInGroup
= 1;
5364 caps
->NumSimultaneousRTs
= gl_info
->limits
.buffers
;
5366 caps
->StretchRectFilterCaps
= WINED3DPTFILTERCAPS_MINFPOINT
|
5367 WINED3DPTFILTERCAPS_MAGFPOINT
|
5368 WINED3DPTFILTERCAPS_MINFLINEAR
|
5369 WINED3DPTFILTERCAPS_MAGFLINEAR
;
5370 caps
->VertexTextureFilterCaps
= 0;
5372 adapter
->shader_backend
->shader_get_caps(&adapter
->gl_info
, &shader_caps
);
5373 adapter
->fragment_pipe
->get_caps(&adapter
->gl_info
, &fragment_caps
);
5374 adapter
->vertex_pipe
->vp_get_caps(&adapter
->gl_info
, &vertex_caps
);
5376 /* Add shader misc caps. Only some of them belong to the shader parts of the pipeline */
5377 caps
->PrimitiveMiscCaps
|= fragment_caps
.PrimitiveMiscCaps
;
5379 caps
->VertexShaderVersion
= shader_caps
.vs_version
;
5380 caps
->MaxVertexShaderConst
= shader_caps
.vs_uniform_count
;
5382 caps
->PixelShaderVersion
= shader_caps
.ps_version
;
5383 caps
->PixelShader1xMaxValue
= shader_caps
.ps_1x_max_value
;
5385 caps
->TextureOpCaps
= fragment_caps
.TextureOpCaps
;
5386 caps
->MaxTextureBlendStages
= fragment_caps
.MaxTextureBlendStages
;
5387 caps
->MaxSimultaneousTextures
= fragment_caps
.MaxSimultaneousTextures
;
5389 caps
->MaxUserClipPlanes
= vertex_caps
.max_user_clip_planes
;
5390 caps
->MaxActiveLights
= vertex_caps
.max_active_lights
;
5391 caps
->MaxVertexBlendMatrices
= vertex_caps
.max_vertex_blend_matrices
;
5392 caps
->MaxVertexBlendMatrixIndex
= vertex_caps
.max_vertex_blend_matrix_index
;
5393 caps
->VertexProcessingCaps
= vertex_caps
.vertex_processing_caps
;
5394 caps
->FVFCaps
= vertex_caps
.fvf_caps
;
5395 caps
->RasterCaps
|= vertex_caps
.raster_caps
;
5397 /* The following caps are shader specific, but they are things we cannot detect, or which
5398 * are the same among all shader models. So to avoid code duplication set the shader version
5399 * specific, but otherwise constant caps here
5401 if (caps
->VertexShaderVersion
>= 3)
5403 /* Where possible set the caps based on OpenGL extensions and if they
5404 * aren't set (in case of software rendering) use the VS 3.0 from
5405 * MSDN or else if there's OpenGL spec use a hardcoded value minimum
5407 caps
->VS20Caps
.caps
= WINED3DVS20CAPS_PREDICATION
;
5408 /* VS 3.0 requires MAX_DYNAMICFLOWCONTROLDEPTH (24) */
5409 caps
->VS20Caps
.dynamic_flow_control_depth
= WINED3DVS20_MAX_DYNAMICFLOWCONTROLDEPTH
;
5410 caps
->VS20Caps
.temp_count
= max(32, adapter
->gl_info
.limits
.arb_vs_temps
);
5411 /* level of nesting in loops / if-statements; VS 3.0 requires MAX (4) */
5412 caps
->VS20Caps
.static_flow_control_depth
= WINED3DVS20_MAX_STATICFLOWCONTROLDEPTH
;
5414 caps
->MaxVShaderInstructionsExecuted
= 65535; /* VS 3.0 needs at least 65535, some cards even use 2^32-1 */
5415 caps
->MaxVertexShader30InstructionSlots
= max(512, adapter
->gl_info
.limits
.arb_vs_instructions
);
5416 caps
->VertexTextureFilterCaps
= WINED3DPTFILTERCAPS_MINFPOINT
| WINED3DPTFILTERCAPS_MAGFPOINT
;
5418 else if (caps
->VertexShaderVersion
== 2)
5420 caps
->VS20Caps
.caps
= 0;
5421 caps
->VS20Caps
.dynamic_flow_control_depth
= WINED3DVS20_MIN_DYNAMICFLOWCONTROLDEPTH
;
5422 caps
->VS20Caps
.temp_count
= max(12, adapter
->gl_info
.limits
.arb_vs_temps
);
5423 caps
->VS20Caps
.static_flow_control_depth
= 1;
5425 caps
->MaxVShaderInstructionsExecuted
= 65535;
5426 caps
->MaxVertexShader30InstructionSlots
= 0;
5430 caps
->VS20Caps
.caps
= 0;
5431 caps
->VS20Caps
.dynamic_flow_control_depth
= 0;
5432 caps
->VS20Caps
.temp_count
= 0;
5433 caps
->VS20Caps
.static_flow_control_depth
= 0;
5435 caps
->MaxVShaderInstructionsExecuted
= 0;
5436 caps
->MaxVertexShader30InstructionSlots
= 0;
5439 if (caps
->PixelShaderVersion
>= 3)
5441 /* Where possible set the caps based on OpenGL extensions and if they
5442 * aren't set (in case of software rendering) use the PS 3.0 from
5443 * MSDN or else if there's OpenGL spec use a hardcoded value minimum
5446 /* Caps is more or less undocumented on MSDN but it appears to be
5447 * used for PS20Caps based on results from R9600/FX5900/Geforce6800
5448 * cards from Windows */
5449 caps
->PS20Caps
.caps
= WINED3DPS20CAPS_ARBITRARYSWIZZLE
|
5450 WINED3DPS20CAPS_GRADIENTINSTRUCTIONS
|
5451 WINED3DPS20CAPS_PREDICATION
|
5452 WINED3DPS20CAPS_NODEPENDENTREADLIMIT
|
5453 WINED3DPS20CAPS_NOTEXINSTRUCTIONLIMIT
;
5454 /* PS 3.0 requires MAX_DYNAMICFLOWCONTROLDEPTH (24) */
5455 caps
->PS20Caps
.dynamic_flow_control_depth
= WINED3DPS20_MAX_DYNAMICFLOWCONTROLDEPTH
;
5456 caps
->PS20Caps
.temp_count
= max(32, adapter
->gl_info
.limits
.arb_ps_temps
);
5457 /* PS 3.0 requires MAX_STATICFLOWCONTROLDEPTH (4) */
5458 caps
->PS20Caps
.static_flow_control_depth
= WINED3DPS20_MAX_STATICFLOWCONTROLDEPTH
;
5459 /* PS 3.0 requires MAX_NUMINSTRUCTIONSLOTS (512) */
5460 caps
->PS20Caps
.instruction_slot_count
= WINED3DPS20_MAX_NUMINSTRUCTIONSLOTS
;
5462 caps
->MaxPShaderInstructionsExecuted
= 65535;
5463 caps
->MaxPixelShader30InstructionSlots
= max(WINED3DMIN30SHADERINSTRUCTIONS
,
5464 adapter
->gl_info
.limits
.arb_ps_instructions
);
5466 else if(caps
->PixelShaderVersion
== 2)
5468 /* Below we assume PS2.0 specs, not extended 2.0a(GeforceFX)/2.0b(Radeon R3xx) ones */
5469 caps
->PS20Caps
.caps
= 0;
5470 caps
->PS20Caps
.dynamic_flow_control_depth
= 0; /* WINED3DVS20_MIN_DYNAMICFLOWCONTROLDEPTH = 0 */
5471 caps
->PS20Caps
.temp_count
= max(12, adapter
->gl_info
.limits
.arb_ps_temps
);
5472 caps
->PS20Caps
.static_flow_control_depth
= WINED3DPS20_MIN_STATICFLOWCONTROLDEPTH
; /* Minimum: 1 */
5473 /* Minimum number (64 ALU + 32 Texture), a GeforceFX uses 512 */
5474 caps
->PS20Caps
.instruction_slot_count
= WINED3DPS20_MIN_NUMINSTRUCTIONSLOTS
;
5476 caps
->MaxPShaderInstructionsExecuted
= 512; /* Minimum value, a GeforceFX uses 1024 */
5477 caps
->MaxPixelShader30InstructionSlots
= 0;
5481 caps
->PS20Caps
.caps
= 0;
5482 caps
->PS20Caps
.dynamic_flow_control_depth
= 0;
5483 caps
->PS20Caps
.temp_count
= 0;
5484 caps
->PS20Caps
.static_flow_control_depth
= 0;
5485 caps
->PS20Caps
.instruction_slot_count
= 0;
5487 caps
->MaxPShaderInstructionsExecuted
= 0;
5488 caps
->MaxPixelShader30InstructionSlots
= 0;
5491 if (caps
->VertexShaderVersion
>= 2)
5493 /* OpenGL supports all the formats below, perhaps not always
5494 * without conversion, but it supports them.
5495 * Further GLSL doesn't seem to have an official unsigned type so
5496 * don't advertise it yet as I'm not sure how we handle it.
5497 * We might need to add some clamping in the shader engine to
5499 * TODO: WINED3DDTCAPS_USHORT2N, WINED3DDTCAPS_USHORT4N, WINED3DDTCAPS_UDEC3, WINED3DDTCAPS_DEC3N */
5500 caps
->DeclTypes
= WINED3DDTCAPS_UBYTE4
|
5501 WINED3DDTCAPS_UBYTE4N
|
5502 WINED3DDTCAPS_SHORT2N
|
5503 WINED3DDTCAPS_SHORT4N
;
5504 if (gl_info
->supported
[ARB_HALF_FLOAT_VERTEX
])
5506 caps
->DeclTypes
|= WINED3DDTCAPS_FLOAT16_2
|
5507 WINED3DDTCAPS_FLOAT16_4
;
5512 caps
->DeclTypes
= 0;
5515 /* Set DirectDraw helper Caps */
5516 ckey_caps
= WINEDDCKEYCAPS_DESTBLT
|
5517 WINEDDCKEYCAPS_SRCBLT
;
5518 fx_caps
= WINEDDFXCAPS_BLTALPHA
|
5519 WINEDDFXCAPS_BLTMIRRORLEFTRIGHT
|
5520 WINEDDFXCAPS_BLTMIRRORUPDOWN
|
5521 WINEDDFXCAPS_BLTROTATION90
|
5522 WINEDDFXCAPS_BLTSHRINKX
|
5523 WINEDDFXCAPS_BLTSHRINKXN
|
5524 WINEDDFXCAPS_BLTSHRINKY
|
5525 WINEDDFXCAPS_BLTSHRINKYN
|
5526 WINEDDFXCAPS_BLTSTRETCHX
|
5527 WINEDDFXCAPS_BLTSTRETCHXN
|
5528 WINEDDFXCAPS_BLTSTRETCHY
|
5529 WINEDDFXCAPS_BLTSTRETCHYN
;
5530 blit_caps
= WINEDDCAPS_BLT
|
5531 WINEDDCAPS_BLTCOLORFILL
|
5532 WINEDDCAPS_BLTDEPTHFILL
|
5533 WINEDDCAPS_BLTSTRETCH
|
5534 WINEDDCAPS_CANBLTSYSMEM
|
5535 WINEDDCAPS_CANCLIP
|
5536 WINEDDCAPS_CANCLIPSTRETCHED
|
5537 WINEDDCAPS_COLORKEY
|
5538 WINEDDCAPS_COLORKEYHWASSIST
|
5539 WINEDDCAPS_ALIGNBOUNDARYSRC
;
5541 /* Fill the ddraw caps structure */
5542 caps
->ddraw_caps
.caps
= WINEDDCAPS_GDI
|
5543 WINEDDCAPS_PALETTE
|
5545 caps
->ddraw_caps
.caps2
= WINEDDCAPS2_CERTIFIED
|
5546 WINEDDCAPS2_NOPAGELOCKREQUIRED
|
5547 WINEDDCAPS2_PRIMARYGAMMA
|
5548 WINEDDCAPS2_WIDESURFACES
|
5549 WINEDDCAPS2_CANRENDERWINDOWED
;
5550 caps
->ddraw_caps
.color_key_caps
= ckey_caps
;
5551 caps
->ddraw_caps
.fx_caps
= fx_caps
;
5552 caps
->ddraw_caps
.svb_caps
= blit_caps
;
5553 caps
->ddraw_caps
.svb_color_key_caps
= ckey_caps
;
5554 caps
->ddraw_caps
.svb_fx_caps
= fx_caps
;
5555 caps
->ddraw_caps
.vsb_caps
= blit_caps
;
5556 caps
->ddraw_caps
.vsb_color_key_caps
= ckey_caps
;
5557 caps
->ddraw_caps
.vsb_fx_caps
= fx_caps
;
5558 caps
->ddraw_caps
.ssb_caps
= blit_caps
;
5559 caps
->ddraw_caps
.ssb_color_key_caps
= ckey_caps
;
5560 caps
->ddraw_caps
.ssb_fx_caps
= fx_caps
;
5562 caps
->ddraw_caps
.dds_caps
= WINEDDSCAPS_ALPHA
|
5563 WINEDDSCAPS_BACKBUFFER
|
5565 WINEDDSCAPS_FRONTBUFFER
|
5566 WINEDDSCAPS_OFFSCREENPLAIN
|
5567 WINEDDSCAPS_PALETTE
|
5568 WINEDDSCAPS_PRIMARYSURFACE
|
5569 WINEDDSCAPS_SYSTEMMEMORY
|
5570 WINEDDSCAPS_VIDEOMEMORY
|
5571 WINEDDSCAPS_VISIBLE
;
5573 if (!(wined3d
->flags
& WINED3D_NO3D
))
5575 caps
->ddraw_caps
.dds_caps
|= WINEDDSCAPS_3DDEVICE
|
5576 WINEDDSCAPS_MIPMAP
|
5577 WINEDDSCAPS_TEXTURE
|
5578 WINEDDSCAPS_ZBUFFER
;
5579 caps
->ddraw_caps
.caps
|= WINEDDCAPS_3D
;
5585 HRESULT CDECL
wined3d_device_create(struct wined3d
*wined3d
, UINT adapter_idx
, enum wined3d_device_type device_type
,
5586 HWND focus_window
, DWORD flags
, BYTE surface_alignment
, struct wined3d_device_parent
*device_parent
,
5587 struct wined3d_device
**device
)
5589 struct wined3d_device
*object
;
5592 TRACE("wined3d %p, adapter_idx %u, device_type %#x, focus_window %p, flags %#x, surface_alignment %u, device_parent %p, device %p.\n",
5593 wined3d
, adapter_idx
, device_type
, focus_window
, flags
, surface_alignment
, device_parent
, device
);
5595 /* Validate the adapter number. If no adapters are available(no GL), ignore the adapter
5596 * number and create a device without a 3D adapter for 2D only operation. */
5597 if (wined3d
->adapter_count
&& adapter_idx
>= wined3d
->adapter_count
)
5598 return WINED3DERR_INVALIDCALL
;
5600 object
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*object
));
5602 return E_OUTOFMEMORY
;
5604 hr
= device_init(object
, wined3d
, adapter_idx
, device_type
,
5605 focus_window
, flags
, surface_alignment
, device_parent
);
5608 WARN("Failed to initialize device, hr %#x.\n", hr
);
5609 HeapFree(GetProcessHeap(), 0, object
);
5613 TRACE("Created device %p.\n", object
);
5616 device_parent
->ops
->wined3d_device_created(device_parent
, *device
);
5621 static void WINE_GLAPI
invalid_func(const void *data
)
5623 ERR("Invalid vertex attribute function called\n");
5627 static void WINE_GLAPI
invalid_texcoord_func(GLenum unit
, const void *data
)
5629 ERR("Invalid texcoord function called\n");
5633 static void WINE_GLAPI
invalid_generic_attrib_func(GLuint idx
, const void *data
)
5635 ERR("Invalid attribute function called.\n");
5639 /* Helper functions for providing vertex data to OpenGL. The arrays are
5640 * initialised based on the extension detection and are used in
5641 * draw_primitive_immediate_mode(). */
5642 static void WINE_GLAPI
position_d3dcolor(const void *data
)
5644 DWORD pos
= *((const DWORD
*)data
);
5646 FIXME("Add a test for fixed function position from d3dcolor type\n");
5647 context_get_current()->gl_info
->gl_ops
.gl
.p_glVertex4s(D3DCOLOR_B_R(pos
),
5653 static void WINE_GLAPI
position_float4(const void *data
)
5655 const GLfloat
*pos
= data
;
5657 if (pos
[3] != 0.0f
&& pos
[3] != 1.0f
)
5659 float w
= 1.0f
/ pos
[3];
5661 context_get_current()->gl_info
->gl_ops
.gl
.p_glVertex4f(pos
[0] * w
, pos
[1] * w
, pos
[2] * w
, w
);
5665 context_get_current()->gl_info
->gl_ops
.gl
.p_glVertex3fv(pos
);
5669 static void WINE_GLAPI
diffuse_d3dcolor(const void *data
)
5671 DWORD diffuseColor
= *((const DWORD
*)data
);
5673 context_get_current()->gl_info
->gl_ops
.gl
.p_glColor4ub(D3DCOLOR_B_R(diffuseColor
),
5674 D3DCOLOR_B_G(diffuseColor
),
5675 D3DCOLOR_B_B(diffuseColor
),
5676 D3DCOLOR_B_A(diffuseColor
));
5679 static void WINE_GLAPI
specular_d3dcolor(const void *data
)
5681 DWORD specularColor
= *((const DWORD
*)data
);
5684 D3DCOLOR_B_R(specularColor
),
5685 D3DCOLOR_B_G(specularColor
),
5686 D3DCOLOR_B_B(specularColor
)
5689 context_get_current()->gl_info
->gl_ops
.ext
.p_glSecondaryColor3ubvEXT(d
);
5692 static void WINE_GLAPI
warn_no_specular_func(const void *data
)
5694 WARN("GL_EXT_secondary_color not supported\n");
5697 static void WINE_GLAPI
generic_d3dcolor(GLuint idx
, const void *data
)
5699 DWORD color
= *((const DWORD
*)data
);
5701 context_get_current()->gl_info
->gl_ops
.ext
.p_glVertexAttrib4Nub(idx
,
5702 D3DCOLOR_B_R(color
), D3DCOLOR_B_G(color
),
5703 D3DCOLOR_B_B(color
), D3DCOLOR_B_A(color
));
5706 static void WINE_GLAPI
generic_short2n(GLuint idx
, const void *data
)
5708 const GLshort s
[] = {((const GLshort
*)data
)[0], ((const GLshort
*)data
)[1], 0, 1};
5710 context_get_current()->gl_info
->gl_ops
.ext
.p_glVertexAttrib4Nsv(idx
, s
);
5713 static void WINE_GLAPI
generic_ushort2n(GLuint idx
, const void *data
)
5715 const GLushort s
[] = {((const GLushort
*)data
)[0], ((const GLushort
*)data
)[1], 0, 1};
5717 context_get_current()->gl_info
->gl_ops
.ext
.p_glVertexAttrib4Nusv(idx
, s
);
5720 static void WINE_GLAPI
generic_float16_2(GLuint idx
, const void *data
)
5722 float x
= float_16_to_32(((const unsigned short *)data
) + 0);
5723 float y
= float_16_to_32(((const unsigned short *)data
) + 1);
5725 context_get_current()->gl_info
->gl_ops
.ext
.p_glVertexAttrib2f(idx
, x
, y
);
5728 static void WINE_GLAPI
generic_float16_4(GLuint idx
, const void *data
)
5730 float x
= float_16_to_32(((const unsigned short *)data
) + 0);
5731 float y
= float_16_to_32(((const unsigned short *)data
) + 1);
5732 float z
= float_16_to_32(((const unsigned short *)data
) + 2);
5733 float w
= float_16_to_32(((const unsigned short *)data
) + 3);
5735 context_get_current()->gl_info
->gl_ops
.ext
.p_glVertexAttrib4f(idx
, x
, y
, z
, w
);
5738 static void wined3d_adapter_init_ffp_attrib_ops(struct wined3d_adapter
*adapter
)
5740 const struct wined3d_gl_info
*gl_info
= &adapter
->gl_info
;
5741 struct wined3d_d3d_info
*d3d_info
= &adapter
->d3d_info
;
5742 struct wined3d_ffp_attrib_ops
*ops
= &d3d_info
->ffp_attrib_ops
;
5744 ops
->position
[WINED3D_FFP_EMIT_FLOAT1
] = invalid_func
;
5745 ops
->position
[WINED3D_FFP_EMIT_FLOAT2
] = invalid_func
;
5746 ops
->position
[WINED3D_FFP_EMIT_FLOAT3
] = (wined3d_ffp_attrib_func
)gl_info
->gl_ops
.gl
.p_glVertex3fv
;
5747 if (!d3d_info
->xyzrhw
)
5748 ops
->position
[WINED3D_FFP_EMIT_FLOAT4
] = position_float4
;
5750 ops
->position
[WINED3D_FFP_EMIT_FLOAT4
] = (wined3d_ffp_attrib_func
)gl_info
->gl_ops
.gl
.p_glVertex4fv
;
5751 ops
->position
[WINED3D_FFP_EMIT_D3DCOLOR
] = position_d3dcolor
;
5752 ops
->position
[WINED3D_FFP_EMIT_UBYTE4
] = invalid_func
;
5753 ops
->position
[WINED3D_FFP_EMIT_SHORT2
] = invalid_func
;
5754 ops
->position
[WINED3D_FFP_EMIT_SHORT4
] = (wined3d_ffp_attrib_func
)gl_info
->gl_ops
.gl
.p_glVertex2sv
;
5755 ops
->position
[WINED3D_FFP_EMIT_UBYTE4N
] = invalid_func
;
5756 ops
->position
[WINED3D_FFP_EMIT_SHORT2N
] = invalid_func
;
5757 ops
->position
[WINED3D_FFP_EMIT_SHORT4N
] = invalid_func
;
5758 ops
->position
[WINED3D_FFP_EMIT_USHORT2N
] = invalid_func
;
5759 ops
->position
[WINED3D_FFP_EMIT_USHORT4N
] = invalid_func
;
5760 ops
->position
[WINED3D_FFP_EMIT_UDEC3
] = invalid_func
;
5761 ops
->position
[WINED3D_FFP_EMIT_DEC3N
] = invalid_func
;
5762 ops
->position
[WINED3D_FFP_EMIT_FLOAT16_2
] = invalid_func
;
5763 ops
->position
[WINED3D_FFP_EMIT_FLOAT16_4
] = invalid_func
;
5764 ops
->position
[WINED3D_FFP_EMIT_INVALID
] = invalid_func
;
5766 ops
->diffuse
[WINED3D_FFP_EMIT_FLOAT1
] = invalid_func
;
5767 ops
->diffuse
[WINED3D_FFP_EMIT_FLOAT2
] = invalid_func
;
5768 ops
->diffuse
[WINED3D_FFP_EMIT_FLOAT3
] = (wined3d_ffp_attrib_func
)gl_info
->gl_ops
.gl
.p_glColor3fv
;
5769 ops
->diffuse
[WINED3D_FFP_EMIT_FLOAT4
] = (wined3d_ffp_attrib_func
)gl_info
->gl_ops
.gl
.p_glColor4fv
;
5770 ops
->diffuse
[WINED3D_FFP_EMIT_D3DCOLOR
] = diffuse_d3dcolor
;
5771 ops
->diffuse
[WINED3D_FFP_EMIT_UBYTE4
] = invalid_func
;
5772 ops
->diffuse
[WINED3D_FFP_EMIT_SHORT2
] = invalid_func
;
5773 ops
->diffuse
[WINED3D_FFP_EMIT_SHORT4
] = invalid_func
;
5774 ops
->diffuse
[WINED3D_FFP_EMIT_UBYTE4N
] = (wined3d_ffp_attrib_func
)gl_info
->gl_ops
.gl
.p_glColor4ubv
;
5775 ops
->diffuse
[WINED3D_FFP_EMIT_SHORT2N
] = invalid_func
;
5776 ops
->diffuse
[WINED3D_FFP_EMIT_SHORT4N
] = (wined3d_ffp_attrib_func
)gl_info
->gl_ops
.gl
.p_glColor4sv
;
5777 ops
->diffuse
[WINED3D_FFP_EMIT_USHORT2N
] = invalid_func
;
5778 ops
->diffuse
[WINED3D_FFP_EMIT_USHORT4N
] = (wined3d_ffp_attrib_func
)gl_info
->gl_ops
.gl
.p_glColor4usv
;
5779 ops
->diffuse
[WINED3D_FFP_EMIT_UDEC3
] = invalid_func
;
5780 ops
->diffuse
[WINED3D_FFP_EMIT_DEC3N
] = invalid_func
;
5781 ops
->diffuse
[WINED3D_FFP_EMIT_FLOAT16_2
] = invalid_func
;
5782 ops
->diffuse
[WINED3D_FFP_EMIT_FLOAT16_4
] = invalid_func
;
5783 ops
->diffuse
[WINED3D_FFP_EMIT_INVALID
] = invalid_func
;
5785 /* No 4 component entry points here. */
5786 ops
->specular
[WINED3D_FFP_EMIT_FLOAT1
] = invalid_func
;
5787 ops
->specular
[WINED3D_FFP_EMIT_FLOAT2
] = invalid_func
;
5788 if (gl_info
->supported
[EXT_SECONDARY_COLOR
])
5789 ops
->specular
[WINED3D_FFP_EMIT_FLOAT3
] = (wined3d_ffp_attrib_func
)GL_EXTCALL(glSecondaryColor3fvEXT
);
5791 ops
->specular
[WINED3D_FFP_EMIT_FLOAT3
] = warn_no_specular_func
;
5792 ops
->specular
[WINED3D_FFP_EMIT_FLOAT4
] = invalid_func
;
5793 if (gl_info
->supported
[EXT_SECONDARY_COLOR
])
5794 ops
->specular
[WINED3D_FFP_EMIT_D3DCOLOR
] = specular_d3dcolor
;
5796 ops
->specular
[WINED3D_FFP_EMIT_D3DCOLOR
] = warn_no_specular_func
;
5797 ops
->specular
[WINED3D_FFP_EMIT_UBYTE4
] = invalid_func
;
5798 ops
->specular
[WINED3D_FFP_EMIT_SHORT2
] = invalid_func
;
5799 ops
->specular
[WINED3D_FFP_EMIT_SHORT4
] = invalid_func
;
5800 ops
->specular
[WINED3D_FFP_EMIT_UBYTE4N
] = invalid_func
;
5801 ops
->specular
[WINED3D_FFP_EMIT_SHORT2N
] = invalid_func
;
5802 ops
->specular
[WINED3D_FFP_EMIT_SHORT4N
] = invalid_func
;
5803 ops
->specular
[WINED3D_FFP_EMIT_USHORT2N
] = invalid_func
;
5804 ops
->specular
[WINED3D_FFP_EMIT_USHORT4N
] = invalid_func
;
5805 ops
->specular
[WINED3D_FFP_EMIT_UDEC3
] = invalid_func
;
5806 ops
->specular
[WINED3D_FFP_EMIT_DEC3N
] = invalid_func
;
5807 ops
->specular
[WINED3D_FFP_EMIT_FLOAT16_2
] = invalid_func
;
5808 ops
->specular
[WINED3D_FFP_EMIT_FLOAT16_4
] = invalid_func
;
5809 ops
->specular
[WINED3D_FFP_EMIT_INVALID
] = invalid_func
;
5811 /* Only 3 component entry points here. Test how others behave. Float4
5812 * normals are used by one of our tests, trying to pass it to the pixel
5813 * shader, which fails on Windows. */
5814 ops
->normal
[WINED3D_FFP_EMIT_FLOAT1
] = invalid_func
;
5815 ops
->normal
[WINED3D_FFP_EMIT_FLOAT2
] = invalid_func
;
5816 ops
->normal
[WINED3D_FFP_EMIT_FLOAT3
] = (wined3d_ffp_attrib_func
)gl_info
->gl_ops
.gl
.p_glNormal3fv
;
5817 /* Just ignore the 4th value. */
5818 ops
->normal
[WINED3D_FFP_EMIT_FLOAT4
] = (wined3d_ffp_attrib_func
)gl_info
->gl_ops
.gl
.p_glNormal3fv
;
5819 ops
->normal
[WINED3D_FFP_EMIT_D3DCOLOR
] = invalid_func
;
5820 ops
->normal
[WINED3D_FFP_EMIT_UBYTE4
] = invalid_func
;
5821 ops
->normal
[WINED3D_FFP_EMIT_SHORT2
] = invalid_func
;
5822 ops
->normal
[WINED3D_FFP_EMIT_SHORT4
] = invalid_func
;
5823 ops
->normal
[WINED3D_FFP_EMIT_UBYTE4N
] = invalid_func
;
5824 ops
->normal
[WINED3D_FFP_EMIT_SHORT2N
] = invalid_func
;
5825 ops
->normal
[WINED3D_FFP_EMIT_SHORT4N
] = invalid_func
;
5826 ops
->normal
[WINED3D_FFP_EMIT_USHORT2N
] = invalid_func
;
5827 ops
->normal
[WINED3D_FFP_EMIT_USHORT4N
] = invalid_func
;
5828 ops
->normal
[WINED3D_FFP_EMIT_UDEC3
] = invalid_func
;
5829 ops
->normal
[WINED3D_FFP_EMIT_DEC3N
] = invalid_func
;
5830 ops
->normal
[WINED3D_FFP_EMIT_FLOAT16_2
] = invalid_func
;
5831 ops
->normal
[WINED3D_FFP_EMIT_FLOAT16_4
] = invalid_func
;
5832 ops
->normal
[WINED3D_FFP_EMIT_INVALID
] = invalid_func
;
5834 ops
->texcoord
[WINED3D_FFP_EMIT_FLOAT1
] = (wined3d_ffp_texcoord_func
)gl_info
->gl_ops
.ext
.p_glMultiTexCoord1fvARB
;
5835 ops
->texcoord
[WINED3D_FFP_EMIT_FLOAT2
] = (wined3d_ffp_texcoord_func
)gl_info
->gl_ops
.ext
.p_glMultiTexCoord2fvARB
;
5836 ops
->texcoord
[WINED3D_FFP_EMIT_FLOAT3
] = (wined3d_ffp_texcoord_func
)gl_info
->gl_ops
.ext
.p_glMultiTexCoord3fvARB
;
5837 ops
->texcoord
[WINED3D_FFP_EMIT_FLOAT4
] = (wined3d_ffp_texcoord_func
)gl_info
->gl_ops
.ext
.p_glMultiTexCoord4fvARB
;
5838 ops
->texcoord
[WINED3D_FFP_EMIT_D3DCOLOR
] = invalid_texcoord_func
;
5839 ops
->texcoord
[WINED3D_FFP_EMIT_UBYTE4
] = invalid_texcoord_func
;
5840 ops
->texcoord
[WINED3D_FFP_EMIT_SHORT2
] = (wined3d_ffp_texcoord_func
)gl_info
->gl_ops
.ext
.p_glMultiTexCoord2svARB
;
5841 ops
->texcoord
[WINED3D_FFP_EMIT_SHORT4
] = (wined3d_ffp_texcoord_func
)gl_info
->gl_ops
.ext
.p_glMultiTexCoord4svARB
;
5842 ops
->texcoord
[WINED3D_FFP_EMIT_UBYTE4N
] = invalid_texcoord_func
;
5843 ops
->texcoord
[WINED3D_FFP_EMIT_SHORT2N
] = invalid_texcoord_func
;
5844 ops
->texcoord
[WINED3D_FFP_EMIT_SHORT4N
] = invalid_texcoord_func
;
5845 ops
->texcoord
[WINED3D_FFP_EMIT_USHORT2N
] = invalid_texcoord_func
;
5846 ops
->texcoord
[WINED3D_FFP_EMIT_USHORT4N
] = invalid_texcoord_func
;
5847 ops
->texcoord
[WINED3D_FFP_EMIT_UDEC3
] = invalid_texcoord_func
;
5848 ops
->texcoord
[WINED3D_FFP_EMIT_DEC3N
] = invalid_texcoord_func
;
5849 if (gl_info
->supported
[NV_HALF_FLOAT
])
5851 /* Not supported by ARB_HALF_FLOAT_VERTEX, so check for NV_HALF_FLOAT. */
5852 ops
->texcoord
[WINED3D_FFP_EMIT_FLOAT16_2
] =
5853 (wined3d_ffp_texcoord_func
)gl_info
->gl_ops
.ext
.p_glMultiTexCoord2hvNV
;
5854 ops
->texcoord
[WINED3D_FFP_EMIT_FLOAT16_4
] =
5855 (wined3d_ffp_texcoord_func
)gl_info
->gl_ops
.ext
.p_glMultiTexCoord4hvNV
;
5859 ops
->texcoord
[WINED3D_FFP_EMIT_FLOAT16_2
] = invalid_texcoord_func
;
5860 ops
->texcoord
[WINED3D_FFP_EMIT_FLOAT16_4
] = invalid_texcoord_func
;
5862 ops
->texcoord
[WINED3D_FFP_EMIT_INVALID
] = invalid_texcoord_func
;
5864 ops
->generic
[WINED3D_FFP_EMIT_FLOAT1
] = (wined3d_generic_attrib_func
)gl_info
->gl_ops
.ext
.p_glVertexAttrib1fv
;
5865 ops
->generic
[WINED3D_FFP_EMIT_FLOAT2
] = (wined3d_generic_attrib_func
)gl_info
->gl_ops
.ext
.p_glVertexAttrib2fv
;
5866 ops
->generic
[WINED3D_FFP_EMIT_FLOAT3
] = (wined3d_generic_attrib_func
)gl_info
->gl_ops
.ext
.p_glVertexAttrib3fv
;
5867 ops
->generic
[WINED3D_FFP_EMIT_FLOAT4
] = (wined3d_generic_attrib_func
)gl_info
->gl_ops
.ext
.p_glVertexAttrib4fv
;
5868 if (gl_info
->supported
[ARB_VERTEX_ARRAY_BGRA
])
5869 ops
->generic
[WINED3D_FFP_EMIT_D3DCOLOR
] = generic_d3dcolor
;
5871 ops
->generic
[WINED3D_FFP_EMIT_D3DCOLOR
] =
5872 (wined3d_generic_attrib_func
)gl_info
->gl_ops
.ext
.p_glVertexAttrib4Nubv
;
5873 ops
->generic
[WINED3D_FFP_EMIT_UBYTE4
] = (wined3d_generic_attrib_func
)gl_info
->gl_ops
.ext
.p_glVertexAttrib4ubv
;
5874 ops
->generic
[WINED3D_FFP_EMIT_SHORT2
] = (wined3d_generic_attrib_func
)gl_info
->gl_ops
.ext
.p_glVertexAttrib2sv
;
5875 ops
->generic
[WINED3D_FFP_EMIT_SHORT4
] = (wined3d_generic_attrib_func
)gl_info
->gl_ops
.ext
.p_glVertexAttrib4sv
;
5876 ops
->generic
[WINED3D_FFP_EMIT_UBYTE4N
] = (wined3d_generic_attrib_func
)gl_info
->gl_ops
.ext
.p_glVertexAttrib4Nubv
;
5877 ops
->generic
[WINED3D_FFP_EMIT_SHORT2N
] = generic_short2n
;
5878 ops
->generic
[WINED3D_FFP_EMIT_SHORT4N
] = (wined3d_generic_attrib_func
)gl_info
->gl_ops
.ext
.p_glVertexAttrib4Nsv
;
5879 ops
->generic
[WINED3D_FFP_EMIT_USHORT2N
] = generic_ushort2n
;
5880 ops
->generic
[WINED3D_FFP_EMIT_USHORT4N
] = (wined3d_generic_attrib_func
)gl_info
->gl_ops
.ext
.p_glVertexAttrib4Nusv
;
5881 ops
->generic
[WINED3D_FFP_EMIT_UDEC3
] = invalid_generic_attrib_func
;
5882 ops
->generic
[WINED3D_FFP_EMIT_DEC3N
] = invalid_generic_attrib_func
;
5883 if (gl_info
->supported
[NV_HALF_FLOAT
] && gl_info
->supported
[NV_VERTEX_PROGRAM
])
5885 ops
->generic
[WINED3D_FFP_EMIT_FLOAT16_2
] =
5886 (wined3d_generic_attrib_func
)gl_info
->gl_ops
.ext
.p_glVertexAttrib2hvNV
;
5887 ops
->generic
[WINED3D_FFP_EMIT_FLOAT16_4
] =
5888 (wined3d_generic_attrib_func
)gl_info
->gl_ops
.ext
.p_glVertexAttrib4hvNV
;
5892 ops
->generic
[WINED3D_FFP_EMIT_FLOAT16_2
] = generic_float16_2
;
5893 ops
->generic
[WINED3D_FFP_EMIT_FLOAT16_4
] = generic_float16_4
;
5895 ops
->generic
[WINED3D_FFP_EMIT_INVALID
] = invalid_generic_attrib_func
;
5898 static void wined3d_adapter_init_fb_cfgs(struct wined3d_adapter
*adapter
, HDC dc
)
5900 const struct wined3d_gl_info
*gl_info
= &adapter
->gl_info
;
5903 if (gl_info
->supported
[WGL_ARB_PIXEL_FORMAT
])
5905 UINT attrib_count
= 0;
5911 attribute
= WGL_NUMBER_PIXEL_FORMATS_ARB
;
5912 GL_EXTCALL(wglGetPixelFormatAttribivARB(dc
, 0, 0, 1, &attribute
, &cfg_count
));
5914 adapter
->cfgs
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, cfg_count
* sizeof(*adapter
->cfgs
));
5915 attribs
[attrib_count
++] = WGL_RED_BITS_ARB
;
5916 attribs
[attrib_count
++] = WGL_GREEN_BITS_ARB
;
5917 attribs
[attrib_count
++] = WGL_BLUE_BITS_ARB
;
5918 attribs
[attrib_count
++] = WGL_ALPHA_BITS_ARB
;
5919 attribs
[attrib_count
++] = WGL_COLOR_BITS_ARB
;
5920 attribs
[attrib_count
++] = WGL_DEPTH_BITS_ARB
;
5921 attribs
[attrib_count
++] = WGL_STENCIL_BITS_ARB
;
5922 attribs
[attrib_count
++] = WGL_DRAW_TO_WINDOW_ARB
;
5923 attribs
[attrib_count
++] = WGL_PIXEL_TYPE_ARB
;
5924 attribs
[attrib_count
++] = WGL_DOUBLE_BUFFER_ARB
;
5925 attribs
[attrib_count
++] = WGL_AUX_BUFFERS_ARB
;
5927 for (i
= 0, adapter
->cfg_count
= 0; i
< cfg_count
; ++i
)
5929 struct wined3d_pixel_format
*cfg
= &adapter
->cfgs
[adapter
->cfg_count
];
5930 int format_id
= i
+ 1;
5932 if (!GL_EXTCALL(wglGetPixelFormatAttribivARB(dc
, format_id
, 0, attrib_count
, attribs
, values
)))
5935 cfg
->iPixelFormat
= format_id
;
5936 cfg
->redSize
= values
[0];
5937 cfg
->greenSize
= values
[1];
5938 cfg
->blueSize
= values
[2];
5939 cfg
->alphaSize
= values
[3];
5940 cfg
->colorSize
= values
[4];
5941 cfg
->depthSize
= values
[5];
5942 cfg
->stencilSize
= values
[6];
5943 cfg
->windowDrawable
= values
[7];
5944 cfg
->iPixelType
= values
[8];
5945 cfg
->doubleBuffer
= values
[9];
5946 cfg
->auxBuffers
= values
[10];
5948 cfg
->numSamples
= 0;
5949 /* Check multisample support. */
5950 if (gl_info
->supported
[ARB_MULTISAMPLE
])
5952 int attribs
[2] = {WGL_SAMPLE_BUFFERS_ARB
, WGL_SAMPLES_ARB
};
5955 if (GL_EXTCALL(wglGetPixelFormatAttribivARB(dc
, format_id
, 0, 2, attribs
, values
)))
5957 /* values[0] = WGL_SAMPLE_BUFFERS_ARB which tells whether
5958 * multisampling is supported. values[1] = number of
5959 * multisample buffers. */
5961 cfg
->numSamples
= values
[1];
5965 TRACE("iPixelFormat=%d, iPixelType=%#x, doubleBuffer=%d, RGBA=%d/%d/%d/%d, "
5966 "depth=%d, stencil=%d, samples=%d, windowDrawable=%d\n",
5967 cfg
->iPixelFormat
, cfg
->iPixelType
, cfg
->doubleBuffer
,
5968 cfg
->redSize
, cfg
->greenSize
, cfg
->blueSize
, cfg
->alphaSize
,
5969 cfg
->depthSize
, cfg
->stencilSize
, cfg
->numSamples
, cfg
->windowDrawable
);
5971 ++adapter
->cfg_count
;
5978 cfg_count
= DescribePixelFormat(dc
, 0, 0, 0);
5979 adapter
->cfgs
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, cfg_count
* sizeof(*adapter
->cfgs
));
5981 for (i
= 0, adapter
->cfg_count
= 0; i
< cfg_count
; ++i
)
5983 struct wined3d_pixel_format
*cfg
= &adapter
->cfgs
[adapter
->cfg_count
];
5984 PIXELFORMATDESCRIPTOR pfd
;
5985 int format_id
= i
+ 1;
5987 if (!DescribePixelFormat(dc
, format_id
, sizeof(pfd
), &pfd
))
5990 /* We only want HW acceleration using an OpenGL ICD driver.
5991 * PFD_GENERIC_FORMAT = slow opengl 1.1 gdi software rendering.
5992 * PFD_GENERIC_ACCELERATED = partial hw acceleration using a MCD
5993 * driver (e.g. 3dfx minigl). */
5994 if (pfd
.dwFlags
& (PFD_GENERIC_FORMAT
| PFD_GENERIC_ACCELERATED
))
5996 TRACE("Skipping format %d because it isn't ICD accelerated.\n", format_id
);
6000 cfg
->iPixelFormat
= format_id
;
6001 cfg
->redSize
= pfd
.cRedBits
;
6002 cfg
->greenSize
= pfd
.cGreenBits
;
6003 cfg
->blueSize
= pfd
.cBlueBits
;
6004 cfg
->alphaSize
= pfd
.cAlphaBits
;
6005 cfg
->colorSize
= pfd
.cColorBits
;
6006 cfg
->depthSize
= pfd
.cDepthBits
;
6007 cfg
->stencilSize
= pfd
.cStencilBits
;
6008 cfg
->windowDrawable
= (pfd
.dwFlags
& PFD_DRAW_TO_WINDOW
) ? 1 : 0;
6009 cfg
->iPixelType
= (pfd
.iPixelType
== PFD_TYPE_RGBA
) ? WGL_TYPE_RGBA_ARB
: WGL_TYPE_COLORINDEX_ARB
;
6010 cfg
->doubleBuffer
= (pfd
.dwFlags
& PFD_DOUBLEBUFFER
) ? 1 : 0;
6011 cfg
->auxBuffers
= pfd
.cAuxBuffers
;
6012 cfg
->numSamples
= 0;
6014 TRACE("iPixelFormat=%d, iPixelType=%#x, doubleBuffer=%d, RGBA=%d/%d/%d/%d, "
6015 "depth=%d, stencil=%d, windowDrawable=%d\n",
6016 cfg
->iPixelFormat
, cfg
->iPixelType
, cfg
->doubleBuffer
,
6017 cfg
->redSize
, cfg
->greenSize
, cfg
->blueSize
, cfg
->alphaSize
,
6018 cfg
->depthSize
, cfg
->stencilSize
, cfg
->windowDrawable
);
6020 ++adapter
->cfg_count
;
6025 static BOOL
wined3d_adapter_init(struct wined3d_adapter
*adapter
, UINT ordinal
, DWORD wined3d_creation_flags
)
6027 static const DWORD supported_gl_versions
[] =
6029 MAKEDWORD_VERSION(3, 2),
6030 MAKEDWORD_VERSION(1, 0),
6032 struct wined3d_gl_info
*gl_info
= &adapter
->gl_info
;
6033 struct wined3d_caps_gl_ctx caps_gl_ctx
= {0};
6035 DISPLAY_DEVICEW display_device
;
6037 TRACE("adapter %p, ordinal %u.\n", adapter
, ordinal
);
6039 adapter
->ordinal
= ordinal
;
6041 /* Dynamically load all GL core functions */
6042 #ifdef USE_WIN32_OPENGL
6044 HMODULE mod_gl
= GetModuleHandleA("opengl32.dll");
6045 #define USE_GL_FUNC(f) gl_info->gl_ops.gl.p_##f = (void *)GetProcAddress(mod_gl, #f);
6048 gl_info
->gl_ops
.wgl
.p_wglSwapBuffers
= (void *)GetProcAddress(mod_gl
, "wglSwapBuffers");
6051 /* To bypass the opengl32 thunks retrieve functions from the WGL driver instead of opengl32 */
6053 HDC hdc
= GetDC( 0 );
6054 const struct opengl_funcs
*wgl_driver
= __wine_get_wgl_driver( hdc
, WINE_WGL_DRIVER_VERSION
);
6055 ReleaseDC( 0, hdc
);
6056 if (!wgl_driver
|| wgl_driver
== (void *)-1) return FALSE
;
6057 gl_info
->gl_ops
.wgl
= wgl_driver
->wgl
;
6058 gl_info
->gl_ops
.gl
= wgl_driver
->gl
;
6062 glEnableWINE
= gl_info
->gl_ops
.gl
.p_glEnable
;
6063 glDisableWINE
= gl_info
->gl_ops
.gl
.p_glDisable
;
6065 if (!AllocateLocallyUniqueId(&adapter
->luid
))
6067 ERR("Failed to set adapter LUID (%#x).\n", GetLastError());
6070 TRACE("Allocated LUID %08x:%08x for adapter %p.\n",
6071 adapter
->luid
.HighPart
, adapter
->luid
.LowPart
, adapter
);
6073 if (!wined3d_caps_gl_ctx_create(adapter
, &caps_gl_ctx
))
6075 ERR("Failed to get a GL context for adapter %p.\n", adapter
);
6079 for (i
= 0; i
< ARRAY_SIZE(supported_gl_versions
); ++i
)
6081 if (supported_gl_versions
[i
] <= wined3d_settings
.max_gl_version
)
6084 if (i
== ARRAY_SIZE(supported_gl_versions
))
6086 ERR_(winediag
)("Requested invalid GL version %u.%u.\n",
6087 wined3d_settings
.max_gl_version
>> 16, wined3d_settings
.max_gl_version
& 0xffff);
6088 i
= ARRAY_SIZE(supported_gl_versions
) - 1;
6091 for (; i
< ARRAY_SIZE(supported_gl_versions
); ++i
)
6093 gl_info
->selected_gl_version
= supported_gl_versions
[i
];
6095 if (wined3d_caps_gl_ctx_create_attribs(&caps_gl_ctx
, gl_info
))
6098 WARN("Couldn't create an OpenGL %u.%u context, trying fallback to a lower version.\n",
6099 supported_gl_versions
[i
] >> 16, supported_gl_versions
[i
] & 0xffff);
6102 if (!wined3d_adapter_init_gl_caps(adapter
, wined3d_creation_flags
))
6104 ERR("Failed to initialize GL caps for adapter %p.\n", adapter
);
6105 wined3d_caps_gl_ctx_destroy(&caps_gl_ctx
);
6109 wined3d_adapter_init_fb_cfgs(adapter
, caps_gl_ctx
.dc
);
6110 /* We haven't found any suitable formats. This should only happen in
6111 * case of GDI software rendering, which is pretty useless anyway. */
6112 if (!adapter
->cfg_count
)
6114 WARN("No suitable pixel formats found.\n");
6115 wined3d_caps_gl_ctx_destroy(&caps_gl_ctx
);
6116 HeapFree(GetProcessHeap(), 0, adapter
->cfgs
);
6120 if (!wined3d_adapter_init_format_info(adapter
, &caps_gl_ctx
))
6122 ERR("Failed to initialize GL format info.\n");
6123 wined3d_caps_gl_ctx_destroy(&caps_gl_ctx
);
6124 HeapFree(GetProcessHeap(), 0, adapter
->cfgs
);
6128 gl_info
->fixed_polyoffset_scale
= wined3d_adapter_find_polyoffset_scale(&caps_gl_ctx
, GL_DEPTH_COMPONENT
);
6129 if (gl_info
->supported
[ARB_DEPTH_BUFFER_FLOAT
])
6130 gl_info
->float_polyoffset_scale
= wined3d_adapter_find_polyoffset_scale(&caps_gl_ctx
, GL_DEPTH32F_STENCIL8
);
6132 adapter
->vram_bytes
= adapter
->driver_info
.vram_bytes
;
6133 adapter
->vram_bytes_used
= 0;
6134 TRACE("Emulating 0x%s bytes of video ram.\n", wine_dbgstr_longlong(adapter
->vram_bytes
));
6136 display_device
.cb
= sizeof(display_device
);
6137 EnumDisplayDevicesW(NULL
, ordinal
, &display_device
, 0);
6138 TRACE("DeviceName: %s\n", debugstr_w(display_device
.DeviceName
));
6139 strcpyW(adapter
->DeviceName
, display_device
.DeviceName
);
6141 wined3d_caps_gl_ctx_destroy(&caps_gl_ctx
);
6143 wined3d_adapter_init_ffp_attrib_ops(adapter
);
6148 static void wined3d_adapter_init_nogl(struct wined3d_adapter
*adapter
, UINT ordinal
)
6150 DISPLAY_DEVICEW display_device
;
6152 memset(adapter
, 0, sizeof(*adapter
));
6153 adapter
->ordinal
= ordinal
;
6155 adapter
->driver_info
.name
= "Display";
6156 adapter
->driver_info
.description
= "WineD3D DirectDraw Emulation";
6157 if (wined3d_settings
.emulated_textureram
)
6158 adapter
->vram_bytes
= wined3d_settings
.emulated_textureram
;
6160 adapter
->vram_bytes
= 128 * 1024 * 1024;
6162 initPixelFormatsNoGL(&adapter
->gl_info
);
6164 adapter
->vertex_pipe
= &none_vertex_pipe
;
6165 adapter
->fragment_pipe
= &none_fragment_pipe
;
6166 adapter
->shader_backend
= &none_shader_backend
;
6167 adapter
->blitter
= &cpu_blit
;
6169 display_device
.cb
= sizeof(display_device
);
6170 EnumDisplayDevicesW(NULL
, ordinal
, &display_device
, 0);
6171 TRACE("DeviceName: %s\n", debugstr_w(display_device
.DeviceName
));
6172 strcpyW(adapter
->DeviceName
, display_device
.DeviceName
);
6175 static void STDMETHODCALLTYPE
wined3d_null_wined3d_object_destroyed(void *parent
) {}
6177 const struct wined3d_parent_ops wined3d_null_parent_ops
=
6179 wined3d_null_wined3d_object_destroyed
,
6182 HRESULT
wined3d_init(struct wined3d
*wined3d
, DWORD flags
)
6185 wined3d
->flags
= flags
;
6187 TRACE("Initializing adapters.\n");
6189 if (flags
& WINED3D_NO3D
)
6191 wined3d_adapter_init_nogl(&wined3d
->adapters
[0], 0);
6192 wined3d
->adapter_count
= 1;
6196 if (!wined3d_adapter_init(&wined3d
->adapters
[0], 0, flags
))
6198 WARN("Failed to initialize adapter.\n");
6201 wined3d
->adapter_count
= 1;