mesa: Add the basics for the NV_fog_distance extension

No driver implements it yet.
This commit is contained in:
Nicholas Miell
2011-09-19 23:16:59 -07:00
committed by Marek Olšák
parent 7f08248c2e
commit 740467dd62
4 changed files with 22 additions and 0 deletions

View File

@@ -287,6 +287,7 @@ static const struct extension extension_table[] = {
{ "GL_NV_depth_clamp", o(ARB_depth_clamp), GL, 2001 },
{ "GL_NV_draw_buffers", o(dummy_true), ES2, 2011 },
{ "GL_NV_fbo_color_attachments", o(EXT_framebuffer_object), ES2, 2010 },
{ "GL_NV_fog_distance", o(NV_fog_distance), GL, 2001 },
{ "GL_NV_fragment_program", o(NV_fragment_program), GL, 2001 },
{ "GL_NV_fragment_program_option", o(NV_fragment_program_option), GL, 2005 },
{ "GL_NV_light_max_exponent", o(NV_light_max_exponent), GL, 1999 },

View File

@@ -172,6 +172,19 @@ _mesa_Fogfv( GLenum pname, const GLfloat *params )
ctx->Fog.FogCoordinateSource = p;
break;
}
case GL_FOG_DISTANCE_MODE_NV: {
GLenum p = (GLenum) (GLint) *params;
if (!ctx->Extensions.NV_fog_distance ||
(p != GL_EYE_RADIAL_NV && p != GL_EYE_PLANE && p != GL_EYE_PLANE_ABSOLUTE_NV)) {
_mesa_error(ctx, GL_INVALID_ENUM, "glFog");
return;
}
if (ctx->Fog.FogDistanceMode == p)
return;
FLUSH_VERTICES(ctx, _NEW_FOG);
ctx->Fog.FogDistanceMode = p;
break;
}
default:
_mesa_error( ctx, GL_INVALID_ENUM, "glFog" );
return;
@@ -201,4 +214,5 @@ void _mesa_init_fog( struct gl_context * ctx )
ctx->Fog.ColorSumEnabled = GL_FALSE;
ctx->Fog.FogCoordinateSource = GL_FRAGMENT_DEPTH_EXT;
ctx->Fog._Scale = 1.0f;
ctx->Fog.FogDistanceMode = GL_EYE_PLANE_ABSOLUTE_NV;
}

View File

@@ -295,6 +295,7 @@ 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(IBM_rasterpos_clip);
EXTRA_EXT(NV_point_sprite);
@@ -972,6 +973,10 @@ static const struct value_desc values[] = {
{ GL_FOG_COORDINATE_SOURCE_EXT, CONTEXT_ENUM(Fog.FogCoordinateSource),
extra_EXT_fog_coord },
/* GL_NV_fog_distance */
{ GL_FOG_DISTANCE_MODE_NV, CONTEXT_ENUM(Fog.FogDistanceMode),
extra_NV_fog_distance },
/* GL_IBM_rasterpos_clip */
{ GL_RASTER_POSITION_UNCLIPPED_IBM,
CONTEXT_BOOL(Transform.RasterPositionUnclipped),

View File

@@ -884,6 +884,7 @@ struct gl_fog_attrib
GLboolean ColorSumEnabled;
GLenum FogCoordinateSource; /**< GL_EXT_fog_coord */
GLfloat _Scale; /**< (End == Start) ? 1.0 : 1.0 / (End - Start) */
GLenum FogDistanceMode; /**< GL_NV_fog_distance */
};
@@ -2902,6 +2903,7 @@ struct gl_extensions
GLboolean MESA_texture_array;
GLboolean NV_blend_square;
GLboolean NV_conditional_render;
GLboolean NV_fog_distance;
GLboolean NV_fragment_program;
GLboolean NV_fragment_program_option;
GLboolean NV_light_max_exponent;