extensions.c revision 7117f1b4
17117f1b4Smrg/* 27117f1b4Smrg * Mesa 3-D graphics library 37117f1b4Smrg * Version: 6.5.1 47117f1b4Smrg * 57117f1b4Smrg * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. 67117f1b4Smrg * 77117f1b4Smrg * Permission is hereby granted, free of charge, to any person obtaining a 87117f1b4Smrg * copy of this software and associated documentation files (the "Software"), 97117f1b4Smrg * to deal in the Software without restriction, including without limitation 107117f1b4Smrg * the rights to use, copy, modify, merge, publish, distribute, sublicense, 117117f1b4Smrg * and/or sell copies of the Software, and to permit persons to whom the 127117f1b4Smrg * Software is furnished to do so, subject to the following conditions: 137117f1b4Smrg * 147117f1b4Smrg * The above copyright notice and this permission notice shall be included 157117f1b4Smrg * in all copies or substantial portions of the Software. 167117f1b4Smrg * 177117f1b4Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 187117f1b4Smrg * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 197117f1b4Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 207117f1b4Smrg * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 217117f1b4Smrg * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 227117f1b4Smrg * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 237117f1b4Smrg */ 247117f1b4Smrg 257117f1b4Smrg 267117f1b4Smrg#include "glheader.h" 277117f1b4Smrg#include "imports.h" 287117f1b4Smrg#include "context.h" 297117f1b4Smrg#include "extensions.h" 307117f1b4Smrg#include "simple_list.h" 317117f1b4Smrg#include "mtypes.h" 327117f1b4Smrg 337117f1b4Smrg 347117f1b4Smrg#define F(x) (int)(uintptr_t)&(((struct gl_extensions *)0)->x) 357117f1b4Smrg#define ON GL_TRUE 367117f1b4Smrg#define OFF GL_FALSE 377117f1b4Smrg 387117f1b4Smrg 397117f1b4Smrg/* 407117f1b4Smrg * Note: The GL_MESAX_* extensions are placeholders for future ARB extensions. 417117f1b4Smrg */ 427117f1b4Smrgstatic const struct { 437117f1b4Smrg GLboolean enabled; 447117f1b4Smrg const char *name; 457117f1b4Smrg int flag_offset; 467117f1b4Smrg} default_extensions[] = { 477117f1b4Smrg { OFF, "GL_ARB_depth_texture", F(ARB_depth_texture) }, 487117f1b4Smrg { OFF, "GL_ARB_draw_buffers", F(ARB_draw_buffers) }, 497117f1b4Smrg { OFF, "GL_ARB_fragment_program", F(ARB_fragment_program) }, 507117f1b4Smrg { OFF, "GL_ARB_fragment_shader", F(ARB_fragment_shader) }, 517117f1b4Smrg { OFF, "GL_ARB_half_float_pixel", F(ARB_half_float_pixel) }, 527117f1b4Smrg { OFF, "GL_ARB_imaging", F(ARB_imaging) }, 537117f1b4Smrg { OFF, "GL_ARB_multisample", F(ARB_multisample) }, 547117f1b4Smrg { OFF, "GL_ARB_multitexture", F(ARB_multitexture) }, 557117f1b4Smrg { OFF, "GL_ARB_occlusion_query", F(ARB_occlusion_query) }, 567117f1b4Smrg { OFF, "GL_ARB_pixel_buffer_object", F(EXT_pixel_buffer_object) }, 577117f1b4Smrg { OFF, "GL_ARB_point_parameters", F(EXT_point_parameters) }, 587117f1b4Smrg { OFF, "GL_ARB_point_sprite", F(ARB_point_sprite) }, 597117f1b4Smrg { OFF, "GL_ARB_shader_objects", F(ARB_shader_objects) }, 607117f1b4Smrg { OFF, "GL_ARB_shading_language_100", F(ARB_shading_language_100) }, 617117f1b4Smrg { OFF, "GL_ARB_shading_language_120", F(ARB_shading_language_120) }, 627117f1b4Smrg { OFF, "GL_ARB_shadow", F(ARB_shadow) }, 637117f1b4Smrg { OFF, "GL_ARB_shadow_ambient", F(SGIX_shadow_ambient) }, 647117f1b4Smrg { OFF, "GL_ARB_texture_border_clamp", F(ARB_texture_border_clamp) }, 657117f1b4Smrg { OFF, "GL_ARB_texture_compression", F(ARB_texture_compression) }, 667117f1b4Smrg { OFF, "GL_ARB_texture_cube_map", F(ARB_texture_cube_map) }, 677117f1b4Smrg { OFF, "GL_ARB_texture_env_add", F(EXT_texture_env_add) }, 687117f1b4Smrg { OFF, "GL_ARB_texture_env_combine", F(ARB_texture_env_combine) }, 697117f1b4Smrg { OFF, "GL_ARB_texture_env_crossbar", F(ARB_texture_env_crossbar) }, 707117f1b4Smrg { OFF, "GL_ARB_texture_env_dot3", F(ARB_texture_env_dot3) }, 717117f1b4Smrg { OFF, "GL_MESAX_texture_float", F(ARB_texture_float) }, 727117f1b4Smrg { OFF, "GL_ARB_texture_mirrored_repeat", F(ARB_texture_mirrored_repeat)}, 737117f1b4Smrg { OFF, "GL_ARB_texture_non_power_of_two", F(ARB_texture_non_power_of_two)}, 747117f1b4Smrg { OFF, "GL_ARB_texture_rectangle", F(NV_texture_rectangle) }, 757117f1b4Smrg { ON, "GL_ARB_transpose_matrix", F(ARB_transpose_matrix) }, 767117f1b4Smrg { OFF, "GL_ARB_vertex_buffer_object", F(ARB_vertex_buffer_object) }, 777117f1b4Smrg { OFF, "GL_ARB_vertex_program", F(ARB_vertex_program) }, 787117f1b4Smrg { OFF, "GL_ARB_vertex_shader", F(ARB_vertex_shader) }, 797117f1b4Smrg { ON, "GL_ARB_window_pos", F(ARB_window_pos) }, 807117f1b4Smrg { ON, "GL_EXT_abgr", F(EXT_abgr) }, 817117f1b4Smrg { ON, "GL_EXT_bgra", F(EXT_bgra) }, 827117f1b4Smrg { OFF, "GL_EXT_blend_color", F(EXT_blend_color) }, 837117f1b4Smrg { OFF, "GL_EXT_blend_equation_separate", F(EXT_blend_equation_separate) }, 847117f1b4Smrg { OFF, "GL_EXT_blend_func_separate", F(EXT_blend_func_separate) }, 857117f1b4Smrg { OFF, "GL_EXT_blend_logic_op", F(EXT_blend_logic_op) }, 867117f1b4Smrg { OFF, "GL_EXT_blend_minmax", F(EXT_blend_minmax) }, 877117f1b4Smrg { OFF, "GL_EXT_blend_subtract", F(EXT_blend_subtract) }, 887117f1b4Smrg { ON, "GL_EXT_clip_volume_hint", F(EXT_clip_volume_hint) }, 897117f1b4Smrg { OFF, "GL_EXT_cull_vertex", F(EXT_cull_vertex) }, 907117f1b4Smrg { ON, "GL_EXT_compiled_vertex_array", F(EXT_compiled_vertex_array) }, 917117f1b4Smrg { OFF, "GL_EXT_convolution", F(EXT_convolution) }, 927117f1b4Smrg { ON, "GL_EXT_copy_texture", F(EXT_copy_texture) }, 937117f1b4Smrg { OFF, "GL_EXT_depth_bounds_test", F(EXT_depth_bounds_test) }, 947117f1b4Smrg { ON, "GL_EXT_draw_range_elements", F(EXT_draw_range_elements) }, 957117f1b4Smrg { OFF, "GL_EXT_framebuffer_object", F(EXT_framebuffer_object) }, 967117f1b4Smrg { OFF, "GL_EXT_framebuffer_blit", F(EXT_framebuffer_blit) }, 977117f1b4Smrg { OFF, "GL_EXT_fog_coord", F(EXT_fog_coord) }, 987117f1b4Smrg { OFF, "GL_EXT_gpu_program_parameters", F(EXT_gpu_program_parameters) }, 997117f1b4Smrg { OFF, "GL_EXT_histogram", F(EXT_histogram) }, 1007117f1b4Smrg { OFF, "GL_EXT_multi_draw_arrays", F(EXT_multi_draw_arrays) }, 1017117f1b4Smrg { OFF, "GL_EXT_packed_depth_stencil", F(EXT_packed_depth_stencil) }, 1027117f1b4Smrg { ON, "GL_EXT_packed_pixels", F(EXT_packed_pixels) }, 1037117f1b4Smrg { OFF, "GL_EXT_paletted_texture", F(EXT_paletted_texture) }, 1047117f1b4Smrg { OFF, "GL_EXT_pixel_buffer_object", F(EXT_pixel_buffer_object) }, 1057117f1b4Smrg { OFF, "GL_EXT_point_parameters", F(EXT_point_parameters) }, 1067117f1b4Smrg { ON, "GL_EXT_polygon_offset", F(EXT_polygon_offset) }, 1077117f1b4Smrg { ON, "GL_EXT_rescale_normal", F(EXT_rescale_normal) }, 1087117f1b4Smrg { OFF, "GL_EXT_secondary_color", F(EXT_secondary_color) }, 1097117f1b4Smrg { ON, "GL_EXT_separate_specular_color", F(EXT_separate_specular_color) }, 1107117f1b4Smrg { OFF, "GL_EXT_shadow_funcs", F(EXT_shadow_funcs) }, 1117117f1b4Smrg { OFF, "GL_EXT_shared_texture_palette", F(EXT_shared_texture_palette) }, 1127117f1b4Smrg { OFF, "GL_EXT_stencil_two_side", F(EXT_stencil_two_side) }, 1137117f1b4Smrg { OFF, "GL_EXT_stencil_wrap", F(EXT_stencil_wrap) }, 1147117f1b4Smrg { ON, "GL_EXT_subtexture", F(EXT_subtexture) }, 1157117f1b4Smrg { ON, "GL_EXT_texture", F(EXT_texture) }, 1167117f1b4Smrg { ON, "GL_EXT_texture3D", F(EXT_texture3D) }, 1177117f1b4Smrg { OFF, "GL_EXT_texture_compression_s3tc", F(EXT_texture_compression_s3tc) }, 1187117f1b4Smrg { ON, "GL_EXT_texture_edge_clamp", F(SGIS_texture_edge_clamp) }, 1197117f1b4Smrg { OFF, "GL_EXT_texture_env_add", F(EXT_texture_env_add) }, 1207117f1b4Smrg { OFF, "GL_EXT_texture_env_combine", F(EXT_texture_env_combine) }, 1217117f1b4Smrg { OFF, "GL_EXT_texture_env_dot3", F(EXT_texture_env_dot3) }, 1227117f1b4Smrg { OFF, "GL_EXT_texture_filter_anisotropic", F(EXT_texture_filter_anisotropic) }, 1237117f1b4Smrg { OFF, "GL_EXT_texture_lod_bias", F(EXT_texture_lod_bias) }, 1247117f1b4Smrg { OFF, "GL_EXT_texture_mirror_clamp", F(EXT_texture_mirror_clamp) }, 1257117f1b4Smrg { ON, "GL_EXT_texture_object", F(EXT_texture_object) }, 1267117f1b4Smrg { OFF, "GL_EXT_texture_rectangle", F(NV_texture_rectangle) }, 1277117f1b4Smrg { OFF, "GL_EXT_texture_sRGB", F(EXT_texture_sRGB) }, 1287117f1b4Smrg { OFF, "GL_EXT_timer_query", F(EXT_timer_query) }, 1297117f1b4Smrg { ON, "GL_EXT_vertex_array", F(EXT_vertex_array) }, 1307117f1b4Smrg { OFF, "GL_EXT_vertex_array_set", F(EXT_vertex_array_set) }, 1317117f1b4Smrg { OFF, "GL_3DFX_texture_compression_FXT1", F(TDFX_texture_compression_FXT1) }, 1327117f1b4Smrg { OFF, "GL_APPLE_client_storage", F(APPLE_client_storage) }, 1337117f1b4Smrg { ON, "GL_APPLE_packed_pixels", F(APPLE_packed_pixels) }, 1347117f1b4Smrg { OFF, "GL_APPLE_vertex_array_object", F(APPLE_vertex_array_object) }, 1357117f1b4Smrg { OFF, "GL_ATI_blend_equation_separate", F(EXT_blend_equation_separate) }, 1367117f1b4Smrg { OFF, "GL_ATI_texture_env_combine3", F(ATI_texture_env_combine3)}, 1377117f1b4Smrg { OFF, "GL_ATI_texture_mirror_once", F(ATI_texture_mirror_once)}, 1387117f1b4Smrg { OFF, "GL_ATI_fragment_shader", F(ATI_fragment_shader)}, 1397117f1b4Smrg { OFF, "GL_ATI_separate_stencil", F(ATI_separate_stencil)}, 1407117f1b4Smrg { OFF, "GL_IBM_multimode_draw_arrays", F(IBM_multimode_draw_arrays) }, 1417117f1b4Smrg { ON, "GL_IBM_rasterpos_clip", F(IBM_rasterpos_clip) }, 1427117f1b4Smrg { OFF, "GL_IBM_texture_mirrored_repeat", F(ARB_texture_mirrored_repeat)}, 1437117f1b4Smrg { OFF, "GL_INGR_blend_func_separate", F(EXT_blend_func_separate) }, 1447117f1b4Smrg { OFF, "GL_MESA_pack_invert", F(MESA_pack_invert) }, 1457117f1b4Smrg { OFF, "GL_MESA_packed_depth_stencil", F(MESA_packed_depth_stencil) }, 1467117f1b4Smrg { OFF, "GL_MESA_program_debug", F(MESA_program_debug) }, 1477117f1b4Smrg { OFF, "GL_MESA_resize_buffers", F(MESA_resize_buffers) }, 1487117f1b4Smrg { OFF, "GL_MESA_ycbcr_texture", F(MESA_ycbcr_texture) }, 1497117f1b4Smrg { ON, "GL_MESA_window_pos", F(ARB_window_pos) }, 1507117f1b4Smrg { OFF, "GL_NV_blend_square", F(NV_blend_square) }, 1517117f1b4Smrg { OFF, "GL_NV_fragment_program", F(NV_fragment_program) }, 1527117f1b4Smrg { ON, "GL_NV_light_max_exponent", F(NV_light_max_exponent) }, 1537117f1b4Smrg { OFF, "GL_NV_point_sprite", F(NV_point_sprite) }, 1547117f1b4Smrg { OFF, "GL_NV_texture_rectangle", F(NV_texture_rectangle) }, 1557117f1b4Smrg { ON, "GL_NV_texgen_reflection", F(NV_texgen_reflection) }, 1567117f1b4Smrg { OFF, "GL_NV_vertex_program", F(NV_vertex_program) }, 1577117f1b4Smrg { OFF, "GL_NV_vertex_program1_1", F(NV_vertex_program1_1) }, 1587117f1b4Smrg { ON, "GL_OES_read_format", F(OES_read_format) }, 1597117f1b4Smrg { OFF, "GL_SGI_color_matrix", F(SGI_color_matrix) }, 1607117f1b4Smrg { OFF, "GL_SGI_color_table", F(SGI_color_table) }, 1617117f1b4Smrg { OFF, "GL_SGI_texture_color_table", F(SGI_texture_color_table) }, 1627117f1b4Smrg { OFF, "GL_SGIS_generate_mipmap", F(SGIS_generate_mipmap) }, 1637117f1b4Smrg { OFF, "GL_SGIS_texture_border_clamp", F(ARB_texture_border_clamp) }, 1647117f1b4Smrg { ON, "GL_SGIS_texture_edge_clamp", F(SGIS_texture_edge_clamp) }, 1657117f1b4Smrg { ON, "GL_SGIS_texture_lod", F(SGIS_texture_lod) }, 1667117f1b4Smrg { OFF, "GL_SGIX_depth_texture", F(SGIX_depth_texture) }, 1677117f1b4Smrg { OFF, "GL_SGIX_shadow", F(SGIX_shadow) }, 1687117f1b4Smrg { OFF, "GL_SGIX_shadow_ambient", F(SGIX_shadow_ambient) }, 1697117f1b4Smrg { OFF, "GL_SUN_multi_draw_arrays", F(EXT_multi_draw_arrays) }, 1707117f1b4Smrg { OFF, "GL_S3_s3tc", F(S3_s3tc) }, 1717117f1b4Smrg}; 1727117f1b4Smrg 1737117f1b4Smrg 1747117f1b4Smrg 1757117f1b4Smrg/** 1767117f1b4Smrg * Enable all extensions suitable for a software-only renderer. 1777117f1b4Smrg * This is a convenience function used by the XMesa, OSMesa, GGI drivers, etc. 1787117f1b4Smrg */ 1797117f1b4Smrgvoid 1807117f1b4Smrg_mesa_enable_sw_extensions(GLcontext *ctx) 1817117f1b4Smrg{ 1827117f1b4Smrg ctx->Extensions.ARB_depth_texture = GL_TRUE; 1837117f1b4Smrg ctx->Extensions.ARB_draw_buffers = GL_TRUE; 1847117f1b4Smrg#if FEATURE_ARB_fragment_program 1857117f1b4Smrg ctx->Extensions.ARB_fragment_program = GL_TRUE; 1867117f1b4Smrg#endif 1877117f1b4Smrg#if FEATURE_ARB_fragment_shader 1887117f1b4Smrg ctx->Extensions.ARB_fragment_shader = GL_TRUE; 1897117f1b4Smrg#endif 1907117f1b4Smrg ctx->Extensions.ARB_half_float_pixel = GL_TRUE; 1917117f1b4Smrg ctx->Extensions.ARB_imaging = GL_TRUE; 1927117f1b4Smrg ctx->Extensions.ARB_multitexture = GL_TRUE; 1937117f1b4Smrg#if FEATURE_ARB_occlusion_query 1947117f1b4Smrg ctx->Extensions.ARB_occlusion_query = GL_TRUE; 1957117f1b4Smrg#endif 1967117f1b4Smrg ctx->Extensions.ARB_point_sprite = GL_TRUE; 1977117f1b4Smrg#if FEATURE_ARB_shader_objects 1987117f1b4Smrg ctx->Extensions.ARB_shader_objects = GL_TRUE; 1997117f1b4Smrg#endif 2007117f1b4Smrg#if FEATURE_ARB_shading_language_100 2017117f1b4Smrg ctx->Extensions.ARB_shading_language_100 = GL_TRUE; 2027117f1b4Smrg#endif 2037117f1b4Smrg#if FEATURE_ARB_shading_language_120 2047117f1b4Smrg ctx->Extensions.ARB_shading_language_120 = GL_TRUE; 2057117f1b4Smrg#endif 2067117f1b4Smrg ctx->Extensions.ARB_shadow = GL_TRUE; 2077117f1b4Smrg ctx->Extensions.ARB_texture_border_clamp = GL_TRUE; 2087117f1b4Smrg ctx->Extensions.ARB_texture_cube_map = GL_TRUE; 2097117f1b4Smrg ctx->Extensions.ARB_texture_env_combine = GL_TRUE; 2107117f1b4Smrg ctx->Extensions.ARB_texture_env_crossbar = GL_TRUE; 2117117f1b4Smrg ctx->Extensions.ARB_texture_env_dot3 = GL_TRUE; 2127117f1b4Smrg /*ctx->Extensions.ARB_texture_float = GL_TRUE;*/ 2137117f1b4Smrg ctx->Extensions.ARB_texture_mirrored_repeat = GL_TRUE; 2147117f1b4Smrg ctx->Extensions.ARB_texture_non_power_of_two = GL_TRUE; 2157117f1b4Smrg#if FEATURE_ARB_vertex_program 2167117f1b4Smrg ctx->Extensions.ARB_vertex_program = GL_TRUE; 2177117f1b4Smrg#endif 2187117f1b4Smrg#if FEATURE_ARB_vertex_shader 2197117f1b4Smrg ctx->Extensions.ARB_vertex_shader = GL_TRUE; 2207117f1b4Smrg#endif 2217117f1b4Smrg#if FEATURE_ARB_vertex_buffer_object 2227117f1b4Smrg ctx->Extensions.ARB_vertex_buffer_object = GL_TRUE; 2237117f1b4Smrg#endif 2247117f1b4Smrg ctx->Extensions.APPLE_vertex_array_object = GL_TRUE; 2257117f1b4Smrg#if FEATURE_ATI_fragment_shader 2267117f1b4Smrg ctx->Extensions.ATI_fragment_shader = GL_TRUE; 2277117f1b4Smrg#endif 2287117f1b4Smrg ctx->Extensions.ATI_texture_env_combine3 = GL_TRUE; 2297117f1b4Smrg ctx->Extensions.ATI_texture_mirror_once = GL_TRUE; 2307117f1b4Smrg ctx->Extensions.ATI_separate_stencil = GL_TRUE; 2317117f1b4Smrg ctx->Extensions.EXT_blend_color = GL_TRUE; 2327117f1b4Smrg ctx->Extensions.EXT_blend_equation_separate = GL_TRUE; 2337117f1b4Smrg ctx->Extensions.EXT_blend_func_separate = GL_TRUE; 2347117f1b4Smrg ctx->Extensions.EXT_blend_logic_op = GL_TRUE; 2357117f1b4Smrg ctx->Extensions.EXT_blend_minmax = GL_TRUE; 2367117f1b4Smrg ctx->Extensions.EXT_blend_subtract = GL_TRUE; 2377117f1b4Smrg ctx->Extensions.EXT_convolution = GL_TRUE; 2387117f1b4Smrg ctx->Extensions.EXT_depth_bounds_test = GL_TRUE; 2397117f1b4Smrg ctx->Extensions.EXT_fog_coord = GL_TRUE; 2407117f1b4Smrg#if FEATURE_EXT_framebuffer_object 2417117f1b4Smrg ctx->Extensions.EXT_framebuffer_object = GL_TRUE; 2427117f1b4Smrg#endif 2437117f1b4Smrg#if FEATURE_EXT_framebuffer_blit 2447117f1b4Smrg ctx->Extensions.EXT_framebuffer_blit = GL_TRUE; 2457117f1b4Smrg#endif 2467117f1b4Smrg ctx->Extensions.EXT_histogram = GL_TRUE; 2477117f1b4Smrg ctx->Extensions.EXT_multi_draw_arrays = GL_TRUE; 2487117f1b4Smrg ctx->Extensions.EXT_packed_depth_stencil = GL_TRUE; 2497117f1b4Smrg ctx->Extensions.EXT_paletted_texture = GL_TRUE; 2507117f1b4Smrg#if FEATURE_EXT_pixel_buffer_object 2517117f1b4Smrg ctx->Extensions.EXT_pixel_buffer_object = GL_TRUE; 2527117f1b4Smrg#endif 2537117f1b4Smrg ctx->Extensions.EXT_point_parameters = GL_TRUE; 2547117f1b4Smrg ctx->Extensions.EXT_shadow_funcs = GL_TRUE; 2557117f1b4Smrg ctx->Extensions.EXT_secondary_color = GL_TRUE; 2567117f1b4Smrg ctx->Extensions.EXT_shared_texture_palette = GL_TRUE; 2577117f1b4Smrg ctx->Extensions.EXT_stencil_wrap = GL_TRUE; 2587117f1b4Smrg ctx->Extensions.EXT_stencil_two_side = GL_FALSE; /* obsolete */ 2597117f1b4Smrg ctx->Extensions.EXT_texture_env_add = GL_TRUE; 2607117f1b4Smrg ctx->Extensions.EXT_texture_env_combine = GL_TRUE; 2617117f1b4Smrg ctx->Extensions.EXT_texture_env_dot3 = GL_TRUE; 2627117f1b4Smrg ctx->Extensions.EXT_texture_mirror_clamp = GL_TRUE; 2637117f1b4Smrg ctx->Extensions.EXT_texture_lod_bias = GL_TRUE; 2647117f1b4Smrg#if FEATURE_EXT_texture_sRGB 2657117f1b4Smrg ctx->Extensions.EXT_texture_sRGB = GL_TRUE; 2667117f1b4Smrg#endif 2677117f1b4Smrg ctx->Extensions.IBM_multimode_draw_arrays = GL_TRUE; 2687117f1b4Smrg ctx->Extensions.MESA_pack_invert = GL_TRUE; 2697117f1b4Smrg#if FEATURE_MESA_program_debug 2707117f1b4Smrg ctx->Extensions.MESA_program_debug = GL_TRUE; 2717117f1b4Smrg#endif 2727117f1b4Smrg ctx->Extensions.MESA_resize_buffers = GL_TRUE; 2737117f1b4Smrg ctx->Extensions.MESA_ycbcr_texture = GL_TRUE; 2747117f1b4Smrg ctx->Extensions.NV_blend_square = GL_TRUE; 2757117f1b4Smrg /*ctx->Extensions.NV_light_max_exponent = GL_TRUE;*/ 2767117f1b4Smrg ctx->Extensions.NV_point_sprite = GL_TRUE; 2777117f1b4Smrg ctx->Extensions.NV_texture_rectangle = GL_TRUE; 2787117f1b4Smrg /*ctx->Extensions.NV_texgen_reflection = GL_TRUE;*/ 2797117f1b4Smrg#if FEATURE_NV_vertex_program 2807117f1b4Smrg ctx->Extensions.NV_vertex_program = GL_TRUE; 2817117f1b4Smrg ctx->Extensions.NV_vertex_program1_1 = GL_TRUE; 2827117f1b4Smrg#endif 2837117f1b4Smrg#if FEATURE_NV_fragment_program 2847117f1b4Smrg ctx->Extensions.NV_fragment_program = GL_TRUE; 2857117f1b4Smrg#endif 2867117f1b4Smrg ctx->Extensions.SGI_color_matrix = GL_TRUE; 2877117f1b4Smrg ctx->Extensions.SGI_color_table = GL_TRUE; 2887117f1b4Smrg ctx->Extensions.SGI_texture_color_table = GL_TRUE; 2897117f1b4Smrg ctx->Extensions.SGIS_generate_mipmap = GL_TRUE; 2907117f1b4Smrg ctx->Extensions.SGIS_texture_edge_clamp = GL_TRUE; 2917117f1b4Smrg ctx->Extensions.SGIX_depth_texture = GL_TRUE; 2927117f1b4Smrg ctx->Extensions.SGIX_shadow = GL_TRUE; 2937117f1b4Smrg ctx->Extensions.SGIX_shadow_ambient = GL_TRUE; 2947117f1b4Smrg#if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program 2957117f1b4Smrg ctx->Extensions.EXT_gpu_program_parameters = GL_TRUE; 2967117f1b4Smrg#endif 2977117f1b4Smrg} 2987117f1b4Smrg 2997117f1b4Smrg 3007117f1b4Smrg/** 3017117f1b4Smrg * Enable GL_ARB_imaging and all the EXT extensions that are subsets of it. 3027117f1b4Smrg */ 3037117f1b4Smrgvoid 3047117f1b4Smrg_mesa_enable_imaging_extensions(GLcontext *ctx) 3057117f1b4Smrg{ 3067117f1b4Smrg ctx->Extensions.ARB_imaging = GL_TRUE; 3077117f1b4Smrg ctx->Extensions.EXT_blend_color = GL_TRUE; 3087117f1b4Smrg ctx->Extensions.EXT_blend_minmax = GL_TRUE; 3097117f1b4Smrg ctx->Extensions.EXT_blend_subtract = GL_TRUE; 3107117f1b4Smrg ctx->Extensions.EXT_convolution = GL_TRUE; 3117117f1b4Smrg ctx->Extensions.EXT_histogram = GL_TRUE; 3127117f1b4Smrg ctx->Extensions.SGI_color_matrix = GL_TRUE; 3137117f1b4Smrg ctx->Extensions.SGI_color_table = GL_TRUE; 3147117f1b4Smrg} 3157117f1b4Smrg 3167117f1b4Smrg 3177117f1b4Smrg 3187117f1b4Smrg/** 3197117f1b4Smrg * Enable all OpenGL 1.3 features and extensions. 3207117f1b4Smrg * A convenience function to be called by drivers. 3217117f1b4Smrg */ 3227117f1b4Smrgvoid 3237117f1b4Smrg_mesa_enable_1_3_extensions(GLcontext *ctx) 3247117f1b4Smrg{ 3257117f1b4Smrg ctx->Extensions.ARB_multisample = GL_TRUE; 3267117f1b4Smrg ctx->Extensions.ARB_multitexture = GL_TRUE; 3277117f1b4Smrg ctx->Extensions.ARB_texture_border_clamp = GL_TRUE; 3287117f1b4Smrg ctx->Extensions.ARB_texture_compression = GL_TRUE; 3297117f1b4Smrg ctx->Extensions.ARB_texture_cube_map = GL_TRUE; 3307117f1b4Smrg ctx->Extensions.ARB_texture_env_combine = GL_TRUE; 3317117f1b4Smrg ctx->Extensions.ARB_texture_env_dot3 = GL_TRUE; 3327117f1b4Smrg ctx->Extensions.EXT_texture_env_add = GL_TRUE; 3337117f1b4Smrg /*ctx->Extensions.ARB_transpose_matrix = GL_TRUE;*/ 3347117f1b4Smrg} 3357117f1b4Smrg 3367117f1b4Smrg 3377117f1b4Smrg 3387117f1b4Smrg/** 3397117f1b4Smrg * Enable all OpenGL 1.4 features and extensions. 3407117f1b4Smrg * A convenience function to be called by drivers. 3417117f1b4Smrg */ 3427117f1b4Smrgvoid 3437117f1b4Smrg_mesa_enable_1_4_extensions(GLcontext *ctx) 3447117f1b4Smrg{ 3457117f1b4Smrg ctx->Extensions.ARB_depth_texture = GL_TRUE; 3467117f1b4Smrg ctx->Extensions.ARB_shadow = GL_TRUE; 3477117f1b4Smrg ctx->Extensions.ARB_texture_env_crossbar = GL_TRUE; 3487117f1b4Smrg ctx->Extensions.ARB_texture_mirrored_repeat = GL_TRUE; 3497117f1b4Smrg ctx->Extensions.ARB_window_pos = GL_TRUE; 3507117f1b4Smrg ctx->Extensions.EXT_blend_color = GL_TRUE; 3517117f1b4Smrg ctx->Extensions.EXT_blend_func_separate = GL_TRUE; 3527117f1b4Smrg ctx->Extensions.EXT_blend_logic_op = GL_TRUE; 3537117f1b4Smrg ctx->Extensions.EXT_blend_minmax = GL_TRUE; 3547117f1b4Smrg ctx->Extensions.EXT_blend_subtract = GL_TRUE; 3557117f1b4Smrg ctx->Extensions.EXT_fog_coord = GL_TRUE; 3567117f1b4Smrg ctx->Extensions.EXT_multi_draw_arrays = GL_TRUE; 3577117f1b4Smrg ctx->Extensions.EXT_point_parameters = GL_TRUE; 3587117f1b4Smrg ctx->Extensions.EXT_secondary_color = GL_TRUE; 3597117f1b4Smrg ctx->Extensions.EXT_stencil_wrap = GL_TRUE; 3607117f1b4Smrg ctx->Extensions.EXT_texture_lod_bias = GL_TRUE; 3617117f1b4Smrg ctx->Extensions.SGIS_generate_mipmap = GL_TRUE; 3627117f1b4Smrg} 3637117f1b4Smrg 3647117f1b4Smrg 3657117f1b4Smrg/** 3667117f1b4Smrg * Enable all OpenGL 1.5 features and extensions. 3677117f1b4Smrg * A convenience function to be called by drivers. 3687117f1b4Smrg */ 3697117f1b4Smrgvoid 3707117f1b4Smrg_mesa_enable_1_5_extensions(GLcontext *ctx) 3717117f1b4Smrg{ 3727117f1b4Smrg ctx->Extensions.ARB_occlusion_query = GL_TRUE; 3737117f1b4Smrg ctx->Extensions.ARB_vertex_buffer_object = GL_TRUE; 3747117f1b4Smrg ctx->Extensions.EXT_shadow_funcs = GL_TRUE; 3757117f1b4Smrg} 3767117f1b4Smrg 3777117f1b4Smrg 3787117f1b4Smrg/** 3797117f1b4Smrg * Enable all OpenGL 2.0 features and extensions. 3807117f1b4Smrg * A convenience function to be called by drivers. 3817117f1b4Smrg */ 3827117f1b4Smrgvoid 3837117f1b4Smrg_mesa_enable_2_0_extensions(GLcontext *ctx) 3847117f1b4Smrg{ 3857117f1b4Smrg ctx->Extensions.ARB_draw_buffers = GL_TRUE; 3867117f1b4Smrg#if FEATURE_ARB_fragment_shader 3877117f1b4Smrg ctx->Extensions.ARB_fragment_shader = GL_TRUE; 3887117f1b4Smrg#endif 3897117f1b4Smrg ctx->Extensions.ARB_point_sprite = GL_TRUE; 3907117f1b4Smrg ctx->Extensions.ARB_texture_non_power_of_two = GL_TRUE; 3917117f1b4Smrg#if FEATURE_ARB_shader_objects 3927117f1b4Smrg ctx->Extensions.ARB_shader_objects = GL_TRUE; 3937117f1b4Smrg#endif 3947117f1b4Smrg#if FEATURE_ARB_shading_language_100 3957117f1b4Smrg ctx->Extensions.ARB_shading_language_100 = GL_TRUE; 3967117f1b4Smrg#endif 3977117f1b4Smrg ctx->Extensions.EXT_stencil_two_side = GL_FALSE; /* obsolete */ 3987117f1b4Smrg#if FEATURE_ARB_vertex_shader 3997117f1b4Smrg ctx->Extensions.ARB_vertex_shader = GL_TRUE; 4007117f1b4Smrg#endif 4017117f1b4Smrg} 4027117f1b4Smrg 4037117f1b4Smrg 4047117f1b4Smrg/** 4057117f1b4Smrg * Enable all OpenGL 2.1 features and extensions. 4067117f1b4Smrg * A convenience function to be called by drivers. 4077117f1b4Smrg */ 4087117f1b4Smrgvoid 4097117f1b4Smrg_mesa_enable_2_1_extensions(GLcontext *ctx) 4107117f1b4Smrg{ 4117117f1b4Smrg#if FEATURE_EXT_pixel_buffer_object 4127117f1b4Smrg ctx->Extensions.EXT_pixel_buffer_object = GL_TRUE; 4137117f1b4Smrg#endif 4147117f1b4Smrg#if FEATURE_EXT_texture_sRGB 4157117f1b4Smrg ctx->Extensions.EXT_texture_sRGB = GL_TRUE; 4167117f1b4Smrg#endif 4177117f1b4Smrg#ifdef FEATURE_ARB_shading_language_120 4187117f1b4Smrg ctx->Extensions.ARB_shading_language_120 = GL_TRUE; 4197117f1b4Smrg#endif 4207117f1b4Smrg} 4217117f1b4Smrg 4227117f1b4Smrg 4237117f1b4Smrg 4247117f1b4Smrg/** 4257117f1b4Smrg * Either enable or disable the named extension. 4267117f1b4Smrg */ 4277117f1b4Smrgstatic void 4287117f1b4Smrgset_extension( GLcontext *ctx, const char *name, GLboolean state ) 4297117f1b4Smrg{ 4307117f1b4Smrg GLboolean *base = (GLboolean *) &ctx->Extensions; 4317117f1b4Smrg GLuint i; 4327117f1b4Smrg 4337117f1b4Smrg if (ctx->Extensions.String) { 4347117f1b4Smrg /* The string was already queried - can't change it now! */ 4357117f1b4Smrg _mesa_problem(ctx, "Trying to enable/disable extension after glGetString(GL_EXTENSIONS): %s", name); 4367117f1b4Smrg return; 4377117f1b4Smrg } 4387117f1b4Smrg 4397117f1b4Smrg for (i = 0 ; i < Elements(default_extensions) ; i++) { 4407117f1b4Smrg if (_mesa_strcmp(default_extensions[i].name, name) == 0) { 4417117f1b4Smrg if (default_extensions[i].flag_offset) { 4427117f1b4Smrg GLboolean *enabled = base + default_extensions[i].flag_offset; 4437117f1b4Smrg *enabled = state; 4447117f1b4Smrg } 4457117f1b4Smrg return; 4467117f1b4Smrg } 4477117f1b4Smrg } 4487117f1b4Smrg _mesa_problem(ctx, "Trying to enable unknown extension: %s", name); 4497117f1b4Smrg} 4507117f1b4Smrg 4517117f1b4Smrg 4527117f1b4Smrg/** 4537117f1b4Smrg * Enable the named extension. 4547117f1b4Smrg * Typically called by drivers. 4557117f1b4Smrg */ 4567117f1b4Smrgvoid 4577117f1b4Smrg_mesa_enable_extension( GLcontext *ctx, const char *name ) 4587117f1b4Smrg{ 4597117f1b4Smrg set_extension(ctx, name, GL_TRUE); 4607117f1b4Smrg} 4617117f1b4Smrg 4627117f1b4Smrg 4637117f1b4Smrg/** 4647117f1b4Smrg * Disable the named extension. 4657117f1b4Smrg * XXX is this really needed??? 4667117f1b4Smrg */ 4677117f1b4Smrgvoid 4687117f1b4Smrg_mesa_disable_extension( GLcontext *ctx, const char *name ) 4697117f1b4Smrg{ 4707117f1b4Smrg set_extension(ctx, name, GL_FALSE); 4717117f1b4Smrg} 4727117f1b4Smrg 4737117f1b4Smrg 4747117f1b4Smrg/** 4757117f1b4Smrg * Test if the named extension is enabled in this context. 4767117f1b4Smrg */ 4777117f1b4SmrgGLboolean 4787117f1b4Smrg_mesa_extension_is_enabled( GLcontext *ctx, const char *name ) 4797117f1b4Smrg{ 4807117f1b4Smrg const GLboolean *base = (const GLboolean *) &ctx->Extensions; 4817117f1b4Smrg GLuint i; 4827117f1b4Smrg 4837117f1b4Smrg for (i = 0 ; i < Elements(default_extensions) ; i++) { 4847117f1b4Smrg if (_mesa_strcmp(default_extensions[i].name, name) == 0) { 4857117f1b4Smrg if (!default_extensions[i].flag_offset) 4867117f1b4Smrg return GL_TRUE; 4877117f1b4Smrg return *(base + default_extensions[i].flag_offset); 4887117f1b4Smrg } 4897117f1b4Smrg } 4907117f1b4Smrg return GL_FALSE; 4917117f1b4Smrg} 4927117f1b4Smrg 4937117f1b4Smrg 4947117f1b4Smrg/** 4957117f1b4Smrg * Run through the default_extensions array above and set the 4967117f1b4Smrg * ctx->Extensions.ARB/EXT_* flags accordingly. 4977117f1b4Smrg * To be called during context initialization. 4987117f1b4Smrg */ 4997117f1b4Smrgvoid 5007117f1b4Smrg_mesa_init_extensions( GLcontext *ctx ) 5017117f1b4Smrg{ 5027117f1b4Smrg GLboolean *base = (GLboolean *) &ctx->Extensions; 5037117f1b4Smrg GLuint i; 5047117f1b4Smrg 5057117f1b4Smrg for (i = 0 ; i < Elements(default_extensions) ; i++) { 5067117f1b4Smrg if (default_extensions[i].enabled && 5077117f1b4Smrg default_extensions[i].flag_offset) { 5087117f1b4Smrg *(base + default_extensions[i].flag_offset) = GL_TRUE; 5097117f1b4Smrg } 5107117f1b4Smrg } 5117117f1b4Smrg} 5127117f1b4Smrg 5137117f1b4Smrg 5147117f1b4Smrg/** 5157117f1b4Smrg * Construct the GL_EXTENSIONS string. Called the first time that 5167117f1b4Smrg * glGetString(GL_EXTENSIONS) is called. 5177117f1b4Smrg */ 5187117f1b4SmrgGLubyte * 5197117f1b4Smrg_mesa_make_extension_string( GLcontext *ctx ) 5207117f1b4Smrg{ 5217117f1b4Smrg const GLboolean *base = (const GLboolean *) &ctx->Extensions; 5227117f1b4Smrg GLuint extStrLen = 0; 5237117f1b4Smrg GLubyte *s; 5247117f1b4Smrg GLuint i; 5257117f1b4Smrg 5267117f1b4Smrg /* first, compute length of the extension string */ 5277117f1b4Smrg for (i = 0 ; i < Elements(default_extensions) ; i++) { 5287117f1b4Smrg if (!default_extensions[i].flag_offset || 5297117f1b4Smrg *(base + default_extensions[i].flag_offset)) { 5307117f1b4Smrg extStrLen += (GLuint)_mesa_strlen(default_extensions[i].name) + 1; 5317117f1b4Smrg } 5327117f1b4Smrg } 5337117f1b4Smrg s = (GLubyte *) _mesa_malloc(extStrLen); 5347117f1b4Smrg 5357117f1b4Smrg /* second, build the extension string */ 5367117f1b4Smrg extStrLen = 0; 5377117f1b4Smrg for (i = 0 ; i < Elements(default_extensions) ; i++) { 5387117f1b4Smrg if (!default_extensions[i].flag_offset || 5397117f1b4Smrg *(base + default_extensions[i].flag_offset)) { 5407117f1b4Smrg GLuint len = (GLuint)_mesa_strlen(default_extensions[i].name); 5417117f1b4Smrg _mesa_memcpy(s + extStrLen, default_extensions[i].name, len); 5427117f1b4Smrg extStrLen += len; 5437117f1b4Smrg s[extStrLen] = (GLubyte) ' '; 5447117f1b4Smrg extStrLen++; 5457117f1b4Smrg } 5467117f1b4Smrg } 5477117f1b4Smrg ASSERT(extStrLen > 0); 5487117f1b4Smrg 5497117f1b4Smrg s[extStrLen - 1] = 0; 5507117f1b4Smrg 5517117f1b4Smrg return s; 5527117f1b4Smrg} 553