1 | /*
|
---|
2 | * IWineD3D implementation
|
---|
3 | *
|
---|
4 | * Copyright 2002-2004 Jason Edmeades
|
---|
5 | * Copyright 2003-2004 Raphael Junqueira
|
---|
6 | * Copyright 2004 Christian Costa
|
---|
7 | * Copyright 2005 Oliver Stieber
|
---|
8 | * Copyright 2007-2008 Stefan Dösinger for CodeWeavers
|
---|
9 | * Copyright 2009 Henri Verbeet for CodeWeavers
|
---|
10 | *
|
---|
11 | * This library is free software; you can redistribute it and/or
|
---|
12 | * modify it under the terms of the GNU Lesser General Public
|
---|
13 | * License as published by the Free Software Foundation; either
|
---|
14 | * version 2.1 of the License, or (at your option) any later version.
|
---|
15 | *
|
---|
16 | * This library is distributed in the hope that it will be useful,
|
---|
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
19 | * Lesser General Public License for more details.
|
---|
20 | *
|
---|
21 | * You should have received a copy of the GNU Lesser General Public
|
---|
22 | * License along with this library; if not, write to the Free Software
|
---|
23 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
---|
24 | */
|
---|
25 |
|
---|
26 | /*
|
---|
27 | * Oracle LGPL Disclaimer: For the avoidance of doubt, except that if any license choice
|
---|
28 | * other than GPL or LGPL is available it will apply instead, Oracle elects to use only
|
---|
29 | * the Lesser General Public License version 2.1 (LGPLv2) at this time for any software where
|
---|
30 | * a choice of LGPL license versions is made available with the language indicating
|
---|
31 | * that LGPLv2 or any later version may be used, or where a choice of which version
|
---|
32 | * of the LGPL is applied is otherwise unspecified.
|
---|
33 | */
|
---|
34 |
|
---|
35 | #include "config.h"
|
---|
36 | #include <stdio.h>
|
---|
37 | #include "wined3d_private.h"
|
---|
38 |
|
---|
39 | #ifdef VBOX_WITH_WDDM
|
---|
40 | # include <VBox/VBoxCrHgsmi.h>
|
---|
41 | #endif
|
---|
42 |
|
---|
43 | #ifdef VBOX_WITH_VMSVGA
|
---|
44 | # ifdef RT_OS_WINDOWS
|
---|
45 | DECLIMPORT(void) APIENTRY glFinish(void);
|
---|
46 | # else
|
---|
47 | void glFinish(void);
|
---|
48 | # endif
|
---|
49 | #endif
|
---|
50 |
|
---|
51 | WINE_DEFAULT_DEBUG_CHANNEL(d3d);
|
---|
52 | WINE_DECLARE_DEBUG_CHANNEL(d3d_caps);
|
---|
53 |
|
---|
54 | #define GLINFO_LOCATION (*gl_info)
|
---|
55 | #define WINE_DEFAULT_VIDMEM (64 * 1024 * 1024)
|
---|
56 |
|
---|
57 | /* The d3d device ID */
|
---|
58 | static const GUID IID_D3DDEVICE_D3DUID = { 0xaeb2cdd4, 0x6e41, 0x43ea, { 0x94,0x1c,0x83,0x61,0xcc,0x76,0x07,0x81 } };
|
---|
59 |
|
---|
60 |
|
---|
61 | /* Extension detection */
|
---|
62 | static const struct {
|
---|
63 | const char *extension_string;
|
---|
64 | GL_SupportedExt extension;
|
---|
65 | DWORD version;
|
---|
66 | } EXTENSION_MAP[] = {
|
---|
67 | /* APPLE */
|
---|
68 | {"GL_APPLE_client_storage", APPLE_CLIENT_STORAGE, 0 },
|
---|
69 | {"GL_APPLE_fence", APPLE_FENCE, 0 },
|
---|
70 | {"GL_APPLE_float_pixels", APPLE_FLOAT_PIXELS, 0 },
|
---|
71 | {"GL_APPLE_flush_buffer_range", APPLE_FLUSH_BUFFER_RANGE, 0 },
|
---|
72 | {"GL_APPLE_flush_render", APPLE_FLUSH_RENDER, 0 },
|
---|
73 | {"GL_APPLE_ycbcr_422", APPLE_YCBCR_422, 0 },
|
---|
74 |
|
---|
75 | /* ARB */
|
---|
76 | {"GL_ARB_color_buffer_float", ARB_COLOR_BUFFER_FLOAT, 0 },
|
---|
77 | {"GL_ARB_depth_buffer_float", ARB_DEPTH_BUFFER_FLOAT, 0 },
|
---|
78 | {"GL_ARB_depth_clamp", ARB_DEPTH_CLAMP, 0 },
|
---|
79 | {"GL_ARB_depth_texture", ARB_DEPTH_TEXTURE, 0 },
|
---|
80 | {"GL_ARB_draw_buffers", ARB_DRAW_BUFFERS, 0 },
|
---|
81 | {"GL_ARB_fragment_program", ARB_FRAGMENT_PROGRAM, 0 },
|
---|
82 | {"GL_ARB_fragment_shader", ARB_FRAGMENT_SHADER, 0 },
|
---|
83 | {"GL_ARB_framebuffer_object", ARB_FRAMEBUFFER_OBJECT, 0 },
|
---|
84 | {"GL_ARB_geometry_shader4", ARB_GEOMETRY_SHADER4, 0 },
|
---|
85 | {"GL_ARB_half_float_pixel", ARB_HALF_FLOAT_PIXEL, 0 },
|
---|
86 | {"GL_ARB_half_float_vertex", ARB_HALF_FLOAT_VERTEX, 0 },
|
---|
87 | {"GL_ARB_imaging", ARB_IMAGING, 0 },
|
---|
88 | {"GL_ARB_map_buffer_range", ARB_MAP_BUFFER_RANGE, 0 },
|
---|
89 | {"GL_ARB_multisample", ARB_MULTISAMPLE, 0 }, /* needs GLX_ARB_MULTISAMPLE as well */
|
---|
90 | {"GL_ARB_multitexture", ARB_MULTITEXTURE, 0 },
|
---|
91 | {"GL_ARB_occlusion_query", ARB_OCCLUSION_QUERY, 0 },
|
---|
92 | {"GL_ARB_pixel_buffer_object", ARB_PIXEL_BUFFER_OBJECT, 0 },
|
---|
93 | {"GL_ARB_point_parameters", ARB_POINT_PARAMETERS, 0 },
|
---|
94 | {"GL_ARB_point_sprite", ARB_POINT_SPRITE, 0 },
|
---|
95 | {"GL_ARB_provoking_vertex", ARB_PROVOKING_VERTEX, 0 },
|
---|
96 | {"GL_ARB_shader_objects", ARB_SHADER_OBJECTS, 0 },
|
---|
97 | {"GL_ARB_shader_texture_lod", ARB_SHADER_TEXTURE_LOD, 0 },
|
---|
98 | {"GL_ARB_shading_language_100", ARB_SHADING_LANGUAGE_100, 0 },
|
---|
99 | {"GL_ARB_sync", ARB_SYNC, 0 },
|
---|
100 | {"GL_ARB_texture_border_clamp", ARB_TEXTURE_BORDER_CLAMP, 0 },
|
---|
101 | {"GL_ARB_texture_compression", ARB_TEXTURE_COMPRESSION, 0 },
|
---|
102 | {"GL_ARB_texture_cube_map", ARB_TEXTURE_CUBE_MAP, 0 },
|
---|
103 | {"GL_ARB_texture_env_add", ARB_TEXTURE_ENV_ADD, 0 },
|
---|
104 | {"GL_ARB_texture_env_combine", ARB_TEXTURE_ENV_COMBINE, 0 },
|
---|
105 | {"GL_ARB_texture_env_dot3", ARB_TEXTURE_ENV_DOT3, 0 },
|
---|
106 | {"GL_ARB_texture_float", ARB_TEXTURE_FLOAT, 0 },
|
---|
107 | {"GL_ARB_texture_mirrored_repeat", ARB_TEXTURE_MIRRORED_REPEAT, 0 },
|
---|
108 | {"GL_IBM_texture_mirrored_repeat", ARB_TEXTURE_MIRRORED_REPEAT, 0 },
|
---|
109 | {"GL_ARB_texture_non_power_of_two", ARB_TEXTURE_NON_POWER_OF_TWO, MAKEDWORD_VERSION(2, 0) },
|
---|
110 | {"GL_ARB_texture_rectangle", ARB_TEXTURE_RECTANGLE, 0 },
|
---|
111 | {"GL_ARB_texture_rg", ARB_TEXTURE_RG, 0 },
|
---|
112 | {"GL_ARB_vertex_array_bgra", ARB_VERTEX_ARRAY_BGRA, 0 },
|
---|
113 | {"GL_ARB_vertex_blend", ARB_VERTEX_BLEND, 0 },
|
---|
114 | {"GL_ARB_vertex_buffer_object", ARB_VERTEX_BUFFER_OBJECT, 0 },
|
---|
115 | {"GL_ARB_vertex_program", ARB_VERTEX_PROGRAM, 0 },
|
---|
116 | {"GL_ARB_vertex_shader", ARB_VERTEX_SHADER, 0 },
|
---|
117 |
|
---|
118 | /* ATI */
|
---|
119 | {"GL_ATI_fragment_shader", ATI_FRAGMENT_SHADER, 0 },
|
---|
120 | {"GL_ATI_separate_stencil", ATI_SEPARATE_STENCIL, 0 },
|
---|
121 | {"GL_ATI_texture_compression_3dc", ATI_TEXTURE_COMPRESSION_3DC, 0 },
|
---|
122 | {"GL_ATI_texture_env_combine3", ATI_TEXTURE_ENV_COMBINE3, 0 },
|
---|
123 | {"GL_ATI_texture_mirror_once", ATI_TEXTURE_MIRROR_ONCE, 0 },
|
---|
124 |
|
---|
125 | /* EXT */
|
---|
126 | {"GL_EXT_blend_color", EXT_BLEND_COLOR, 0 },
|
---|
127 | {"GL_EXT_blend_equation_separate", EXT_BLEND_EQUATION_SEPARATE, 0 },
|
---|
128 | {"GL_EXT_blend_func_separate", EXT_BLEND_FUNC_SEPARATE, 0 },
|
---|
129 | {"GL_EXT_blend_minmax", EXT_BLEND_MINMAX, 0 },
|
---|
130 | {"GL_EXT_draw_buffers2", EXT_DRAW_BUFFERS2, 0 },
|
---|
131 | {"GL_EXT_fog_coord", EXT_FOG_COORD, 0 },
|
---|
132 | {"GL_EXT_framebuffer_blit", EXT_FRAMEBUFFER_BLIT, 0 },
|
---|
133 | {"GL_EXT_framebuffer_multisample", EXT_FRAMEBUFFER_MULTISAMPLE, 0 },
|
---|
134 | {"GL_EXT_framebuffer_object", EXT_FRAMEBUFFER_OBJECT, 0 },
|
---|
135 | {"GL_EXT_gpu_program_parameters", EXT_GPU_PROGRAM_PARAMETERS, 0 },
|
---|
136 | {"GL_EXT_gpu_shader4", EXT_GPU_SHADER4, 0 },
|
---|
137 | {"GL_EXT_packed_depth_stencil", EXT_PACKED_DEPTH_STENCIL, 0 },
|
---|
138 | {"GL_EXT_paletted_texture", EXT_PALETTED_TEXTURE, 0 },
|
---|
139 | {"GL_EXT_point_parameters", EXT_POINT_PARAMETERS, 0 },
|
---|
140 | {"GL_EXT_provoking_vertex", EXT_PROVOKING_VERTEX, 0 },
|
---|
141 | {"GL_EXT_secondary_color", EXT_SECONDARY_COLOR, 0 },
|
---|
142 | {"GL_EXT_stencil_two_side", EXT_STENCIL_TWO_SIDE, 0 },
|
---|
143 | {"GL_EXT_stencil_wrap", EXT_STENCIL_WRAP, 0 },
|
---|
144 | {"GL_EXT_texture3D", EXT_TEXTURE3D, MAKEDWORD_VERSION(1, 2) },
|
---|
145 | {"GL_EXT_texture_compression_rgtc", EXT_TEXTURE_COMPRESSION_RGTC, 0 },
|
---|
146 | {"GL_EXT_texture_compression_s3tc", EXT_TEXTURE_COMPRESSION_S3TC, 0 },
|
---|
147 | {"GL_EXT_texture_env_add", EXT_TEXTURE_ENV_ADD, 0 },
|
---|
148 | {"GL_EXT_texture_env_combine", EXT_TEXTURE_ENV_COMBINE, 0 },
|
---|
149 | {"GL_EXT_texture_env_dot3", EXT_TEXTURE_ENV_DOT3, 0 },
|
---|
150 | {"GL_EXT_texture_filter_anisotropic", EXT_TEXTURE_FILTER_ANISOTROPIC, 0 },
|
---|
151 | {"GL_EXT_texture_lod_bias", EXT_TEXTURE_LOD_BIAS, 0 },
|
---|
152 | {"GL_EXT_texture_sRGB", EXT_TEXTURE_SRGB, 0 },
|
---|
153 | {"GL_EXT_vertex_array_bgra", EXT_VERTEX_ARRAY_BGRA, 0 },
|
---|
154 |
|
---|
155 | /* NV */
|
---|
156 | {"GL_NV_depth_clamp", NV_DEPTH_CLAMP, 0 },
|
---|
157 | {"GL_NV_fence", NV_FENCE, 0 },
|
---|
158 | {"GL_NV_fog_distance", NV_FOG_DISTANCE, 0 },
|
---|
159 | {"GL_NV_fragment_program", NV_FRAGMENT_PROGRAM, 0 },
|
---|
160 | {"GL_NV_fragment_program2", NV_FRAGMENT_PROGRAM2, 0 },
|
---|
161 | {"GL_NV_fragment_program_option", NV_FRAGMENT_PROGRAM_OPTION, 0 },
|
---|
162 | {"GL_NV_half_float", NV_HALF_FLOAT, 0 },
|
---|
163 | {"GL_NV_light_max_exponent", NV_LIGHT_MAX_EXPONENT, 0 },
|
---|
164 | {"GL_NV_register_combiners", NV_REGISTER_COMBINERS, 0 },
|
---|
165 | {"GL_NV_register_combiners2", NV_REGISTER_COMBINERS2, 0 },
|
---|
166 | {"GL_NV_texgen_reflection", NV_TEXGEN_REFLECTION, 0 },
|
---|
167 | {"GL_NV_texture_env_combine4", NV_TEXTURE_ENV_COMBINE4, 0 },
|
---|
168 | {"GL_NV_texture_shader", NV_TEXTURE_SHADER, 0 },
|
---|
169 | {"GL_NV_texture_shader2", NV_TEXTURE_SHADER2, 0 },
|
---|
170 | {"GL_NV_vertex_program", NV_VERTEX_PROGRAM, 0 },
|
---|
171 | {"GL_NV_vertex_program1_1", NV_VERTEX_PROGRAM1_1, 0 },
|
---|
172 | {"GL_NV_vertex_program2", NV_VERTEX_PROGRAM2, 0 },
|
---|
173 | {"GL_NV_vertex_program2_option", NV_VERTEX_PROGRAM2_OPTION, 0 },
|
---|
174 | {"GL_NV_vertex_program3", NV_VERTEX_PROGRAM3, 0 },
|
---|
175 |
|
---|
176 | /* SGI */
|
---|
177 | {"GL_SGIS_generate_mipmap", SGIS_GENERATE_MIPMAP, 0 },
|
---|
178 | };
|
---|
179 |
|
---|
180 | /**********************************************************
|
---|
181 | * Utility functions follow
|
---|
182 | **********************************************************/
|
---|
183 |
|
---|
184 | const struct min_lookup minMipLookup[] =
|
---|
185 | {
|
---|
186 | /* NONE POINT LINEAR */
|
---|
187 | {{GL_NEAREST, GL_NEAREST, GL_NEAREST}}, /* NONE */
|
---|
188 | {{GL_NEAREST, GL_NEAREST_MIPMAP_NEAREST, GL_NEAREST_MIPMAP_LINEAR}}, /* POINT*/
|
---|
189 | {{GL_LINEAR, GL_LINEAR_MIPMAP_NEAREST, GL_LINEAR_MIPMAP_LINEAR}}, /* LINEAR */
|
---|
190 | };
|
---|
191 |
|
---|
192 | const struct min_lookup minMipLookup_noFilter[] =
|
---|
193 | {
|
---|
194 | /* NONE POINT LINEAR */
|
---|
195 | {{GL_NEAREST, GL_NEAREST, GL_NEAREST}}, /* NONE */
|
---|
196 | {{GL_NEAREST, GL_NEAREST, GL_NEAREST}}, /* POINT */
|
---|
197 | {{GL_NEAREST, GL_NEAREST, GL_NEAREST}}, /* LINEAR */
|
---|
198 | };
|
---|
199 |
|
---|
200 | const struct min_lookup minMipLookup_noMip[] =
|
---|
201 | {
|
---|
202 | /* NONE POINT LINEAR */
|
---|
203 | {{GL_NEAREST, GL_NEAREST, GL_NEAREST}}, /* NONE */
|
---|
204 | {{GL_NEAREST, GL_NEAREST, GL_NEAREST}}, /* POINT */
|
---|
205 | {{GL_LINEAR, GL_LINEAR, GL_LINEAR }}, /* LINEAR */
|
---|
206 | };
|
---|
207 |
|
---|
208 | const GLenum magLookup[] =
|
---|
209 | {
|
---|
210 | /* NONE POINT LINEAR */
|
---|
211 | GL_NEAREST, GL_NEAREST, GL_LINEAR,
|
---|
212 | };
|
---|
213 |
|
---|
214 | const GLenum magLookup_noFilter[] =
|
---|
215 | {
|
---|
216 | /* NONE POINT LINEAR */
|
---|
217 | GL_NEAREST, GL_NEAREST, GL_NEAREST,
|
---|
218 | };
|
---|
219 |
|
---|
220 | /* drawStridedSlow attributes */
|
---|
221 | glAttribFunc position_funcs[WINED3D_FFP_EMIT_COUNT];
|
---|
222 | glAttribFunc diffuse_funcs[WINED3D_FFP_EMIT_COUNT];
|
---|
223 | glAttribFunc specular_func_3ubv;
|
---|
224 | glAttribFunc specular_funcs[WINED3D_FFP_EMIT_COUNT];
|
---|
225 | glAttribFunc normal_funcs[WINED3D_FFP_EMIT_COUNT];
|
---|
226 | glMultiTexCoordFunc multi_texcoord_funcs[WINED3D_FFP_EMIT_COUNT];
|
---|
227 |
|
---|
228 |
|
---|
229 | /**********************************************************
|
---|
230 | * IWineD3D parts follows
|
---|
231 | **********************************************************/
|
---|
232 |
|
---|
233 | /* GL locking is done by the caller */
|
---|
234 | static inline BOOL test_arb_vs_offset_limit(const struct wined3d_gl_info *gl_info)
|
---|
235 | {
|
---|
236 | GLuint prog;
|
---|
237 | BOOL ret = FALSE;
|
---|
238 | const char *testcode =
|
---|
239 | "!!ARBvp1.0\n"
|
---|
240 | "PARAM C[66] = { program.env[0..65] };\n"
|
---|
241 | "ADDRESS A0;"
|
---|
242 | "PARAM zero = {0.0, 0.0, 0.0, 0.0};\n"
|
---|
243 | "ARL A0.x, zero.x;\n"
|
---|
244 | "MOV result.position, C[A0.x + 65];\n"
|
---|
245 | "END\n";
|
---|
246 |
|
---|
247 | while(glGetError());
|
---|
248 | GL_EXTCALL(glGenProgramsARB(1, &prog));
|
---|
249 | if(!prog) {
|
---|
250 | ERR("Failed to create an ARB offset limit test program\n");
|
---|
251 | }
|
---|
252 | GL_EXTCALL(glBindProgramARB(GL_VERTEX_PROGRAM_ARB, prog));
|
---|
253 | GL_EXTCALL(glProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
|
---|
254 | strlen(testcode), testcode));
|
---|
255 | if(glGetError() != 0) {
|
---|
256 | TRACE("OpenGL implementation does not allow indirect addressing offsets > 63\n");
|
---|
257 | TRACE("error: %s\n", debugstr_a((const char *)glGetString(GL_PROGRAM_ERROR_STRING_ARB)));
|
---|
258 | ret = TRUE;
|
---|
259 | } else TRACE("OpenGL implementation allows offsets > 63\n");
|
---|
260 |
|
---|
261 | GL_EXTCALL(glBindProgramARB(GL_VERTEX_PROGRAM_ARB, 0));
|
---|
262 | GL_EXTCALL(glDeleteProgramsARB(1, &prog));
|
---|
263 | checkGLcall("ARB vp offset limit test cleanup");
|
---|
264 |
|
---|
265 | return ret;
|
---|
266 | }
|
---|
267 |
|
---|
268 | static DWORD ver_for_ext(GL_SupportedExt ext)
|
---|
269 | {
|
---|
270 | unsigned int i;
|
---|
271 | for (i = 0; i < (sizeof(EXTENSION_MAP) / sizeof(*EXTENSION_MAP)); ++i) {
|
---|
272 | if(EXTENSION_MAP[i].extension == ext) {
|
---|
273 | return EXTENSION_MAP[i].version;
|
---|
274 | }
|
---|
275 | }
|
---|
276 | return 0;
|
---|
277 | }
|
---|
278 |
|
---|
279 | static BOOL match_ati_r300_to_500(const struct wined3d_gl_info *gl_info, const char *gl_renderer,
|
---|
280 | enum wined3d_gl_vendor gl_vendor, enum wined3d_pci_vendor card_vendor, enum wined3d_pci_device device)
|
---|
281 | {
|
---|
282 | if (card_vendor != HW_VENDOR_ATI) return FALSE;
|
---|
283 | if (device == CARD_ATI_RADEON_9500) return TRUE;
|
---|
284 | if (device == CARD_ATI_RADEON_X700) return TRUE;
|
---|
285 | if (device == CARD_ATI_RADEON_X1600) return TRUE;
|
---|
286 | return FALSE;
|
---|
287 | }
|
---|
288 |
|
---|
289 | static BOOL match_geforce5(const struct wined3d_gl_info *gl_info, const char *gl_renderer,
|
---|
290 | enum wined3d_gl_vendor gl_vendor, enum wined3d_pci_vendor card_vendor, enum wined3d_pci_device device)
|
---|
291 | {
|
---|
292 | if (card_vendor == HW_VENDOR_NVIDIA)
|
---|
293 | {
|
---|
294 | if (device == CARD_NVIDIA_GEFORCEFX_5800 || device == CARD_NVIDIA_GEFORCEFX_5600)
|
---|
295 | {
|
---|
296 | return TRUE;
|
---|
297 | }
|
---|
298 | }
|
---|
299 | return FALSE;
|
---|
300 | }
|
---|
301 |
|
---|
302 | static BOOL match_apple(const struct wined3d_gl_info *gl_info, const char *gl_renderer,
|
---|
303 | enum wined3d_gl_vendor gl_vendor, enum wined3d_pci_vendor card_vendor, enum wined3d_pci_device device)
|
---|
304 | {
|
---|
305 | /* MacOS has various specialities in the extensions it advertises. Some have to be loaded from
|
---|
306 | * the opengl 1.2+ core, while other extensions are advertised, but software emulated. So try to
|
---|
307 | * detect the Apple OpenGL implementation to apply some extension fixups afterwards.
|
---|
308 | *
|
---|
309 | * Detecting this isn't really easy. The vendor string doesn't mention Apple. Compile-time checks
|
---|
310 | * aren't sufficient either because a Linux binary may display on a macos X server via remote X11.
|
---|
311 | * So try to detect the GL implementation by looking at certain Apple extensions. Some extensions
|
---|
312 | * like client storage might be supported on other implementations too, but GL_APPLE_flush_render
|
---|
313 | * is specific to the Mac OS X window management, and GL_APPLE_ycbcr_422 is QuickTime specific. So
|
---|
314 | * the chance that other implementations support them is rather small since Win32 QuickTime uses
|
---|
315 | * DirectDraw, not OpenGL.
|
---|
316 | *
|
---|
317 | * This test has been moved into wined3d_guess_gl_vendor()
|
---|
318 | */
|
---|
319 | if (gl_vendor == GL_VENDOR_APPLE)
|
---|
320 | {
|
---|
321 | return TRUE;
|
---|
322 | }
|
---|
323 | return FALSE;
|
---|
324 | }
|
---|
325 |
|
---|
326 | /* Context activation is done by the caller. */
|
---|
327 | static void test_pbo_functionality(struct wined3d_gl_info *gl_info)
|
---|
328 | {
|
---|
329 | /* Some OpenGL implementations, namely Apple's Geforce 8 driver, advertises PBOs,
|
---|
330 | * but glTexSubImage from a PBO fails miserably, with the first line repeated over
|
---|
331 | * all the texture. This function detects this bug by its symptom and disables PBOs
|
---|
332 | * if the test fails.
|
---|
333 | *
|
---|
334 | * The test uploads a 4x4 texture via the PBO in the "native" format GL_BGRA,
|
---|
335 | * GL_UNSIGNED_INT_8_8_8_8_REV. This format triggers the bug, and it is what we use
|
---|
336 | * for D3DFMT_A8R8G8B8. Then the texture is read back without any PBO and the data
|
---|
337 | * read back is compared to the original. If they are equal PBOs are assumed to work,
|
---|
338 | * otherwise the PBO extension is disabled. */
|
---|
339 | GLuint texture, pbo;
|
---|
340 | static const unsigned int pattern[] =
|
---|
341 | {
|
---|
342 | 0x00000000, 0x000000ff, 0x0000ff00, 0x40ff0000,
|
---|
343 | 0x80ffffff, 0x40ffff00, 0x00ff00ff, 0x0000ffff,
|
---|
344 | 0x00ffff00, 0x00ff00ff, 0x0000ffff, 0x000000ff,
|
---|
345 | 0x80ff00ff, 0x0000ffff, 0x00ff00ff, 0x40ff00ff
|
---|
346 | };
|
---|
347 | unsigned int check[sizeof(pattern) / sizeof(pattern[0])];
|
---|
348 |
|
---|
349 | /* No PBO -> No point in testing them. */
|
---|
350 | if (!gl_info->supported[ARB_PIXEL_BUFFER_OBJECT]) return;
|
---|
351 |
|
---|
352 | ENTER_GL();
|
---|
353 |
|
---|
354 | while (glGetError());
|
---|
355 | glGenTextures(1, &texture);
|
---|
356 | glBindTexture(GL_TEXTURE_2D, texture);
|
---|
357 |
|
---|
358 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0);
|
---|
359 | glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 4, 4, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, 0);
|
---|
360 | checkGLcall("Specifying the PBO test texture");
|
---|
361 |
|
---|
362 | GL_EXTCALL(glGenBuffersARB(1, &pbo));
|
---|
363 | GL_EXTCALL(glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, pbo));
|
---|
364 | GL_EXTCALL(glBufferDataARB(GL_PIXEL_UNPACK_BUFFER_ARB, sizeof(pattern), pattern, GL_STREAM_DRAW_ARB));
|
---|
365 | checkGLcall("Specifying the PBO test pbo");
|
---|
366 |
|
---|
367 | glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 4, 4, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, NULL);
|
---|
368 | checkGLcall("Loading the PBO test texture");
|
---|
369 |
|
---|
370 | GL_EXTCALL(glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, 0));
|
---|
371 | #ifdef VBOX_WITH_VMSVGA
|
---|
372 | glFinish();
|
---|
373 | #else
|
---|
374 | wglFinish(); /* just to be sure */
|
---|
375 | #endif
|
---|
376 | memset(check, 0, sizeof(check));
|
---|
377 | glGetTexImage(GL_TEXTURE_2D, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, check);
|
---|
378 | checkGLcall("Reading back the PBO test texture");
|
---|
379 |
|
---|
380 | glDeleteTextures(1, &texture);
|
---|
381 | GL_EXTCALL(glDeleteBuffersARB(1, &pbo));
|
---|
382 | checkGLcall("PBO test cleanup");
|
---|
383 |
|
---|
384 | LEAVE_GL();
|
---|
385 |
|
---|
386 | if (memcmp(check, pattern, sizeof(check)))
|
---|
387 | {
|
---|
388 | WARN_(d3d_caps)("PBO test failed, read back data doesn't match original.\n");
|
---|
389 | WARN_(d3d_caps)("Disabling PBOs. This may result in slower performance.\n");
|
---|
390 | gl_info->supported[ARB_PIXEL_BUFFER_OBJECT] = FALSE;
|
---|
391 | }
|
---|
392 | else
|
---|
393 | {
|
---|
394 | TRACE_(d3d_caps)("PBO test successful.\n");
|
---|
395 | }
|
---|
396 | }
|
---|
397 |
|
---|
398 | static BOOL match_apple_intel(const struct wined3d_gl_info *gl_info, const char *gl_renderer,
|
---|
399 | enum wined3d_gl_vendor gl_vendor, enum wined3d_pci_vendor card_vendor, enum wined3d_pci_device device)
|
---|
400 | {
|
---|
401 | return (card_vendor == HW_VENDOR_INTEL) && (gl_vendor == GL_VENDOR_APPLE);
|
---|
402 | }
|
---|
403 |
|
---|
404 | static BOOL match_apple_nonr500ati(const struct wined3d_gl_info *gl_info, const char *gl_renderer,
|
---|
405 | enum wined3d_gl_vendor gl_vendor, enum wined3d_pci_vendor card_vendor, enum wined3d_pci_device device)
|
---|
406 | {
|
---|
407 | if (gl_vendor != GL_VENDOR_APPLE) return FALSE;
|
---|
408 | if (card_vendor != HW_VENDOR_ATI) return FALSE;
|
---|
409 | if (device == CARD_ATI_RADEON_X1600) return FALSE;
|
---|
410 | return TRUE;
|
---|
411 | }
|
---|
412 |
|
---|
413 | static BOOL match_fglrx(const struct wined3d_gl_info *gl_info, const char *gl_renderer,
|
---|
414 | enum wined3d_gl_vendor gl_vendor, enum wined3d_pci_vendor card_vendor, enum wined3d_pci_device device)
|
---|
415 | {
|
---|
416 | return gl_vendor == GL_VENDOR_FGLRX;
|
---|
417 |
|
---|
418 | }
|
---|
419 |
|
---|
420 | static BOOL match_dx10_capable(const struct wined3d_gl_info *gl_info, const char *gl_renderer,
|
---|
421 | enum wined3d_gl_vendor gl_vendor, enum wined3d_pci_vendor card_vendor, enum wined3d_pci_device device)
|
---|
422 | {
|
---|
423 | /* DX9 cards support 40 single float varyings in hardware, most drivers report 32. ATI misreports
|
---|
424 | * 44 varyings. So assume that if we have more than 44 varyings we have a dx10 card.
|
---|
425 | * This detection is for the gl_ClipPos varying quirk. If a d3d9 card really supports more than 44
|
---|
426 | * varyings and we subtract one in dx9 shaders its not going to hurt us because the dx9 limit is
|
---|
427 | * hardcoded
|
---|
428 | *
|
---|
429 | * dx10 cards usually have 64 varyings */
|
---|
430 | return gl_info->limits.glsl_varyings > 44;
|
---|
431 | }
|
---|
432 |
|
---|
433 | /* A GL context is provided by the caller */
|
---|
434 | static BOOL match_allows_spec_alpha(const struct wined3d_gl_info *gl_info, const char *gl_renderer,
|
---|
435 | enum wined3d_gl_vendor gl_vendor, enum wined3d_pci_vendor card_vendor, enum wined3d_pci_device device)
|
---|
436 | {
|
---|
437 | GLenum error;
|
---|
438 | DWORD data[16];
|
---|
439 |
|
---|
440 | if (!gl_info->supported[EXT_SECONDARY_COLOR]) return FALSE;
|
---|
441 |
|
---|
442 | ENTER_GL();
|
---|
443 | while(glGetError());
|
---|
444 | GL_EXTCALL(glSecondaryColorPointerEXT)(4, GL_UNSIGNED_BYTE, 4, data);
|
---|
445 | error = glGetError();
|
---|
446 | LEAVE_GL();
|
---|
447 |
|
---|
448 | if(error == GL_NO_ERROR)
|
---|
449 | {
|
---|
450 | TRACE("GL Implementation accepts 4 component specular color pointers\n");
|
---|
451 | return TRUE;
|
---|
452 | }
|
---|
453 | else
|
---|
454 | {
|
---|
455 | TRACE("GL implementation does not accept 4 component specular colors, error %s\n",
|
---|
456 | debug_glerror(error));
|
---|
457 | return FALSE;
|
---|
458 | }
|
---|
459 | }
|
---|
460 |
|
---|
461 | static BOOL match_apple_nvts(const struct wined3d_gl_info *gl_info, const char *gl_renderer,
|
---|
462 | enum wined3d_gl_vendor gl_vendor, enum wined3d_pci_vendor card_vendor, enum wined3d_pci_device device)
|
---|
463 | {
|
---|
464 | if (!match_apple(gl_info, gl_renderer, gl_vendor, card_vendor, device)) return FALSE;
|
---|
465 | return gl_info->supported[NV_TEXTURE_SHADER];
|
---|
466 | }
|
---|
467 |
|
---|
468 | /* A GL context is provided by the caller */
|
---|
469 | static BOOL match_broken_nv_clip(const struct wined3d_gl_info *gl_info, const char *gl_renderer,
|
---|
470 | enum wined3d_gl_vendor gl_vendor, enum wined3d_pci_vendor card_vendor, enum wined3d_pci_device device)
|
---|
471 | {
|
---|
472 | GLuint prog;
|
---|
473 | BOOL ret = FALSE;
|
---|
474 | GLint pos;
|
---|
475 | const char *testcode =
|
---|
476 | "!!ARBvp1.0\n"
|
---|
477 | "OPTION NV_vertex_program2;\n"
|
---|
478 | "MOV result.clip[0], 0.0;\n"
|
---|
479 | "MOV result.position, 0.0;\n"
|
---|
480 | "END\n";
|
---|
481 |
|
---|
482 | if (!gl_info->supported[NV_VERTEX_PROGRAM2_OPTION]) return FALSE;
|
---|
483 |
|
---|
484 | ENTER_GL();
|
---|
485 | while(glGetError());
|
---|
486 |
|
---|
487 | GL_EXTCALL(glGenProgramsARB(1, &prog));
|
---|
488 | if(!prog)
|
---|
489 | {
|
---|
490 | ERR("Failed to create the NVvp clip test program\n");
|
---|
491 | LEAVE_GL();
|
---|
492 | return FALSE;
|
---|
493 | }
|
---|
494 | GL_EXTCALL(glBindProgramARB(GL_VERTEX_PROGRAM_ARB, prog));
|
---|
495 | GL_EXTCALL(glProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
|
---|
496 | strlen(testcode), testcode));
|
---|
497 | glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &pos);
|
---|
498 | if(pos != -1)
|
---|
499 | {
|
---|
500 | WARN("GL_NV_vertex_program2_option result.clip[] test failed\n");
|
---|
501 | TRACE("error: %s\n", debugstr_a((const char *)glGetString(GL_PROGRAM_ERROR_STRING_ARB)));
|
---|
502 | ret = TRUE;
|
---|
503 | while(glGetError());
|
---|
504 | }
|
---|
505 | else TRACE("GL_NV_vertex_program2_option result.clip[] test passed\n");
|
---|
506 |
|
---|
507 | GL_EXTCALL(glBindProgramARB(GL_VERTEX_PROGRAM_ARB, 0));
|
---|
508 | GL_EXTCALL(glDeleteProgramsARB(1, &prog));
|
---|
509 | checkGLcall("GL_NV_vertex_program2_option result.clip[] test cleanup");
|
---|
510 |
|
---|
511 | LEAVE_GL();
|
---|
512 | return ret;
|
---|
513 | }
|
---|
514 |
|
---|
515 | /* Context activation is done by the caller. */
|
---|
516 | static BOOL match_fbo_tex_update(const struct wined3d_gl_info *gl_info, const char *gl_renderer,
|
---|
517 | enum wined3d_gl_vendor gl_vendor, enum wined3d_pci_vendor card_vendor, enum wined3d_pci_device device)
|
---|
518 | {
|
---|
519 | char data[4 * 4 * 4];
|
---|
520 | GLuint tex, fbo;
|
---|
521 | GLenum status;
|
---|
522 |
|
---|
523 | #ifndef VBOX_WITH_VMSVGA
|
---|
524 | if (wined3d_settings.offscreen_rendering_mode != ORM_FBO) return FALSE;
|
---|
525 | #endif
|
---|
526 | memset(data, 0xcc, sizeof(data));
|
---|
527 |
|
---|
528 | ENTER_GL();
|
---|
529 |
|
---|
530 | glGenTextures(1, &tex);
|
---|
531 | glBindTexture(GL_TEXTURE_2D, tex);
|
---|
532 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
---|
533 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
---|
534 | glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 4, 4, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, NULL);
|
---|
535 | checkGLcall("glTexImage2D");
|
---|
536 |
|
---|
537 | gl_info->fbo_ops.glGenFramebuffers(1, &fbo);
|
---|
538 | gl_info->fbo_ops.glBindFramebuffer(GL_FRAMEBUFFER, fbo);
|
---|
539 | gl_info->fbo_ops.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, tex, 0);
|
---|
540 | checkGLcall("glFramebufferTexture2D");
|
---|
541 |
|
---|
542 | status = gl_info->fbo_ops.glCheckFramebufferStatus(GL_FRAMEBUFFER);
|
---|
543 | if (status != GL_FRAMEBUFFER_COMPLETE) ERR("FBO status %#x\n", status);
|
---|
544 | checkGLcall("glCheckFramebufferStatus");
|
---|
545 |
|
---|
546 | memset(data, 0x11, sizeof(data));
|
---|
547 | glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 4, 4, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, data);
|
---|
548 | checkGLcall("glTexSubImage2D");
|
---|
549 |
|
---|
550 | glClearColor(0.996, 0.729, 0.745, 0.792);
|
---|
551 | glClear(GL_COLOR_BUFFER_BIT);
|
---|
552 | checkGLcall("glClear");
|
---|
553 |
|
---|
554 | glGetTexImage(GL_TEXTURE_2D, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, data);
|
---|
555 | checkGLcall("glGetTexImage");
|
---|
556 |
|
---|
557 | gl_info->fbo_ops.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, 0, 0);
|
---|
558 | gl_info->fbo_ops.glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
---|
559 | glBindTexture(GL_TEXTURE_2D, 0);
|
---|
560 | checkGLcall("glBindTexture");
|
---|
561 |
|
---|
562 | gl_info->fbo_ops.glDeleteFramebuffers(1, &fbo);
|
---|
563 | glDeleteTextures(1, &tex);
|
---|
564 | checkGLcall("glDeleteTextures");
|
---|
565 |
|
---|
566 | LEAVE_GL();
|
---|
567 |
|
---|
568 | return *(DWORD *)data == 0x11111111;
|
---|
569 | }
|
---|
570 |
|
---|
571 | static void quirk_arb_constants(struct wined3d_gl_info *gl_info)
|
---|
572 | {
|
---|
573 | TRACE_(d3d_caps)("Using ARB vs constant limit(=%u) for GLSL.\n", gl_info->limits.arb_vs_native_constants);
|
---|
574 | gl_info->limits.glsl_vs_float_constants = gl_info->limits.arb_vs_native_constants;
|
---|
575 | TRACE_(d3d_caps)("Using ARB ps constant limit(=%u) for GLSL.\n", gl_info->limits.arb_ps_native_constants);
|
---|
576 | gl_info->limits.glsl_ps_float_constants = gl_info->limits.arb_ps_native_constants;
|
---|
577 | }
|
---|
578 |
|
---|
579 | static void quirk_apple_glsl_constants(struct wined3d_gl_info *gl_info)
|
---|
580 | {
|
---|
581 | quirk_arb_constants(gl_info);
|
---|
582 | /* MacOS needs uniforms for relative addressing offsets. This can accumulate to quite a few uniforms.
|
---|
583 | * Beyond that the general uniform isn't optimal, so reserve a number of uniforms. 12 vec4's should
|
---|
584 | * allow 48 different offsets or other helper immediate values. */
|
---|
585 | TRACE_(d3d_caps)("Reserving 12 GLSL constants for compiler private use.\n");
|
---|
586 | gl_info->reserved_glsl_constants = max(gl_info->reserved_glsl_constants, 12);
|
---|
587 | }
|
---|
588 |
|
---|
589 | /* fglrx crashes with a very bad kernel panic if GL_POINT_SPRITE_ARB is set to GL_COORD_REPLACE_ARB
|
---|
590 | * on more than one texture unit. This means that the d3d9 visual point size test will cause a
|
---|
591 | * kernel panic on any machine running fglrx 9.3(latest that supports r300 to r500 cards). This
|
---|
592 | * quirk only enables point sprites on the first texture unit. This keeps point sprites working in
|
---|
593 | * most games, but avoids the crash
|
---|
594 | *
|
---|
595 | * A more sophisticated way would be to find all units that need texture coordinates and enable
|
---|
596 | * point sprites for one if only one is found, and software emulate point sprites in drawStridedSlow
|
---|
597 | * if more than one unit needs texture coordinates(This requires software ffp and vertex shaders though)
|
---|
598 | *
|
---|
599 | * Note that disabling the extension entirely does not gain predictability because there is no point
|
---|
600 | * sprite capability flag in d3d, so the potential rendering bugs are the same if we disable the extension. */
|
---|
601 | static void quirk_one_point_sprite(struct wined3d_gl_info *gl_info)
|
---|
602 | {
|
---|
603 | if (gl_info->supported[ARB_POINT_SPRITE])
|
---|
604 | {
|
---|
605 | TRACE("Limiting point sprites to one texture unit.\n");
|
---|
606 | gl_info->limits.point_sprite_units = 1;
|
---|
607 | }
|
---|
608 | }
|
---|
609 |
|
---|
610 | static void quirk_ati_dx9(struct wined3d_gl_info *gl_info)
|
---|
611 | {
|
---|
612 | quirk_arb_constants(gl_info);
|
---|
613 |
|
---|
614 | /* MacOS advertises GL_ARB_texture_non_power_of_two on ATI r500 and earlier cards, although
|
---|
615 | * these cards only support GL_ARB_texture_rectangle(D3DPTEXTURECAPS_NONPOW2CONDITIONAL).
|
---|
616 | * If real NP2 textures are used, the driver falls back to software. We could just remove the
|
---|
617 | * extension and use GL_ARB_texture_rectangle instead, but texture_rectangle is inconventient
|
---|
618 | * due to the non-normalized texture coordinates. Thus set an internal extension flag,
|
---|
619 | * GL_WINE_normalized_texrect, which signals the code that it can use non power of two textures
|
---|
620 | * as per GL_ARB_texture_non_power_of_two, but has to stick to the texture_rectangle limits.
|
---|
621 | *
|
---|
622 | * fglrx doesn't advertise GL_ARB_texture_non_power_of_two, but it advertises opengl 2.0 which
|
---|
623 | * has this extension promoted to core. The extension loading code sets this extension supported
|
---|
624 | * due to that, so this code works on fglrx as well. */
|
---|
625 | if(gl_info->supported[ARB_TEXTURE_NON_POWER_OF_TWO])
|
---|
626 | {
|
---|
627 | TRACE("GL_ARB_texture_non_power_of_two advertised on R500 or earlier card, removing.\n");
|
---|
628 | gl_info->supported[ARB_TEXTURE_NON_POWER_OF_TWO] = FALSE;
|
---|
629 | gl_info->supported[WINE_NORMALIZED_TEXRECT] = TRUE;
|
---|
630 | }
|
---|
631 |
|
---|
632 | /* fglrx has the same structural issues as the one described in quirk_apple_glsl_constants, although
|
---|
633 | * it is generally more efficient. Reserve just 8 constants. */
|
---|
634 | TRACE_(d3d_caps)("Reserving 8 GLSL constants for compiler private use.\n");
|
---|
635 | gl_info->reserved_glsl_constants = max(gl_info->reserved_glsl_constants, 8);
|
---|
636 | }
|
---|
637 |
|
---|
638 | static void quirk_no_np2(struct wined3d_gl_info *gl_info)
|
---|
639 | {
|
---|
640 | /* The nVidia GeForceFX series reports OpenGL 2.0 capabilities with the latest drivers versions, but
|
---|
641 | * doesn't explicitly advertise the ARB_tex_npot extension in the GL extension string.
|
---|
642 | * This usually means that ARB_tex_npot is supported in hardware as long as the application is staying
|
---|
643 | * within the limits enforced by the ARB_texture_rectangle extension. This however is not true for the
|
---|
644 | * FX series, which instantly falls back to a slower software path as soon as ARB_tex_npot is used.
|
---|
645 | * We therefore completely remove ARB_tex_npot from the list of supported extensions.
|
---|
646 | *
|
---|
647 | * Note that wine_normalized_texrect can't be used in this case because internally it uses ARB_tex_npot,
|
---|
648 | * triggering the software fallback. There is not much we can do here apart from disabling the
|
---|
649 | * software-emulated extension and reenable ARB_tex_rect (which was previously disabled
|
---|
650 | * in IWineD3DImpl_FillGLCaps).
|
---|
651 | * This fixup removes performance problems on both the FX 5900 and FX 5700 (e.g. for framebuffer
|
---|
652 | * post-processing effects in the game "Max Payne 2").
|
---|
653 | * The behaviour can be verified through a simple test app attached in bugreport #14724. */
|
---|
654 | TRACE("GL_ARB_texture_non_power_of_two advertised through OpenGL 2.0 on NV FX card, removing.\n");
|
---|
655 | gl_info->supported[ARB_TEXTURE_NON_POWER_OF_TWO] = FALSE;
|
---|
656 | gl_info->supported[ARB_TEXTURE_RECTANGLE] = TRUE;
|
---|
657 | }
|
---|
658 |
|
---|
659 | static void quirk_texcoord_w(struct wined3d_gl_info *gl_info)
|
---|
660 | {
|
---|
661 | /* The Intel GPUs on MacOS set the .w register of texcoords to 0.0 by default, which causes problems
|
---|
662 | * with fixed function fragment processing. Ideally this flag should be detected with a test shader
|
---|
663 | * and OpenGL feedback mode, but some GL implementations (MacOS ATI at least, probably all MacOS ones)
|
---|
664 | * do not like vertex shaders in feedback mode and return an error, even though it should be valid
|
---|
665 | * according to the spec.
|
---|
666 | *
|
---|
667 | * We don't want to enable this on all cards, as it adds an extra instruction per texcoord used. This
|
---|
668 | * makes the shader slower and eats instruction slots which should be available to the d3d app.
|
---|
669 | *
|
---|
670 | * ATI Radeon HD 2xxx cards on MacOS have the issue. Instead of checking for the buggy cards, blacklist
|
---|
671 | * all radeon cards on Macs and whitelist the good ones. That way we're prepared for the future. If
|
---|
672 | * this workaround is activated on cards that do not need it, it won't break things, just affect
|
---|
673 | * performance negatively. */
|
---|
674 | TRACE("Enabling vertex texture coord fixes in vertex shaders.\n");
|
---|
675 | gl_info->quirks |= WINED3D_QUIRK_SET_TEXCOORD_W;
|
---|
676 | }
|
---|
677 |
|
---|
678 | static void quirk_clip_varying(struct wined3d_gl_info *gl_info)
|
---|
679 | {
|
---|
680 | gl_info->quirks |= WINED3D_QUIRK_GLSL_CLIP_VARYING;
|
---|
681 | }
|
---|
682 |
|
---|
683 | static void quirk_allows_specular_alpha(struct wined3d_gl_info *gl_info)
|
---|
684 | {
|
---|
685 | gl_info->quirks |= WINED3D_QUIRK_ALLOWS_SPECULAR_ALPHA;
|
---|
686 | }
|
---|
687 |
|
---|
688 | static void quirk_apple_nvts(struct wined3d_gl_info *gl_info)
|
---|
689 | {
|
---|
690 | gl_info->supported[NV_TEXTURE_SHADER] = FALSE;
|
---|
691 | gl_info->supported[NV_TEXTURE_SHADER2] = FALSE;
|
---|
692 | }
|
---|
693 |
|
---|
694 | static void quirk_disable_nvvp_clip(struct wined3d_gl_info *gl_info)
|
---|
695 | {
|
---|
696 | gl_info->quirks |= WINED3D_QUIRK_NV_CLIP_BROKEN;
|
---|
697 | }
|
---|
698 |
|
---|
699 | static void quirk_fbo_tex_update(struct wined3d_gl_info *gl_info)
|
---|
700 | {
|
---|
701 | gl_info->quirks |= WINED3D_QUIRK_FBO_TEX_UPDATE;
|
---|
702 | }
|
---|
703 |
|
---|
704 | static BOOL match_ati_hd4800(const struct wined3d_gl_info *gl_info, const char *gl_renderer,
|
---|
705 | enum wined3d_gl_vendor gl_vendor, enum wined3d_pci_vendor card_vendor, enum wined3d_pci_device device)
|
---|
706 | {
|
---|
707 | if (card_vendor != HW_VENDOR_ATI) return FALSE;
|
---|
708 | if (device == CARD_ATI_RADEON_HD4800) return TRUE;
|
---|
709 | return FALSE;
|
---|
710 | }
|
---|
711 |
|
---|
712 | static void quirk_fullsize_blit(struct wined3d_gl_info *gl_info)
|
---|
713 | {
|
---|
714 | gl_info->quirks |= WINED3D_QUIRK_FULLSIZE_BLIT;
|
---|
715 | }
|
---|
716 |
|
---|
717 | #ifdef VBOX_WITH_WDDM
|
---|
718 | static BOOL match_mesa_nvidia(const struct wined3d_gl_info *gl_info, const char *gl_renderer,
|
---|
719 | enum wined3d_gl_vendor gl_vendor, enum wined3d_pci_vendor card_vendor, enum wined3d_pci_device device)
|
---|
720 | {
|
---|
721 | if (card_vendor != HW_VENDOR_NVIDIA) return FALSE;
|
---|
722 | if (gl_vendor != GL_VENDOR_MESA) return FALSE;
|
---|
723 | return TRUE;
|
---|
724 | }
|
---|
725 |
|
---|
726 | static void quirk_no_shader_3(struct wined3d_gl_info *gl_info)
|
---|
727 | {
|
---|
728 | int vs_selected_mode, ps_selected_mode;
|
---|
729 | select_shader_mode(gl_info, &ps_selected_mode, &vs_selected_mode);
|
---|
730 | if (vs_selected_mode != SHADER_GLSL && ps_selected_mode != SHADER_GLSL)
|
---|
731 | return;
|
---|
732 |
|
---|
733 | gl_info->limits.arb_ps_instructions = 512;
|
---|
734 | }
|
---|
735 | #endif
|
---|
736 |
|
---|
737 | static BOOL match_intel(const struct wined3d_gl_info *gl_info, const char *gl_renderer,
|
---|
738 | enum wined3d_gl_vendor gl_vendor, enum wined3d_pci_vendor card_vendor, enum wined3d_pci_device device)
|
---|
739 | {
|
---|
740 | if (card_vendor == HW_VENDOR_INTEL) return TRUE;
|
---|
741 | if (gl_vendor == HW_VENDOR_INTEL) return TRUE;
|
---|
742 | return FALSE;
|
---|
743 | }
|
---|
744 |
|
---|
745 | static void quirk_force_blit(struct wined3d_gl_info *gl_info)
|
---|
746 | {
|
---|
747 | gl_info->quirks |= WINED3D_QUIRK_FORCE_BLIT;
|
---|
748 | }
|
---|
749 |
|
---|
750 | struct driver_quirk
|
---|
751 | {
|
---|
752 | BOOL (*match)(const struct wined3d_gl_info *gl_info, const char *gl_renderer,
|
---|
753 | enum wined3d_gl_vendor gl_vendor, enum wined3d_pci_vendor card_vendor, enum wined3d_pci_device device);
|
---|
754 | void (*apply)(struct wined3d_gl_info *gl_info);
|
---|
755 | const char *description;
|
---|
756 | };
|
---|
757 |
|
---|
758 | static const struct driver_quirk quirk_table[] =
|
---|
759 | {
|
---|
760 | {
|
---|
761 | match_ati_r300_to_500,
|
---|
762 | quirk_ati_dx9,
|
---|
763 | "ATI GLSL constant and normalized texrect quirk"
|
---|
764 | },
|
---|
765 | /* MacOS advertises more GLSL vertex shader uniforms than supported by the hardware, and if more are
|
---|
766 | * used it falls back to software. While the compiler can detect if the shader uses all declared
|
---|
767 | * uniforms, the optimization fails if the shader uses relative addressing. So any GLSL shader
|
---|
768 | * using relative addressing falls back to software.
|
---|
769 | *
|
---|
770 | * ARB vp gives the correct amount of uniforms, so use it instead of GLSL. */
|
---|
771 | {
|
---|
772 | match_apple,
|
---|
773 | quirk_apple_glsl_constants,
|
---|
774 | "Apple GLSL uniform override"
|
---|
775 | },
|
---|
776 | {
|
---|
777 | match_geforce5,
|
---|
778 | quirk_no_np2,
|
---|
779 | "Geforce 5 NP2 disable"
|
---|
780 | },
|
---|
781 | {
|
---|
782 | match_apple_intel,
|
---|
783 | quirk_texcoord_w,
|
---|
784 | "Init texcoord .w for Apple Intel GPU driver"
|
---|
785 | },
|
---|
786 | {
|
---|
787 | match_apple_nonr500ati,
|
---|
788 | quirk_texcoord_w,
|
---|
789 | "Init texcoord .w for Apple ATI >= r600 GPU driver"
|
---|
790 | },
|
---|
791 | {
|
---|
792 | match_fglrx,
|
---|
793 | quirk_one_point_sprite,
|
---|
794 | "Fglrx point sprite crash workaround"
|
---|
795 | },
|
---|
796 | {
|
---|
797 | match_dx10_capable,
|
---|
798 | quirk_clip_varying,
|
---|
799 | "Reserved varying for gl_ClipPos"
|
---|
800 | },
|
---|
801 | {
|
---|
802 | /* GL_EXT_secondary_color does not allow 4 component secondary colors, but most
|
---|
803 | * GL implementations accept it. The Mac GL is the only implementation known to
|
---|
804 | * reject it.
|
---|
805 | *
|
---|
806 | * If we can pass 4 component specular colors, do it, because (a) we don't have
|
---|
807 | * to screw around with the data, and (b) the D3D fixed function vertex pipeline
|
---|
808 | * passes specular alpha to the pixel shader if any is used. Otherwise the
|
---|
809 | * specular alpha is used to pass the fog coordinate, which we pass to opengl
|
---|
810 | * via GL_EXT_fog_coord.
|
---|
811 | */
|
---|
812 | match_allows_spec_alpha,
|
---|
813 | quirk_allows_specular_alpha,
|
---|
814 | "Allow specular alpha quirk"
|
---|
815 | },
|
---|
816 | {
|
---|
817 | /* The pixel formats provided by GL_NV_texture_shader are broken on OSX
|
---|
818 | * (rdar://5682521).
|
---|
819 | */
|
---|
820 | match_apple_nvts,
|
---|
821 | quirk_apple_nvts,
|
---|
822 | "Apple NV_texture_shader disable"
|
---|
823 | },
|
---|
824 | #ifndef VBOX_WITH_VMSVGA
|
---|
825 | {
|
---|
826 | match_broken_nv_clip,
|
---|
827 | quirk_disable_nvvp_clip,
|
---|
828 | "Apple NV_vertex_program clip bug quirk"
|
---|
829 | },
|
---|
830 | #endif
|
---|
831 | {
|
---|
832 | match_fbo_tex_update,
|
---|
833 | quirk_fbo_tex_update,
|
---|
834 | "FBO rebind for attachment updates"
|
---|
835 | },
|
---|
836 | {
|
---|
837 | match_ati_hd4800,
|
---|
838 | quirk_fullsize_blit,
|
---|
839 | "Fullsize blit"
|
---|
840 | },
|
---|
841 | #ifdef VBOX_WITH_WDDM
|
---|
842 | {
|
---|
843 | match_mesa_nvidia,
|
---|
844 | quirk_no_shader_3,
|
---|
845 | "disable shader 3 support"
|
---|
846 | },
|
---|
847 | #endif
|
---|
848 | {
|
---|
849 | match_intel,
|
---|
850 | quirk_force_blit,
|
---|
851 | "force framebuffer blit when possible"
|
---|
852 | }
|
---|
853 | };
|
---|
854 |
|
---|
855 | /* Context activation is done by the caller. */
|
---|
856 | static void fixup_extensions(struct wined3d_gl_info *gl_info, const char *gl_renderer,
|
---|
857 | enum wined3d_gl_vendor gl_vendor, enum wined3d_pci_vendor card_vendor, enum wined3d_pci_device device)
|
---|
858 | {
|
---|
859 | unsigned int i;
|
---|
860 |
|
---|
861 | for (i = 0; i < (sizeof(quirk_table) / sizeof(*quirk_table)); ++i)
|
---|
862 | {
|
---|
863 | if (!quirk_table[i].match(gl_info, gl_renderer, gl_vendor, card_vendor, device)) continue;
|
---|
864 | TRACE_(d3d_caps)("Applying driver quirk \"%s\".\n", quirk_table[i].description);
|
---|
865 | quirk_table[i].apply(gl_info);
|
---|
866 | }
|
---|
867 |
|
---|
868 | /* Find out if PBOs work as they are supposed to. */
|
---|
869 | test_pbo_functionality(gl_info);
|
---|
870 | }
|
---|
871 |
|
---|
872 |
|
---|
873 | /* Certain applications (Steam) complain if we report an outdated driver version. In general,
|
---|
874 | * reporting a driver version is moot because we are not the Windows driver, and we have different
|
---|
875 | * bugs, features, etc.
|
---|
876 | *
|
---|
877 | * The driver version has the form "x.y.z.w".
|
---|
878 | *
|
---|
879 | * "x" is the Windows version the driver is meant for:
|
---|
880 | * 4 -> 95/98/NT4
|
---|
881 | * 5 -> 2000
|
---|
882 | * 6 -> 2000/XP
|
---|
883 | * 7 -> Vista
|
---|
884 | * 8 -> Win 7
|
---|
885 | *
|
---|
886 | * "y" is the Direct3D level the driver supports:
|
---|
887 | * 11 -> d3d6
|
---|
888 | * 12 -> d3d7
|
---|
889 | * 13 -> d3d8
|
---|
890 | * 14 -> d3d9
|
---|
891 | * 15 -> d3d10
|
---|
892 | *
|
---|
893 | * "z" is unknown, possibly vendor specific.
|
---|
894 | *
|
---|
895 | * "w" is the vendor specific driver version.
|
---|
896 | */
|
---|
897 | struct driver_version_information
|
---|
898 | {
|
---|
899 | WORD vendor; /* reported PCI card vendor ID */
|
---|
900 | WORD card; /* reported PCI card device ID */
|
---|
901 | const char *description; /* Description of the card e.g. NVIDIA RIVA TNT */
|
---|
902 | WORD d3d_level; /* driver hiword to report */
|
---|
903 | WORD lopart_hi, lopart_lo; /* driver loword to report */
|
---|
904 | };
|
---|
905 |
|
---|
906 | static const struct driver_version_information driver_version_table[] =
|
---|
907 | {
|
---|
908 | /* Nvidia drivers. Geforce6 and newer cards are supported by the current driver (180.x)
|
---|
909 | * GeforceFX support is up to 173.x, - driver uses numbering x.y.11.7341 for 173.41 where x is the windows revision (6=2000/xp, 7=vista), y is unknown
|
---|
910 | * Geforce2MX/3/4 up to 96.x - driver uses numbering 9.6.8.9 for 96.89
|
---|
911 | * TNT/Geforce1/2 up to 71.x - driver uses numbering 7.1.8.6 for 71.86
|
---|
912 | *
|
---|
913 | * All version numbers used below are from the Linux nvidia drivers. */
|
---|
914 | {HW_VENDOR_NVIDIA, CARD_NVIDIA_RIVA_TNT, "NVIDIA RIVA TNT", 1, 8, 6 },
|
---|
915 | {HW_VENDOR_NVIDIA, CARD_NVIDIA_RIVA_TNT2, "NVIDIA RIVA TNT2/TNT2 Pro", 1, 8, 6 },
|
---|
916 | {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE, "NVIDIA GeForce 256", 1, 8, 6 },
|
---|
917 | {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE2_MX, "NVIDIA GeForce2 MX/MX 400", 6, 4, 3 },
|
---|
918 | {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE2, "NVIDIA GeForce2 GTS/GeForce2 Pro", 1, 8, 6 },
|
---|
919 | {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE3, "NVIDIA GeForce3", 6, 10, 9371 },
|
---|
920 | {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE4_MX, "NVIDIA GeForce4 MX 460", 6, 10, 9371 },
|
---|
921 | {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE4_TI4200, "NVIDIA GeForce4 Ti 4200", 6, 10, 9371 },
|
---|
922 | {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCEFX_5200, "NVIDIA GeForce FX 5200", 15, 11, 7516 },
|
---|
923 | {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCEFX_5600, "NVIDIA GeForce FX 5600", 15, 11, 7516 },
|
---|
924 | {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCEFX_5800, "NVIDIA GeForce FX 5800", 15, 11, 7516 },
|
---|
925 | {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_6200, "NVIDIA GeForce 6200", 15, 11, 8618 },
|
---|
926 | {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_6600GT, "NVIDIA GeForce 6600 GT", 15, 11, 8618 },
|
---|
927 | {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_6800, "NVIDIA GeForce 6800", 15, 11, 8618 },
|
---|
928 | {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_7300, "NVIDIA GeForce Go 7300", 15, 11, 8585 },
|
---|
929 | {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_7400, "NVIDIA GeForce Go 7400", 15, 11, 8585 },
|
---|
930 | {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_7600, "NVIDIA GeForce 7600 GT", 15, 11, 8618 },
|
---|
931 | {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_7800GT, "NVIDIA GeForce 7800 GT", 15, 11, 8618 },
|
---|
932 | {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_8300GS, "NVIDIA GeForce 8300 GS", 15, 11, 8618 },
|
---|
933 | {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_8600GT, "NVIDIA GeForce 8600 GT", 15, 11, 8618 },
|
---|
934 | {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_8600MGT, "NVIDIA GeForce 8600M GT", 15, 11, 8585 },
|
---|
935 | {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_8800GTS, "NVIDIA GeForce 8800 GTS", 15, 11, 8618 },
|
---|
936 | {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_9200, "NVIDIA GeForce 9200", 15, 11, 8618 },
|
---|
937 | {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_9400GT, "NVIDIA GeForce 9400 GT", 15, 11, 8618 },
|
---|
938 | {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_9500GT, "NVIDIA GeForce 9500 GT", 15, 11, 8618 },
|
---|
939 | {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_9600GT, "NVIDIA GeForce 9600 GT", 15, 11, 8618 },
|
---|
940 | {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_9800GT, "NVIDIA GeForce 9800 GT", 15, 11, 8618 },
|
---|
941 | {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX260, "NVIDIA GeForce GTX 260", 15, 11, 8618 },
|
---|
942 | {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX275, "NVIDIA GeForce GTX 275", 15, 11, 8618 },
|
---|
943 | {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX280, "NVIDIA GeForce GTX 280", 15, 11, 8618 },
|
---|
944 | {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GT240, "NVIDIA GeForce GT 240", 15, 11, 8618 },
|
---|
945 |
|
---|
946 | /* ATI cards. The driver versions are somewhat similar, but not quite the same. Let's hardcode. */
|
---|
947 | {HW_VENDOR_ATI, CARD_ATI_RADEON_9500, "ATI Radeon 9500", 14, 10, 6764 },
|
---|
948 | {HW_VENDOR_ATI, CARD_ATI_RADEON_X700, "ATI Radeon X700 SE", 14, 10, 6764 },
|
---|
949 | {HW_VENDOR_ATI, CARD_ATI_RADEON_X1600, "ATI Radeon X1600 Series", 14, 10, 6764 },
|
---|
950 | {HW_VENDOR_ATI, CARD_ATI_RADEON_HD2350, "ATI Mobility Radeon HD 2350", 14, 10, 6764 },
|
---|
951 | {HW_VENDOR_ATI, CARD_ATI_RADEON_HD2600, "ATI Mobility Radeon HD 2600", 14, 10, 6764 },
|
---|
952 | {HW_VENDOR_ATI, CARD_ATI_RADEON_HD2900, "ATI Radeon HD 2900 XT", 14, 10, 6764 },
|
---|
953 | {HW_VENDOR_ATI, CARD_ATI_RADEON_HD4350, "ATI Radeon HD 4350", 14, 10, 6764 },
|
---|
954 | {HW_VENDOR_ATI, CARD_ATI_RADEON_HD4600, "ATI Radeon HD 4600 Series", 14, 10, 6764 },
|
---|
955 | {HW_VENDOR_ATI, CARD_ATI_RADEON_HD4700, "ATI Radeon HD 4700 Series", 14, 10, 6764 },
|
---|
956 | {HW_VENDOR_ATI, CARD_ATI_RADEON_HD4800, "ATI Radeon HD 4800 Series", 14, 10, 6764 },
|
---|
957 | {HW_VENDOR_ATI, CARD_ATI_RADEON_HD5700, "ATI Radeon HD 5700 Series", 14, 10, 8681 },
|
---|
958 | {HW_VENDOR_ATI, CARD_ATI_RADEON_HD5800, "ATI Radeon HD 5800 Series", 14, 10, 8681 },
|
---|
959 |
|
---|
960 | /* TODO: Add information about legacy ATI hardware, Intel and other cards. */
|
---|
961 | };
|
---|
962 |
|
---|
963 |
|
---|
964 | static DWORD wined3d_parse_gl_version(const char *gl_version)
|
---|
965 | {
|
---|
966 | const char *ptr = gl_version;
|
---|
967 | int major, minor;
|
---|
968 |
|
---|
969 | major = atoi(ptr);
|
---|
970 | if (major <= 0) ERR_(d3d_caps)("Invalid opengl major version: %d.\n", major);
|
---|
971 |
|
---|
972 | while (isdigit(*ptr)) ++ptr;
|
---|
973 | if (*ptr++ != '.') ERR_(d3d_caps)("Invalid opengl version string: %s.\n", debugstr_a(gl_version));
|
---|
974 |
|
---|
975 | minor = atoi(ptr);
|
---|
976 |
|
---|
977 | TRACE_(d3d_caps)("Found OpenGL version: %d.%d.\n", major, minor);
|
---|
978 |
|
---|
979 | return MAKEDWORD_VERSION(major, minor);
|
---|
980 | }
|
---|
981 |
|
---|
982 | static enum wined3d_gl_vendor wined3d_guess_gl_vendor(struct wined3d_gl_info *gl_info, const char *gl_vendor_string, const char *gl_renderer)
|
---|
983 | {
|
---|
984 |
|
---|
985 | /* MacOS has various specialities in the extensions it advertises. Some have to be loaded from
|
---|
986 | * the opengl 1.2+ core, while other extensions are advertised, but software emulated. So try to
|
---|
987 | * detect the Apple OpenGL implementation to apply some extension fixups afterwards.
|
---|
988 | *
|
---|
989 | * Detecting this isn't really easy. The vendor string doesn't mention Apple. Compile-time checks
|
---|
990 | * aren't sufficient either because a Linux binary may display on a macos X server via remote X11.
|
---|
991 | * So try to detect the GL implementation by looking at certain Apple extensions. Some extensions
|
---|
992 | * like client storage might be supported on other implementations too, but GL_APPLE_flush_render
|
---|
993 | * is specific to the Mac OS X window management, and GL_APPLE_ycbcr_422 is QuickTime specific. So
|
---|
994 | * the chance that other implementations support them is rather small since Win32 QuickTime uses
|
---|
995 | * DirectDraw, not OpenGL. */
|
---|
996 | if (gl_info->supported[APPLE_FENCE]
|
---|
997 | && gl_info->supported[APPLE_CLIENT_STORAGE]
|
---|
998 | && gl_info->supported[APPLE_FLUSH_RENDER]
|
---|
999 | && gl_info->supported[APPLE_YCBCR_422])
|
---|
1000 | return GL_VENDOR_APPLE;
|
---|
1001 |
|
---|
1002 | if (strstr(gl_vendor_string, "NVIDIA"))
|
---|
1003 | return GL_VENDOR_NVIDIA;
|
---|
1004 |
|
---|
1005 | if (strstr(gl_vendor_string, "ATI"))
|
---|
1006 | return GL_VENDOR_FGLRX;
|
---|
1007 |
|
---|
1008 | if (strstr(gl_vendor_string, "Intel(R)")
|
---|
1009 | || strstr(gl_renderer, "Intel(R)")
|
---|
1010 | || strstr(gl_vendor_string, "Intel Inc."))
|
---|
1011 | {
|
---|
1012 | if (strstr(gl_renderer, "Mesa"))
|
---|
1013 | return GL_VENDOR_MESA;
|
---|
1014 | return GL_VENDOR_INTEL;
|
---|
1015 | }
|
---|
1016 |
|
---|
1017 | if (strstr(gl_vendor_string, "Mesa")
|
---|
1018 | || strstr(gl_vendor_string, "Advanced Micro Devices, Inc.")
|
---|
1019 | || strstr(gl_vendor_string, "DRI R300 Project")
|
---|
1020 | || strstr(gl_vendor_string, "X.Org R300 Project")
|
---|
1021 | || strstr(gl_vendor_string, "Tungsten Graphics, Inc")
|
---|
1022 | || strstr(gl_vendor_string, "VMware, Inc.")
|
---|
1023 | || strstr(gl_renderer, "Mesa")
|
---|
1024 | || strstr(gl_renderer, "Gallium"))
|
---|
1025 | return GL_VENDOR_MESA;
|
---|
1026 |
|
---|
1027 | FIXME_(d3d_caps)("Received unrecognized GL_VENDOR %s. Returning GL_VENDOR_UNKNOWN.\n",
|
---|
1028 | debugstr_a(gl_vendor_string));
|
---|
1029 |
|
---|
1030 | return GL_VENDOR_UNKNOWN;
|
---|
1031 | }
|
---|
1032 |
|
---|
1033 | static enum wined3d_pci_vendor wined3d_guess_card_vendor(const char *gl_vendor_string, const char *gl_renderer)
|
---|
1034 | {
|
---|
1035 | if (strstr(gl_vendor_string, "NVIDIA"))
|
---|
1036 | return HW_VENDOR_NVIDIA;
|
---|
1037 |
|
---|
1038 | if (strstr(gl_vendor_string, "ATI")
|
---|
1039 | || strstr(gl_vendor_string, "Advanced Micro Devices, Inc.")
|
---|
1040 | || strstr(gl_vendor_string, "X.Org R300 Project")
|
---|
1041 | || strstr(gl_vendor_string, "DRI R300 Project"))
|
---|
1042 | return HW_VENDOR_ATI;
|
---|
1043 |
|
---|
1044 | if (strstr(gl_vendor_string, "Intel(R)")
|
---|
1045 | || strstr(gl_renderer, "Intel(R)")
|
---|
1046 | || strstr(gl_vendor_string, "Intel Inc."))
|
---|
1047 | return HW_VENDOR_INTEL;
|
---|
1048 |
|
---|
1049 | if (strstr(gl_vendor_string, "Mesa")
|
---|
1050 | || strstr(gl_vendor_string, "Tungsten Graphics, Inc")
|
---|
1051 | || strstr(gl_vendor_string, "VMware, Inc."))
|
---|
1052 | return HW_VENDOR_SOFTWARE;
|
---|
1053 |
|
---|
1054 | FIXME_(d3d_caps)("Received unrecognized GL_VENDOR %s. Returning HW_VENDOR_NVIDIA.\n", debugstr_a(gl_vendor_string));
|
---|
1055 |
|
---|
1056 | return HW_VENDOR_NVIDIA;
|
---|
1057 | }
|
---|
1058 |
|
---|
1059 |
|
---|
1060 |
|
---|
1061 | static enum wined3d_pci_device select_card_nvidia_binary(const struct wined3d_gl_info *gl_info,
|
---|
1062 | const char *gl_renderer, unsigned int *vidmem)
|
---|
1063 | {
|
---|
1064 | #ifndef VBOX_WITH_WDDM
|
---|
1065 | if (WINE_D3D10_CAPABLE(gl_info))
|
---|
1066 | #endif
|
---|
1067 | {
|
---|
1068 | /* Geforce 200 - highend */
|
---|
1069 | if (strstr(gl_renderer, "GTX 280")
|
---|
1070 | || strstr(gl_renderer, "GTX 285")
|
---|
1071 | || strstr(gl_renderer, "GTX 295"))
|
---|
1072 | {
|
---|
1073 | *vidmem = 1024;
|
---|
1074 | return CARD_NVIDIA_GEFORCE_GTX280;
|
---|
1075 | }
|
---|
1076 |
|
---|
1077 | /* Geforce 200 - midend high */
|
---|
1078 | if (strstr(gl_renderer, "GTX 275"))
|
---|
1079 | {
|
---|
1080 | *vidmem = 896;
|
---|
1081 | return CARD_NVIDIA_GEFORCE_GTX275;
|
---|
1082 | }
|
---|
1083 |
|
---|
1084 | /* Geforce 200 - midend */
|
---|
1085 | if (strstr(gl_renderer, "GTX 260"))
|
---|
1086 | {
|
---|
1087 | *vidmem = 1024;
|
---|
1088 | return CARD_NVIDIA_GEFORCE_GTX260;
|
---|
1089 | }
|
---|
1090 | /* Geforce 200 - midend */
|
---|
1091 | if (strstr(gl_renderer, "GT 240"))
|
---|
1092 | {
|
---|
1093 | *vidmem = 512;
|
---|
1094 | return CARD_NVIDIA_GEFORCE_GT240;
|
---|
1095 | }
|
---|
1096 |
|
---|
1097 | /* Geforce9 - highend / Geforce 200 - midend (GTS 150/250 are based on the same core) */
|
---|
1098 | if (strstr(gl_renderer, "9800")
|
---|
1099 | || strstr(gl_renderer, "GTS 150")
|
---|
1100 | || strstr(gl_renderer, "GTS 250"))
|
---|
1101 | {
|
---|
1102 | *vidmem = 512;
|
---|
1103 | return CARD_NVIDIA_GEFORCE_9800GT;
|
---|
1104 | }
|
---|
1105 |
|
---|
1106 | /* Geforce9 - midend */
|
---|
1107 | if (strstr(gl_renderer, "9600"))
|
---|
1108 | {
|
---|
1109 | *vidmem = 384; /* The 9600GSO has 384MB, the 9600GT has 512-1024MB */
|
---|
1110 | return CARD_NVIDIA_GEFORCE_9600GT;
|
---|
1111 | }
|
---|
1112 |
|
---|
1113 | /* Geforce9 - midend low / Geforce 200 - low */
|
---|
1114 | if (strstr(gl_renderer, "9500")
|
---|
1115 | || strstr(gl_renderer, "GT 120")
|
---|
1116 | || strstr(gl_renderer, "GT 130"))
|
---|
1117 | {
|
---|
1118 | *vidmem = 256; /* The 9500GT has 256-1024MB */
|
---|
1119 | return CARD_NVIDIA_GEFORCE_9500GT;
|
---|
1120 | }
|
---|
1121 |
|
---|
1122 | /* Geforce9 - lowend */
|
---|
1123 | if (strstr(gl_renderer, "9400"))
|
---|
1124 | {
|
---|
1125 | *vidmem = 256; /* The 9400GT has 256-1024MB */
|
---|
1126 | return CARD_NVIDIA_GEFORCE_9400GT;
|
---|
1127 | }
|
---|
1128 |
|
---|
1129 | /* Geforce9 - lowend low */
|
---|
1130 | if (strstr(gl_renderer, "9100")
|
---|
1131 | || strstr(gl_renderer, "9200")
|
---|
1132 | || strstr(gl_renderer, "9300")
|
---|
1133 | || strstr(gl_renderer, "G 100"))
|
---|
1134 | {
|
---|
1135 | *vidmem = 256; /* The 9100-9300 cards have 256MB */
|
---|
1136 | return CARD_NVIDIA_GEFORCE_9200;
|
---|
1137 | }
|
---|
1138 |
|
---|
1139 | /* Geforce8 - highend */
|
---|
1140 | if (strstr(gl_renderer, "8800"))
|
---|
1141 | {
|
---|
1142 | *vidmem = 320; /* The 8800GTS uses 320MB, a 8800GTX can have 768MB */
|
---|
1143 | return CARD_NVIDIA_GEFORCE_8800GTS;
|
---|
1144 | }
|
---|
1145 |
|
---|
1146 | /* Geforce8 - midend mobile */
|
---|
1147 | if (strstr(gl_renderer, "8600 M"))
|
---|
1148 | {
|
---|
1149 | *vidmem = 512;
|
---|
1150 | return CARD_NVIDIA_GEFORCE_8600MGT;
|
---|
1151 | }
|
---|
1152 |
|
---|
1153 | /* Geforce8 - midend */
|
---|
1154 | if (strstr(gl_renderer, "8600")
|
---|
1155 | || strstr(gl_renderer, "8700"))
|
---|
1156 | {
|
---|
1157 | *vidmem = 256;
|
---|
1158 | return CARD_NVIDIA_GEFORCE_8600GT;
|
---|
1159 | }
|
---|
1160 |
|
---|
1161 | /* Geforce8 - lowend */
|
---|
1162 | if (strstr(gl_renderer, "8100")
|
---|
1163 | || strstr(gl_renderer, "8200")
|
---|
1164 | || strstr(gl_renderer, "8300")
|
---|
1165 | || strstr(gl_renderer, "8400")
|
---|
1166 | || strstr(gl_renderer, "8500"))
|
---|
1167 | {
|
---|
1168 | *vidmem = 128; /* 128-256MB for a 8300, 256-512MB for a 8400 */
|
---|
1169 | return CARD_NVIDIA_GEFORCE_8300GS;
|
---|
1170 | }
|
---|
1171 |
|
---|
1172 | /* Geforce8-compatible fall back if the GPU is not in the list yet */
|
---|
1173 | *vidmem = 128;
|
---|
1174 | return CARD_NVIDIA_GEFORCE_8300GS;
|
---|
1175 | }
|
---|
1176 |
|
---|
1177 | /* Both the GeforceFX, 6xxx and 7xxx series support D3D9. The last two types have more
|
---|
1178 | * shader capabilities, so we use the shader capabilities to distinguish between FX and 6xxx/7xxx.
|
---|
1179 | */
|
---|
1180 | if (WINE_D3D9_CAPABLE(gl_info) && gl_info->supported[NV_VERTEX_PROGRAM3])
|
---|
1181 | {
|
---|
1182 | /* Geforce7 - highend */
|
---|
1183 | if (strstr(gl_renderer, "7800")
|
---|
1184 | || strstr(gl_renderer, "7900")
|
---|
1185 | || strstr(gl_renderer, "7950")
|
---|
1186 | || strstr(gl_renderer, "Quadro FX 4")
|
---|
1187 | || strstr(gl_renderer, "Quadro FX 5"))
|
---|
1188 | {
|
---|
1189 | *vidmem = 256; /* A 7800GT uses 256MB while highend 7900 cards can use 512MB */
|
---|
1190 | return CARD_NVIDIA_GEFORCE_7800GT;
|
---|
1191 | }
|
---|
1192 |
|
---|
1193 | /* Geforce7 midend */
|
---|
1194 | if (strstr(gl_renderer, "7600")
|
---|
1195 | || strstr(gl_renderer, "7700"))
|
---|
1196 | {
|
---|
1197 | *vidmem = 256; /* The 7600 uses 256-512MB */
|
---|
1198 | return CARD_NVIDIA_GEFORCE_7600;
|
---|
1199 | }
|
---|
1200 |
|
---|
1201 | /* Geforce7 lower medium */
|
---|
1202 | if (strstr(gl_renderer, "7400"))
|
---|
1203 | {
|
---|
1204 | *vidmem = 256; /* The 7400 uses 256-512MB */
|
---|
1205 | return CARD_NVIDIA_GEFORCE_7400;
|
---|
1206 | }
|
---|
1207 |
|
---|
1208 | /* Geforce7 lowend */
|
---|
1209 | if (strstr(gl_renderer, "7300"))
|
---|
1210 | {
|
---|
1211 | *vidmem = 256; /* Mac Pros with this card have 256 MB */
|
---|
1212 | return CARD_NVIDIA_GEFORCE_7300;
|
---|
1213 | }
|
---|
1214 |
|
---|
1215 | /* Geforce6 highend */
|
---|
1216 | if (strstr(gl_renderer, "6800"))
|
---|
1217 | {
|
---|
1218 | *vidmem = 128; /* The 6800 uses 128-256MB, the 7600 uses 256-512MB */
|
---|
1219 | return CARD_NVIDIA_GEFORCE_6800;
|
---|
1220 | }
|
---|
1221 |
|
---|
1222 | /* Geforce6 - midend */
|
---|
1223 | if (strstr(gl_renderer, "6600")
|
---|
1224 | || strstr(gl_renderer, "6610")
|
---|
1225 | || strstr(gl_renderer, "6700"))
|
---|
1226 | {
|
---|
1227 | *vidmem = 128; /* A 6600GT has 128-256MB */
|
---|
1228 | return CARD_NVIDIA_GEFORCE_6600GT;
|
---|
1229 | }
|
---|
1230 |
|
---|
1231 | /* Geforce6/7 lowend */
|
---|
1232 | *vidmem = 64; /* */
|
---|
1233 | return CARD_NVIDIA_GEFORCE_6200; /* Geforce 6100/6150/6200/7300/7400/7500 */
|
---|
1234 | }
|
---|
1235 |
|
---|
1236 | if (WINE_D3D9_CAPABLE(gl_info))
|
---|
1237 | {
|
---|
1238 | /* GeforceFX - highend */
|
---|
1239 | if (strstr(gl_renderer, "5800")
|
---|
1240 | || strstr(gl_renderer, "5900")
|
---|
1241 | || strstr(gl_renderer, "5950")
|
---|
1242 | || strstr(gl_renderer, "Quadro FX"))
|
---|
1243 | {
|
---|
1244 | *vidmem = 256; /* 5800-5900 cards use 256MB */
|
---|
1245 | return CARD_NVIDIA_GEFORCEFX_5800;
|
---|
1246 | }
|
---|
1247 |
|
---|
1248 | /* GeforceFX - midend */
|
---|
1249 | if (strstr(gl_renderer, "5600")
|
---|
1250 | || strstr(gl_renderer, "5650")
|
---|
1251 | || strstr(gl_renderer, "5700")
|
---|
1252 | || strstr(gl_renderer, "5750"))
|
---|
1253 | {
|
---|
1254 | *vidmem = 128; /* A 5600 uses 128-256MB */
|
---|
1255 | return CARD_NVIDIA_GEFORCEFX_5600;
|
---|
1256 | }
|
---|
1257 |
|
---|
1258 | /* GeforceFX - lowend */
|
---|
1259 | *vidmem = 64; /* Normal FX5200 cards use 64-256MB; laptop (non-standard) can have less */
|
---|
1260 | return CARD_NVIDIA_GEFORCEFX_5200; /* GeforceFX 5100/5200/5250/5300/5500 */
|
---|
1261 | }
|
---|
1262 |
|
---|
1263 | if (WINE_D3D8_CAPABLE(gl_info))
|
---|
1264 | {
|
---|
1265 | if (strstr(gl_renderer, "GeForce4 Ti") || strstr(gl_renderer, "Quadro4"))
|
---|
1266 | {
|
---|
1267 | *vidmem = 64; /* Geforce4 Ti cards have 64-128MB */
|
---|
1268 | return CARD_NVIDIA_GEFORCE4_TI4200; /* Geforce4 Ti4200/Ti4400/Ti4600/Ti4800, Quadro4 */
|
---|
1269 | }
|
---|
1270 |
|
---|
1271 | *vidmem = 64; /* Geforce3 cards have 64-128MB */
|
---|
1272 | return CARD_NVIDIA_GEFORCE3; /* Geforce3 standard/Ti200/Ti500, Quadro DCC */
|
---|
1273 | }
|
---|
1274 |
|
---|
1275 | if (WINE_D3D7_CAPABLE(gl_info))
|
---|
1276 | {
|
---|
1277 | if (strstr(gl_renderer, "GeForce4 MX"))
|
---|
1278 | {
|
---|
1279 | /* Most Geforce4MX GPUs have at least 64MB of memory, some
|
---|
1280 | * early models had 32MB but most have 64MB or even 128MB. */
|
---|
1281 | *vidmem = 64;
|
---|
1282 | return CARD_NVIDIA_GEFORCE4_MX; /* MX420/MX440/MX460/MX4000 */
|
---|
1283 | }
|
---|
1284 |
|
---|
1285 | if (strstr(gl_renderer, "GeForce2 MX") || strstr(gl_renderer, "Quadro2 MXR"))
|
---|
1286 | {
|
---|
1287 | *vidmem = 32; /* Geforce2MX GPUs have 32-64MB of video memory */
|
---|
1288 | return CARD_NVIDIA_GEFORCE2_MX; /* Geforce2 standard/MX100/MX200/MX400, Quadro2 MXR */
|
---|
1289 | }
|
---|
1290 |
|
---|
1291 | if (strstr(gl_renderer, "GeForce2") || strstr(gl_renderer, "Quadro2"))
|
---|
1292 | {
|
---|
1293 | *vidmem = 32; /* Geforce2 GPUs have 32-64MB of video memory */
|
---|
1294 | return CARD_NVIDIA_GEFORCE2; /* Geforce2 GTS/Pro/Ti/Ultra, Quadro2 */
|
---|
1295 | }
|
---|
1296 |
|
---|
1297 | /* Most Geforce1 cards have 32MB, there are also some rare 16
|
---|
1298 | * and 64MB (Dell) models. */
|
---|
1299 | *vidmem = 32;
|
---|
1300 | return CARD_NVIDIA_GEFORCE; /* Geforce 256/DDR, Quadro */
|
---|
1301 | }
|
---|
1302 |
|
---|
1303 | if (strstr(gl_renderer, "TNT2"))
|
---|
1304 | {
|
---|
1305 | *vidmem = 32; /* Most TNT2 boards have 32MB, though there are 16MB boards too */
|
---|
1306 | return CARD_NVIDIA_RIVA_TNT2; /* Riva TNT2 standard/M64/Pro/Ultra */
|
---|
1307 | }
|
---|
1308 |
|
---|
1309 | *vidmem = 16; /* Most TNT boards have 16MB, some rare models have 8MB */
|
---|
1310 | return CARD_NVIDIA_RIVA_TNT; /* Riva TNT, Vanta */
|
---|
1311 |
|
---|
1312 | }
|
---|
1313 |
|
---|
1314 | static enum wined3d_pci_device select_card_ati_binary(const struct wined3d_gl_info *gl_info,
|
---|
1315 | const char *gl_renderer, unsigned int *vidmem)
|
---|
1316 | {
|
---|
1317 | /* See http://developer.amd.com/drivers/pc_vendor_id/Pages/default.aspx
|
---|
1318 | *
|
---|
1319 | * Beware: renderer string do not match exact card model,
|
---|
1320 | * eg HD 4800 is returned for multiple cards, even for RV790 based ones. */
|
---|
1321 | #ifndef VBOX_WITH_WDDM
|
---|
1322 | if (WINE_D3D10_CAPABLE(gl_info))
|
---|
1323 | #endif
|
---|
1324 | {
|
---|
1325 | /* Radeon EG CYPRESS XT / PRO HD5800 - highend */
|
---|
1326 | if (strstr(gl_renderer, "HD 5800") /* Radeon EG CYPRESS HD58xx generic renderer string */
|
---|
1327 | || strstr(gl_renderer, "HD 5850") /* Radeon EG CYPRESS XT */
|
---|
1328 | || strstr(gl_renderer, "HD 5870")) /* Radeon EG CYPRESS PRO */
|
---|
1329 | {
|
---|
1330 | *vidmem = 1024; /* note: HD58xx cards use 1024MB */
|
---|
1331 | return CARD_ATI_RADEON_HD5800;
|
---|
1332 | }
|
---|
1333 |
|
---|
1334 | /* Radeon EG JUNIPER XT / LE HD5700 - midend */
|
---|
1335 | if (strstr(gl_renderer, "HD 5700") /* Radeon EG JUNIPER HD57xx generic renderer string */
|
---|
1336 | || strstr(gl_renderer, "HD 5750") /* Radeon EG JUNIPER LE */
|
---|
1337 | || strstr(gl_renderer, "HD 5770")) /* Radeon EG JUNIPER XT */
|
---|
1338 | {
|
---|
1339 | *vidmem = 512; /* note: HD5770 cards use 1024MB and HD5750 cards use 512MB or 1024MB */
|
---|
1340 | return CARD_ATI_RADEON_HD5700;
|
---|
1341 | }
|
---|
1342 |
|
---|
1343 | /* Radeon R7xx HD4800 - highend */
|
---|
1344 | if (strstr(gl_renderer, "HD 4800") /* Radeon RV7xx HD48xx generic renderer string */
|
---|
1345 | || strstr(gl_renderer, "HD 4830") /* Radeon RV770 */
|
---|
1346 | || strstr(gl_renderer, "HD 4850") /* Radeon RV770 */
|
---|
1347 | || strstr(gl_renderer, "HD 4870") /* Radeon RV770 */
|
---|
1348 | || strstr(gl_renderer, "HD 4890")) /* Radeon RV790 */
|
---|
1349 | {
|
---|
1350 | *vidmem = 512; /* note: HD4890 cards use 1024MB */
|
---|
1351 | return CARD_ATI_RADEON_HD4800;
|
---|
1352 | }
|
---|
1353 |
|
---|
1354 | /* Radeon R740 HD4700 - midend */
|
---|
1355 | if (strstr(gl_renderer, "HD 4700") /* Radeon RV770 */
|
---|
1356 | || strstr(gl_renderer, "HD 4770")) /* Radeon RV740 */
|
---|
1357 | {
|
---|
1358 | *vidmem = 512;
|
---|
1359 | return CARD_ATI_RADEON_HD4700;
|
---|
1360 | }
|
---|
1361 |
|
---|
1362 | /* Radeon R730 HD4600 - midend */
|
---|
1363 | if (strstr(gl_renderer, "HD 4600") /* Radeon RV730 */
|
---|
1364 | || strstr(gl_renderer, "HD 4650") /* Radeon RV730 */
|
---|
1365 | || strstr(gl_renderer, "HD 4670")) /* Radeon RV730 */
|
---|
1366 | {
|
---|
1367 | *vidmem = 512;
|
---|
1368 | return CARD_ATI_RADEON_HD4600;
|
---|
1369 | }
|
---|
1370 |
|
---|
1371 | /* Radeon R710 HD4500/HD4350 - lowend */
|
---|
1372 | if (strstr(gl_renderer, "HD 4350") /* Radeon RV710 */
|
---|
1373 | || strstr(gl_renderer, "HD 4550")) /* Radeon RV710 */
|
---|
1374 | {
|
---|
1375 | *vidmem = 256;
|
---|
1376 | return CARD_ATI_RADEON_HD4350;
|
---|
1377 | }
|
---|
1378 |
|
---|
1379 | /* Radeon R6xx HD2900/HD3800 - highend */
|
---|
1380 | if (strstr(gl_renderer, "HD 2900")
|
---|
1381 | || strstr(gl_renderer, "HD 3870")
|
---|
1382 | || strstr(gl_renderer, "HD 3850"))
|
---|
1383 | {
|
---|
1384 | *vidmem = 512; /* HD2900/HD3800 uses 256-1024MB */
|
---|
1385 | return CARD_ATI_RADEON_HD2900;
|
---|
1386 | }
|
---|
1387 |
|
---|
1388 | /* Radeon R6xx HD2600/HD3600 - midend; HD3830 is China-only midend */
|
---|
1389 | if (strstr(gl_renderer, "HD 2600")
|
---|
1390 | || strstr(gl_renderer, "HD 3830")
|
---|
1391 | || strstr(gl_renderer, "HD 3690")
|
---|
1392 | || strstr(gl_renderer, "HD 3650"))
|
---|
1393 | {
|
---|
1394 | *vidmem = 256; /* HD2600/HD3600 uses 256-512MB */
|
---|
1395 | return CARD_ATI_RADEON_HD2600;
|
---|
1396 | }
|
---|
1397 |
|
---|
1398 | /* Radeon R6xx HD2350/HD2400/HD3400 - lowend
|
---|
1399 | * Note HD2300=DX9, HD2350=DX10 */
|
---|
1400 | if (strstr(gl_renderer, "HD 2350")
|
---|
1401 | || strstr(gl_renderer, "HD 2400")
|
---|
1402 | || strstr(gl_renderer, "HD 3470")
|
---|
1403 | || strstr(gl_renderer, "HD 3450")
|
---|
1404 | || strstr(gl_renderer, "HD 3430")
|
---|
1405 | || strstr(gl_renderer, "HD 3400"))
|
---|
1406 | {
|
---|
1407 | *vidmem = 256; /* HD2350/2400 use 256MB, HD34xx use 256-512MB */
|
---|
1408 | return CARD_ATI_RADEON_HD2350;
|
---|
1409 | }
|
---|
1410 |
|
---|
1411 | /* Radeon R6xx/R7xx integrated */
|
---|
1412 | if (strstr(gl_renderer, "HD 3100")
|
---|
1413 | || strstr(gl_renderer, "HD 3200")
|
---|
1414 | || strstr(gl_renderer, "HD 3300"))
|
---|
1415 | {
|
---|
1416 | *vidmem = 128; /* 128MB */
|
---|
1417 | return CARD_ATI_RADEON_HD3200;
|
---|
1418 | }
|
---|
1419 |
|
---|
1420 | /* Default for when no GPU has been found */
|
---|
1421 | *vidmem = 128; /* 128MB */
|
---|
1422 | return CARD_ATI_RADEON_HD3200;
|
---|
1423 | }
|
---|
1424 |
|
---|
1425 | if (WINE_D3D8_CAPABLE(gl_info))
|
---|
1426 | {
|
---|
1427 | /* Radeon R5xx */
|
---|
1428 | if (strstr(gl_renderer, "X1600")
|
---|
1429 | || strstr(gl_renderer, "X1650")
|
---|
1430 | || strstr(gl_renderer, "X1800")
|
---|
1431 | || strstr(gl_renderer, "X1900")
|
---|
1432 | || strstr(gl_renderer, "X1950"))
|
---|
1433 | {
|
---|
1434 | *vidmem = 128; /* X1600 uses 128-256MB, >=X1800 uses 256MB */
|
---|
1435 | return CARD_ATI_RADEON_X1600;
|
---|
1436 | }
|
---|
1437 |
|
---|
1438 | /* Radeon R4xx + X1300/X1400/X1450/X1550/X2300/X2500/HD2300 (lowend R5xx)
|
---|
1439 | * Note X2300/X2500/HD2300 are R5xx GPUs with a 2xxx naming but they are still DX9-only */
|
---|
1440 | if (strstr(gl_renderer, "X700")
|
---|
1441 | || strstr(gl_renderer, "X800")
|
---|
1442 | || strstr(gl_renderer, "X850")
|
---|
1443 | || strstr(gl_renderer, "X1300")
|
---|
1444 | || strstr(gl_renderer, "X1400")
|
---|
1445 | || strstr(gl_renderer, "X1450")
|
---|
1446 | || strstr(gl_renderer, "X1550")
|
---|
1447 | || strstr(gl_renderer, "X2300")
|
---|
1448 | || strstr(gl_renderer, "X2500")
|
---|
1449 | || strstr(gl_renderer, "HD 2300")
|
---|
1450 | )
|
---|
1451 | {
|
---|
1452 | *vidmem = 128; /* x700/x8*0 use 128-256MB, >=x1300 128-512MB */
|
---|
1453 | return CARD_ATI_RADEON_X700;
|
---|
1454 | }
|
---|
1455 |
|
---|
1456 | /* Radeon Xpress Series - onboard, DX9b, Shader 2.0, 300-400MHz */
|
---|
1457 | if (strstr(gl_renderer, "Radeon Xpress"))
|
---|
1458 | {
|
---|
1459 | *vidmem = 64; /* Shared RAM, BIOS configurable, 64-256M */
|
---|
1460 | return CARD_ATI_RADEON_XPRESS_200M;
|
---|
1461 | }
|
---|
1462 |
|
---|
1463 | /* Radeon R3xx */
|
---|
1464 | *vidmem = 64; /* Radeon 9500 uses 64MB, higher models use up to 256MB */
|
---|
1465 | return CARD_ATI_RADEON_9500; /* Radeon 9500/9550/9600/9700/9800/X300/X550/X600 */
|
---|
1466 | }
|
---|
1467 |
|
---|
1468 | if (WINE_D3D8_CAPABLE(gl_info))
|
---|
1469 | {
|
---|
1470 | *vidmem = 64; /* 8500/9000 cards use mostly 64MB, though there are 32MB and 128MB models */
|
---|
1471 | return CARD_ATI_RADEON_8500; /* Radeon 8500/9000/9100/9200/9300 */
|
---|
1472 | }
|
---|
1473 |
|
---|
1474 | if (WINE_D3D7_CAPABLE(gl_info))
|
---|
1475 | {
|
---|
1476 | *vidmem = 32; /* There are models with up to 64MB */
|
---|
1477 | return CARD_ATI_RADEON_7200; /* Radeon 7000/7100/7200/7500 */
|
---|
1478 | }
|
---|
1479 |
|
---|
1480 | *vidmem = 16; /* There are 16-32MB models */
|
---|
1481 | return CARD_ATI_RAGE_128PRO;
|
---|
1482 |
|
---|
1483 | }
|
---|
1484 |
|
---|
1485 | static enum wined3d_pci_device select_card_intel_binary(const struct wined3d_gl_info *gl_info,
|
---|
1486 | const char *gl_renderer, unsigned int *vidmem)
|
---|
1487 | {
|
---|
1488 | if (strstr(gl_renderer, "X3100"))
|
---|
1489 | {
|
---|
1490 | /* MacOS calls the card GMA X3100, Google findings also suggest the name GM965 */
|
---|
1491 | *vidmem = 128;
|
---|
1492 | return CARD_INTEL_X3100;
|
---|
1493 | }
|
---|
1494 |
|
---|
1495 | if (strstr(gl_renderer, "GMA 950") || strstr(gl_renderer, "945GM"))
|
---|
1496 | {
|
---|
1497 | /* MacOS calls the card GMA 950, but everywhere else the PCI ID is named 945GM */
|
---|
1498 | *vidmem = 64;
|
---|
1499 | return CARD_INTEL_I945GM;
|
---|
1500 | }
|
---|
1501 |
|
---|
1502 | if (strstr(gl_renderer, "915GM")) return CARD_INTEL_I915GM;
|
---|
1503 | if (strstr(gl_renderer, "915G")) return CARD_INTEL_I915G;
|
---|
1504 | if (strstr(gl_renderer, "865G")) return CARD_INTEL_I865G;
|
---|
1505 | if (strstr(gl_renderer, "855G")) return CARD_INTEL_I855G;
|
---|
1506 | if (strstr(gl_renderer, "830G")) return CARD_INTEL_I830G;
|
---|
1507 | return CARD_INTEL_I915G;
|
---|
1508 |
|
---|
1509 | }
|
---|
1510 |
|
---|
1511 | static enum wined3d_pci_device select_card_ati_mesa(const struct wined3d_gl_info *gl_info,
|
---|
1512 | const char *gl_renderer, unsigned int *vidmem)
|
---|
1513 | {
|
---|
1514 | /* See http://developer.amd.com/drivers/pc_vendor_id/Pages/default.aspx
|
---|
1515 | *
|
---|
1516 | * Beware: renderer string do not match exact card model,
|
---|
1517 | * eg HD 4800 is returned for multiple cards, even for RV790 based ones. */
|
---|
1518 | if (strstr(gl_renderer, "Gallium"))
|
---|
1519 | {
|
---|
1520 | /* Radeon R7xx HD4800 - highend */
|
---|
1521 | if (strstr(gl_renderer, "R700") /* Radeon R7xx HD48xx generic renderer string */
|
---|
1522 | || strstr(gl_renderer, "RV770") /* Radeon RV770 */
|
---|
1523 | || strstr(gl_renderer, "RV790")) /* Radeon RV790 */
|
---|
1524 | {
|
---|
1525 | *vidmem = 512; /* note: HD4890 cards use 1024MB */
|
---|
1526 | return CARD_ATI_RADEON_HD4800;
|
---|
1527 | }
|
---|
1528 |
|
---|
1529 | /* Radeon R740 HD4700 - midend */
|
---|
1530 | if (strstr(gl_renderer, "RV740")) /* Radeon RV740 */
|
---|
1531 | {
|
---|
1532 | *vidmem = 512;
|
---|
1533 | return CARD_ATI_RADEON_HD4700;
|
---|
1534 | }
|
---|
1535 |
|
---|
1536 | /* Radeon R730 HD4600 - midend */
|
---|
1537 | if (strstr(gl_renderer, "RV730")) /* Radeon RV730 */
|
---|
1538 | {
|
---|
1539 | *vidmem = 512;
|
---|
1540 | return CARD_ATI_RADEON_HD4600;
|
---|
1541 | }
|
---|
1542 |
|
---|
1543 | /* Radeon R710 HD4500/HD4350 - lowend */
|
---|
1544 | if (strstr(gl_renderer, "RV710")) /* Radeon RV710 */
|
---|
1545 | {
|
---|
1546 | *vidmem = 256;
|
---|
1547 | return CARD_ATI_RADEON_HD4350;
|
---|
1548 | }
|
---|
1549 |
|
---|
1550 | /* Radeon R6xx HD2900/HD3800 - highend */
|
---|
1551 | if (strstr(gl_renderer, "R600")
|
---|
1552 | || strstr(gl_renderer, "RV670")
|
---|
1553 | || strstr(gl_renderer, "R680"))
|
---|
1554 | {
|
---|
1555 | *vidmem = 512; /* HD2900/HD3800 uses 256-1024MB */
|
---|
1556 | return CARD_ATI_RADEON_HD2900;
|
---|
1557 | }
|
---|
1558 |
|
---|
1559 | /* Radeon R6xx HD2600/HD3600 - midend; HD3830 is China-only midend */
|
---|
1560 | if (strstr(gl_renderer, "RV630")
|
---|
1561 | || strstr(gl_renderer, "RV635"))
|
---|
1562 | {
|
---|
1563 | *vidmem = 256; /* HD2600/HD3600 uses 256-512MB */
|
---|
1564 | return CARD_ATI_RADEON_HD2600;
|
---|
1565 | }
|
---|
1566 |
|
---|
1567 | /* Radeon R6xx HD2350/HD2400/HD3400 - lowend */
|
---|
1568 | if (strstr(gl_renderer, "RV610")
|
---|
1569 | || strstr(gl_renderer, "RV620"))
|
---|
1570 | {
|
---|
1571 | *vidmem = 256; /* HD2350/2400 use 256MB, HD34xx use 256-512MB */
|
---|
1572 | return CARD_ATI_RADEON_HD2350;
|
---|
1573 | }
|
---|
1574 |
|
---|
1575 | /* Radeon R6xx/R7xx integrated */
|
---|
1576 | if (strstr(gl_renderer, "RS780")
|
---|
1577 | || strstr(gl_renderer, "RS880"))
|
---|
1578 | {
|
---|
1579 | *vidmem = 128; /* 128MB */
|
---|
1580 | return CARD_ATI_RADEON_HD3200;
|
---|
1581 | }
|
---|
1582 |
|
---|
1583 | /* Radeon R5xx */
|
---|
1584 | if (strstr(gl_renderer, "RV530")
|
---|
1585 | || strstr(gl_renderer, "RV535")
|
---|
1586 | || strstr(gl_renderer, "RV560")
|
---|
1587 | || strstr(gl_renderer, "R520")
|
---|
1588 | || strstr(gl_renderer, "RV570")
|
---|
1589 | || strstr(gl_renderer, "R580"))
|
---|
1590 | {
|
---|
1591 | *vidmem = 128; /* X1600 uses 128-256MB, >=X1800 uses 256MB */
|
---|
1592 | return CARD_ATI_RADEON_X1600;
|
---|
1593 | }
|
---|
1594 |
|
---|
1595 | /* Radeon R4xx + X1300/X1400/X1450/X1550/X2300 (lowend R5xx) */
|
---|
1596 | if (strstr(gl_renderer, "R410")
|
---|
1597 | || strstr(gl_renderer, "R420")
|
---|
1598 | || strstr(gl_renderer, "R423")
|
---|
1599 | || strstr(gl_renderer, "R430")
|
---|
1600 | || strstr(gl_renderer, "R480")
|
---|
1601 | || strstr(gl_renderer, "R481")
|
---|
1602 | || strstr(gl_renderer, "RV410")
|
---|
1603 | || strstr(gl_renderer, "RV515")
|
---|
1604 | || strstr(gl_renderer, "RV516"))
|
---|
1605 | {
|
---|
1606 | *vidmem = 128; /* x700/x8*0 use 128-256MB, >=x1300 128-512MB */
|
---|
1607 | return CARD_ATI_RADEON_X700;
|
---|
1608 | }
|
---|
1609 |
|
---|
1610 | /* Radeon Xpress Series - onboard, DX9b, Shader 2.0, 300-400MHz */
|
---|
1611 | if (strstr(gl_renderer, "RS400")
|
---|
1612 | || strstr(gl_renderer, "RS480")
|
---|
1613 | || strstr(gl_renderer, "RS482")
|
---|
1614 | || strstr(gl_renderer, "RS485")
|
---|
1615 | || strstr(gl_renderer, "RS600")
|
---|
1616 | || strstr(gl_renderer, "RS690")
|
---|
1617 | || strstr(gl_renderer, "RS740"))
|
---|
1618 | {
|
---|
1619 | *vidmem = 64; /* Shared RAM, BIOS configurable, 64-256M */
|
---|
1620 | return CARD_ATI_RADEON_XPRESS_200M;
|
---|
1621 | }
|
---|
1622 |
|
---|
1623 | /* Radeon R3xx */
|
---|
1624 | if (strstr(gl_renderer, "R300")
|
---|
1625 | || strstr(gl_renderer, "RV350")
|
---|
1626 | || strstr(gl_renderer, "RV351")
|
---|
1627 | || strstr(gl_renderer, "RV360")
|
---|
1628 | || strstr(gl_renderer, "RV370")
|
---|
1629 | || strstr(gl_renderer, "R350")
|
---|
1630 | || strstr(gl_renderer, "R360"))
|
---|
1631 | {
|
---|
1632 | *vidmem = 64; /* Radeon 9500 uses 64MB, higher models use up to 256MB */
|
---|
1633 | return CARD_ATI_RADEON_9500; /* Radeon 9500/9550/9600/9700/9800/X300/X550/X600 */
|
---|
1634 | }
|
---|
1635 | }
|
---|
1636 |
|
---|
1637 | if (WINE_D3D9_CAPABLE(gl_info))
|
---|
1638 | {
|
---|
1639 | /* Radeon R7xx HD4800 - highend */
|
---|
1640 | if (strstr(gl_renderer, "(R700") /* Radeon R7xx HD48xx generic renderer string */
|
---|
1641 | || strstr(gl_renderer, "(RV770") /* Radeon RV770 */
|
---|
1642 | || strstr(gl_renderer, "(RV790")) /* Radeon RV790 */
|
---|
1643 | {
|
---|
1644 | *vidmem = 512; /* note: HD4890 cards use 1024MB */
|
---|
1645 | return CARD_ATI_RADEON_HD4800;
|
---|
1646 | }
|
---|
1647 |
|
---|
1648 | /* Radeon R740 HD4700 - midend */
|
---|
1649 | if (strstr(gl_renderer, "(RV740")) /* Radeon RV740 */
|
---|
1650 | {
|
---|
1651 | *vidmem = 512;
|
---|
1652 | return CARD_ATI_RADEON_HD4700;
|
---|
1653 | }
|
---|
1654 |
|
---|
1655 | /* Radeon R730 HD4600 - midend */
|
---|
1656 | if (strstr(gl_renderer, "(RV730")) /* Radeon RV730 */
|
---|
1657 | {
|
---|
1658 | *vidmem = 512;
|
---|
1659 | return CARD_ATI_RADEON_HD4600;
|
---|
1660 | }
|
---|
1661 |
|
---|
1662 | /* Radeon R710 HD4500/HD4350 - lowend */
|
---|
1663 | if (strstr(gl_renderer, "(RV710")) /* Radeon RV710 */
|
---|
1664 | {
|
---|
1665 | *vidmem = 256;
|
---|
1666 | return CARD_ATI_RADEON_HD4350;
|
---|
1667 | }
|
---|
1668 |
|
---|
1669 | /* Radeon R6xx HD2900/HD3800 - highend */
|
---|
1670 | if (strstr(gl_renderer, "(R600")
|
---|
1671 | || strstr(gl_renderer, "(RV670")
|
---|
1672 | || strstr(gl_renderer, "(R680"))
|
---|
1673 | {
|
---|
1674 | *vidmem = 512; /* HD2900/HD3800 uses 256-1024MB */
|
---|
1675 | return CARD_ATI_RADEON_HD2900;
|
---|
1676 | }
|
---|
1677 |
|
---|
1678 | /* Radeon R6xx HD2600/HD3600 - midend; HD3830 is China-only midend */
|
---|
1679 | if (strstr(gl_renderer, "(RV630")
|
---|
1680 | || strstr(gl_renderer, "(RV635"))
|
---|
1681 | {
|
---|
1682 | *vidmem = 256; /* HD2600/HD3600 uses 256-512MB */
|
---|
1683 | return CARD_ATI_RADEON_HD2600;
|
---|
1684 | }
|
---|
1685 |
|
---|
1686 | /* Radeon R6xx HD2300/HD2400/HD3400 - lowend */
|
---|
1687 | if (strstr(gl_renderer, "(RV610")
|
---|
1688 | || strstr(gl_renderer, "(RV620"))
|
---|
1689 | {
|
---|
1690 | *vidmem = 256; /* HD2350/2400 use 256MB, HD34xx use 256-512MB */
|
---|
1691 | return CARD_ATI_RADEON_HD2350;
|
---|
1692 | }
|
---|
1693 |
|
---|
1694 | /* Radeon R6xx/R7xx integrated */
|
---|
1695 | if (strstr(gl_renderer, "(RS780")
|
---|
1696 | || strstr(gl_renderer, "(RS880"))
|
---|
1697 | {
|
---|
1698 | *vidmem = 128; /* 128MB */
|
---|
1699 | return CARD_ATI_RADEON_HD3200;
|
---|
1700 | }
|
---|
1701 | }
|
---|
1702 |
|
---|
1703 | if (WINE_D3D8_CAPABLE(gl_info))
|
---|
1704 | {
|
---|
1705 | *vidmem = 64; /* 8500/9000 cards use mostly 64MB, though there are 32MB and 128MB models */
|
---|
1706 | return CARD_ATI_RADEON_8500; /* Radeon 8500/9000/9100/9200/9300 */
|
---|
1707 | }
|
---|
1708 |
|
---|
1709 | if (WINE_D3D7_CAPABLE(gl_info))
|
---|
1710 | {
|
---|
1711 | *vidmem = 32; /* There are models with up to 64MB */
|
---|
1712 | return CARD_ATI_RADEON_7200; /* Radeon 7000/7100/7200/7500 */
|
---|
1713 | }
|
---|
1714 |
|
---|
1715 | *vidmem = 16; /* There are 16-32MB models */
|
---|
1716 | return CARD_ATI_RAGE_128PRO;
|
---|
1717 |
|
---|
1718 | }
|
---|
1719 |
|
---|
1720 | static enum wined3d_pci_device select_card_nvidia_mesa(const struct wined3d_gl_info *gl_info,
|
---|
1721 | const char *gl_renderer, unsigned int *vidmem)
|
---|
1722 | {
|
---|
1723 | FIXME_(d3d_caps)("Card selection not handled for Mesa Nouveau driver\n");
|
---|
1724 | #ifndef VBOX_WITH_WDDM
|
---|
1725 | if (WINE_D3D9_CAPABLE(gl_info)) return CARD_NVIDIA_GEFORCEFX_5600;
|
---|
1726 | #else
|
---|
1727 | /* tmp work around to disable quirk_no_np2 quirk for mesa drivers */
|
---|
1728 | if (WINE_D3D9_CAPABLE(gl_info)) return CARD_NVIDIA_GEFORCE_6200;
|
---|
1729 | #endif
|
---|
1730 | if (WINE_D3D8_CAPABLE(gl_info)) return CARD_NVIDIA_GEFORCE3;
|
---|
1731 | if (WINE_D3D7_CAPABLE(gl_info)) return CARD_NVIDIA_GEFORCE;
|
---|
1732 | if (WINE_D3D6_CAPABLE(gl_info)) return CARD_NVIDIA_RIVA_TNT;
|
---|
1733 | return CARD_NVIDIA_RIVA_128;
|
---|
1734 | }
|
---|
1735 |
|
---|
1736 | static enum wined3d_pci_device select_card_intel_cmn(const struct wined3d_gl_info *gl_info,
|
---|
1737 | const char *gl_renderer, unsigned int *vidmem)
|
---|
1738 | {
|
---|
1739 | if (strstr(gl_renderer, "HD Graphics")
|
---|
1740 | || strstr(gl_renderer, "Sandybridge"))
|
---|
1741 | return CARD_INTEL_SBHD;
|
---|
1742 | FIXME_(d3d_caps)("Card selection not handled for Windows Intel driver\n");
|
---|
1743 | return CARD_INTEL_I915G;
|
---|
1744 | }
|
---|
1745 |
|
---|
1746 | static enum wined3d_pci_device select_card_intel_mesa(const struct wined3d_gl_info *gl_info,
|
---|
1747 | const char *gl_renderer, unsigned int *vidmem)
|
---|
1748 | {
|
---|
1749 | return select_card_intel_cmn(gl_info, gl_renderer, vidmem);
|
---|
1750 | }
|
---|
1751 |
|
---|
1752 | struct vendor_card_selection
|
---|
1753 | {
|
---|
1754 | enum wined3d_gl_vendor gl_vendor;
|
---|
1755 | enum wined3d_pci_vendor card_vendor;
|
---|
1756 | const char *description; /* Description of the card selector i.e. Apple OS/X Intel */
|
---|
1757 | enum wined3d_pci_device (*select_card)(const struct wined3d_gl_info *gl_info, const char *gl_renderer,
|
---|
1758 | unsigned int *vidmem );
|
---|
1759 | };
|
---|
1760 |
|
---|
1761 | static const struct vendor_card_selection vendor_card_select_table[] =
|
---|
1762 | {
|
---|
1763 | {GL_VENDOR_NVIDIA, HW_VENDOR_NVIDIA, "Nvidia binary driver", select_card_nvidia_binary},
|
---|
1764 | {GL_VENDOR_APPLE, HW_VENDOR_NVIDIA, "Apple OSX NVidia binary driver", select_card_nvidia_binary},
|
---|
1765 | {GL_VENDOR_APPLE, HW_VENDOR_ATI, "Apple OSX AMD/ATI binary driver", select_card_ati_binary},
|
---|
1766 | {GL_VENDOR_APPLE, HW_VENDOR_INTEL, "Apple OSX Intel binary driver", select_card_intel_binary},
|
---|
1767 | {GL_VENDOR_FGLRX, HW_VENDOR_ATI, "AMD/ATI binary driver", select_card_ati_binary},
|
---|
1768 | {GL_VENDOR_MESA, HW_VENDOR_ATI, "Mesa AMD/ATI driver", select_card_ati_mesa},
|
---|
1769 | {GL_VENDOR_MESA, HW_VENDOR_NVIDIA, "Mesa Nouveau driver", select_card_nvidia_mesa},
|
---|
1770 | {GL_VENDOR_MESA, HW_VENDOR_INTEL, "Mesa Intel driver", select_card_intel_mesa},
|
---|
1771 | {GL_VENDOR_INTEL, HW_VENDOR_INTEL, "Windows Intel binary driver", select_card_intel_cmn}
|
---|
1772 | };
|
---|
1773 |
|
---|
1774 |
|
---|
1775 | static enum wined3d_pci_device wined3d_guess_card(const struct wined3d_gl_info *gl_info, const char *gl_renderer,
|
---|
1776 | enum wined3d_gl_vendor *gl_vendor, enum wined3d_pci_vendor *card_vendor, unsigned int *vidmem)
|
---|
1777 | {
|
---|
1778 | /* Above is a list of Nvidia and ATI GPUs. Both vendors have dozens of
|
---|
1779 | * different GPUs with roughly the same features. In most cases GPUs from a
|
---|
1780 | * certain family differ in clockspeeds, the amount of video memory and the
|
---|
1781 | * number of shader pipelines.
|
---|
1782 | *
|
---|
1783 | * A Direct3D device object contains the PCI id (vendor + device) of the
|
---|
1784 | * videocard which is used for rendering. Various applications use this
|
---|
1785 | * information to get a rough estimation of the features of the card and
|
---|
1786 | * some might use it for enabling 3d effects only on certain types of
|
---|
1787 | * videocards. In some cases games might even use it to work around bugs
|
---|
1788 | * which happen on certain videocards/driver combinations. The problem is
|
---|
1789 | * that OpenGL only exposes a rendering string containing the name of the
|
---|
1790 | * videocard and not the PCI id.
|
---|
1791 | *
|
---|
1792 | * Various games depend on the PCI id, so somehow we need to provide one.
|
---|
1793 | * A simple option is to parse the renderer string and translate this to
|
---|
1794 | * the right PCI id. This is a lot of work because there are more than 200
|
---|
1795 | * GPUs just for Nvidia. Various cards share the same renderer string, so
|
---|
1796 | * the amount of code might be 'small' but there are quite a number of
|
---|
1797 | * exceptions which would make this a pain to maintain. Another way would
|
---|
1798 | * be to query the PCI id from the operating system (assuming this is the
|
---|
1799 | * videocard which is used for rendering which is not always the case).
|
---|
1800 | * This would work but it is not very portable. Second it would not work
|
---|
1801 | * well in, let's say, a remote X situation in which the amount of 3d
|
---|
1802 | * features which can be used is limited.
|
---|
1803 | *
|
---|
1804 | * As said most games only use the PCI id to get an indication of the
|
---|
1805 | * capabilities of the card. It doesn't really matter if the given id is
|
---|
1806 | * the correct one if we return the id of a card with similar 3d features.
|
---|
1807 | *
|
---|
1808 | * The code below checks the OpenGL capabilities of a videocard and matches
|
---|
1809 | * that to a certain level of Direct3D functionality. Once a card passes
|
---|
1810 | * the Direct3D9 check, we know that the card (in case of Nvidia) is at
|
---|
1811 | * least a GeforceFX. To give a better estimate we do a basic check on the
|
---|
1812 | * renderer string but if that won't pass we return a default card. This
|
---|
1813 | * way is better than maintaining a full card database as even without a
|
---|
1814 | * full database we can return a card with similar features. Second the
|
---|
1815 | * size of the database can be made quite small because when you know what
|
---|
1816 | * type of 3d functionality a card has, you know to which GPU family the
|
---|
1817 | * GPU must belong. Because of this you only have to check a small part of
|
---|
1818 | * the renderer string to distinguishes between different models from that
|
---|
1819 | * family.
|
---|
1820 | *
|
---|
1821 | * The code also selects a default amount of video memory which we will
|
---|
1822 | * use for an estimation of the amount of free texture memory. In case of
|
---|
1823 | * real D3D the amount of texture memory includes video memory and system
|
---|
1824 | * memory (to be specific AGP memory or in case of PCIE TurboCache /
|
---|
1825 | * HyperMemory). We don't know how much system memory can be addressed by
|
---|
1826 | * the system but we can make a reasonable estimation about the amount of
|
---|
1827 | * video memory. If the value is slightly wrong it doesn't matter as we
|
---|
1828 | * didn't include AGP-like memory which makes the amount of addressable
|
---|
1829 | * memory higher and second OpenGL isn't that critical it moves to system
|
---|
1830 | * memory behind our backs if really needed. Note that the amount of video
|
---|
1831 | * memory can be overruled using a registry setting. */
|
---|
1832 |
|
---|
1833 | int i;
|
---|
1834 |
|
---|
1835 | for (i = 0; i < (sizeof(vendor_card_select_table) / sizeof(*vendor_card_select_table)); ++i)
|
---|
1836 | {
|
---|
1837 | if ((vendor_card_select_table[i].gl_vendor != *gl_vendor)
|
---|
1838 | || (vendor_card_select_table[i].card_vendor != *card_vendor))
|
---|
1839 | continue;
|
---|
1840 | TRACE_(d3d_caps)("Applying card_selector \"%s\".\n", vendor_card_select_table[i].description);
|
---|
1841 | return vendor_card_select_table[i].select_card(gl_info, gl_renderer, vidmem);
|
---|
1842 | }
|
---|
1843 |
|
---|
1844 | FIXME_(d3d_caps)("No card selector available for GL vendor %d and card vendor %04x.\n",
|
---|
1845 | *gl_vendor, *card_vendor);
|
---|
1846 |
|
---|
1847 | /* Default to generic Nvidia hardware based on the supported OpenGL extensions. The choice
|
---|
1848 | * for Nvidia was because the hardware and drivers they make are of good quality. This makes
|
---|
1849 | * them a good generic choice. */
|
---|
1850 | *card_vendor = HW_VENDOR_NVIDIA;
|
---|
1851 | #ifndef VBOX_WITH_WDDM
|
---|
1852 | if (WINE_D3D9_CAPABLE(gl_info)) return CARD_NVIDIA_GEFORCEFX_5600;
|
---|
1853 | #else
|
---|
1854 | /* tmp work around to disable quirk_no_np2 quirk for not-recognized drivers */
|
---|
1855 | if (WINE_D3D9_CAPABLE(gl_info)) return CARD_NVIDIA_GEFORCE_6200;
|
---|
1856 | #endif
|
---|
1857 |
|
---|
1858 | if (WINE_D3D8_CAPABLE(gl_info)) return CARD_NVIDIA_GEFORCE3;
|
---|
1859 | if (WINE_D3D7_CAPABLE(gl_info)) return CARD_NVIDIA_GEFORCE;
|
---|
1860 | if (WINE_D3D6_CAPABLE(gl_info)) return CARD_NVIDIA_RIVA_TNT;
|
---|
1861 | return CARD_NVIDIA_RIVA_128;
|
---|
1862 | }
|
---|
1863 |
|
---|
1864 | #ifndef VBOX_WITH_VMSVGA
|
---|
1865 | static const struct fragment_pipeline *select_fragment_implementation(struct wined3d_adapter *adapter)
|
---|
1866 | {
|
---|
1867 | const struct wined3d_gl_info *gl_info = &adapter->gl_info;
|
---|
1868 | int vs_selected_mode, ps_selected_mode;
|
---|
1869 |
|
---|
1870 | select_shader_mode(gl_info, &ps_selected_mode, &vs_selected_mode);
|
---|
1871 | if ((ps_selected_mode == SHADER_ARB || ps_selected_mode == SHADER_GLSL)
|
---|
1872 | && gl_info->supported[ARB_FRAGMENT_PROGRAM]) return &arbfp_fragment_pipeline;
|
---|
1873 | else if (ps_selected_mode == SHADER_ATI) return &atifs_fragment_pipeline;
|
---|
1874 | else if (gl_info->supported[NV_REGISTER_COMBINERS]
|
---|
1875 | && gl_info->supported[NV_TEXTURE_SHADER2]) return &nvts_fragment_pipeline;
|
---|
1876 | else if (gl_info->supported[NV_REGISTER_COMBINERS]) return &nvrc_fragment_pipeline;
|
---|
1877 | else return &ffp_fragment_pipeline;
|
---|
1878 | }
|
---|
1879 | #endif
|
---|
1880 |
|
---|
1881 | static const shader_backend_t *select_shader_backend(struct wined3d_adapter *adapter)
|
---|
1882 | {
|
---|
1883 | int vs_selected_mode, ps_selected_mode;
|
---|
1884 |
|
---|
1885 | select_shader_mode(&adapter->gl_info, &ps_selected_mode, &vs_selected_mode);
|
---|
1886 | if (vs_selected_mode == SHADER_GLSL || ps_selected_mode == SHADER_GLSL) return &glsl_shader_backend;
|
---|
1887 | #ifndef VBOX_WITH_VMSVGA
|
---|
1888 | if (vs_selected_mode == SHADER_ARB || ps_selected_mode == SHADER_ARB) return &arb_program_shader_backend;
|
---|
1889 | #endif
|
---|
1890 | return &none_shader_backend;
|
---|
1891 | }
|
---|
1892 |
|
---|
1893 | #ifndef VBOX_WITH_VMSVGA
|
---|
1894 | static const struct blit_shader *select_blit_implementation(struct wined3d_adapter *adapter)
|
---|
1895 | {
|
---|
1896 | const struct wined3d_gl_info *gl_info = &adapter->gl_info;
|
---|
1897 | int vs_selected_mode, ps_selected_mode;
|
---|
1898 |
|
---|
1899 | select_shader_mode(gl_info, &ps_selected_mode, &vs_selected_mode);
|
---|
1900 | if ((ps_selected_mode == SHADER_ARB || ps_selected_mode == SHADER_GLSL)
|
---|
1901 | && gl_info->supported[ARB_FRAGMENT_PROGRAM]) return &arbfp_blit;
|
---|
1902 | else return &ffp_blit;
|
---|
1903 | }
|
---|
1904 | #endif
|
---|
1905 |
|
---|
1906 | /* Context activation is done by the caller. */
|
---|
1907 | BOOL IWineD3DImpl_FillGLCaps(struct wined3d_adapter *adapter)
|
---|
1908 | {
|
---|
1909 | struct wined3d_driver_info *driver_info = &adapter->driver_info;
|
---|
1910 | struct wined3d_gl_info *gl_info = &adapter->gl_info;
|
---|
1911 | const char *GL_Extensions = NULL;
|
---|
1912 | const char *WGL_Extensions = NULL;
|
---|
1913 | const char *gl_vendor_str, *gl_renderer_str, *gl_version_str;
|
---|
1914 | struct fragment_caps fragment_caps;
|
---|
1915 | enum wined3d_gl_vendor gl_vendor;
|
---|
1916 | enum wined3d_pci_vendor card_vendor;
|
---|
1917 | enum wined3d_pci_device device;
|
---|
1918 | GLint gl_max;
|
---|
1919 | GLfloat gl_floatv[2];
|
---|
1920 | unsigned i;
|
---|
1921 | HDC hdc;
|
---|
1922 | unsigned int vidmem=0;
|
---|
1923 | DWORD gl_version;
|
---|
1924 | size_t len;
|
---|
1925 |
|
---|
1926 | TRACE_(d3d_caps)("(%p)\n", gl_info);
|
---|
1927 |
|
---|
1928 | ENTER_GL();
|
---|
1929 |
|
---|
1930 | gl_renderer_str = (const char *)glGetString(GL_RENDERER);
|
---|
1931 | TRACE_(d3d_caps)("GL_RENDERER: %s.\n", debugstr_a(gl_renderer_str));
|
---|
1932 | if (!gl_renderer_str)
|
---|
1933 | {
|
---|
1934 | LEAVE_GL();
|
---|
1935 | ERR_(d3d_caps)("Received a NULL GL_RENDERER.\n");
|
---|
1936 | return FALSE;
|
---|
1937 | }
|
---|
1938 |
|
---|
1939 | gl_vendor_str = (const char *)glGetString(GL_VENDOR);
|
---|
1940 | TRACE_(d3d_caps)("GL_VENDOR: %s.\n", debugstr_a(gl_vendor_str));
|
---|
1941 | if (!gl_vendor_str)
|
---|
1942 | {
|
---|
1943 | LEAVE_GL();
|
---|
1944 | ERR_(d3d_caps)("Received a NULL GL_VENDOR.\n");
|
---|
1945 | return FALSE;
|
---|
1946 | }
|
---|
1947 |
|
---|
1948 | /* Parse the GL_VERSION field into major and minor information */
|
---|
1949 | gl_version_str = (const char *)glGetString(GL_VERSION);
|
---|
1950 | TRACE_(d3d_caps)("GL_VERSION: %s.\n", debugstr_a(gl_version_str));
|
---|
1951 | if (!gl_version_str)
|
---|
1952 | {
|
---|
1953 | LEAVE_GL();
|
---|
1954 | ERR_(d3d_caps)("Received a NULL GL_VERSION.\n");
|
---|
1955 | return FALSE;
|
---|
1956 | }
|
---|
1957 | gl_version = wined3d_parse_gl_version(gl_version_str);
|
---|
1958 |
|
---|
1959 | /*
|
---|
1960 | * Initialize openGL extension related variables
|
---|
1961 | * with Default values
|
---|
1962 | */
|
---|
1963 | memset(gl_info->supported, 0, sizeof(gl_info->supported));
|
---|
1964 | gl_info->limits.blends = 1;
|
---|
1965 | gl_info->limits.buffers = 1;
|
---|
1966 | gl_info->limits.textures = 1;
|
---|
1967 | gl_info->limits.fragment_samplers = 1;
|
---|
1968 | gl_info->limits.vertex_samplers = 0;
|
---|
1969 | gl_info->limits.combined_samplers = gl_info->limits.fragment_samplers + gl_info->limits.vertex_samplers;
|
---|
1970 | gl_info->limits.sampler_stages = 1;
|
---|
1971 | gl_info->limits.glsl_vs_float_constants = 0;
|
---|
1972 | gl_info->limits.glsl_ps_float_constants = 0;
|
---|
1973 | gl_info->limits.arb_vs_float_constants = 0;
|
---|
1974 | gl_info->limits.arb_vs_native_constants = 0;
|
---|
1975 | gl_info->limits.arb_vs_instructions = 0;
|
---|
1976 | gl_info->limits.arb_vs_temps = 0;
|
---|
1977 | gl_info->limits.arb_ps_float_constants = 0;
|
---|
1978 | gl_info->limits.arb_ps_local_constants = 0;
|
---|
1979 | gl_info->limits.arb_ps_instructions = 0;
|
---|
1980 | gl_info->limits.arb_ps_temps = 0;
|
---|
1981 |
|
---|
1982 | /* Retrieve opengl defaults */
|
---|
1983 | glGetIntegerv(GL_MAX_CLIP_PLANES, &gl_max);
|
---|
1984 | gl_info->limits.clipplanes = min(WINED3DMAXUSERCLIPPLANES, gl_max);
|
---|
1985 | TRACE_(d3d_caps)("ClipPlanes support - num Planes=%d\n", gl_max);
|
---|
1986 |
|
---|
1987 | glGetIntegerv(GL_MAX_LIGHTS, &gl_max);
|
---|
1988 | gl_info->limits.lights = gl_max;
|
---|
1989 | TRACE_(d3d_caps)("Lights support - max lights=%d\n", gl_max);
|
---|
1990 |
|
---|
1991 | glGetIntegerv(GL_MAX_TEXTURE_SIZE, &gl_max);
|
---|
1992 | gl_info->limits.texture_size = gl_max;
|
---|
1993 | TRACE_(d3d_caps)("Maximum texture size support - max texture size=%d\n", gl_max);
|
---|
1994 |
|
---|
1995 | glGetFloatv(GL_ALIASED_POINT_SIZE_RANGE, gl_floatv);
|
---|
1996 | gl_info->limits.pointsize_min = gl_floatv[0];
|
---|
1997 | gl_info->limits.pointsize_max = gl_floatv[1];
|
---|
1998 | TRACE_(d3d_caps)("Maximum point size support - max point size=%f\n", gl_floatv[1]);
|
---|
1999 |
|
---|
2000 | /* Parse the gl supported features, in theory enabling parts of our code appropriately. */
|
---|
2001 | GL_Extensions = (const char *)glGetString(GL_EXTENSIONS);
|
---|
2002 | if (!GL_Extensions)
|
---|
2003 | {
|
---|
2004 | LEAVE_GL();
|
---|
2005 | ERR_(d3d_caps)("Received a NULL GL_EXTENSIONS.\n");
|
---|
2006 | return FALSE;
|
---|
2007 | }
|
---|
2008 |
|
---|
2009 | LEAVE_GL();
|
---|
2010 |
|
---|
2011 | TRACE_(d3d_caps)("GL_Extensions reported:\n");
|
---|
2012 |
|
---|
2013 | gl_info->supported[WINED3D_GL_EXT_NONE] = TRUE;
|
---|
2014 |
|
---|
2015 | gl_info->supported[VBOX_SHARED_CONTEXTS] = TRUE;
|
---|
2016 |
|
---|
2017 | while (*GL_Extensions)
|
---|
2018 | {
|
---|
2019 | const char *start;
|
---|
2020 | char current_ext[256];
|
---|
2021 |
|
---|
2022 | while (isspace(*GL_Extensions)) ++GL_Extensions;
|
---|
2023 | start = GL_Extensions;
|
---|
2024 | while (!isspace(*GL_Extensions) && *GL_Extensions) ++GL_Extensions;
|
---|
2025 |
|
---|
2026 | len = GL_Extensions - start;
|
---|
2027 | if (!len || len >= sizeof(current_ext)) continue;
|
---|
2028 |
|
---|
2029 | memcpy(current_ext, start, len);
|
---|
2030 | current_ext[len] = '\0';
|
---|
2031 | TRACE_(d3d_caps)("- %s\n", debugstr_a(current_ext));
|
---|
2032 |
|
---|
2033 | for (i = 0; i < (sizeof(EXTENSION_MAP) / sizeof(*EXTENSION_MAP)); ++i)
|
---|
2034 | {
|
---|
2035 | if (!strcmp(current_ext, EXTENSION_MAP[i].extension_string))
|
---|
2036 | {
|
---|
2037 | TRACE_(d3d_caps)(" FOUND: %s support.\n", EXTENSION_MAP[i].extension_string);
|
---|
2038 | gl_info->supported[EXTENSION_MAP[i].extension] = TRUE;
|
---|
2039 | break;
|
---|
2040 | }
|
---|
2041 | }
|
---|
2042 | }
|
---|
2043 |
|
---|
2044 | #ifdef VBOX_WITH_VMSVGA
|
---|
2045 | # ifdef RT_OS_WINDOWS
|
---|
2046 | # define OGLGETPROCADDRESS wglGetProcAddress
|
---|
2047 | # elif RT_OS_DARWIN
|
---|
2048 | extern void (*MyNSGLGetProcAddress(const char *name))(void);
|
---|
2049 | # define OGLGETPROCADDRESS MyNSGLGetProcAddress
|
---|
2050 | # else
|
---|
2051 | extern void (*glXGetProcAddress(const GLubyte *procname))( void );
|
---|
2052 | # define OGLGETPROCADDRESS(x) glXGetProcAddress((const GLubyte *)x)
|
---|
2053 | # endif
|
---|
2054 | #endif
|
---|
2055 |
|
---|
2056 | /* Now work out what GL support this card really has */
|
---|
2057 | #define USE_GL_FUNC(type, pfn, ext, replace) \
|
---|
2058 | { \
|
---|
2059 | DWORD ver = ver_for_ext(ext); \
|
---|
2060 | if (gl_info->supported[ext]) gl_info->pfn = (type)OGLGETPROCADDRESS(#pfn); \
|
---|
2061 | else if (ver && ver <= gl_version) gl_info->pfn = (type)OGLGETPROCADDRESS(#replace); \
|
---|
2062 | else gl_info->pfn = NULL; \
|
---|
2063 | }
|
---|
2064 | GL_EXT_FUNCS_GEN;
|
---|
2065 | #undef USE_GL_FUNC
|
---|
2066 |
|
---|
2067 | #ifndef VBOX_WITH_VMSVGA
|
---|
2068 | #define USE_GL_FUNC(type, pfn, ext, replace) gl_info->pfn = (type)OGLGETPROCADDRESS(#pfn);
|
---|
2069 | WGL_EXT_FUNCS_GEN;
|
---|
2070 | #undef USE_GL_FUNC
|
---|
2071 | #endif
|
---|
2072 |
|
---|
2073 | ENTER_GL();
|
---|
2074 |
|
---|
2075 | /* Now mark all the extensions supported which are included in the opengl core version. Do this *after*
|
---|
2076 | * loading the functions, otherwise the code above will load the extension entry points instead of the
|
---|
2077 | * core functions, which may not work. */
|
---|
2078 | for (i = 0; i < (sizeof(EXTENSION_MAP) / sizeof(*EXTENSION_MAP)); ++i)
|
---|
2079 | {
|
---|
2080 | if (!gl_info->supported[EXTENSION_MAP[i].extension]
|
---|
2081 | && EXTENSION_MAP[i].version <= gl_version && EXTENSION_MAP[i].version)
|
---|
2082 | {
|
---|
2083 | TRACE_(d3d_caps)(" GL CORE: %s support.\n", EXTENSION_MAP[i].extension_string);
|
---|
2084 | gl_info->supported[EXTENSION_MAP[i].extension] = TRUE;
|
---|
2085 | }
|
---|
2086 | }
|
---|
2087 |
|
---|
2088 | if (gl_info->supported[APPLE_FENCE])
|
---|
2089 | {
|
---|
2090 | /* GL_NV_fence and GL_APPLE_fence provide the same functionality basically.
|
---|
2091 | * The apple extension interacts with some other apple exts. Disable the NV
|
---|
2092 | * extension if the apple one is support to prevent confusion in other parts
|
---|
2093 | * of the code. */
|
---|
2094 | gl_info->supported[NV_FENCE] = FALSE;
|
---|
2095 | }
|
---|
2096 | if (gl_info->supported[APPLE_FLOAT_PIXELS])
|
---|
2097 | {
|
---|
2098 | /* GL_APPLE_float_pixels == GL_ARB_texture_float + GL_ARB_half_float_pixel
|
---|
2099 | *
|
---|
2100 | * The enums are the same:
|
---|
2101 | * GL_RGBA16F_ARB = GL_RGBA_FLOAT16_APPLE = 0x881A
|
---|
2102 | * GL_RGB16F_ARB = GL_RGB_FLOAT16_APPLE = 0x881B
|
---|
2103 | * GL_RGBA32F_ARB = GL_RGBA_FLOAT32_APPLE = 0x8814
|
---|
2104 | * GL_RGB32F_ARB = GL_RGB_FLOAT32_APPLE = 0x8815
|
---|
2105 | * GL_HALF_FLOAT_ARB = GL_HALF_APPLE = 0x140B
|
---|
2106 | */
|
---|
2107 | if (!gl_info->supported[ARB_TEXTURE_FLOAT])
|
---|
2108 | {
|
---|
2109 | TRACE_(d3d_caps)(" IMPLIED: GL_ARB_texture_float support(from GL_APPLE_float_pixels.\n");
|
---|
2110 | gl_info->supported[ARB_TEXTURE_FLOAT] = TRUE;
|
---|
2111 | }
|
---|
2112 | if (!gl_info->supported[ARB_HALF_FLOAT_PIXEL])
|
---|
2113 | {
|
---|
2114 | TRACE_(d3d_caps)(" IMPLIED: GL_ARB_half_float_pixel support(from GL_APPLE_float_pixels.\n");
|
---|
2115 | gl_info->supported[ARB_HALF_FLOAT_PIXEL] = TRUE;
|
---|
2116 | }
|
---|
2117 | }
|
---|
2118 | if (gl_info->supported[ARB_MAP_BUFFER_RANGE])
|
---|
2119 | {
|
---|
2120 | /* GL_ARB_map_buffer_range and GL_APPLE_flush_buffer_range provide the same
|
---|
2121 | * functionality. Prefer the ARB extension */
|
---|
2122 | gl_info->supported[APPLE_FLUSH_BUFFER_RANGE] = FALSE;
|
---|
2123 | }
|
---|
2124 | if (gl_info->supported[ARB_TEXTURE_CUBE_MAP])
|
---|
2125 | {
|
---|
2126 | TRACE_(d3d_caps)(" IMPLIED: NVIDIA (NV) Texture Gen Reflection support.\n");
|
---|
2127 | gl_info->supported[NV_TEXGEN_REFLECTION] = TRUE;
|
---|
2128 | }
|
---|
2129 | if (!gl_info->supported[ARB_DEPTH_CLAMP] && gl_info->supported[NV_DEPTH_CLAMP])
|
---|
2130 | {
|
---|
2131 | TRACE_(d3d_caps)(" IMPLIED: ARB_depth_clamp support (by NV_depth_clamp).\n");
|
---|
2132 | gl_info->supported[ARB_DEPTH_CLAMP] = TRUE;
|
---|
2133 | }
|
---|
2134 | if (!gl_info->supported[ARB_VERTEX_ARRAY_BGRA] && gl_info->supported[EXT_VERTEX_ARRAY_BGRA])
|
---|
2135 | {
|
---|
2136 | TRACE_(d3d_caps)(" IMPLIED: ARB_vertex_array_bgra support (by EXT_vertex_array_bgra).\n");
|
---|
2137 | gl_info->supported[ARB_VERTEX_ARRAY_BGRA] = TRUE;
|
---|
2138 | }
|
---|
2139 | if (gl_info->supported[NV_TEXTURE_SHADER2])
|
---|
2140 | {
|
---|
2141 | if (gl_info->supported[NV_REGISTER_COMBINERS])
|
---|
2142 | {
|
---|
2143 | /* Also disable ATI_FRAGMENT_SHADER if register combiners and texture_shader2
|
---|
2144 | * are supported. The nv extensions provide the same functionality as the
|
---|
2145 | * ATI one, and a bit more(signed pixelformats). */
|
---|
2146 | gl_info->supported[ATI_FRAGMENT_SHADER] = FALSE;
|
---|
2147 | }
|
---|
2148 | }
|
---|
2149 |
|
---|
2150 | if (gl_info->supported[NV_REGISTER_COMBINERS])
|
---|
2151 | {
|
---|
2152 | glGetIntegerv(GL_MAX_GENERAL_COMBINERS_NV, &gl_max);
|
---|
2153 | gl_info->limits.general_combiners = gl_max;
|
---|
2154 | TRACE_(d3d_caps)("Max general combiners: %d.\n", gl_max);
|
---|
2155 | }
|
---|
2156 | if (gl_info->supported[ARB_DRAW_BUFFERS])
|
---|
2157 | {
|
---|
2158 | glGetIntegerv(GL_MAX_DRAW_BUFFERS_ARB, &gl_max);
|
---|
2159 | gl_info->limits.buffers = gl_max;
|
---|
2160 | TRACE_(d3d_caps)("Max draw buffers: %u.\n", gl_max);
|
---|
2161 | }
|
---|
2162 | if (gl_info->supported[ARB_MULTITEXTURE])
|
---|
2163 | {
|
---|
2164 | glGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB, &gl_max);
|
---|
2165 | gl_info->limits.textures = min(MAX_TEXTURES, gl_max);
|
---|
2166 | TRACE_(d3d_caps)("Max textures: %d.\n", gl_info->limits.textures);
|
---|
2167 |
|
---|
2168 | if (gl_info->supported[ARB_FRAGMENT_PROGRAM])
|
---|
2169 | {
|
---|
2170 | GLint tmp;
|
---|
2171 | glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS_ARB, &tmp);
|
---|
2172 | gl_info->limits.fragment_samplers = min(MAX_FRAGMENT_SAMPLERS, tmp);
|
---|
2173 | }
|
---|
2174 | else
|
---|
2175 | {
|
---|
2176 | gl_info->limits.fragment_samplers = max(gl_info->limits.fragment_samplers, gl_max);
|
---|
2177 | }
|
---|
2178 | TRACE_(d3d_caps)("Max fragment samplers: %d.\n", gl_info->limits.fragment_samplers);
|
---|
2179 |
|
---|
2180 | if (gl_info->supported[ARB_VERTEX_SHADER])
|
---|
2181 | {
|
---|
2182 | GLint tmp;
|
---|
2183 | glGetIntegerv(GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB, &tmp);
|
---|
2184 | gl_info->limits.vertex_samplers = tmp;
|
---|
2185 | glGetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB, &tmp);
|
---|
2186 | gl_info->limits.combined_samplers = tmp;
|
---|
2187 |
|
---|
2188 | /* Loading GLSL sampler uniforms is much simpler if we can assume that the sampler setup
|
---|
2189 | * is known at shader link time. In a vertex shader + pixel shader combination this isn't
|
---|
2190 | * an issue because then the sampler setup only depends on the two shaders. If a pixel
|
---|
2191 | * shader is used with fixed function vertex processing we're fine too because fixed function
|
---|
2192 | * vertex processing doesn't use any samplers. If fixed function fragment processing is
|
---|
2193 | * used we have to make sure that all vertex sampler setups are valid together with all
|
---|
2194 | * possible fixed function fragment processing setups. This is true if vsamplers + MAX_TEXTURES
|
---|
2195 | * <= max_samplers. This is true on all d3d9 cards that support vtf(gf 6 and gf7 cards).
|
---|
2196 | * dx9 radeon cards do not support vertex texture fetch. DX10 cards have 128 samplers, and
|
---|
2197 | * dx9 is limited to 8 fixed function texture stages and 4 vertex samplers. DX10 does not have
|
---|
2198 | * a fixed function pipeline anymore.
|
---|
2199 | *
|
---|
2200 | * So this is just a check to check that our assumption holds true. If not, write a warning
|
---|
2201 | * and reduce the number of vertex samplers or probably disable vertex texture fetch. */
|
---|
2202 | if (gl_info->limits.vertex_samplers && gl_info->limits.combined_samplers < 12
|
---|
2203 | && MAX_TEXTURES + gl_info->limits.vertex_samplers > gl_info->limits.combined_samplers)
|
---|
2204 | {
|
---|
2205 | FIXME("OpenGL implementation supports %u vertex samplers and %u total samplers.\n",
|
---|
2206 | gl_info->limits.vertex_samplers, gl_info->limits.combined_samplers);
|
---|
2207 | FIXME("Expected vertex samplers + MAX_TEXTURES(=8) > combined_samplers.\n");
|
---|
2208 | if (gl_info->limits.combined_samplers > MAX_TEXTURES)
|
---|
2209 | gl_info->limits.vertex_samplers = gl_info->limits.combined_samplers - MAX_TEXTURES;
|
---|
2210 | else
|
---|
2211 | gl_info->limits.vertex_samplers = 0;
|
---|
2212 | }
|
---|
2213 | }
|
---|
2214 | else
|
---|
2215 | {
|
---|
2216 | gl_info->limits.combined_samplers = gl_info->limits.fragment_samplers;
|
---|
2217 | }
|
---|
2218 | TRACE_(d3d_caps)("Max vertex samplers: %u.\n", gl_info->limits.vertex_samplers);
|
---|
2219 | TRACE_(d3d_caps)("Max combined samplers: %u.\n", gl_info->limits.combined_samplers);
|
---|
2220 | }
|
---|
2221 | if (gl_info->supported[ARB_VERTEX_BLEND])
|
---|
2222 | {
|
---|
2223 | glGetIntegerv(GL_MAX_VERTEX_UNITS_ARB, &gl_max);
|
---|
2224 | gl_info->limits.blends = gl_max;
|
---|
2225 | TRACE_(d3d_caps)("Max blends: %u.\n", gl_info->limits.blends);
|
---|
2226 | }
|
---|
2227 | if (gl_info->supported[EXT_TEXTURE3D])
|
---|
2228 | {
|
---|
2229 | glGetIntegerv(GL_MAX_3D_TEXTURE_SIZE_EXT, &gl_max);
|
---|
2230 | gl_info->limits.texture3d_size = gl_max;
|
---|
2231 | TRACE_(d3d_caps)("Max texture3D size: %d.\n", gl_info->limits.texture3d_size);
|
---|
2232 | }
|
---|
2233 | if (gl_info->supported[EXT_TEXTURE_FILTER_ANISOTROPIC])
|
---|
2234 | {
|
---|
2235 | glGetIntegerv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &gl_max);
|
---|
2236 | gl_info->limits.anisotropy = gl_max;
|
---|
2237 | TRACE_(d3d_caps)("Max anisotropy: %d.\n", gl_info->limits.anisotropy);
|
---|
2238 | }
|
---|
2239 | if (gl_info->supported[ARB_FRAGMENT_PROGRAM])
|
---|
2240 | {
|
---|
2241 | GL_EXTCALL(glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_ENV_PARAMETERS_ARB, &gl_max));
|
---|
2242 | gl_info->limits.arb_ps_float_constants = gl_max;
|
---|
2243 | TRACE_(d3d_caps)("Max ARB_FRAGMENT_PROGRAM float constants: %d.\n", gl_info->limits.arb_ps_float_constants);
|
---|
2244 | GL_EXTCALL(glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB, &gl_max));
|
---|
2245 | gl_info->limits.arb_ps_native_constants = gl_max;
|
---|
2246 | TRACE_(d3d_caps)("Max ARB_FRAGMENT_PROGRAM native float constants: %d.\n",
|
---|
2247 | gl_info->limits.arb_ps_native_constants);
|
---|
2248 | GL_EXTCALL(glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB, &gl_max));
|
---|
2249 | gl_info->limits.arb_ps_temps = gl_max;
|
---|
2250 | TRACE_(d3d_caps)("Max ARB_FRAGMENT_PROGRAM native temporaries: %d.\n", gl_info->limits.arb_ps_temps);
|
---|
2251 | GL_EXTCALL(glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB, &gl_max));
|
---|
2252 | gl_info->limits.arb_ps_instructions = gl_max;
|
---|
2253 | TRACE_(d3d_caps)("Max ARB_FRAGMENT_PROGRAM native instructions: %d.\n", gl_info->limits.arb_ps_instructions);
|
---|
2254 | GL_EXTCALL(glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB, &gl_max));
|
---|
2255 | gl_info->limits.arb_ps_local_constants = gl_max;
|
---|
2256 | TRACE_(d3d_caps)("Max ARB_FRAGMENT_PROGRAM local parameters: %d.\n", gl_info->limits.arb_ps_instructions);
|
---|
2257 | }
|
---|
2258 | if (gl_info->supported[ARB_VERTEX_PROGRAM])
|
---|
2259 | {
|
---|
2260 | GL_EXTCALL(glGetProgramivARB(GL_VERTEX_PROGRAM_ARB, GL_MAX_PROGRAM_ENV_PARAMETERS_ARB, &gl_max));
|
---|
2261 | gl_info->limits.arb_vs_float_constants = gl_max;
|
---|
2262 | TRACE_(d3d_caps)("Max ARB_VERTEX_PROGRAM float constants: %d.\n", gl_info->limits.arb_vs_float_constants);
|
---|
2263 | GL_EXTCALL(glGetProgramivARB(GL_VERTEX_PROGRAM_ARB, GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB, &gl_max));
|
---|
2264 | gl_info->limits.arb_vs_native_constants = gl_max;
|
---|
2265 | TRACE_(d3d_caps)("Max ARB_VERTEX_PROGRAM native float constants: %d.\n",
|
---|
2266 | gl_info->limits.arb_vs_native_constants);
|
---|
2267 | GL_EXTCALL(glGetProgramivARB(GL_VERTEX_PROGRAM_ARB, GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB, &gl_max));
|
---|
2268 | gl_info->limits.arb_vs_temps = gl_max;
|
---|
2269 | TRACE_(d3d_caps)("Max ARB_VERTEX_PROGRAM native temporaries: %d.\n", gl_info->limits.arb_vs_temps);
|
---|
2270 | GL_EXTCALL(glGetProgramivARB(GL_VERTEX_PROGRAM_ARB, GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB, &gl_max));
|
---|
2271 | gl_info->limits.arb_vs_instructions = gl_max;
|
---|
2272 | TRACE_(d3d_caps)("Max ARB_VERTEX_PROGRAM native instructions: %d.\n", gl_info->limits.arb_vs_instructions);
|
---|
2273 | #ifndef VBOX_WITH_VMSVGA
|
---|
2274 | if (test_arb_vs_offset_limit(gl_info)) gl_info->quirks |= WINED3D_QUIRK_ARB_VS_OFFSET_LIMIT;
|
---|
2275 | #endif
|
---|
2276 | }
|
---|
2277 | if (gl_info->supported[ARB_VERTEX_SHADER])
|
---|
2278 | {
|
---|
2279 | glGetIntegerv(GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB, &gl_max);
|
---|
2280 | gl_info->limits.glsl_vs_float_constants = gl_max / 4;
|
---|
2281 | #ifdef VBOX_WITH_WDDM
|
---|
2282 | /* AFAICT the " / 4" here comes from that we're going to use the glsl_vs/ps_float_constants to create vec4 arrays,
|
---|
2283 | * thus each array element has 4 components, so the actual number of vec4 arrays is GL_MAX_VERTEX/FRAGMENT_UNIFORM_COMPONENTS_ARB / 4
|
---|
2284 | * win8 Aero won't properly work with this constant < 256 in any way,
|
---|
2285 | * while Intel drivers I've encountered this problem with supports vec4 arrays of size > GL_MAX_VERTEX/FRAGMENT_UNIFORM_COMPONENTS_ARB / 4
|
---|
2286 | * so use it here.
|
---|
2287 | * @todo: add logging
|
---|
2288 | * @todo: perhaps should be movet to quirks?
|
---|
2289 | * */
|
---|
2290 | if (gl_info->limits.glsl_vs_float_constants < 256 && gl_max >= 256)
|
---|
2291 | {
|
---|
2292 | DWORD dwVersion = GetVersion();
|
---|
2293 | DWORD dwMajor = (DWORD)(LOBYTE(LOWORD(dwVersion)));
|
---|
2294 | DWORD dwMinor = (DWORD)(HIBYTE(LOWORD(dwVersion)));
|
---|
2295 | /* tmp workaround Win8 Aero requirement for 256 */
|
---|
2296 | if (dwMajor > 6 || dwMinor > 1)
|
---|
2297 | {
|
---|
2298 | gl_info->limits.glsl_vs_float_constants = 256;
|
---|
2299 | }
|
---|
2300 | }
|
---|
2301 | #endif
|
---|
2302 | TRACE_(d3d_caps)("Max ARB_VERTEX_SHADER float constants: %u.\n", gl_info->limits.glsl_vs_float_constants);
|
---|
2303 | }
|
---|
2304 | if (gl_info->supported[ARB_FRAGMENT_SHADER])
|
---|
2305 | {
|
---|
2306 | glGetIntegerv(GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB, &gl_max);
|
---|
2307 | gl_info->limits.glsl_ps_float_constants = gl_max / 4;
|
---|
2308 | #ifdef VBOX_WITH_WDDM
|
---|
2309 | /* AFAICT the " / 4" here comes from that we're going to use the glsl_vs/ps_float_constants to create vec4 arrays,
|
---|
2310 | * thus each array element has 4 components, so the actual number of vec4 arrays is GL_MAX_VERTEX/FRAGMENT_UNIFORM_COMPONENTS_ARB / 4
|
---|
2311 | * win8 Aero won't properly work with this constant < 256 in any way,
|
---|
2312 | * while Intel drivers I've encountered this problem with supports vec4 arrays of size > GL_MAX_VERTEX/FRAGMENT_UNIFORM_COMPONENTS_ARB / 4
|
---|
2313 | * so use it here.
|
---|
2314 | * @todo: add logging
|
---|
2315 | * @todo: perhaps should be movet to quirks?
|
---|
2316 | * */
|
---|
2317 | if (gl_info->limits.glsl_ps_float_constants < 256 && gl_max >= 256)
|
---|
2318 | {
|
---|
2319 | DWORD dwVersion = GetVersion();
|
---|
2320 | DWORD dwMajor = (DWORD)(LOBYTE(LOWORD(dwVersion)));
|
---|
2321 | DWORD dwMinor = (DWORD)(HIBYTE(LOWORD(dwVersion)));
|
---|
2322 | /* tmp workaround Win8 Aero requirement for 256 */
|
---|
2323 | if (dwMajor > 6 || dwMinor > 1)
|
---|
2324 | {
|
---|
2325 | gl_info->limits.glsl_ps_float_constants = 256;
|
---|
2326 | }
|
---|
2327 | }
|
---|
2328 | #endif
|
---|
2329 | TRACE_(d3d_caps)("Max ARB_FRAGMENT_SHADER float constants: %u.\n", gl_info->limits.glsl_ps_float_constants);
|
---|
2330 | glGetIntegerv(GL_MAX_VARYING_FLOATS_ARB, &gl_max);
|
---|
2331 | gl_info->limits.glsl_varyings = gl_max;
|
---|
2332 | TRACE_(d3d_caps)("Max GLSL varyings: %u (%u 4 component varyings).\n", gl_max, gl_max / 4);
|
---|
2333 | }
|
---|
2334 | if (gl_info->supported[ARB_SHADING_LANGUAGE_100])
|
---|
2335 | {
|
---|
2336 | const char *str = (const char *)glGetString(GL_SHADING_LANGUAGE_VERSION_ARB);
|
---|
2337 | unsigned int major, minor;
|
---|
2338 |
|
---|
2339 | TRACE_(d3d_caps)("GLSL version string: %s.\n", debugstr_a(str));
|
---|
2340 |
|
---|
2341 | /* The format of the GLSL version string is "major.minor[.release] [vendor info]". */
|
---|
2342 | sscanf(str, "%u.%u", &major, &minor);
|
---|
2343 | gl_info->glsl_version = MAKEDWORD_VERSION(major, minor);
|
---|
2344 | }
|
---|
2345 | if (gl_info->supported[NV_LIGHT_MAX_EXPONENT])
|
---|
2346 | {
|
---|
2347 | glGetFloatv(GL_MAX_SHININESS_NV, &gl_info->limits.shininess);
|
---|
2348 | }
|
---|
2349 | else
|
---|
2350 | {
|
---|
2351 | gl_info->limits.shininess = 128.0f;
|
---|
2352 | }
|
---|
2353 | if (gl_info->supported[ARB_TEXTURE_NON_POWER_OF_TWO])
|
---|
2354 | {
|
---|
2355 | /* If we have full NP2 texture support, disable
|
---|
2356 | * GL_ARB_texture_rectangle because we will never use it.
|
---|
2357 | * This saves a few redundant glDisable calls. */
|
---|
2358 | gl_info->supported[ARB_TEXTURE_RECTANGLE] = FALSE;
|
---|
2359 | }
|
---|
2360 | if (gl_info->supported[ATI_FRAGMENT_SHADER])
|
---|
2361 | {
|
---|
2362 | /* Disable NV_register_combiners and fragment shader if this is supported.
|
---|
2363 | * generally the NV extensions are preferred over the ATI ones, and this
|
---|
2364 | * extension is disabled if register_combiners and texture_shader2 are both
|
---|
2365 | * supported. So we reach this place only if we have incomplete NV dxlevel 8
|
---|
2366 | * fragment processing support. */
|
---|
2367 | gl_info->supported[NV_REGISTER_COMBINERS] = FALSE;
|
---|
2368 | gl_info->supported[NV_REGISTER_COMBINERS2] = FALSE;
|
---|
2369 | gl_info->supported[NV_TEXTURE_SHADER] = FALSE;
|
---|
2370 | gl_info->supported[NV_TEXTURE_SHADER2] = FALSE;
|
---|
2371 | }
|
---|
2372 | if (gl_info->supported[NV_HALF_FLOAT])
|
---|
2373 | {
|
---|
2374 | /* GL_ARB_half_float_vertex is a subset of GL_NV_half_float. */
|
---|
2375 | gl_info->supported[ARB_HALF_FLOAT_VERTEX] = TRUE;
|
---|
2376 | }
|
---|
2377 | if (gl_info->supported[ARB_POINT_SPRITE])
|
---|
2378 | {
|
---|
2379 | gl_info->limits.point_sprite_units = gl_info->limits.textures;
|
---|
2380 | }
|
---|
2381 | else
|
---|
2382 | {
|
---|
2383 | gl_info->limits.point_sprite_units = 0;
|
---|
2384 | }
|
---|
2385 | #ifndef VBOX_WITH_VMSVGA
|
---|
2386 | checkGLcall("extension detection");
|
---|
2387 | #endif
|
---|
2388 | LEAVE_GL();
|
---|
2389 |
|
---|
2390 | #ifndef VBOX_WITH_VMSVGA
|
---|
2391 | adapter->fragment_pipe = select_fragment_implementation(adapter);
|
---|
2392 | #endif
|
---|
2393 | adapter->shader_backend = select_shader_backend(adapter);
|
---|
2394 | #ifndef VBOX_WITH_VMSVGA
|
---|
2395 | adapter->blitter = select_blit_implementation(adapter);
|
---|
2396 |
|
---|
2397 | adapter->fragment_pipe->get_caps(gl_info, &fragment_caps);
|
---|
2398 | gl_info->limits.texture_stages = fragment_caps.MaxTextureBlendStages;
|
---|
2399 | TRACE_(d3d_caps)("Max texture stages: %u.\n", gl_info->limits.texture_stages);
|
---|
2400 |
|
---|
2401 | /* In some cases the number of texture stages can be larger than the number
|
---|
2402 | * of samplers. The GF4 for example can use only 2 samplers (no fragment
|
---|
2403 | * shaders), but 8 texture stages (register combiners). */
|
---|
2404 | gl_info->limits.sampler_stages = max(gl_info->limits.fragment_samplers, gl_info->limits.texture_stages);
|
---|
2405 | #endif
|
---|
2406 |
|
---|
2407 | if (gl_info->supported[ARB_FRAMEBUFFER_OBJECT])
|
---|
2408 | {
|
---|
2409 | gl_info->fbo_ops.glIsRenderbuffer = gl_info->glIsRenderbuffer;
|
---|
2410 | gl_info->fbo_ops.glBindRenderbuffer = gl_info->glBindRenderbuffer;
|
---|
2411 | gl_info->fbo_ops.glDeleteRenderbuffers = gl_info->glDeleteRenderbuffers;
|
---|
2412 | gl_info->fbo_ops.glGenRenderbuffers = gl_info->glGenRenderbuffers;
|
---|
2413 | gl_info->fbo_ops.glRenderbufferStorage = gl_info->glRenderbufferStorage;
|
---|
2414 | gl_info->fbo_ops.glRenderbufferStorageMultisample = gl_info->glRenderbufferStorageMultisample;
|
---|
2415 | gl_info->fbo_ops.glGetRenderbufferParameteriv = gl_info->glGetRenderbufferParameteriv;
|
---|
2416 | gl_info->fbo_ops.glIsFramebuffer = gl_info->glIsFramebuffer;
|
---|
2417 | gl_info->fbo_ops.glBindFramebuffer = gl_info->glBindFramebuffer;
|
---|
2418 | gl_info->fbo_ops.glDeleteFramebuffers = gl_info->glDeleteFramebuffers;
|
---|
2419 | gl_info->fbo_ops.glGenFramebuffers = gl_info->glGenFramebuffers;
|
---|
2420 | gl_info->fbo_ops.glCheckFramebufferStatus = gl_info->glCheckFramebufferStatus;
|
---|
2421 | gl_info->fbo_ops.glFramebufferTexture1D = gl_info->glFramebufferTexture1D;
|
---|
2422 | gl_info->fbo_ops.glFramebufferTexture2D = gl_info->glFramebufferTexture2D;
|
---|
2423 | gl_info->fbo_ops.glFramebufferTexture3D = gl_info->glFramebufferTexture3D;
|
---|
2424 | gl_info->fbo_ops.glFramebufferRenderbuffer = gl_info->glFramebufferRenderbuffer;
|
---|
2425 | gl_info->fbo_ops.glGetFramebufferAttachmentParameteriv = gl_info->glGetFramebufferAttachmentParameteriv;
|
---|
2426 | gl_info->fbo_ops.glBlitFramebuffer = gl_info->glBlitFramebuffer;
|
---|
2427 | gl_info->fbo_ops.glGenerateMipmap = gl_info->glGenerateMipmap;
|
---|
2428 | }
|
---|
2429 | else
|
---|
2430 | {
|
---|
2431 | if (gl_info->supported[EXT_FRAMEBUFFER_OBJECT])
|
---|
2432 | {
|
---|
2433 | gl_info->fbo_ops.glIsRenderbuffer = gl_info->glIsRenderbufferEXT;
|
---|
2434 | gl_info->fbo_ops.glBindRenderbuffer = gl_info->glBindRenderbufferEXT;
|
---|
2435 | gl_info->fbo_ops.glDeleteRenderbuffers = gl_info->glDeleteRenderbuffersEXT;
|
---|
2436 | gl_info->fbo_ops.glGenRenderbuffers = gl_info->glGenRenderbuffersEXT;
|
---|
2437 | gl_info->fbo_ops.glRenderbufferStorage = gl_info->glRenderbufferStorageEXT;
|
---|
2438 | gl_info->fbo_ops.glGetRenderbufferParameteriv = gl_info->glGetRenderbufferParameterivEXT;
|
---|
2439 | gl_info->fbo_ops.glIsFramebuffer = gl_info->glIsFramebufferEXT;
|
---|
2440 | gl_info->fbo_ops.glBindFramebuffer = gl_info->glBindFramebufferEXT;
|
---|
2441 | gl_info->fbo_ops.glDeleteFramebuffers = gl_info->glDeleteFramebuffersEXT;
|
---|
2442 | gl_info->fbo_ops.glGenFramebuffers = gl_info->glGenFramebuffersEXT;
|
---|
2443 | gl_info->fbo_ops.glCheckFramebufferStatus = gl_info->glCheckFramebufferStatusEXT;
|
---|
2444 | gl_info->fbo_ops.glFramebufferTexture1D = gl_info->glFramebufferTexture1DEXT;
|
---|
2445 | gl_info->fbo_ops.glFramebufferTexture2D = gl_info->glFramebufferTexture2DEXT;
|
---|
2446 | gl_info->fbo_ops.glFramebufferTexture3D = gl_info->glFramebufferTexture3DEXT;
|
---|
2447 | gl_info->fbo_ops.glFramebufferRenderbuffer = gl_info->glFramebufferRenderbufferEXT;
|
---|
2448 | gl_info->fbo_ops.glGetFramebufferAttachmentParameteriv = gl_info->glGetFramebufferAttachmentParameterivEXT;
|
---|
2449 | gl_info->fbo_ops.glGenerateMipmap = gl_info->glGenerateMipmapEXT;
|
---|
2450 | }
|
---|
2451 | #ifndef VBOX_WITH_VMSVGA
|
---|
2452 | else if (wined3d_settings.offscreen_rendering_mode == ORM_FBO)
|
---|
2453 | {
|
---|
2454 | WARN_(d3d_caps)("Framebuffer objects not supported, falling back to backbuffer offscreen rendering mode.\n");
|
---|
2455 | wined3d_settings.offscreen_rendering_mode = ORM_BACKBUFFER;
|
---|
2456 | }
|
---|
2457 | #endif
|
---|
2458 | if (gl_info->supported[EXT_FRAMEBUFFER_BLIT])
|
---|
2459 | {
|
---|
2460 | gl_info->fbo_ops.glBlitFramebuffer = gl_info->glBlitFramebufferEXT;
|
---|
2461 | }
|
---|
2462 | if (gl_info->supported[EXT_FRAMEBUFFER_MULTISAMPLE])
|
---|
2463 | {
|
---|
2464 | gl_info->fbo_ops.glRenderbufferStorageMultisample = gl_info->glRenderbufferStorageMultisampleEXT;
|
---|
2465 | }
|
---|
2466 | }
|
---|
2467 |
|
---|
2468 | #ifndef VBOX_WITH_VMSVGA
|
---|
2469 | /* MRTs are currently only supported when FBOs are used. */
|
---|
2470 | if (wined3d_settings.offscreen_rendering_mode != ORM_FBO)
|
---|
2471 | {
|
---|
2472 | gl_info->limits.buffers = 1;
|
---|
2473 | }
|
---|
2474 | #endif
|
---|
2475 | gl_vendor = wined3d_guess_gl_vendor(gl_info, gl_vendor_str, gl_renderer_str);
|
---|
2476 | card_vendor = wined3d_guess_card_vendor(gl_vendor_str, gl_renderer_str);
|
---|
2477 | TRACE_(d3d_caps)("found GL_VENDOR (%s)->(0x%04x/0x%04x)\n", debugstr_a(gl_vendor_str), gl_vendor, card_vendor);
|
---|
2478 |
|
---|
2479 | device = wined3d_guess_card(gl_info, gl_renderer_str, &gl_vendor, &card_vendor, &vidmem);
|
---|
2480 | TRACE_(d3d_caps)("FOUND (fake) card: 0x%x (vendor id), 0x%x (device id)\n", card_vendor, device);
|
---|
2481 |
|
---|
2482 | /* If we have an estimate use it, else default to 64MB; */
|
---|
2483 | if(vidmem)
|
---|
2484 | gl_info->vidmem = vidmem*1024*1024; /* convert from MBs to bytes */
|
---|
2485 | else
|
---|
2486 | gl_info->vidmem = WINE_DEFAULT_VIDMEM;
|
---|
2487 |
|
---|
2488 | gl_info->wrap_lookup[WINED3DTADDRESS_WRAP - WINED3DTADDRESS_WRAP] = GL_REPEAT;
|
---|
2489 | gl_info->wrap_lookup[WINED3DTADDRESS_MIRROR - WINED3DTADDRESS_WRAP] =
|
---|
2490 | gl_info->supported[ARB_TEXTURE_MIRRORED_REPEAT] ? GL_MIRRORED_REPEAT_ARB : GL_REPEAT;
|
---|
2491 | gl_info->wrap_lookup[WINED3DTADDRESS_CLAMP - WINED3DTADDRESS_WRAP] = GL_CLAMP_TO_EDGE;
|
---|
2492 | gl_info->wrap_lookup[WINED3DTADDRESS_BORDER - WINED3DTADDRESS_WRAP] =
|
---|
2493 | gl_info->supported[ARB_TEXTURE_BORDER_CLAMP] ? GL_CLAMP_TO_BORDER_ARB : GL_REPEAT;
|
---|
2494 | gl_info->wrap_lookup[WINED3DTADDRESS_MIRRORONCE - WINED3DTADDRESS_WRAP] =
|
---|
2495 | gl_info->supported[ATI_TEXTURE_MIRROR_ONCE] ? GL_MIRROR_CLAMP_TO_EDGE_ATI : GL_REPEAT;
|
---|
2496 |
|
---|
2497 | #ifndef VBOX_WITH_VMSVGA
|
---|
2498 | /* Make sure there's an active HDC else the WGL extensions will fail */
|
---|
2499 | hdc = pwglGetCurrentDC();
|
---|
2500 | if (hdc) {
|
---|
2501 | /* Not all GL drivers might offer WGL extensions e.g. VirtualBox */
|
---|
2502 | if(GL_EXTCALL(wglGetExtensionsStringARB))
|
---|
2503 | WGL_Extensions = GL_EXTCALL(wglGetExtensionsStringARB(hdc));
|
---|
2504 |
|
---|
2505 | if (NULL == WGL_Extensions) {
|
---|
2506 | ERR(" WGL_Extensions returns NULL\n");
|
---|
2507 | } else {
|
---|
2508 | TRACE_(d3d_caps)("WGL_Extensions reported:\n");
|
---|
2509 | while (*WGL_Extensions != 0x00) {
|
---|
2510 | const char *Start;
|
---|
2511 | char ThisExtn[256];
|
---|
2512 |
|
---|
2513 | while (isspace(*WGL_Extensions)) WGL_Extensions++;
|
---|
2514 | Start = WGL_Extensions;
|
---|
2515 | while (!isspace(*WGL_Extensions) && *WGL_Extensions != 0x00) {
|
---|
2516 | WGL_Extensions++;
|
---|
2517 | }
|
---|
2518 |
|
---|
2519 | len = WGL_Extensions - Start;
|
---|
2520 | if (len == 0 || len >= sizeof(ThisExtn))
|
---|
2521 | continue;
|
---|
2522 |
|
---|
2523 | memcpy(ThisExtn, Start, len);
|
---|
2524 | ThisExtn[len] = '\0';
|
---|
2525 | TRACE_(d3d_caps)("- %s\n", debugstr_a(ThisExtn));
|
---|
2526 |
|
---|
2527 | if (!strcmp(ThisExtn, "WGL_ARB_pixel_format")) {
|
---|
2528 | gl_info->supported[WGL_ARB_PIXEL_FORMAT] = TRUE;
|
---|
2529 | TRACE_(d3d_caps)("FOUND: WGL_ARB_pixel_format support\n");
|
---|
2530 | }
|
---|
2531 | if (!strcmp(ThisExtn, "WGL_WINE_pixel_format_passthrough")) {
|
---|
2532 | gl_info->supported[WGL_WINE_PIXEL_FORMAT_PASSTHROUGH] = TRUE;
|
---|
2533 | TRACE_(d3d_caps)("FOUND: WGL_WINE_pixel_format_passthrough support\n");
|
---|
2534 | }
|
---|
2535 | }
|
---|
2536 | }
|
---|
2537 | }
|
---|
2538 | #endif
|
---|
2539 |
|
---|
2540 | fixup_extensions(gl_info, gl_renderer_str, gl_vendor, card_vendor, device);
|
---|
2541 | #ifndef VBOX_WITH_VMSVGA
|
---|
2542 | init_driver_info(driver_info, card_vendor, device);
|
---|
2543 | add_gl_compat_wrappers(gl_info);
|
---|
2544 | #endif
|
---|
2545 |
|
---|
2546 | return TRUE;
|
---|
2547 | }
|
---|
2548 |
|
---|