diff options
author | Kristian Høgsberg <[email protected]> | 2010-04-22 08:27:51 -0400 |
---|---|---|
committer | Kristian Høgsberg <[email protected]> | 2010-04-22 12:42:23 -0400 |
commit | 18f7e118a5c6dfc04502e6e91ae492bfa33d3cc9 (patch) | |
tree | 57d58367168432ae4cd60bc7994ea25eba78d6c6 /src/mesa/main | |
parent | 04bf868ad9f0034ce7b726eadd2ffac346441a68 (diff) |
es2: Move over es2 code to compute extensions
Diffstat (limited to 'src/mesa/main')
-rw-r--r-- | src/mesa/main/extensions.c | 109 |
1 files changed, 106 insertions, 3 deletions
diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c index 208069c1db5..30a51abbe7e 100644 --- a/src/mesa/main/extensions.c +++ b/src/mesa/main/extensions.c @@ -495,7 +495,6 @@ _mesa_enable_2_1_extensions(GLcontext *ctx) } - /** * Either enable or disable the named extension. * \return GL_TRUE for success, GL_FALSE if invalid extension name @@ -681,8 +680,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; @@ -727,6 +726,110 @@ _mesa_make_extension_string( GLcontext *ctx ) return (GLubyte *) s; } +static size_t +append_extension(char **str, const char *ext) +{ + char *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_es2(const GLcontext *ctx, char *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) +{ + if (!ctx->Extensions.String) { + char *s; + unsigned int len; + + len = make_extension_string_es2(ctx, NULL); + s = (char *) malloc(len + 1); + if (!s) + return NULL; + make_extension_string_es2(ctx, s); + ctx->Extensions.String = (const GLubyte *) s; + } + + return ctx->Extensions.String; +} + +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: + default: + assert(0); + return NULL; + } +} /** * Return number of enabled extensions. |