summaryrefslogtreecommitdiff
path: root/src/mesa/main
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2000-03-07 17:54:58 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2000-03-07 17:54:58 +0000
commitaabf086a03f27aace21f56098989f94b5697c8dd (patch)
tree969e4f128985c83da35ee64a805f8763a2a0fef2 /src/mesa/main
parent4f92969899df9eb37d3c831cf3e17545877eda6e (diff)
added GL_EXT_texture_lod_bias extension (Michael Vance)
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/enums.c5
-rw-r--r--src/mesa/main/extensions.c32
-rw-r--r--src/mesa/main/texstate.c85
3 files changed, 82 insertions, 40 deletions
diff --git a/src/mesa/main/enums.c b/src/mesa/main/enums.c
index 5dbda02dfb..9c49a810be 100644
--- a/src/mesa/main/enums.c
+++ b/src/mesa/main/enums.c
@@ -1,4 +1,4 @@
-/* $Id: enums.c,v 1.6 2000/02/05 01:52:05 brianp Exp $ */
+/* $Id: enums.c,v 1.7 2000/03/07 17:54:58 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -769,6 +769,9 @@ enum_elt all_enums[] =
{ "GL_CLIENT_ACTIVE_TEXTURE_ARB", 0x84E1 },
{ "GL_MAX_TEXTURE_UNITS_ARB", 0x84E2 },
+ { "GL_TEXTURE_FILTER_CONTROL_EXT", 0x8500 },
+ { "GL_TEXTUER_LOD_BIAS_EXT", 0x8501 },
+
{ "GL_NORMAL_MAP_NV", 0x8511 },
{ "GL_REFLECTION_MAP_NV", 0x8512 },
diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
index b3b7a05382..b6ff6d1293 100644
--- a/src/mesa/main/extensions.c
+++ b/src/mesa/main/extensions.c
@@ -1,4 +1,4 @@
-/* $Id: extensions.c,v 1.18 2000/02/25 03:55:40 keithw Exp $ */
+/* $Id: extensions.c,v 1.19 2000/03/07 17:54:58 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -41,7 +41,7 @@
struct extension {
struct extension *next, *prev;
- int enabled;
+ GLint enabled;
char name[MAX_EXT_NAMELEN+1];
void (*notify)( GLcontext *, GLboolean );
};
@@ -77,9 +77,23 @@ static struct { int enabled; const char *name; } default_extensions[] = {
{ ALWAYS_ENABLED, "GL_ARB_tranpose_matrix" },
{ DEFAULT_OFF, "GL_EXT_vertex_array_set" },
{ DEFAULT_OFF, "GL_EXT_texture_env" },
+ { DEFAULT_ON, "GL_EXT_texture_lod_bias" }
};
+/*
+ * Update the boolean convenience flags in the Extensions struct.
+ */
+static void
+update_extension_flags( GLcontext *ctx )
+{
+ /* Update flags */
+ ctx->Extensions.HaveTextureEnvAdd = gl_extension_is_enabled(ctx, "GL_EXT_texture_env_add");
+ ctx->Extensions.HaveTextureLodBias = gl_extension_is_enabled(ctx, "GL_EXT_texture_lod_bias");
+}
+
+
+
int gl_extensions_add( GLcontext *ctx,
int state,
const char *name,
@@ -101,21 +115,26 @@ int gl_extensions_add( GLcontext *ctx,
}
-static int set_extension( GLcontext *ctx, const char *name, GLuint state )
+/*
+ * Either enable or disable the named extension.
+ */
+static int set_extension( GLcontext *ctx, const char *name, GLint state )
{
struct extension *i;
foreach( i, ctx->Extensions.ext_list )
if (strncmp(i->name, name, MAX_EXT_NAMELEN) == 0)
break;
- if (i == ctx->Extensions.ext_list) return 1;
+ if (i == ctx->Extensions.ext_list)
+ return 1;
- if (i->enabled && !(i->enabled & ALWAYS_ENABLED))
- {
+ if (i->enabled && !(i->enabled & ALWAYS_ENABLED)) {
if (i->notify) i->notify( ctx, state );
i->enabled = state;
}
+ update_extension_flags(ctx);
+
return 0;
}
@@ -189,6 +208,7 @@ void gl_extensions_ctr( GLcontext *ctx )
default_extensions[i].name,
0 );
}
+ update_extension_flags(ctx);
}
diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c
index e5f901255b..2993be4522 100644
--- a/src/mesa/main/texstate.c
+++ b/src/mesa/main/texstate.c
@@ -1,4 +1,4 @@
-/* $Id: texstate.c,v 1.8 2000/03/07 17:11:29 brianp Exp $ */
+/* $Id: texstate.c,v 1.9 2000/03/07 17:54:58 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -69,35 +69,24 @@ _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param )
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glTexEnv");
- if (target!=GL_TEXTURE_ENV) {
- gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(target)" );
- return;
- }
+ if (target==GL_TEXTURE_ENV) {
- if (MESA_VERBOSE&(VERBOSE_API|VERBOSE_TEXTURE))
- fprintf(stderr, "glTexEnv %s %s %.1f(%s) ...\n",
- gl_lookup_enum_by_nr(target),
- gl_lookup_enum_by_nr(pname),
- *param,
- gl_lookup_enum_by_nr((GLenum) (GLint) *param));
-
-
- if (pname==GL_TEXTURE_ENV_MODE) {
- GLenum mode = (GLenum) (GLint) *param;
- switch (mode) {
- case GL_ADD:
- if (!gl_extension_is_enabled(ctx, "GL_EXT_texture_env_add")) {
- gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(param)");
- return;
- }
- /* FALL-THROUGH */
- case GL_MODULATE:
- case GL_BLEND:
- case GL_DECAL:
- case GL_REPLACE:
+ if (pname==GL_TEXTURE_ENV_MODE) {
+ GLenum mode = (GLenum) (GLint) *param;
+ switch (mode) {
+ case GL_ADD:
+ if (!ctx->Extensions.HaveTextureEnvAdd) {
+ gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(param)");
+ return;
+ }
+ /* FALL-THROUGH */
+ case GL_MODULATE:
+ case GL_BLEND:
+ case GL_DECAL:
+ case GL_REPLACE:
/* A small optimization for drivers */
if (texUnit->EnvMode == mode)
- return;
+ return;
if (MESA_VERBOSE & (VERBOSE_STATE|VERBOSE_TEXTURE))
fprintf(stderr, "glTexEnv: old mode %s, new mode %s\n",
@@ -110,23 +99,53 @@ _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param )
default:
gl_error( ctx, GL_INVALID_VALUE, "glTexEnv(param)" );
return;
+ }
+ }
+ else if (pname==GL_TEXTURE_ENV_COLOR) {
+ texUnit->EnvColor[0] = CLAMP( param[0], 0.0F, 1.0F );
+ texUnit->EnvColor[1] = CLAMP( param[1], 0.0F, 1.0F );
+ texUnit->EnvColor[2] = CLAMP( param[2], 0.0F, 1.0F );
+ texUnit->EnvColor[3] = CLAMP( param[3], 0.0F, 1.0F );
+ }
+ else {
+ gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(pname)" );
+ return;
}
+
}
- else if (pname==GL_TEXTURE_ENV_COLOR) {
- texUnit->EnvColor[0] = CLAMP( param[0], 0.0F, 1.0F );
- texUnit->EnvColor[1] = CLAMP( param[1], 0.0F, 1.0F );
- texUnit->EnvColor[2] = CLAMP( param[2], 0.0F, 1.0F );
- texUnit->EnvColor[3] = CLAMP( param[3], 0.0F, 1.0F );
+ else if (target==GL_TEXTURE_FILTER_CONTROL_EXT) {
+
+ if (!ctx->Extensions.HaveTextureLodBias) {
+ gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(param)" );
+ return;
+ }
+
+ if (pname==GL_TEXTURE_LOD_BIAS_EXT) {
+ texUnit->LodBias = param[0];
+ }
+ else {
+ gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(pname)" );
+ return;
+ }
+
}
else {
- gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(pname)" );
+ gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(target)" );
return;
}
+ if (MESA_VERBOSE&(VERBOSE_API|VERBOSE_TEXTURE))
+ fprintf(stderr, "glTexEnv %s %s %.1f(%s) ...\n",
+ gl_lookup_enum_by_nr(target),
+ gl_lookup_enum_by_nr(pname),
+ *param,
+ gl_lookup_enum_by_nr((GLenum) (GLint) *param));
+
/* Tell device driver about the new texture environment */
if (ctx->Driver.TexEnv) {
(*ctx->Driver.TexEnv)( ctx, target, pname, param );
}
+
}