[Mesa-dev] [PATCH 1/2] mesa: Refactor handling of extension strings
Brian Paul
brianp at vmware.com
Mon Jan 10 07:18:44 PST 2011
On 01/10/2011 12:53 AM, Chad Versace wrote:
> Place GL, GLES1, and GLES2 extensions in a unified extension table. This
> allows one to enable, disable, and query the status of GLES1 and GLES2
> extensions by name.
>
> When tested on Intel Ironlake, this patch did not alter the extension
> string [as given by glGetString(GL_EXTENSIONS)] for any API.
> ---
> src/mesa/main/extensions.c | 904 ++++++++++++++++++++------------------------
> src/mesa/main/mtypes.h | 3 +
> 2 files changed, 417 insertions(+), 490 deletions(-)
>
> diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
> index 4262615..a771d62 100644
> --- a/src/mesa/main/extensions.c
> +++ b/src/mesa/main/extensions.c
> @@ -24,6 +24,12 @@
> */
>
>
> +/**
> + * \file
> + * \brief Extension handling
> + */
> +
> +
> #include "glheader.h"
> #include "imports.h"
> #include "context.h"
> @@ -31,200 +37,342 @@
> #include "mfeatures.h"
> #include "mtypes.h"
>
> +static const uint8_t GL = 1<< 0;
> +static const uint8_t ES1 = 1<< 1;
> +static const uint8_t ES2 = 1<< 2;
>
> -#define F(x) offsetof(struct gl_extensions, x)
> -#define ON GL_TRUE
> -#define OFF GL_FALSE
> +static unsigned
> +api_bit(struct gl_context* ctx)
> +{
> + switch(ctx->API) {
> + case API_OPENGL: return GL;
> + case API_OPENGLES: return ES1;
> + case API_OPENGLES2: return ES2;
> + default:
> + assert(0);
> + return 0;
> + }
> +}
Why not just defined the GL, ES1 and ES2 bits to be 1 << gl_api like this:
GL = 1 << API_OPENGL
ES1 = 1 << API_OPENGLES
ES2 = 1 << API_OPENGLES2
That'd make api_bit() trivial.
[...]
GL },
> + { "GL_SGIS_texture_edge_clamp", o(SGIS_texture_edge_clamp), GL },
> + { "GL_SGIS_texture_lod", o(SGIS_texture_lod), GL },
> + { "GL_SGI_texture_color_table", o(SGI_texture_color_table), GL },
> + { "GL_SUN_multi_draw_arrays", o(EXT_multi_draw_arrays), GL },
> +
> + { 0, 0, 0, },
Some compilers will complain about the trailing comma after the 0 there.
-Brian
More information about the mesa-dev
mailing list