VirtualBox

source: vbox/trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_limits.c@ 37613

最後變更 在這個檔案從37613是 27091,由 vboxsync 提交於 15 年 前

crOpenGL: add GL_ARB_pixel_buffer_object support

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Id
檔案大小: 18.0 KB
 
1
2/* Copyright (c) 2001, Stanford University
3 * All rights reserved
4 *
5 * See the file LICENSE.txt for information on redistributing this software.
6 */
7
8#include <stdio.h>
9#include "state.h"
10#include "state/cr_statetypes.h"
11#include "cr_mem.h"
12#include "cr_string.h"
13#include "cr_extstring.h"
14
15#ifdef WINDOWS
16#pragma warning( disable : 4127 )
17#endif
18
19
20/* This is a debug helper function. */
21void crStateLimitsPrint (const CRLimitsState *l)
22{
23 fprintf(stderr, "----------- OpenGL limits ----------------\n");
24 fprintf(stderr, "GL_MAX_TEXTURE_UNITS = %d\n", (int) l->maxTextureUnits);
25 fprintf(stderr, "GL_MAX_TEXTURE_SIZE = %d\n", (int) l->maxTextureSize);
26 fprintf(stderr, "GL_MAX_3D_TEXTURE_SIZE = %d\n", (int) l->max3DTextureSize);
27 fprintf(stderr, "GL_MAX_CUBE_MAP_TEXTURE_SIZE = %d\n", (int) l->maxCubeMapTextureSize);
28 fprintf(stderr, "GL_MAX_TEXTURE_ANISOTROPY = %f\n", l->maxTextureAnisotropy);
29 fprintf(stderr, "GL_MAX_LIGHTS = %d\n", (int) l->maxLights);
30 fprintf(stderr, "GL_MAX_CLIP_PLANES = %d\n", (int) l->maxClipPlanes);
31 fprintf(stderr, "GL_MAX_ATTRIB_STACK_DEPTH = %d\n", (int) l->maxClientAttribStackDepth);
32 fprintf(stderr, "GL_MAX_PROJECTION_STACK_DEPTH = %d\n", (int) l->maxProjectionStackDepth);
33 fprintf(stderr, "GL_MAX_MODELVIEW_STACK_DEPTH = %d\n", (int) l->maxModelviewStackDepth);
34 fprintf(stderr, "GL_MAX_TEXTURE_STACK_DEPTH = %d\n", (int) l->maxTextureStackDepth);
35 fprintf(stderr, "GL_MAX_COLOR_STACK_DEPTH = %d\n", (int) l->maxColorStackDepth);
36 fprintf(stderr, "GL_MAX_ATTRIB_STACK_DEPTH = %d\n", (int) l->maxAttribStackDepth);
37 fprintf(stderr, "GL_MAX_ATTRIB_STACK_DEPTH = %d\n", (int) l->maxClientAttribStackDepth);
38 fprintf(stderr, "GL_MAX_NAME_STACK_DEPTH = %d\n", (int) l->maxNameStackDepth);
39 fprintf(stderr, "GL_MAX_ELEMENTS_INDICES = %d\n", (int) l->maxElementsIndices);
40 fprintf(stderr, "GL_MAX_ELEMENTS_VERTICES = %d\n", (int) l->maxElementsVertices);
41 fprintf(stderr, "GL_MAX_EVAL_ORDER = %d\n", (int) l->maxEvalOrder);
42 fprintf(stderr, "GL_MAX_LIST_NESTING = %d\n", (int) l->maxListNesting);
43 fprintf(stderr, "GL_MAX_PIXEL_MAP_TABLE = %d\n", (int) l->maxPixelMapTable);
44 fprintf(stderr, "GL_MAX_VIEWPORT_DIMS = %d %d\n",
45 (int) l->maxViewportDims[0], (int) l->maxViewportDims[1]);
46 fprintf(stderr, "GL_SUBPIXEL_BITS = %d\n", (int) l->subpixelBits);
47 fprintf(stderr, "GL_ALIASED_POINT_SIZE_RANGE = %f .. %f\n",
48 l->aliasedPointSizeRange[0], l->aliasedPointSizeRange[1]);
49 fprintf(stderr, "GL_SMOOTH_POINT_SIZE_RANGE = %f .. %f\n",
50 l->aliasedPointSizeRange[0], l->aliasedPointSizeRange[1]);
51 fprintf(stderr, "GL_POINT_SIZE_GRANULARITY = %f\n", l->pointSizeGranularity);
52 fprintf(stderr, "GL_ALIASED_LINE_WIDTH_RANGE = %f .. %f\n",
53 l->aliasedLineWidthRange[0], l->aliasedLineWidthRange[1]);
54 fprintf(stderr, "GL_SMOOTH_LINE_WIDTH_RANGE = %f .. %f\n",
55 l->smoothLineWidthRange[0], l->smoothLineWidthRange[1]);
56 fprintf(stderr, "GL_LINE_WIDTH_GRANULARITY = %f\n", l->lineWidthGranularity);
57 fprintf(stderr, "GL_MAX_GENERAL_COMBINERS_NV = %d\n", (int) l->maxGeneralCombiners);
58 fprintf(stderr, "GL_EXTENSIONS = %s\n", (const char *) l->extensions);
59 fprintf(stderr, "------------------------------------------\n");
60}
61
62
63void crStateLimitsDestroy(CRLimitsState *l)
64{
65 if (l->extensions) {
66 crFree((void *) l->extensions);
67 l->extensions = NULL;
68 }
69}
70
71
72/*
73 * Initialize the CRLimitsState object to Chromium's defaults.
74 */
75void crStateLimitsInit (CRLimitsState *l)
76{
77 l->maxTextureUnits = CR_MAX_TEXTURE_UNITS;
78 l->maxTextureSize = CR_MAX_TEXTURE_SIZE;
79 l->max3DTextureSize = CR_MAX_3D_TEXTURE_SIZE;
80 l->maxCubeMapTextureSize = CR_MAX_CUBE_TEXTURE_SIZE;
81#ifdef CR_NV_texture_rectangle
82 l->maxRectTextureSize = CR_MAX_RECTANGLE_TEXTURE_SIZE;
83#endif
84 l->maxTextureAnisotropy = CR_MAX_TEXTURE_ANISOTROPY;
85 l->maxGeneralCombiners = CR_MAX_GENERAL_COMBINERS;
86 l->maxLights = CR_MAX_LIGHTS;
87 l->maxClipPlanes = CR_MAX_CLIP_PLANES;
88 l->maxClientAttribStackDepth = CR_MAX_ATTRIB_STACK_DEPTH;
89 l->maxProjectionStackDepth = CR_MAX_PROJECTION_STACK_DEPTH;
90 l->maxModelviewStackDepth = CR_MAX_MODELVIEW_STACK_DEPTH;
91 l->maxTextureStackDepth = CR_MAX_TEXTURE_STACK_DEPTH;
92 l->maxColorStackDepth = CR_MAX_COLOR_STACK_DEPTH;
93 l->maxAttribStackDepth = CR_MAX_ATTRIB_STACK_DEPTH;
94 l->maxClientAttribStackDepth = CR_MAX_ATTRIB_STACK_DEPTH;
95 l->maxNameStackDepth = CR_MAX_NAME_STACK_DEPTH;
96 l->maxElementsIndices = CR_MAX_ELEMENTS_INDICES;
97 l->maxElementsVertices = CR_MAX_ELEMENTS_VERTICES;
98 l->maxEvalOrder = CR_MAX_EVAL_ORDER;
99 l->maxListNesting = CR_MAX_LIST_NESTING;
100 l->maxPixelMapTable = CR_MAX_PIXEL_MAP_TABLE;
101 l->maxViewportDims[0] = l->maxViewportDims[1] = CR_MAX_VIEWPORT_DIM;
102 l->subpixelBits = CR_SUBPIXEL_BITS;
103 l->aliasedPointSizeRange[0] = CR_ALIASED_POINT_SIZE_MIN;
104 l->aliasedPointSizeRange[1] = CR_ALIASED_POINT_SIZE_MAX;
105 l->smoothPointSizeRange[0] = CR_SMOOTH_POINT_SIZE_MIN;
106 l->smoothPointSizeRange[1] = CR_SMOOTH_POINT_SIZE_MAX;
107 l->pointSizeGranularity = CR_POINT_SIZE_GRANULARITY;
108 l->aliasedLineWidthRange[0] = CR_ALIASED_LINE_WIDTH_MIN;
109 l->aliasedLineWidthRange[1] = CR_ALIASED_LINE_WIDTH_MAX;
110 l->smoothLineWidthRange[0] = CR_SMOOTH_LINE_WIDTH_MIN;
111 l->smoothLineWidthRange[1] = CR_SMOOTH_LINE_WIDTH_MAX;
112 l->lineWidthGranularity = CR_LINE_WIDTH_GRANULARITY;
113#ifdef CR_EXT_texture_lod_bias
114 l->maxTextureLodBias = CR_MAX_TEXTURE_LOD_BIAS;
115#endif
116#ifdef CR_NV_fragment_program
117 l->maxTextureCoords = CR_MAX_TEXTURE_COORDS;
118 l->maxTextureImageUnits = CR_MAX_TEXTURE_IMAGE_UNITS;
119 l->maxFragmentProgramLocalParams = CR_MAX_FRAGMENT_LOCAL_PARAMS;
120#endif
121#ifdef CR_NV_vertex_program
122 l->maxProgramMatrixStackDepth = CR_MAX_PROGRAM_MATRIX_STACK_DEPTH;
123 l->maxProgramMatrices = CR_MAX_PROGRAM_MATRICES;
124#endif
125#ifdef CR_ARB_fragment_program
126 l->maxFragmentProgramInstructions = CR_MAX_FRAGMENT_PROGRAM_INSTRUCTIONS;
127 l->maxFragmentProgramLocalParams = CR_MAX_FRAGMENT_PROGRAM_LOCAL_PARAMS;
128 l->maxFragmentProgramEnvParams = CR_MAX_FRAGMENT_PROGRAM_ENV_PARAMS;
129 l->maxFragmentProgramTemps = CR_MAX_FRAGMENT_PROGRAM_TEMPS;
130 l->maxFragmentProgramAttribs = CR_MAX_FRAGMENT_PROGRAM_ATTRIBS;
131 l->maxFragmentProgramAddressRegs = CR_MAX_FRAGMENT_PROGRAM_ADDRESS_REGS;
132 l->maxFragmentProgramAluInstructions = CR_MAX_FRAGMENT_PROGRAM_ALU_INSTRUCTIONS;
133 l->maxFragmentProgramTexInstructions = CR_MAX_FRAGMENT_PROGRAM_TEX_INSTRUCTIONS;
134 l->maxFragmentProgramTexIndirections = CR_MAX_FRAGMENT_PROGRAM_TEX_INDIRECTIONS;
135#endif
136#ifdef CR_ARB_vertex_program
137 l->maxVertexProgramInstructions = CR_MAX_VERTEX_PROGRAM_INSTRUCTIONS;
138 l->maxVertexProgramLocalParams = CR_MAX_VERTEX_PROGRAM_LOCAL_PARAMS;
139 l->maxVertexProgramEnvParams = CR_MAX_VERTEX_PROGRAM_ENV_PARAMS;
140 l->maxVertexProgramTemps = CR_MAX_VERTEX_PROGRAM_TEMPS;
141 l->maxVertexProgramAttribs = CR_MAX_VERTEX_PROGRAM_ATTRIBS;
142 l->maxVertexProgramAddressRegs = CR_MAX_VERTEX_PROGRAM_ADDRESS_REGS;
143#endif
144
145 l->extensions = (GLubyte *) crStrdup(crExtensions);
146
147 /* These will get properly set in crStateCreateContext() by examining
148 * the visBits bitfield parameter.
149 */
150 l->redBits = 0;
151 l->greenBits = 0;
152 l->blueBits = 0;
153 l->alphaBits = 0;
154 l->depthBits = 0;
155 l->stencilBits = 0;
156 l->accumRedBits = 0;
157 l->accumGreenBits = 0;
158 l->accumBlueBits = 0;
159 l->accumAlphaBits = 0;
160 l->auxBuffers = 0;
161 l->rgbaMode = GL_TRUE;
162 l->doubleBuffer = GL_FALSE;
163 l->stereo = GL_FALSE;
164 l->sampleBuffers = 0;
165 l->samples = 0;
166 l->level = 0;
167
168 (void) crAppOnlyExtensions; /* silence warning */
169}
170
171
172/*
173 * Given the GL version number returned from a real GL renderer,
174 * compute the version number supported by Chromium.
175 */
176GLfloat crStateComputeVersion(float minVersion)
177{
178 const GLfloat crVersion = crStrToFloat(CR_OPENGL_VERSION_STRING);
179 if (crVersion < minVersion)
180 minVersion = crVersion;
181 return minVersion;
182}
183
184
185/*
186 * <extenions> is an array [n] of GLubyte pointers which contain lists of
187 * OpenGL extensions.
188 * Compute the intersection of those strings, then append the Chromium
189 * extension strings.
190 */
191GLubyte * crStateMergeExtensions(GLuint n, const GLubyte **extensions)
192{
193 char *merged, *result;
194 GLuint i;
195
196 /* find intersection of all extension strings */
197 merged = crStrdup(crExtensions);
198 for (i = 0; i < n; i++)
199 {
200 char *m = crStrIntersect(merged, (const char *) extensions[i]);
201 if (merged)
202 crFree(merged);
203 merged = m;
204 }
205
206 /* append Cr extensions */
207 result = crStrjoin(merged, crChromiumExtensions);
208 crFree(merged);
209 return (GLubyte *) result;
210}
211
212static GLboolean hasExtension(const char *haystack, const char *needle)
213{
214 const int needleLen = crStrlen(needle);
215 const char *s;
216
217 while (1) {
218 s = crStrstr(haystack, needle);
219 if (!s)
220 return GL_FALSE;
221 if (s && (s[needleLen] == ' ' || s[needleLen] == 0))
222 return GL_TRUE;
223 haystack += needleLen;
224 }
225}
226
227/*
228 * Examine the context's extension string and set the boolean extension
229 * flags accordingly. This is to be called during context initialization.
230 */
231void crStateExtensionsInit( CRLimitsState *limits, CRExtensionState *extensions )
232{
233 /* init all booleans to false */
234 crMemZero(extensions, sizeof(CRExtensionState));
235
236 if (hasExtension((const char*)limits->extensions, "GL_ARB_depth_texture"))
237 extensions->ARB_depth_texture = GL_TRUE;
238
239 if (hasExtension((const char*)limits->extensions, "GL_ARB_fragment_program"))
240 extensions->ARB_fragment_program = GL_TRUE;
241
242 if (hasExtension((const char*)limits->extensions, "GL_ARB_imaging"))
243 extensions->ARB_imaging = GL_TRUE;
244
245 if (hasExtension((const char*)limits->extensions, "GL_ARB_multisample"))
246 extensions->ARB_multisample = GL_TRUE;
247
248 if (hasExtension((const char*)limits->extensions, "GL_ARB_multitexture"))
249 extensions->ARB_multitexture = GL_TRUE;
250
251 if (hasExtension((const char*)limits->extensions, "GL_ARB_occlusion_query"))
252 extensions->ARB_occlusion_query = GL_TRUE;
253
254 if (hasExtension((const char*)limits->extensions, "GL_ARB_point_parameters"))
255 extensions->ARB_point_parameters = GL_TRUE;
256
257 if (hasExtension((const char*)limits->extensions, "GL_ARB_point_sprite"))
258 extensions->ARB_point_sprite = GL_TRUE;
259
260 if (hasExtension((const char*)limits->extensions, "GL_ARB_shadow"))
261 extensions->ARB_shadow = GL_TRUE;
262
263 if (hasExtension((const char*)limits->extensions, "GL_ARB_shadow_ambient"))
264 extensions->ARB_shadow_ambient = GL_TRUE;
265
266 if (hasExtension((const char*)limits->extensions, "GL_ARB_texture_border_clamp") ||
267 hasExtension((const char*)limits->extensions, "GL_SGIS_texture_border_clamp"))
268 extensions->ARB_texture_border_clamp = GL_TRUE;
269
270 if (hasExtension((const char*)limits->extensions, "GL_ARB_texture_compression"))
271 extensions->ARB_texture_compression = GL_TRUE;
272
273 if (hasExtension((const char*)limits->extensions, "GL_ARB_texture_cube_map") ||
274 hasExtension((const char*)limits->extensions, "GL_EXT_texture_cube_map"))
275 extensions->ARB_texture_cube_map = GL_TRUE;
276
277 if (hasExtension((const char*)limits->extensions, "GL_ARB_texture_env_add"))
278 extensions->ARB_texture_env_add = GL_TRUE;
279
280 if (hasExtension((const char*)limits->extensions, "GL_ARB_texture_env_combine") ||
281 hasExtension((const char*)limits->extensions, "GL_EXT_texture_env_combine"))
282 extensions->ARB_texture_env_combine = GL_TRUE;
283
284 if (hasExtension((const char*)limits->extensions, "GL_ARB_texture_env_crossbar"))
285 extensions->ARB_texture_env_crossbar = GL_TRUE;
286
287 if (hasExtension((const char*)limits->extensions, "GL_ARB_texture_env_dot3") ||
288 hasExtension((const char*)limits->extensions, "GL_EXT_texture_env_dot3"))
289 extensions->ARB_texture_env_dot3 = GL_TRUE;
290
291 if (hasExtension((const char*)limits->extensions, "GL_ARB_texture_mirrored_repeat"))
292 extensions->ARB_texture_mirrored_repeat = GL_TRUE;
293
294 if (hasExtension((const char*)limits->extensions, "GL_ARB_texture_non_power_of_two"))
295 extensions->ARB_texture_non_power_of_two = GL_TRUE;
296
297 if (hasExtension((const char*)limits->extensions, "GL_ARB_transpose_matrix"))
298 extensions->ARB_transpose_matrix = GL_TRUE;
299
300 if (hasExtension((const char*)limits->extensions, "GL_ARB_vertex_buffer_object"))
301 extensions->ARB_vertex_buffer_object = GL_TRUE;
302
303 if (hasExtension((const char*)limits->extensions, "GL_ARB_pixel_buffer_object"))
304 extensions->ARB_pixel_buffer_object = GL_TRUE;
305
306 if (hasExtension((const char*)limits->extensions, "GL_ARB_vertex_program"))
307 extensions->ARB_vertex_program = GL_TRUE;
308
309 if (hasExtension((const char*)limits->extensions, "GL_ARB_window_pos"))
310 extensions->ARB_window_pos = GL_TRUE;
311
312 if (hasExtension((const char*)limits->extensions, "GL_EXT_blend_color"))
313 extensions->EXT_blend_color= GL_TRUE;
314
315 if (hasExtension((const char*)limits->extensions, "GL_EXT_blend_minmax"))
316 extensions->EXT_blend_minmax = GL_TRUE;
317
318 if (hasExtension((const char*)limits->extensions, "GL_EXT_blend_func_separate"))
319 extensions->EXT_blend_func_separate = GL_TRUE;
320
321 if (hasExtension((const char*)limits->extensions, "GL_EXT_blend_logic_op"))
322 extensions->EXT_blend_logic_op = GL_TRUE;
323
324 if (hasExtension((const char*)limits->extensions, "GL_EXT_blend_subtract"))
325 extensions->EXT_blend_subtract = GL_TRUE;
326
327 if (hasExtension((const char*)limits->extensions, "GL_EXT_clip_volume_hint"))
328 extensions->EXT_clip_volume_hint = GL_TRUE;
329
330 if (hasExtension((const char*)limits->extensions, "GL_EXT_fog_coord"))
331 extensions->EXT_fog_coord = GL_TRUE;
332
333 if (hasExtension((const char*)limits->extensions, "GL_EXT_multi_draw_arrays"))
334 extensions->EXT_multi_draw_arrays = GL_TRUE;
335
336 if (hasExtension((const char*)limits->extensions, "GL_EXT_secondary_color"))
337 extensions->EXT_secondary_color = GL_TRUE;
338
339 if (hasExtension((const char*)limits->extensions, "GL_EXT_separate_specular_color"))
340 extensions->EXT_separate_specular_color = GL_TRUE;
341
342 if (hasExtension((const char*)limits->extensions, "GL_EXT_shadow_funcs"))
343 extensions->EXT_shadow_funcs = GL_TRUE;
344
345 if (hasExtension((const char*)limits->extensions, "GL_EXT_stencil_wrap"))
346 extensions->EXT_stencil_wrap = GL_TRUE;
347
348 if (hasExtension((const char*)limits->extensions, "GL_EXT_texture_edge_clamp") ||
349 hasExtension((const char*)limits->extensions, "GL_SGIS_texture_edge_clamp"))
350 extensions->EXT_texture_edge_clamp = GL_TRUE;
351
352 if (hasExtension((const char*)limits->extensions, "GL_EXT_texture_filter_anisotropic"))
353 extensions->EXT_texture_filter_anisotropic = GL_TRUE;
354
355 if (hasExtension((const char*)limits->extensions, "GL_EXT_texture_lod_bias"))
356 extensions->EXT_texture_lod_bias = GL_TRUE;
357
358 if (hasExtension((const char*)limits->extensions, "GL_IBM_rasterpos_clip"))
359 extensions->IBM_rasterpos_clip = GL_TRUE;
360
361 if (hasExtension((const char*)limits->extensions, "GL_NV_fog_distance"))
362 extensions->NV_fog_distance = GL_TRUE;
363
364 if (hasExtension((const char*)limits->extensions, "GL_NV_fragment_program"))
365 extensions->NV_fragment_program = GL_TRUE;
366
367 if (hasExtension((const char*)limits->extensions, "GL_NV_register_combiners"))
368 extensions->NV_register_combiners = GL_TRUE;
369
370 if (hasExtension((const char*)limits->extensions, "GL_NV_register_combiners2"))
371 extensions->NV_register_combiners2 = GL_TRUE;
372
373 if (hasExtension((const char*)limits->extensions, "GL_NV_texgen_reflection"))
374 extensions->NV_texgen_reflection = GL_TRUE;
375
376 if (hasExtension((const char*)limits->extensions, "GL_NV_texture_rectangle")
377 || hasExtension((const char*)limits->extensions, "GL_EXT_texture_rectangle"))
378 extensions->NV_texture_rectangle = GL_TRUE;
379
380 if (hasExtension((const char*)limits->extensions, "GL_NV_vertex_program"))
381 extensions->NV_vertex_program = GL_TRUE;
382
383 if (hasExtension((const char*)limits->extensions, "GL_NV_vertex_program1_1"))
384 extensions->NV_vertex_program1_1 = GL_TRUE;
385
386 if (hasExtension((const char*)limits->extensions, "GL_NV_vertex_program2"))
387 extensions->NV_vertex_program2 = GL_TRUE;
388
389 if (hasExtension((const char*)limits->extensions, "GL_EXT_texture3D"))
390 extensions->EXT_texture3D = GL_TRUE;
391
392 if (hasExtension((const char*)limits->extensions, "GL_SGIS_generate_mipmap"))
393 extensions->SGIS_generate_mipmap = GL_TRUE;
394
395 if (hasExtension((const char*)limits->extensions, "GLX_EXT_texture_from_pixmap"))
396 extensions->EXT_texture_from_pixmap = GL_TRUE;
397
398 if (extensions->NV_vertex_program2)
399 limits->maxVertexProgramEnvParams = 256;
400 else
401 limits->maxVertexProgramEnvParams = 96;
402
403 if (extensions->NV_vertex_program || extensions->ARB_vertex_program)
404 extensions->any_vertex_program = GL_TRUE;
405 if (extensions->NV_fragment_program || extensions->ARB_fragment_program)
406 extensions->any_fragment_program = GL_TRUE;
407 if (extensions->any_vertex_program || extensions->any_fragment_program)
408 extensions->any_program = GL_TRUE;
409
410#if 0
411 /* Now, determine what level of OpenGL we support */
412 if (extensions->ARB_multisample &&
413 extensions->ARB_multitexture &&
414 extensions->ARB_texture_border_clamp &&
415 extensions->ARB_texture_compression &&
416 extensions->ARB_texture_cube_map &&
417 extensions->ARB_texture_env_add &&
418 extensions->ARB_texture_env_combine &&
419 extensions->ARB_texture_env_dot3) {
420 if (extensions->ARB_depth_texture &&
421 extensions->ARB_point_parameters &&
422 extensions->ARB_shadow &&
423 extensions->ARB_texture_env_crossbar &&
424 extensions->ARB_texture_mirrored_repeat &&
425 extensions->ARB_window_pos &&
426 extensions->EXT_blend_color &&
427 extensions->EXT_blend_func_separate &&
428 extensions->EXT_blend_logic_op &&
429 extensions->EXT_blend_minmax &&
430 extensions->EXT_blend_subtract &&
431 extensions->EXT_fog_coord &&
432 extensions->EXT_multi_draw_arrays &&
433 extensions->EXT_secondary_color &&
434 extensions->EXT_shadow_funcs &&
435 extensions->EXT_stencil_wrap &&
436 extensions->SGIS_generate_mipmap) {
437 if (extensions->ARB_occlusion_query &&
438 extensions->ARB_vertex_buffer_object &&
439 extensions->ARB_texture_non_power_of_two &&
440 extensions->EXT_shadow_funcs) {
441 extensions->version = (const GLubyte *) "1.5 Chromium " CR_VERSION_STRING;
442 }
443 else {
444 extensions->version = (const GLubyte *) "1.4 Chromium " CR_VERSION_STRING;
445 }
446 }
447 else {
448 extensions->version = (const GLubyte *) "1.3 Chromium " CR_VERSION_STRING;
449 }
450 }
451 else {
452 extensions->version = (const GLubyte *) "1.2 Chromium " CR_VERSION_STRING;
453 }
454#endif
455}
456
457
458/*
459 * Set the GL_EXTENSIONS string for the given context. We'll make
460 * a copy of the given string.
461 */
462void
463crStateSetExtensionString( CRContext *ctx, const GLubyte *extensions )
464{
465 if (ctx->limits.extensions)
466 crFree((void *) ctx->limits.extensions);
467
468 ctx->limits.extensions = (const GLubyte *)crStrdup((const char*)extensions);
469
470 crStateExtensionsInit(&(ctx->limits), &(ctx->extensions));
471}
472
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette