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_client_storage", APPLE_CLIENT_STORAGE
},
105 {"GL_APPLE_fence", APPLE_FENCE
},
106 {"GL_APPLE_float_pixels", APPLE_FLOAT_PIXELS
},
107 {"GL_APPLE_flush_buffer_range", APPLE_FLUSH_BUFFER_RANGE
},
108 {"GL_APPLE_ycbcr_422", APPLE_YCBCR_422
},
111 {"GL_ARB_blend_func_extended", ARB_BLEND_FUNC_EXTENDED
},
112 {"GL_ARB_color_buffer_float", ARB_COLOR_BUFFER_FLOAT
},
113 {"GL_ARB_debug_output", ARB_DEBUG_OUTPUT
},
114 {"GL_ARB_depth_buffer_float", ARB_DEPTH_BUFFER_FLOAT
},
115 {"GL_ARB_depth_clamp", ARB_DEPTH_CLAMP
},
116 {"GL_ARB_depth_texture", ARB_DEPTH_TEXTURE
},
117 {"GL_ARB_draw_buffers", ARB_DRAW_BUFFERS
},
118 {"GL_ARB_draw_elements_base_vertex", ARB_DRAW_ELEMENTS_BASE_VERTEX
},
119 {"GL_ARB_draw_instanced", ARB_DRAW_INSTANCED
},
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_query2", ARB_INTERNALFORMAT_QUERY2
, },
129 {"GL_ARB_map_buffer_alignment", ARB_MAP_BUFFER_ALIGNMENT
},
130 {"GL_ARB_map_buffer_range", ARB_MAP_BUFFER_RANGE
},
131 {"GL_ARB_multisample", ARB_MULTISAMPLE
}, /* needs GLX_ARB_MULTISAMPLE as well */
132 {"GL_ARB_multitexture", ARB_MULTITEXTURE
},
133 {"GL_ARB_occlusion_query", ARB_OCCLUSION_QUERY
},
134 {"GL_ARB_pixel_buffer_object", ARB_PIXEL_BUFFER_OBJECT
},
135 {"GL_ARB_point_parameters", ARB_POINT_PARAMETERS
},
136 {"GL_ARB_point_sprite", ARB_POINT_SPRITE
},
137 {"GL_ARB_provoking_vertex", ARB_PROVOKING_VERTEX
},
138 {"GL_ARB_shader_bit_encoding", ARB_SHADER_BIT_ENCODING
},
139 {"GL_ARB_shader_objects", ARB_SHADER_OBJECTS
},
140 {"GL_ARB_shader_texture_lod", ARB_SHADER_TEXTURE_LOD
},
141 {"GL_ARB_shading_language_100", ARB_SHADING_LANGUAGE_100
},
142 {"GL_ARB_shadow", ARB_SHADOW
},
143 {"GL_ARB_sync", ARB_SYNC
},
144 {"GL_ARB_texture_border_clamp", ARB_TEXTURE_BORDER_CLAMP
},
145 {"GL_ARB_texture_compression", ARB_TEXTURE_COMPRESSION
},
146 {"GL_ARB_texture_compression_rgtc", ARB_TEXTURE_COMPRESSION_RGTC
},
147 {"GL_ARB_texture_cube_map", ARB_TEXTURE_CUBE_MAP
},
148 {"GL_ARB_texture_env_add", ARB_TEXTURE_ENV_ADD
},
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_rectangle", ARB_TEXTURE_RECTANGLE
},
156 {"GL_ARB_texture_rg", ARB_TEXTURE_RG
},
157 {"GL_ARB_timer_query", ARB_TIMER_QUERY
},
158 {"GL_ARB_uniform_buffer_object", ARB_UNIFORM_BUFFER_OBJECT
},
159 {"GL_ARB_vertex_array_bgra", ARB_VERTEX_ARRAY_BGRA
},
160 {"GL_ARB_vertex_blend", ARB_VERTEX_BLEND
},
161 {"GL_ARB_vertex_buffer_object", ARB_VERTEX_BUFFER_OBJECT
},
162 {"GL_ARB_vertex_program", ARB_VERTEX_PROGRAM
},
163 {"GL_ARB_vertex_shader", ARB_VERTEX_SHADER
},
166 {"GL_ATI_fragment_shader", ATI_FRAGMENT_SHADER
},
167 {"GL_ATI_separate_stencil", ATI_SEPARATE_STENCIL
},
168 {"GL_ATI_texture_compression_3dc", ATI_TEXTURE_COMPRESSION_3DC
},
169 {"GL_ATI_texture_env_combine3", ATI_TEXTURE_ENV_COMBINE3
},
170 {"GL_ATI_texture_mirror_once", ATI_TEXTURE_MIRROR_ONCE
},
173 {"GL_EXT_blend_color", EXT_BLEND_COLOR
},
174 {"GL_EXT_blend_equation_separate", EXT_BLEND_EQUATION_SEPARATE
},
175 {"GL_EXT_blend_func_separate", EXT_BLEND_FUNC_SEPARATE
},
176 {"GL_EXT_blend_minmax", EXT_BLEND_MINMAX
},
177 {"GL_EXT_blend_subtract", EXT_BLEND_SUBTRACT
},
178 {"GL_EXT_depth_bounds_test", EXT_DEPTH_BOUNDS_TEST
},
179 {"GL_EXT_draw_buffers2", EXT_DRAW_BUFFERS2
},
180 {"GL_EXT_fog_coord", EXT_FOG_COORD
},
181 {"GL_EXT_framebuffer_blit", EXT_FRAMEBUFFER_BLIT
},
182 {"GL_EXT_framebuffer_multisample", EXT_FRAMEBUFFER_MULTISAMPLE
},
183 {"GL_EXT_framebuffer_object", EXT_FRAMEBUFFER_OBJECT
},
184 {"GL_EXT_gpu_program_parameters", EXT_GPU_PROGRAM_PARAMETERS
},
185 {"GL_EXT_gpu_shader4", EXT_GPU_SHADER4
},
186 {"GL_EXT_packed_depth_stencil", EXT_PACKED_DEPTH_STENCIL
},
187 {"GL_EXT_point_parameters", EXT_POINT_PARAMETERS
},
188 {"GL_EXT_provoking_vertex", EXT_PROVOKING_VERTEX
},
189 {"GL_EXT_secondary_color", EXT_SECONDARY_COLOR
},
190 {"GL_EXT_stencil_two_side", EXT_STENCIL_TWO_SIDE
},
191 {"GL_EXT_stencil_wrap", EXT_STENCIL_WRAP
},
192 {"GL_EXT_texture3D", EXT_TEXTURE3D
},
193 {"GL_EXT_texture_compression_rgtc", EXT_TEXTURE_COMPRESSION_RGTC
},
194 {"GL_EXT_texture_compression_s3tc", EXT_TEXTURE_COMPRESSION_S3TC
},
195 {"GL_EXT_texture_env_add", EXT_TEXTURE_ENV_ADD
},
196 {"GL_EXT_texture_env_combine", EXT_TEXTURE_ENV_COMBINE
},
197 {"GL_EXT_texture_env_dot3", EXT_TEXTURE_ENV_DOT3
},
198 {"GL_EXT_texture_filter_anisotropic", EXT_TEXTURE_FILTER_ANISOTROPIC
},
199 {"GL_EXT_texture_lod_bias", EXT_TEXTURE_LOD_BIAS
},
200 {"GL_EXT_texture_mirror_clamp", EXT_TEXTURE_MIRROR_CLAMP
},
201 {"GL_EXT_texture_sRGB", EXT_TEXTURE_SRGB
},
202 {"GL_EXT_texture_sRGB_decode", EXT_TEXTURE_SRGB_DECODE
},
203 {"GL_EXT_vertex_array_bgra", EXT_VERTEX_ARRAY_BGRA
},
206 {"GL_NV_depth_clamp", NV_DEPTH_CLAMP
},
207 {"GL_NV_fence", NV_FENCE
},
208 {"GL_NV_fog_distance", NV_FOG_DISTANCE
},
209 {"GL_NV_fragment_program", NV_FRAGMENT_PROGRAM
},
210 {"GL_NV_fragment_program2", NV_FRAGMENT_PROGRAM2
},
211 {"GL_NV_fragment_program_option", NV_FRAGMENT_PROGRAM_OPTION
},
212 {"GL_NV_half_float", NV_HALF_FLOAT
},
213 {"GL_NV_light_max_exponent", NV_LIGHT_MAX_EXPONENT
},
214 {"GL_NV_point_sprite", NV_POINT_SPRITE
},
215 {"GL_NV_register_combiners", NV_REGISTER_COMBINERS
},
216 {"GL_NV_register_combiners2", NV_REGISTER_COMBINERS2
},
217 {"GL_NV_texgen_reflection", NV_TEXGEN_REFLECTION
},
218 {"GL_NV_texture_env_combine4", NV_TEXTURE_ENV_COMBINE4
},
219 {"GL_NV_texture_shader", NV_TEXTURE_SHADER
},
220 {"GL_NV_texture_shader2", NV_TEXTURE_SHADER2
},
221 {"GL_NV_vertex_program", NV_VERTEX_PROGRAM
},
222 {"GL_NV_vertex_program1_1", NV_VERTEX_PROGRAM1_1
},
223 {"GL_NV_vertex_program2", NV_VERTEX_PROGRAM2
},
224 {"GL_NV_vertex_program2_option", NV_VERTEX_PROGRAM2_OPTION
},
225 {"GL_NV_vertex_program3", NV_VERTEX_PROGRAM3
},
228 {"GL_SGIS_generate_mipmap", SGIS_GENERATE_MIPMAP
},
231 static const struct wined3d_extension_map wgl_extension_map
[] =
233 {"WGL_ARB_pixel_format", WGL_ARB_PIXEL_FORMAT
},
234 {"WGL_EXT_swap_control", WGL_EXT_SWAP_CONTROL
},
235 {"WGL_WINE_pixel_format_passthrough", WGL_WINE_PIXEL_FORMAT_PASSTHROUGH
},
238 /**********************************************************
239 * Utility functions follow
240 **********************************************************/
242 const struct min_lookup minMipLookup
[] =
244 /* NONE POINT LINEAR */
245 {{GL_NEAREST
, GL_NEAREST
, GL_NEAREST
}}, /* NONE */
246 {{GL_NEAREST
, GL_NEAREST_MIPMAP_NEAREST
, GL_NEAREST_MIPMAP_LINEAR
}}, /* POINT*/
247 {{GL_LINEAR
, GL_LINEAR_MIPMAP_NEAREST
, GL_LINEAR_MIPMAP_LINEAR
}}, /* LINEAR */
250 const struct min_lookup minMipLookup_noFilter
[] =
252 /* NONE POINT LINEAR */
253 {{GL_NEAREST
, GL_NEAREST
, GL_NEAREST
}}, /* NONE */
254 {{GL_NEAREST
, GL_NEAREST
, GL_NEAREST
}}, /* POINT */
255 {{GL_NEAREST
, GL_NEAREST
, GL_NEAREST
}}, /* LINEAR */
258 const struct min_lookup minMipLookup_noMip
[] =
260 /* NONE POINT LINEAR */
261 {{GL_NEAREST
, GL_NEAREST
, GL_NEAREST
}}, /* NONE */
262 {{GL_NEAREST
, GL_NEAREST
, GL_NEAREST
}}, /* POINT */
263 {{GL_LINEAR
, GL_LINEAR
, GL_LINEAR
}}, /* LINEAR */
266 const GLenum magLookup
[] =
268 /* NONE POINT LINEAR */
269 GL_NEAREST
, GL_NEAREST
, GL_LINEAR
,
272 const GLenum magLookup_noFilter
[] =
274 /* NONE POINT LINEAR */
275 GL_NEAREST
, GL_NEAREST
, GL_NEAREST
,
278 struct wined3d_caps_gl_ctx
284 HGLRC restore_gl_ctx
;
287 static void wined3d_caps_gl_ctx_destroy(const struct wined3d_caps_gl_ctx
*ctx
)
289 TRACE("Destroying caps GL context.\n");
291 if (!wglMakeCurrent(NULL
, NULL
))
292 ERR("Failed to disable caps GL context.\n");
294 if (!wglDeleteContext(ctx
->gl_ctx
))
296 DWORD err
= GetLastError();
297 ERR("wglDeleteContext(%p) failed, last error %#x.\n", ctx
->gl_ctx
, err
);
300 wined3d_release_dc(ctx
->wnd
, ctx
->dc
);
301 DestroyWindow(ctx
->wnd
);
303 if (ctx
->restore_gl_ctx
&& !wglMakeCurrent(ctx
->restore_dc
, ctx
->restore_gl_ctx
))
304 ERR("Failed to restore previous GL context.\n");
307 static void wined3d_caps_gl_ctx_create_attribs(struct wined3d_caps_gl_ctx
*caps_gl_ctx
,
308 struct wined3d_gl_info
*gl_info
, const GLint
*ctx_attribs
)
312 if (!(gl_info
->p_wglCreateContextAttribsARB
= (void *)wglGetProcAddress("wglCreateContextAttribsARB")))
315 if (!(new_ctx
= gl_info
->p_wglCreateContextAttribsARB(caps_gl_ctx
->dc
, NULL
, ctx_attribs
)))
317 ERR("Failed to create a context using wglCreateContextAttribsARB(), last error %#x.\n", GetLastError());
318 gl_info
->p_wglCreateContextAttribsARB
= NULL
;
322 if (!wglMakeCurrent(caps_gl_ctx
->dc
, new_ctx
))
324 ERR("Failed to make new context current, last error %#x.\n", GetLastError());
325 if (!wglDeleteContext(new_ctx
))
326 ERR("Failed to delete new context, last error %#x.\n", GetLastError());
327 gl_info
->p_wglCreateContextAttribsARB
= NULL
;
331 if (!wglDeleteContext(caps_gl_ctx
->gl_ctx
))
332 ERR("Failed to delete old context, last error %#x.\n", GetLastError());
333 caps_gl_ctx
->gl_ctx
= new_ctx
;
336 static BOOL
wined3d_caps_gl_ctx_create(struct wined3d_caps_gl_ctx
*ctx
)
338 PIXELFORMATDESCRIPTOR pfd
;
341 TRACE("getting context...\n");
343 ctx
->restore_dc
= wglGetCurrentDC();
344 ctx
->restore_gl_ctx
= wglGetCurrentContext();
346 /* We need a fake window as a hdc retrieved using GetDC(0) can't be used for much GL purposes. */
347 ctx
->wnd
= CreateWindowA(WINED3D_OPENGL_WINDOW_CLASS_NAME
, "WineD3D fake window",
348 WS_OVERLAPPEDWINDOW
, 10, 10, 10, 10, NULL
, NULL
, NULL
, NULL
);
351 ERR("Failed to create a window.\n");
355 ctx
->dc
= GetDC(ctx
->wnd
);
358 ERR("Failed to get a DC.\n");
362 /* PixelFormat selection */
363 ZeroMemory(&pfd
, sizeof(pfd
));
364 pfd
.nSize
= sizeof(pfd
);
366 pfd
.dwFlags
= PFD_SUPPORT_OPENGL
| PFD_DOUBLEBUFFER
| PFD_DRAW_TO_WINDOW
; /* PFD_GENERIC_ACCELERATED */
367 pfd
.iPixelType
= PFD_TYPE_RGBA
;
369 pfd
.iLayerType
= PFD_MAIN_PLANE
;
371 if (!(iPixelFormat
= ChoosePixelFormat(ctx
->dc
, &pfd
)))
373 /* If this happens something is very wrong as ChoosePixelFormat barely fails. */
374 ERR("Failed to find a suitable pixel format.\n");
377 DescribePixelFormat(ctx
->dc
, iPixelFormat
, sizeof(pfd
), &pfd
);
378 SetPixelFormat(ctx
->dc
, iPixelFormat
, &pfd
);
380 /* Create a GL context. */
381 if (!(ctx
->gl_ctx
= wglCreateContext(ctx
->dc
)))
383 WARN("Failed to create default context for capabilities initialization.\n");
387 /* Make it the current GL context. */
388 if (!wglMakeCurrent(ctx
->dc
, ctx
->gl_ctx
))
390 ERR("Failed to make caps GL context current.\n");
397 if (ctx
->gl_ctx
) wglDeleteContext(ctx
->gl_ctx
);
399 if (ctx
->dc
) ReleaseDC(ctx
->wnd
, ctx
->dc
);
401 if (ctx
->wnd
) DestroyWindow(ctx
->wnd
);
403 if (ctx
->restore_gl_ctx
&& !wglMakeCurrent(ctx
->restore_dc
, ctx
->restore_gl_ctx
))
404 ERR("Failed to restore previous GL context.\n");
409 /* Adjust the amount of used texture memory */
410 UINT64
adapter_adjust_memory(struct wined3d_adapter
*adapter
, INT64 amount
)
412 adapter
->vram_bytes_used
+= amount
;
413 TRACE("Adjusted used adapter memory by 0x%s to 0x%s.\n",
414 wine_dbgstr_longlong(amount
),
415 wine_dbgstr_longlong(adapter
->vram_bytes_used
));
416 return adapter
->vram_bytes_used
;
419 static void wined3d_adapter_cleanup(struct wined3d_adapter
*adapter
)
421 HeapFree(GetProcessHeap(), 0, adapter
->gl_info
.formats
);
422 HeapFree(GetProcessHeap(), 0, adapter
->cfgs
);
425 ULONG CDECL
wined3d_incref(struct wined3d
*wined3d
)
427 ULONG refcount
= InterlockedIncrement(&wined3d
->ref
);
429 TRACE("%p increasing refcount to %u.\n", wined3d
, refcount
);
434 ULONG CDECL
wined3d_decref(struct wined3d
*wined3d
)
436 ULONG refcount
= InterlockedDecrement(&wined3d
->ref
);
438 TRACE("%p decreasing refcount to %u.\n", wined3d
, refcount
);
444 for (i
= 0; i
< wined3d
->adapter_count
; ++i
)
446 wined3d_adapter_cleanup(&wined3d
->adapters
[i
]);
448 HeapFree(GetProcessHeap(), 0, wined3d
);
454 /* Context activation is done by the caller. */
455 static BOOL
test_arb_vs_offset_limit(const struct wined3d_gl_info
*gl_info
)
459 static const char testcode
[] =
461 "PARAM C[66] = { program.env[0..65] };\n"
463 "PARAM zero = {0.0, 0.0, 0.0, 0.0};\n"
464 "ARL A0.x, zero.x;\n"
465 "MOV result.position, C[A0.x + 65];\n"
468 while (gl_info
->gl_ops
.gl
.p_glGetError());
469 GL_EXTCALL(glGenProgramsARB(1, &prog
));
471 ERR("Failed to create an ARB offset limit test program\n");
473 GL_EXTCALL(glBindProgramARB(GL_VERTEX_PROGRAM_ARB
, prog
));
474 GL_EXTCALL(glProgramStringARB(GL_VERTEX_PROGRAM_ARB
, GL_PROGRAM_FORMAT_ASCII_ARB
,
475 strlen(testcode
), testcode
));
476 if (gl_info
->gl_ops
.gl
.p_glGetError())
478 TRACE("OpenGL implementation does not allow indirect addressing offsets > 63\n");
479 TRACE("error: %s\n", debugstr_a((const char *)gl_info
->gl_ops
.gl
.p_glGetString(GL_PROGRAM_ERROR_STRING_ARB
)));
481 } else TRACE("OpenGL implementation allows offsets > 63\n");
483 GL_EXTCALL(glBindProgramARB(GL_VERTEX_PROGRAM_ARB
, 0));
484 GL_EXTCALL(glDeleteProgramsARB(1, &prog
));
485 checkGLcall("ARB vp offset limit test cleanup");
490 static BOOL
match_amd_r300_to_500(const struct wined3d_gl_info
*gl_info
, const char *gl_renderer
,
491 enum wined3d_gl_vendor gl_vendor
, enum wined3d_pci_vendor card_vendor
, enum wined3d_pci_device device
)
493 if (card_vendor
!= HW_VENDOR_AMD
) return FALSE
;
494 if (device
== CARD_AMD_RADEON_9500
) return TRUE
;
495 if (device
== CARD_AMD_RADEON_X700
) return TRUE
;
496 if (device
== CARD_AMD_RADEON_X1600
) return TRUE
;
500 static BOOL
match_geforce5(const struct wined3d_gl_info
*gl_info
, const char *gl_renderer
,
501 enum wined3d_gl_vendor gl_vendor
, enum wined3d_pci_vendor card_vendor
, enum wined3d_pci_device device
)
503 if (card_vendor
== HW_VENDOR_NVIDIA
)
505 if (device
== CARD_NVIDIA_GEFORCEFX_5200
||
506 device
== CARD_NVIDIA_GEFORCEFX_5600
||
507 device
== CARD_NVIDIA_GEFORCEFX_5800
)
515 static BOOL
match_apple(const struct wined3d_gl_info
*gl_info
, const char *gl_renderer
,
516 enum wined3d_gl_vendor gl_vendor
, enum wined3d_pci_vendor card_vendor
, enum wined3d_pci_device device
)
518 /* MacOS has various specialities in the extensions it advertises. Some have to be loaded from
519 * the opengl 1.2+ core, while other extensions are advertised, but software emulated. So try to
520 * detect the Apple OpenGL implementation to apply some extension fixups afterwards.
522 * Detecting this isn't really easy. The vendor string doesn't mention Apple. Compile-time checks
523 * aren't sufficient either because a Linux binary may display on a macos X server via remote X11.
524 * So try to detect the GL implementation by looking at certain Apple extensions. Some extensions
525 * like client storage might be supported on other implementations too, but GL_APPLE_flush_render
526 * is specific to the Mac OS X window management, and GL_APPLE_ycbcr_422 is QuickTime specific. So
527 * the chance that other implementations support them is rather small since Win32 QuickTime uses
528 * DirectDraw, not OpenGL.
530 * This test has been moved into wined3d_guess_gl_vendor()
532 if (gl_vendor
== GL_VENDOR_APPLE
)
539 /* Context activation is done by the caller. */
540 static void test_pbo_functionality(struct wined3d_gl_info
*gl_info
)
542 /* Some OpenGL implementations, namely Apple's Geforce 8 driver, advertises PBOs,
543 * but glTexSubImage from a PBO fails miserably, with the first line repeated over
544 * all the texture. This function detects this bug by its symptom and disables PBOs
547 * The test uploads a 4x4 texture via the PBO in the "native" format GL_BGRA,
548 * GL_UNSIGNED_INT_8_8_8_8_REV. This format triggers the bug, and it is what we use
549 * for D3DFMT_A8R8G8B8. Then the texture is read back without any PBO and the data
550 * read back is compared to the original. If they are equal PBOs are assumed to work,
551 * otherwise the PBO extension is disabled. */
553 static const unsigned int pattern
[] =
555 0x00000000, 0x000000ff, 0x0000ff00, 0x40ff0000,
556 0x80ffffff, 0x40ffff00, 0x00ff00ff, 0x0000ffff,
557 0x00ffff00, 0x00ff00ff, 0x0000ffff, 0x000000ff,
558 0x80ff00ff, 0x0000ffff, 0x00ff00ff, 0x40ff00ff
560 unsigned int check
[sizeof(pattern
) / sizeof(pattern
[0])];
562 /* No PBO -> No point in testing them. */
563 if (!gl_info
->supported
[ARB_PIXEL_BUFFER_OBJECT
]) return;
565 while (gl_info
->gl_ops
.gl
.p_glGetError());
566 gl_info
->gl_ops
.gl
.p_glGenTextures(1, &texture
);
567 gl_info
->gl_ops
.gl
.p_glBindTexture(GL_TEXTURE_2D
, texture
);
569 gl_info
->gl_ops
.gl
.p_glTexParameteri(GL_TEXTURE_2D
, GL_TEXTURE_MAX_LEVEL
, 0);
570 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);
571 checkGLcall("Specifying the PBO test texture");
573 GL_EXTCALL(glGenBuffers(1, &pbo
));
574 GL_EXTCALL(glBindBuffer(GL_PIXEL_UNPACK_BUFFER
, pbo
));
575 GL_EXTCALL(glBufferData(GL_PIXEL_UNPACK_BUFFER
, sizeof(pattern
), pattern
, GL_STREAM_DRAW
));
576 checkGLcall("Specifying the PBO test pbo");
578 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
);
579 checkGLcall("Loading the PBO test texture");
581 GL_EXTCALL(glBindBuffer(GL_PIXEL_UNPACK_BUFFER
, 0));
583 gl_info
->gl_ops
.gl
.p_glFinish(); /* just to be sure */
585 memset(check
, 0, sizeof(check
));
586 gl_info
->gl_ops
.gl
.p_glGetTexImage(GL_TEXTURE_2D
, 0, GL_BGRA
, GL_UNSIGNED_INT_8_8_8_8_REV
, check
);
587 checkGLcall("Reading back the PBO test texture");
589 gl_info
->gl_ops
.gl
.p_glDeleteTextures(1, &texture
);
590 GL_EXTCALL(glDeleteBuffers(1, &pbo
));
591 checkGLcall("PBO test cleanup");
593 if (memcmp(check
, pattern
, sizeof(check
)))
595 WARN_(d3d_perf
)("PBO test failed, read back data doesn't match original.\n"
596 "Disabling PBOs. This may result in slower performance.\n");
597 gl_info
->supported
[ARB_PIXEL_BUFFER_OBJECT
] = FALSE
;
601 TRACE("PBO test successful.\n");
605 static BOOL
match_apple_intel(const struct wined3d_gl_info
*gl_info
, const char *gl_renderer
,
606 enum wined3d_gl_vendor gl_vendor
, enum wined3d_pci_vendor card_vendor
, enum wined3d_pci_device device
)
608 return (card_vendor
== HW_VENDOR_INTEL
) && (gl_vendor
== GL_VENDOR_APPLE
);
611 static BOOL
match_apple_nonr500ati(const struct wined3d_gl_info
*gl_info
, const char *gl_renderer
,
612 enum wined3d_gl_vendor gl_vendor
, enum wined3d_pci_vendor card_vendor
, enum wined3d_pci_device device
)
614 if (gl_vendor
!= GL_VENDOR_APPLE
) return FALSE
;
615 if (card_vendor
!= HW_VENDOR_AMD
) return FALSE
;
616 if (device
== CARD_AMD_RADEON_X1600
) return FALSE
;
620 static BOOL
match_dx10_capable(const struct wined3d_gl_info
*gl_info
, const char *gl_renderer
,
621 enum wined3d_gl_vendor gl_vendor
, enum wined3d_pci_vendor card_vendor
, enum wined3d_pci_device device
)
623 /* DX9 cards support 40 single float varyings in hardware, most drivers report 32. ATI misreports
624 * 44 varyings. So assume that if we have more than 44 varyings we have a dx10 card.
625 * This detection is for the gl_ClipPos varying quirk. If a d3d9 card really supports more than 44
626 * varyings and we subtract one in dx9 shaders it's not going to hurt us because the dx9 limit is
629 * dx10 cards usually have 64 varyings */
630 return gl_info
->limits
.glsl_varyings
> 44;
633 static BOOL
match_not_dx10_capable(const struct wined3d_gl_info
*gl_info
, const char *gl_renderer
,
634 enum wined3d_gl_vendor gl_vendor
, enum wined3d_pci_vendor card_vendor
, enum wined3d_pci_device device
)
636 return !match_dx10_capable(gl_info
, gl_renderer
, gl_vendor
, card_vendor
, device
);
639 /* A GL context is provided by the caller */
640 static BOOL
match_allows_spec_alpha(const struct wined3d_gl_info
*gl_info
, const char *gl_renderer
,
641 enum wined3d_gl_vendor gl_vendor
, enum wined3d_pci_vendor card_vendor
, enum wined3d_pci_device device
)
646 if (!gl_info
->supported
[EXT_SECONDARY_COLOR
])
649 while (gl_info
->gl_ops
.gl
.p_glGetError());
650 GL_EXTCALL(glSecondaryColorPointerEXT
)(4, GL_UNSIGNED_BYTE
, 4, data
);
651 error
= gl_info
->gl_ops
.gl
.p_glGetError();
653 if (error
== GL_NO_ERROR
)
655 TRACE("GL Implementation accepts 4 component specular color pointers\n");
660 TRACE("GL implementation does not accept 4 component specular colors, error %s\n",
661 debug_glerror(error
));
666 /* A GL context is provided by the caller */
667 static BOOL
match_broken_nv_clip(const struct wined3d_gl_info
*gl_info
, const char *gl_renderer
,
668 enum wined3d_gl_vendor gl_vendor
, enum wined3d_pci_vendor card_vendor
, enum wined3d_pci_device device
)
673 static const char testcode
[] =
675 "OPTION NV_vertex_program2;\n"
676 "MOV result.clip[0], 0.0;\n"
677 "MOV result.position, 0.0;\n"
680 if (!gl_info
->supported
[NV_VERTEX_PROGRAM2_OPTION
]) return FALSE
;
682 while (gl_info
->gl_ops
.gl
.p_glGetError());
684 GL_EXTCALL(glGenProgramsARB(1, &prog
));
687 ERR("Failed to create the NVvp clip test program\n");
690 GL_EXTCALL(glBindProgramARB(GL_VERTEX_PROGRAM_ARB
, prog
));
691 GL_EXTCALL(glProgramStringARB(GL_VERTEX_PROGRAM_ARB
, GL_PROGRAM_FORMAT_ASCII_ARB
,
692 strlen(testcode
), testcode
));
693 gl_info
->gl_ops
.gl
.p_glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB
, &pos
);
696 WARN("GL_NV_vertex_program2_option result.clip[] test failed\n");
697 TRACE("error: %s\n", debugstr_a((const char *)gl_info
->gl_ops
.gl
.p_glGetString(GL_PROGRAM_ERROR_STRING_ARB
)));
699 while (gl_info
->gl_ops
.gl
.p_glGetError());
701 else TRACE("GL_NV_vertex_program2_option result.clip[] test passed\n");
703 GL_EXTCALL(glBindProgramARB(GL_VERTEX_PROGRAM_ARB
, 0));
704 GL_EXTCALL(glDeleteProgramsARB(1, &prog
));
705 checkGLcall("GL_NV_vertex_program2_option result.clip[] test cleanup");
710 /* Context activation is done by the caller. */
711 static BOOL
match_fbo_tex_update(const struct wined3d_gl_info
*gl_info
, const char *gl_renderer
,
712 enum wined3d_gl_vendor gl_vendor
, enum wined3d_pci_vendor card_vendor
, enum wined3d_pci_device device
)
714 char data
[4 * 4 * 4];
718 if (wined3d_settings
.offscreen_rendering_mode
!= ORM_FBO
) return FALSE
;
720 memset(data
, 0xcc, sizeof(data
));
722 gl_info
->gl_ops
.gl
.p_glGenTextures(1, &tex
);
723 gl_info
->gl_ops
.gl
.p_glBindTexture(GL_TEXTURE_2D
, tex
);
724 gl_info
->gl_ops
.gl
.p_glTexParameteri(GL_TEXTURE_2D
, GL_TEXTURE_MIN_FILTER
, GL_NEAREST
);
725 gl_info
->gl_ops
.gl
.p_glTexParameteri(GL_TEXTURE_2D
, GL_TEXTURE_MAG_FILTER
, GL_NEAREST
);
726 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
);
727 checkGLcall("glTexImage2D");
729 gl_info
->fbo_ops
.glGenFramebuffers(1, &fbo
);
730 gl_info
->fbo_ops
.glBindFramebuffer(GL_FRAMEBUFFER
, fbo
);
731 gl_info
->fbo_ops
.glFramebufferTexture2D(GL_FRAMEBUFFER
, GL_COLOR_ATTACHMENT0
, GL_TEXTURE_2D
, tex
, 0);
732 checkGLcall("glFramebufferTexture2D");
734 status
= gl_info
->fbo_ops
.glCheckFramebufferStatus(GL_FRAMEBUFFER
);
735 if (status
!= GL_FRAMEBUFFER_COMPLETE
) ERR("FBO status %#x\n", status
);
736 checkGLcall("glCheckFramebufferStatus");
738 memset(data
, 0x11, sizeof(data
));
739 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
);
740 checkGLcall("glTexSubImage2D");
742 gl_info
->gl_ops
.gl
.p_glClearColor(0.996f
, 0.729f
, 0.745f
, 0.792f
);
743 gl_info
->gl_ops
.gl
.p_glClear(GL_COLOR_BUFFER_BIT
);
744 checkGLcall("glClear");
746 gl_info
->gl_ops
.gl
.p_glGetTexImage(GL_TEXTURE_2D
, 0, GL_BGRA
, GL_UNSIGNED_INT_8_8_8_8_REV
, data
);
747 checkGLcall("glGetTexImage");
749 gl_info
->fbo_ops
.glFramebufferTexture2D(GL_FRAMEBUFFER
, GL_COLOR_ATTACHMENT0
, GL_TEXTURE_2D
, 0, 0);
750 gl_info
->fbo_ops
.glBindFramebuffer(GL_FRAMEBUFFER
, 0);
751 gl_info
->gl_ops
.gl
.p_glBindTexture(GL_TEXTURE_2D
, 0);
752 checkGLcall("glBindTexture");
754 gl_info
->fbo_ops
.glDeleteFramebuffers(1, &fbo
);
755 gl_info
->gl_ops
.gl
.p_glDeleteTextures(1, &tex
);
756 checkGLcall("glDeleteTextures");
758 return *(DWORD
*)data
== 0x11111111;
761 /* Context activation is done by the caller. */
762 static BOOL
match_broken_rgba16(const struct wined3d_gl_info
*gl_info
, const char *gl_renderer
,
763 enum wined3d_gl_vendor gl_vendor
, enum wined3d_pci_vendor card_vendor
, enum wined3d_pci_device device
)
765 /* GL_RGBA16 uses GL_RGBA8 internally on Geforce 7 and older cards.
766 * This leads to graphical bugs in Half Life 2 and Unreal engine games. */
770 gl_info
->gl_ops
.gl
.p_glGenTextures(1, &tex
);
771 gl_info
->gl_ops
.gl
.p_glBindTexture(GL_TEXTURE_2D
, tex
);
772 gl_info
->gl_ops
.gl
.p_glTexImage2D(GL_TEXTURE_2D
, 0, GL_RGBA16
, 4, 4, 0, GL_RGBA
, GL_UNSIGNED_SHORT
, NULL
);
773 checkGLcall("glTexImage2D");
775 gl_info
->gl_ops
.gl
.p_glGetTexLevelParameteriv(GL_TEXTURE_2D
, 0, GL_TEXTURE_RED_SIZE
, &size
);
776 checkGLcall("glGetTexLevelParameteriv");
777 TRACE("Real color depth is %d\n", size
);
779 gl_info
->gl_ops
.gl
.p_glBindTexture(GL_TEXTURE_2D
, 0);
780 checkGLcall("glBindTexture");
781 gl_info
->gl_ops
.gl
.p_glDeleteTextures(1, &tex
);
782 checkGLcall("glDeleteTextures");
787 static BOOL
match_fglrx(const struct wined3d_gl_info
*gl_info
, const char *gl_renderer
,
788 enum wined3d_gl_vendor gl_vendor
, enum wined3d_pci_vendor card_vendor
, enum wined3d_pci_device device
)
790 return gl_vendor
== GL_VENDOR_FGLRX
;
793 static BOOL
match_r200(const struct wined3d_gl_info
*gl_info
, const char *gl_renderer
,
794 enum wined3d_gl_vendor gl_vendor
, enum wined3d_pci_vendor card_vendor
, enum wined3d_pci_device device
)
796 if (card_vendor
!= HW_VENDOR_AMD
) return FALSE
;
797 if (device
== CARD_AMD_RADEON_8500
) return TRUE
;
801 static BOOL
match_broken_arb_fog(const struct wined3d_gl_info
*gl_info
, const char *gl_renderer
,
802 enum wined3d_gl_vendor gl_vendor
, enum wined3d_pci_vendor card_vendor
, enum wined3d_pci_device device
)
807 float color
[4] = {0.0f
, 1.0f
, 0.0f
, 0.0f
};
810 static const char program_code
[] =
812 "OPTION ARB_fog_linear;\n"
813 "MOV result.color, {1.0, 0.0, 0.0, 0.0};\n"
816 if (wined3d_settings
.offscreen_rendering_mode
!= ORM_FBO
)
818 if (!gl_info
->supported
[ARB_FRAGMENT_PROGRAM
])
821 gl_info
->gl_ops
.gl
.p_glGenTextures(1, &tex
);
822 gl_info
->gl_ops
.gl
.p_glBindTexture(GL_TEXTURE_2D
, tex
);
823 gl_info
->gl_ops
.gl
.p_glTexParameteri(GL_TEXTURE_2D
, GL_TEXTURE_MIN_FILTER
, GL_NEAREST
);
824 gl_info
->gl_ops
.gl
.p_glTexParameteri(GL_TEXTURE_2D
, GL_TEXTURE_MAG_FILTER
, GL_NEAREST
);
825 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
);
826 checkGLcall("glTexImage2D");
828 gl_info
->fbo_ops
.glGenFramebuffers(1, &fbo
);
829 gl_info
->fbo_ops
.glBindFramebuffer(GL_FRAMEBUFFER
, fbo
);
830 gl_info
->fbo_ops
.glFramebufferTexture2D(GL_FRAMEBUFFER
, GL_COLOR_ATTACHMENT0
, GL_TEXTURE_2D
, tex
, 0);
831 checkGLcall("glFramebufferTexture2D");
833 status
= gl_info
->fbo_ops
.glCheckFramebufferStatus(GL_FRAMEBUFFER
);
834 if (status
!= GL_FRAMEBUFFER_COMPLETE
) ERR("FBO status %#x\n", status
);
835 checkGLcall("glCheckFramebufferStatus");
837 gl_info
->gl_ops
.gl
.p_glClearColor(0.0f
, 0.0f
, 1.0f
, 0.0f
);
838 gl_info
->gl_ops
.gl
.p_glClear(GL_COLOR_BUFFER_BIT
);
839 checkGLcall("glClear");
840 gl_info
->gl_ops
.gl
.p_glViewport(0, 0, 4, 1);
841 checkGLcall("glViewport");
843 gl_info
->gl_ops
.gl
.p_glEnable(GL_FOG
);
844 gl_info
->gl_ops
.gl
.p_glFogf(GL_FOG_START
, 0.5f
);
845 gl_info
->gl_ops
.gl
.p_glFogf(GL_FOG_END
, 0.5f
);
846 gl_info
->gl_ops
.gl
.p_glFogi(GL_FOG_MODE
, GL_LINEAR
);
847 gl_info
->gl_ops
.gl
.p_glHint(GL_FOG_HINT
, GL_NICEST
);
848 gl_info
->gl_ops
.gl
.p_glFogfv(GL_FOG_COLOR
, color
);
849 checkGLcall("fog setup");
851 GL_EXTCALL(glGenProgramsARB(1, &prog
));
852 GL_EXTCALL(glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB
, prog
));
853 GL_EXTCALL(glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB
, GL_PROGRAM_FORMAT_ASCII_ARB
,
854 strlen(program_code
), program_code
));
855 gl_info
->gl_ops
.gl
.p_glEnable(GL_FRAGMENT_PROGRAM_ARB
);
856 checkGLcall("Test fragment program setup");
858 gl_info
->gl_ops
.gl
.p_glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB
, &err_pos
);
861 const char *error_str
;
862 error_str
= (const char *)gl_info
->gl_ops
.gl
.p_glGetString(GL_PROGRAM_ERROR_STRING_ARB
);
863 FIXME("Fog test program error at position %d: %s\n\n", err_pos
, debugstr_a(error_str
));
866 gl_info
->gl_ops
.gl
.p_glBegin(GL_TRIANGLE_STRIP
);
867 gl_info
->gl_ops
.gl
.p_glVertex3f(-1.0f
, -1.0f
, 0.0f
);
868 gl_info
->gl_ops
.gl
.p_glVertex3f( 1.0f
, -1.0f
, 1.0f
);
869 gl_info
->gl_ops
.gl
.p_glVertex3f(-1.0f
, 1.0f
, 0.0f
);
870 gl_info
->gl_ops
.gl
.p_glVertex3f( 1.0f
, 1.0f
, 1.0f
);
871 gl_info
->gl_ops
.gl
.p_glEnd();
872 checkGLcall("ARBfp fog test draw");
874 gl_info
->gl_ops
.gl
.p_glGetTexImage(GL_TEXTURE_2D
, 0, GL_BGRA
, GL_UNSIGNED_INT_8_8_8_8_REV
, data
);
875 checkGLcall("glGetTexImage");
876 data
[0] &= 0x00ffffff;
877 data
[1] &= 0x00ffffff;
878 data
[2] &= 0x00ffffff;
879 data
[3] &= 0x00ffffff;
881 gl_info
->fbo_ops
.glBindFramebuffer(GL_FRAMEBUFFER
, 0);
882 gl_info
->gl_ops
.gl
.p_glBindTexture(GL_TEXTURE_2D
, 0);
884 gl_info
->fbo_ops
.glDeleteFramebuffers(1, &fbo
);
885 gl_info
->gl_ops
.gl
.p_glDeleteTextures(1, &tex
);
886 gl_info
->gl_ops
.gl
.p_glDisable(GL_FOG
);
887 GL_EXTCALL(glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB
, 0));
888 gl_info
->gl_ops
.gl
.p_glDisable(GL_FRAGMENT_PROGRAM_ARB
);
889 GL_EXTCALL(glDeleteProgramsARB(1, &prog
));
890 checkGLcall("ARBfp fog test teardown");
892 TRACE("Fog test data: %08x %08x %08x %08x\n", data
[0], data
[1], data
[2], data
[3]);
893 return data
[0] != 0x00ff0000 || data
[3] != 0x0000ff00;
896 static void quirk_apple_glsl_constants(struct wined3d_gl_info
*gl_info
)
898 /* MacOS needs uniforms for relative addressing offsets. This can accumulate to quite a few uniforms.
899 * Beyond that the general uniform isn't optimal, so reserve a number of uniforms. 12 vec4's should
900 * allow 48 different offsets or other helper immediate values. */
901 TRACE("Reserving 12 GLSL constants for compiler private use.\n");
902 gl_info
->reserved_glsl_constants
= max(gl_info
->reserved_glsl_constants
, 12);
905 static void quirk_amd_dx9(struct wined3d_gl_info
*gl_info
)
907 /* MacOS advertises GL_ARB_texture_non_power_of_two on ATI r500 and earlier cards, although
908 * these cards only support GL_ARB_texture_rectangle(D3DPTEXTURECAPS_NONPOW2CONDITIONAL).
909 * If real NP2 textures are used, the driver falls back to software. We could just remove the
910 * extension and use GL_ARB_texture_rectangle instead, but texture_rectangle is inconvenient
911 * due to the non-normalized texture coordinates. Thus set an internal extension flag,
912 * GL_WINE_normalized_texrect, which signals the code that it can use non power of two textures
913 * as per GL_ARB_texture_non_power_of_two, but has to stick to the texture_rectangle limits.
915 * fglrx doesn't advertise GL_ARB_texture_non_power_of_two, but it advertises opengl 2.0 which
916 * has this extension promoted to core. The extension loading code sets this extension supported
917 * due to that, so this code works on fglrx as well. */
918 if(gl_info
->supported
[ARB_TEXTURE_NON_POWER_OF_TWO
])
920 TRACE("GL_ARB_texture_non_power_of_two advertised on R500 or earlier card, removing.\n");
921 gl_info
->supported
[ARB_TEXTURE_NON_POWER_OF_TWO
] = FALSE
;
922 gl_info
->supported
[WINED3D_GL_NORMALIZED_TEXRECT
] = TRUE
;
926 static void quirk_no_np2(struct wined3d_gl_info
*gl_info
)
928 /* The nVidia GeForceFX series reports OpenGL 2.0 capabilities with the latest drivers versions, but
929 * doesn't explicitly advertise the ARB_tex_npot extension in the GL extension string.
930 * This usually means that ARB_tex_npot is supported in hardware as long as the application is staying
931 * within the limits enforced by the ARB_texture_rectangle extension. This however is not true for the
932 * FX series, which instantly falls back to a slower software path as soon as ARB_tex_npot is used.
933 * We therefore completely remove ARB_tex_npot from the list of supported extensions.
935 * Note that wine_normalized_texrect can't be used in this case because internally it uses ARB_tex_npot,
936 * triggering the software fallback. There is not much we can do here apart from disabling the
937 * software-emulated extension and re-enable ARB_tex_rect (which was previously disabled
938 * in wined3d_adapter_init_gl_caps).
939 * This fixup removes performance problems on both the FX 5900 and FX 5700 (e.g. for framebuffer
940 * post-processing effects in the game "Max Payne 2").
941 * The behaviour can be verified through a simple test app attached in bugreport #14724. */
942 TRACE("GL_ARB_texture_non_power_of_two advertised through OpenGL 2.0 on NV FX card, removing.\n");
943 gl_info
->supported
[ARB_TEXTURE_NON_POWER_OF_TWO
] = FALSE
;
944 gl_info
->supported
[ARB_TEXTURE_RECTANGLE
] = TRUE
;
947 static void quirk_texcoord_w(struct wined3d_gl_info
*gl_info
)
949 /* The Intel GPUs on MacOS set the .w register of texcoords to 0.0 by default, which causes problems
950 * with fixed function fragment processing. Ideally this flag should be detected with a test shader
951 * and OpenGL feedback mode, but some GL implementations (MacOS ATI at least, probably all MacOS ones)
952 * do not like vertex shaders in feedback mode and return an error, even though it should be valid
953 * according to the spec.
955 * We don't want to enable this on all cards, as it adds an extra instruction per texcoord used. This
956 * makes the shader slower and eats instruction slots which should be available to the d3d app.
958 * ATI Radeon HD 2xxx cards on MacOS have the issue. Instead of checking for the buggy cards, blacklist
959 * all radeon cards on Macs and whitelist the good ones. That way we're prepared for the future. If
960 * this workaround is activated on cards that do not need it, it won't break things, just affect
961 * performance negatively. */
962 TRACE("Enabling vertex texture coord fixes in vertex shaders.\n");
963 gl_info
->quirks
|= WINED3D_QUIRK_SET_TEXCOORD_W
;
966 static void quirk_clip_varying(struct wined3d_gl_info
*gl_info
)
968 gl_info
->quirks
|= WINED3D_QUIRK_GLSL_CLIP_VARYING
;
971 static void quirk_allows_specular_alpha(struct wined3d_gl_info
*gl_info
)
973 gl_info
->quirks
|= WINED3D_QUIRK_ALLOWS_SPECULAR_ALPHA
;
976 static void quirk_disable_nvvp_clip(struct wined3d_gl_info
*gl_info
)
978 gl_info
->quirks
|= WINED3D_QUIRK_NV_CLIP_BROKEN
;
981 static void quirk_fbo_tex_update(struct wined3d_gl_info
*gl_info
)
983 gl_info
->quirks
|= WINED3D_QUIRK_FBO_TEX_UPDATE
;
986 static void quirk_broken_rgba16(struct wined3d_gl_info
*gl_info
)
988 gl_info
->quirks
|= WINED3D_QUIRK_BROKEN_RGBA16
;
991 static void quirk_infolog_spam(struct wined3d_gl_info
*gl_info
)
993 gl_info
->quirks
|= WINED3D_QUIRK_INFO_LOG_SPAM
;
996 static void quirk_limited_tex_filtering(struct wined3d_gl_info
*gl_info
)
998 /* Nvidia GeForce 6xxx and 7xxx support accelerated VTF only on a few
999 selected texture formats. They are apparently the only DX9 class GPUs
1001 Also, DX9-era GPUs are somewhat limited with float textures
1002 filtering and blending. */
1003 gl_info
->quirks
|= WINED3D_QUIRK_LIMITED_TEX_FILTERING
;
1006 static void quirk_r200_constants(struct wined3d_gl_info
*gl_info
)
1008 /* The Mesa r200 driver (and there is no other driver for this GPU Wine would run on)
1009 * loads some fog parameters (start, end, exponent, but not the color) into the
1012 * Apparently the fog hardware is only able to handle linear fog with a range of 0.0;1.0,
1013 * and it is the responsibility of the vertex pipeline to handle non-linear fog and
1014 * linear fog with start and end other than 0.0 and 1.0. */
1015 TRACE("Reserving 1 ARB constant for compiler private use.\n");
1016 gl_info
->reserved_arb_constants
= max(gl_info
->reserved_arb_constants
, 1);
1019 static void quirk_broken_arb_fog(struct wined3d_gl_info
*gl_info
)
1021 gl_info
->quirks
|= WINED3D_QUIRK_BROKEN_ARB_FOG
;
1026 BOOL (*match
)(const struct wined3d_gl_info
*gl_info
, const char *gl_renderer
,
1027 enum wined3d_gl_vendor gl_vendor
, enum wined3d_pci_vendor card_vendor
, enum wined3d_pci_device device
);
1028 void (*apply
)(struct wined3d_gl_info
*gl_info
);
1029 const char *description
;
1032 static const struct driver_quirk quirk_table
[] =
1035 match_amd_r300_to_500
,
1037 "AMD normalized texrect quirk"
1041 quirk_apple_glsl_constants
,
1042 "Apple GLSL uniform override"
1047 "Geforce 5 NP2 disable"
1052 "Init texcoord .w for Apple Intel GPU driver"
1055 match_apple_nonr500ati
,
1057 "Init texcoord .w for Apple ATI >= r600 GPU driver"
1062 "Reserved varying for gl_ClipPos"
1065 /* GL_EXT_secondary_color does not allow 4 component secondary colors, but most
1066 * GL implementations accept it. The Mac GL is the only implementation known to
1069 * If we can pass 4 component specular colors, do it, because (a) we don't have
1070 * to screw around with the data, and (b) the D3D fixed function vertex pipeline
1071 * passes specular alpha to the pixel shader if any is used. Otherwise the
1072 * specular alpha is used to pass the fog coordinate, which we pass to opengl
1073 * via GL_EXT_fog_coord.
1075 match_allows_spec_alpha
,
1076 quirk_allows_specular_alpha
,
1077 "Allow specular alpha quirk"
1080 match_broken_nv_clip
,
1081 quirk_disable_nvvp_clip
,
1082 "Apple NV_vertex_program clip bug quirk"
1085 match_fbo_tex_update
,
1086 quirk_fbo_tex_update
,
1087 "FBO rebind for attachment updates"
1090 match_broken_rgba16
,
1091 quirk_broken_rgba16
,
1092 "True RGBA16 is not available"
1097 "Not printing GLSL infolog"
1100 match_not_dx10_capable
,
1101 quirk_limited_tex_filtering
,
1102 "Texture filtering, blending and VTF support is limited"
1106 quirk_r200_constants
,
1107 "r200 vertex shader constants"
1110 match_broken_arb_fog
,
1111 quirk_broken_arb_fog
,
1112 "ARBfp fogstart == fogend workaround"
1116 /* Certain applications (Steam) complain if we report an outdated driver version. In general,
1117 * reporting a driver version is moot because we are not the Windows driver, and we have different
1118 * bugs, features, etc.
1120 * The driver version has the form "x.y.z.w".
1122 * "x" is the Windows version the driver is meant for:
1129 * "y" is the maximum Direct3D version the driver supports.
1130 * y -> d3d version mapping:
1139 * "z" is the subversion number.
1141 * "w" is the vendor specific driver build number.
1144 struct driver_version_information
1146 enum wined3d_display_driver driver
;
1147 enum wined3d_driver_model driver_model
;
1148 const char *driver_name
; /* name of Windows driver */
1149 WORD version
; /* version word ('y'), contained in low word of DriverVersion.HighPart */
1150 WORD subversion
; /* subversion word ('z'), contained in high word of DriverVersion.LowPart */
1151 WORD build
; /* build number ('w'), contained in low word of DriverVersion.LowPart */
1154 /* The driver version table contains driver information for different devices on several OS versions. */
1155 static const struct driver_version_information driver_version_table
[] =
1158 * - Radeon HD2x00 (R600) and up supported by current drivers.
1159 * - Radeon 9500 (R300) - X1*00 (R5xx) supported up to Catalyst 9.3 (Linux) and 10.2 (XP/Vista/Win7)
1160 * - Radeon 7xxx (R100) - 9250 (RV250) supported up to Catalyst 6.11 (XP)
1161 * - Rage 128 supported up to XP, latest official build 6.13.3279 dated October 2001 */
1162 {DRIVER_AMD_RAGE_128PRO
, DRIVER_MODEL_NT5X
, "ati2dvaa.dll", 13, 3279, 0},
1163 {DRIVER_AMD_R100
, DRIVER_MODEL_NT5X
, "ati2dvag.dll", 14, 10, 6614},
1164 {DRIVER_AMD_R300
, DRIVER_MODEL_NT5X
, "ati2dvag.dll", 14, 10, 6764},
1165 {DRIVER_AMD_R600
, DRIVER_MODEL_NT5X
, "ati2dvag.dll", 17, 10, 1280},
1166 {DRIVER_AMD_R300
, DRIVER_MODEL_NT6X
, "atiumdag.dll", 14, 10, 741 },
1167 {DRIVER_AMD_R600
, DRIVER_MODEL_NT6X
, "atiumdag.dll", 17, 10, 1280 },
1170 * The drivers are unified but not all versions support all GPUs. At some point the 2k/xp
1171 * drivers used ialmrnt5.dll for GMA800/GMA900 but at some point the file was renamed to
1172 * igxprd32.dll but the GMA800 driver was never updated. */
1173 {DRIVER_INTEL_GMA800
, DRIVER_MODEL_NT5X
, "ialmrnt5.dll", 14, 10, 3889},
1174 {DRIVER_INTEL_GMA900
, DRIVER_MODEL_NT5X
, "igxprd32.dll", 14, 10, 4764},
1175 {DRIVER_INTEL_GMA950
, DRIVER_MODEL_NT5X
, "igxprd32.dll", 14, 10, 4926},
1176 {DRIVER_INTEL_GMA3000
, DRIVER_MODEL_NT5X
, "igxprd32.dll", 14, 10, 5218},
1177 {DRIVER_INTEL_GMA950
, DRIVER_MODEL_NT6X
, "igdumd32.dll", 14, 10, 1504},
1178 {DRIVER_INTEL_GMA3000
, DRIVER_MODEL_NT6X
, "igdumd32.dll", 15, 10, 1666},
1181 * - Geforce8 and newer is supported by the current 340.52 driver on XP-Win8
1182 * - Geforce6 and 7 support is up to 307.83 on XP-Win8
1183 * - GeforceFX support is up to 173.x on <= XP
1184 * - Geforce2MX/3/4 up to 96.x on <= XP
1185 * - TNT/Geforce1/2 up to 71.x on <= XP
1186 * All version numbers used below are from the Linux nvidia drivers. */
1187 {DRIVER_NVIDIA_TNT
, DRIVER_MODEL_NT5X
, "nv4_disp.dll", 14, 10, 7186},
1188 {DRIVER_NVIDIA_GEFORCE2MX
, DRIVER_MODEL_NT5X
, "nv4_disp.dll", 14, 10, 9371},
1189 {DRIVER_NVIDIA_GEFORCEFX
, DRIVER_MODEL_NT5X
, "nv4_disp.dll", 14, 11, 7516},
1190 {DRIVER_NVIDIA_GEFORCE6
, DRIVER_MODEL_NT5X
, "nv4_disp.dll", 18, 13, 783},
1191 {DRIVER_NVIDIA_GEFORCE8
, DRIVER_MODEL_NT5X
, "nv4_disp.dll", 18, 13, 4052},
1192 {DRIVER_NVIDIA_GEFORCE6
, DRIVER_MODEL_NT6X
, "nvd3dum.dll", 18, 13, 783},
1193 {DRIVER_NVIDIA_GEFORCE8
, DRIVER_MODEL_NT6X
, "nvd3dum.dll", 18, 13, 4052},
1196 {DRIVER_VMWARE
, DRIVER_MODEL_NT5X
, "vm3dum.dll", 14, 1, 1134},
1199 struct gpu_description
1201 WORD vendor
; /* reported PCI card vendor ID */
1202 WORD card
; /* reported PCI card device ID */
1203 const char *description
; /* Description of the card e.g. NVIDIA RIVA TNT */
1204 enum wined3d_display_driver driver
;
1205 unsigned int vidmem
;
1208 /* The amount of video memory stored in the gpu description table is the minimum amount of video memory
1209 * found on a board containing a specific GPU. */
1210 static const struct gpu_description gpu_description_table
[] =
1213 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_RIVA_TNT
, "NVIDIA RIVA TNT", DRIVER_NVIDIA_TNT
, 16 },
1214 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_RIVA_TNT2
, "NVIDIA RIVA TNT2/TNT2 Pro", DRIVER_NVIDIA_TNT
, 32 },
1215 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE
, "NVIDIA GeForce 256", DRIVER_NVIDIA_TNT
, 32 },
1216 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE2
, "NVIDIA GeForce2 GTS/GeForce2 Pro", DRIVER_NVIDIA_TNT
, 32 },
1217 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE2_MX
, "NVIDIA GeForce2 MX/MX 400", DRIVER_NVIDIA_GEFORCE2MX
,32 },
1218 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE3
, "NVIDIA GeForce3", DRIVER_NVIDIA_GEFORCE2MX
,64 },
1219 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE4_MX
, "NVIDIA GeForce4 MX 460", DRIVER_NVIDIA_GEFORCE2MX
,64 },
1220 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE4_TI4200
, "NVIDIA GeForce4 Ti 4200", DRIVER_NVIDIA_GEFORCE2MX
,64, },
1221 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCEFX_5200
, "NVIDIA GeForce FX 5200", DRIVER_NVIDIA_GEFORCEFX
, 64 },
1222 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCEFX_5600
, "NVIDIA GeForce FX 5600", DRIVER_NVIDIA_GEFORCEFX
, 128 },
1223 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCEFX_5800
, "NVIDIA GeForce FX 5800", DRIVER_NVIDIA_GEFORCEFX
, 256 },
1224 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_6200
, "NVIDIA GeForce 6200", DRIVER_NVIDIA_GEFORCE6
, 64 },
1225 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_6600GT
, "NVIDIA GeForce 6600 GT", DRIVER_NVIDIA_GEFORCE6
, 128 },
1226 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_6800
, "NVIDIA GeForce 6800", DRIVER_NVIDIA_GEFORCE6
, 128 },
1227 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_7300
, "NVIDIA GeForce Go 7300", DRIVER_NVIDIA_GEFORCE6
, 256 },
1228 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_7400
, "NVIDIA GeForce Go 7400", DRIVER_NVIDIA_GEFORCE6
, 256 },
1229 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_7600
, "NVIDIA GeForce 7600 GT", DRIVER_NVIDIA_GEFORCE6
, 256 },
1230 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_7800GT
, "NVIDIA GeForce 7800 GT", DRIVER_NVIDIA_GEFORCE6
, 256 },
1231 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_8300GS
, "NVIDIA GeForce 8300 GS", DRIVER_NVIDIA_GEFORCE8
, 128 },
1232 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_8400GS
, "NVIDIA GeForce 8400 GS", DRIVER_NVIDIA_GEFORCE8
, 128 },
1233 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_8600GT
, "NVIDIA GeForce 8600 GT", DRIVER_NVIDIA_GEFORCE8
, 256 },
1234 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_8600MGT
, "NVIDIA GeForce 8600M GT", DRIVER_NVIDIA_GEFORCE8
, 512 },
1235 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_8800GTS
, "NVIDIA GeForce 8800 GTS", DRIVER_NVIDIA_GEFORCE8
, 320 },
1236 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_8800GTX
, "NVIDIA GeForce 8800 GTX", DRIVER_NVIDIA_GEFORCE8
, 768 },
1237 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_9200
, "NVIDIA GeForce 9200", DRIVER_NVIDIA_GEFORCE8
, 256 },
1238 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_9300
, "NVIDIA GeForce 9300", DRIVER_NVIDIA_GEFORCE8
, 256 },
1239 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_9400M
, "NVIDIA GeForce 9400M", DRIVER_NVIDIA_GEFORCE8
, 256 },
1240 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_9400GT
, "NVIDIA GeForce 9400 GT", DRIVER_NVIDIA_GEFORCE8
, 256 },
1241 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_9500GT
, "NVIDIA GeForce 9500 GT", DRIVER_NVIDIA_GEFORCE8
, 256 },
1242 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_9600GT
, "NVIDIA GeForce 9600 GT", DRIVER_NVIDIA_GEFORCE8
, 384 },
1243 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_9800GT
, "NVIDIA GeForce 9800 GT", DRIVER_NVIDIA_GEFORCE8
, 512 },
1244 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_210
, "NVIDIA GeForce 210", DRIVER_NVIDIA_GEFORCE8
, 512 },
1245 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT220
, "NVIDIA GeForce GT 220", DRIVER_NVIDIA_GEFORCE8
, 512 },
1246 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT240
, "NVIDIA GeForce GT 240", DRIVER_NVIDIA_GEFORCE8
, 512 },
1247 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX260
, "NVIDIA GeForce GTX 260", DRIVER_NVIDIA_GEFORCE8
, 1024},
1248 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX275
, "NVIDIA GeForce GTX 275", DRIVER_NVIDIA_GEFORCE8
, 896 },
1249 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX280
, "NVIDIA GeForce GTX 280", DRIVER_NVIDIA_GEFORCE8
, 1024},
1250 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_315M
, "NVIDIA GeForce 315M", DRIVER_NVIDIA_GEFORCE8
, 512 },
1251 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_320M
, "NVIDIA GeForce 320M", DRIVER_NVIDIA_GEFORCE8
, 256},
1252 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_410M
, "NVIDIA GeForce 410M", DRIVER_NVIDIA_GEFORCE8
, 512},
1253 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT320M
, "NVIDIA GeForce GT 320M", DRIVER_NVIDIA_GEFORCE8
, 1024},
1254 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT325M
, "NVIDIA GeForce GT 325M", DRIVER_NVIDIA_GEFORCE8
, 1024},
1255 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT330
, "NVIDIA GeForce GT 330", DRIVER_NVIDIA_GEFORCE8
, 1024},
1256 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTS350M
, "NVIDIA GeForce GTS 350M", DRIVER_NVIDIA_GEFORCE8
, 1024},
1257 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT420
, "NVIDIA GeForce GT 420", DRIVER_NVIDIA_GEFORCE8
, 2048},
1258 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT430
, "NVIDIA GeForce GT 430", DRIVER_NVIDIA_GEFORCE8
, 1024},
1259 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT440
, "NVIDIA GeForce GT 440", DRIVER_NVIDIA_GEFORCE8
, 1024},
1260 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTS450
, "NVIDIA GeForce GTS 450", DRIVER_NVIDIA_GEFORCE8
, 1024},
1261 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX460
, "NVIDIA GeForce GTX 460", DRIVER_NVIDIA_GEFORCE8
, 768 },
1262 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX460M
, "NVIDIA GeForce GTX 460M", DRIVER_NVIDIA_GEFORCE8
, 1536},
1263 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX465
, "NVIDIA GeForce GTX 465", DRIVER_NVIDIA_GEFORCE8
, 1024},
1264 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX470
, "NVIDIA GeForce GTX 470", DRIVER_NVIDIA_GEFORCE8
, 1280},
1265 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX480
, "NVIDIA GeForce GTX 480", DRIVER_NVIDIA_GEFORCE8
, 1536},
1266 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT520
, "NVIDIA GeForce GT 520", DRIVER_NVIDIA_GEFORCE8
, 1024},
1267 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT540M
, "NVIDIA GeForce GT 540M", DRIVER_NVIDIA_GEFORCE8
, 1024},
1268 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX550
, "NVIDIA GeForce GTX 550 Ti", DRIVER_NVIDIA_GEFORCE8
, 1024},
1269 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT555M
, "NVIDIA GeForce GT 555M", DRIVER_NVIDIA_GEFORCE8
, 1024},
1270 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX560TI
, "NVIDIA GeForce GTX 560 Ti", DRIVER_NVIDIA_GEFORCE8
, 1024},
1271 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX560
, "NVIDIA GeForce GTX 560", DRIVER_NVIDIA_GEFORCE8
, 1024},
1272 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX570
, "NVIDIA GeForce GTX 570", DRIVER_NVIDIA_GEFORCE8
, 1280},
1273 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX580
, "NVIDIA GeForce GTX 580", DRIVER_NVIDIA_GEFORCE8
, 1536},
1274 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT610
, "NVIDIA GeForce GT 610", DRIVER_NVIDIA_GEFORCE8
, 1024},
1275 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT630
, "NVIDIA GeForce GT 630", DRIVER_NVIDIA_GEFORCE8
, 1024},
1276 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT630M
, "NVIDIA GeForce GT 630M", DRIVER_NVIDIA_GEFORCE8
, 1024},
1277 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT640M
, "NVIDIA GeForce GT 640M", DRIVER_NVIDIA_GEFORCE8
, 1024},
1278 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT650M
, "NVIDIA GeForce GT 650M", DRIVER_NVIDIA_GEFORCE8
, 2048},
1279 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX650
, "NVIDIA GeForce GTX 650", DRIVER_NVIDIA_GEFORCE8
, 1024},
1280 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX650TI
, "NVIDIA GeForce GTX 650 Ti", DRIVER_NVIDIA_GEFORCE8
, 1024},
1281 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX660
, "NVIDIA GeForce GTX 660", DRIVER_NVIDIA_GEFORCE8
, 2048},
1282 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX660M
, "NVIDIA GeForce GTX 660M", DRIVER_NVIDIA_GEFORCE8
, 2048},
1283 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX660TI
, "NVIDIA GeForce GTX 660 Ti", DRIVER_NVIDIA_GEFORCE8
, 2048},
1284 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX670
, "NVIDIA GeForce GTX 670", DRIVER_NVIDIA_GEFORCE8
, 2048},
1285 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX670MX
, "NVIDIA GeForce GTX 670MX", DRIVER_NVIDIA_GEFORCE8
, 3072},
1286 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX680
, "NVIDIA GeForce GTX 680", DRIVER_NVIDIA_GEFORCE8
, 2048},
1287 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GT750M
, "NVIDIA GeForce GT 750M", DRIVER_NVIDIA_GEFORCE8
, 1024},
1288 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX750
, "NVIDIA GeForce GTX 750", DRIVER_NVIDIA_GEFORCE8
, 1024},
1289 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX750TI
, "NVIDIA GeForce GTX 750 Ti", DRIVER_NVIDIA_GEFORCE8
, 2048},
1290 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX760
, "NVIDIA Geforce GTX 760", DRIVER_NVIDIA_GEFORCE8
, 2048},
1291 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX765M
, "NVIDIA GeForce GTX 765M", DRIVER_NVIDIA_GEFORCE8
, 2048},
1292 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX770M
, "NVIDIA GeForce GTX 770M", DRIVER_NVIDIA_GEFORCE8
, 3072},
1293 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX770
, "NVIDIA GeForce GTX 770", DRIVER_NVIDIA_GEFORCE8
, 2048},
1294 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX780
, "NVIDIA GeForce GTX 780", DRIVER_NVIDIA_GEFORCE8
, 3072},
1295 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX780TI
, "NVIDIA GeForce GTX 780 Ti", DRIVER_NVIDIA_GEFORCE8
, 3072},
1296 {HW_VENDOR_NVIDIA
, CARD_NVIDIA_GEFORCE_GTX970
, "NVIDIA GeForce GTX 970", DRIVER_NVIDIA_GEFORCE8
, 4096},
1299 {HW_VENDOR_AMD
, CARD_AMD_RAGE_128PRO
, "ATI Rage Fury", DRIVER_AMD_RAGE_128PRO
, 16 },
1300 {HW_VENDOR_AMD
, CARD_AMD_RADEON_7200
, "ATI RADEON 7200 SERIES", DRIVER_AMD_R100
, 32 },
1301 {HW_VENDOR_AMD
, CARD_AMD_RADEON_8500
, "ATI RADEON 8500 SERIES", DRIVER_AMD_R100
, 64 },
1302 {HW_VENDOR_AMD
, CARD_AMD_RADEON_9500
, "ATI Radeon 9500", DRIVER_AMD_R300
, 64 },
1303 {HW_VENDOR_AMD
, CARD_AMD_RADEON_XPRESS_200M
, "ATI RADEON XPRESS 200M Series", DRIVER_AMD_R300
, 64 },
1304 {HW_VENDOR_AMD
, CARD_AMD_RADEON_X700
, "ATI Radeon X700 SE", DRIVER_AMD_R300
, 128 },
1305 {HW_VENDOR_AMD
, CARD_AMD_RADEON_X1600
, "ATI Radeon X1600 Series", DRIVER_AMD_R300
, 128 },
1306 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD2350
, "ATI Mobility Radeon HD 2350", DRIVER_AMD_R600
, 256 },
1307 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD2600
, "ATI Mobility Radeon HD 2600", DRIVER_AMD_R600
, 256 },
1308 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD2900
, "ATI Radeon HD 2900 XT", DRIVER_AMD_R600
, 512 },
1309 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD3200
, "ATI Radeon HD 3200 Graphics", DRIVER_AMD_R600
, 128 },
1310 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD4200M
, "ATI Mobility Radeon HD 4200", DRIVER_AMD_R600
, 256 },
1311 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD4350
, "ATI Radeon HD 4350", DRIVER_AMD_R600
, 256 },
1312 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD4600
, "ATI Radeon HD 4600 Series", DRIVER_AMD_R600
, 512 },
1313 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD4700
, "ATI Radeon HD 4700 Series", DRIVER_AMD_R600
, 512 },
1314 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD4800
, "ATI Radeon HD 4800 Series", DRIVER_AMD_R600
, 512 },
1315 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD5400
, "ATI Radeon HD 5400 Series", DRIVER_AMD_R600
, 512 },
1316 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD5600
, "ATI Radeon HD 5600 Series", DRIVER_AMD_R600
, 512 },
1317 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD5700
, "ATI Radeon HD 5700 Series", DRIVER_AMD_R600
, 512 },
1318 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD5800
, "ATI Radeon HD 5800 Series", DRIVER_AMD_R600
, 1024},
1319 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD5900
, "ATI Radeon HD 5900 Series", DRIVER_AMD_R600
, 1024},
1320 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD6300
, "AMD Radeon HD 6300 series Graphics", DRIVER_AMD_R600
, 1024},
1321 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD6400
, "AMD Radeon HD 6400 Series", DRIVER_AMD_R600
, 1024},
1322 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD6410D
, "AMD Radeon HD 6410D", DRIVER_AMD_R600
, 1024},
1323 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD6550D
, "AMD Radeon HD 6550D", DRIVER_AMD_R600
, 1024},
1324 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD6600
, "AMD Radeon HD 6600 Series", DRIVER_AMD_R600
, 1024},
1325 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD6600M
, "AMD Radeon HD 6600M Series", DRIVER_AMD_R600
, 512 },
1326 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD6700
, "AMD Radeon HD 6700 Series", DRIVER_AMD_R600
, 1024},
1327 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD6800
, "AMD Radeon HD 6800 Series", DRIVER_AMD_R600
, 1024},
1328 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD6900
, "AMD Radeon HD 6900 Series", DRIVER_AMD_R600
, 2048},
1329 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD7660D
, "AMD Radeon HD 7660D", DRIVER_AMD_R600
, 2048},
1330 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD7700
, "AMD Radeon HD 7700 Series", DRIVER_AMD_R600
, 1024},
1331 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD7800
, "AMD Radeon HD 7800 Series", DRIVER_AMD_R600
, 2048},
1332 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD7900
, "AMD Radeon HD 7900 Series", DRIVER_AMD_R600
, 2048},
1333 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD8600M
, "AMD Radeon HD 8600M Series", DRIVER_AMD_R600
, 1024},
1334 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD8670
, "AMD Radeon HD 8670", DRIVER_AMD_R600
, 2048},
1335 {HW_VENDOR_AMD
, CARD_AMD_RADEON_HD8770
, "AMD Radeon HD 8770", DRIVER_AMD_R600
, 2048},
1336 {HW_VENDOR_AMD
, CARD_AMD_RADEON_R3
, "AMD Radeon HD 8400 / R3 Series", DRIVER_AMD_R600
, 2048},
1337 {HW_VENDOR_AMD
, CARD_AMD_RADEON_R7
, "AMD Radeon(TM) R7 Graphics", DRIVER_AMD_R600
, 2048},
1338 {HW_VENDOR_AMD
, CARD_AMD_RADEON_R9
, "AMD Radeon R9 290", DRIVER_AMD_R600
, 4096},
1341 {HW_VENDOR_VMWARE
, CARD_VMWARE_SVGA3D
, "VMware SVGA 3D (Microsoft Corporation - WDDM)", DRIVER_VMWARE
, 1024},
1344 {HW_VENDOR_INTEL
, CARD_INTEL_830M
, "Intel(R) 82830M Graphics Controller", DRIVER_INTEL_GMA800
, 32 },
1345 {HW_VENDOR_INTEL
, CARD_INTEL_855GM
, "Intel(R) 82852/82855 GM/GME Graphics Controller", DRIVER_INTEL_GMA800
, 32 },
1346 {HW_VENDOR_INTEL
, CARD_INTEL_845G
, "Intel(R) 845G", DRIVER_INTEL_GMA800
, 32 },
1347 {HW_VENDOR_INTEL
, CARD_INTEL_865G
, "Intel(R) 82865G Graphics Controller", DRIVER_INTEL_GMA800
, 32 },
1348 {HW_VENDOR_INTEL
, CARD_INTEL_915G
, "Intel(R) 82915G/GV/910GL Express Chipset Family", DRIVER_INTEL_GMA900
, 64 },
1349 {HW_VENDOR_INTEL
, CARD_INTEL_E7221G
, "Intel(R) E7221G", DRIVER_INTEL_GMA900
, 64 },
1350 {HW_VENDOR_INTEL
, CARD_INTEL_915GM
, "Mobile Intel(R) 915GM/GMS,910GML Express Chipset Family", DRIVER_INTEL_GMA900
, 64 },
1351 {HW_VENDOR_INTEL
, CARD_INTEL_945G
, "Intel(R) 945G", DRIVER_INTEL_GMA950
, 64 },
1352 {HW_VENDOR_INTEL
, CARD_INTEL_945GM
, "Mobile Intel(R) 945GM Express Chipset Family", DRIVER_INTEL_GMA950
, 64 },
1353 {HW_VENDOR_INTEL
, CARD_INTEL_945GME
, "Intel(R) 945GME", DRIVER_INTEL_GMA950
, 64 },
1354 {HW_VENDOR_INTEL
, CARD_INTEL_Q35
, "Intel(R) Q35", DRIVER_INTEL_GMA950
, 64 },
1355 {HW_VENDOR_INTEL
, CARD_INTEL_G33
, "Intel(R) G33", DRIVER_INTEL_GMA950
, 64 },
1356 {HW_VENDOR_INTEL
, CARD_INTEL_Q33
, "Intel(R) Q33", DRIVER_INTEL_GMA950
, 64 },
1357 {HW_VENDOR_INTEL
, CARD_INTEL_PNVG
, "Intel(R) IGD", DRIVER_INTEL_GMA950
, 64 },
1358 {HW_VENDOR_INTEL
, CARD_INTEL_PNVM
, "Intel(R) IGD", DRIVER_INTEL_GMA950
, 64 },
1359 {HW_VENDOR_INTEL
, CARD_INTEL_965Q
, "Intel(R) 965Q", DRIVER_INTEL_GMA3000
, 128},
1360 {HW_VENDOR_INTEL
, CARD_INTEL_965G
, "Intel(R) 965G", DRIVER_INTEL_GMA3000
, 128},
1361 {HW_VENDOR_INTEL
, CARD_INTEL_946GZ
, "Intel(R) 946GZ", DRIVER_INTEL_GMA3000
, 128},
1362 {HW_VENDOR_INTEL
, CARD_INTEL_965GM
, "Mobile Intel(R) 965 Express Chipset Family", DRIVER_INTEL_GMA3000
, 128},
1363 {HW_VENDOR_INTEL
, CARD_INTEL_965GME
, "Intel(R) 965GME", DRIVER_INTEL_GMA3000
, 128},
1364 {HW_VENDOR_INTEL
, CARD_INTEL_GM45
, "Mobile Intel(R) GM45 Express Chipset Family", DRIVER_INTEL_GMA3000
, 512},
1365 {HW_VENDOR_INTEL
, CARD_INTEL_IGD
, "Intel(R) Integrated Graphics Device", DRIVER_INTEL_GMA3000
, 512},
1366 {HW_VENDOR_INTEL
, CARD_INTEL_G45
, "Intel(R) G45/G43", DRIVER_INTEL_GMA3000
, 512},
1367 {HW_VENDOR_INTEL
, CARD_INTEL_Q45
, "Intel(R) Q45/Q43", DRIVER_INTEL_GMA3000
, 512},
1368 {HW_VENDOR_INTEL
, CARD_INTEL_G41
, "Intel(R) G41", DRIVER_INTEL_GMA3000
, 512},
1369 {HW_VENDOR_INTEL
, CARD_INTEL_B43
, "Intel(R) B43", DRIVER_INTEL_GMA3000
, 512},
1370 {HW_VENDOR_INTEL
, CARD_INTEL_ILKD
, "Intel(R) Ironlake Desktop", DRIVER_INTEL_GMA3000
, 1024},
1371 {HW_VENDOR_INTEL
, CARD_INTEL_ILKM
, "Intel(R) Ironlake Mobile", DRIVER_INTEL_GMA3000
, 1024},
1372 {HW_VENDOR_INTEL
, CARD_INTEL_SNBD
, "Intel(R) Sandybridge Desktop", DRIVER_INTEL_GMA3000
, 1024},
1373 {HW_VENDOR_INTEL
, CARD_INTEL_SNBM
, "Intel(R) Sandybridge Mobile", DRIVER_INTEL_GMA3000
, 1024},
1374 {HW_VENDOR_INTEL
, CARD_INTEL_SNBS
, "Intel(R) Sandybridge Server", DRIVER_INTEL_GMA3000
, 1024},
1375 {HW_VENDOR_INTEL
, CARD_INTEL_IVBD
, "Intel(R) Ivybridge Desktop", DRIVER_INTEL_GMA3000
, 1024},
1376 {HW_VENDOR_INTEL
, CARD_INTEL_IVBM
, "Intel(R) Ivybridge Mobile", DRIVER_INTEL_GMA3000
, 1024},
1377 {HW_VENDOR_INTEL
, CARD_INTEL_IVBS
, "Intel(R) Ivybridge Server", DRIVER_INTEL_GMA3000
, 1024},
1378 {HW_VENDOR_INTEL
, CARD_INTEL_HWM
, "Intel(R) Haswell Mobile", DRIVER_INTEL_GMA3000
, 1024},
1381 static const struct driver_version_information
*get_driver_version_info(enum wined3d_display_driver driver
,
1382 enum wined3d_driver_model driver_model
)
1386 TRACE("Looking up version info for driver=%d driver_model=%d\n", driver
, driver_model
);
1387 for (i
= 0; i
< (sizeof(driver_version_table
) / sizeof(driver_version_table
[0])); i
++)
1389 const struct driver_version_information
*entry
= &driver_version_table
[i
];
1391 if (entry
->driver
== driver
&& entry
->driver_model
== driver_model
)
1393 TRACE("Found driver \"%s\", version %u, subversion %u, build %u.\n",
1394 entry
->driver_name
, entry
->version
, entry
->subversion
, entry
->build
);
1401 static const struct gpu_description
*get_gpu_description(enum wined3d_pci_vendor vendor
,
1402 enum wined3d_pci_device device
)
1406 for (i
= 0; i
< (sizeof(gpu_description_table
) / sizeof(*gpu_description_table
)); ++i
)
1408 if (vendor
== gpu_description_table
[i
].vendor
&& device
== gpu_description_table
[i
].card
)
1409 return &gpu_description_table
[i
];
1415 static void init_driver_info(struct wined3d_driver_info
*driver_info
,
1416 enum wined3d_pci_vendor vendor
, enum wined3d_pci_device device
)
1418 OSVERSIONINFOW os_version
;
1419 WORD driver_os_version
;
1420 enum wined3d_display_driver driver
;
1421 enum wined3d_driver_model driver_model
;
1422 const struct driver_version_information
*version_info
;
1423 const struct gpu_description
*gpu_desc
;
1425 if (driver_info
->vendor
!= PCI_VENDOR_NONE
|| driver_info
->device
!= PCI_DEVICE_NONE
)
1427 static unsigned int once
;
1429 TRACE("GPU override %04x:%04x.\n", wined3d_settings
.pci_vendor_id
, wined3d_settings
.pci_device_id
);
1431 driver_info
->vendor
= wined3d_settings
.pci_vendor_id
;
1432 if (driver_info
->vendor
== PCI_VENDOR_NONE
)
1433 driver_info
->vendor
= vendor
;
1435 driver_info
->device
= wined3d_settings
.pci_device_id
;
1436 if (driver_info
->device
== PCI_DEVICE_NONE
)
1437 driver_info
->device
= device
;
1439 if (get_gpu_description(driver_info
->vendor
, driver_info
->device
))
1441 vendor
= driver_info
->vendor
;
1442 device
= driver_info
->device
;
1445 ERR_(winediag
)("Invalid GPU override %04x:%04x specified, ignoring.\n",
1446 driver_info
->vendor
, driver_info
->device
);
1449 driver_info
->vendor
= vendor
;
1450 driver_info
->device
= device
;
1452 memset(&os_version
, 0, sizeof(os_version
));
1453 os_version
.dwOSVersionInfoSize
= sizeof(os_version
);
1454 if (!GetVersionExW(&os_version
))
1456 ERR("Failed to get OS version, reporting 2000/XP.\n");
1457 driver_os_version
= 6;
1458 driver_model
= DRIVER_MODEL_NT5X
;
1462 TRACE("OS version %u.%u.\n", os_version
.dwMajorVersion
, os_version
.dwMinorVersion
);
1463 switch (os_version
.dwMajorVersion
)
1466 /* If needed we could distinguish between 9x and NT4, but this code won't make
1467 * sense for NT4 since it had no way to obtain this info through DirectDraw 3.0.
1469 driver_os_version
= 4;
1470 driver_model
= DRIVER_MODEL_WIN9X
;
1474 driver_os_version
= 6;
1475 driver_model
= DRIVER_MODEL_NT5X
;
1479 if (os_version
.dwMinorVersion
== 0)
1481 driver_os_version
= 7;
1482 driver_model
= DRIVER_MODEL_NT6X
;
1484 else if (os_version
.dwMinorVersion
== 1)
1486 driver_os_version
= 8;
1487 driver_model
= DRIVER_MODEL_NT6X
;
1491 if (os_version
.dwMinorVersion
> 2)
1493 FIXME("Unhandled OS version %u.%u, reporting Win 8.\n",
1494 os_version
.dwMajorVersion
, os_version
.dwMinorVersion
);
1496 driver_os_version
= 9;
1497 driver_model
= DRIVER_MODEL_NT6X
;
1502 FIXME("Unhandled OS version %u.%u, reporting 2000/XP.\n",
1503 os_version
.dwMajorVersion
, os_version
.dwMinorVersion
);
1504 driver_os_version
= 6;
1505 driver_model
= DRIVER_MODEL_NT5X
;
1510 if ((gpu_desc
= get_gpu_description(driver_info
->vendor
, driver_info
->device
)))
1512 driver_info
->description
= gpu_desc
->description
;
1513 driver_info
->vram_bytes
= (UINT64
)gpu_desc
->vidmem
* 1024 * 1024;
1514 driver
= gpu_desc
->driver
;
1518 ERR("Card %04x:%04x not found in driver DB.\n", vendor
, device
);
1519 driver_info
->description
= "Direct3D HAL";
1520 driver_info
->vram_bytes
= WINE_DEFAULT_VIDMEM
;
1521 driver
= DRIVER_UNKNOWN
;
1524 if (wined3d_settings
.emulated_textureram
)
1526 TRACE("Overriding amount of video memory with 0x%s bytes.\n",
1527 wine_dbgstr_longlong(wined3d_settings
.emulated_textureram
));
1528 driver_info
->vram_bytes
= wined3d_settings
.emulated_textureram
;
1531 /* Try to obtain driver version information for the current Windows version. This fails in
1533 * - the gpu is not available on the currently selected OS version:
1534 * - Geforce GTX480 on Win98. When running applications in compatibility mode on Windows,
1535 * version information for the current Windows version is returned instead of faked info.
1536 * We do the same and assume the default Windows version to emulate is WinXP.
1538 * - Videocard is a Riva TNT but winver is set to win7 (there are no drivers for this beast)
1539 * For now return the XP driver info. Perhaps later on we should return VESA.
1541 * - the gpu is not in our database (can happen when the user overrides the vendor_id / device_id)
1542 * This could be an indication that our database is not up to date, so this should be fixed.
1544 if ((version_info
= get_driver_version_info(driver
, driver_model
))
1545 || (version_info
= get_driver_version_info(driver
, DRIVER_MODEL_NT5X
)))
1547 driver_info
->name
= version_info
->driver_name
;
1548 driver_info
->version_high
= MAKEDWORD_VERSION(driver_os_version
, version_info
->version
);
1549 driver_info
->version_low
= MAKEDWORD_VERSION(version_info
->subversion
, version_info
->build
);
1553 ERR("No driver version info found for device %04x:%04x, driver model %#x.\n",
1554 vendor
, device
, driver_model
);
1555 driver_info
->name
= "Display";
1556 driver_info
->version_high
= MAKEDWORD_VERSION(driver_os_version
, 15);
1557 driver_info
->version_low
= MAKEDWORD_VERSION(8, 6); /* Nvidia RIVA TNT, arbitrary */
1560 TRACE("Reporting (fake) driver version 0x%08x-0x%08x.\n",
1561 driver_info
->version_high
, driver_info
->version_low
);
1564 /* Context activation is done by the caller. */
1565 static void fixup_extensions(struct wined3d_gl_info
*gl_info
, const char *gl_renderer
,
1566 enum wined3d_gl_vendor gl_vendor
, enum wined3d_pci_vendor card_vendor
, enum wined3d_pci_device device
)
1570 for (i
= 0; i
< (sizeof(quirk_table
) / sizeof(*quirk_table
)); ++i
)
1572 if (!quirk_table
[i
].match(gl_info
, gl_renderer
, gl_vendor
, card_vendor
, device
)) continue;
1573 TRACE("Applying driver quirk \"%s\".\n", quirk_table
[i
].description
);
1574 quirk_table
[i
].apply(gl_info
);
1577 /* Find out if PBOs work as they are supposed to. */
1578 test_pbo_functionality(gl_info
);
1581 static DWORD
wined3d_parse_gl_version(const char *gl_version
)
1583 const char *ptr
= gl_version
;
1588 ERR("Invalid OpenGL major version %d.\n", major
);
1590 while (isdigit(*ptr
)) ++ptr
;
1592 ERR("Invalid OpenGL version string %s.\n", debugstr_a(gl_version
));
1596 TRACE("Found OpenGL version %d.%d.\n", major
, minor
);
1598 return MAKEDWORD_VERSION(major
, minor
);
1601 static enum wined3d_gl_vendor
wined3d_guess_gl_vendor(const struct wined3d_gl_info
*gl_info
,
1602 const char *gl_vendor_string
, const char *gl_renderer
)
1605 /* MacOS has various specialities in the extensions it advertises. Some have to be loaded from
1606 * the opengl 1.2+ core, while other extensions are advertised, but software emulated. So try to
1607 * detect the Apple OpenGL implementation to apply some extension fixups afterwards.
1609 * Detecting this isn't really easy. The vendor string doesn't mention Apple. Compile-time checks
1610 * aren't sufficient either because a Linux binary may display on a macos X server via remote X11.
1611 * So try to detect the GL implementation by looking at certain Apple extensions. Some extensions
1612 * like client storage might be supported on other implementations too, but GL_APPLE_flush_render
1613 * is specific to the Mac OS X window management, and GL_APPLE_ycbcr_422 is QuickTime specific. So
1614 * the chance that other implementations support them is rather small since Win32 QuickTime uses
1615 * DirectDraw, not OpenGL. */
1616 if (gl_info
->supported
[APPLE_FENCE
]
1617 && gl_info
->supported
[APPLE_CLIENT_STORAGE
]
1618 && gl_info
->supported
[APPLE_YCBCR_422
])
1619 return GL_VENDOR_APPLE
;
1621 if (strstr(gl_vendor_string
, "NVIDIA"))
1622 return GL_VENDOR_NVIDIA
;
1624 if (strstr(gl_vendor_string
, "ATI"))
1625 return GL_VENDOR_FGLRX
;
1627 if (strstr(gl_vendor_string
, "Mesa")
1628 || strstr(gl_vendor_string
, "X.Org")
1629 || strstr(gl_vendor_string
, "Advanced Micro Devices, Inc.")
1630 || strstr(gl_vendor_string
, "DRI R300 Project")
1631 || strstr(gl_vendor_string
, "Tungsten Graphics, Inc")
1632 || strstr(gl_vendor_string
, "VMware, Inc.")
1633 || strstr(gl_vendor_string
, "Intel")
1634 || strstr(gl_renderer
, "Mesa")
1635 || strstr(gl_renderer
, "Gallium")
1636 || strstr(gl_renderer
, "Intel"))
1637 return GL_VENDOR_MESA
;
1639 FIXME("Received unrecognized GL_VENDOR %s. Returning GL_VENDOR_UNKNOWN.\n",
1640 debugstr_a(gl_vendor_string
));
1642 return GL_VENDOR_UNKNOWN
;
1645 static enum wined3d_pci_vendor
wined3d_guess_card_vendor(const char *gl_vendor_string
, const char *gl_renderer
)
1647 if (strstr(gl_vendor_string
, "NVIDIA")
1648 || strstr(gl_vendor_string
, "Nouveau")
1649 || strstr(gl_vendor_string
, "nouveau"))
1650 return HW_VENDOR_NVIDIA
;
1652 if (strstr(gl_vendor_string
, "ATI")
1653 || strstr(gl_vendor_string
, "Advanced Micro Devices, Inc.")
1654 || strstr(gl_vendor_string
, "X.Org R300 Project")
1655 || strstr(gl_renderer
, "AMD")
1656 || strstr(gl_renderer
, "R100")
1657 || strstr(gl_renderer
, "R200")
1658 || strstr(gl_renderer
, "R300")
1659 || strstr(gl_renderer
, "R600")
1660 || strstr(gl_renderer
, "R700"))
1661 return HW_VENDOR_AMD
;
1663 if (strstr(gl_vendor_string
, "Intel(R)")
1664 /* Intel switched from Intel(R) to Intel® recently, so just match Intel. */
1665 || strstr(gl_renderer
, "Intel")
1666 || strstr(gl_renderer
, "i915")
1667 || strstr(gl_vendor_string
, "Intel Inc."))
1668 return HW_VENDOR_INTEL
;
1670 if (strstr(gl_renderer
, "SVGA3D"))
1671 return HW_VENDOR_VMWARE
;
1673 if (strstr(gl_vendor_string
, "Mesa")
1674 || strstr(gl_vendor_string
, "Brian Paul")
1675 || strstr(gl_vendor_string
, "Tungsten Graphics, Inc")
1676 || strstr(gl_vendor_string
, "VMware, Inc."))
1677 return HW_VENDOR_SOFTWARE
;
1679 FIXME("Received unrecognized GL_VENDOR %s. Returning HW_VENDOR_NVIDIA.\n", debugstr_a(gl_vendor_string
));
1681 return HW_VENDOR_NVIDIA
;
1684 static enum wined3d_d3d_level
d3d_level_from_caps(const struct shader_caps
*shader_caps
, const struct fragment_caps
*fragment_caps
, DWORD glsl_version
)
1686 if (shader_caps
->vs_version
>= 5)
1687 return WINED3D_D3D_LEVEL_11
;
1688 if (shader_caps
->vs_version
== 4)
1690 /* No backed supports SM 5 at the moment */
1691 if (glsl_version
>= MAKEDWORD_VERSION(4, 00))
1692 return WINED3D_D3D_LEVEL_11
;
1693 return WINED3D_D3D_LEVEL_10
;
1695 if (shader_caps
->vs_version
== 3)
1697 /* Wine cannot use SM 4 on mesa drivers as the necessary functionality
1698 * is not exposed on compatibility contexts */
1699 if (glsl_version
>= MAKEDWORD_VERSION(1, 30))
1700 return WINED3D_D3D_LEVEL_10
;
1701 return WINED3D_D3D_LEVEL_9_SM3
;
1703 if (shader_caps
->vs_version
== 2)
1704 return WINED3D_D3D_LEVEL_9_SM2
;
1705 if (shader_caps
->vs_version
== 1)
1706 return WINED3D_D3D_LEVEL_8
;
1708 if (fragment_caps
->TextureOpCaps
& WINED3DTEXOPCAPS_DOTPRODUCT3
)
1709 return WINED3D_D3D_LEVEL_7
;
1710 if (fragment_caps
->MaxSimultaneousTextures
> 1)
1711 return WINED3D_D3D_LEVEL_6
;
1713 return WINED3D_D3D_LEVEL_5
;
1716 static const struct wined3d_renderer_table
1718 const char *renderer
;
1719 enum wined3d_pci_device id
;
1721 cards_nvidia_binary
[] =
1724 {"GTX 970", CARD_NVIDIA_GEFORCE_GTX970
}, /* GeForce 900 - highend */
1725 {"GTX 780 Ti", CARD_NVIDIA_GEFORCE_GTX780TI
}, /* Geforce 700 - highend */
1726 {"GTX 780", CARD_NVIDIA_GEFORCE_GTX780
}, /* Geforce 700 - highend */
1727 {"GTX 770M", CARD_NVIDIA_GEFORCE_GTX770M
}, /* Geforce 700 - midend high mobile */
1728 {"GTX 770", CARD_NVIDIA_GEFORCE_GTX770
}, /* Geforce 700 - highend */
1729 {"GTX 765M", CARD_NVIDIA_GEFORCE_GTX765M
}, /* Geforce 700 - midend high mobile */
1730 {"GTX 760", CARD_NVIDIA_GEFORCE_GTX760
}, /* Geforce 700 - midend high */
1731 {"GTX 750 Ti", CARD_NVIDIA_GEFORCE_GTX750TI
}, /* Geforce 700 - midend */
1732 {"GTX 750", CARD_NVIDIA_GEFORCE_GTX750
}, /* Geforce 700 - midend */
1733 {"GT 750M", CARD_NVIDIA_GEFORCE_GT750M
}, /* Geforce 700 - midend mobile */
1734 {"GTX 680", CARD_NVIDIA_GEFORCE_GTX680
}, /* Geforce 600 - highend */
1735 {"GTX 670MX", CARD_NVIDIA_GEFORCE_GTX670MX
}, /* Geforce 600 - highend */
1736 {"GTX 670", CARD_NVIDIA_GEFORCE_GTX670
}, /* Geforce 600 - midend high */
1737 {"GTX 660 Ti", CARD_NVIDIA_GEFORCE_GTX660TI
}, /* Geforce 600 - midend high */
1738 {"GTX 660M", CARD_NVIDIA_GEFORCE_GTX660M
}, /* Geforce 600 - midend high mobile */
1739 {"GTX 660", CARD_NVIDIA_GEFORCE_GTX660
}, /* Geforce 600 - midend high */
1740 {"GTX 650 Ti", CARD_NVIDIA_GEFORCE_GTX650TI
}, /* Geforce 600 - lowend */
1741 {"GTX 650", CARD_NVIDIA_GEFORCE_GTX650
}, /* Geforce 600 - lowend */
1742 {"GT 650M", CARD_NVIDIA_GEFORCE_GT650M
}, /* Geforce 600 - midend mobile */
1743 {"GT 640M", CARD_NVIDIA_GEFORCE_GT640M
}, /* Geforce 600 - midend mobile */
1744 {"GT 630M", CARD_NVIDIA_GEFORCE_GT630M
}, /* Geforce 600 - midend mobile */
1745 {"GT 630", CARD_NVIDIA_GEFORCE_GT630
}, /* Geforce 600 - lowend */
1746 {"GT 610", CARD_NVIDIA_GEFORCE_GT610
}, /* Geforce 600 - lowend */
1747 {"GTX 580", CARD_NVIDIA_GEFORCE_GTX580
}, /* Geforce 500 - highend */
1748 {"GTX 570", CARD_NVIDIA_GEFORCE_GTX570
}, /* Geforce 500 - midend high */
1749 {"GTX 560 Ti", CARD_NVIDIA_GEFORCE_GTX560TI
}, /* Geforce 500 - midend */
1750 {"GTX 560", CARD_NVIDIA_GEFORCE_GTX560
}, /* Geforce 500 - midend */
1751 {"GT 555M", CARD_NVIDIA_GEFORCE_GT555M
}, /* Geforce 500 - midend mobile */
1752 {"GTX 550 Ti", CARD_NVIDIA_GEFORCE_GTX550
}, /* Geforce 500 - midend */
1753 {"GT 540M", CARD_NVIDIA_GEFORCE_GT540M
}, /* Geforce 500 - midend mobile */
1754 {"GT 520", CARD_NVIDIA_GEFORCE_GT520
}, /* Geforce 500 - lowend */
1755 {"GTX 480", CARD_NVIDIA_GEFORCE_GTX480
}, /* Geforce 400 - highend */
1756 {"GTX 470", CARD_NVIDIA_GEFORCE_GTX470
}, /* Geforce 400 - midend high */
1758 {"GTX 465", CARD_NVIDIA_GEFORCE_GTX465
}, /* Geforce 400 - midend */
1759 {"GTX 460M", CARD_NVIDIA_GEFORCE_GTX460M
}, /* Geforce 400 - highend mobile */
1760 {"GTX 460", CARD_NVIDIA_GEFORCE_GTX460
}, /* Geforce 400 - midend */
1761 {"GTS 450", CARD_NVIDIA_GEFORCE_GTS450
}, /* Geforce 400 - midend low */
1762 {"GT 440", CARD_NVIDIA_GEFORCE_GT440
}, /* Geforce 400 - lowend */
1763 {"GT 430", CARD_NVIDIA_GEFORCE_GT430
}, /* Geforce 400 - lowend */
1764 {"GT 420", CARD_NVIDIA_GEFORCE_GT420
}, /* Geforce 400 - lowend */
1765 {"410M", CARD_NVIDIA_GEFORCE_410M
}, /* Geforce 400 - lowend mobile */
1766 {"GT 330", CARD_NVIDIA_GEFORCE_GT330
}, /* Geforce 300 - highend */
1767 {"GTS 360M", CARD_NVIDIA_GEFORCE_GTS350M
}, /* Geforce 300 - highend mobile */
1768 {"GTS 350M", CARD_NVIDIA_GEFORCE_GTS350M
}, /* Geforce 300 - highend mobile */
1769 {"GT 330M", CARD_NVIDIA_GEFORCE_GT325M
}, /* Geforce 300 - midend mobile */
1770 {"GT 325M", CARD_NVIDIA_GEFORCE_GT325M
}, /* Geforce 300 - midend mobile */
1771 {"GT 320M", CARD_NVIDIA_GEFORCE_GT320M
}, /* Geforce 300 - midend mobile */
1772 {"320M", CARD_NVIDIA_GEFORCE_320M
}, /* Geforce 300 - midend mobile */
1773 {"315M", CARD_NVIDIA_GEFORCE_315M
}, /* Geforce 300 - midend mobile */
1774 {"GTX 295", CARD_NVIDIA_GEFORCE_GTX280
}, /* Geforce 200 - highend */
1775 {"GTX 285", CARD_NVIDIA_GEFORCE_GTX280
}, /* Geforce 200 - highend */
1776 {"GTX 280", CARD_NVIDIA_GEFORCE_GTX280
}, /* Geforce 200 - highend */
1777 {"GTX 275", CARD_NVIDIA_GEFORCE_GTX275
}, /* Geforce 200 - midend high */
1778 {"GTX 260", CARD_NVIDIA_GEFORCE_GTX260
}, /* Geforce 200 - midend */
1779 {"GT 240", CARD_NVIDIA_GEFORCE_GT240
}, /* Geforce 200 - midend */
1780 {"GT 220", CARD_NVIDIA_GEFORCE_GT220
}, /* Geforce 200 - lowend */
1781 {"GeForce 310", CARD_NVIDIA_GEFORCE_210
}, /* Geforce 200 - lowend */
1782 {"GeForce 305", CARD_NVIDIA_GEFORCE_210
}, /* Geforce 200 - lowend */
1783 {"GeForce 210", CARD_NVIDIA_GEFORCE_210
}, /* Geforce 200 - lowend */
1784 {"G 210", CARD_NVIDIA_GEFORCE_210
}, /* Geforce 200 - lowend */
1785 {"GTS 250", CARD_NVIDIA_GEFORCE_9800GT
}, /* Geforce 9 - highend / Geforce 200 - midend */
1786 {"GTS 150", CARD_NVIDIA_GEFORCE_9800GT
}, /* Geforce 9 - highend / Geforce 200 - midend */
1787 {"9800", CARD_NVIDIA_GEFORCE_9800GT
}, /* Geforce 9 - highend / Geforce 200 - midend */
1788 {"GT 140", CARD_NVIDIA_GEFORCE_9600GT
}, /* Geforce 9 - midend */
1789 {"9600", CARD_NVIDIA_GEFORCE_9600GT
}, /* Geforce 9 - midend */
1790 {"GT 130", CARD_NVIDIA_GEFORCE_9500GT
}, /* Geforce 9 - midend low / Geforce 200 - low */
1791 {"GT 120", CARD_NVIDIA_GEFORCE_9500GT
}, /* Geforce 9 - midend low / Geforce 200 - low */
1792 {"9500", CARD_NVIDIA_GEFORCE_9500GT
}, /* Geforce 9 - midend low / Geforce 200 - low */
1793 {"9400M", CARD_NVIDIA_GEFORCE_9400M
}, /* Geforce 9 - lowend */
1794 {"9400", CARD_NVIDIA_GEFORCE_9400GT
}, /* Geforce 9 - lowend */
1795 {"9300", CARD_NVIDIA_GEFORCE_9300
}, /* Geforce 9 - lowend low */
1796 {"9200", CARD_NVIDIA_GEFORCE_9200
}, /* Geforce 9 - lowend low */
1797 {"9100", CARD_NVIDIA_GEFORCE_9200
}, /* Geforce 9 - lowend low */
1798 {"G 100", CARD_NVIDIA_GEFORCE_9200
}, /* Geforce 9 - lowend low */
1799 {"8800 GTX", CARD_NVIDIA_GEFORCE_8800GTX
}, /* Geforce 8 - highend high */
1800 {"8800", CARD_NVIDIA_GEFORCE_8800GTS
}, /* Geforce 8 - highend */
1801 {"8600M", CARD_NVIDIA_GEFORCE_8600MGT
}, /* Geforce 8 - midend mobile */
1802 {"8600 M", CARD_NVIDIA_GEFORCE_8600MGT
}, /* Geforce 8 - midend mobile */
1803 {"8700", CARD_NVIDIA_GEFORCE_8600GT
}, /* Geforce 8 - midend */
1804 {"8600", CARD_NVIDIA_GEFORCE_8600GT
}, /* Geforce 8 - midend */
1805 {"8500", CARD_NVIDIA_GEFORCE_8400GS
}, /* Geforce 8 - mid-lowend */
1806 {"8400", CARD_NVIDIA_GEFORCE_8400GS
}, /* Geforce 8 - mid-lowend */
1807 {"8300", CARD_NVIDIA_GEFORCE_8300GS
}, /* Geforce 8 - lowend */
1808 {"8200", CARD_NVIDIA_GEFORCE_8300GS
}, /* Geforce 8 - lowend */
1809 {"8100", CARD_NVIDIA_GEFORCE_8300GS
}, /* Geforce 8 - lowend */
1810 /* Direct 3D 9 SM3 */
1811 {"Quadro FX 5", CARD_NVIDIA_GEFORCE_7800GT
}, /* Geforce 7 - highend */
1812 {"Quadro FX 4", CARD_NVIDIA_GEFORCE_7800GT
}, /* Geforce 7 - highend */
1813 {"7950", CARD_NVIDIA_GEFORCE_7800GT
}, /* Geforce 7 - highend */
1814 {"7900", CARD_NVIDIA_GEFORCE_7800GT
}, /* Geforce 7 - highend */
1815 {"7800", CARD_NVIDIA_GEFORCE_7800GT
}, /* Geforce 7 - highend */
1816 {"7700", CARD_NVIDIA_GEFORCE_7600
}, /* Geforce 7 - midend */
1817 {"7600", CARD_NVIDIA_GEFORCE_7600
}, /* Geforce 7 - midend */
1818 {"7400", CARD_NVIDIA_GEFORCE_7400
}, /* Geforce 7 - lower medium */
1819 {"7300", CARD_NVIDIA_GEFORCE_7300
}, /* Geforce 7 - lowend */
1820 {"6800", CARD_NVIDIA_GEFORCE_6800
}, /* Geforce 6 - highend */
1821 {"6700", CARD_NVIDIA_GEFORCE_6600GT
}, /* Geforce 6 - midend */
1822 {"6610", CARD_NVIDIA_GEFORCE_6600GT
}, /* Geforce 6 - midend */
1823 {"6600", CARD_NVIDIA_GEFORCE_6600GT
}, /* Geforce 6 - midend */
1824 /* Direct 3D 9 SM2 */
1825 {"Quadro FX", CARD_NVIDIA_GEFORCEFX_5800
}, /* GeforceFX - highend */
1826 {"5950", CARD_NVIDIA_GEFORCEFX_5800
}, /* GeforceFX - highend */
1827 {"5900", CARD_NVIDIA_GEFORCEFX_5800
}, /* GeforceFX - highend */
1828 {"5800", CARD_NVIDIA_GEFORCEFX_5800
}, /* GeforceFX - highend */
1829 {"5750", CARD_NVIDIA_GEFORCEFX_5600
}, /* GeforceFX - midend */
1830 {"5700", CARD_NVIDIA_GEFORCEFX_5600
}, /* GeforceFX - midend */
1831 {"5650", CARD_NVIDIA_GEFORCEFX_5600
}, /* GeforceFX - midend */
1832 {"5600", CARD_NVIDIA_GEFORCEFX_5600
}, /* GeforceFX - midend */
1833 {"5500", CARD_NVIDIA_GEFORCEFX_5200
}, /* GeforceFX - lowend */
1834 {"5300", CARD_NVIDIA_GEFORCEFX_5200
}, /* GeforceFX - lowend */
1835 {"5250", CARD_NVIDIA_GEFORCEFX_5200
}, /* GeforceFX - lowend */
1836 {"5200", CARD_NVIDIA_GEFORCEFX_5200
}, /* GeforceFX - lowend */
1837 {"5100", CARD_NVIDIA_GEFORCEFX_5200
}, /* GeforceFX - lowend */
1839 {"Quadro4", CARD_NVIDIA_GEFORCE4_TI4200
},
1840 {"GeForce4 Ti", CARD_NVIDIA_GEFORCE4_TI4200
}, /* Geforce4 Ti4200/Ti4400/Ti4600/Ti4800 */
1842 {"GeForce4 MX", CARD_NVIDIA_GEFORCE4_MX
}, /* MX420/MX440/MX460/MX4000 */
1843 {"Quadro2 MXR", CARD_NVIDIA_GEFORCE2_MX
},
1844 {"GeForce2 MX", CARD_NVIDIA_GEFORCE2_MX
}, /* Geforce2 standard/MX100/MX200/MX400 */
1845 {"Quadro2", CARD_NVIDIA_GEFORCE2
},
1846 {"GeForce2", CARD_NVIDIA_GEFORCE2
}, /* Geforce2 GTS/Pro/Ti/Ultra */
1848 {"TNT2", CARD_NVIDIA_RIVA_TNT2
}, /* Riva TNT2 standard/M64/Pro/Ultra */
1850 /* See http://developer.amd.com/resources/hardware-drivers/ati-catalyst-pc-vendor-id-1002-li/
1852 * Beware: renderer string do not match exact card model,
1853 * eg HD 4800 is returned for multiple cards, even for RV790 based ones. */
1854 cards_amd_binary
[] =
1856 /* Southern Islands */
1857 {"HD 7900", CARD_AMD_RADEON_HD7900
},
1858 {"HD 7800", CARD_AMD_RADEON_HD7800
},
1859 {"HD 7700", CARD_AMD_RADEON_HD7700
},
1860 /* Northern Islands */
1861 {"HD 6970", CARD_AMD_RADEON_HD6900
},
1862 {"HD 6900", CARD_AMD_RADEON_HD6900
},
1863 {"HD 6800", CARD_AMD_RADEON_HD6800
},
1864 {"HD 6770M", CARD_AMD_RADEON_HD6600M
},
1865 {"HD 6750M", CARD_AMD_RADEON_HD6600M
},
1866 {"HD 6700", CARD_AMD_RADEON_HD6700
},
1867 {"HD 6670", CARD_AMD_RADEON_HD6600
},
1868 {"HD 6630M", CARD_AMD_RADEON_HD6600M
},
1869 {"HD 6600M", CARD_AMD_RADEON_HD6600M
},
1870 {"HD 6600", CARD_AMD_RADEON_HD6600
},
1871 {"HD 6570", CARD_AMD_RADEON_HD6600
},
1872 {"HD 6500M", CARD_AMD_RADEON_HD6600M
},
1873 {"HD 6500", CARD_AMD_RADEON_HD6600
},
1874 {"HD 6400", CARD_AMD_RADEON_HD6400
},
1875 {"HD 6300", CARD_AMD_RADEON_HD6300
},
1876 {"HD 6200", CARD_AMD_RADEON_HD6300
},
1878 {"HD 5870", CARD_AMD_RADEON_HD5800
}, /* Radeon EG CYPRESS PRO */
1879 {"HD 5850", CARD_AMD_RADEON_HD5800
}, /* Radeon EG CYPRESS XT */
1880 {"HD 5800", CARD_AMD_RADEON_HD5800
}, /* Radeon EG CYPRESS HD58xx generic renderer string */
1881 {"HD 5770", CARD_AMD_RADEON_HD5700
}, /* Radeon EG JUNIPER XT */
1882 {"HD 5750", CARD_AMD_RADEON_HD5700
}, /* Radeon EG JUNIPER LE */
1883 {"HD 5700", CARD_AMD_RADEON_HD5700
}, /* Radeon EG JUNIPER HD57xx generic renderer string */
1884 {"HD 5670", CARD_AMD_RADEON_HD5600
}, /* Radeon EG REDWOOD XT */
1885 {"HD 5570", CARD_AMD_RADEON_HD5600
}, /* Radeon EG REDWOOD PRO mapped to HD5600 series */
1886 {"HD 5550", CARD_AMD_RADEON_HD5600
}, /* Radeon EG REDWOOD LE mapped to HD5600 series */
1887 {"HD 5450", CARD_AMD_RADEON_HD5400
}, /* Radeon EG CEDAR PRO */
1888 {"HD 5000", CARD_AMD_RADEON_HD5600
}, /* Defaulting to HD 5600 */
1890 {"HD 4890", CARD_AMD_RADEON_HD4800
}, /* Radeon RV790 */
1891 {"HD 4870", CARD_AMD_RADEON_HD4800
}, /* Radeon RV770 */
1892 {"HD 4850", CARD_AMD_RADEON_HD4800
}, /* Radeon RV770 */
1893 {"HD 4830", CARD_AMD_RADEON_HD4800
}, /* Radeon RV770 */
1894 {"HD 4800", CARD_AMD_RADEON_HD4800
}, /* Radeon RV7xx HD48xx generic renderer string */
1895 {"HD 4770", CARD_AMD_RADEON_HD4700
}, /* Radeon RV740 */
1896 {"HD 4700", CARD_AMD_RADEON_HD4700
}, /* Radeon RV7xx HD47xx generic renderer string */
1897 {"HD 4670", CARD_AMD_RADEON_HD4600
}, /* Radeon RV730 */
1898 {"HD 4650", CARD_AMD_RADEON_HD4600
}, /* Radeon RV730 */
1899 {"HD 4600", CARD_AMD_RADEON_HD4600
}, /* Radeon RV730 */
1900 {"HD 4550", CARD_AMD_RADEON_HD4350
}, /* Radeon RV710 */
1901 {"HD 4350", CARD_AMD_RADEON_HD4350
}, /* Radeon RV710 */
1902 /* R600/R700 integrated */
1903 {"HD 4200M", CARD_AMD_RADEON_HD4200M
},
1904 {"HD 3300", CARD_AMD_RADEON_HD3200
},
1905 {"HD 3200", CARD_AMD_RADEON_HD3200
},
1906 {"HD 3100", CARD_AMD_RADEON_HD3200
},
1908 {"HD 3870", CARD_AMD_RADEON_HD2900
}, /* HD2900/HD3800 - highend */
1909 {"HD 3850", CARD_AMD_RADEON_HD2900
}, /* HD2900/HD3800 - highend */
1910 {"HD 2900", CARD_AMD_RADEON_HD2900
}, /* HD2900/HD3800 - highend */
1911 {"HD 3830", CARD_AMD_RADEON_HD2600
}, /* China-only midend */
1912 {"HD 3690", CARD_AMD_RADEON_HD2600
}, /* HD2600/HD3600 - midend */
1913 {"HD 3650", CARD_AMD_RADEON_HD2600
}, /* HD2600/HD3600 - midend */
1914 {"HD 2600", CARD_AMD_RADEON_HD2600
}, /* HD2600/HD3600 - midend */
1915 {"HD 3470", CARD_AMD_RADEON_HD2350
}, /* HD2350/HD2400/HD3400 - lowend */
1916 {"HD 3450", CARD_AMD_RADEON_HD2350
}, /* HD2350/HD2400/HD3400 - lowend */
1917 {"HD 3430", CARD_AMD_RADEON_HD2350
}, /* HD2350/HD2400/HD3400 - lowend */
1918 {"HD 3400", CARD_AMD_RADEON_HD2350
}, /* HD2350/HD2400/HD3400 - lowend */
1919 {"HD 2400", CARD_AMD_RADEON_HD2350
}, /* HD2350/HD2400/HD3400 - lowend */
1920 {"HD 2350", CARD_AMD_RADEON_HD2350
}, /* HD2350/HD2400/HD3400 - lowend */
1922 {"X1950", CARD_AMD_RADEON_X1600
},
1923 {"X1900", CARD_AMD_RADEON_X1600
},
1924 {"X1800", CARD_AMD_RADEON_X1600
},
1925 {"X1650", CARD_AMD_RADEON_X1600
},
1926 {"X1600", CARD_AMD_RADEON_X1600
},
1927 /* Radeon R4xx + X1300/X1400/X1450/X1550/X2300/X2500/HD2300 (lowend R5xx)
1928 * Note X2300/X2500/HD2300 are R5xx GPUs with a 2xxx naming but they are still DX9-only */
1929 {"HD 2300", CARD_AMD_RADEON_X700
},
1930 {"X2500", CARD_AMD_RADEON_X700
},
1931 {"X2300", CARD_AMD_RADEON_X700
},
1932 {"X1550", CARD_AMD_RADEON_X700
},
1933 {"X1450", CARD_AMD_RADEON_X700
},
1934 {"X1400", CARD_AMD_RADEON_X700
},
1935 {"X1300", CARD_AMD_RADEON_X700
},
1936 {"X850", CARD_AMD_RADEON_X700
},
1937 {"X800", CARD_AMD_RADEON_X700
},
1938 {"X700", CARD_AMD_RADEON_X700
},
1939 /* Radeon Xpress Series - onboard, DX9b, Shader 2.0, 300-400 MHz */
1940 {"Radeon Xpress", CARD_AMD_RADEON_XPRESS_200M
},
1945 {"Haswell Mobile", CARD_INTEL_HWM
},
1947 {"Ivybridge Server", CARD_INTEL_IVBS
},
1948 {"Ivybridge Mobile", CARD_INTEL_IVBM
},
1949 {"Ivybridge Desktop", CARD_INTEL_IVBD
},
1951 {"Sandybridge Server", CARD_INTEL_SNBS
},
1952 {"Sandybridge Mobile", CARD_INTEL_SNBM
},
1953 {"Sandybridge Desktop", CARD_INTEL_SNBD
},
1955 {"Ironlake Mobile", CARD_INTEL_ILKM
},
1956 {"Ironlake Desktop", CARD_INTEL_ILKD
},
1958 {"B43", CARD_INTEL_B43
},
1959 {"G41", CARD_INTEL_G41
},
1960 {"G45", CARD_INTEL_G45
},
1961 {"Q45", CARD_INTEL_Q45
},
1962 {"Integrated Graphics Device", CARD_INTEL_IGD
},
1963 {"GM45", CARD_INTEL_GM45
},
1965 {"965GME", CARD_INTEL_965GME
},
1966 {"965GM", CARD_INTEL_965GM
},
1967 {"X3100", CARD_INTEL_965GM
}, /* MacOS */
1968 {"946GZ", CARD_INTEL_946GZ
},
1969 {"965G", CARD_INTEL_965G
},
1970 {"965Q", CARD_INTEL_965Q
},
1972 {"Pineview M", CARD_INTEL_PNVM
},
1973 {"Pineview G", CARD_INTEL_PNVG
},
1974 {"IGD", CARD_INTEL_PNVG
},
1975 {"Q33", CARD_INTEL_Q33
},
1976 {"G33", CARD_INTEL_G33
},
1977 {"Q35", CARD_INTEL_Q35
},
1978 {"945GME", CARD_INTEL_945GME
},
1979 {"945GM", CARD_INTEL_945GM
},
1980 {"GMA 950", CARD_INTEL_945GM
}, /* MacOS */
1981 {"945G", CARD_INTEL_945G
},
1983 {"915GM", CARD_INTEL_915GM
},
1984 {"E7221G", CARD_INTEL_E7221G
},
1985 {"915G", CARD_INTEL_915G
},
1987 {"865G", CARD_INTEL_865G
},
1988 {"845G", CARD_INTEL_845G
},
1989 {"855GM", CARD_INTEL_855GM
},
1990 {"830M", CARD_INTEL_830M
},
1992 /* 20101109 - These are never returned by current Gallium radeon
1993 * drivers: R700, RV790, R680, RV535, RV516, R410, RS485, RV360, RV351.
1995 * These are returned but not handled: RC410, RV380. */
1999 {"HAWAII", CARD_AMD_RADEON_R9
},
2000 {"KAVERI", CARD_AMD_RADEON_R7
},
2001 {"KABINI", CARD_AMD_RADEON_R3
},
2002 {"BONAIRE", CARD_AMD_RADEON_HD8770
},
2003 /* Southern Islands */
2004 {"OLAND", CARD_AMD_RADEON_HD8670
},
2005 {"HAINAN", CARD_AMD_RADEON_HD8600M
},
2006 {"TAHITI", CARD_AMD_RADEON_HD7900
},
2007 {"PITCAIRN", CARD_AMD_RADEON_HD7800
},
2008 {"CAPE VERDE", CARD_AMD_RADEON_HD7700
},
2009 /* Northern Islands */
2010 {"ARUBA", CARD_AMD_RADEON_HD7660D
},
2011 {"CAYMAN", CARD_AMD_RADEON_HD6900
},
2012 {"BARTS", CARD_AMD_RADEON_HD6800
},
2013 {"TURKS", CARD_AMD_RADEON_HD6600
},
2014 {"SUMO2", CARD_AMD_RADEON_HD6410D
}, /* SUMO2 first, because we do a strstr(). */
2015 {"SUMO", CARD_AMD_RADEON_HD6550D
},
2016 {"CAICOS", CARD_AMD_RADEON_HD6400
},
2017 {"PALM", CARD_AMD_RADEON_HD6300
},
2019 {"HEMLOCK", CARD_AMD_RADEON_HD5900
},
2020 {"CYPRESS", CARD_AMD_RADEON_HD5800
},
2021 {"JUNIPER", CARD_AMD_RADEON_HD5700
},
2022 {"REDWOOD", CARD_AMD_RADEON_HD5600
},
2023 {"CEDAR", CARD_AMD_RADEON_HD5400
},
2025 {"R700", CARD_AMD_RADEON_HD4800
},
2026 {"RV790", CARD_AMD_RADEON_HD4800
},
2027 {"RV770", CARD_AMD_RADEON_HD4800
},
2028 {"RV740", CARD_AMD_RADEON_HD4700
},
2029 {"RV730", CARD_AMD_RADEON_HD4600
},
2030 {"RV710", CARD_AMD_RADEON_HD4350
},
2031 /* R600/R700 integrated */
2032 {"RS880", CARD_AMD_RADEON_HD4200M
},
2033 {"RS780", CARD_AMD_RADEON_HD3200
},
2035 {"R680", CARD_AMD_RADEON_HD2900
},
2036 {"R600", CARD_AMD_RADEON_HD2900
},
2037 {"RV670", CARD_AMD_RADEON_HD2900
},
2038 {"RV635", CARD_AMD_RADEON_HD2600
},
2039 {"RV630", CARD_AMD_RADEON_HD2600
},
2040 {"RV620", CARD_AMD_RADEON_HD2350
},
2041 {"RV610", CARD_AMD_RADEON_HD2350
},
2043 {"R580", CARD_AMD_RADEON_X1600
},
2044 {"R520", CARD_AMD_RADEON_X1600
},
2045 {"RV570", CARD_AMD_RADEON_X1600
},
2046 {"RV560", CARD_AMD_RADEON_X1600
},
2047 {"RV535", CARD_AMD_RADEON_X1600
},
2048 {"RV530", CARD_AMD_RADEON_X1600
},
2049 {"RV516", CARD_AMD_RADEON_X700
},
2050 {"RV515", CARD_AMD_RADEON_X700
},
2052 {"R481", CARD_AMD_RADEON_X700
},
2053 {"R480", CARD_AMD_RADEON_X700
},
2054 {"R430", CARD_AMD_RADEON_X700
},
2055 {"R423", CARD_AMD_RADEON_X700
},
2056 {"R420", CARD_AMD_RADEON_X700
},
2057 {"R410", CARD_AMD_RADEON_X700
},
2058 {"RV410", CARD_AMD_RADEON_X700
},
2059 /* Radeon Xpress - onboard, DX9b, Shader 2.0, 300-400 MHz */
2060 {"RS740", CARD_AMD_RADEON_XPRESS_200M
},
2061 {"RS690", CARD_AMD_RADEON_XPRESS_200M
},
2062 {"RS600", CARD_AMD_RADEON_XPRESS_200M
},
2063 {"RS485", CARD_AMD_RADEON_XPRESS_200M
},
2064 {"RS482", CARD_AMD_RADEON_XPRESS_200M
},
2065 {"RS480", CARD_AMD_RADEON_XPRESS_200M
},
2066 {"RS400", CARD_AMD_RADEON_XPRESS_200M
},
2068 {"R360", CARD_AMD_RADEON_9500
},
2069 {"R350", CARD_AMD_RADEON_9500
},
2070 {"R300", CARD_AMD_RADEON_9500
},
2071 {"RV370", CARD_AMD_RADEON_9500
},
2072 {"RV360", CARD_AMD_RADEON_9500
},
2073 {"RV351", CARD_AMD_RADEON_9500
},
2074 {"RV350", CARD_AMD_RADEON_9500
},
2076 cards_nvidia_mesa
[] =
2079 {"NV124", CARD_NVIDIA_GEFORCE_GTX970
},
2080 {"NV117", CARD_NVIDIA_GEFORCE_GTX750
},
2082 {"NVF1", CARD_NVIDIA_GEFORCE_GTX780TI
},
2083 {"NVF0", CARD_NVIDIA_GEFORCE_GTX780
},
2084 {"NVE6", CARD_NVIDIA_GEFORCE_GTX770M
},
2085 {"NVE4", CARD_NVIDIA_GEFORCE_GTX680
},
2087 {"NVD9", CARD_NVIDIA_GEFORCE_GT520
},
2088 {"NVCF", CARD_NVIDIA_GEFORCE_GTX550
},
2089 {"NVCE", CARD_NVIDIA_GEFORCE_GTX560
},
2090 {"NVC8", CARD_NVIDIA_GEFORCE_GTX570
},
2091 {"NVC4", CARD_NVIDIA_GEFORCE_GTX460
},
2092 {"NVC3", CARD_NVIDIA_GEFORCE_GT440
},
2093 {"NVC1", CARD_NVIDIA_GEFORCE_GT420
},
2094 {"NVC0", CARD_NVIDIA_GEFORCE_GTX480
},
2096 {"NVAF", CARD_NVIDIA_GEFORCE_GT320M
},
2097 {"NVAC", CARD_NVIDIA_GEFORCE_8200
},
2098 {"NVAA", CARD_NVIDIA_GEFORCE_8200
},
2099 {"NVA8", CARD_NVIDIA_GEFORCE_210
},
2100 {"NVA5", CARD_NVIDIA_GEFORCE_GT220
},
2101 {"NVA3", CARD_NVIDIA_GEFORCE_GT240
},
2102 {"NVA0", CARD_NVIDIA_GEFORCE_GTX280
},
2103 {"NV98", CARD_NVIDIA_GEFORCE_9200
},
2104 {"NV96", CARD_NVIDIA_GEFORCE_9400GT
},
2105 {"NV94", CARD_NVIDIA_GEFORCE_9600GT
},
2106 {"NV92", CARD_NVIDIA_GEFORCE_9800GT
},
2107 {"NV86", CARD_NVIDIA_GEFORCE_8500GT
},
2108 {"NV84", CARD_NVIDIA_GEFORCE_8600GT
},
2109 {"NV50", CARD_NVIDIA_GEFORCE_8800GTX
},
2111 {"NV68", CARD_NVIDIA_GEFORCE_6200
}, /* 7050 */
2112 {"NV67", CARD_NVIDIA_GEFORCE_6200
}, /* 7000M */
2113 {"NV63", CARD_NVIDIA_GEFORCE_6200
}, /* 7100 */
2114 {"NV4E", CARD_NVIDIA_GEFORCE_6200
}, /* 6100 Go / 6150 Go */
2115 {"NV4C", CARD_NVIDIA_GEFORCE_6200
}, /* 6150SE */
2116 {"NV4B", CARD_NVIDIA_GEFORCE_7600
},
2117 {"NV4A", CARD_NVIDIA_GEFORCE_6200
},
2118 {"NV49", CARD_NVIDIA_GEFORCE_7800GT
}, /* 7900 */
2119 {"NV47", CARD_NVIDIA_GEFORCE_7800GT
},
2120 {"NV46", CARD_NVIDIA_GEFORCE_7400
},
2121 {"NV45", CARD_NVIDIA_GEFORCE_6800
},
2122 {"NV44", CARD_NVIDIA_GEFORCE_6200
},
2123 {"NV43", CARD_NVIDIA_GEFORCE_6600GT
},
2124 {"NV42", CARD_NVIDIA_GEFORCE_6800
},
2125 {"NV41", CARD_NVIDIA_GEFORCE_6800
},
2126 {"NV40", CARD_NVIDIA_GEFORCE_6800
},
2128 {"NV38", CARD_NVIDIA_GEFORCEFX_5800
}, /* FX 5950 Ultra */
2129 {"NV36", CARD_NVIDIA_GEFORCEFX_5800
}, /* FX 5700/5750 */
2130 {"NV35", CARD_NVIDIA_GEFORCEFX_5800
}, /* FX 5900 */
2131 {"NV34", CARD_NVIDIA_GEFORCEFX_5200
},
2132 {"NV31", CARD_NVIDIA_GEFORCEFX_5600
},
2133 {"NV30", CARD_NVIDIA_GEFORCEFX_5800
},
2135 {"nv28", CARD_NVIDIA_GEFORCE4_TI4200
},
2136 {"nv25", CARD_NVIDIA_GEFORCE4_TI4200
},
2137 {"nv20", CARD_NVIDIA_GEFORCE3
},
2139 {"nv1F", CARD_NVIDIA_GEFORCE4_MX
}, /* GF4 MX IGP */
2140 {"nv1A", CARD_NVIDIA_GEFORCE2
}, /* GF2 IGP */
2141 {"nv18", CARD_NVIDIA_GEFORCE4_MX
},
2142 {"nv17", CARD_NVIDIA_GEFORCE4_MX
},
2143 {"nv16", CARD_NVIDIA_GEFORCE2
},
2144 {"nv15", CARD_NVIDIA_GEFORCE2
},
2145 {"nv11", CARD_NVIDIA_GEFORCE2_MX
},
2146 {"nv10", CARD_NVIDIA_GEFORCE
},
2148 {"nv05", CARD_NVIDIA_RIVA_TNT2
},
2149 {"nv04", CARD_NVIDIA_RIVA_TNT
},
2150 {"nv03", CARD_NVIDIA_RIVA_128
},
2154 {"SVGA3D", CARD_VMWARE_SVGA3D
},
2157 static const struct gl_vendor_selection
2159 enum wined3d_gl_vendor gl_vendor
;
2160 const char *description
; /* Description of the card selector i.e. Apple OS/X Intel */
2161 const struct wined3d_renderer_table
*cards
; /* To be used as cards[], pointer to the first member in an array */
2162 size_t cards_size
; /* Number of entries in the array above */
2164 amd_gl_vendor_table
[] =
2166 {GL_VENDOR_APPLE
, "Apple OSX AMD/ATI binary driver", cards_amd_binary
, ARRAY_SIZE(cards_amd_binary
)},
2167 {GL_VENDOR_FGLRX
, "AMD/ATI binary driver", cards_amd_binary
, ARRAY_SIZE(cards_amd_binary
)},
2168 {GL_VENDOR_MESA
, "Mesa AMD/ATI driver", cards_amd_mesa
, ARRAY_SIZE(cards_amd_mesa
)},
2170 nvidia_gl_vendor_table
[] =
2172 {GL_VENDOR_APPLE
, "Apple OSX NVidia binary driver", cards_nvidia_binary
, ARRAY_SIZE(cards_nvidia_binary
)},
2173 {GL_VENDOR_MESA
, "Mesa Nouveau driver", cards_nvidia_mesa
, ARRAY_SIZE(cards_nvidia_mesa
)},
2174 {GL_VENDOR_NVIDIA
, "Nvidia binary driver", cards_nvidia_binary
, ARRAY_SIZE(cards_nvidia_binary
)},
2176 vmware_gl_vendor_table
[] =
2178 {GL_VENDOR_MESA
, "VMware driver", cards_vmware
, ARRAY_SIZE(cards_vmware
)},
2180 intel_gl_vendor_table
[] =
2182 {GL_VENDOR_APPLE
, "Apple OSX Intel binary driver", cards_intel
, ARRAY_SIZE(cards_intel
)},
2183 {GL_VENDOR_MESA
, "Mesa Intel driver", cards_intel
, ARRAY_SIZE(cards_intel
)},
2186 static const enum wined3d_pci_device
2187 card_fallback_nvidia
[] =
2189 CARD_NVIDIA_RIVA_128
, /* D3D5 */
2190 CARD_NVIDIA_RIVA_TNT
, /* D3D6 */
2191 CARD_NVIDIA_GEFORCE
, /* D3D7 */
2192 CARD_NVIDIA_GEFORCE3
, /* D3D8 */
2193 CARD_NVIDIA_GEFORCEFX_5800
, /* D3D9_SM2 */
2194 CARD_NVIDIA_GEFORCE_6800
, /* D3D9_SM3 */
2195 CARD_NVIDIA_GEFORCE_8800GTX
, /* D3D10 */
2196 CARD_NVIDIA_GEFORCE_GTX470
, /* D3D11 */
2198 card_fallback_amd
[] =
2200 CARD_AMD_RAGE_128PRO
, /* D3D5 */
2201 CARD_AMD_RAGE_128PRO
, /* D3D6 */
2202 CARD_AMD_RADEON_7200
, /* D3D7 */
2203 CARD_AMD_RADEON_8500
, /* D3D8 */
2204 CARD_AMD_RADEON_9500
, /* D3D9_SM2 */
2205 CARD_AMD_RADEON_X1600
, /* D3D9_SM3 */
2206 CARD_AMD_RADEON_HD2900
, /* D3D10 */
2207 CARD_AMD_RADEON_HD5600
, /* D3D11 */
2209 card_fallback_intel
[] =
2211 CARD_INTEL_845G
, /* D3D5 */
2212 CARD_INTEL_845G
, /* D3D6 */
2213 CARD_INTEL_845G
, /* D3D7 */
2214 CARD_INTEL_915G
, /* D3D8 */
2215 CARD_INTEL_915G
, /* D3D9_SM2 */
2216 CARD_INTEL_945G
, /* D3D9_SM3 */
2217 CARD_INTEL_G45
, /* D3D10 */
2218 CARD_INTEL_IVBD
, /* D3D11 */
2220 C_ASSERT(ARRAY_SIZE(card_fallback_nvidia
) == WINED3D_D3D_LEVEL_COUNT
);
2221 C_ASSERT(ARRAY_SIZE(card_fallback_amd
) == WINED3D_D3D_LEVEL_COUNT
);
2222 C_ASSERT(ARRAY_SIZE(card_fallback_intel
) == WINED3D_D3D_LEVEL_COUNT
);
2224 static enum wined3d_pci_device
select_card_handler(const struct gl_vendor_selection
*table
,
2225 unsigned int table_size
, enum wined3d_gl_vendor gl_vendor
, const char *gl_renderer
)
2229 for (i
= 0; i
< table_size
; ++i
)
2231 if (table
[i
].gl_vendor
!= gl_vendor
)
2234 TRACE("Applying card selector \"%s\".\n", table
[i
].description
);
2236 for (j
= 0; j
< table
[i
].cards_size
; ++j
)
2238 if (strstr(gl_renderer
, table
[i
].cards
[j
].renderer
))
2239 return table
[i
].cards
[j
].id
;
2241 return PCI_DEVICE_NONE
;
2243 FIXME("Couldn't find a suitable card selector for GL vendor %04x (using GL_RENDERER %s)\n",
2244 gl_vendor
, debugstr_a(gl_renderer
));
2246 return PCI_DEVICE_NONE
;
2251 enum wined3d_pci_vendor card_vendor
;
2252 const char *description
; /* Description of the card selector i.e. Apple OS/X Intel */
2253 const struct gl_vendor_selection
*gl_vendor_selection
;
2254 unsigned int gl_vendor_count
;
2255 const enum wined3d_pci_device
*card_fallback
; /* An array with D3D_LEVEL_COUNT elements */
2257 card_vendor_table
[] =
2259 {HW_VENDOR_AMD
, "AMD", amd_gl_vendor_table
,
2260 sizeof(amd_gl_vendor_table
) / sizeof(*amd_gl_vendor_table
),
2262 {HW_VENDOR_NVIDIA
, "Nvidia", nvidia_gl_vendor_table
,
2263 sizeof(nvidia_gl_vendor_table
) / sizeof(*nvidia_gl_vendor_table
),
2264 card_fallback_nvidia
},
2265 {HW_VENDOR_VMWARE
, "VMware", vmware_gl_vendor_table
,
2266 sizeof(vmware_gl_vendor_table
) / sizeof(*vmware_gl_vendor_table
),
2268 {HW_VENDOR_INTEL
, "Intel", intel_gl_vendor_table
,
2269 sizeof(intel_gl_vendor_table
) / sizeof(*intel_gl_vendor_table
),
2270 card_fallback_intel
},
2274 static enum wined3d_pci_device
wined3d_guess_card(const struct shader_caps
*shader_caps
, const struct fragment_caps
*fragment_caps
,
2275 DWORD glsl_version
, const char *gl_renderer
, enum wined3d_gl_vendor
*gl_vendor
, enum wined3d_pci_vendor
*card_vendor
)
2277 /* A Direct3D device object contains the PCI id (vendor + device) of the
2278 * videocard which is used for rendering. Various applications use this
2279 * information to get a rough estimation of the features of the card and
2280 * some might use it for enabling 3d effects only on certain types of
2281 * videocards. In some cases games might even use it to work around bugs
2282 * which happen on certain videocards/driver combinations. The problem is
2283 * that OpenGL only exposes a rendering string containing the name of the
2284 * videocard and not the PCI id.
2286 * Various games depend on the PCI id, so somehow we need to provide one.
2287 * A simple option is to parse the renderer string and translate this to
2288 * the right PCI id. This is a lot of work because there are more than 200
2289 * GPUs just for Nvidia. Various cards share the same renderer string, so
2290 * the amount of code might be 'small' but there are quite a number of
2291 * exceptions which would make this a pain to maintain. Another way would
2292 * be to query the PCI id from the operating system (assuming this is the
2293 * videocard which is used for rendering which is not always the case).
2294 * This would work but it is not very portable. Second it would not work
2295 * well in, let's say, a remote X situation in which the amount of 3d
2296 * features which can be used is limited.
2298 * As said most games only use the PCI id to get an indication of the
2299 * capabilities of the card. It doesn't really matter if the given id is
2300 * the correct one if we return the id of a card with similar 3d features.
2302 * The code below checks the OpenGL capabilities of a videocard and matches
2303 * that to a certain level of Direct3D functionality. Once a card passes
2304 * the Direct3D9 check, we know that the card (in case of Nvidia) is at
2305 * least a GeforceFX. To give a better estimate we do a basic check on the
2306 * renderer string but if that won't pass we return a default card. This
2307 * way is better than maintaining a full card database as even without a
2308 * full database we can return a card with similar features. Second the
2309 * size of the database can be made quite small because when you know what
2310 * type of 3d functionality a card has, you know to which GPU family the
2311 * GPU must belong. Because of this you only have to check a small part of
2312 * the renderer string to distinguish between different models from that
2315 * The code also selects a default amount of video memory which we will
2316 * use for an estimation of the amount of free texture memory. In case of
2317 * real D3D the amount of texture memory includes video memory and system
2318 * memory (to be specific AGP memory or in case of PCIE TurboCache /
2319 * HyperMemory). We don't know how much system memory can be addressed by
2320 * the system but we can make a reasonable estimation about the amount of
2321 * video memory. If the value is slightly wrong it doesn't matter as we
2322 * didn't include AGP-like memory which makes the amount of addressable
2323 * memory higher and second OpenGL isn't that critical it moves to system
2324 * memory behind our backs if really needed. Note that the amount of video
2325 * memory can be overruled using a registry setting. */
2328 enum wined3d_d3d_level d3d_level
= d3d_level_from_caps(shader_caps
, fragment_caps
, glsl_version
);
2329 enum wined3d_pci_device device
;
2331 for (i
= 0; i
< (sizeof(card_vendor_table
) / sizeof(*card_vendor_table
)); ++i
)
2333 if (card_vendor_table
[i
].card_vendor
!= *card_vendor
)
2336 TRACE("Applying card selector \"%s\".\n", card_vendor_table
[i
].description
);
2337 device
= select_card_handler(card_vendor_table
[i
].gl_vendor_selection
,
2338 card_vendor_table
[i
].gl_vendor_count
, *gl_vendor
, gl_renderer
);
2339 if (device
!= PCI_DEVICE_NONE
)
2342 TRACE("Unrecognized renderer %s, falling back to default.\n", debugstr_a(gl_renderer
));
2343 return card_vendor_table
[i
].card_fallback
[d3d_level
];
2346 FIXME("No card selector available for card vendor %04x (using GL_RENDERER %s).\n",
2347 *card_vendor
, debugstr_a(gl_renderer
));
2349 /* Default to generic Nvidia hardware based on the supported OpenGL extensions. */
2350 *card_vendor
= HW_VENDOR_NVIDIA
;
2351 return card_fallback_nvidia
[d3d_level
];
2354 static const struct wined3d_vertex_pipe_ops
*select_vertex_implementation(const struct wined3d_gl_info
*gl_info
,
2355 const struct wined3d_shader_backend_ops
*shader_backend_ops
)
2357 if (shader_backend_ops
== &glsl_shader_backend
)
2358 return &glsl_vertex_pipe
;
2359 return &ffp_vertex_pipe
;
2362 static const struct fragment_pipeline
*select_fragment_implementation(const struct wined3d_gl_info
*gl_info
,
2363 const struct wined3d_shader_backend_ops
*shader_backend_ops
)
2365 if (shader_backend_ops
== &glsl_shader_backend
)
2366 return &glsl_fragment_pipe
;
2367 if (shader_backend_ops
== &arb_program_shader_backend
&& gl_info
->supported
[ARB_FRAGMENT_PROGRAM
])
2368 return &arbfp_fragment_pipeline
;
2369 if (gl_info
->supported
[ATI_FRAGMENT_SHADER
])
2370 return &atifs_fragment_pipeline
;
2371 if (gl_info
->supported
[NV_REGISTER_COMBINERS
] && gl_info
->supported
[NV_TEXTURE_SHADER2
])
2372 return &nvts_fragment_pipeline
;
2373 if (gl_info
->supported
[NV_REGISTER_COMBINERS
])
2374 return &nvrc_fragment_pipeline
;
2375 return &ffp_fragment_pipeline
;
2378 static const struct wined3d_shader_backend_ops
*select_shader_backend(const struct wined3d_gl_info
*gl_info
)
2380 BOOL glsl
= wined3d_settings
.glslRequested
&& gl_info
->glsl_version
>= MAKEDWORD_VERSION(1, 20);
2382 if (glsl
&& gl_info
->supported
[ARB_FRAGMENT_SHADER
])
2383 return &glsl_shader_backend
;
2384 if (glsl
&& gl_info
->supported
[ARB_VERTEX_SHADER
])
2386 /* Geforce4 cards support GLSL but for vertex shaders only. Further
2387 * its reported GLSL caps are wrong. This combined with the fact that
2388 * GLSL won't offer more features or performance, use ARB shaders only
2390 if (gl_info
->supported
[NV_VERTEX_PROGRAM
] && !gl_info
->supported
[NV_VERTEX_PROGRAM2
])
2391 return &arb_program_shader_backend
;
2392 return &glsl_shader_backend
;
2394 if (gl_info
->supported
[ARB_VERTEX_PROGRAM
] || gl_info
->supported
[ARB_FRAGMENT_PROGRAM
])
2395 return &arb_program_shader_backend
;
2396 return &none_shader_backend
;
2399 static const struct blit_shader
*select_blit_implementation(const struct wined3d_gl_info
*gl_info
,
2400 const struct wined3d_shader_backend_ops
*shader_backend_ops
)
2402 if ((shader_backend_ops
== &glsl_shader_backend
2403 || shader_backend_ops
== &arb_program_shader_backend
)
2404 && gl_info
->supported
[ARB_FRAGMENT_PROGRAM
])
2409 static void parse_extension_string(struct wined3d_gl_info
*gl_info
, const char *extensions
,
2410 const struct wined3d_extension_map
*map
, UINT entry_count
)
2418 while (isspace(*extensions
))
2421 while (!isspace(*extensions
) && *extensions
)
2424 len
= extensions
- start
;
2428 TRACE("- %s.\n", debugstr_an(start
, len
));
2430 for (i
= 0; i
< entry_count
; ++i
)
2432 if (len
== strlen(map
[i
].extension_string
)
2433 && !memcmp(start
, map
[i
].extension_string
, len
))
2435 TRACE(" FOUND: %s support.\n", map
[i
].extension_string
);
2436 gl_info
->supported
[map
[i
].extension
] = TRUE
;
2443 static void load_gl_funcs(struct wined3d_gl_info
*gl_info
)
2445 #define USE_GL_FUNC(pfn) gl_info->gl_ops.ext.p_##pfn = (void *)wglGetProcAddress(#pfn);
2446 /* GL_APPLE_fence */
2447 USE_GL_FUNC(glDeleteFencesAPPLE
)
2448 USE_GL_FUNC(glFinishFenceAPPLE
)
2449 USE_GL_FUNC(glFinishObjectAPPLE
)
2450 USE_GL_FUNC(glGenFencesAPPLE
)
2451 USE_GL_FUNC(glIsFenceAPPLE
)
2452 USE_GL_FUNC(glSetFenceAPPLE
)
2453 USE_GL_FUNC(glTestFenceAPPLE
)
2454 USE_GL_FUNC(glTestObjectAPPLE
)
2455 /* GL_APPLE_flush_buffer_range */
2456 USE_GL_FUNC(glBufferParameteriAPPLE
)
2457 USE_GL_FUNC(glFlushMappedBufferRangeAPPLE
)
2458 /* GL_ARB_blend_func_extended */
2459 USE_GL_FUNC(glBindFragDataLocationIndexed
)
2460 USE_GL_FUNC(glGetFragDataIndex
)
2461 /* GL_ARB_color_buffer_float */
2462 USE_GL_FUNC(glClampColorARB
)
2463 /* GL_ARB_debug_output */
2464 USE_GL_FUNC(glDebugMessageCallbackARB
)
2465 USE_GL_FUNC(glDebugMessageControlARB
)
2466 USE_GL_FUNC(glDebugMessageInsertARB
)
2467 USE_GL_FUNC(glGetDebugMessageLogARB
)
2468 /* GL_ARB_draw_buffers */
2469 USE_GL_FUNC(glDrawBuffersARB
)
2470 /* GL_ARB_draw_elements_base_vertex */
2471 USE_GL_FUNC(glDrawElementsBaseVertex
)
2472 USE_GL_FUNC(glDrawElementsInstancedBaseVertex
)
2473 USE_GL_FUNC(glDrawRangeElementsBaseVertex
)
2474 USE_GL_FUNC(glMultiDrawElementsBaseVertex
)
2475 /* GL_ARB_draw_instanced */
2476 USE_GL_FUNC(glDrawArraysInstancedARB
)
2477 USE_GL_FUNC(glDrawElementsInstancedARB
)
2478 /* GL_ARB_framebuffer_object */
2479 USE_GL_FUNC(glBindFramebuffer
)
2480 USE_GL_FUNC(glBindRenderbuffer
)
2481 USE_GL_FUNC(glBlitFramebuffer
)
2482 USE_GL_FUNC(glCheckFramebufferStatus
)
2483 USE_GL_FUNC(glDeleteFramebuffers
)
2484 USE_GL_FUNC(glDeleteRenderbuffers
)
2485 USE_GL_FUNC(glFramebufferRenderbuffer
)
2486 USE_GL_FUNC(glFramebufferTexture1D
)
2487 USE_GL_FUNC(glFramebufferTexture2D
)
2488 USE_GL_FUNC(glFramebufferTexture3D
)
2489 USE_GL_FUNC(glFramebufferTextureLayer
)
2490 USE_GL_FUNC(glGenFramebuffers
)
2491 USE_GL_FUNC(glGenRenderbuffers
)
2492 USE_GL_FUNC(glGenerateMipmap
)
2493 USE_GL_FUNC(glGetFramebufferAttachmentParameteriv
)
2494 USE_GL_FUNC(glGetRenderbufferParameteriv
)
2495 USE_GL_FUNC(glIsFramebuffer
)
2496 USE_GL_FUNC(glIsRenderbuffer
)
2497 USE_GL_FUNC(glRenderbufferStorage
)
2498 USE_GL_FUNC(glRenderbufferStorageMultisample
)
2499 /* GL_ARB_geometry_shader4 */
2500 USE_GL_FUNC(glFramebufferTextureARB
)
2501 USE_GL_FUNC(glFramebufferTextureFaceARB
)
2502 USE_GL_FUNC(glFramebufferTextureLayerARB
)
2503 USE_GL_FUNC(glProgramParameteriARB
)
2504 /* GL_ARB_instanced_arrays */
2505 USE_GL_FUNC(glVertexAttribDivisorARB
)
2506 /* GL_ARB_internalformat_query */
2507 USE_GL_FUNC(glGetInternalformativ
)
2508 /* GL_ARB_internalformat_query2 */
2509 USE_GL_FUNC(glGetInternalformati64v
)
2510 /* GL_ARB_map_buffer_range */
2511 USE_GL_FUNC(glFlushMappedBufferRange
)
2512 USE_GL_FUNC(glMapBufferRange
)
2513 /* GL_ARB_multisample */
2514 USE_GL_FUNC(glSampleCoverageARB
)
2515 /* GL_ARB_multitexture */
2516 USE_GL_FUNC(glActiveTextureARB
)
2517 USE_GL_FUNC(glClientActiveTextureARB
)
2518 USE_GL_FUNC(glMultiTexCoord1fARB
)
2519 USE_GL_FUNC(glMultiTexCoord1fvARB
)
2520 USE_GL_FUNC(glMultiTexCoord2fARB
)
2521 USE_GL_FUNC(glMultiTexCoord2fvARB
)
2522 USE_GL_FUNC(glMultiTexCoord2svARB
)
2523 USE_GL_FUNC(glMultiTexCoord3fARB
)
2524 USE_GL_FUNC(glMultiTexCoord3fvARB
)
2525 USE_GL_FUNC(glMultiTexCoord4fARB
)
2526 USE_GL_FUNC(glMultiTexCoord4fvARB
)
2527 USE_GL_FUNC(glMultiTexCoord4svARB
)
2528 /* GL_ARB_occlusion_query */
2529 USE_GL_FUNC(glBeginQueryARB
)
2530 USE_GL_FUNC(glDeleteQueriesARB
)
2531 USE_GL_FUNC(glEndQueryARB
)
2532 USE_GL_FUNC(glGenQueriesARB
)
2533 USE_GL_FUNC(glGetQueryivARB
)
2534 USE_GL_FUNC(glGetQueryObjectivARB
)
2535 USE_GL_FUNC(glGetQueryObjectuivARB
)
2536 USE_GL_FUNC(glIsQueryARB
)
2537 /* GL_ARB_point_parameters */
2538 USE_GL_FUNC(glPointParameterfARB
)
2539 USE_GL_FUNC(glPointParameterfvARB
)
2540 /* GL_ARB_provoking_vertex */
2541 USE_GL_FUNC(glProvokingVertex
)
2542 /* GL_ARB_shader_objects */
2543 USE_GL_FUNC(glAttachObjectARB
)
2544 USE_GL_FUNC(glBindAttribLocationARB
)
2545 USE_GL_FUNC(glCompileShaderARB
)
2546 USE_GL_FUNC(glCreateProgramObjectARB
)
2547 USE_GL_FUNC(glCreateShaderObjectARB
)
2548 USE_GL_FUNC(glDeleteObjectARB
)
2549 USE_GL_FUNC(glDetachObjectARB
)
2550 USE_GL_FUNC(glGetActiveUniformARB
)
2551 USE_GL_FUNC(glGetAttachedObjectsARB
)
2552 USE_GL_FUNC(glGetAttribLocationARB
)
2553 USE_GL_FUNC(glGetHandleARB
)
2554 USE_GL_FUNC(glGetInfoLogARB
)
2555 USE_GL_FUNC(glGetObjectParameterfvARB
)
2556 USE_GL_FUNC(glGetObjectParameterivARB
)
2557 USE_GL_FUNC(glGetShaderSourceARB
)
2558 USE_GL_FUNC(glGetUniformLocationARB
)
2559 USE_GL_FUNC(glGetUniformfvARB
)
2560 USE_GL_FUNC(glGetUniformivARB
)
2561 USE_GL_FUNC(glLinkProgramARB
)
2562 USE_GL_FUNC(glShaderSourceARB
)
2563 USE_GL_FUNC(glUniform1fARB
)
2564 USE_GL_FUNC(glUniform1fvARB
)
2565 USE_GL_FUNC(glUniform1iARB
)
2566 USE_GL_FUNC(glUniform1ivARB
)
2567 USE_GL_FUNC(glUniform2fARB
)
2568 USE_GL_FUNC(glUniform2fvARB
)
2569 USE_GL_FUNC(glUniform2iARB
)
2570 USE_GL_FUNC(glUniform2ivARB
)
2571 USE_GL_FUNC(glUniform3fARB
)
2572 USE_GL_FUNC(glUniform3fvARB
)
2573 USE_GL_FUNC(glUniform3iARB
)
2574 USE_GL_FUNC(glUniform3ivARB
)
2575 USE_GL_FUNC(glUniform4fARB
)
2576 USE_GL_FUNC(glUniform4fvARB
)
2577 USE_GL_FUNC(glUniform4iARB
)
2578 USE_GL_FUNC(glUniform4ivARB
)
2579 USE_GL_FUNC(glUniformMatrix2fvARB
)
2580 USE_GL_FUNC(glUniformMatrix3fvARB
)
2581 USE_GL_FUNC(glUniformMatrix4fvARB
)
2582 USE_GL_FUNC(glUseProgramObjectARB
)
2583 USE_GL_FUNC(glValidateProgramARB
)
2585 USE_GL_FUNC(glClientWaitSync
)
2586 USE_GL_FUNC(glDeleteSync
)
2587 USE_GL_FUNC(glFenceSync
)
2588 USE_GL_FUNC(glGetInteger64v
)
2589 USE_GL_FUNC(glGetSynciv
)
2590 USE_GL_FUNC(glIsSync
)
2591 USE_GL_FUNC(glWaitSync
)
2592 /* GL_ARB_texture_compression */
2593 USE_GL_FUNC(glCompressedTexImage2DARB
)
2594 USE_GL_FUNC(glCompressedTexImage3DARB
)
2595 USE_GL_FUNC(glCompressedTexSubImage2DARB
)
2596 USE_GL_FUNC(glCompressedTexSubImage3DARB
)
2597 USE_GL_FUNC(glGetCompressedTexImageARB
)
2598 /* GL_ARB_timer_query */
2599 USE_GL_FUNC(glQueryCounter
)
2600 USE_GL_FUNC(glGetQueryObjectui64v
)
2601 /* GL_ARB_uniform_buffer_object */
2602 USE_GL_FUNC(glBindBufferBase
)
2603 USE_GL_FUNC(glBindBufferRange
)
2604 USE_GL_FUNC(glGetActiveUniformBlockName
)
2605 USE_GL_FUNC(glGetActiveUniformBlockiv
)
2606 USE_GL_FUNC(glGetActiveUniformName
)
2607 USE_GL_FUNC(glGetActiveUniformsiv
)
2608 USE_GL_FUNC(glGetIntegeri_v
)
2609 USE_GL_FUNC(glGetUniformBlockIndex
)
2610 USE_GL_FUNC(glGetUniformIndices
)
2611 USE_GL_FUNC(glUniformBlockBinding
)
2612 /* GL_ARB_vertex_blend */
2613 USE_GL_FUNC(glVertexBlendARB
)
2614 USE_GL_FUNC(glWeightPointerARB
)
2615 USE_GL_FUNC(glWeightbvARB
)
2616 USE_GL_FUNC(glWeightdvARB
)
2617 USE_GL_FUNC(glWeightfvARB
)
2618 USE_GL_FUNC(glWeightivARB
)
2619 USE_GL_FUNC(glWeightsvARB
)
2620 USE_GL_FUNC(glWeightubvARB
)
2621 USE_GL_FUNC(glWeightuivARB
)
2622 USE_GL_FUNC(glWeightusvARB
)
2623 /* GL_ARB_vertex_buffer_object */
2624 USE_GL_FUNC(glBindBufferARB
)
2625 USE_GL_FUNC(glBufferDataARB
)
2626 USE_GL_FUNC(glBufferSubDataARB
)
2627 USE_GL_FUNC(glDeleteBuffersARB
)
2628 USE_GL_FUNC(glGenBuffersARB
)
2629 USE_GL_FUNC(glGetBufferParameterivARB
)
2630 USE_GL_FUNC(glGetBufferPointervARB
)
2631 USE_GL_FUNC(glGetBufferSubDataARB
)
2632 USE_GL_FUNC(glIsBufferARB
)
2633 USE_GL_FUNC(glMapBufferARB
)
2634 USE_GL_FUNC(glUnmapBufferARB
)
2635 /* GL_ARB_vertex_program */
2636 USE_GL_FUNC(glBindProgramARB
)
2637 USE_GL_FUNC(glDeleteProgramsARB
)
2638 USE_GL_FUNC(glDisableVertexAttribArrayARB
)
2639 USE_GL_FUNC(glEnableVertexAttribArrayARB
)
2640 USE_GL_FUNC(glGenProgramsARB
)
2641 USE_GL_FUNC(glGetProgramivARB
)
2642 USE_GL_FUNC(glProgramEnvParameter4fvARB
)
2643 USE_GL_FUNC(glProgramLocalParameter4fvARB
)
2644 USE_GL_FUNC(glProgramStringARB
)
2645 USE_GL_FUNC(glVertexAttrib1dARB
)
2646 USE_GL_FUNC(glVertexAttrib1dvARB
)
2647 USE_GL_FUNC(glVertexAttrib1fARB
)
2648 USE_GL_FUNC(glVertexAttrib1fvARB
)
2649 USE_GL_FUNC(glVertexAttrib1sARB
)
2650 USE_GL_FUNC(glVertexAttrib1svARB
)
2651 USE_GL_FUNC(glVertexAttrib2dARB
)
2652 USE_GL_FUNC(glVertexAttrib2dvARB
)
2653 USE_GL_FUNC(glVertexAttrib2fARB
)
2654 USE_GL_FUNC(glVertexAttrib2fvARB
)
2655 USE_GL_FUNC(glVertexAttrib2sARB
)
2656 USE_GL_FUNC(glVertexAttrib2svARB
)
2657 USE_GL_FUNC(glVertexAttrib3dARB
)
2658 USE_GL_FUNC(glVertexAttrib3dvARB
)
2659 USE_GL_FUNC(glVertexAttrib3fARB
)
2660 USE_GL_FUNC(glVertexAttrib3fvARB
)
2661 USE_GL_FUNC(glVertexAttrib3sARB
)
2662 USE_GL_FUNC(glVertexAttrib3svARB
)
2663 USE_GL_FUNC(glVertexAttrib4NbvARB
)
2664 USE_GL_FUNC(glVertexAttrib4NivARB
)
2665 USE_GL_FUNC(glVertexAttrib4NsvARB
)
2666 USE_GL_FUNC(glVertexAttrib4NubARB
)
2667 USE_GL_FUNC(glVertexAttrib4NubvARB
)
2668 USE_GL_FUNC(glVertexAttrib4NuivARB
)
2669 USE_GL_FUNC(glVertexAttrib4NusvARB
)
2670 USE_GL_FUNC(glVertexAttrib4bvARB
)
2671 USE_GL_FUNC(glVertexAttrib4dARB
)
2672 USE_GL_FUNC(glVertexAttrib4dvARB
)
2673 USE_GL_FUNC(glVertexAttrib4fARB
)
2674 USE_GL_FUNC(glVertexAttrib4fvARB
)
2675 USE_GL_FUNC(glVertexAttrib4ivARB
)
2676 USE_GL_FUNC(glVertexAttrib4sARB
)
2677 USE_GL_FUNC(glVertexAttrib4svARB
)
2678 USE_GL_FUNC(glVertexAttrib4ubvARB
)
2679 USE_GL_FUNC(glVertexAttrib4uivARB
)
2680 USE_GL_FUNC(glVertexAttrib4usvARB
)
2681 USE_GL_FUNC(glVertexAttribPointerARB
)
2682 /* GL_ATI_fragment_shader */
2683 USE_GL_FUNC(glAlphaFragmentOp1ATI
)
2684 USE_GL_FUNC(glAlphaFragmentOp2ATI
)
2685 USE_GL_FUNC(glAlphaFragmentOp3ATI
)
2686 USE_GL_FUNC(glBeginFragmentShaderATI
)
2687 USE_GL_FUNC(glBindFragmentShaderATI
)
2688 USE_GL_FUNC(glColorFragmentOp1ATI
)
2689 USE_GL_FUNC(glColorFragmentOp2ATI
)
2690 USE_GL_FUNC(glColorFragmentOp3ATI
)
2691 USE_GL_FUNC(glDeleteFragmentShaderATI
)
2692 USE_GL_FUNC(glEndFragmentShaderATI
)
2693 USE_GL_FUNC(glGenFragmentShadersATI
)
2694 USE_GL_FUNC(glPassTexCoordATI
)
2695 USE_GL_FUNC(glSampleMapATI
)
2696 USE_GL_FUNC(glSetFragmentShaderConstantATI
)
2697 /* GL_ATI_separate_stencil */
2698 USE_GL_FUNC(glStencilOpSeparateATI
)
2699 USE_GL_FUNC(glStencilFuncSeparateATI
)
2700 /* GL_EXT_blend_color */
2701 USE_GL_FUNC(glBlendColorEXT
)
2702 /* GL_EXT_blend_equation_separate */
2703 USE_GL_FUNC(glBlendFuncSeparateEXT
)
2704 /* GL_EXT_blend_func_separate */
2705 USE_GL_FUNC(glBlendEquationSeparateEXT
)
2706 /* GL_EXT_blend_minmax */
2707 USE_GL_FUNC(glBlendEquationEXT
)
2708 /* GL_EXT_depth_bounds_test */
2709 USE_GL_FUNC(glDepthBoundsEXT
)
2710 /* GL_EXT_draw_buffers2 */
2711 USE_GL_FUNC(glColorMaskIndexedEXT
)
2712 USE_GL_FUNC(glDisableIndexedEXT
)
2713 USE_GL_FUNC(glEnableIndexedEXT
)
2714 USE_GL_FUNC(glGetBooleanIndexedvEXT
)
2715 USE_GL_FUNC(glGetIntegerIndexedvEXT
)
2716 USE_GL_FUNC(glIsEnabledIndexedEXT
)
2717 /* GL_EXT_fog_coord */
2718 USE_GL_FUNC(glFogCoordPointerEXT
)
2719 USE_GL_FUNC(glFogCoorddEXT
)
2720 USE_GL_FUNC(glFogCoorddvEXT
)
2721 USE_GL_FUNC(glFogCoordfEXT
)
2722 USE_GL_FUNC(glFogCoordfvEXT
)
2723 /* GL_EXT_framebuffer_blit */
2724 USE_GL_FUNC(glBlitFramebufferEXT
)
2725 /* GL_EXT_framebuffer_multisample */
2726 USE_GL_FUNC(glRenderbufferStorageMultisampleEXT
)
2727 /* GL_EXT_framebuffer_object */
2728 USE_GL_FUNC(glBindFramebufferEXT
)
2729 USE_GL_FUNC(glBindRenderbufferEXT
)
2730 USE_GL_FUNC(glCheckFramebufferStatusEXT
)
2731 USE_GL_FUNC(glDeleteFramebuffersEXT
)
2732 USE_GL_FUNC(glDeleteRenderbuffersEXT
)
2733 USE_GL_FUNC(glFramebufferRenderbufferEXT
)
2734 USE_GL_FUNC(glFramebufferTexture1DEXT
)
2735 USE_GL_FUNC(glFramebufferTexture2DEXT
)
2736 USE_GL_FUNC(glFramebufferTexture3DEXT
)
2737 USE_GL_FUNC(glGenFramebuffersEXT
)
2738 USE_GL_FUNC(glGenRenderbuffersEXT
)
2739 USE_GL_FUNC(glGenerateMipmapEXT
)
2740 USE_GL_FUNC(glGetFramebufferAttachmentParameterivEXT
)
2741 USE_GL_FUNC(glGetRenderbufferParameterivEXT
)
2742 USE_GL_FUNC(glIsFramebufferEXT
)
2743 USE_GL_FUNC(glIsRenderbufferEXT
)
2744 USE_GL_FUNC(glRenderbufferStorageEXT
)
2745 /* GL_EXT_gpu_program_parameters */
2746 USE_GL_FUNC(glProgramEnvParameters4fvEXT
)
2747 USE_GL_FUNC(glProgramLocalParameters4fvEXT
)
2748 /* GL_EXT_gpu_shader4 */
2749 USE_GL_FUNC(glBindFragDataLocationEXT
)
2750 USE_GL_FUNC(glGetFragDataLocationEXT
)
2751 USE_GL_FUNC(glGetUniformuivEXT
)
2752 USE_GL_FUNC(glGetVertexAttribIivEXT
)
2753 USE_GL_FUNC(glGetVertexAttribIuivEXT
)
2754 USE_GL_FUNC(glUniform1uiEXT
)
2755 USE_GL_FUNC(glUniform1uivEXT
)
2756 USE_GL_FUNC(glUniform2uiEXT
)
2757 USE_GL_FUNC(glUniform2uivEXT
)
2758 USE_GL_FUNC(glUniform3uiEXT
)
2759 USE_GL_FUNC(glUniform3uivEXT
)
2760 USE_GL_FUNC(glUniform4uiEXT
)
2761 USE_GL_FUNC(glUniform4uivEXT
)
2762 USE_GL_FUNC(glVertexAttribI1iEXT
)
2763 USE_GL_FUNC(glVertexAttribI1ivEXT
)
2764 USE_GL_FUNC(glVertexAttribI1uiEXT
)
2765 USE_GL_FUNC(glVertexAttribI1uivEXT
)
2766 USE_GL_FUNC(glVertexAttribI2iEXT
)
2767 USE_GL_FUNC(glVertexAttribI2ivEXT
)
2768 USE_GL_FUNC(glVertexAttribI2uiEXT
)
2769 USE_GL_FUNC(glVertexAttribI2uivEXT
)
2770 USE_GL_FUNC(glVertexAttribI3iEXT
)
2771 USE_GL_FUNC(glVertexAttribI3ivEXT
)
2772 USE_GL_FUNC(glVertexAttribI3uiEXT
)
2773 USE_GL_FUNC(glVertexAttribI3uivEXT
)
2774 USE_GL_FUNC(glVertexAttribI4bvEXT
)
2775 USE_GL_FUNC(glVertexAttribI4iEXT
)
2776 USE_GL_FUNC(glVertexAttribI4ivEXT
)
2777 USE_GL_FUNC(glVertexAttribI4svEXT
)
2778 USE_GL_FUNC(glVertexAttribI4ubvEXT
)
2779 USE_GL_FUNC(glVertexAttribI4uiEXT
)
2780 USE_GL_FUNC(glVertexAttribI4uivEXT
)
2781 USE_GL_FUNC(glVertexAttribI4usvEXT
)
2782 USE_GL_FUNC(glVertexAttribIPointerEXT
)
2783 /* GL_EXT_point_parameters */
2784 USE_GL_FUNC(glPointParameterfEXT
)
2785 USE_GL_FUNC(glPointParameterfvEXT
)
2786 /* GL_EXT_provoking_vertex */
2787 USE_GL_FUNC(glProvokingVertexEXT
)
2788 /* GL_EXT_secondary_color */
2789 USE_GL_FUNC(glSecondaryColor3fEXT
)
2790 USE_GL_FUNC(glSecondaryColor3fvEXT
)
2791 USE_GL_FUNC(glSecondaryColor3ubEXT
)
2792 USE_GL_FUNC(glSecondaryColor3ubvEXT
)
2793 USE_GL_FUNC(glSecondaryColorPointerEXT
)
2794 /* GL_EXT_stencil_two_side */
2795 USE_GL_FUNC(glActiveStencilFaceEXT
)
2796 /* GL_EXT_texture3D */
2797 USE_GL_FUNC(glTexImage3D
)
2798 USE_GL_FUNC(glTexImage3DEXT
)
2799 USE_GL_FUNC(glTexSubImage3D
)
2800 USE_GL_FUNC(glTexSubImage3DEXT
)
2802 USE_GL_FUNC(glDeleteFencesNV
)
2803 USE_GL_FUNC(glFinishFenceNV
)
2804 USE_GL_FUNC(glGenFencesNV
)
2805 USE_GL_FUNC(glGetFenceivNV
)
2806 USE_GL_FUNC(glIsFenceNV
)
2807 USE_GL_FUNC(glSetFenceNV
)
2808 USE_GL_FUNC(glTestFenceNV
)
2809 /* GL_NV_half_float */
2810 USE_GL_FUNC(glColor3hNV
)
2811 USE_GL_FUNC(glColor3hvNV
)
2812 USE_GL_FUNC(glColor4hNV
)
2813 USE_GL_FUNC(glColor4hvNV
)
2814 USE_GL_FUNC(glFogCoordhNV
)
2815 USE_GL_FUNC(glFogCoordhvNV
)
2816 USE_GL_FUNC(glMultiTexCoord1hNV
)
2817 USE_GL_FUNC(glMultiTexCoord1hvNV
)
2818 USE_GL_FUNC(glMultiTexCoord2hNV
)
2819 USE_GL_FUNC(glMultiTexCoord2hvNV
)
2820 USE_GL_FUNC(glMultiTexCoord3hNV
)
2821 USE_GL_FUNC(glMultiTexCoord3hvNV
)
2822 USE_GL_FUNC(glMultiTexCoord4hNV
)
2823 USE_GL_FUNC(glMultiTexCoord4hvNV
)
2824 USE_GL_FUNC(glNormal3hNV
)
2825 USE_GL_FUNC(glNormal3hvNV
)
2826 USE_GL_FUNC(glSecondaryColor3hNV
)
2827 USE_GL_FUNC(glSecondaryColor3hvNV
)
2828 USE_GL_FUNC(glTexCoord1hNV
)
2829 USE_GL_FUNC(glTexCoord1hvNV
)
2830 USE_GL_FUNC(glTexCoord2hNV
)
2831 USE_GL_FUNC(glTexCoord2hvNV
)
2832 USE_GL_FUNC(glTexCoord3hNV
)
2833 USE_GL_FUNC(glTexCoord3hvNV
)
2834 USE_GL_FUNC(glTexCoord4hNV
)
2835 USE_GL_FUNC(glTexCoord4hvNV
)
2836 USE_GL_FUNC(glVertex2hNV
)
2837 USE_GL_FUNC(glVertex2hvNV
)
2838 USE_GL_FUNC(glVertex3hNV
)
2839 USE_GL_FUNC(glVertex3hvNV
)
2840 USE_GL_FUNC(glVertex4hNV
)
2841 USE_GL_FUNC(glVertex4hvNV
)
2842 USE_GL_FUNC(glVertexAttrib1hNV
)
2843 USE_GL_FUNC(glVertexAttrib1hvNV
)
2844 USE_GL_FUNC(glVertexAttrib2hNV
)
2845 USE_GL_FUNC(glVertexAttrib2hvNV
)
2846 USE_GL_FUNC(glVertexAttrib3hNV
)
2847 USE_GL_FUNC(glVertexAttrib3hvNV
)
2848 USE_GL_FUNC(glVertexAttrib4hNV
)
2849 USE_GL_FUNC(glVertexAttrib4hvNV
)
2850 USE_GL_FUNC(glVertexAttribs1hvNV
)
2851 USE_GL_FUNC(glVertexAttribs2hvNV
)
2852 USE_GL_FUNC(glVertexAttribs3hvNV
)
2853 USE_GL_FUNC(glVertexAttribs4hvNV
)
2854 USE_GL_FUNC(glVertexWeighthNV
)
2855 USE_GL_FUNC(glVertexWeighthvNV
)
2856 /* GL_NV_point_sprite */
2857 USE_GL_FUNC(glPointParameteri
)
2858 USE_GL_FUNC(glPointParameteriNV
)
2859 USE_GL_FUNC(glPointParameteriv
)
2860 USE_GL_FUNC(glPointParameterivNV
)
2861 /* GL_NV_register_combiners */
2862 USE_GL_FUNC(glCombinerInputNV
)
2863 USE_GL_FUNC(glCombinerOutputNV
)
2864 USE_GL_FUNC(glCombinerParameterfNV
)
2865 USE_GL_FUNC(glCombinerParameterfvNV
)
2866 USE_GL_FUNC(glCombinerParameteriNV
)
2867 USE_GL_FUNC(glCombinerParameterivNV
)
2868 USE_GL_FUNC(glFinalCombinerInputNV
)
2869 /* WGL extensions */
2870 USE_GL_FUNC(wglChoosePixelFormatARB
)
2871 USE_GL_FUNC(wglGetExtensionsStringARB
)
2872 USE_GL_FUNC(wglGetPixelFormatAttribfvARB
)
2873 USE_GL_FUNC(wglGetPixelFormatAttribivARB
)
2874 USE_GL_FUNC(wglSetPixelFormatWINE
)
2875 USE_GL_FUNC(wglSwapIntervalEXT
)
2877 /* Newer core functions */
2878 USE_GL_FUNC(glActiveTexture
) /* OpenGL 1.3 */
2879 USE_GL_FUNC(glBindBuffer
) /* OpenGL 1.5 */
2880 USE_GL_FUNC(glBlendColor
) /* OpenGL 1.4 */
2881 USE_GL_FUNC(glBlendEquation
) /* OpenGL 1.4 */
2882 USE_GL_FUNC(glBlendEquationSeparate
) /* OpenGL 2.0 */
2883 USE_GL_FUNC(glBlendFuncSeparate
) /* OpenGL 1.4 */
2884 USE_GL_FUNC(glBufferData
) /* OpenGL 1.5 */
2885 USE_GL_FUNC(glBufferSubData
) /* OpenGL 1.5 */
2886 USE_GL_FUNC(glDeleteBuffers
) /* OpenGL 1.5 */
2887 USE_GL_FUNC(glGenBuffers
) /* OpenGL 1.5 */
2888 USE_GL_FUNC(glGetBufferSubData
) /* OpenGL 1.5 */
2889 USE_GL_FUNC(glMapBuffer
) /* OpenGL 1.5 */
2890 USE_GL_FUNC(glUnmapBuffer
) /* OpenGL 1.5 */
2893 #ifndef USE_WIN32_OPENGL
2894 /* hack: use the functions directly from the TEB table to bypass the thunks */
2895 /* note that we still need the above wglGetProcAddress calls to initialize the table */
2896 gl_info
->gl_ops
.ext
= ((struct opengl_funcs
*)NtCurrentTeb()->glTable
)->ext
;
2899 #define MAP_GL_FUNCTION(core_func, ext_func) \
2902 if (!gl_info->gl_ops.ext.p_##core_func) \
2903 gl_info->gl_ops.ext.p_##core_func = gl_info->gl_ops.ext.p_##ext_func; \
2906 MAP_GL_FUNCTION(glActiveTexture
, glActiveTextureARB
);
2907 MAP_GL_FUNCTION(glBindBuffer
, glBindBufferARB
);
2908 MAP_GL_FUNCTION(glBlendColor
, glBlendColorEXT
);
2909 MAP_GL_FUNCTION(glBlendEquation
, glBlendEquationEXT
);
2910 MAP_GL_FUNCTION(glBlendEquationSeparate
, glBlendEquationSeparateEXT
);
2911 MAP_GL_FUNCTION(glBlendFuncSeparate
, glBlendFuncSeparateEXT
);
2912 MAP_GL_FUNCTION(glBufferData
, glBufferDataARB
);
2913 MAP_GL_FUNCTION(glBufferSubData
, glBufferSubDataARB
);
2914 MAP_GL_FUNCTION(glDeleteBuffers
, glDeleteBuffersARB
);
2915 MAP_GL_FUNCTION(glGenBuffers
, glGenBuffersARB
);
2916 MAP_GL_FUNCTION(glGetBufferSubData
, glGetBufferSubDataARB
);
2917 MAP_GL_FUNCTION(glMapBuffer
, glMapBufferARB
);
2918 MAP_GL_FUNCTION(glUnmapBuffer
, glUnmapBufferARB
);
2919 #undef MAP_GL_FUNCTION
2922 static void wined3d_adapter_init_limits(struct wined3d_gl_info
*gl_info
)
2924 GLfloat gl_floatv
[2];
2927 gl_info
->limits
.blends
= 1;
2928 gl_info
->limits
.buffers
= 1;
2929 gl_info
->limits
.textures
= 1;
2930 gl_info
->limits
.texture_coords
= 1;
2931 gl_info
->limits
.vertex_uniform_blocks
= 0;
2932 gl_info
->limits
.geometry_uniform_blocks
= 0;
2933 gl_info
->limits
.fragment_uniform_blocks
= 0;
2934 gl_info
->limits
.fragment_samplers
= 1;
2935 gl_info
->limits
.vertex_samplers
= 0;
2936 gl_info
->limits
.combined_samplers
= gl_info
->limits
.fragment_samplers
+ gl_info
->limits
.vertex_samplers
;
2937 gl_info
->limits
.vertex_attribs
= 16;
2938 gl_info
->limits
.glsl_vs_float_constants
= 0;
2939 gl_info
->limits
.glsl_ps_float_constants
= 0;
2940 gl_info
->limits
.arb_vs_float_constants
= 0;
2941 gl_info
->limits
.arb_vs_native_constants
= 0;
2942 gl_info
->limits
.arb_vs_instructions
= 0;
2943 gl_info
->limits
.arb_vs_temps
= 0;
2944 gl_info
->limits
.arb_ps_float_constants
= 0;
2945 gl_info
->limits
.arb_ps_local_constants
= 0;
2946 gl_info
->limits
.arb_ps_instructions
= 0;
2947 gl_info
->limits
.arb_ps_temps
= 0;
2949 gl_info
->gl_ops
.gl
.p_glGetIntegerv(GL_MAX_CLIP_PLANES
, &gl_max
);
2950 gl_info
->limits
.clipplanes
= min(WINED3DMAXUSERCLIPPLANES
, gl_max
);
2951 TRACE("Clip plane support - max planes %d.\n", gl_max
);
2953 gl_info
->gl_ops
.gl
.p_glGetIntegerv(GL_MAX_LIGHTS
, &gl_max
);
2954 gl_info
->limits
.lights
= gl_max
;
2955 TRACE("Light support - max lights %d.\n", gl_max
);
2957 gl_info
->gl_ops
.gl
.p_glGetIntegerv(GL_MAX_TEXTURE_SIZE
, &gl_max
);
2958 gl_info
->limits
.texture_size
= gl_max
;
2959 TRACE("Maximum texture size support - max texture size %d.\n", gl_max
);
2961 gl_info
->gl_ops
.gl
.p_glGetFloatv(GL_ALIASED_POINT_SIZE_RANGE
, gl_floatv
);
2962 gl_info
->limits
.pointsize_min
= gl_floatv
[0];
2963 gl_info
->limits
.pointsize_max
= gl_floatv
[1];
2964 TRACE("Maximum point size support - max point size %f.\n", gl_floatv
[1]);
2966 if (gl_info
->supported
[ARB_MAP_BUFFER_ALIGNMENT
])
2968 gl_info
->gl_ops
.gl
.p_glGetIntegerv(GL_MIN_MAP_BUFFER_ALIGNMENT
, &gl_max
);
2969 TRACE("Minimum buffer map alignment: %d.\n", gl_max
);
2973 WARN_(d3d_perf
)("Driver doesn't guarantee a minimum buffer map alignment.\n");
2975 if (gl_info
->supported
[NV_REGISTER_COMBINERS
])
2977 gl_info
->gl_ops
.gl
.p_glGetIntegerv(GL_MAX_GENERAL_COMBINERS_NV
, &gl_max
);
2978 gl_info
->limits
.general_combiners
= gl_max
;
2979 TRACE("Max general combiners: %d.\n", gl_max
);
2981 if (gl_info
->supported
[ARB_DRAW_BUFFERS
] && wined3d_settings
.offscreen_rendering_mode
== ORM_FBO
)
2983 gl_info
->gl_ops
.gl
.p_glGetIntegerv(GL_MAX_DRAW_BUFFERS_ARB
, &gl_max
);
2984 gl_info
->limits
.buffers
= gl_max
;
2985 TRACE("Max draw buffers: %u.\n", gl_max
);
2987 if (gl_info
->supported
[ARB_MULTITEXTURE
])
2989 gl_info
->gl_ops
.gl
.p_glGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB
, &gl_max
);
2990 gl_info
->limits
.textures
= min(MAX_TEXTURES
, gl_max
);
2991 TRACE("Max textures: %d.\n", gl_info
->limits
.textures
);
2993 if (gl_info
->supported
[ARB_FRAGMENT_PROGRAM
])
2996 gl_info
->gl_ops
.gl
.p_glGetIntegerv(GL_MAX_TEXTURE_COORDS_ARB
, &gl_max
);
2997 gl_info
->limits
.texture_coords
= min(MAX_TEXTURES
, gl_max
);
2998 gl_info
->gl_ops
.gl
.p_glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS_ARB
, &tmp
);
2999 gl_info
->limits
.fragment_samplers
= min(MAX_FRAGMENT_SAMPLERS
, tmp
);
3003 gl_info
->limits
.texture_coords
= max(gl_info
->limits
.texture_coords
, gl_max
);
3004 gl_info
->limits
.fragment_samplers
= max(gl_info
->limits
.fragment_samplers
, gl_max
);
3006 TRACE("Max texture coords: %d.\n", gl_info
->limits
.texture_coords
);
3007 TRACE("Max fragment samplers: %d.\n", gl_info
->limits
.fragment_samplers
);
3009 if (gl_info
->supported
[ARB_VERTEX_SHADER
])
3012 gl_info
->gl_ops
.gl
.p_glGetIntegerv(GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB
, &tmp
);
3013 gl_info
->limits
.vertex_samplers
= tmp
;
3014 gl_info
->gl_ops
.gl
.p_glGetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB
, &tmp
);
3015 gl_info
->limits
.combined_samplers
= tmp
;
3016 gl_info
->gl_ops
.gl
.p_glGetIntegerv(GL_MAX_VERTEX_ATTRIBS_ARB
, &tmp
);
3017 gl_info
->limits
.vertex_attribs
= tmp
;
3019 /* Loading GLSL sampler uniforms is much simpler if we can assume that the sampler setup
3020 * is known at shader link time. In a vertex shader + pixel shader combination this isn't
3021 * an issue because then the sampler setup only depends on the two shaders. If a pixel
3022 * shader is used with fixed function vertex processing we're fine too because fixed function
3023 * vertex processing doesn't use any samplers. If fixed function fragment processing is
3024 * used we have to make sure that all vertex sampler setups are valid together with all
3025 * possible fixed function fragment processing setups. This is true if vsamplers + MAX_TEXTURES
3026 * <= max_samplers. This is true on all d3d9 cards that support vtf(gf 6 and gf7 cards).
3027 * dx9 radeon cards do not support vertex texture fetch. DX10 cards have 128 samplers, and
3028 * dx9 is limited to 8 fixed function texture stages and 4 vertex samplers. DX10 does not have
3029 * a fixed function pipeline anymore.
3031 * So this is just a check to check that our assumption holds true. If not, write a warning
3032 * and reduce the number of vertex samplers or probably disable vertex texture fetch. */
3033 if (gl_info
->limits
.vertex_samplers
&& gl_info
->limits
.combined_samplers
< 12
3034 && MAX_TEXTURES
+ gl_info
->limits
.vertex_samplers
> gl_info
->limits
.combined_samplers
)
3036 FIXME("OpenGL implementation supports %u vertex samplers and %u total samplers.\n",
3037 gl_info
->limits
.vertex_samplers
, gl_info
->limits
.combined_samplers
);
3038 FIXME("Expected vertex samplers + MAX_TEXTURES(=8) > combined_samplers.\n");
3039 if (gl_info
->limits
.combined_samplers
> MAX_TEXTURES
)
3040 gl_info
->limits
.vertex_samplers
= gl_info
->limits
.combined_samplers
- MAX_TEXTURES
;
3042 gl_info
->limits
.vertex_samplers
= 0;
3047 gl_info
->limits
.combined_samplers
= gl_info
->limits
.fragment_samplers
;
3049 TRACE("Max vertex samplers: %u.\n", gl_info
->limits
.vertex_samplers
);
3050 TRACE("Max combined samplers: %u.\n", gl_info
->limits
.combined_samplers
);
3052 if (gl_info
->supported
[ARB_VERTEX_BLEND
])
3054 gl_info
->gl_ops
.gl
.p_glGetIntegerv(GL_MAX_VERTEX_UNITS_ARB
, &gl_max
);
3055 gl_info
->limits
.blends
= gl_max
;
3056 TRACE("Max blends: %u.\n", gl_info
->limits
.blends
);
3058 if (gl_info
->supported
[EXT_TEXTURE3D
])
3060 gl_info
->gl_ops
.gl
.p_glGetIntegerv(GL_MAX_3D_TEXTURE_SIZE_EXT
, &gl_max
);
3061 gl_info
->limits
.texture3d_size
= gl_max
;
3062 TRACE("Max texture3D size: %d.\n", gl_info
->limits
.texture3d_size
);
3064 if (gl_info
->supported
[EXT_TEXTURE_FILTER_ANISOTROPIC
])
3066 gl_info
->gl_ops
.gl
.p_glGetIntegerv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT
, &gl_max
);
3067 gl_info
->limits
.anisotropy
= gl_max
;
3068 TRACE("Max anisotropy: %d.\n", gl_info
->limits
.anisotropy
);
3070 if (gl_info
->supported
[ARB_FRAGMENT_PROGRAM
])
3072 GL_EXTCALL(glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB
, GL_MAX_PROGRAM_ENV_PARAMETERS_ARB
, &gl_max
));
3073 gl_info
->limits
.arb_ps_float_constants
= gl_max
;
3074 TRACE("Max ARB_FRAGMENT_PROGRAM float constants: %d.\n", gl_info
->limits
.arb_ps_float_constants
);
3075 GL_EXTCALL(glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB
, GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB
, &gl_max
));
3076 gl_info
->limits
.arb_ps_native_constants
= gl_max
;
3077 TRACE("Max ARB_FRAGMENT_PROGRAM native float constants: %d.\n",
3078 gl_info
->limits
.arb_ps_native_constants
);
3079 GL_EXTCALL(glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB
, GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB
, &gl_max
));
3080 gl_info
->limits
.arb_ps_temps
= gl_max
;
3081 TRACE("Max ARB_FRAGMENT_PROGRAM native temporaries: %d.\n", gl_info
->limits
.arb_ps_temps
);
3082 GL_EXTCALL(glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB
, GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB
, &gl_max
));
3083 gl_info
->limits
.arb_ps_instructions
= gl_max
;
3084 TRACE("Max ARB_FRAGMENT_PROGRAM native instructions: %d.\n", gl_info
->limits
.arb_ps_instructions
);
3085 GL_EXTCALL(glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB
, GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB
, &gl_max
));
3086 gl_info
->limits
.arb_ps_local_constants
= gl_max
;
3087 TRACE("Max ARB_FRAGMENT_PROGRAM local parameters: %d.\n", gl_info
->limits
.arb_ps_instructions
);
3089 if (gl_info
->supported
[ARB_VERTEX_PROGRAM
])
3091 GL_EXTCALL(glGetProgramivARB(GL_VERTEX_PROGRAM_ARB
, GL_MAX_PROGRAM_ENV_PARAMETERS_ARB
, &gl_max
));
3092 gl_info
->limits
.arb_vs_float_constants
= gl_max
;
3093 TRACE("Max ARB_VERTEX_PROGRAM float constants: %d.\n", gl_info
->limits
.arb_vs_float_constants
);
3094 GL_EXTCALL(glGetProgramivARB(GL_VERTEX_PROGRAM_ARB
, GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB
, &gl_max
));
3095 gl_info
->limits
.arb_vs_native_constants
= gl_max
;
3096 TRACE("Max ARB_VERTEX_PROGRAM native float constants: %d.\n",
3097 gl_info
->limits
.arb_vs_native_constants
);
3098 GL_EXTCALL(glGetProgramivARB(GL_VERTEX_PROGRAM_ARB
, GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB
, &gl_max
));
3099 gl_info
->limits
.arb_vs_temps
= gl_max
;
3100 TRACE("Max ARB_VERTEX_PROGRAM native temporaries: %d.\n", gl_info
->limits
.arb_vs_temps
);
3101 GL_EXTCALL(glGetProgramivARB(GL_VERTEX_PROGRAM_ARB
, GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB
, &gl_max
));
3102 gl_info
->limits
.arb_vs_instructions
= gl_max
;
3103 TRACE("Max ARB_VERTEX_PROGRAM native instructions: %d.\n", gl_info
->limits
.arb_vs_instructions
);
3105 if (gl_info
->supported
[ARB_VERTEX_SHADER
])
3107 gl_info
->gl_ops
.gl
.p_glGetIntegerv(GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB
, &gl_max
);
3108 gl_info
->limits
.glsl_vs_float_constants
= gl_max
/ 4;
3109 TRACE("Max ARB_VERTEX_SHADER float constants: %u.\n", gl_info
->limits
.glsl_vs_float_constants
);
3111 if (gl_info
->supported
[ARB_UNIFORM_BUFFER_OBJECT
])
3113 gl_info
->gl_ops
.gl
.p_glGetIntegerv(GL_MAX_VERTEX_UNIFORM_BLOCKS
, &gl_max
);
3114 gl_info
->limits
.vertex_uniform_blocks
= min(gl_max
, WINED3D_MAX_CBS
);
3115 TRACE("Max vertex uniform blocks: %u (%d).\n", gl_info
->limits
.vertex_uniform_blocks
, gl_max
);
3118 if (gl_info
->supported
[ARB_GEOMETRY_SHADER4
] && gl_info
->supported
[ARB_UNIFORM_BUFFER_OBJECT
])
3120 gl_info
->gl_ops
.gl
.p_glGetIntegerv(GL_MAX_GEOMETRY_UNIFORM_BLOCKS
, &gl_max
);
3121 gl_info
->limits
.geometry_uniform_blocks
= min(gl_max
, WINED3D_MAX_CBS
);
3122 TRACE("Max geometry uniform blocks: %u (%d).\n", gl_info
->limits
.geometry_uniform_blocks
, gl_max
);
3124 if (gl_info
->supported
[ARB_FRAGMENT_SHADER
])
3126 gl_info
->gl_ops
.gl
.p_glGetIntegerv(GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB
, &gl_max
);
3127 gl_info
->limits
.glsl_ps_float_constants
= gl_max
/ 4;
3128 TRACE("Max ARB_FRAGMENT_SHADER float constants: %u.\n", gl_info
->limits
.glsl_ps_float_constants
);
3129 gl_info
->gl_ops
.gl
.p_glGetIntegerv(GL_MAX_VARYING_FLOATS_ARB
, &gl_max
);
3130 gl_info
->limits
.glsl_varyings
= gl_max
;
3131 TRACE("Max GLSL varyings: %u (%u 4 component varyings).\n", gl_max
, gl_max
/ 4);
3133 if (gl_info
->supported
[ARB_UNIFORM_BUFFER_OBJECT
])
3135 gl_info
->gl_ops
.gl
.p_glGetIntegerv(GL_MAX_FRAGMENT_UNIFORM_BLOCKS
, &gl_max
);
3136 gl_info
->limits
.fragment_uniform_blocks
= min(gl_max
, WINED3D_MAX_CBS
);
3137 TRACE("Max fragment uniform blocks: %u (%d).\n", gl_info
->limits
.fragment_uniform_blocks
, gl_max
);
3140 if (gl_info
->supported
[ARB_UNIFORM_BUFFER_OBJECT
])
3142 gl_info
->gl_ops
.gl
.p_glGetIntegerv(GL_MAX_COMBINED_UNIFORM_BLOCKS
, &gl_max
);
3143 TRACE("Max combined uniform blocks: %d.\n", gl_max
);
3144 gl_info
->gl_ops
.gl
.p_glGetIntegerv(GL_MAX_UNIFORM_BUFFER_BINDINGS
, &gl_max
);
3145 TRACE("Max uniform buffer bindings: %d.\n", gl_max
);
3148 if (gl_info
->supported
[NV_LIGHT_MAX_EXPONENT
])
3149 gl_info
->gl_ops
.gl
.p_glGetFloatv(GL_MAX_SHININESS_NV
, &gl_info
->limits
.shininess
);
3151 gl_info
->limits
.shininess
= 128.0f
;
3153 if ((gl_info
->supported
[ARB_FRAMEBUFFER_OBJECT
] || gl_info
->supported
[EXT_FRAMEBUFFER_MULTISAMPLE
])
3154 && wined3d_settings
.allow_multisampling
)
3156 gl_info
->gl_ops
.gl
.p_glGetIntegerv(GL_MAX_SAMPLES
, &gl_max
);
3157 gl_info
->limits
.samples
= gl_max
;
3161 /* Context activation is done by the caller. */
3162 static BOOL
wined3d_adapter_init_gl_caps(struct wined3d_adapter
*adapter
)
3164 struct wined3d_driver_info
*driver_info
= &adapter
->driver_info
;
3165 const char *gl_vendor_str
, *gl_renderer_str
, *gl_version_str
;
3166 struct wined3d_gl_info
*gl_info
= &adapter
->gl_info
;
3167 struct wined3d_vertex_caps vertex_caps
;
3168 enum wined3d_pci_vendor card_vendor
;
3169 struct fragment_caps fragment_caps
;
3170 struct shader_caps shader_caps
;
3171 const char *WGL_Extensions
= NULL
;
3172 const char *GL_Extensions
= NULL
;
3173 enum wined3d_gl_vendor gl_vendor
;
3174 enum wined3d_pci_device device
;
3179 TRACE("adapter %p.\n", adapter
);
3181 gl_renderer_str
= (const char *)gl_info
->gl_ops
.gl
.p_glGetString(GL_RENDERER
);
3182 TRACE("GL_RENDERER: %s.\n", debugstr_a(gl_renderer_str
));
3183 if (!gl_renderer_str
)
3185 ERR("Received a NULL GL_RENDERER.\n");
3189 gl_vendor_str
= (const char *)gl_info
->gl_ops
.gl
.p_glGetString(GL_VENDOR
);
3190 TRACE("GL_VENDOR: %s.\n", debugstr_a(gl_vendor_str
));
3193 ERR("Received a NULL GL_VENDOR.\n");
3197 /* Parse the GL_VERSION field into major and minor information */
3198 gl_version_str
= (const char *)gl_info
->gl_ops
.gl
.p_glGetString(GL_VERSION
);
3199 TRACE("GL_VERSION: %s.\n", debugstr_a(gl_version_str
));
3200 if (!gl_version_str
)
3202 ERR("Received a NULL GL_VERSION.\n");
3205 gl_version
= wined3d_parse_gl_version(gl_version_str
);
3207 /* Parse the gl supported features, in theory enabling parts of our code appropriately. */
3208 GL_Extensions
= (const char *)gl_info
->gl_ops
.gl
.p_glGetString(GL_EXTENSIONS
);
3211 ERR("Received a NULL GL_EXTENSIONS.\n");
3215 memset(gl_info
->supported
, 0, sizeof(gl_info
->supported
));
3216 gl_info
->supported
[WINED3D_GL_EXT_NONE
] = TRUE
;
3218 TRACE("GL extensions reported:\n");
3219 parse_extension_string(gl_info
, GL_Extensions
, gl_extension_map
,
3220 sizeof(gl_extension_map
) / sizeof(*gl_extension_map
));
3222 /* Now work out what GL support this card really has. */
3223 load_gl_funcs( gl_info
);
3225 hdc
= wglGetCurrentDC();
3226 /* Not all GL drivers might offer WGL extensions e.g. VirtualBox. */
3227 if (GL_EXTCALL(wglGetExtensionsStringARB
))
3228 WGL_Extensions
= (const char *)GL_EXTCALL(wglGetExtensionsStringARB(hdc
));
3229 if (!WGL_Extensions
)
3230 WARN("WGL extensions not supported.\n");
3232 parse_extension_string(gl_info
, WGL_Extensions
, wgl_extension_map
,
3233 sizeof(wgl_extension_map
) / sizeof(*wgl_extension_map
));
3235 if (!gl_info
->supported
[EXT_TEXTURE3D
] && gl_version
>= MAKEDWORD_VERSION(1, 2))
3237 TRACE("GL CORE: GL_EXT_texture3D support.\n");
3238 gl_info
->gl_ops
.ext
.p_glTexImage3DEXT
= (void *)gl_info
->gl_ops
.ext
.p_glTexImage3D
;
3239 gl_info
->gl_ops
.ext
.p_glTexSubImage3DEXT
= gl_info
->gl_ops
.ext
.p_glTexSubImage3D
;
3240 gl_info
->supported
[EXT_TEXTURE3D
] = TRUE
;
3243 if (!gl_info
->supported
[NV_POINT_SPRITE
] && gl_version
>= MAKEDWORD_VERSION(1, 4))
3245 TRACE("GL CORE: GL_NV_point_sprite support.\n");
3246 gl_info
->gl_ops
.ext
.p_glPointParameterivNV
= gl_info
->gl_ops
.ext
.p_glPointParameteriv
;
3247 gl_info
->gl_ops
.ext
.p_glPointParameteriNV
= gl_info
->gl_ops
.ext
.p_glPointParameteri
;
3248 gl_info
->supported
[NV_POINT_SPRITE
] = TRUE
;
3251 if (!gl_info
->supported
[ARB_TEXTURE_NON_POWER_OF_TWO
] && gl_version
>= MAKEDWORD_VERSION(2, 0))
3253 TRACE("GL CORE: GL_ARB_texture_non_power_of_two support.\n");
3254 gl_info
->supported
[ARB_TEXTURE_NON_POWER_OF_TWO
] = TRUE
;
3257 if (gl_version
>= MAKEDWORD_VERSION(2, 0)) gl_info
->supported
[WINED3D_GL_VERSION_2_0
] = TRUE
;
3259 if (gl_info
->supported
[APPLE_FENCE
])
3261 /* GL_NV_fence and GL_APPLE_fence provide the same functionality basically.
3262 * The apple extension interacts with some other apple exts. Disable the NV
3263 * extension if the apple one is support to prevent confusion in other parts
3265 gl_info
->supported
[NV_FENCE
] = FALSE
;
3267 if (gl_info
->supported
[APPLE_FLOAT_PIXELS
])
3269 /* GL_APPLE_float_pixels == GL_ARB_texture_float + GL_ARB_half_float_pixel
3271 * The enums are the same:
3272 * GL_RGBA16F_ARB = GL_RGBA_FLOAT16_APPLE = 0x881a
3273 * GL_RGB16F_ARB = GL_RGB_FLOAT16_APPLE = 0x881b
3274 * GL_RGBA32F_ARB = GL_RGBA_FLOAT32_APPLE = 0x8814
3275 * GL_RGB32F_ARB = GL_RGB_FLOAT32_APPLE = 0x8815
3276 * GL_HALF_FLOAT_ARB = GL_HALF_APPLE = 0x140b
3278 if (!gl_info
->supported
[ARB_TEXTURE_FLOAT
])
3280 TRACE(" IMPLIED: GL_ARB_texture_float support (by GL_APPLE_float_pixels).\n");
3281 gl_info
->supported
[ARB_TEXTURE_FLOAT
] = TRUE
;
3283 if (!gl_info
->supported
[ARB_HALF_FLOAT_PIXEL
])
3285 TRACE(" IMPLIED: GL_ARB_half_float_pixel support (by GL_APPLE_float_pixels).\n");
3286 gl_info
->supported
[ARB_HALF_FLOAT_PIXEL
] = TRUE
;
3289 if (gl_info
->supported
[ARB_MAP_BUFFER_RANGE
])
3291 /* GL_ARB_map_buffer_range and GL_APPLE_flush_buffer_range provide the same
3292 * functionality. Prefer the ARB extension */
3293 gl_info
->supported
[APPLE_FLUSH_BUFFER_RANGE
] = FALSE
;
3295 if (gl_info
->supported
[ARB_TEXTURE_CUBE_MAP
])
3297 TRACE(" IMPLIED: NVIDIA (NV) Texture Gen Reflection support.\n");
3298 gl_info
->supported
[NV_TEXGEN_REFLECTION
] = TRUE
;
3300 if (!gl_info
->supported
[ARB_DEPTH_CLAMP
] && gl_info
->supported
[NV_DEPTH_CLAMP
])
3302 TRACE(" IMPLIED: ARB_depth_clamp support (by NV_depth_clamp).\n");
3303 gl_info
->supported
[ARB_DEPTH_CLAMP
] = TRUE
;
3305 if (!gl_info
->supported
[ARB_VERTEX_ARRAY_BGRA
] && gl_info
->supported
[EXT_VERTEX_ARRAY_BGRA
])
3307 TRACE(" IMPLIED: ARB_vertex_array_bgra support (by EXT_vertex_array_bgra).\n");
3308 gl_info
->supported
[ARB_VERTEX_ARRAY_BGRA
] = TRUE
;
3310 if (!gl_info
->supported
[ARB_TEXTURE_COMPRESSION_RGTC
] && gl_info
->supported
[EXT_TEXTURE_COMPRESSION_RGTC
])
3312 TRACE(" IMPLIED: ARB_texture_compression_rgtc support (by EXT_texture_compression_rgtc).\n");
3313 gl_info
->supported
[ARB_TEXTURE_COMPRESSION_RGTC
] = TRUE
;
3315 if (gl_info
->supported
[NV_TEXTURE_SHADER2
])
3317 if (gl_info
->supported
[NV_REGISTER_COMBINERS
])
3319 /* Also disable ATI_FRAGMENT_SHADER if register combiners and texture_shader2
3320 * are supported. The nv extensions provide the same functionality as the
3321 * ATI one, and a bit more(signed pixelformats). */
3322 gl_info
->supported
[ATI_FRAGMENT_SHADER
] = FALSE
;
3325 if (gl_info
->supported
[ARB_TEXTURE_NON_POWER_OF_TWO
])
3327 /* If we have full NP2 texture support, disable
3328 * GL_ARB_texture_rectangle because we will never use it.
3329 * This saves a few redundant glDisable calls. */
3330 gl_info
->supported
[ARB_TEXTURE_RECTANGLE
] = FALSE
;
3332 if (gl_info
->supported
[ATI_FRAGMENT_SHADER
])
3334 /* Disable NV_register_combiners and fragment shader if this is supported.
3335 * generally the NV extensions are preferred over the ATI ones, and this
3336 * extension is disabled if register_combiners and texture_shader2 are both
3337 * supported. So we reach this place only if we have incomplete NV dxlevel 8
3338 * fragment processing support. */
3339 gl_info
->supported
[NV_REGISTER_COMBINERS
] = FALSE
;
3340 gl_info
->supported
[NV_REGISTER_COMBINERS2
] = FALSE
;
3341 gl_info
->supported
[NV_TEXTURE_SHADER
] = FALSE
;
3342 gl_info
->supported
[NV_TEXTURE_SHADER2
] = FALSE
;
3344 if (gl_info
->supported
[NV_HALF_FLOAT
])
3346 /* GL_ARB_half_float_vertex is a subset of GL_NV_half_float. */
3347 gl_info
->supported
[ARB_HALF_FLOAT_VERTEX
] = TRUE
;
3349 if (gl_info
->supported
[ARB_FRAMEBUFFER_SRGB
] && !gl_info
->supported
[EXT_TEXTURE_SRGB_DECODE
])
3351 /* Current wined3d sRGB infrastructure requires EXT_texture_sRGB_decode
3352 * for GL_ARB_framebuffer_sRGB support (without EXT_texture_sRGB_decode
3353 * we never render to sRGB surfaces). */
3354 gl_info
->supported
[ARB_FRAMEBUFFER_SRGB
] = FALSE
;
3356 if (gl_info
->supported
[ARB_OCCLUSION_QUERY
])
3360 GL_EXTCALL(glGetQueryivARB(GL_SAMPLES_PASSED_ARB
, GL_QUERY_COUNTER_BITS_ARB
, &counter_bits
));
3361 TRACE("Occlusion query counter has %d bits.\n", counter_bits
);
3363 gl_info
->supported
[ARB_OCCLUSION_QUERY
] = FALSE
;
3365 if (gl_info
->supported
[ARB_TIMER_QUERY
])
3369 GL_EXTCALL(glGetQueryivARB(GL_TIMESTAMP
, GL_QUERY_COUNTER_BITS_ARB
, &counter_bits
));
3370 TRACE("Timestamp query counter has %d bits.\n", counter_bits
);
3372 gl_info
->supported
[ARB_TIMER_QUERY
] = FALSE
;
3374 if (!gl_info
->supported
[ATI_TEXTURE_MIRROR_ONCE
] && gl_info
->supported
[EXT_TEXTURE_MIRROR_CLAMP
])
3376 TRACE(" IMPLIED: ATI_texture_mirror_once support (by EXT_texture_mirror_clamp).\n");
3377 gl_info
->supported
[ATI_TEXTURE_MIRROR_ONCE
] = TRUE
;
3379 if (!gl_info
->supported
[ARB_TEXTURE_MIRROR_CLAMP_TO_EDGE
] && gl_info
->supported
[ATI_TEXTURE_MIRROR_ONCE
])
3381 TRACE(" IMPLIED: ARB_texture_mirror_clamp_to_edge support (by ATI_texture_mirror_once).\n");
3382 gl_info
->supported
[ARB_TEXTURE_MIRROR_CLAMP_TO_EDGE
] = TRUE
;
3385 wined3d_adapter_init_limits(gl_info
);
3387 if (gl_info
->supported
[ARB_VERTEX_PROGRAM
] && test_arb_vs_offset_limit(gl_info
))
3388 gl_info
->quirks
|= WINED3D_QUIRK_ARB_VS_OFFSET_LIMIT
;
3390 if (gl_info
->supported
[ARB_SHADING_LANGUAGE_100
])
3392 const char *str
= (const char *)gl_info
->gl_ops
.gl
.p_glGetString(GL_SHADING_LANGUAGE_VERSION_ARB
);
3393 unsigned int major
, minor
;
3395 TRACE("GLSL version string: %s.\n", debugstr_a(str
));
3397 /* The format of the GLSL version string is "major.minor[.release] [vendor info]". */
3398 sscanf(str
, "%u.%u", &major
, &minor
);
3399 gl_info
->glsl_version
= MAKEDWORD_VERSION(major
, minor
);
3402 checkGLcall("extension detection");
3404 adapter
->shader_backend
= select_shader_backend(gl_info
);
3405 adapter
->vertex_pipe
= select_vertex_implementation(gl_info
, adapter
->shader_backend
);
3406 adapter
->fragment_pipe
= select_fragment_implementation(gl_info
, adapter
->shader_backend
);
3407 adapter
->blitter
= select_blit_implementation(gl_info
, adapter
->shader_backend
);
3409 adapter
->shader_backend
->shader_get_caps(&adapter
->gl_info
, &shader_caps
);
3410 adapter
->d3d_info
.vs_clipping
= shader_caps
.wined3d_caps
& WINED3D_SHADER_CAP_VS_CLIPPING
;
3411 adapter
->d3d_info
.limits
.vs_version
= shader_caps
.vs_version
;
3412 adapter
->d3d_info
.limits
.gs_version
= shader_caps
.gs_version
;
3413 adapter
->d3d_info
.limits
.ps_version
= shader_caps
.ps_version
;
3414 adapter
->d3d_info
.limits
.vs_uniform_count
= shader_caps
.vs_uniform_count
;
3415 adapter
->d3d_info
.limits
.ps_uniform_count
= shader_caps
.ps_uniform_count
;
3417 adapter
->vertex_pipe
->vp_get_caps(gl_info
, &vertex_caps
);
3418 adapter
->d3d_info
.xyzrhw
= vertex_caps
.xyzrhw
;
3420 adapter
->fragment_pipe
->get_caps(gl_info
, &fragment_caps
);
3421 adapter
->d3d_info
.limits
.ffp_blend_stages
= fragment_caps
.MaxTextureBlendStages
;
3422 adapter
->d3d_info
.limits
.ffp_textures
= fragment_caps
.MaxSimultaneousTextures
;
3423 TRACE("Max texture stages: %u.\n", adapter
->d3d_info
.limits
.ffp_blend_stages
);
3425 if (gl_info
->supported
[ARB_FRAMEBUFFER_OBJECT
])
3427 gl_info
->fbo_ops
.glIsRenderbuffer
= gl_info
->gl_ops
.ext
.p_glIsRenderbuffer
;
3428 gl_info
->fbo_ops
.glBindRenderbuffer
= gl_info
->gl_ops
.ext
.p_glBindRenderbuffer
;
3429 gl_info
->fbo_ops
.glDeleteRenderbuffers
= gl_info
->gl_ops
.ext
.p_glDeleteRenderbuffers
;
3430 gl_info
->fbo_ops
.glGenRenderbuffers
= gl_info
->gl_ops
.ext
.p_glGenRenderbuffers
;
3431 gl_info
->fbo_ops
.glRenderbufferStorage
= gl_info
->gl_ops
.ext
.p_glRenderbufferStorage
;
3432 gl_info
->fbo_ops
.glRenderbufferStorageMultisample
= gl_info
->gl_ops
.ext
.p_glRenderbufferStorageMultisample
;
3433 gl_info
->fbo_ops
.glGetRenderbufferParameteriv
= gl_info
->gl_ops
.ext
.p_glGetRenderbufferParameteriv
;
3434 gl_info
->fbo_ops
.glIsFramebuffer
= gl_info
->gl_ops
.ext
.p_glIsFramebuffer
;
3435 gl_info
->fbo_ops
.glBindFramebuffer
= gl_info
->gl_ops
.ext
.p_glBindFramebuffer
;
3436 gl_info
->fbo_ops
.glDeleteFramebuffers
= gl_info
->gl_ops
.ext
.p_glDeleteFramebuffers
;
3437 gl_info
->fbo_ops
.glGenFramebuffers
= gl_info
->gl_ops
.ext
.p_glGenFramebuffers
;
3438 gl_info
->fbo_ops
.glCheckFramebufferStatus
= gl_info
->gl_ops
.ext
.p_glCheckFramebufferStatus
;
3439 gl_info
->fbo_ops
.glFramebufferTexture1D
= gl_info
->gl_ops
.ext
.p_glFramebufferTexture1D
;
3440 gl_info
->fbo_ops
.glFramebufferTexture2D
= gl_info
->gl_ops
.ext
.p_glFramebufferTexture2D
;
3441 gl_info
->fbo_ops
.glFramebufferTexture3D
= gl_info
->gl_ops
.ext
.p_glFramebufferTexture3D
;
3442 gl_info
->fbo_ops
.glFramebufferRenderbuffer
= gl_info
->gl_ops
.ext
.p_glFramebufferRenderbuffer
;
3443 gl_info
->fbo_ops
.glGetFramebufferAttachmentParameteriv
3444 = gl_info
->gl_ops
.ext
.p_glGetFramebufferAttachmentParameteriv
;
3445 gl_info
->fbo_ops
.glBlitFramebuffer
= gl_info
->gl_ops
.ext
.p_glBlitFramebuffer
;
3446 gl_info
->fbo_ops
.glGenerateMipmap
= gl_info
->gl_ops
.ext
.p_glGenerateMipmap
;
3450 if (gl_info
->supported
[EXT_FRAMEBUFFER_OBJECT
])
3452 gl_info
->fbo_ops
.glIsRenderbuffer
= gl_info
->gl_ops
.ext
.p_glIsRenderbufferEXT
;
3453 gl_info
->fbo_ops
.glBindRenderbuffer
= gl_info
->gl_ops
.ext
.p_glBindRenderbufferEXT
;
3454 gl_info
->fbo_ops
.glDeleteRenderbuffers
= gl_info
->gl_ops
.ext
.p_glDeleteRenderbuffersEXT
;
3455 gl_info
->fbo_ops
.glGenRenderbuffers
= gl_info
->gl_ops
.ext
.p_glGenRenderbuffersEXT
;
3456 gl_info
->fbo_ops
.glRenderbufferStorage
= gl_info
->gl_ops
.ext
.p_glRenderbufferStorageEXT
;
3457 gl_info
->fbo_ops
.glGetRenderbufferParameteriv
= gl_info
->gl_ops
.ext
.p_glGetRenderbufferParameterivEXT
;
3458 gl_info
->fbo_ops
.glIsFramebuffer
= gl_info
->gl_ops
.ext
.p_glIsFramebufferEXT
;
3459 gl_info
->fbo_ops
.glBindFramebuffer
= gl_info
->gl_ops
.ext
.p_glBindFramebufferEXT
;
3460 gl_info
->fbo_ops
.glDeleteFramebuffers
= gl_info
->gl_ops
.ext
.p_glDeleteFramebuffersEXT
;
3461 gl_info
->fbo_ops
.glGenFramebuffers
= gl_info
->gl_ops
.ext
.p_glGenFramebuffersEXT
;
3462 gl_info
->fbo_ops
.glCheckFramebufferStatus
= gl_info
->gl_ops
.ext
.p_glCheckFramebufferStatusEXT
;
3463 gl_info
->fbo_ops
.glFramebufferTexture1D
= gl_info
->gl_ops
.ext
.p_glFramebufferTexture1DEXT
;
3464 gl_info
->fbo_ops
.glFramebufferTexture2D
= gl_info
->gl_ops
.ext
.p_glFramebufferTexture2DEXT
;
3465 gl_info
->fbo_ops
.glFramebufferTexture3D
= gl_info
->gl_ops
.ext
.p_glFramebufferTexture3DEXT
;
3466 gl_info
->fbo_ops
.glFramebufferRenderbuffer
= gl_info
->gl_ops
.ext
.p_glFramebufferRenderbufferEXT
;
3467 gl_info
->fbo_ops
.glGetFramebufferAttachmentParameteriv
3468 = gl_info
->gl_ops
.ext
.p_glGetFramebufferAttachmentParameterivEXT
;
3469 gl_info
->fbo_ops
.glGenerateMipmap
= gl_info
->gl_ops
.ext
.p_glGenerateMipmapEXT
;
3471 else if (wined3d_settings
.offscreen_rendering_mode
== ORM_FBO
)
3473 WARN_(d3d_perf
)("Framebuffer objects not supported, falling back to backbuffer offscreen rendering mode.\n");
3474 wined3d_settings
.offscreen_rendering_mode
= ORM_BACKBUFFER
;
3476 if (gl_info
->supported
[EXT_FRAMEBUFFER_BLIT
])
3478 gl_info
->fbo_ops
.glBlitFramebuffer
= gl_info
->gl_ops
.ext
.p_glBlitFramebufferEXT
;
3480 if (gl_info
->supported
[EXT_FRAMEBUFFER_MULTISAMPLE
])
3482 gl_info
->fbo_ops
.glRenderbufferStorageMultisample
3483 = gl_info
->gl_ops
.ext
.p_glRenderbufferStorageMultisampleEXT
;
3487 gl_vendor
= wined3d_guess_gl_vendor(gl_info
, gl_vendor_str
, gl_renderer_str
);
3488 card_vendor
= wined3d_guess_card_vendor(gl_vendor_str
, gl_renderer_str
);
3489 TRACE("Found GL_VENDOR (%s)->(0x%04x/0x%04x).\n", debugstr_a(gl_vendor_str
), gl_vendor
, card_vendor
);
3491 device
= wined3d_guess_card(&shader_caps
, &fragment_caps
, gl_info
->glsl_version
, gl_renderer_str
, &gl_vendor
, &card_vendor
);
3492 TRACE("Found (fake) card: 0x%x (vendor id), 0x%x (device id).\n", card_vendor
, device
);
3494 gl_info
->wrap_lookup
[WINED3D_TADDRESS_WRAP
- WINED3D_TADDRESS_WRAP
] = GL_REPEAT
;
3495 gl_info
->wrap_lookup
[WINED3D_TADDRESS_MIRROR
- WINED3D_TADDRESS_WRAP
] =
3496 gl_info
->supported
[ARB_TEXTURE_MIRRORED_REPEAT
] ? GL_MIRRORED_REPEAT_ARB
: GL_REPEAT
;
3497 gl_info
->wrap_lookup
[WINED3D_TADDRESS_CLAMP
- WINED3D_TADDRESS_WRAP
] = GL_CLAMP_TO_EDGE
;
3498 gl_info
->wrap_lookup
[WINED3D_TADDRESS_BORDER
- WINED3D_TADDRESS_WRAP
] =
3499 gl_info
->supported
[ARB_TEXTURE_BORDER_CLAMP
] ? GL_CLAMP_TO_BORDER_ARB
: GL_REPEAT
;
3500 gl_info
->wrap_lookup
[WINED3D_TADDRESS_MIRROR_ONCE
- WINED3D_TADDRESS_WRAP
] =
3501 gl_info
->supported
[ARB_TEXTURE_MIRROR_CLAMP_TO_EDGE
] ? GL_MIRROR_CLAMP_TO_EDGE
: GL_REPEAT
;
3503 adapter
->d3d_info
.valid_rt_mask
= 0;
3504 for (i
= 0; i
< gl_info
->limits
.buffers
; ++i
)
3505 adapter
->d3d_info
.valid_rt_mask
|= (1 << i
);
3507 fixup_extensions(gl_info
, gl_renderer_str
, gl_vendor
, card_vendor
, device
);
3508 init_driver_info(driver_info
, card_vendor
, device
);
3509 add_gl_compat_wrappers(gl_info
);
3514 UINT CDECL
wined3d_get_adapter_count(const struct wined3d
*wined3d
)
3516 TRACE("wined3d %p, reporting %u adapters.\n",
3517 wined3d
, wined3d
->adapter_count
);
3519 return wined3d
->adapter_count
;
3522 HRESULT CDECL
wined3d_register_software_device(struct wined3d
*wined3d
, void *init_function
)
3524 FIXME("wined3d %p, init_function %p stub!\n", wined3d
, init_function
);
3529 HMONITOR CDECL
wined3d_get_adapter_monitor(const struct wined3d
*wined3d
, UINT adapter_idx
)
3531 TRACE("wined3d %p, adapter_idx %u.\n", wined3d
, adapter_idx
);
3533 if (adapter_idx
>= wined3d
->adapter_count
)
3536 return MonitorFromPoint(wined3d
->adapters
[adapter_idx
].monitorPoint
, MONITOR_DEFAULTTOPRIMARY
);
3539 /* FIXME: GetAdapterModeCount and EnumAdapterModes currently only returns modes
3540 of the same bpp but different resolutions */
3542 /* Note: dx9 supplies a format. Calls from d3d8 supply WINED3DFMT_UNKNOWN */
3543 UINT CDECL
wined3d_get_adapter_mode_count(const struct wined3d
*wined3d
, UINT adapter_idx
,
3544 enum wined3d_format_id format_id
, enum wined3d_scanline_ordering scanline_ordering
)
3546 const struct wined3d_adapter
*adapter
;
3547 const struct wined3d_format
*format
;
3553 TRACE("wined3d %p, adapter_idx %u, format %s, scanline_ordering %#x.\n",
3554 wined3d
, adapter_idx
, debug_d3dformat(format_id
), scanline_ordering
);
3556 if (adapter_idx
>= wined3d
->adapter_count
)
3559 adapter
= &wined3d
->adapters
[adapter_idx
];
3560 format
= wined3d_get_format(&adapter
->gl_info
, format_id
);
3561 format_bits
= format
->byte_count
* CHAR_BIT
;
3563 memset(&mode
, 0, sizeof(mode
));
3564 mode
.dmSize
= sizeof(mode
);
3566 while (EnumDisplaySettingsExW(adapter
->DeviceName
, j
++, &mode
, 0))
3568 if (mode
.dmFields
& DM_DISPLAYFLAGS
)
3570 if (scanline_ordering
== WINED3D_SCANLINE_ORDERING_PROGRESSIVE
3571 && (mode
.u2
.dmDisplayFlags
& DM_INTERLACED
))
3574 if (scanline_ordering
== WINED3D_SCANLINE_ORDERING_INTERLACED
3575 && !(mode
.u2
.dmDisplayFlags
& DM_INTERLACED
))
3579 if (format_id
== WINED3DFMT_UNKNOWN
)
3581 /* This is for d3d8, do not enumerate P8 here. */
3582 if (mode
.dmBitsPerPel
== 32 || mode
.dmBitsPerPel
== 16) ++i
;
3584 else if (mode
.dmBitsPerPel
== format_bits
)
3590 TRACE("Returning %u matching modes (out of %u total) for adapter %u.\n", i
, j
, adapter_idx
);
3595 /* Note: dx9 supplies a format. Calls from d3d8 supply WINED3DFMT_UNKNOWN */
3596 HRESULT CDECL
wined3d_enum_adapter_modes(const struct wined3d
*wined3d
, UINT adapter_idx
,
3597 enum wined3d_format_id format_id
, enum wined3d_scanline_ordering scanline_ordering
,
3598 UINT mode_idx
, struct wined3d_display_mode
*mode
)
3600 const struct wined3d_adapter
*adapter
;
3601 const struct wined3d_format
*format
;
3607 TRACE("wined3d %p, adapter_idx %u, format %s, scanline_ordering %#x, mode_idx %u, mode %p.\n",
3608 wined3d
, adapter_idx
, debug_d3dformat(format_id
), scanline_ordering
, mode_idx
, mode
);
3610 if (!mode
|| adapter_idx
>= wined3d
->adapter_count
)
3611 return WINED3DERR_INVALIDCALL
;
3613 adapter
= &wined3d
->adapters
[adapter_idx
];
3614 format
= wined3d_get_format(&adapter
->gl_info
, format_id
);
3615 format_bits
= format
->byte_count
* CHAR_BIT
;
3617 memset(&m
, 0, sizeof(m
));
3618 m
.dmSize
= sizeof(m
);
3620 while (i
<= mode_idx
)
3622 if (!EnumDisplaySettingsExW(adapter
->DeviceName
, j
++, &m
, 0))
3624 WARN("Invalid mode_idx %u.\n", mode_idx
);
3625 return WINED3DERR_INVALIDCALL
;
3628 if (m
.dmFields
& DM_DISPLAYFLAGS
)
3630 if (scanline_ordering
== WINED3D_SCANLINE_ORDERING_PROGRESSIVE
3631 && (m
.u2
.dmDisplayFlags
& DM_INTERLACED
))
3634 if (scanline_ordering
== WINED3D_SCANLINE_ORDERING_INTERLACED
3635 && !(m
.u2
.dmDisplayFlags
& DM_INTERLACED
))
3639 if (format_id
== WINED3DFMT_UNKNOWN
)
3641 /* This is for d3d8, do not enumerate P8 here. */
3642 if (m
.dmBitsPerPel
== 32 || m
.dmBitsPerPel
== 16) ++i
;
3644 else if (m
.dmBitsPerPel
== format_bits
)
3650 mode
->width
= m
.dmPelsWidth
;
3651 mode
->height
= m
.dmPelsHeight
;
3652 mode
->refresh_rate
= DEFAULT_REFRESH_RATE
;
3653 if (m
.dmFields
& DM_DISPLAYFREQUENCY
)
3654 mode
->refresh_rate
= m
.dmDisplayFrequency
;
3656 if (format_id
== WINED3DFMT_UNKNOWN
)
3657 mode
->format_id
= pixelformat_for_depth(m
.dmBitsPerPel
);
3659 mode
->format_id
= format_id
;
3661 if (!(m
.dmFields
& DM_DISPLAYFLAGS
))
3662 mode
->scanline_ordering
= WINED3D_SCANLINE_ORDERING_UNKNOWN
;
3663 else if (m
.u2
.dmDisplayFlags
& DM_INTERLACED
)
3664 mode
->scanline_ordering
= WINED3D_SCANLINE_ORDERING_INTERLACED
;
3666 mode
->scanline_ordering
= WINED3D_SCANLINE_ORDERING_PROGRESSIVE
;
3668 TRACE("%ux%u@%u %u bpp, %s %#x.\n", mode
->width
, mode
->height
, mode
->refresh_rate
,
3669 m
.dmBitsPerPel
, debug_d3dformat(mode
->format_id
), mode
->scanline_ordering
);
3674 HRESULT CDECL
wined3d_get_adapter_display_mode(const struct wined3d
*wined3d
, UINT adapter_idx
,
3675 struct wined3d_display_mode
*mode
, enum wined3d_display_rotation
*rotation
)
3677 const struct wined3d_adapter
*adapter
;
3680 TRACE("wined3d %p, adapter_idx %u, display_mode %p, rotation %p.\n",
3681 wined3d
, adapter_idx
, mode
, rotation
);
3683 if (!mode
|| adapter_idx
>= wined3d
->adapter_count
)
3684 return WINED3DERR_INVALIDCALL
;
3686 adapter
= &wined3d
->adapters
[adapter_idx
];
3688 memset(&m
, 0, sizeof(m
));
3689 m
.dmSize
= sizeof(m
);
3691 EnumDisplaySettingsExW(adapter
->DeviceName
, ENUM_CURRENT_SETTINGS
, &m
, 0);
3692 mode
->width
= m
.dmPelsWidth
;
3693 mode
->height
= m
.dmPelsHeight
;
3694 mode
->refresh_rate
= DEFAULT_REFRESH_RATE
;
3695 if (m
.dmFields
& DM_DISPLAYFREQUENCY
)
3696 mode
->refresh_rate
= m
.dmDisplayFrequency
;
3697 mode
->format_id
= pixelformat_for_depth(m
.dmBitsPerPel
);
3699 /* Lie about the format. X11 can't change the color depth, and some apps
3700 * are pretty angry if they SetDisplayMode from 24 to 16 bpp and find out
3701 * that GetDisplayMode still returns 24 bpp. This should probably be
3702 * handled in winex11 instead. */
3703 if (adapter
->screen_format
&& adapter
->screen_format
!= mode
->format_id
)
3705 WARN("Overriding format %s with stored format %s.\n",
3706 debug_d3dformat(mode
->format_id
),
3707 debug_d3dformat(adapter
->screen_format
));
3708 mode
->format_id
= adapter
->screen_format
;
3711 if (!(m
.dmFields
& DM_DISPLAYFLAGS
))
3712 mode
->scanline_ordering
= WINED3D_SCANLINE_ORDERING_UNKNOWN
;
3713 else if (m
.u2
.dmDisplayFlags
& DM_INTERLACED
)
3714 mode
->scanline_ordering
= WINED3D_SCANLINE_ORDERING_INTERLACED
;
3716 mode
->scanline_ordering
= WINED3D_SCANLINE_ORDERING_PROGRESSIVE
;
3720 switch (m
.u1
.s2
.dmDisplayOrientation
)
3723 *rotation
= WINED3D_DISPLAY_ROTATION_0
;
3726 *rotation
= WINED3D_DISPLAY_ROTATION_90
;
3729 *rotation
= WINED3D_DISPLAY_ROTATION_180
;
3732 *rotation
= WINED3D_DISPLAY_ROTATION_270
;
3735 FIXME("Unhandled display rotation %#x.\n", m
.u1
.s2
.dmDisplayOrientation
);
3736 *rotation
= WINED3D_DISPLAY_ROTATION_UNSPECIFIED
;
3741 TRACE("Returning %ux%u@%u %s %#x.\n", mode
->width
, mode
->height
,
3742 mode
->refresh_rate
, debug_d3dformat(mode
->format_id
),
3743 mode
->scanline_ordering
);
3747 HRESULT CDECL
wined3d_set_adapter_display_mode(struct wined3d
*wined3d
,
3748 UINT adapter_idx
, const struct wined3d_display_mode
*mode
)
3750 struct wined3d_adapter
*adapter
;
3751 DEVMODEW new_mode
, current_mode
;
3754 enum wined3d_format_id new_format_id
;
3756 TRACE("wined3d %p, adapter_idx %u, mode %p.\n", wined3d
, adapter_idx
, mode
);
3758 if (adapter_idx
>= wined3d
->adapter_count
)
3759 return WINED3DERR_INVALIDCALL
;
3760 adapter
= &wined3d
->adapters
[adapter_idx
];
3762 memset(&new_mode
, 0, sizeof(new_mode
));
3763 new_mode
.dmSize
= sizeof(new_mode
);
3764 memset(¤t_mode
, 0, sizeof(current_mode
));
3765 current_mode
.dmSize
= sizeof(current_mode
);
3768 const struct wined3d_format
*format
;
3770 TRACE("mode %ux%u@%u %s %#x.\n", mode
->width
, mode
->height
, mode
->refresh_rate
,
3771 debug_d3dformat(mode
->format_id
), mode
->scanline_ordering
);
3773 format
= wined3d_get_format(&adapter
->gl_info
, mode
->format_id
);
3775 new_mode
.dmFields
= DM_BITSPERPEL
| DM_PELSWIDTH
| DM_PELSHEIGHT
;
3776 new_mode
.dmBitsPerPel
= format
->byte_count
* CHAR_BIT
;
3777 new_mode
.dmPelsWidth
= mode
->width
;
3778 new_mode
.dmPelsHeight
= mode
->height
;
3780 new_mode
.dmDisplayFrequency
= mode
->refresh_rate
;
3781 if (mode
->refresh_rate
)
3782 new_mode
.dmFields
|= DM_DISPLAYFREQUENCY
;
3784 if (mode
->scanline_ordering
!= WINED3D_SCANLINE_ORDERING_UNKNOWN
)
3786 new_mode
.dmFields
|= DM_DISPLAYFLAGS
;
3787 if (mode
->scanline_ordering
== WINED3D_SCANLINE_ORDERING_INTERLACED
)
3788 new_mode
.u2
.dmDisplayFlags
|= DM_INTERLACED
;
3790 new_format_id
= mode
->format_id
;
3794 if (!EnumDisplaySettingsW(adapter
->DeviceName
, ENUM_REGISTRY_SETTINGS
, &new_mode
))
3796 ERR("Failed to read mode from registry.\n");
3797 return WINED3DERR_NOTAVAILABLE
;
3799 new_format_id
= pixelformat_for_depth(new_mode
.dmBitsPerPel
);
3802 /* Only change the mode if necessary. */
3803 if (!EnumDisplaySettingsW(adapter
->DeviceName
, ENUM_CURRENT_SETTINGS
, ¤t_mode
))
3805 ERR("Failed to get current display mode.\n");
3807 else if (current_mode
.dmPelsWidth
== new_mode
.dmPelsWidth
3808 && current_mode
.dmPelsHeight
== new_mode
.dmPelsHeight
3809 && current_mode
.dmBitsPerPel
== new_mode
.dmBitsPerPel
3810 && (current_mode
.dmDisplayFrequency
== new_mode
.dmDisplayFrequency
3811 || !(new_mode
.dmFields
& DM_DISPLAYFREQUENCY
))
3812 && (current_mode
.u2
.dmDisplayFlags
== new_mode
.u2
.dmDisplayFlags
3813 || !(new_mode
.dmFields
& DM_DISPLAYFLAGS
)))
3815 TRACE("Skipping redundant mode setting call.\n");
3819 ret
= ChangeDisplaySettingsExW(adapter
->DeviceName
, &new_mode
, NULL
, CDS_FULLSCREEN
, NULL
);
3820 if (ret
!= DISP_CHANGE_SUCCESSFUL
)
3822 if (new_mode
.dmFields
& DM_DISPLAYFREQUENCY
)
3824 WARN("ChangeDisplaySettingsExW failed, trying without the refresh rate.\n");
3825 new_mode
.dmFields
&= ~DM_DISPLAYFREQUENCY
;
3826 new_mode
.dmDisplayFrequency
= 0;
3827 ret
= ChangeDisplaySettingsExW(adapter
->DeviceName
, &new_mode
, NULL
, CDS_FULLSCREEN
, NULL
);
3829 if (ret
!= DISP_CHANGE_SUCCESSFUL
)
3830 return WINED3DERR_NOTAVAILABLE
;
3833 /* Store the new values. */
3834 adapter
->screen_format
= new_format_id
;
3836 /* And finally clip mouse to our screen. */
3837 SetRect(&clip_rc
, 0, 0, new_mode
.dmPelsWidth
, new_mode
.dmPelsHeight
);
3838 ClipCursor(&clip_rc
);
3843 /* NOTE: due to structure differences between dx8 and dx9 D3DADAPTER_IDENTIFIER,
3844 and fields being inserted in the middle, a new structure is used in place */
3845 HRESULT CDECL
wined3d_get_adapter_identifier(const struct wined3d
*wined3d
,
3846 UINT adapter_idx
, DWORD flags
, struct wined3d_adapter_identifier
*identifier
)
3848 const struct wined3d_adapter
*adapter
;
3851 TRACE("wined3d %p, adapter_idx %u, flags %#x, identifier %p.\n",
3852 wined3d
, adapter_idx
, flags
, identifier
);
3854 if (adapter_idx
>= wined3d
->adapter_count
)
3855 return WINED3DERR_INVALIDCALL
;
3857 adapter
= &wined3d
->adapters
[adapter_idx
];
3859 if (identifier
->driver_size
)
3861 const char *name
= adapter
->driver_info
.name
;
3862 len
= min(strlen(name
), identifier
->driver_size
- 1);
3863 memcpy(identifier
->driver
, name
, len
);
3864 memset(&identifier
->driver
[len
], 0, identifier
->driver_size
- len
);
3867 if (identifier
->description_size
)
3869 const char *description
= adapter
->driver_info
.description
;
3870 len
= min(strlen(description
), identifier
->description_size
- 1);
3871 memcpy(identifier
->description
, description
, len
);
3872 memset(&identifier
->description
[len
], 0, identifier
->description_size
- len
);
3875 /* Note that d3d8 doesn't supply a device name. */
3876 if (identifier
->device_name_size
)
3878 if (!WideCharToMultiByte(CP_ACP
, 0, adapter
->DeviceName
, -1, identifier
->device_name
,
3879 identifier
->device_name_size
, NULL
, NULL
))
3881 ERR("Failed to convert device name, last error %#x.\n", GetLastError());
3882 return WINED3DERR_INVALIDCALL
;
3886 identifier
->driver_version
.u
.HighPart
= adapter
->driver_info
.version_high
;
3887 identifier
->driver_version
.u
.LowPart
= adapter
->driver_info
.version_low
;
3888 identifier
->vendor_id
= adapter
->driver_info
.vendor
;
3889 identifier
->device_id
= adapter
->driver_info
.device
;
3890 identifier
->subsystem_id
= 0;
3891 identifier
->revision
= 0;
3892 memcpy(&identifier
->device_identifier
, &IID_D3DDEVICE_D3DUID
, sizeof(identifier
->device_identifier
));
3893 identifier
->whql_level
= (flags
& WINED3DENUM_NO_WHQL_LEVEL
) ? 0 : 1;
3894 memcpy(&identifier
->adapter_luid
, &adapter
->luid
, sizeof(identifier
->adapter_luid
));
3895 identifier
->video_memory
= min(~(SIZE_T
)0, adapter
->vram_bytes
);
3900 HRESULT CDECL
wined3d_get_adapter_raster_status(const struct wined3d
*wined3d
, UINT adapter_idx
,
3901 struct wined3d_raster_status
*raster_status
)
3903 LONGLONG freq_per_frame
, freq_per_line
;
3904 LARGE_INTEGER counter
, freq_per_sec
;
3905 struct wined3d_display_mode mode
;
3909 FIXME("wined3d %p, adapter_idx %u, raster_status %p semi-stub!\n",
3910 wined3d
, adapter_idx
, raster_status
);
3912 WARN("wined3d %p, adapter_idx %u, raster_status %p semi-stub!\n",
3913 wined3d
, adapter_idx
, raster_status
);
3915 /* Obtaining the raster status is a widely implemented but optional
3916 * feature. When this method returns OK StarCraft 2 expects the
3917 * raster_status->InVBlank value to actually change over time.
3918 * And Endless Alice Crysis doesn't care even if this method fails.
3919 * Thus this method returns OK and fakes raster_status by
3920 * QueryPerformanceCounter. */
3922 if (!QueryPerformanceCounter(&counter
) || !QueryPerformanceFrequency(&freq_per_sec
))
3923 return WINED3DERR_INVALIDCALL
;
3924 if (FAILED(wined3d_get_adapter_display_mode(wined3d
, adapter_idx
, &mode
, NULL
)))
3925 return WINED3DERR_INVALIDCALL
;
3926 if (mode
.refresh_rate
== DEFAULT_REFRESH_RATE
)
3927 mode
.refresh_rate
= 60;
3929 freq_per_frame
= freq_per_sec
.QuadPart
/ mode
.refresh_rate
;
3930 /* Assume 20 scan lines in the vertical blank. */
3931 freq_per_line
= freq_per_frame
/ (mode
.height
+ 20);
3932 raster_status
->scan_line
= (counter
.QuadPart
% freq_per_frame
) / freq_per_line
;
3933 if (raster_status
->scan_line
< mode
.height
)
3934 raster_status
->in_vblank
= FALSE
;
3937 raster_status
->scan_line
= 0;
3938 raster_status
->in_vblank
= TRUE
;
3941 TRACE("Returning fake value, in_vblank %u, scan_line %u.\n",
3942 raster_status
->in_vblank
, raster_status
->scan_line
);
3947 static BOOL
wined3d_check_pixel_format_color(const struct wined3d_gl_info
*gl_info
,
3948 const struct wined3d_pixel_format
*cfg
, const struct wined3d_format
*format
)
3950 BYTE redSize
, greenSize
, blueSize
, alphaSize
, colorBits
;
3952 /* Float formats need FBOs. If FBOs are used this function isn't called */
3953 if (format
->flags
& WINED3DFMT_FLAG_FLOAT
) return FALSE
;
3955 if(cfg
->iPixelType
== WGL_TYPE_RGBA_ARB
) { /* Integer RGBA formats */
3956 if (!getColorBits(format
, &redSize
, &greenSize
, &blueSize
, &alphaSize
, &colorBits
))
3958 ERR("Unable to check compatibility for format %s.\n", debug_d3dformat(format
->id
));
3962 if(cfg
->redSize
< redSize
)
3965 if(cfg
->greenSize
< greenSize
)
3968 if(cfg
->blueSize
< blueSize
)
3971 if(cfg
->alphaSize
< alphaSize
)
3977 /* Probably a RGBA_float or color index mode */
3981 static BOOL
wined3d_check_pixel_format_depth(const struct wined3d_gl_info
*gl_info
,
3982 const struct wined3d_pixel_format
*cfg
, const struct wined3d_format
*format
)
3984 BYTE depthSize
, stencilSize
;
3985 BOOL lockable
= FALSE
;
3987 if (!getDepthStencilBits(format
, &depthSize
, &stencilSize
))
3989 ERR("Unable to check compatibility for format %s.\n", debug_d3dformat(format
->id
));
3993 /* Float formats need FBOs. If FBOs are used this function isn't called */
3994 if (format
->flags
& WINED3DFMT_FLAG_FLOAT
) return FALSE
;
3996 if ((format
->id
== WINED3DFMT_D16_LOCKABLE
) || (format
->id
== WINED3DFMT_D32_FLOAT
))
3999 /* On some modern cards like the Geforce8/9 GLX doesn't offer some dephthstencil formats which D3D9 reports.
4000 * We can safely report 'compatible' formats (e.g. D24 can be used for D16) as long as we aren't dealing with
4001 * a lockable format. This also helps D3D <= 7 as they expect D16 which isn't offered without this on Geforce8 cards. */
4002 if(!(cfg
->depthSize
== depthSize
|| (!lockable
&& cfg
->depthSize
> depthSize
)))
4005 /* Some cards like Intel i915 ones only offer D24S8 but lots of games also need a format without stencil, so
4006 * allow more stencil bits than requested. */
4007 if(cfg
->stencilSize
< stencilSize
)
4013 HRESULT CDECL
wined3d_check_depth_stencil_match(const struct wined3d
*wined3d
,
4014 UINT adapter_idx
, enum wined3d_device_type device_type
, enum wined3d_format_id adapter_format_id
,
4015 enum wined3d_format_id render_target_format_id
, enum wined3d_format_id depth_stencil_format_id
)
4017 const struct wined3d_format
*rt_format
;
4018 const struct wined3d_format
*ds_format
;
4019 const struct wined3d_adapter
*adapter
;
4021 TRACE("wined3d %p, adapter_idx %u, device_type %s,\n"
4022 "adapter_format %s, render_target_format %s, depth_stencil_format %s.\n",
4023 wined3d
, adapter_idx
, debug_d3ddevicetype(device_type
), debug_d3dformat(adapter_format_id
),
4024 debug_d3dformat(render_target_format_id
), debug_d3dformat(depth_stencil_format_id
));
4026 if (adapter_idx
>= wined3d
->adapter_count
)
4027 return WINED3DERR_INVALIDCALL
;
4029 adapter
= &wined3d
->adapters
[adapter_idx
];
4030 rt_format
= wined3d_get_format(&adapter
->gl_info
, render_target_format_id
);
4031 ds_format
= wined3d_get_format(&adapter
->gl_info
, depth_stencil_format_id
);
4032 if (wined3d_settings
.offscreen_rendering_mode
== ORM_FBO
)
4034 if ((rt_format
->flags
& WINED3DFMT_FLAG_RENDERTARGET
)
4035 && (ds_format
->flags
& (WINED3DFMT_FLAG_DEPTH
| WINED3DFMT_FLAG_STENCIL
)))
4037 TRACE("Formats match.\n");
4043 const struct wined3d_pixel_format
*cfgs
;
4044 unsigned int cfg_count
;
4047 cfgs
= adapter
->cfgs
;
4048 cfg_count
= adapter
->cfg_count
;
4049 for (i
= 0; i
< cfg_count
; ++i
)
4051 if (wined3d_check_pixel_format_color(&adapter
->gl_info
, &cfgs
[i
], rt_format
)
4052 && wined3d_check_pixel_format_depth(&adapter
->gl_info
, &cfgs
[i
], ds_format
))
4054 TRACE("Formats match.\n");
4060 TRACE("Unsupported format pair: %s and %s.\n",
4061 debug_d3dformat(render_target_format_id
),
4062 debug_d3dformat(depth_stencil_format_id
));
4064 return WINED3DERR_NOTAVAILABLE
;
4067 HRESULT CDECL
wined3d_check_device_multisample_type(const struct wined3d
*wined3d
, UINT adapter_idx
,
4068 enum wined3d_device_type device_type
, enum wined3d_format_id surface_format_id
, BOOL windowed
,
4069 enum wined3d_multisample_type multisample_type
, DWORD
*quality_levels
)
4071 const struct wined3d_gl_info
*gl_info
;
4073 TRACE("wined3d %p, adapter_idx %u, device_type %s, surface_format %s,\n"
4074 "windowed %#x, multisample_type %#x, quality_levels %p.\n",
4075 wined3d
, adapter_idx
, debug_d3ddevicetype(device_type
), debug_d3dformat(surface_format_id
),
4076 windowed
, multisample_type
, quality_levels
);
4078 if (adapter_idx
>= wined3d
->adapter_count
)
4079 return WINED3DERR_INVALIDCALL
;
4081 gl_info
= &wined3d
->adapters
[adapter_idx
].gl_info
;
4083 if (multisample_type
> gl_info
->limits
.samples
)
4085 TRACE("Returning not supported.\n");
4087 *quality_levels
= 0;
4089 return WINED3DERR_NOTAVAILABLE
;
4094 if (multisample_type
== WINED3D_MULTISAMPLE_NON_MASKABLE
)
4095 /* FIXME: This is probably wrong. */
4096 *quality_levels
= gl_info
->limits
.samples
;
4098 *quality_levels
= 1;
4104 /* Check if the given DisplayFormat + DepthStencilFormat combination is valid for the Adapter */
4105 static BOOL
CheckDepthStencilCapability(const struct wined3d_adapter
*adapter
,
4106 const struct wined3d_format
*display_format
, const struct wined3d_format
*ds_format
)
4108 /* Only allow depth/stencil formats */
4109 if (!(ds_format
->depth_size
|| ds_format
->stencil_size
)) return FALSE
;
4111 /* Blacklist formats not supported on Windows */
4112 switch (ds_format
->id
)
4114 case WINED3DFMT_S1_UINT_D15_UNORM
: /* Breaks the shadowvol2 dx7 sdk sample */
4115 case WINED3DFMT_S4X4_UINT_D24_UNORM
:
4116 TRACE("[FAILED] - not supported on windows.\n");
4123 if (wined3d_settings
.offscreen_rendering_mode
== ORM_FBO
)
4125 /* With FBOs WGL limitations do not apply, but the format needs to be FBO attachable */
4126 if (ds_format
->flags
& (WINED3DFMT_FLAG_DEPTH
| WINED3DFMT_FLAG_STENCIL
)) return TRUE
;
4132 /* Walk through all WGL pixel formats to find a match */
4133 for (i
= 0; i
< adapter
->cfg_count
; ++i
)
4135 const struct wined3d_pixel_format
*cfg
= &adapter
->cfgs
[i
];
4136 if (wined3d_check_pixel_format_color(&adapter
->gl_info
, cfg
, display_format
)
4137 && wined3d_check_pixel_format_depth(&adapter
->gl_info
, cfg
, ds_format
))
4145 /* Check the render target capabilities of a format */
4146 static BOOL
CheckRenderTargetCapability(const struct wined3d_adapter
*adapter
,
4147 const struct wined3d_format
*adapter_format
, const struct wined3d_format
*check_format
)
4149 /* Filter out non-RT formats */
4150 if (!(check_format
->flags
& WINED3DFMT_FLAG_RENDERTARGET
)) return FALSE
;
4151 if (wined3d_settings
.offscreen_rendering_mode
== ORM_BACKBUFFER
)
4153 BYTE AdapterRed
, AdapterGreen
, AdapterBlue
, AdapterAlpha
, AdapterTotalSize
;
4154 BYTE CheckRed
, CheckGreen
, CheckBlue
, CheckAlpha
, CheckTotalSize
;
4155 const struct wined3d_pixel_format
*cfgs
= adapter
->cfgs
;
4158 getColorBits(adapter_format
, &AdapterRed
, &AdapterGreen
, &AdapterBlue
, &AdapterAlpha
, &AdapterTotalSize
);
4159 getColorBits(check_format
, &CheckRed
, &CheckGreen
, &CheckBlue
, &CheckAlpha
, &CheckTotalSize
);
4161 /* In backbuffer mode the front and backbuffer share the same WGL pixelformat.
4162 * The format must match in RGB, alpha is allowed to be different. (Only the backbuffer can have alpha) */
4163 if (!((AdapterRed
== CheckRed
) && (AdapterGreen
== CheckGreen
) && (AdapterBlue
== CheckBlue
)))
4165 TRACE("[FAILED]\n");
4169 /* Check if there is a WGL pixel format matching the requirements, the format should also be window
4170 * drawable (not offscreen; e.g. Nvidia offers R5G6B5 for pbuffers even when X is running at 24bit) */
4171 for (i
= 0; i
< adapter
->cfg_count
; ++i
)
4173 if (cfgs
[i
].windowDrawable
4174 && wined3d_check_pixel_format_color(&adapter
->gl_info
, &cfgs
[i
], check_format
))
4176 TRACE("Pixel format %d is compatible with format %s.\n",
4177 cfgs
[i
].iPixelFormat
, debug_d3dformat(check_format
->id
));
4182 else if(wined3d_settings
.offscreen_rendering_mode
== ORM_FBO
)
4184 /* For now return TRUE for FBOs until we have some proper checks.
4185 * Note that this function will only be called when the format is around for texturing. */
4191 static BOOL
CheckSurfaceCapability(const struct wined3d_adapter
*adapter
,
4192 const struct wined3d_format
*adapter_format
,
4193 const struct wined3d_format
*check_format
, BOOL no3d
)
4197 switch (check_format
->id
)
4199 case WINED3DFMT_B8G8R8_UNORM
:
4200 TRACE("[FAILED] - Not enumerated on Windows.\n");
4202 case WINED3DFMT_B8G8R8A8_UNORM
:
4203 case WINED3DFMT_B8G8R8X8_UNORM
:
4204 case WINED3DFMT_B5G6R5_UNORM
:
4205 case WINED3DFMT_B5G5R5X1_UNORM
:
4206 case WINED3DFMT_B5G5R5A1_UNORM
:
4207 case WINED3DFMT_B4G4R4A4_UNORM
:
4208 case WINED3DFMT_B2G3R3_UNORM
:
4209 case WINED3DFMT_A8_UNORM
:
4210 case WINED3DFMT_B2G3R3A8_UNORM
:
4211 case WINED3DFMT_B4G4R4X4_UNORM
:
4212 case WINED3DFMT_R10G10B10A2_UNORM
:
4213 case WINED3DFMT_R8G8B8A8_UNORM
:
4214 case WINED3DFMT_R8G8B8X8_UNORM
:
4215 case WINED3DFMT_R16G16_UNORM
:
4216 case WINED3DFMT_B10G10R10A2_UNORM
:
4217 case WINED3DFMT_R16G16B16A16_UNORM
:
4218 case WINED3DFMT_P8_UINT
:
4222 TRACE("[FAILED] - Not available on GDI surfaces.\n");
4227 /* All formats that are supported for textures are supported for surfaces
4229 if (check_format
->flags
& WINED3DFMT_FLAG_TEXTURE
)
4231 /* All depth stencil formats are supported on surfaces */
4232 if (CheckDepthStencilCapability(adapter
, adapter_format
, check_format
)) return TRUE
;
4234 /* If opengl can't process the format natively, the blitter may be able to convert it */
4235 if (adapter
->blitter
->blit_supported(&adapter
->gl_info
, WINED3D_BLIT_OP_COLOR_BLIT
,
4236 NULL
, WINED3D_POOL_DEFAULT
, 0, check_format
,
4237 NULL
, WINED3D_POOL_DEFAULT
, 0, adapter_format
))
4243 /* Reject other formats */
4244 TRACE("[FAILED]\n");
4248 /* OpenGL supports mipmapping on all formats. Wrapping is unsupported, but we
4249 * have to report mipmapping so we cannot reject WRAPANDMIP. Tests show that
4250 * Windows reports WRAPANDMIP on unfilterable surfaces as well, apparently to
4251 * show that wrapping is supported. The lack of filtering will sort out the
4252 * mipmapping capability anyway.
4254 * For now lets report this on all formats, but in the future we may want to
4255 * restrict it to some should applications need that. */
4256 HRESULT CDECL
wined3d_check_device_format(const struct wined3d
*wined3d
, UINT adapter_idx
,
4257 enum wined3d_device_type device_type
, enum wined3d_format_id adapter_format_id
, DWORD usage
,
4258 enum wined3d_resource_type resource_type
, enum wined3d_format_id check_format_id
)
4260 const struct wined3d_adapter
*adapter
= &wined3d
->adapters
[adapter_idx
];
4261 const struct wined3d_gl_info
*gl_info
= &adapter
->gl_info
;
4262 const struct wined3d_format
*adapter_format
= wined3d_get_format(gl_info
, adapter_format_id
);
4263 const struct wined3d_format
*format
= wined3d_get_format(gl_info
, check_format_id
);
4264 DWORD format_flags
= 0;
4265 DWORD allowed_usage
;
4267 TRACE("wined3d %p, adapter_idx %u, device_type %s, adapter_format %s, usage %s, %s,\n"
4268 "resource_type %s, check_format %s.\n",
4269 wined3d
, adapter_idx
, debug_d3ddevicetype(device_type
), debug_d3dformat(adapter_format_id
),
4270 debug_d3dusage(usage
), debug_d3dusagequery(usage
), debug_d3dresourcetype(resource_type
),
4271 debug_d3dformat(check_format_id
));
4273 if (adapter_idx
>= wined3d
->adapter_count
)
4274 return WINED3DERR_INVALIDCALL
;
4276 switch (resource_type
)
4278 case WINED3D_RTYPE_CUBE_TEXTURE
:
4279 if (!gl_info
->supported
[ARB_TEXTURE_CUBE_MAP
])
4281 TRACE("[FAILED] - No cube texture support.\n");
4282 return WINED3DERR_NOTAVAILABLE
;
4285 format_flags
|= WINED3DFMT_FLAG_TEXTURE
;
4286 allowed_usage
= WINED3DUSAGE_AUTOGENMIPMAP
4287 | WINED3DUSAGE_DYNAMIC
4288 | WINED3DUSAGE_RENDERTARGET
4289 | WINED3DUSAGE_SOFTWAREPROCESSING
4290 | WINED3DUSAGE_QUERY_FILTER
4291 | WINED3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING
4292 | WINED3DUSAGE_QUERY_SRGBREAD
4293 | WINED3DUSAGE_QUERY_SRGBWRITE
4294 | WINED3DUSAGE_QUERY_VERTEXTEXTURE
4295 | WINED3DUSAGE_QUERY_WRAPANDMIP
;
4298 case WINED3D_RTYPE_SURFACE
:
4299 if (!CheckSurfaceCapability(adapter
, adapter_format
, format
, wined3d
->flags
& WINED3D_NO3D
))
4301 TRACE("[FAILED] - Not supported for plain surfaces.\n");
4302 return WINED3DERR_NOTAVAILABLE
;
4305 allowed_usage
= WINED3DUSAGE_DEPTHSTENCIL
4306 | WINED3DUSAGE_RENDERTARGET
4307 | WINED3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING
;
4310 case WINED3D_RTYPE_TEXTURE
:
4311 if ((usage
& WINED3DUSAGE_DEPTHSTENCIL
) && (format
->flags
& WINED3DFMT_FLAG_SHADOW
)
4312 && !gl_info
->supported
[ARB_SHADOW
])
4314 TRACE("[FAILED] - No shadow sampler support.\n");
4315 return WINED3DERR_NOTAVAILABLE
;
4318 format_flags
|= WINED3DFMT_FLAG_TEXTURE
;
4319 allowed_usage
= WINED3DUSAGE_AUTOGENMIPMAP
4320 | WINED3DUSAGE_DEPTHSTENCIL
4321 | WINED3DUSAGE_DYNAMIC
4322 | WINED3DUSAGE_RENDERTARGET
4323 | WINED3DUSAGE_SOFTWAREPROCESSING
4324 | WINED3DUSAGE_QUERY_FILTER
4325 | WINED3DUSAGE_QUERY_LEGACYBUMPMAP
4326 | WINED3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING
4327 | WINED3DUSAGE_QUERY_SRGBREAD
4328 | WINED3DUSAGE_QUERY_SRGBWRITE
4329 | WINED3DUSAGE_QUERY_VERTEXTEXTURE
4330 | WINED3DUSAGE_QUERY_WRAPANDMIP
;
4333 case WINED3D_RTYPE_VOLUME_TEXTURE
:
4334 case WINED3D_RTYPE_VOLUME
:
4335 /* Volume is to VolumeTexture what Surface is to Texture, but its
4336 * usage caps are not documented. Most driver seem to offer
4337 * (nearly) the same on Volume and VolumeTexture, so do that too. */
4338 if (!gl_info
->supported
[EXT_TEXTURE3D
])
4340 TRACE("[FAILED] - No volume texture support.\n");
4341 return WINED3DERR_NOTAVAILABLE
;
4344 /* The GL_EXT_texture_compression_s3tc spec requires that loading
4345 * an s3tc compressed texture results in an error. While the D3D
4346 * refrast does support s3tc volumes, at least the nvidia Windows
4347 * driver does not, so we're free not to support this format. */
4348 switch (check_format_id
)
4350 case WINED3DFMT_DXT1
:
4351 case WINED3DFMT_DXT2
:
4352 case WINED3DFMT_DXT3
:
4353 case WINED3DFMT_DXT4
:
4354 case WINED3DFMT_DXT5
:
4355 TRACE("[FAILED] - DXTn does not support 3D textures.\n");
4356 return WINED3DERR_NOTAVAILABLE
;
4359 /* Do nothing, continue with checking the format below */
4363 format_flags
|= WINED3DFMT_FLAG_TEXTURE
;
4364 allowed_usage
= WINED3DUSAGE_DYNAMIC
4365 | WINED3DUSAGE_SOFTWAREPROCESSING
4366 | WINED3DUSAGE_QUERY_FILTER
4367 | WINED3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING
4368 | WINED3DUSAGE_QUERY_SRGBREAD
4369 | WINED3DUSAGE_QUERY_SRGBWRITE
4370 | WINED3DUSAGE_QUERY_VERTEXTEXTURE
4371 | WINED3DUSAGE_QUERY_WRAPANDMIP
;
4375 FIXME("Unhandled resource type %s.\n", debug_d3dresourcetype(resource_type
));
4376 return WINED3DERR_NOTAVAILABLE
;
4379 if ((usage
& allowed_usage
) != usage
)
4381 TRACE("Requested usage %#x, but resource type %s only allows %#x.\n",
4382 usage
, debug_d3dresourcetype(resource_type
), allowed_usage
);
4383 return WINED3DERR_NOTAVAILABLE
;
4386 if (usage
& WINED3DUSAGE_QUERY_FILTER
)
4387 format_flags
|= WINED3DFMT_FLAG_FILTERING
;
4388 if (usage
& WINED3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING
)
4389 format_flags
|= WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING
;
4390 if (usage
& WINED3DUSAGE_QUERY_SRGBREAD
)
4391 format_flags
|= WINED3DFMT_FLAG_SRGB_READ
;
4392 if (usage
& WINED3DUSAGE_QUERY_SRGBWRITE
)
4393 format_flags
|= WINED3DFMT_FLAG_SRGB_WRITE
;
4394 if (usage
& WINED3DUSAGE_QUERY_VERTEXTEXTURE
)
4395 format_flags
|= WINED3DFMT_FLAG_VTF
;
4396 if (usage
& WINED3DUSAGE_QUERY_LEGACYBUMPMAP
)
4397 format_flags
|= WINED3DFMT_FLAG_BUMPMAP
;
4399 if ((format
->flags
& format_flags
) != format_flags
)
4401 TRACE("Requested format flags %#x, but format %s only has %#x.\n",
4402 format_flags
, debug_d3dformat(check_format_id
), format
->flags
);
4403 return WINED3DERR_NOTAVAILABLE
;
4406 if ((format_flags
& WINED3DFMT_FLAG_TEXTURE
) && (wined3d
->flags
& WINED3D_NO3D
))
4408 TRACE("Requested texturing support, but wined3d was created with WINED3D_NO3D.\n");
4409 return WINED3DERR_NOTAVAILABLE
;
4412 if ((usage
& WINED3DUSAGE_DEPTHSTENCIL
)
4413 && !CheckDepthStencilCapability(adapter
, adapter_format
, format
))
4415 TRACE("Requested WINED3DUSAGE_DEPTHSTENCIL, but format %s is not supported for depth / stencil buffers.\n",
4416 debug_d3dformat(check_format_id
));
4417 return WINED3DERR_NOTAVAILABLE
;
4420 if ((usage
& WINED3DUSAGE_RENDERTARGET
)
4421 && !CheckRenderTargetCapability(adapter
, adapter_format
, format
))
4423 TRACE("Requested WINED3DUSAGE_RENDERTARGET, but format %s is not supported for render targets.\n",
4424 debug_d3dformat(check_format_id
));
4425 return WINED3DERR_NOTAVAILABLE
;
4428 if ((usage
& WINED3DUSAGE_AUTOGENMIPMAP
) && !gl_info
->supported
[SGIS_GENERATE_MIPMAP
])
4430 TRACE("No WINED3DUSAGE_AUTOGENMIPMAP support, returning WINED3DOK_NOAUTOGEN.\n");
4431 return WINED3DOK_NOAUTOGEN
;
4437 UINT CDECL
wined3d_calculate_format_pitch(const struct wined3d
*wined3d
, UINT adapter_idx
,
4438 enum wined3d_format_id format_id
, UINT width
)
4440 const struct wined3d_gl_info
*gl_info
;
4442 TRACE("wined3d %p, adapter_idx %u, format_id %s, width %u.\n",
4443 wined3d
, adapter_idx
, debug_d3dformat(format_id
), width
);
4445 if (adapter_idx
>= wined3d
->adapter_count
)
4448 gl_info
= &wined3d
->adapters
[adapter_idx
].gl_info
;
4449 return wined3d_format_calculate_pitch(wined3d_get_format(gl_info
, format_id
), width
);
4452 HRESULT CDECL
wined3d_check_device_format_conversion(const struct wined3d
*wined3d
, UINT adapter_idx
,
4453 enum wined3d_device_type device_type
, enum wined3d_format_id src_format
, enum wined3d_format_id dst_format
)
4455 FIXME("wined3d %p, adapter_idx %u, device_type %s, src_format %s, dst_format %s stub!\n",
4456 wined3d
, adapter_idx
, debug_d3ddevicetype(device_type
), debug_d3dformat(src_format
),
4457 debug_d3dformat(dst_format
));
4462 HRESULT CDECL
wined3d_check_device_type(const struct wined3d
*wined3d
, UINT adapter_idx
,
4463 enum wined3d_device_type device_type
, enum wined3d_format_id display_format
,
4464 enum wined3d_format_id backbuffer_format
, BOOL windowed
)
4466 BOOL present_conversion
= wined3d
->flags
& WINED3D_PRESENT_CONVERSION
;
4468 TRACE("wined3d %p, adapter_idx %u, device_type %s, display_format %s, backbuffer_format %s, windowed %#x.\n",
4469 wined3d
, adapter_idx
, debug_d3ddevicetype(device_type
), debug_d3dformat(display_format
),
4470 debug_d3dformat(backbuffer_format
), windowed
);
4472 if (adapter_idx
>= wined3d
->adapter_count
)
4473 return WINED3DERR_INVALIDCALL
;
4475 /* The task of this function is to check whether a certain display / backbuffer format
4476 * combination is available on the given adapter. In fullscreen mode microsoft specified
4477 * that the display format shouldn't provide alpha and that ignoring alpha the backbuffer
4478 * and display format should match exactly.
4479 * In windowed mode format conversion can occur and this depends on the driver. */
4481 /* There are only 4 display formats. */
4482 if (!(display_format
== WINED3DFMT_B5G6R5_UNORM
4483 || display_format
== WINED3DFMT_B5G5R5X1_UNORM
4484 || display_format
== WINED3DFMT_B8G8R8X8_UNORM
4485 || display_format
== WINED3DFMT_B10G10R10A2_UNORM
))
4487 TRACE("Format %s is not supported as display format.\n", debug_d3dformat(display_format
));
4488 return WINED3DERR_NOTAVAILABLE
;
4493 /* If the requested display format is not available, don't continue. */
4494 if (!wined3d_get_adapter_mode_count(wined3d
, adapter_idx
,
4495 display_format
, WINED3D_SCANLINE_ORDERING_UNKNOWN
))
4497 TRACE("No available modes for display format %s.\n", debug_d3dformat(display_format
));
4498 return WINED3DERR_NOTAVAILABLE
;
4501 present_conversion
= FALSE
;
4503 else if (display_format
== WINED3DFMT_B10G10R10A2_UNORM
)
4505 /* WINED3DFMT_B10G10R10A2_UNORM is only allowed in fullscreen mode. */
4506 TRACE("Unsupported format combination %s / %s in windowed mode.\n",
4507 debug_d3dformat(display_format
), debug_d3dformat(backbuffer_format
));
4508 return WINED3DERR_NOTAVAILABLE
;
4511 if (present_conversion
)
4513 /* Use the display format as back buffer format if the latter is
4514 * WINED3DFMT_UNKNOWN. */
4515 if (backbuffer_format
== WINED3DFMT_UNKNOWN
)
4516 backbuffer_format
= display_format
;
4518 if (FAILED(wined3d_check_device_format_conversion(wined3d
, adapter_idx
,
4519 device_type
, backbuffer_format
, display_format
)))
4521 TRACE("Format conversion from %s to %s not supported.\n",
4522 debug_d3dformat(backbuffer_format
), debug_d3dformat(display_format
));
4523 return WINED3DERR_NOTAVAILABLE
;
4528 /* When format conversion from the back buffer format to the display
4529 * format is not allowed, only a limited number of combinations are
4532 if (display_format
== WINED3DFMT_B5G6R5_UNORM
&& backbuffer_format
!= WINED3DFMT_B5G6R5_UNORM
)
4534 TRACE("Unsupported format combination %s / %s.\n",
4535 debug_d3dformat(display_format
), debug_d3dformat(backbuffer_format
));
4536 return WINED3DERR_NOTAVAILABLE
;
4539 if (display_format
== WINED3DFMT_B5G5R5X1_UNORM
4540 && !(backbuffer_format
== WINED3DFMT_B5G5R5X1_UNORM
|| backbuffer_format
== WINED3DFMT_B5G5R5A1_UNORM
))
4542 TRACE("Unsupported format combination %s / %s.\n",
4543 debug_d3dformat(display_format
), debug_d3dformat(backbuffer_format
));
4544 return WINED3DERR_NOTAVAILABLE
;
4547 if (display_format
== WINED3DFMT_B8G8R8X8_UNORM
4548 && !(backbuffer_format
== WINED3DFMT_B8G8R8X8_UNORM
|| backbuffer_format
== WINED3DFMT_B8G8R8A8_UNORM
))
4550 TRACE("Unsupported format combination %s / %s.\n",
4551 debug_d3dformat(display_format
), debug_d3dformat(backbuffer_format
));
4552 return WINED3DERR_NOTAVAILABLE
;
4555 if (display_format
== WINED3DFMT_B10G10R10A2_UNORM
4556 && backbuffer_format
!= WINED3DFMT_B10G10R10A2_UNORM
)
4558 TRACE("Unsupported format combination %s / %s.\n",
4559 debug_d3dformat(display_format
), debug_d3dformat(backbuffer_format
));
4560 return WINED3DERR_NOTAVAILABLE
;
4564 /* Validate that the back buffer format is usable for render targets. */
4565 if (FAILED(wined3d_check_device_format(wined3d
, adapter_idx
, device_type
, display_format
,
4566 WINED3DUSAGE_RENDERTARGET
, WINED3D_RTYPE_SURFACE
, backbuffer_format
)))
4568 TRACE("Format %s not allowed for render targets.\n", debug_d3dformat(backbuffer_format
));
4569 return WINED3DERR_NOTAVAILABLE
;
4575 HRESULT CDECL
wined3d_get_device_caps(const struct wined3d
*wined3d
, UINT adapter_idx
,
4576 enum wined3d_device_type device_type
, WINED3DCAPS
*caps
)
4578 const struct wined3d_adapter
*adapter
= &wined3d
->adapters
[adapter_idx
];
4579 const struct wined3d_gl_info
*gl_info
= &adapter
->gl_info
;
4580 struct shader_caps shader_caps
;
4581 struct fragment_caps fragment_caps
;
4582 struct wined3d_vertex_caps vertex_caps
;
4583 DWORD ckey_caps
, blit_caps
, fx_caps
;
4585 TRACE("wined3d %p, adapter_idx %u, device_type %s, caps %p.\n",
4586 wined3d
, adapter_idx
, debug_d3ddevicetype(device_type
), caps
);
4588 if (adapter_idx
>= wined3d
->adapter_count
)
4589 return WINED3DERR_INVALIDCALL
;
4591 caps
->DeviceType
= (device_type
== WINED3D_DEVICE_TYPE_HAL
) ? WINED3D_DEVICE_TYPE_HAL
: WINED3D_DEVICE_TYPE_REF
;
4592 caps
->AdapterOrdinal
= adapter_idx
;
4595 caps
->Caps2
= WINED3DCAPS2_CANRENDERWINDOWED
|
4596 WINED3DCAPS2_FULLSCREENGAMMA
|
4597 WINED3DCAPS2_DYNAMICTEXTURES
;
4598 if (gl_info
->supported
[SGIS_GENERATE_MIPMAP
])
4599 caps
->Caps2
|= WINED3DCAPS2_CANAUTOGENMIPMAP
;
4601 caps
->Caps3
= WINED3DCAPS3_ALPHA_FULLSCREEN_FLIP_OR_DISCARD
|
4602 WINED3DCAPS3_COPY_TO_VIDMEM
|
4603 WINED3DCAPS3_COPY_TO_SYSTEMMEM
;
4605 caps
->PresentationIntervals
= WINED3DPRESENT_INTERVAL_IMMEDIATE
|
4606 WINED3DPRESENT_INTERVAL_ONE
;
4608 caps
->CursorCaps
= WINED3DCURSORCAPS_COLOR
|
4609 WINED3DCURSORCAPS_LOWRES
;
4611 caps
->DevCaps
= WINED3DDEVCAPS_FLOATTLVERTEX
|
4612 WINED3DDEVCAPS_EXECUTESYSTEMMEMORY
|
4613 WINED3DDEVCAPS_TLVERTEXSYSTEMMEMORY
|
4614 WINED3DDEVCAPS_TLVERTEXVIDEOMEMORY
|
4615 WINED3DDEVCAPS_DRAWPRIMTLVERTEX
|
4616 WINED3DDEVCAPS_HWTRANSFORMANDLIGHT
|
4617 WINED3DDEVCAPS_EXECUTEVIDEOMEMORY
|
4618 WINED3DDEVCAPS_PUREDEVICE
|
4619 WINED3DDEVCAPS_HWRASTERIZATION
|
4620 WINED3DDEVCAPS_TEXTUREVIDEOMEMORY
|
4621 WINED3DDEVCAPS_TEXTURESYSTEMMEMORY
|
4622 WINED3DDEVCAPS_CANRENDERAFTERFLIP
|
4623 WINED3DDEVCAPS_DRAWPRIMITIVES2
|
4624 WINED3DDEVCAPS_DRAWPRIMITIVES2EX
;
4626 caps
->PrimitiveMiscCaps
= WINED3DPMISCCAPS_CULLNONE
|
4627 WINED3DPMISCCAPS_CULLCCW
|
4628 WINED3DPMISCCAPS_CULLCW
|
4629 WINED3DPMISCCAPS_COLORWRITEENABLE
|
4630 WINED3DPMISCCAPS_CLIPTLVERTS
|
4631 WINED3DPMISCCAPS_CLIPPLANESCALEDPOINTS
|
4632 WINED3DPMISCCAPS_MASKZ
|
4633 WINED3DPMISCCAPS_BLENDOP
|
4634 WINED3DPMISCCAPS_MRTPOSTPIXELSHADERBLENDING
;
4636 WINED3DPMISCCAPS_NULLREFERENCE
4637 WINED3DPMISCCAPS_FOGANDSPECULARALPHA
4638 WINED3DPMISCCAPS_MRTINDEPENDENTBITDEPTHS
4639 WINED3DPMISCCAPS_FOGVERTEXCLAMPED */
4641 if (gl_info
->supported
[EXT_BLEND_EQUATION_SEPARATE
] && gl_info
->supported
[EXT_BLEND_FUNC_SEPARATE
])
4642 caps
->PrimitiveMiscCaps
|= WINED3DPMISCCAPS_SEPARATEALPHABLEND
;
4643 if (gl_info
->supported
[EXT_DRAW_BUFFERS2
])
4644 caps
->PrimitiveMiscCaps
|= WINED3DPMISCCAPS_INDEPENDENTWRITEMASKS
;
4645 if (gl_info
->supported
[ARB_FRAMEBUFFER_SRGB
])
4646 caps
->PrimitiveMiscCaps
|= WINED3DPMISCCAPS_POSTBLENDSRGBCONVERT
;
4648 caps
->RasterCaps
= WINED3DPRASTERCAPS_DITHER
|
4649 WINED3DPRASTERCAPS_PAT
|
4650 WINED3DPRASTERCAPS_WFOG
|
4651 WINED3DPRASTERCAPS_ZFOG
|
4652 WINED3DPRASTERCAPS_FOGVERTEX
|
4653 WINED3DPRASTERCAPS_FOGTABLE
|
4654 WINED3DPRASTERCAPS_STIPPLE
|
4655 WINED3DPRASTERCAPS_SUBPIXEL
|
4656 WINED3DPRASTERCAPS_ZTEST
|
4657 WINED3DPRASTERCAPS_SCISSORTEST
|
4658 WINED3DPRASTERCAPS_SLOPESCALEDEPTHBIAS
|
4659 WINED3DPRASTERCAPS_DEPTHBIAS
;
4661 if (gl_info
->supported
[EXT_TEXTURE_FILTER_ANISOTROPIC
])
4663 caps
->RasterCaps
|= WINED3DPRASTERCAPS_ANISOTROPY
|
4664 WINED3DPRASTERCAPS_ZBIAS
|
4665 WINED3DPRASTERCAPS_MIPMAPLODBIAS
;
4668 caps
->ZCmpCaps
= WINED3DPCMPCAPS_ALWAYS
|
4669 WINED3DPCMPCAPS_EQUAL
|
4670 WINED3DPCMPCAPS_GREATER
|
4671 WINED3DPCMPCAPS_GREATEREQUAL
|
4672 WINED3DPCMPCAPS_LESS
|
4673 WINED3DPCMPCAPS_LESSEQUAL
|
4674 WINED3DPCMPCAPS_NEVER
|
4675 WINED3DPCMPCAPS_NOTEQUAL
;
4677 /* WINED3DPBLENDCAPS_BOTHINVSRCALPHA and WINED3DPBLENDCAPS_BOTHSRCALPHA
4678 * are legacy settings for srcblend only. */
4679 caps
->SrcBlendCaps
= WINED3DPBLENDCAPS_BOTHINVSRCALPHA
|
4680 WINED3DPBLENDCAPS_BOTHSRCALPHA
|
4681 WINED3DPBLENDCAPS_DESTALPHA
|
4682 WINED3DPBLENDCAPS_DESTCOLOR
|
4683 WINED3DPBLENDCAPS_INVDESTALPHA
|
4684 WINED3DPBLENDCAPS_INVDESTCOLOR
|
4685 WINED3DPBLENDCAPS_INVSRCALPHA
|
4686 WINED3DPBLENDCAPS_INVSRCCOLOR
|
4687 WINED3DPBLENDCAPS_ONE
|
4688 WINED3DPBLENDCAPS_SRCALPHA
|
4689 WINED3DPBLENDCAPS_SRCALPHASAT
|
4690 WINED3DPBLENDCAPS_SRCCOLOR
|
4691 WINED3DPBLENDCAPS_ZERO
;
4693 caps
->DestBlendCaps
= WINED3DPBLENDCAPS_DESTALPHA
|
4694 WINED3DPBLENDCAPS_DESTCOLOR
|
4695 WINED3DPBLENDCAPS_INVDESTALPHA
|
4696 WINED3DPBLENDCAPS_INVDESTCOLOR
|
4697 WINED3DPBLENDCAPS_INVSRCALPHA
|
4698 WINED3DPBLENDCAPS_INVSRCCOLOR
|
4699 WINED3DPBLENDCAPS_ONE
|
4700 WINED3DPBLENDCAPS_SRCALPHA
|
4701 WINED3DPBLENDCAPS_SRCCOLOR
|
4702 WINED3DPBLENDCAPS_ZERO
;
4704 if (gl_info
->supported
[ARB_BLEND_FUNC_EXTENDED
])
4705 caps
->DestBlendCaps
|= WINED3DPBLENDCAPS_SRCALPHASAT
;
4707 if (gl_info
->supported
[EXT_BLEND_COLOR
])
4709 caps
->SrcBlendCaps
|= WINED3DPBLENDCAPS_BLENDFACTOR
;
4710 caps
->DestBlendCaps
|= WINED3DPBLENDCAPS_BLENDFACTOR
;
4714 caps
->AlphaCmpCaps
= WINED3DPCMPCAPS_ALWAYS
|
4715 WINED3DPCMPCAPS_EQUAL
|
4716 WINED3DPCMPCAPS_GREATER
|
4717 WINED3DPCMPCAPS_GREATEREQUAL
|
4718 WINED3DPCMPCAPS_LESS
|
4719 WINED3DPCMPCAPS_LESSEQUAL
|
4720 WINED3DPCMPCAPS_NEVER
|
4721 WINED3DPCMPCAPS_NOTEQUAL
;
4723 caps
->ShadeCaps
= WINED3DPSHADECAPS_SPECULARGOURAUDRGB
|
4724 WINED3DPSHADECAPS_COLORGOURAUDRGB
|
4725 WINED3DPSHADECAPS_ALPHAFLATBLEND
|
4726 WINED3DPSHADECAPS_ALPHAGOURAUDBLEND
|
4727 WINED3DPSHADECAPS_COLORFLATRGB
|
4728 WINED3DPSHADECAPS_FOGFLAT
|
4729 WINED3DPSHADECAPS_FOGGOURAUD
|
4730 WINED3DPSHADECAPS_SPECULARFLATRGB
;
4732 caps
->TextureCaps
= WINED3DPTEXTURECAPS_ALPHA
|
4733 WINED3DPTEXTURECAPS_ALPHAPALETTE
|
4734 WINED3DPTEXTURECAPS_TRANSPARENCY
|
4735 WINED3DPTEXTURECAPS_BORDER
|
4736 WINED3DPTEXTURECAPS_MIPMAP
|
4737 WINED3DPTEXTURECAPS_PROJECTED
|
4738 WINED3DPTEXTURECAPS_PERSPECTIVE
;
4740 if (!gl_info
->supported
[ARB_TEXTURE_NON_POWER_OF_TWO
])
4742 caps
->TextureCaps
|= WINED3DPTEXTURECAPS_POW2
|
4743 WINED3DPTEXTURECAPS_NONPOW2CONDITIONAL
;
4746 if (gl_info
->supported
[EXT_TEXTURE3D
])
4748 caps
->TextureCaps
|= WINED3DPTEXTURECAPS_VOLUMEMAP
|
4749 WINED3DPTEXTURECAPS_MIPVOLUMEMAP
;
4750 if (!gl_info
->supported
[ARB_TEXTURE_NON_POWER_OF_TWO
])
4752 caps
->TextureCaps
|= WINED3DPTEXTURECAPS_VOLUMEMAP_POW2
;
4756 if (gl_info
->supported
[ARB_TEXTURE_CUBE_MAP
])
4758 caps
->TextureCaps
|= WINED3DPTEXTURECAPS_CUBEMAP
|
4759 WINED3DPTEXTURECAPS_MIPCUBEMAP
;
4760 if (!gl_info
->supported
[ARB_TEXTURE_NON_POWER_OF_TWO
])
4762 caps
->TextureCaps
|= WINED3DPTEXTURECAPS_CUBEMAP_POW2
;
4766 caps
->TextureFilterCaps
= WINED3DPTFILTERCAPS_MAGFLINEAR
|
4767 WINED3DPTFILTERCAPS_MAGFPOINT
|
4768 WINED3DPTFILTERCAPS_MINFLINEAR
|
4769 WINED3DPTFILTERCAPS_MINFPOINT
|
4770 WINED3DPTFILTERCAPS_MIPFLINEAR
|
4771 WINED3DPTFILTERCAPS_MIPFPOINT
|
4772 WINED3DPTFILTERCAPS_LINEAR
|
4773 WINED3DPTFILTERCAPS_LINEARMIPLINEAR
|
4774 WINED3DPTFILTERCAPS_LINEARMIPNEAREST
|
4775 WINED3DPTFILTERCAPS_MIPLINEAR
|
4776 WINED3DPTFILTERCAPS_MIPNEAREST
|
4777 WINED3DPTFILTERCAPS_NEAREST
;
4779 if (gl_info
->supported
[EXT_TEXTURE_FILTER_ANISOTROPIC
])
4781 caps
->TextureFilterCaps
|= WINED3DPTFILTERCAPS_MAGFANISOTROPIC
|
4782 WINED3DPTFILTERCAPS_MINFANISOTROPIC
;
4785 if (gl_info
->supported
[ARB_TEXTURE_CUBE_MAP
])
4787 caps
->CubeTextureFilterCaps
= WINED3DPTFILTERCAPS_MAGFLINEAR
|
4788 WINED3DPTFILTERCAPS_MAGFPOINT
|
4789 WINED3DPTFILTERCAPS_MINFLINEAR
|
4790 WINED3DPTFILTERCAPS_MINFPOINT
|
4791 WINED3DPTFILTERCAPS_MIPFLINEAR
|
4792 WINED3DPTFILTERCAPS_MIPFPOINT
|
4793 WINED3DPTFILTERCAPS_LINEAR
|
4794 WINED3DPTFILTERCAPS_LINEARMIPLINEAR
|
4795 WINED3DPTFILTERCAPS_LINEARMIPNEAREST
|
4796 WINED3DPTFILTERCAPS_MIPLINEAR
|
4797 WINED3DPTFILTERCAPS_MIPNEAREST
|
4798 WINED3DPTFILTERCAPS_NEAREST
;
4800 if (gl_info
->supported
[EXT_TEXTURE_FILTER_ANISOTROPIC
])
4802 caps
->CubeTextureFilterCaps
|= WINED3DPTFILTERCAPS_MAGFANISOTROPIC
|
4803 WINED3DPTFILTERCAPS_MINFANISOTROPIC
;
4808 caps
->CubeTextureFilterCaps
= 0;
4811 if (gl_info
->supported
[EXT_TEXTURE3D
])
4813 caps
->VolumeTextureFilterCaps
= WINED3DPTFILTERCAPS_MAGFLINEAR
|
4814 WINED3DPTFILTERCAPS_MAGFPOINT
|
4815 WINED3DPTFILTERCAPS_MINFLINEAR
|
4816 WINED3DPTFILTERCAPS_MINFPOINT
|
4817 WINED3DPTFILTERCAPS_MIPFLINEAR
|
4818 WINED3DPTFILTERCAPS_MIPFPOINT
|
4819 WINED3DPTFILTERCAPS_LINEAR
|
4820 WINED3DPTFILTERCAPS_LINEARMIPLINEAR
|
4821 WINED3DPTFILTERCAPS_LINEARMIPNEAREST
|
4822 WINED3DPTFILTERCAPS_MIPLINEAR
|
4823 WINED3DPTFILTERCAPS_MIPNEAREST
|
4824 WINED3DPTFILTERCAPS_NEAREST
;
4828 caps
->VolumeTextureFilterCaps
= 0;
4831 caps
->TextureAddressCaps
= WINED3DPTADDRESSCAPS_INDEPENDENTUV
|
4832 WINED3DPTADDRESSCAPS_CLAMP
|
4833 WINED3DPTADDRESSCAPS_WRAP
;
4835 if (gl_info
->supported
[ARB_TEXTURE_BORDER_CLAMP
])
4837 caps
->TextureAddressCaps
|= WINED3DPTADDRESSCAPS_BORDER
;
4839 if (gl_info
->supported
[ARB_TEXTURE_MIRRORED_REPEAT
])
4841 caps
->TextureAddressCaps
|= WINED3DPTADDRESSCAPS_MIRROR
;
4843 if (gl_info
->supported
[ARB_TEXTURE_MIRROR_CLAMP_TO_EDGE
])
4845 caps
->TextureAddressCaps
|= WINED3DPTADDRESSCAPS_MIRRORONCE
;
4848 if (gl_info
->supported
[EXT_TEXTURE3D
])
4850 caps
->VolumeTextureAddressCaps
= WINED3DPTADDRESSCAPS_INDEPENDENTUV
|
4851 WINED3DPTADDRESSCAPS_CLAMP
|
4852 WINED3DPTADDRESSCAPS_WRAP
;
4853 if (gl_info
->supported
[ARB_TEXTURE_BORDER_CLAMP
])
4855 caps
->VolumeTextureAddressCaps
|= WINED3DPTADDRESSCAPS_BORDER
;
4857 if (gl_info
->supported
[ARB_TEXTURE_MIRRORED_REPEAT
])
4859 caps
->VolumeTextureAddressCaps
|= WINED3DPTADDRESSCAPS_MIRROR
;
4861 if (gl_info
->supported
[ARB_TEXTURE_MIRROR_CLAMP_TO_EDGE
])
4863 caps
->VolumeTextureAddressCaps
|= WINED3DPTADDRESSCAPS_MIRRORONCE
;
4868 caps
->VolumeTextureAddressCaps
= 0;
4871 caps
->LineCaps
= WINED3DLINECAPS_TEXTURE
|
4872 WINED3DLINECAPS_ZTEST
|
4873 WINED3DLINECAPS_BLEND
|
4874 WINED3DLINECAPS_ALPHACMP
|
4875 WINED3DLINECAPS_FOG
;
4876 /* WINED3DLINECAPS_ANTIALIAS is not supported on Windows, and dx and gl seem to have a different
4877 * idea how generating the smoothing alpha values works; the result is different
4880 caps
->MaxTextureWidth
= gl_info
->limits
.texture_size
;
4881 caps
->MaxTextureHeight
= gl_info
->limits
.texture_size
;
4883 if (gl_info
->supported
[EXT_TEXTURE3D
])
4884 caps
->MaxVolumeExtent
= gl_info
->limits
.texture3d_size
;
4886 caps
->MaxVolumeExtent
= 0;
4888 caps
->MaxTextureRepeat
= 32768;
4889 caps
->MaxTextureAspectRatio
= gl_info
->limits
.texture_size
;
4890 caps
->MaxVertexW
= 1.0f
;
4892 caps
->GuardBandLeft
= 0.0f
;
4893 caps
->GuardBandTop
= 0.0f
;
4894 caps
->GuardBandRight
= 0.0f
;
4895 caps
->GuardBandBottom
= 0.0f
;
4897 caps
->ExtentsAdjust
= 0.0f
;
4899 caps
->StencilCaps
= WINED3DSTENCILCAPS_DECRSAT
|
4900 WINED3DSTENCILCAPS_INCRSAT
|
4901 WINED3DSTENCILCAPS_INVERT
|
4902 WINED3DSTENCILCAPS_KEEP
|
4903 WINED3DSTENCILCAPS_REPLACE
|
4904 WINED3DSTENCILCAPS_ZERO
;
4905 if (gl_info
->supported
[EXT_STENCIL_WRAP
])
4907 caps
->StencilCaps
|= WINED3DSTENCILCAPS_DECR
|
4908 WINED3DSTENCILCAPS_INCR
;
4910 if (gl_info
->supported
[EXT_STENCIL_TWO_SIDE
] || gl_info
->supported
[ATI_SEPARATE_STENCIL
])
4912 caps
->StencilCaps
|= WINED3DSTENCILCAPS_TWOSIDED
;
4915 caps
->MaxAnisotropy
= gl_info
->limits
.anisotropy
;
4916 caps
->MaxPointSize
= gl_info
->limits
.pointsize_max
;
4918 caps
->MaxPrimitiveCount
= 0x555555; /* Taken from an AMD Radeon HD 5700 (Evergreen) GPU. */
4919 caps
->MaxVertexIndex
= 0xffffff; /* Taken from an AMD Radeon HD 5700 (Evergreen) GPU. */
4920 caps
->MaxStreams
= MAX_STREAMS
;
4921 caps
->MaxStreamStride
= 1024;
4923 /* d3d9.dll sets D3DDEVCAPS2_CAN_STRETCHRECT_FROM_TEXTURES here because StretchRects is implemented in d3d9 */
4924 caps
->DevCaps2
= WINED3DDEVCAPS2_STREAMOFFSET
|
4925 WINED3DDEVCAPS2_VERTEXELEMENTSCANSHARESTREAMOFFSET
;
4926 caps
->MaxNpatchTessellationLevel
= 0;
4927 caps
->MasterAdapterOrdinal
= 0;
4928 caps
->AdapterOrdinalInGroup
= 0;
4929 caps
->NumberOfAdaptersInGroup
= 1;
4931 caps
->NumSimultaneousRTs
= gl_info
->limits
.buffers
;
4933 caps
->StretchRectFilterCaps
= WINED3DPTFILTERCAPS_MINFPOINT
|
4934 WINED3DPTFILTERCAPS_MAGFPOINT
|
4935 WINED3DPTFILTERCAPS_MINFLINEAR
|
4936 WINED3DPTFILTERCAPS_MAGFLINEAR
;
4937 caps
->VertexTextureFilterCaps
= 0;
4939 adapter
->shader_backend
->shader_get_caps(&adapter
->gl_info
, &shader_caps
);
4940 adapter
->fragment_pipe
->get_caps(&adapter
->gl_info
, &fragment_caps
);
4941 adapter
->vertex_pipe
->vp_get_caps(&adapter
->gl_info
, &vertex_caps
);
4943 /* Add shader misc caps. Only some of them belong to the shader parts of the pipeline */
4944 caps
->PrimitiveMiscCaps
|= fragment_caps
.PrimitiveMiscCaps
;
4946 caps
->VertexShaderVersion
= shader_caps
.vs_version
;
4947 caps
->MaxVertexShaderConst
= shader_caps
.vs_uniform_count
;
4949 caps
->PixelShaderVersion
= shader_caps
.ps_version
;
4950 caps
->PixelShader1xMaxValue
= shader_caps
.ps_1x_max_value
;
4952 caps
->TextureOpCaps
= fragment_caps
.TextureOpCaps
;
4953 caps
->MaxTextureBlendStages
= fragment_caps
.MaxTextureBlendStages
;
4954 caps
->MaxSimultaneousTextures
= fragment_caps
.MaxSimultaneousTextures
;
4956 caps
->MaxUserClipPlanes
= vertex_caps
.max_user_clip_planes
;
4957 caps
->MaxActiveLights
= vertex_caps
.max_active_lights
;
4958 caps
->MaxVertexBlendMatrices
= vertex_caps
.max_vertex_blend_matrices
;
4959 caps
->MaxVertexBlendMatrixIndex
= vertex_caps
.max_vertex_blend_matrix_index
;
4960 caps
->VertexProcessingCaps
= vertex_caps
.vertex_processing_caps
;
4961 caps
->FVFCaps
= vertex_caps
.fvf_caps
;
4962 caps
->RasterCaps
|= vertex_caps
.raster_caps
;
4964 /* The following caps are shader specific, but they are things we cannot detect, or which
4965 * are the same among all shader models. So to avoid code duplication set the shader version
4966 * specific, but otherwise constant caps here
4968 if (caps
->VertexShaderVersion
>= 3)
4970 /* Where possible set the caps based on OpenGL extensions and if they
4971 * aren't set (in case of software rendering) use the VS 3.0 from
4972 * MSDN or else if there's OpenGL spec use a hardcoded value minimum
4974 caps
->VS20Caps
.caps
= WINED3DVS20CAPS_PREDICATION
;
4975 /* VS 3.0 requires MAX_DYNAMICFLOWCONTROLDEPTH (24) */
4976 caps
->VS20Caps
.dynamic_flow_control_depth
= WINED3DVS20_MAX_DYNAMICFLOWCONTROLDEPTH
;
4977 caps
->VS20Caps
.temp_count
= max(32, adapter
->gl_info
.limits
.arb_vs_temps
);
4978 /* level of nesting in loops / if-statements; VS 3.0 requires MAX (4) */
4979 caps
->VS20Caps
.static_flow_control_depth
= WINED3DVS20_MAX_STATICFLOWCONTROLDEPTH
;
4981 caps
->MaxVShaderInstructionsExecuted
= 65535; /* VS 3.0 needs at least 65535, some cards even use 2^32-1 */
4982 caps
->MaxVertexShader30InstructionSlots
= max(512, adapter
->gl_info
.limits
.arb_vs_instructions
);
4983 caps
->VertexTextureFilterCaps
= WINED3DPTFILTERCAPS_MINFPOINT
| WINED3DPTFILTERCAPS_MAGFPOINT
;
4985 else if (caps
->VertexShaderVersion
== 2)
4987 caps
->VS20Caps
.caps
= 0;
4988 caps
->VS20Caps
.dynamic_flow_control_depth
= WINED3DVS20_MIN_DYNAMICFLOWCONTROLDEPTH
;
4989 caps
->VS20Caps
.temp_count
= max(12, adapter
->gl_info
.limits
.arb_vs_temps
);
4990 caps
->VS20Caps
.static_flow_control_depth
= 1;
4992 caps
->MaxVShaderInstructionsExecuted
= 65535;
4993 caps
->MaxVertexShader30InstructionSlots
= 0;
4997 caps
->VS20Caps
.caps
= 0;
4998 caps
->VS20Caps
.dynamic_flow_control_depth
= 0;
4999 caps
->VS20Caps
.temp_count
= 0;
5000 caps
->VS20Caps
.static_flow_control_depth
= 0;
5002 caps
->MaxVShaderInstructionsExecuted
= 0;
5003 caps
->MaxVertexShader30InstructionSlots
= 0;
5006 if (caps
->PixelShaderVersion
>= 3)
5008 /* Where possible set the caps based on OpenGL extensions and if they
5009 * aren't set (in case of software rendering) use the PS 3.0 from
5010 * MSDN or else if there's OpenGL spec use a hardcoded value minimum
5013 /* Caps is more or less undocumented on MSDN but it appears to be
5014 * used for PS20Caps based on results from R9600/FX5900/Geforce6800
5015 * cards from Windows */
5016 caps
->PS20Caps
.caps
= WINED3DPS20CAPS_ARBITRARYSWIZZLE
|
5017 WINED3DPS20CAPS_GRADIENTINSTRUCTIONS
|
5018 WINED3DPS20CAPS_PREDICATION
|
5019 WINED3DPS20CAPS_NODEPENDENTREADLIMIT
|
5020 WINED3DPS20CAPS_NOTEXINSTRUCTIONLIMIT
;
5021 /* PS 3.0 requires MAX_DYNAMICFLOWCONTROLDEPTH (24) */
5022 caps
->PS20Caps
.dynamic_flow_control_depth
= WINED3DPS20_MAX_DYNAMICFLOWCONTROLDEPTH
;
5023 caps
->PS20Caps
.temp_count
= max(32, adapter
->gl_info
.limits
.arb_ps_temps
);
5024 /* PS 3.0 requires MAX_STATICFLOWCONTROLDEPTH (4) */
5025 caps
->PS20Caps
.static_flow_control_depth
= WINED3DPS20_MAX_STATICFLOWCONTROLDEPTH
;
5026 /* PS 3.0 requires MAX_NUMINSTRUCTIONSLOTS (512) */
5027 caps
->PS20Caps
.instruction_slot_count
= WINED3DPS20_MAX_NUMINSTRUCTIONSLOTS
;
5029 caps
->MaxPShaderInstructionsExecuted
= 65535;
5030 caps
->MaxPixelShader30InstructionSlots
= max(WINED3DMIN30SHADERINSTRUCTIONS
,
5031 adapter
->gl_info
.limits
.arb_ps_instructions
);
5033 else if(caps
->PixelShaderVersion
== 2)
5035 /* Below we assume PS2.0 specs, not extended 2.0a(GeforceFX)/2.0b(Radeon R3xx) ones */
5036 caps
->PS20Caps
.caps
= 0;
5037 caps
->PS20Caps
.dynamic_flow_control_depth
= 0; /* WINED3DVS20_MIN_DYNAMICFLOWCONTROLDEPTH = 0 */
5038 caps
->PS20Caps
.temp_count
= max(12, adapter
->gl_info
.limits
.arb_ps_temps
);
5039 caps
->PS20Caps
.static_flow_control_depth
= WINED3DPS20_MIN_STATICFLOWCONTROLDEPTH
; /* Minimum: 1 */
5040 /* Minimum number (64 ALU + 32 Texture), a GeforceFX uses 512 */
5041 caps
->PS20Caps
.instruction_slot_count
= WINED3DPS20_MIN_NUMINSTRUCTIONSLOTS
;
5043 caps
->MaxPShaderInstructionsExecuted
= 512; /* Minimum value, a GeforceFX uses 1024 */
5044 caps
->MaxPixelShader30InstructionSlots
= 0;
5048 caps
->PS20Caps
.caps
= 0;
5049 caps
->PS20Caps
.dynamic_flow_control_depth
= 0;
5050 caps
->PS20Caps
.temp_count
= 0;
5051 caps
->PS20Caps
.static_flow_control_depth
= 0;
5052 caps
->PS20Caps
.instruction_slot_count
= 0;
5054 caps
->MaxPShaderInstructionsExecuted
= 0;
5055 caps
->MaxPixelShader30InstructionSlots
= 0;
5058 if (caps
->VertexShaderVersion
>= 2)
5060 /* OpenGL supports all the formats below, perhaps not always
5061 * without conversion, but it supports them.
5062 * Further GLSL doesn't seem to have an official unsigned type so
5063 * don't advertise it yet as I'm not sure how we handle it.
5064 * We might need to add some clamping in the shader engine to
5066 * TODO: WINED3DDTCAPS_USHORT2N, WINED3DDTCAPS_USHORT4N, WINED3DDTCAPS_UDEC3, WINED3DDTCAPS_DEC3N */
5067 caps
->DeclTypes
= WINED3DDTCAPS_UBYTE4
|
5068 WINED3DDTCAPS_UBYTE4N
|
5069 WINED3DDTCAPS_SHORT2N
|
5070 WINED3DDTCAPS_SHORT4N
;
5071 if (gl_info
->supported
[ARB_HALF_FLOAT_VERTEX
])
5073 caps
->DeclTypes
|= WINED3DDTCAPS_FLOAT16_2
|
5074 WINED3DDTCAPS_FLOAT16_4
;
5079 caps
->DeclTypes
= 0;
5082 /* Set DirectDraw helper Caps */
5083 ckey_caps
= WINEDDCKEYCAPS_DESTBLT
|
5084 WINEDDCKEYCAPS_SRCBLT
;
5085 fx_caps
= WINEDDFXCAPS_BLTALPHA
|
5086 WINEDDFXCAPS_BLTMIRRORLEFTRIGHT
|
5087 WINEDDFXCAPS_BLTMIRRORUPDOWN
|
5088 WINEDDFXCAPS_BLTROTATION90
|
5089 WINEDDFXCAPS_BLTSHRINKX
|
5090 WINEDDFXCAPS_BLTSHRINKXN
|
5091 WINEDDFXCAPS_BLTSHRINKY
|
5092 WINEDDFXCAPS_BLTSHRINKYN
|
5093 WINEDDFXCAPS_BLTSTRETCHX
|
5094 WINEDDFXCAPS_BLTSTRETCHXN
|
5095 WINEDDFXCAPS_BLTSTRETCHY
|
5096 WINEDDFXCAPS_BLTSTRETCHYN
;
5097 blit_caps
= WINEDDCAPS_BLT
|
5098 WINEDDCAPS_BLTCOLORFILL
|
5099 WINEDDCAPS_BLTDEPTHFILL
|
5100 WINEDDCAPS_BLTSTRETCH
|
5101 WINEDDCAPS_CANBLTSYSMEM
|
5102 WINEDDCAPS_CANCLIP
|
5103 WINEDDCAPS_CANCLIPSTRETCHED
|
5104 WINEDDCAPS_COLORKEY
|
5105 WINEDDCAPS_COLORKEYHWASSIST
|
5106 WINEDDCAPS_ALIGNBOUNDARYSRC
;
5108 /* Fill the ddraw caps structure */
5109 caps
->ddraw_caps
.caps
= WINEDDCAPS_GDI
|
5110 WINEDDCAPS_PALETTE
|
5112 caps
->ddraw_caps
.caps2
= WINEDDCAPS2_CERTIFIED
|
5113 WINEDDCAPS2_NOPAGELOCKREQUIRED
|
5114 WINEDDCAPS2_PRIMARYGAMMA
|
5115 WINEDDCAPS2_WIDESURFACES
|
5116 WINEDDCAPS2_CANRENDERWINDOWED
;
5117 caps
->ddraw_caps
.color_key_caps
= ckey_caps
;
5118 caps
->ddraw_caps
.fx_caps
= fx_caps
;
5119 caps
->ddraw_caps
.svb_caps
= blit_caps
;
5120 caps
->ddraw_caps
.svb_color_key_caps
= ckey_caps
;
5121 caps
->ddraw_caps
.svb_fx_caps
= fx_caps
;
5122 caps
->ddraw_caps
.vsb_caps
= blit_caps
;
5123 caps
->ddraw_caps
.vsb_color_key_caps
= ckey_caps
;
5124 caps
->ddraw_caps
.vsb_fx_caps
= fx_caps
;
5125 caps
->ddraw_caps
.ssb_caps
= blit_caps
;
5126 caps
->ddraw_caps
.ssb_color_key_caps
= ckey_caps
;
5127 caps
->ddraw_caps
.ssb_fx_caps
= fx_caps
;
5129 caps
->ddraw_caps
.dds_caps
= WINEDDSCAPS_ALPHA
|
5130 WINEDDSCAPS_BACKBUFFER
|
5132 WINEDDSCAPS_FRONTBUFFER
|
5133 WINEDDSCAPS_OFFSCREENPLAIN
|
5134 WINEDDSCAPS_PALETTE
|
5135 WINEDDSCAPS_PRIMARYSURFACE
|
5136 WINEDDSCAPS_SYSTEMMEMORY
|
5137 WINEDDSCAPS_VIDEOMEMORY
|
5138 WINEDDSCAPS_VISIBLE
;
5140 if (!(wined3d
->flags
& WINED3D_NO3D
))
5142 caps
->ddraw_caps
.dds_caps
|= WINEDDSCAPS_3DDEVICE
|
5143 WINEDDSCAPS_MIPMAP
|
5144 WINEDDSCAPS_TEXTURE
|
5145 WINEDDSCAPS_ZBUFFER
;
5146 caps
->ddraw_caps
.caps
|= WINEDDCAPS_3D
;
5152 HRESULT CDECL
wined3d_device_create(struct wined3d
*wined3d
, UINT adapter_idx
, enum wined3d_device_type device_type
,
5153 HWND focus_window
, DWORD flags
, BYTE surface_alignment
, struct wined3d_device_parent
*device_parent
,
5154 struct wined3d_device
**device
)
5156 struct wined3d_device
*object
;
5159 TRACE("wined3d %p, adapter_idx %u, device_type %#x, focus_window %p, flags %#x, device_parent %p, device %p.\n",
5160 wined3d
, adapter_idx
, device_type
, focus_window
, flags
, device_parent
, device
);
5162 /* Validate the adapter number. If no adapters are available(no GL), ignore the adapter
5163 * number and create a device without a 3D adapter for 2D only operation. */
5164 if (wined3d
->adapter_count
&& adapter_idx
>= wined3d
->adapter_count
)
5165 return WINED3DERR_INVALIDCALL
;
5167 object
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*object
));
5169 return E_OUTOFMEMORY
;
5171 hr
= device_init(object
, wined3d
, adapter_idx
, device_type
,
5172 focus_window
, flags
, surface_alignment
, device_parent
);
5175 WARN("Failed to initialize device, hr %#x.\n", hr
);
5176 HeapFree(GetProcessHeap(), 0, object
);
5180 TRACE("Created device %p.\n", object
);
5183 device_parent
->ops
->wined3d_device_created(device_parent
, *device
);
5188 static void WINE_GLAPI
invalid_func(const void *data
)
5190 ERR("Invalid vertex attribute function called\n");
5194 static void WINE_GLAPI
invalid_texcoord_func(GLenum unit
, const void *data
)
5196 ERR("Invalid texcoord function called\n");
5200 /* Helper functions for providing vertex data to opengl. The arrays are initialized based on
5201 * the extension detection and are used in drawStridedSlow
5203 static void WINE_GLAPI
position_d3dcolor(const void *data
)
5205 DWORD pos
= *((const DWORD
*)data
);
5207 FIXME("Add a test for fixed function position from d3dcolor type\n");
5208 context_get_current()->gl_info
->gl_ops
.gl
.p_glVertex4s(D3DCOLOR_B_R(pos
),
5214 static void WINE_GLAPI
position_float4(const void *data
)
5216 const GLfloat
*pos
= data
;
5218 if (pos
[3] != 0.0f
&& pos
[3] != 1.0f
)
5220 float w
= 1.0f
/ pos
[3];
5222 context_get_current()->gl_info
->gl_ops
.gl
.p_glVertex4f(pos
[0] * w
, pos
[1] * w
, pos
[2] * w
, w
);
5226 context_get_current()->gl_info
->gl_ops
.gl
.p_glVertex3fv(pos
);
5230 static void WINE_GLAPI
diffuse_d3dcolor(const void *data
)
5232 DWORD diffuseColor
= *((const DWORD
*)data
);
5234 context_get_current()->gl_info
->gl_ops
.gl
.p_glColor4ub(D3DCOLOR_B_R(diffuseColor
),
5235 D3DCOLOR_B_G(diffuseColor
),
5236 D3DCOLOR_B_B(diffuseColor
),
5237 D3DCOLOR_B_A(diffuseColor
));
5240 static void WINE_GLAPI
specular_d3dcolor(const void *data
)
5242 DWORD specularColor
= *((const DWORD
*)data
);
5245 D3DCOLOR_B_R(specularColor
),
5246 D3DCOLOR_B_G(specularColor
),
5247 D3DCOLOR_B_B(specularColor
)
5250 context_get_current()->gl_info
->gl_ops
.ext
.p_glSecondaryColor3ubvEXT(d
);
5253 static void WINE_GLAPI
warn_no_specular_func(const void *data
)
5255 WARN("GL_EXT_secondary_color not supported\n");
5258 static void wined3d_adapter_init_ffp_attrib_ops(struct wined3d_adapter
*adapter
)
5260 const struct wined3d_gl_info
*gl_info
= &adapter
->gl_info
;
5261 struct wined3d_d3d_info
*d3d_info
= &adapter
->d3d_info
;
5262 struct wined3d_ffp_attrib_ops
*ops
= &d3d_info
->ffp_attrib_ops
;
5264 ops
->position
[WINED3D_FFP_EMIT_FLOAT1
] = invalid_func
;
5265 ops
->position
[WINED3D_FFP_EMIT_FLOAT2
] = invalid_func
;
5266 ops
->position
[WINED3D_FFP_EMIT_FLOAT3
] = (wined3d_ffp_attrib_func
)gl_info
->gl_ops
.gl
.p_glVertex3fv
;
5267 if (!d3d_info
->xyzrhw
)
5268 ops
->position
[WINED3D_FFP_EMIT_FLOAT4
] = position_float4
;
5270 ops
->position
[WINED3D_FFP_EMIT_FLOAT4
] = (wined3d_ffp_attrib_func
)gl_info
->gl_ops
.gl
.p_glVertex4fv
;
5271 ops
->position
[WINED3D_FFP_EMIT_D3DCOLOR
] = position_d3dcolor
;
5272 ops
->position
[WINED3D_FFP_EMIT_UBYTE4
] = invalid_func
;
5273 ops
->position
[WINED3D_FFP_EMIT_SHORT2
] = invalid_func
;
5274 ops
->position
[WINED3D_FFP_EMIT_SHORT4
] = (wined3d_ffp_attrib_func
)gl_info
->gl_ops
.gl
.p_glVertex2sv
;
5275 ops
->position
[WINED3D_FFP_EMIT_UBYTE4N
] = invalid_func
;
5276 ops
->position
[WINED3D_FFP_EMIT_SHORT2N
] = invalid_func
;
5277 ops
->position
[WINED3D_FFP_EMIT_SHORT4N
] = invalid_func
;
5278 ops
->position
[WINED3D_FFP_EMIT_USHORT2N
] = invalid_func
;
5279 ops
->position
[WINED3D_FFP_EMIT_USHORT4N
] = invalid_func
;
5280 ops
->position
[WINED3D_FFP_EMIT_UDEC3
] = invalid_func
;
5281 ops
->position
[WINED3D_FFP_EMIT_DEC3N
] = invalid_func
;
5282 ops
->position
[WINED3D_FFP_EMIT_FLOAT16_2
] = invalid_func
;
5283 ops
->position
[WINED3D_FFP_EMIT_FLOAT16_4
] = invalid_func
;
5284 ops
->position
[WINED3D_FFP_EMIT_INVALID
] = invalid_func
;
5286 ops
->diffuse
[WINED3D_FFP_EMIT_FLOAT1
] = invalid_func
;
5287 ops
->diffuse
[WINED3D_FFP_EMIT_FLOAT2
] = invalid_func
;
5288 ops
->diffuse
[WINED3D_FFP_EMIT_FLOAT3
] = (wined3d_ffp_attrib_func
)gl_info
->gl_ops
.gl
.p_glColor3fv
;
5289 ops
->diffuse
[WINED3D_FFP_EMIT_FLOAT4
] = (wined3d_ffp_attrib_func
)gl_info
->gl_ops
.gl
.p_glColor4fv
;
5290 ops
->diffuse
[WINED3D_FFP_EMIT_D3DCOLOR
] = diffuse_d3dcolor
;
5291 ops
->diffuse
[WINED3D_FFP_EMIT_UBYTE4
] = invalid_func
;
5292 ops
->diffuse
[WINED3D_FFP_EMIT_SHORT2
] = invalid_func
;
5293 ops
->diffuse
[WINED3D_FFP_EMIT_SHORT4
] = invalid_func
;
5294 ops
->diffuse
[WINED3D_FFP_EMIT_UBYTE4N
] = (wined3d_ffp_attrib_func
)gl_info
->gl_ops
.gl
.p_glColor4ubv
;
5295 ops
->diffuse
[WINED3D_FFP_EMIT_SHORT2N
] = invalid_func
;
5296 ops
->diffuse
[WINED3D_FFP_EMIT_SHORT4N
] = (wined3d_ffp_attrib_func
)gl_info
->gl_ops
.gl
.p_glColor4sv
;
5297 ops
->diffuse
[WINED3D_FFP_EMIT_USHORT2N
] = invalid_func
;
5298 ops
->diffuse
[WINED3D_FFP_EMIT_USHORT4N
] = (wined3d_ffp_attrib_func
)gl_info
->gl_ops
.gl
.p_glColor4usv
;
5299 ops
->diffuse
[WINED3D_FFP_EMIT_UDEC3
] = invalid_func
;
5300 ops
->diffuse
[WINED3D_FFP_EMIT_DEC3N
] = invalid_func
;
5301 ops
->diffuse
[WINED3D_FFP_EMIT_FLOAT16_2
] = invalid_func
;
5302 ops
->diffuse
[WINED3D_FFP_EMIT_FLOAT16_4
] = invalid_func
;
5303 ops
->diffuse
[WINED3D_FFP_EMIT_INVALID
] = invalid_func
;
5305 /* No 4 component entry points here. */
5306 ops
->specular
[WINED3D_FFP_EMIT_FLOAT1
] = invalid_func
;
5307 ops
->specular
[WINED3D_FFP_EMIT_FLOAT2
] = invalid_func
;
5308 if (gl_info
->supported
[EXT_SECONDARY_COLOR
])
5309 ops
->specular
[WINED3D_FFP_EMIT_FLOAT3
] = (wined3d_ffp_attrib_func
)GL_EXTCALL(glSecondaryColor3fvEXT
);
5311 ops
->specular
[WINED3D_FFP_EMIT_FLOAT3
] = warn_no_specular_func
;
5312 ops
->specular
[WINED3D_FFP_EMIT_FLOAT4
] = invalid_func
;
5313 if (gl_info
->supported
[EXT_SECONDARY_COLOR
])
5314 ops
->specular
[WINED3D_FFP_EMIT_D3DCOLOR
] = specular_d3dcolor
;
5316 ops
->specular
[WINED3D_FFP_EMIT_D3DCOLOR
] = warn_no_specular_func
;
5317 ops
->specular
[WINED3D_FFP_EMIT_UBYTE4
] = invalid_func
;
5318 ops
->specular
[WINED3D_FFP_EMIT_SHORT2
] = invalid_func
;
5319 ops
->specular
[WINED3D_FFP_EMIT_SHORT4
] = invalid_func
;
5320 ops
->specular
[WINED3D_FFP_EMIT_UBYTE4N
] = invalid_func
;
5321 ops
->specular
[WINED3D_FFP_EMIT_SHORT2N
] = invalid_func
;
5322 ops
->specular
[WINED3D_FFP_EMIT_SHORT4N
] = invalid_func
;
5323 ops
->specular
[WINED3D_FFP_EMIT_USHORT2N
] = invalid_func
;
5324 ops
->specular
[WINED3D_FFP_EMIT_USHORT4N
] = invalid_func
;
5325 ops
->specular
[WINED3D_FFP_EMIT_UDEC3
] = invalid_func
;
5326 ops
->specular
[WINED3D_FFP_EMIT_DEC3N
] = invalid_func
;
5327 ops
->specular
[WINED3D_FFP_EMIT_FLOAT16_2
] = invalid_func
;
5328 ops
->specular
[WINED3D_FFP_EMIT_FLOAT16_4
] = invalid_func
;
5329 ops
->specular
[WINED3D_FFP_EMIT_INVALID
] = invalid_func
;
5331 /* Only 3 component entry points here. Test how others behave. Float4
5332 * normals are used by one of our tests, trying to pass it to the pixel
5333 * shader, which fails on Windows. */
5334 ops
->normal
[WINED3D_FFP_EMIT_FLOAT1
] = invalid_func
;
5335 ops
->normal
[WINED3D_FFP_EMIT_FLOAT2
] = invalid_func
;
5336 ops
->normal
[WINED3D_FFP_EMIT_FLOAT3
] = (wined3d_ffp_attrib_func
)gl_info
->gl_ops
.gl
.p_glNormal3fv
;
5337 /* Just ignore the 4th value. */
5338 ops
->normal
[WINED3D_FFP_EMIT_FLOAT4
] = (wined3d_ffp_attrib_func
)gl_info
->gl_ops
.gl
.p_glNormal3fv
;
5339 ops
->normal
[WINED3D_FFP_EMIT_D3DCOLOR
] = invalid_func
;
5340 ops
->normal
[WINED3D_FFP_EMIT_UBYTE4
] = invalid_func
;
5341 ops
->normal
[WINED3D_FFP_EMIT_SHORT2
] = invalid_func
;
5342 ops
->normal
[WINED3D_FFP_EMIT_SHORT4
] = invalid_func
;
5343 ops
->normal
[WINED3D_FFP_EMIT_UBYTE4N
] = invalid_func
;
5344 ops
->normal
[WINED3D_FFP_EMIT_SHORT2N
] = invalid_func
;
5345 ops
->normal
[WINED3D_FFP_EMIT_SHORT4N
] = invalid_func
;
5346 ops
->normal
[WINED3D_FFP_EMIT_USHORT2N
] = invalid_func
;
5347 ops
->normal
[WINED3D_FFP_EMIT_USHORT4N
] = invalid_func
;
5348 ops
->normal
[WINED3D_FFP_EMIT_UDEC3
] = invalid_func
;
5349 ops
->normal
[WINED3D_FFP_EMIT_DEC3N
] = invalid_func
;
5350 ops
->normal
[WINED3D_FFP_EMIT_FLOAT16_2
] = invalid_func
;
5351 ops
->normal
[WINED3D_FFP_EMIT_FLOAT16_4
] = invalid_func
;
5352 ops
->normal
[WINED3D_FFP_EMIT_INVALID
] = invalid_func
;
5354 ops
->texcoord
[WINED3D_FFP_EMIT_FLOAT1
] = (wined3d_ffp_texcoord_func
)gl_info
->gl_ops
.ext
.p_glMultiTexCoord1fvARB
;
5355 ops
->texcoord
[WINED3D_FFP_EMIT_FLOAT2
] = (wined3d_ffp_texcoord_func
)gl_info
->gl_ops
.ext
.p_glMultiTexCoord2fvARB
;
5356 ops
->texcoord
[WINED3D_FFP_EMIT_FLOAT3
] = (wined3d_ffp_texcoord_func
)gl_info
->gl_ops
.ext
.p_glMultiTexCoord3fvARB
;
5357 ops
->texcoord
[WINED3D_FFP_EMIT_FLOAT4
] = (wined3d_ffp_texcoord_func
)gl_info
->gl_ops
.ext
.p_glMultiTexCoord4fvARB
;
5358 ops
->texcoord
[WINED3D_FFP_EMIT_D3DCOLOR
] = invalid_texcoord_func
;
5359 ops
->texcoord
[WINED3D_FFP_EMIT_UBYTE4
] = invalid_texcoord_func
;
5360 ops
->texcoord
[WINED3D_FFP_EMIT_SHORT2
] = (wined3d_ffp_texcoord_func
)gl_info
->gl_ops
.ext
.p_glMultiTexCoord2svARB
;
5361 ops
->texcoord
[WINED3D_FFP_EMIT_SHORT4
] = (wined3d_ffp_texcoord_func
)gl_info
->gl_ops
.ext
.p_glMultiTexCoord4svARB
;
5362 ops
->texcoord
[WINED3D_FFP_EMIT_UBYTE4N
] = invalid_texcoord_func
;
5363 ops
->texcoord
[WINED3D_FFP_EMIT_SHORT2N
] = invalid_texcoord_func
;
5364 ops
->texcoord
[WINED3D_FFP_EMIT_SHORT4N
] = invalid_texcoord_func
;
5365 ops
->texcoord
[WINED3D_FFP_EMIT_USHORT2N
] = invalid_texcoord_func
;
5366 ops
->texcoord
[WINED3D_FFP_EMIT_USHORT4N
] = invalid_texcoord_func
;
5367 ops
->texcoord
[WINED3D_FFP_EMIT_UDEC3
] = invalid_texcoord_func
;
5368 ops
->texcoord
[WINED3D_FFP_EMIT_DEC3N
] = invalid_texcoord_func
;
5369 if (gl_info
->supported
[NV_HALF_FLOAT
])
5371 /* Not supported by ARB_HALF_FLOAT_VERTEX, so check for NV_HALF_FLOAT. */
5372 ops
->texcoord
[WINED3D_FFP_EMIT_FLOAT16_2
] =
5373 (wined3d_ffp_texcoord_func
)gl_info
->gl_ops
.ext
.p_glMultiTexCoord2hvNV
;
5374 ops
->texcoord
[WINED3D_FFP_EMIT_FLOAT16_4
] =
5375 (wined3d_ffp_texcoord_func
)gl_info
->gl_ops
.ext
.p_glMultiTexCoord4hvNV
;
5379 ops
->texcoord
[WINED3D_FFP_EMIT_FLOAT16_2
] = invalid_texcoord_func
;
5380 ops
->texcoord
[WINED3D_FFP_EMIT_FLOAT16_4
] = invalid_texcoord_func
;
5382 ops
->texcoord
[WINED3D_FFP_EMIT_INVALID
] = invalid_texcoord_func
;
5385 static void wined3d_adapter_init_fb_cfgs(struct wined3d_adapter
*adapter
, HDC dc
)
5387 const struct wined3d_gl_info
*gl_info
= &adapter
->gl_info
;
5390 if (gl_info
->supported
[WGL_ARB_PIXEL_FORMAT
])
5392 UINT attrib_count
= 0;
5398 attribute
= WGL_NUMBER_PIXEL_FORMATS_ARB
;
5399 GL_EXTCALL(wglGetPixelFormatAttribivARB(dc
, 0, 0, 1, &attribute
, &cfg_count
));
5401 adapter
->cfgs
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, cfg_count
* sizeof(*adapter
->cfgs
));
5402 attribs
[attrib_count
++] = WGL_RED_BITS_ARB
;
5403 attribs
[attrib_count
++] = WGL_GREEN_BITS_ARB
;
5404 attribs
[attrib_count
++] = WGL_BLUE_BITS_ARB
;
5405 attribs
[attrib_count
++] = WGL_ALPHA_BITS_ARB
;
5406 attribs
[attrib_count
++] = WGL_COLOR_BITS_ARB
;
5407 attribs
[attrib_count
++] = WGL_DEPTH_BITS_ARB
;
5408 attribs
[attrib_count
++] = WGL_STENCIL_BITS_ARB
;
5409 attribs
[attrib_count
++] = WGL_DRAW_TO_WINDOW_ARB
;
5410 attribs
[attrib_count
++] = WGL_PIXEL_TYPE_ARB
;
5411 attribs
[attrib_count
++] = WGL_DOUBLE_BUFFER_ARB
;
5412 attribs
[attrib_count
++] = WGL_AUX_BUFFERS_ARB
;
5414 for (i
= 0, adapter
->cfg_count
= 0; i
< cfg_count
; ++i
)
5416 struct wined3d_pixel_format
*cfg
= &adapter
->cfgs
[adapter
->cfg_count
];
5417 int format_id
= i
+ 1;
5419 if (!GL_EXTCALL(wglGetPixelFormatAttribivARB(dc
, format_id
, 0, attrib_count
, attribs
, values
)))
5422 cfg
->iPixelFormat
= format_id
;
5423 cfg
->redSize
= values
[0];
5424 cfg
->greenSize
= values
[1];
5425 cfg
->blueSize
= values
[2];
5426 cfg
->alphaSize
= values
[3];
5427 cfg
->colorSize
= values
[4];
5428 cfg
->depthSize
= values
[5];
5429 cfg
->stencilSize
= values
[6];
5430 cfg
->windowDrawable
= values
[7];
5431 cfg
->iPixelType
= values
[8];
5432 cfg
->doubleBuffer
= values
[9];
5433 cfg
->auxBuffers
= values
[10];
5435 cfg
->numSamples
= 0;
5436 /* Check multisample support. */
5437 if (gl_info
->supported
[ARB_MULTISAMPLE
])
5439 int attribs
[2] = {WGL_SAMPLE_BUFFERS_ARB
, WGL_SAMPLES_ARB
};
5442 if (GL_EXTCALL(wglGetPixelFormatAttribivARB(dc
, format_id
, 0, 2, attribs
, values
)))
5444 /* values[0] = WGL_SAMPLE_BUFFERS_ARB which tells whether
5445 * multisampling is supported. values[1] = number of
5446 * multisample buffers. */
5448 cfg
->numSamples
= values
[1];
5452 TRACE("iPixelFormat=%d, iPixelType=%#x, doubleBuffer=%d, RGBA=%d/%d/%d/%d, "
5453 "depth=%d, stencil=%d, samples=%d, windowDrawable=%d\n",
5454 cfg
->iPixelFormat
, cfg
->iPixelType
, cfg
->doubleBuffer
,
5455 cfg
->redSize
, cfg
->greenSize
, cfg
->blueSize
, cfg
->alphaSize
,
5456 cfg
->depthSize
, cfg
->stencilSize
, cfg
->numSamples
, cfg
->windowDrawable
);
5458 ++adapter
->cfg_count
;
5465 cfg_count
= DescribePixelFormat(dc
, 0, 0, 0);
5466 adapter
->cfgs
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, cfg_count
* sizeof(*adapter
->cfgs
));
5468 for (i
= 0, adapter
->cfg_count
= 0; i
< cfg_count
; ++i
)
5470 struct wined3d_pixel_format
*cfg
= &adapter
->cfgs
[adapter
->cfg_count
];
5471 PIXELFORMATDESCRIPTOR pfd
;
5472 int format_id
= i
+ 1;
5474 if (!DescribePixelFormat(dc
, format_id
, sizeof(pfd
), &pfd
))
5477 /* We only want HW acceleration using an OpenGL ICD driver.
5478 * PFD_GENERIC_FORMAT = slow opengl 1.1 gdi software rendering.
5479 * PFD_GENERIC_ACCELERATED = partial hw acceleration using a MCD
5480 * driver (e.g. 3dfx minigl). */
5481 if (pfd
.dwFlags
& (PFD_GENERIC_FORMAT
| PFD_GENERIC_ACCELERATED
))
5483 TRACE("Skipping format %d because it isn't ICD accelerated.\n", format_id
);
5487 cfg
->iPixelFormat
= format_id
;
5488 cfg
->redSize
= pfd
.cRedBits
;
5489 cfg
->greenSize
= pfd
.cGreenBits
;
5490 cfg
->blueSize
= pfd
.cBlueBits
;
5491 cfg
->alphaSize
= pfd
.cAlphaBits
;
5492 cfg
->colorSize
= pfd
.cColorBits
;
5493 cfg
->depthSize
= pfd
.cDepthBits
;
5494 cfg
->stencilSize
= pfd
.cStencilBits
;
5495 cfg
->windowDrawable
= (pfd
.dwFlags
& PFD_DRAW_TO_WINDOW
) ? 1 : 0;
5496 cfg
->iPixelType
= (pfd
.iPixelType
== PFD_TYPE_RGBA
) ? WGL_TYPE_RGBA_ARB
: WGL_TYPE_COLORINDEX_ARB
;
5497 cfg
->doubleBuffer
= (pfd
.dwFlags
& PFD_DOUBLEBUFFER
) ? 1 : 0;
5498 cfg
->auxBuffers
= pfd
.cAuxBuffers
;
5499 cfg
->numSamples
= 0;
5501 TRACE("iPixelFormat=%d, iPixelType=%#x, doubleBuffer=%d, RGBA=%d/%d/%d/%d, "
5502 "depth=%d, stencil=%d, windowDrawable=%d\n",
5503 cfg
->iPixelFormat
, cfg
->iPixelType
, cfg
->doubleBuffer
,
5504 cfg
->redSize
, cfg
->greenSize
, cfg
->blueSize
, cfg
->alphaSize
,
5505 cfg
->depthSize
, cfg
->stencilSize
, cfg
->windowDrawable
);
5507 ++adapter
->cfg_count
;
5512 static BOOL
wined3d_adapter_init(struct wined3d_adapter
*adapter
, UINT ordinal
)
5514 struct wined3d_gl_info
*gl_info
= &adapter
->gl_info
;
5515 struct wined3d_caps_gl_ctx caps_gl_ctx
= {0};
5516 unsigned int ctx_attrib_idx
= 0;
5517 DISPLAY_DEVICEW display_device
;
5518 GLint ctx_attribs
[3];
5520 TRACE("adapter %p, ordinal %u.\n", adapter
, ordinal
);
5522 adapter
->ordinal
= ordinal
;
5523 adapter
->monitorPoint
.x
= -1;
5524 adapter
->monitorPoint
.y
= -1;
5526 /* Dynamically load all GL core functions */
5527 #ifdef USE_WIN32_OPENGL
5529 HMODULE mod_gl
= GetModuleHandleA("opengl32.dll");
5530 #define USE_GL_FUNC(f) gl_info->gl_ops.gl.p_##f = (void *)GetProcAddress(mod_gl, #f);
5533 gl_info
->gl_ops
.wgl
.p_wglSwapBuffers
= (void *)GetProcAddress(mod_gl
, "wglSwapBuffers");
5536 /* To bypass the opengl32 thunks retrieve functions from the WGL driver instead of opengl32 */
5538 HDC hdc
= GetDC( 0 );
5539 const struct opengl_funcs
*wgl_driver
= __wine_get_wgl_driver( hdc
, WINE_WGL_DRIVER_VERSION
);
5540 ReleaseDC( 0, hdc
);
5541 if (!wgl_driver
|| wgl_driver
== (void *)-1) return FALSE
;
5542 gl_info
->gl_ops
.wgl
= wgl_driver
->wgl
;
5543 gl_info
->gl_ops
.gl
= wgl_driver
->gl
;
5547 glEnableWINE
= gl_info
->gl_ops
.gl
.p_glEnable
;
5548 glDisableWINE
= gl_info
->gl_ops
.gl
.p_glDisable
;
5550 if (!AllocateLocallyUniqueId(&adapter
->luid
))
5552 ERR("Failed to set adapter LUID (%#x).\n", GetLastError());
5555 TRACE("Allocated LUID %08x:%08x for adapter %p.\n",
5556 adapter
->luid
.HighPart
, adapter
->luid
.LowPart
, adapter
);
5558 if (!wined3d_caps_gl_ctx_create(&caps_gl_ctx
))
5560 ERR("Failed to get a GL context for adapter %p.\n", adapter
);
5564 if (context_debug_output_enabled(gl_info
))
5566 ctx_attribs
[ctx_attrib_idx
++] = WGL_CONTEXT_FLAGS_ARB
;
5567 ctx_attribs
[ctx_attrib_idx
++] = WGL_CONTEXT_DEBUG_BIT_ARB
;
5569 ctx_attribs
[ctx_attrib_idx
] = 0;
5570 wined3d_caps_gl_ctx_create_attribs(&caps_gl_ctx
, gl_info
, ctx_attribs
);
5572 if (!wined3d_adapter_init_gl_caps(adapter
))
5574 ERR("Failed to initialize GL caps for adapter %p.\n", adapter
);
5575 wined3d_caps_gl_ctx_destroy(&caps_gl_ctx
);
5579 wined3d_adapter_init_fb_cfgs(adapter
, caps_gl_ctx
.dc
);
5580 /* We haven't found any suitable formats. This should only happen in
5581 * case of GDI software rendering, which is pretty useless anyway. */
5582 if (!adapter
->cfg_count
)
5584 WARN("No suitable pixel formats found.\n");
5585 wined3d_caps_gl_ctx_destroy(&caps_gl_ctx
);
5586 HeapFree(GetProcessHeap(), 0, adapter
->cfgs
);
5590 if (!wined3d_adapter_init_format_info(adapter
))
5592 ERR("Failed to initialize GL format info.\n");
5593 wined3d_caps_gl_ctx_destroy(&caps_gl_ctx
);
5594 HeapFree(GetProcessHeap(), 0, adapter
->cfgs
);
5598 adapter
->vram_bytes
= adapter
->driver_info
.vram_bytes
;
5599 adapter
->vram_bytes_used
= 0;
5600 TRACE("Emulating 0x%s bytes of video ram.\n", wine_dbgstr_longlong(adapter
->vram_bytes
));
5602 display_device
.cb
= sizeof(display_device
);
5603 EnumDisplayDevicesW(NULL
, ordinal
, &display_device
, 0);
5604 TRACE("DeviceName: %s\n", debugstr_w(display_device
.DeviceName
));
5605 strcpyW(adapter
->DeviceName
, display_device
.DeviceName
);
5607 wined3d_caps_gl_ctx_destroy(&caps_gl_ctx
);
5609 wined3d_adapter_init_ffp_attrib_ops(adapter
);
5614 static void wined3d_adapter_init_nogl(struct wined3d_adapter
*adapter
, UINT ordinal
)
5616 DISPLAY_DEVICEW display_device
;
5618 memset(adapter
, 0, sizeof(*adapter
));
5619 adapter
->ordinal
= ordinal
;
5620 adapter
->monitorPoint
.x
= -1;
5621 adapter
->monitorPoint
.y
= -1;
5623 adapter
->driver_info
.name
= "Display";
5624 adapter
->driver_info
.description
= "WineD3D DirectDraw Emulation";
5625 if (wined3d_settings
.emulated_textureram
)
5626 adapter
->vram_bytes
= wined3d_settings
.emulated_textureram
;
5628 adapter
->vram_bytes
= 128 * 1024 * 1024;
5630 initPixelFormatsNoGL(&adapter
->gl_info
);
5632 adapter
->vertex_pipe
= &none_vertex_pipe
;
5633 adapter
->fragment_pipe
= &none_fragment_pipe
;
5634 adapter
->shader_backend
= &none_shader_backend
;
5635 adapter
->blitter
= &cpu_blit
;
5637 display_device
.cb
= sizeof(display_device
);
5638 EnumDisplayDevicesW(NULL
, ordinal
, &display_device
, 0);
5639 TRACE("DeviceName: %s\n", debugstr_w(display_device
.DeviceName
));
5640 strcpyW(adapter
->DeviceName
, display_device
.DeviceName
);
5643 static void STDMETHODCALLTYPE
wined3d_null_wined3d_object_destroyed(void *parent
) {}
5645 const struct wined3d_parent_ops wined3d_null_parent_ops
=
5647 wined3d_null_wined3d_object_destroyed
,
5650 HRESULT
wined3d_init(struct wined3d
*wined3d
, DWORD flags
)
5653 wined3d
->flags
= flags
;
5655 TRACE("Initializing adapters.\n");
5657 if (flags
& WINED3D_NO3D
)
5659 wined3d_adapter_init_nogl(&wined3d
->adapters
[0], 0);
5660 wined3d
->adapter_count
= 1;
5664 if (!wined3d_adapter_init(&wined3d
->adapters
[0], 0))
5666 WARN("Failed to initialize adapter.\n");
5669 wined3d
->adapter_count
= 1;