X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fmain%2Fextensions.c;h=73be24d80cf5666102bf2641e374894662395ace;hb=43867acb6afc7fad26cdc2f22b2a3bb6eeefb2da;hp=2ad66de7dd137e2668d7b9600b1997d1030c259c;hpb=41bbc8395111c6ef37e08a63ee58876d10a09e77;p=mesa.git diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c index 2ad66de7dd1..73be24d80cf 100644 --- a/src/mesa/main/extensions.c +++ b/src/mesa/main/extensions.c @@ -50,11 +50,13 @@ static const struct { { OFF, "GL_ARB_depth_clamp", F(ARB_depth_clamp) }, { 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_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_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_map_buffer_range", F(ARB_map_buffer_range) }, { ON, "GL_ARB_multisample", F(ARB_multisample) }, @@ -63,6 +65,7 @@ static const struct { { 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_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) }, @@ -102,9 +105,11 @@ static const struct { { OFF, "GL_EXT_convolution", F(EXT_convolution) }, { 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) }, { ON, "GL_EXT_draw_range_elements", F(EXT_draw_range_elements) }, - { OFF, "GL_EXT_framebuffer_object", F(EXT_framebuffer_object) }, { 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_fog_coord", F(EXT_fog_coord) }, { OFF, "GL_EXT_gpu_program_parameters", F(EXT_gpu_program_parameters) }, { OFF, "GL_EXT_histogram", F(EXT_histogram) }, @@ -164,9 +169,12 @@ static const struct { { OFF, "GL_MESA_ycbcr_texture", F(MESA_ycbcr_texture) }, { ON, "GL_MESA_window_pos", F(ARB_window_pos) }, { OFF, "GL_NV_blend_square", F(NV_blend_square) }, + { OFF, "GL_NV_conditional_render", F(NV_conditional_render) }, { OFF, "GL_NV_depth_clamp", F(ARB_depth_clamp) }, { OFF, "GL_NV_fragment_program", F(NV_fragment_program) }, + { OFF, "GL_NV_fragment_program_option", F(NV_fragment_program_option) }, { 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_texture_env_combine4", F(NV_texture_env_combine4) }, { OFF, "GL_NV_texture_rectangle", F(NV_texture_rectangle) }, @@ -183,6 +191,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_draw_texture + { OFF, "GL_OES_draw_texture", F(OES_draw_texture) }, +#endif /* FEATURE_OES_draw_texture */ }; @@ -210,10 +221,11 @@ _mesa_enable_sw_extensions(GLcontext *ctx) ctx->Extensions.ARB_framebuffer_object = 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; ctx->Extensions.ARB_map_buffer_range = GL_TRUE; ctx->Extensions.ARB_multitexture = GL_TRUE; -#if FEATURE_ARB_occlusion_query +#if FEATURE_queryobj ctx->Extensions.ARB_occlusion_query = GL_TRUE; #endif ctx->Extensions.ARB_point_sprite = GL_TRUE; @@ -265,12 +277,16 @@ _mesa_enable_sw_extensions(GLcontext *ctx) ctx->Extensions.EXT_blend_subtract = GL_TRUE; ctx->Extensions.EXT_convolution = GL_TRUE; ctx->Extensions.EXT_depth_bounds_test = GL_TRUE; + ctx->Extensions.EXT_draw_buffers2 = GL_TRUE; ctx->Extensions.EXT_fog_coord = GL_TRUE; #if FEATURE_EXT_framebuffer_object ctx->Extensions.EXT_framebuffer_object = GL_TRUE; #endif #if FEATURE_EXT_framebuffer_blit ctx->Extensions.EXT_framebuffer_blit = GL_TRUE; +#endif +#if FEATURE_ARB_framebuffer_object + ctx->Extensions.EXT_framebuffer_multisample = GL_TRUE; #endif ctx->Extensions.EXT_histogram = GL_TRUE; /*ctx->Extensions.EXT_multi_draw_arrays = GL_TRUE;*/ @@ -302,6 +318,7 @@ _mesa_enable_sw_extensions(GLcontext *ctx) ctx->Extensions.MESA_texture_array = GL_TRUE; ctx->Extensions.MESA_ycbcr_texture = GL_TRUE; ctx->Extensions.NV_blend_square = GL_TRUE; + ctx->Extensions.NV_conditional_render = GL_TRUE; /*ctx->Extensions.NV_light_max_exponent = GL_TRUE;*/ ctx->Extensions.NV_point_sprite = GL_TRUE; ctx->Extensions.NV_texture_env_combine4 = GL_TRUE; @@ -313,6 +330,9 @@ _mesa_enable_sw_extensions(GLcontext *ctx) #endif #if FEATURE_NV_fragment_program ctx->Extensions.NV_fragment_program = GL_TRUE; +#endif +#if FEATURE_NV_fragment_program && FEATURE_ARB_fragment_program + ctx->Extensions.NV_fragment_program_option = GL_TRUE; #endif ctx->Extensions.SGI_color_matrix = GL_TRUE; ctx->Extensions.SGI_color_table = GL_TRUE; @@ -512,20 +532,34 @@ _mesa_disable_extension( GLcontext *ctx, const char *name ) } +/** + * Check if the i-th extension is enabled. + */ +static GLboolean +extension_enabled(GLcontext *ctx, GLuint index) +{ + const GLboolean *base = (const GLboolean *) &ctx->Extensions; + if (!default_extensions[index].flag_offset || + *(base + default_extensions[index].flag_offset)) { + return GL_TRUE; + } + else { + return GL_FALSE; + } +} + + /** * Test if the named extension is enabled in this context. */ GLboolean _mesa_extension_is_enabled( GLcontext *ctx, const char *name ) { - const GLboolean *base = (const GLboolean *) &ctx->Extensions; GLuint i; for (i = 0 ; i < Elements(default_extensions) ; i++) { if (_mesa_strcmp(default_extensions[i].name, name) == 0) { - if (!default_extensions[i].flag_offset) - return GL_TRUE; - return *(base + default_extensions[i].flag_offset); + return extension_enabled(ctx, i); } } return GL_FALSE; @@ -633,7 +667,6 @@ _mesa_init_extensions( GLcontext *ctx ) GLubyte * _mesa_make_extension_string( GLcontext *ctx ) { - const GLboolean *base = (const GLboolean *) &ctx->Extensions; const char *extraExt = get_extension_override(ctx); GLuint extStrLen = 0; char *s; @@ -641,8 +674,7 @@ _mesa_make_extension_string( GLcontext *ctx ) /* first, compute length of the extension string */ for (i = 0 ; i < Elements(default_extensions) ; i++) { - if (!default_extensions[i].flag_offset || - *(base + default_extensions[i].flag_offset)) { + if (extension_enabled(ctx, i)) { extStrLen += (GLuint)_mesa_strlen(default_extensions[i].name) + 1; } } @@ -658,8 +690,7 @@ _mesa_make_extension_string( GLcontext *ctx ) /* second, build the extension string */ extStrLen = 0; for (i = 0 ; i < Elements(default_extensions) ; i++) { - if (!default_extensions[i].flag_offset || - *(base + default_extensions[i].flag_offset)) { + if (extension_enabled(ctx, i)) { GLuint len = (GLuint)_mesa_strlen(default_extensions[i].name); _mesa_memcpy(s + extStrLen, default_extensions[i].name, len); extStrLen += len; @@ -678,3 +709,48 @@ _mesa_make_extension_string( GLcontext *ctx ) return (GLubyte *) s; } + + +/** + * Return number of enabled extensions. + */ +GLuint +_mesa_get_extension_count(GLcontext *ctx) +{ + GLuint i; + + /* only count once */ + if (!ctx->Extensions.Count) { + for (i = 0; i < Elements(default_extensions); i++) { + if (extension_enabled(ctx, i)) { + ctx->Extensions.Count++; + } + } + } + + if (0) + _mesa_debug(ctx, "%u of %d extensions enabled\n", ctx->Extensions.Count, + Elements(default_extensions)); + + return ctx->Extensions.Count; +} + + +/** + * Return name of i-th enabled extension + */ +const GLubyte * +_mesa_get_enabled_extension(GLcontext *ctx, GLuint index) +{ + GLuint i; + + for (i = 0; i < Elements(default_extensions); i++) { + if (extension_enabled(ctx, i)) { + if (index == 0) + return (const GLubyte *) default_extensions[i].name; + index--; + } + } + + return NULL; +}