diff options
author | marha <marha@users.sourceforge.net> | 2010-11-29 22:05:53 +0000 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2010-11-29 22:05:53 +0000 |
commit | fed109d6a33c0871291d1bb2f3f6b7a3d1a3e9d7 (patch) | |
tree | fa1ba494685a71e28a096990a8707680c7cb378b /mesalib/src/mesa/main/extensions.c | |
parent | ae340911c1ba1f98b418bd8f1a487fa4d79491b0 (diff) | |
parent | 6fda93be42ace9eeab0e82ceebb6798961c9105c (diff) | |
download | vcxsrv-fed109d6a33c0871291d1bb2f3f6b7a3d1a3e9d7.tar.gz vcxsrv-fed109d6a33c0871291d1bb2f3f6b7a3d1a3e9d7.tar.bz2 vcxsrv-fed109d6a33c0871291d1bb2f3f6b7a3d1a3e9d7.zip |
svn merge ^/branches/released .
Diffstat (limited to 'mesalib/src/mesa/main/extensions.c')
-rw-r--r-- | mesalib/src/mesa/main/extensions.c | 253 |
1 files changed, 239 insertions, 14 deletions
diff --git a/mesalib/src/mesa/main/extensions.c b/mesalib/src/mesa/main/extensions.c index 30245d6aa..080fa98df 100644 --- a/mesalib/src/mesa/main/extensions.c +++ b/mesalib/src/mesa/main/extensions.c @@ -28,7 +28,6 @@ #include "imports.h" #include "context.h" #include "extensions.h" -#include "simple_list.h" #include "mtypes.h" @@ -45,35 +44,44 @@ static const struct { const char *name; int flag_offset; } default_extensions[] = { + { OFF, "GL_ARB_blend_func_extended", F(ARB_blend_func_extended) }, { OFF, "GL_ARB_copy_buffer", F(ARB_copy_buffer) }, - { OFF, "GL_ARB_depth_texture", F(ARB_depth_texture) }, + { OFF, "GL_ARB_depth_buffer_float", F(ARB_depth_buffer_float) }, { OFF, "GL_ARB_depth_clamp", F(ARB_depth_clamp) }, + { OFF, "GL_ARB_depth_texture", F(ARB_depth_texture) }, { ON, "GL_ARB_draw_buffers", F(ARB_draw_buffers) }, { OFF, "GL_ARB_draw_elements_base_vertex", F(ARB_draw_elements_base_vertex) }, + { OFF, "GL_ARB_draw_instanced", F(ARB_draw_instanced) }, { OFF, "GL_ARB_fragment_coord_conventions", F(ARB_fragment_coord_conventions) }, { OFF, "GL_ARB_fragment_program", F(ARB_fragment_program) }, { OFF, "GL_ARB_fragment_program_shadow", F(ARB_fragment_program_shadow) }, { OFF, "GL_ARB_fragment_shader", F(ARB_fragment_shader) }, { OFF, "GL_ARB_framebuffer_object", F(ARB_framebuffer_object) }, + { OFF, "GL_ARB_explicit_attrib_location", F(ARB_explicit_attrib_location) }, + /* TODO: reenable this when the new GLSL compiler actually supports them */ + /* { OFF, "GL_ARB_geometry_shader4", F(ARB_geometry_shader4) }, */ { OFF, "GL_ARB_half_float_pixel", F(ARB_half_float_pixel) }, { OFF, "GL_ARB_half_float_vertex", F(ARB_half_float_vertex) }, { OFF, "GL_ARB_imaging", F(ARB_imaging) }, + { OFF, "GL_ARB_instanced_arrays", F(ARB_instanced_arrays) }, { OFF, "GL_ARB_map_buffer_range", F(ARB_map_buffer_range) }, { ON, "GL_ARB_multisample", F(ARB_multisample) }, { OFF, "GL_ARB_multitexture", F(ARB_multitexture) }, { OFF, "GL_ARB_occlusion_query", F(ARB_occlusion_query) }, + { OFF, "GL_ARB_occlusion_query2", F(ARB_occlusion_query2) }, { OFF, "GL_ARB_pixel_buffer_object", F(EXT_pixel_buffer_object) }, { OFF, "GL_ARB_point_parameters", F(EXT_point_parameters) }, { OFF, "GL_ARB_point_sprite", F(ARB_point_sprite) }, { OFF, "GL_ARB_provoking_vertex", F(EXT_provoking_vertex) }, + { OFF, "GL_ARB_sampler_objects", F(ARB_sampler_objects) }, { OFF, "GL_ARB_seamless_cube_map", F(ARB_seamless_cube_map) }, { OFF, "GL_ARB_shader_objects", F(ARB_shader_objects) }, { OFF, "GL_ARB_shading_language_100", F(ARB_shading_language_100) }, - { OFF, "GL_ARB_shading_language_120", F(ARB_shading_language_120) }, { OFF, "GL_ARB_shadow", F(ARB_shadow) }, { OFF, "GL_ARB_shadow_ambient", F(ARB_shadow_ambient) }, { OFF, "GL_ARB_sync", F(ARB_sync) }, { OFF, "GL_ARB_texture_border_clamp", F(ARB_texture_border_clamp) }, + { OFF, "GL_ARB_texture_buffer_object", F(ARB_texture_buffer_object) }, { ON, "GL_ARB_texture_compression", F(ARB_texture_compression) }, { OFF, "GL_ARB_texture_cube_map", F(ARB_texture_cube_map) }, { OFF, "GL_ARB_texture_env_add", F(EXT_texture_env_add) }, @@ -82,14 +90,21 @@ static const struct { { OFF, "GL_ARB_texture_env_dot3", F(ARB_texture_env_dot3) }, { OFF, "GL_MESAX_texture_float", F(ARB_texture_float) }, { OFF, "GL_ARB_texture_mirrored_repeat", F(ARB_texture_mirrored_repeat)}, + { OFF, "GL_ARB_texture_multisample", F(ARB_texture_multisample) }, { OFF, "GL_ARB_texture_non_power_of_two", F(ARB_texture_non_power_of_two)}, { OFF, "GL_ARB_texture_rectangle", F(NV_texture_rectangle) }, + { OFF, "GL_ARB_texture_rg", F(ARB_texture_rg) }, + { OFF, "GL_ARB_texture_rgb10_a2ui", F(ARB_texture_rgb10_a2ui) }, + { OFF, "GL_ARB_texture_swizzle", F(EXT_texture_swizzle) }, { ON, "GL_ARB_transpose_matrix", F(ARB_transpose_matrix) }, + { OFF, "GL_ARB_transform_feedback2", F(ARB_transform_feedback2) }, + { OFF, "GL_ARB_uniform_buffer_object", F(ARB_uniform_buffer_object) }, { OFF, "GL_ARB_vertex_array_bgra", F(EXT_vertex_array_bgra) }, { OFF, "GL_ARB_vertex_array_object", F(ARB_vertex_array_object) }, { ON, "GL_ARB_vertex_buffer_object", F(ARB_vertex_buffer_object) }, { OFF, "GL_ARB_vertex_program", F(ARB_vertex_program) }, { OFF, "GL_ARB_vertex_shader", F(ARB_vertex_shader) }, + { OFF, "GL_ARB_vertex_type_2_10_10_10_rev", F(ARB_vertex_type_2_10_10_10_rev) }, { ON, "GL_ARB_window_pos", F(ARB_window_pos) }, { ON, "GL_EXT_abgr", F(EXT_abgr) }, { ON, "GL_EXT_bgra", F(EXT_bgra) }, @@ -106,15 +121,18 @@ static const struct { { ON, "GL_EXT_copy_texture", F(EXT_copy_texture) }, { OFF, "GL_EXT_depth_bounds_test", F(EXT_depth_bounds_test) }, { OFF, "GL_EXT_draw_buffers2", F(EXT_draw_buffers2) }, + { OFF, "GL_EXT_draw_instanced", F(ARB_draw_instanced) }, { ON, "GL_EXT_draw_range_elements", F(EXT_draw_range_elements) }, { OFF, "GL_EXT_framebuffer_blit", F(EXT_framebuffer_blit) }, { OFF, "GL_EXT_framebuffer_multisample", F(EXT_framebuffer_multisample) }, { OFF, "GL_EXT_framebuffer_object", F(EXT_framebuffer_object) }, + { OFF, "GL_EXT_framebuffer_sRGB", F(EXT_framebuffer_sRGB) }, { OFF, "GL_EXT_fog_coord", F(EXT_fog_coord) }, { OFF, "GL_EXT_gpu_program_parameters", F(EXT_gpu_program_parameters) }, { OFF, "GL_EXT_histogram", F(EXT_histogram) }, { ON, "GL_EXT_multi_draw_arrays", F(EXT_multi_draw_arrays) }, { OFF, "GL_EXT_packed_depth_stencil", F(EXT_packed_depth_stencil) }, + { OFF, "GL_EXT_packed_float", F(EXT_packed_float) }, { ON, "GL_EXT_packed_pixels", F(EXT_packed_pixels) }, { OFF, "GL_EXT_paletted_texture", F(EXT_paletted_texture) }, { OFF, "GL_EXT_pixel_buffer_object", F(EXT_pixel_buffer_object) }, @@ -133,19 +151,23 @@ static const struct { { ON, "GL_EXT_texture3D", F(EXT_texture3D) }, { OFF, "GL_EXT_texture_array", F(EXT_texture_array) }, { OFF, "GL_EXT_texture_compression_s3tc", F(EXT_texture_compression_s3tc) }, + { OFF, "GL_EXT_texture_compression_rgtc", F(EXT_texture_compression_rgtc) }, { OFF, "GL_EXT_texture_cube_map", F(ARB_texture_cube_map) }, { ON, "GL_EXT_texture_edge_clamp", F(SGIS_texture_edge_clamp) }, { OFF, "GL_EXT_texture_env_add", F(EXT_texture_env_add) }, { OFF, "GL_EXT_texture_env_combine", F(EXT_texture_env_combine) }, { OFF, "GL_EXT_texture_env_dot3", F(EXT_texture_env_dot3) }, { OFF, "GL_EXT_texture_filter_anisotropic", F(EXT_texture_filter_anisotropic) }, + { OFF, "GL_EXT_texture_integer", F(EXT_texture_integer) }, { OFF, "GL_EXT_texture_lod_bias", F(EXT_texture_lod_bias) }, { OFF, "GL_EXT_texture_mirror_clamp", F(EXT_texture_mirror_clamp) }, { ON, "GL_EXT_texture_object", F(EXT_texture_object) }, { OFF, "GL_EXT_texture_rectangle", F(NV_texture_rectangle) }, + { OFF, "GL_EXT_texture_shared_exponent", F(EXT_texture_shared_exponent) }, { OFF, "GL_EXT_texture_sRGB", F(EXT_texture_sRGB) }, { OFF, "GL_EXT_texture_swizzle", F(EXT_texture_swizzle) }, { OFF, "GL_EXT_timer_query", F(EXT_timer_query) }, + { OFF, "GL_EXT_transform_feedback", F(EXT_transform_feedback) }, { ON, "GL_EXT_vertex_array", F(EXT_vertex_array) }, { OFF, "GL_EXT_vertex_array_bgra", F(EXT_vertex_array_bgra) }, { OFF, "GL_EXT_vertex_array_set", F(EXT_vertex_array_set) }, @@ -179,9 +201,10 @@ static const struct { { ON, "GL_NV_light_max_exponent", F(NV_light_max_exponent) }, { OFF, "GL_NV_packed_depth_stencil", F(EXT_packed_depth_stencil) }, { OFF, "GL_NV_point_sprite", F(NV_point_sprite) }, + { OFF, "GL_NV_primitive_restart", F(NV_primitive_restart) }, + { ON, "GL_NV_texgen_reflection", F(NV_texgen_reflection) }, { OFF, "GL_NV_texture_env_combine4", F(NV_texture_env_combine4) }, { OFF, "GL_NV_texture_rectangle", F(NV_texture_rectangle) }, - { ON, "GL_NV_texgen_reflection", F(NV_texgen_reflection) }, { OFF, "GL_NV_vertex_program", F(NV_vertex_program) }, { OFF, "GL_NV_vertex_program1_1", F(NV_vertex_program1_1) }, { ON, "GL_OES_read_format", F(OES_read_format) }, @@ -194,6 +217,9 @@ static const struct { { ON, "GL_SGIS_texture_lod", F(SGIS_texture_lod) }, { ON, "GL_SUN_multi_draw_arrays", F(EXT_multi_draw_arrays) }, { OFF, "GL_S3_s3tc", F(S3_s3tc) }, +#if FEATURE_OES_EGL_image + { OFF, "GL_OES_EGL_image", F(OES_EGL_image) }, +#endif #if FEATURE_OES_draw_texture { OFF, "GL_OES_draw_texture", F(OES_draw_texture) }, #endif /* FEATURE_OES_draw_texture */ @@ -224,6 +250,9 @@ _mesa_enable_sw_extensions(GLcontext *ctx) #if FEATURE_ARB_framebuffer_object ctx->Extensions.ARB_framebuffer_object = GL_TRUE; #endif +#if FEATURE_ARB_geometry_shader4 + ctx->Extensions.ARB_geometry_shader4 = GL_TRUE; +#endif ctx->Extensions.ARB_half_float_pixel = GL_TRUE; ctx->Extensions.ARB_half_float_vertex = GL_TRUE; ctx->Extensions.ARB_imaging = GL_TRUE; @@ -239,9 +268,6 @@ _mesa_enable_sw_extensions(GLcontext *ctx) #if FEATURE_ARB_shading_language_100 ctx->Extensions.ARB_shading_language_100 = GL_TRUE; #endif -#if FEATURE_ARB_shading_language_120 - ctx->Extensions.ARB_shading_language_120 = GL_TRUE; -#endif ctx->Extensions.ARB_shadow = GL_TRUE; ctx->Extensions.ARB_shadow_ambient = GL_TRUE; ctx->Extensions.ARB_texture_border_clamp = GL_TRUE; @@ -319,6 +345,9 @@ _mesa_enable_sw_extensions(GLcontext *ctx) ctx->Extensions.EXT_texture_sRGB = GL_TRUE; #endif ctx->Extensions.EXT_texture_swizzle = GL_TRUE; +#if FEATURE_EXT_transform_feedback + /*ctx->Extensions.EXT_transform_feedback = GL_TRUE;*/ +#endif ctx->Extensions.EXT_vertex_array_bgra = GL_TRUE; /*ctx->Extensions.IBM_multimode_draw_arrays = GL_TRUE;*/ ctx->Extensions.MESA_pack_invert = GL_TRUE; @@ -480,13 +509,9 @@ _mesa_enable_2_1_extensions(GLcontext *ctx) #if FEATURE_EXT_texture_sRGB ctx->Extensions.EXT_texture_sRGB = GL_TRUE; #endif -#ifdef FEATURE_ARB_shading_language_120 - ctx->Extensions.ARB_shading_language_120 = GL_TRUE; -#endif } - /** * Either enable or disable the named extension. * \return GL_TRUE for success, GL_FALSE if invalid extension name @@ -672,8 +697,8 @@ _mesa_init_extensions( GLcontext *ctx ) * Construct the GL_EXTENSIONS string. Called the first time that * glGetString(GL_EXTENSIONS) is called. */ -GLubyte * -_mesa_make_extension_string( GLcontext *ctx ) +static GLubyte * +compute_extensions( GLcontext *ctx ) { const char *extraExt = get_extension_override(ctx); GLuint extStrLen = 0; @@ -718,6 +743,206 @@ _mesa_make_extension_string( GLcontext *ctx ) return (GLubyte *) s; } +static size_t +append_extension(GLubyte **str, const char *ext) +{ + GLubyte *s = *str; + size_t len = strlen(ext); + + if (s) { + memcpy(s, ext, len); + s[len++] = ' '; + s[len] = '\0'; + + *str += len; + } + else { + len++; + } + + return len; +} + + +static size_t +make_extension_string_es1(const GLcontext *ctx, GLubyte *str) +{ + size_t len = 0; + + /* Core additions */ + len += append_extension(&str, "GL_OES_byte_coordinates"); + len += append_extension(&str, "GL_OES_fixed_point"); + len += append_extension(&str, "GL_OES_single_precision"); + len += append_extension(&str, "GL_OES_matrix_get"); + + /* 1.1 required extensions */ + len += append_extension(&str, "GL_OES_read_format"); + len += append_extension(&str, "GL_OES_compressed_paletted_texture"); + len += append_extension(&str, "GL_OES_point_size_array"); + len += append_extension(&str, "GL_OES_point_sprite"); + + /* 1.1 deprecated extensions */ + len += append_extension(&str, "GL_OES_query_matrix"); + +#if FEATURE_OES_draw_texture + if (ctx->Extensions.OES_draw_texture) + len += append_extension(&str, "GL_OES_draw_texture"); +#endif + + if (ctx->Extensions.EXT_blend_equation_separate) + len += append_extension(&str, "GL_OES_blend_equation_separate"); + if (ctx->Extensions.EXT_blend_func_separate) + len += append_extension(&str, "GL_OES_blend_func_separate"); + if (ctx->Extensions.EXT_blend_subtract) + len += append_extension(&str, "GL_OES_blend_subtract"); + + if (ctx->Extensions.EXT_stencil_wrap) + len += append_extension(&str, "GL_OES_stencil_wrap"); + + if (ctx->Extensions.ARB_texture_cube_map) + len += append_extension(&str, "GL_OES_texture_cube_map"); + if (ctx->Extensions.ARB_texture_env_crossbar) + len += append_extension(&str, "GL_OES_texture_env_crossbar"); + if (ctx->Extensions.ARB_texture_mirrored_repeat) + len += append_extension(&str, "GL_OES_texture_mirrored_repeat"); + + if (ctx->Extensions.ARB_framebuffer_object) { + len += append_extension(&str, "GL_OES_framebuffer_object"); + len += append_extension(&str, "GL_OES_depth24"); + len += append_extension(&str, "GL_OES_depth32"); + len += append_extension(&str, "GL_OES_fbo_render_mipmap"); + len += append_extension(&str, "GL_OES_rgb8_rgba8"); + len += append_extension(&str, "GL_OES_stencil1"); + len += append_extension(&str, "GL_OES_stencil4"); + len += append_extension(&str, "GL_OES_stencil8"); + } + + if (ctx->Extensions.EXT_vertex_array) + len += append_extension(&str, "GL_OES_element_index_uint"); + if (ctx->Extensions.ARB_vertex_buffer_object) + len += append_extension(&str, "GL_OES_mapbuffer"); + if (ctx->Extensions.EXT_texture_filter_anisotropic) + len += append_extension(&str, "GL_EXT_texture_filter_anisotropic"); + + /* some applications check this for NPOT support */ + if (ctx->Extensions.ARB_texture_non_power_of_two) + len += append_extension(&str, "GL_ARB_texture_non_power_of_two"); + + if (ctx->Extensions.EXT_texture_compression_s3tc) + len += append_extension(&str, "GL_EXT_texture_compression_dxt1"); + if (ctx->Extensions.EXT_texture_lod_bias) + len += append_extension(&str, "GL_EXT_texture_lod_bias"); + if (ctx->Extensions.EXT_blend_minmax) + len += append_extension(&str, "GL_EXT_blend_minmax"); + if (ctx->Extensions.EXT_multi_draw_arrays) + len += append_extension(&str, "GL_EXT_multi_draw_arrays"); + +#if FEATURE_OES_EGL_image + if (ctx->Extensions.OES_EGL_image) + len += append_extension(&str, "GL_OES_EGL_image"); +#endif + + return len; +} + + +static GLubyte * +compute_extensions_es1(const GLcontext *ctx) +{ + GLubyte *s; + unsigned int len; + + len = make_extension_string_es1(ctx, NULL); + s = malloc(len + 1); + if (!s) + return NULL; + make_extension_string_es1(ctx, s); + + return s; +} + +static size_t +make_extension_string_es2(const GLcontext *ctx, GLubyte *str) +{ + size_t len = 0; + + len += append_extension(&str, "GL_OES_compressed_paletted_texture"); + + if (ctx->Extensions.ARB_framebuffer_object) { + len += append_extension(&str, "GL_OES_depth24"); + len += append_extension(&str, "GL_OES_depth32"); + len += append_extension(&str, "GL_OES_fbo_render_mipmap"); + len += append_extension(&str, "GL_OES_rgb8_rgba8"); + len += append_extension(&str, "GL_OES_stencil1"); + len += append_extension(&str, "GL_OES_stencil4"); + } + + if (ctx->Extensions.EXT_vertex_array) + len += append_extension(&str, "GL_OES_element_index_uint"); + if (ctx->Extensions.ARB_vertex_buffer_object) + len += append_extension(&str, "GL_OES_mapbuffer"); + + if (ctx->Extensions.EXT_texture3D) + len += append_extension(&str, "GL_OES_texture_3D"); + if (ctx->Extensions.ARB_texture_non_power_of_two) + len += append_extension(&str, "GL_OES_texture_npot"); + if (ctx->Extensions.EXT_texture_filter_anisotropic) + len += append_extension(&str, "GL_EXT_texture_filter_anisotropic"); + + len += append_extension(&str, "GL_EXT_texture_type_2_10_10_10_REV"); + if (ctx->Extensions.ARB_depth_texture) + len += append_extension(&str, "GL_OES_depth_texture"); + if (ctx->Extensions.EXT_packed_depth_stencil) + len += append_extension(&str, "GL_OES_packed_depth_stencil"); + if (ctx->Extensions.ARB_fragment_shader) + len += append_extension(&str, "GL_OES_standard_derivatives"); + + if (ctx->Extensions.EXT_texture_compression_s3tc) + len += append_extension(&str, "GL_EXT_texture_compression_dxt1"); + if (ctx->Extensions.EXT_blend_minmax) + len += append_extension(&str, "GL_EXT_blend_minmax"); + if (ctx->Extensions.EXT_multi_draw_arrays) + len += append_extension(&str, "GL_EXT_multi_draw_arrays"); + +#if FEATURE_OES_EGL_image + if (ctx->Extensions.OES_EGL_image) + len += append_extension(&str, "GL_OES_EGL_image"); +#endif + + return len; +} + +static GLubyte * +compute_extensions_es2(GLcontext *ctx) +{ + GLubyte *s; + unsigned int len; + + len = make_extension_string_es2(ctx, NULL); + s = malloc(len + 1); + if (!s) + return NULL; + make_extension_string_es2(ctx, s); + + return s; +} + + +GLubyte * +_mesa_make_extension_string(GLcontext *ctx) +{ + switch (ctx->API) { + case API_OPENGL: + return compute_extensions(ctx); + case API_OPENGLES2: + return compute_extensions_es2(ctx); + case API_OPENGLES: + return compute_extensions_es1(ctx); + default: + assert(0); + return NULL; + } +} /** * Return number of enabled extensions. @@ -738,7 +963,7 @@ _mesa_get_extension_count(GLcontext *ctx) if (0) _mesa_debug(ctx, "%u of %d extensions enabled\n", ctx->Extensions.Count, - Elements(default_extensions)); + (int) Elements(default_extensions)); return ctx->Extensions.Count; } |