[Mesa-dev] [PATCH] mesa: Always assume EXT_fog_coord support.

Anuj Phogat anuj.phogat at gmail.com
Wed Feb 6 13:37:52 PST 2013


On Wed, Feb 6, 2013 at 11:42 AM, Kenneth Graunke <kenneth at whitecape.org> wrote:
> All drivers (Gallium, classic i915, i965, radeon, r200, nouveau, and
> swrast) supported it.  This patch enables it universally and removes
> the gl_extensions enable bit in favor of dummy_true.
>
> Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
> ---
>  src/mesa/drivers/dri/intel/intel_extensions.c  |  1 -
>  src/mesa/drivers/dri/nouveau/nouveau_context.c |  1 -
>  src/mesa/drivers/dri/r200/r200_context.c       |  1 -
>  src/mesa/drivers/dri/radeon/radeon_context.c   |  1 -
>  src/mesa/main/enable.c                         |  1 -
>  src/mesa/main/extensions.c                     |  4 +---
>  src/mesa/main/fog.c                            |  2 +-
>  src/mesa/main/get.c                            |  7 -------
>  src/mesa/main/get_hash_params.py               | 10 +++++-----
>  src/mesa/main/mtypes.h                         |  1 -
>  src/mesa/main/version.c                        |  1 -
>  src/mesa/program/program_parse.y               |  5 -----
>  src/mesa/state_tracker/st_extensions.c         |  1 -
>  13 files changed, 7 insertions(+), 29 deletions(-)
>
> Thanks Brian!
>
> I'll include this before other three.
>
> diff --git a/src/mesa/drivers/dri/intel/intel_extensions.c b/src/mesa/drivers/dri/intel/intel_extensions.c
> index 6b5f678..beaa1b2 100755
> --- a/src/mesa/drivers/dri/intel/intel_extensions.c
> +++ b/src/mesa/drivers/dri/intel/intel_extensions.c
> @@ -68,7 +68,6 @@ intelInitExtensions(struct gl_context *ctx)
>     ctx->Extensions.EXT_framebuffer_blit = true;
>     ctx->Extensions.EXT_framebuffer_object = true;
>     ctx->Extensions.EXT_framebuffer_multisample = true;
> -   ctx->Extensions.EXT_fog_coord = true;
>     ctx->Extensions.EXT_gpu_program_parameters = true;
>     ctx->Extensions.EXT_packed_depth_stencil = true;
>     ctx->Extensions.EXT_pixel_buffer_object = true;
> diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.c b/src/mesa/drivers/dri/nouveau/nouveau_context.c
> index b216c60..dc2d75a 100644
> --- a/src/mesa/drivers/dri/nouveau/nouveau_context.c
> +++ b/src/mesa/drivers/dri/nouveau/nouveau_context.c
> @@ -198,7 +198,6 @@ nouveau_context_init(struct gl_context *ctx, struct nouveau_screen *screen,
>         /* Enable any supported extensions. */
>         ctx->Extensions.EXT_blend_color = true;
>         ctx->Extensions.EXT_blend_minmax = true;
> -       ctx->Extensions.EXT_fog_coord = true;
>         ctx->Extensions.EXT_framebuffer_blit = true;
>         ctx->Extensions.EXT_framebuffer_object = true;
>         ctx->Extensions.EXT_packed_depth_stencil = true;
> diff --git a/src/mesa/drivers/dri/r200/r200_context.c b/src/mesa/drivers/dri/r200/r200_context.c
> index ee66683..16d0665 100644
> --- a/src/mesa/drivers/dri/r200/r200_context.c
> +++ b/src/mesa/drivers/dri/r200/r200_context.c
> @@ -387,7 +387,6 @@ GLboolean r200CreateContext( gl_api api,
>     ctx->Extensions.ARB_texture_env_crossbar = true;
>     ctx->Extensions.EXT_blend_color = true;
>     ctx->Extensions.EXT_blend_minmax = true;
> -   ctx->Extensions.EXT_fog_coord = true;
>     ctx->Extensions.EXT_packed_depth_stencil = true;
>     ctx->Extensions.EXT_secondary_color = true;
>     ctx->Extensions.EXT_texture_env_dot3 = true;
> diff --git a/src/mesa/drivers/dri/radeon/radeon_context.c b/src/mesa/drivers/dri/radeon/radeon_context.c
> index a2f2228..acdca8c 100644
> --- a/src/mesa/drivers/dri/radeon/radeon_context.c
> +++ b/src/mesa/drivers/dri/radeon/radeon_context.c
> @@ -345,7 +345,6 @@ r100CreateContext( gl_api api,
>     ctx->Extensions.ARB_texture_env_combine = true;
>     ctx->Extensions.ARB_texture_env_crossbar = true;
>     ctx->Extensions.ARB_texture_env_dot3 = true;
> -   ctx->Extensions.EXT_fog_coord = true;
>     ctx->Extensions.EXT_packed_depth_stencil = true;
>     ctx->Extensions.EXT_secondary_color = true;
>     ctx->Extensions.EXT_texture_env_dot3 = true;
> diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c
> index 7e85fdf..ef95951 100644
> --- a/src/mesa/main/enable.c
> +++ b/src/mesa/main/enable.c
> @@ -1424,7 +1424,6 @@ _mesa_IsEnabled( GLenum cap )
>        case GL_FOG_COORDINATE_ARRAY_EXT:
>           if (ctx->API != API_OPENGL_COMPAT)
>              goto invalid_enum_error;
> -         CHECK_EXTENSION(EXT_fog_coord);
>           return (ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_FOG].Enabled != 0);
>        case GL_SECONDARY_COLOR_ARRAY_EXT:
>           if (ctx->API != API_OPENGL_COMPAT)
> diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
> index 04435e0..d744507 100644
> --- a/src/mesa/main/extensions.c
> +++ b/src/mesa/main/extensions.c
> @@ -177,7 +177,7 @@ static const struct extension extension_table[] = {
>     { "GL_EXT_draw_buffers2",                       o(EXT_draw_buffers2),                       GL,             2006 },
>     { "GL_EXT_draw_instanced",                      o(ARB_draw_instanced),                      GL,             2006 },
>     { "GL_EXT_draw_range_elements",                 o(dummy_true),                              GLL,            1997 },
> -   { "GL_EXT_fog_coord",                           o(EXT_fog_coord),                           GLL,            1999 },
> +   { "GL_EXT_fog_coord",                           o(dummy_true),                              GLL,            1999 },
>     { "GL_EXT_framebuffer_blit",                    o(EXT_framebuffer_blit),                    GL,             2005 },
>     { "GL_EXT_framebuffer_multisample",             o(EXT_framebuffer_multisample),             GL,             2005 },
>     { "GL_EXT_framebuffer_object",                  o(EXT_framebuffer_object),                  GL,             2000 },
> @@ -416,7 +416,6 @@ _mesa_enable_sw_extensions(struct gl_context *ctx)
>     ctx->Extensions.EXT_blend_minmax = GL_TRUE;
>     ctx->Extensions.EXT_depth_bounds_test = GL_TRUE;
>     ctx->Extensions.EXT_draw_buffers2 = GL_TRUE;
> -   ctx->Extensions.EXT_fog_coord = GL_TRUE;
>     ctx->Extensions.EXT_framebuffer_object = GL_TRUE;
>     ctx->Extensions.EXT_framebuffer_blit = GL_TRUE;
>     ctx->Extensions.EXT_packed_depth_stencil = GL_TRUE;
> @@ -486,7 +485,6 @@ _mesa_enable_1_4_extensions(struct gl_context *ctx)
>     ctx->Extensions.EXT_blend_color = GL_TRUE;
>     ctx->Extensions.EXT_blend_func_separate = GL_TRUE;
>     ctx->Extensions.EXT_blend_minmax = GL_TRUE;
> -   ctx->Extensions.EXT_fog_coord = GL_TRUE;
>     ctx->Extensions.EXT_point_parameters = GL_TRUE;
>     ctx->Extensions.EXT_secondary_color = GL_TRUE;
>  }
> diff --git a/src/mesa/main/fog.c b/src/mesa/main/fog.c
> index 3c5228a..f594ac3 100644
> --- a/src/mesa/main/fog.c
> +++ b/src/mesa/main/fog.c
> @@ -162,7 +162,7 @@ _mesa_Fogfv( GLenum pname, const GLfloat *params )
>           break;
>        case GL_FOG_COORDINATE_SOURCE_EXT: {
>          GLenum p = (GLenum) (GLint) *params;
> -         if (ctx->API != API_OPENGL_COMPAT || !ctx->Extensions.EXT_fog_coord ||
> +         if (ctx->API != API_OPENGL_COMPAT ||
>               (p != GL_FOG_COORDINATE_EXT && p != GL_FRAGMENT_DEPTH_EXT)) {
>             _mesa_error(ctx, GL_INVALID_ENUM, "glFog");
>             return;
> diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
> index da1e01c..ffcf625 100644
> --- a/src/mesa/main/get.c
> +++ b/src/mesa/main/get.c
> @@ -268,12 +268,6 @@ static const int extra_EXT_secondary_color_flush_current[] = {
>     EXTRA_END
>  };
>
> -static const int extra_EXT_fog_coord_flush_current[] = {
> -   EXT(EXT_fog_coord),
> -   EXTRA_FLUSH_CURRENT,
> -   EXTRA_END
> -};
> -
>  static const int extra_EXT_texture_integer[] = {
>     EXT(EXT_texture_integer),
>     EXTRA_END
> @@ -319,7 +313,6 @@ EXTRA_EXT(ARB_texture_cube_map);
>  EXTRA_EXT(MESA_texture_array);
>  EXTRA_EXT2(EXT_secondary_color, ARB_vertex_program);
>  EXTRA_EXT(EXT_secondary_color);
> -EXTRA_EXT(EXT_fog_coord);
>  EXTRA_EXT(NV_fog_distance);
>  EXTRA_EXT(EXT_texture_filter_anisotropic);
>  EXTRA_EXT(NV_point_sprite);
> diff --git a/src/mesa/main/get_hash_params.py b/src/mesa/main/get_hash_params.py
> index b6bed80..31b96c7 100644
> --- a/src/mesa/main/get_hash_params.py
> +++ b/src/mesa/main/get_hash_params.py
> @@ -545,11 +545,11 @@ descriptor=[
>    [ "SECONDARY_COLOR_ARRAY_SIZE", "ARRAY_INT(VertexAttrib[VERT_ATTRIB_COLOR1].Size), extra_EXT_secondary_color" ],
>
>  # GL_EXT_fog_coord
> -  [ "CURRENT_FOG_COORDINATE", "CONTEXT_FLOAT(Current.Attrib[VERT_ATTRIB_FOG][0]), extra_EXT_fog_coord_flush_current" ],
> -  [ "FOG_COORDINATE_ARRAY", "ARRAY_BOOL(VertexAttrib[VERT_ATTRIB_FOG].Enabled), extra_EXT_fog_coord" ],
> -  [ "FOG_COORDINATE_ARRAY_TYPE", "ARRAY_ENUM(VertexAttrib[VERT_ATTRIB_FOG].Type), extra_EXT_fog_coord" ],
> -  [ "FOG_COORDINATE_ARRAY_STRIDE", "ARRAY_INT(VertexAttrib[VERT_ATTRIB_FOG].Stride), extra_EXT_fog_coord" ],
> -  [ "FOG_COORDINATE_SOURCE", "CONTEXT_ENUM(Fog.FogCoordinateSource), extra_EXT_fog_coord" ],
> +  [ "CURRENT_FOG_COORDINATE", "CONTEXT_FLOAT(Current.Attrib[VERT_ATTRIB_FOG][0]), extra_flush_current" ],
> +  [ "FOG_COORDINATE_ARRAY", "ARRAY_BOOL(VertexAttrib[VERT_ATTRIB_FOG].Enabled), NO_EXTRA" ],
> +  [ "FOG_COORDINATE_ARRAY_TYPE", "ARRAY_ENUM(VertexAttrib[VERT_ATTRIB_FOG].Type), NO_EXTRA" ],
> +  [ "FOG_COORDINATE_ARRAY_STRIDE", "ARRAY_INT(VertexAttrib[VERT_ATTRIB_FOG].Stride), NO_EXTRA" ],
> +  [ "FOG_COORDINATE_SOURCE", "CONTEXT_ENUM(Fog.FogCoordinateSource), NO_EXTRA" ],
>
>  # GL_NV_fog_distance
>    [ "FOG_DISTANCE_MODE_NV", "CONTEXT_ENUM(Fog.FogDistanceMode), extra_NV_fog_distance" ],
> diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
> index b92f98e..8c47164 100644
> --- a/src/mesa/main/mtypes.h
> +++ b/src/mesa/main/mtypes.h
> @@ -3108,7 +3108,6 @@ struct gl_extensions
>     GLboolean EXT_clip_volume_hint;
>     GLboolean EXT_depth_bounds_test;
>     GLboolean EXT_draw_buffers2;
> -   GLboolean EXT_fog_coord;
>     GLboolean EXT_framebuffer_blit;
>     GLboolean EXT_framebuffer_multisample;
>     GLboolean EXT_framebuffer_object;
> diff --git a/src/mesa/main/version.c b/src/mesa/main/version.c
> index e944a55..019c303 100644
> --- a/src/mesa/main/version.c
> +++ b/src/mesa/main/version.c
> @@ -164,7 +164,6 @@ compute_version(struct gl_context *ctx)
>                                ctx->Extensions.EXT_blend_color &&
>                                ctx->Extensions.EXT_blend_func_separate &&
>                                ctx->Extensions.EXT_blend_minmax &&
> -                              ctx->Extensions.EXT_fog_coord &&
>                                ctx->Extensions.EXT_point_parameters &&
>                                ctx->Extensions.EXT_secondary_color);
>     const GLboolean ver_1_5 = (ver_1_4 &&
> diff --git a/src/mesa/program/program_parse.y b/src/mesa/program/program_parse.y
> index 025b547..2fbf029 100644
> --- a/src/mesa/program/program_parse.y
> +++ b/src/mesa/program/program_parse.y
> @@ -1149,11 +1149,6 @@ vtxAttribItem: POSITION
>         }
>         | FOGCOORD
>         {
> -          if (!state->ctx->Extensions.EXT_fog_coord) {
> -             yyerror(& @1, state, "GL_EXT_fog_coord not supported");
> -             YYERROR;
> -          }
> -
>            $$ = VERT_ATTRIB_FOG;
>         }
>         | TEXCOORD optTexCoordUnitNum
> diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c
> index 4d2d43d..f85f422 100644
> --- a/src/mesa/state_tracker/st_extensions.c
> +++ b/src/mesa/state_tracker/st_extensions.c
> @@ -534,7 +534,6 @@ void st_init_extensions(struct st_context *st)
>     ctx->Extensions.EXT_blend_minmax = GL_TRUE;
>     ctx->Extensions.EXT_framebuffer_blit = GL_TRUE;
>     ctx->Extensions.EXT_framebuffer_object = GL_TRUE;
> -   ctx->Extensions.EXT_fog_coord = GL_TRUE;
>     ctx->Extensions.EXT_gpu_program_parameters = GL_TRUE;
>     ctx->Extensions.EXT_pixel_buffer_object = GL_TRUE;
>     ctx->Extensions.EXT_point_parameters = GL_TRUE;
> --
> 1.8.1.2
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reviewed-by: Anuj Phogat <anuj.phogat at gmail.com>


More information about the mesa-dev mailing list