summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2002-05-27 17:04:52 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2002-05-27 17:04:52 +0000
commit6c408b46678637959dba04663fbc34eb9c4bc397 (patch)
tree6fddafa97a16c2e48fc984a8e5f27b1e8d770677
parent23d8ef3937b3b66684f7feb62446abca8e91d307 (diff)
replaced experimental MESA_sprite_point with NV_point_sprite
-rw-r--r--src/mesa/main/attrib.c16
-rw-r--r--src/mesa/main/config.h4
-rw-r--r--src/mesa/main/context.c8
-rw-r--r--src/mesa/main/enable.c18
-rw-r--r--src/mesa/main/extensions.c5
-rw-r--r--src/mesa/main/get.c50
-rw-r--r--src/mesa/main/mtypes.h25
-rw-r--r--src/mesa/main/points.c119
-rw-r--r--src/mesa/main/points.h10
-rw-r--r--src/mesa/main/texstate.c780
-rw-r--r--src/mesa/swrast/s_points.c9
-rw-r--r--src/mesa/swrast/s_pointtemp.h104
12 files changed, 660 insertions, 488 deletions
diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c
index 5e6da38d98..9a13aa7691 100644
--- a/src/mesa/main/attrib.c
+++ b/src/mesa/main/attrib.c
@@ -1,4 +1,4 @@
-/* $Id: attrib.c,v 1.63 2002/04/01 17:03:38 brianp Exp $ */
+/* $Id: attrib.c,v 1.64 2002/05/27 17:04:52 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -527,6 +527,10 @@ pop_enable_group(GLcontext *ctx, const struct gl_enable_attrib *enable)
GL_POINT_SMOOTH);
TEST_AND_UPDATE(ctx->Point.SmoothFlag, enable->PointSmooth,
GL_POINT_SMOOTH);
+ if (ctx->Extensions.NV_point_sprite) {
+ TEST_AND_UPDATE(ctx->Point.PointSprite, enable->PointSprite,
+ GL_POINT_SPRITE_NV);
+ }
TEST_AND_UPDATE(ctx->Polygon.OffsetPoint, enable->PolygonOffsetPoint,
GL_POLYGON_OFFSET_POINT);
TEST_AND_UPDATE(ctx->Polygon.OffsetLine, enable->PolygonOffsetLine,
@@ -991,6 +995,16 @@ _mesa_PopAttrib(void)
_mesa_PointParameterfEXT(GL_POINT_SIZE_MAX_EXT, point->MaxSize);
_mesa_PointParameterfEXT(GL_POINT_FADE_THRESHOLD_SIZE_EXT,
point->Threshold);
+ if (ctx->Extensions.NV_point_sprite) {
+ GLuint u;
+ for (u = 0; u < ctx->Const.MaxTextureUnits; u++) {
+ _mesa_TexEnvi(GL_POINT_SPRITE_NV, GL_COORD_REPLACE_NV,
+ (GLint) point->CoordReplace[u]);
+ }
+ _mesa_set_enable(ctx, GL_POINT_SPRITE_NV,point->PointSprite);
+ _mesa_PointParameteriNV(GL_POINT_SPRITE_R_MODE_NV,
+ ctx->Point.SpriteRMode);
+ }
}
break;
case GL_POLYGON_BIT:
diff --git a/src/mesa/main/config.h b/src/mesa/main/config.h
index 37c572226d..96dafac0ad 100644
--- a/src/mesa/main/config.h
+++ b/src/mesa/main/config.h
@@ -1,4 +1,4 @@
-/* $Id: config.h,v 1.37 2001/12/18 04:06:45 brianp Exp $ */
+/* $Id: config.h,v 1.38 2002/05/27 17:04:52 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -92,7 +92,7 @@
/* Min and Max point sizes and granularity */
#define MIN_POINT_SIZE 1.0
-#define MAX_POINT_SIZE 10.0
+#define MAX_POINT_SIZE 20.0
#define POINT_SIZE_GRANULARITY 0.1
/* Min and Max line widths and granularity */
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index b4e746d769..420bfa4691 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -1,4 +1,4 @@
-/* $Id: context.c,v 1.162 2002/05/09 21:54:16 brianp Exp $ */
+/* $Id: context.c,v 1.163 2002/05/27 17:04:52 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -1116,7 +1116,11 @@ init_attrib_groups( GLcontext *ctx )
ctx->Point.MinSize = 0.0;
ctx->Point.MaxSize = ctx->Const.MaxPointSize;
ctx->Point.Threshold = 1.0;
- ctx->Point.SpriteMode = GL_FALSE; /* GL_MESA_sprite_point */
+ ctx->Point.PointSprite = GL_FALSE; /* GL_NV_point_sprite */
+ ctx->Point.SpriteRMode = GL_ZERO; /* GL_NV_point_sprite */
+ for (i = 0; i < MAX_TEXTURE_UNITS; i++) {
+ ctx->Point.CoordReplace[i] = GL_FALSE; /* GL_NV_point_sprite */
+ }
/* Polygon group */
ctx->Polygon.CullFlag = GL_FALSE;
diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c
index af870e1639..87db3d5a6f 100644
--- a/src/mesa/main/enable.c
+++ b/src/mesa/main/enable.c
@@ -1,4 +1,4 @@
-/* $Id: enable.c,v 1.62 2002/04/21 18:49:18 brianp Exp $ */
+/* $Id: enable.c,v 1.63 2002/05/27 17:04:53 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -794,13 +794,13 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
ctx->Transform.RasterPositionUnclipped = state;
break;
- /* GL_MESA_sprite_point */
- case GL_SPRITE_POINT_MESA:
- CHECK_EXTENSION(MESA_sprite_point);
- if (ctx->Point.SpriteMode == state)
+ /* GL_NV_point_sprite */
+ case GL_POINT_SPRITE_NV:
+ CHECK_EXTENSION(NV_point_sprite);
+ if (ctx->Point.PointSprite == state)
return;
FLUSH_VERTICES(ctx, _NEW_POINT);
- ctx->Point.SpriteMode = state;
+ ctx->Point.PointSprite = state;
break;
/* GL_NV_vertex_program */
@@ -1158,9 +1158,9 @@ _mesa_IsEnabled( GLenum cap )
CHECK_EXTENSION(IBM_rasterpos_clip);
return ctx->Transform.RasterPositionUnclipped;
- /* GL_MESA_sprite_point */
- case GL_SPRITE_POINT_MESA:
- return ctx->Point.SpriteMode;
+ /* GL_NV_point_sprite */
+ case GL_POINT_SPRITE_NV:
+ return ctx->Point.PointSprite;
/* GL_NV_vertex_program */
case GL_VERTEX_PROGRAM_NV:
diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
index 96984359c1..c86bf7ce2d 100644
--- a/src/mesa/main/extensions.c
+++ b/src/mesa/main/extensions.c
@@ -1,4 +1,4 @@
-/* $Id: extensions.c,v 1.73 2002/05/02 00:59:20 brianp Exp $ */
+/* $Id: extensions.c,v 1.74 2002/05/27 17:04:53 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -111,9 +111,9 @@ static struct {
{ OFF, "GL_INGR_blend_func_separate", F(INGR_blend_func_separate) },
{ OFF, "GL_MESA_packed_depth_stencil", 0 },
{ OFF, "GL_MESA_resize_buffers", F(MESA_resize_buffers) },
- { OFF, "GL_MESA_sprite_point", F(MESA_sprite_point) },
{ ON, "GL_MESA_window_pos", F(MESA_window_pos) },
{ OFF, "GL_NV_blend_square", F(NV_blend_square) },
+ { OFF, "GL_NV_point_sprite", F(NV_point_sprite) },
{ ON, "GL_NV_texgen_reflection", F(NV_texgen_reflection) },
{ OFF, "GL_NV_vertex_program", F(NV_vertex_program) },
{ OFF, "GL_NV_vertex_program1_1", F(NV_vertex_program1_1) },
@@ -177,6 +177,7 @@ _mesa_enable_sw_extensions(GLcontext *ctx)
"GL_INGR_blend_func_separate",
"GL_MESA_resize_buffers",
"GL_NV_blend_square",
+ "GL_NV_point_sprite",
"GL_NV_texgen_reflection",
"GL_NV_vertex_program",
"GL_NV_vertex_program1_1",
diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index 0b63eab77c..0705f884e6 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -1,4 +1,4 @@
-/* $Id: get.c,v 1.78 2002/05/09 21:54:16 brianp Exp $ */
+/* $Id: get.c,v 1.79 2002/05/27 17:04:53 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -1325,10 +1325,14 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
*params = ctx->Transform.RasterPositionUnclipped;
break;
- /* GL_MESA_sprite_point */
- case GL_SPRITE_POINT_MESA:
- CHECK_EXTENSION_B(MESA_sprite_point);
- *params = ctx->Point.SpriteMode;
+ /* GL_NV_point_sprite */
+ case GL_POINT_SPRITE_NV:
+ CHECK_EXTENSION_B(NV_point_sprite);
+ *params = ctx->Point.PointSprite;
+ break;
+ case GL_POINT_SPRITE_R_MODE_NV:
+ CHECK_EXTENSION_B(NV_point_sprite);
+ *params = ENUM_TO_BOOL(ctx->Point.SpriteRMode);
break;
/* GL_SGIS_generate_mipmap */
@@ -2654,10 +2658,14 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params )
*params = (GLdouble) ctx->Transform.RasterPositionUnclipped;
break;
- /* GL_MESA_sprite_point */
- case GL_SPRITE_POINT_MESA:
- CHECK_EXTENSION_D(MESA_sprite_point);
- *params = (GLdouble) ctx->Point.SpriteMode;
+ /* GL_NV_point_sprite */
+ case GL_POINT_SPRITE_NV:
+ CHECK_EXTENSION_B(NV_point_sprite);
+ *params = (GLdouble) ctx->Point.PointSprite;
+ break;
+ case GL_POINT_SPRITE_R_MODE_NV:
+ CHECK_EXTENSION_B(NV_point_sprite);
+ *params = (GLdouble) ctx->Point.SpriteRMode;
break;
/* GL_SGIS_generate_mipmap */
@@ -3869,10 +3877,14 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
*params = (GLfloat) ctx->Transform.RasterPositionUnclipped;
break;
- /* GL_MESA_sprite_point */
- case GL_SPRITE_POINT_MESA:
- CHECK_EXTENSION_F(MESA_sprite_point);
- *params = (GLfloat) ctx->Point.SpriteMode;
+ /* GL_NV_point_sprite */
+ case GL_POINT_SPRITE_NV:
+ CHECK_EXTENSION_B(NV_point_sprite);
+ *params = (GLfloat) ctx->Point.PointSprite;
+ break;
+ case GL_POINT_SPRITE_R_MODE_NV:
+ CHECK_EXTENSION_B(NV_point_sprite);
+ *params = (GLfloat) ctx->Point.SpriteRMode;
break;
/* GL_SGIS_generate_mipmap */
@@ -5122,10 +5134,14 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
*params = (GLint) ctx->Transform.RasterPositionUnclipped;
break;
- /* GL_MESA_sprite_point */
- case GL_SPRITE_POINT_MESA:
- CHECK_EXTENSION_I(MESA_sprite_point);
- *params = (GLint) ctx->Point.SpriteMode;
+ /* GL_NV_point_sprite */
+ case GL_POINT_SPRITE_NV:
+ CHECK_EXTENSION_B(NV_point_sprite);
+ *params = (GLint) ctx->Point.PointSprite;
+ break;
+ case GL_POINT_SPRITE_R_MODE_NV:
+ CHECK_EXTENSION_B(NV_point_sprite);
+ *params = (GLint) ctx->Point.SpriteRMode;
break;
/* GL_SGIS_generate_mipmap */
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 93f217f57c..2864e65b47 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -1,4 +1,4 @@
-/* $Id: mtypes.h,v 1.75 2002/05/09 21:54:16 brianp Exp $ */
+/* $Id: mtypes.h,v 1.76 2002/05/27 17:04:53 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -426,18 +426,18 @@ struct gl_enable_attrib {
GLboolean RescaleNormals;
GLboolean Scissor;
GLboolean Stencil;
- GLboolean MultisampleEnabled; /* GL_ARB_multisample */
- GLboolean SampleAlphaToCoverage; /* GL_ARB_multisample */
- GLboolean SampleAlphaToOne; /* GL_ARB_multisample */
- GLboolean SampleCoverage; /* GL_ARB_multisample */
- GLboolean SampleCoverageInvert; /* GL_ARB_multisample */
+ GLboolean MultisampleEnabled; /* GL_ARB_multisample */
+ GLboolean SampleAlphaToCoverage; /* GL_ARB_multisample */
+ GLboolean SampleAlphaToOne; /* GL_ARB_multisample */
+ GLboolean SampleCoverage; /* GL_ARB_multisample */
+ GLboolean SampleCoverageInvert; /* GL_ARB_multisample */
GLboolean RasterPositionUnclipped; /* GL_IBM_rasterpos_clip */
GLuint Texture[MAX_TEXTURE_UNITS];
GLuint TexGen[MAX_TEXTURE_UNITS];
- /* GL_NV_vertex_program */
- GLboolean VertexProgram;
- GLboolean VertexProgramPointSize;
- GLboolean VertexProgramTwoSide;
+ GLboolean VertexProgram; /* GL_NV_vertex_program */
+ GLboolean VertexProgramPointSize; /* GL_NV_vertex_program */
+ GLboolean VertexProgramTwoSide; /* GL_NV_vertex_program */
+ GLboolean PointSprite; /* GL_NV_point_sprite */
};
@@ -669,13 +669,15 @@ struct gl_pixel_attrib {
struct gl_point_attrib {
GLboolean SmoothFlag; /* True if GL_POINT_SMOOTH is enabled */
- GLboolean SpriteMode; /* GL_MESA_sprite_point extension */
GLfloat Size; /* User-specified point size */
GLfloat _Size; /* Size clamped to Const.Min/MaxPointSize */
GLfloat Params[3]; /* GL_EXT_point_parameters */
GLfloat MinSize, MaxSize; /* GL_EXT_point_parameters */
GLfloat Threshold; /* GL_EXT_point_parameters */
GLboolean _Attenuated; /* True if Params != [1, 0, 0] */
+ GLboolean PointSprite; /* GL_NV_point_sprite */
+ GLboolean CoordReplace[MAX_TEXTURE_UNITS]; /* GL_NV_point_sprite */
+ GLenum SpriteRMode; /* GL_NV_point_sprite */
};
@@ -1427,6 +1429,7 @@ struct gl_extensions {
GLboolean MESA_resize_buffers;
GLboolean MESA_sprite_point;
GLboolean NV_blend_square;
+ GLboolean NV_point_sprite;
GLboolean NV_texgen_reflection;
GLboolean NV_vertex_program;
GLboolean NV_vertex_program1_1;
diff --git a/src/mesa/main/points.c b/src/mesa/main/points.c
index a3e678811d..cf9922479d 100644
--- a/src/mesa/main/points.c
+++ b/src/mesa/main/points.c
@@ -1,4 +1,4 @@
-/* $Id: points.c,v 1.32 2002/04/02 16:15:16 brianp Exp $ */
+/* $Id: points.c,v 1.33 2002/05/27 17:04:53 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -71,6 +71,29 @@ _mesa_PointSize( GLfloat size )
/*
+ * Added by GL_NV_point_sprite
+ */
+void
+_mesa_PointParameteriNV( GLenum pname, GLint param )
+{
+ const GLfloat value = (GLfloat) param;
+ _mesa_PointParameterfvEXT(pname, &value);
+}
+
+
+/*
+ * Added by GL_NV_point_sprite
+ */
+void
+_mesa_PointParameterivNV( GLenum pname, const GLint *params )
+{
+ const GLfloat value = (GLfloat) params[0];
+ _mesa_PointParameterfvEXT(pname, &value);
+}
+
+
+
+/*
* Same for both GL_EXT_point_parameters and GL_ARB_point_parameters.
*/
void
@@ -90,14 +113,9 @@ _mesa_PointParameterfvEXT( GLenum pname, const GLfloat *params)
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END(ctx);
- if (!ctx->Extensions.EXT_point_parameters) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glPointParameterf[v]{EXT,ARB}(pname)");
- return;
- }
-
switch (pname) {
case GL_DISTANCE_ATTENUATION_EXT:
- {
+ if (ctx->Extensions.EXT_point_parameters) {
const GLboolean tmp = ctx->Point._Attenuated;
if (TEST_EQ_3V(ctx->Point.Params, params))
return;
@@ -118,39 +136,88 @@ _mesa_PointParameterfvEXT( GLenum pname, const GLfloat *params)
ctx->_NeedEyeCoords ^= NEED_EYE_POINT_ATTEN;
}
}
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glPointParameterf[v]{EXT,ARB}(pname)");
+ return;
+ }
break;
case GL_POINT_SIZE_MIN_EXT:
- if (*params < 0.0F) {
- _mesa_error( ctx, GL_INVALID_VALUE, "glPointParameterf[v]{EXT,ARB}(param)" );
+ if (ctx->Extensions.EXT_point_parameters) {
+ if (params[0] < 0.0F) {
+ _mesa_error( ctx, GL_INVALID_VALUE,
+ "glPointParameterf[v]{EXT,ARB}(param)" );
+ return;
+ }
+ if (ctx->Point.MinSize == params[0])
+ return;
+ FLUSH_VERTICES(ctx, _NEW_POINT);
+ ctx->Point.MinSize = params[0];
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glPointParameterf[v]{EXT,ARB}(pname)");
return;
}
- if (ctx->Point.MinSize == *params)
- return;
- FLUSH_VERTICES(ctx, _NEW_POINT);
- ctx->Point.MinSize = *params;
break;
case GL_POINT_SIZE_MAX_EXT:
- if (*params < 0.0F) {
- _mesa_error( ctx, GL_INVALID_VALUE, "glPointParameterf[v]{EXT,ARB}(param)" );
+ if (ctx->Extensions.EXT_point_parameters) {
+ if (params[0] < 0.0F) {
+ _mesa_error( ctx, GL_INVALID_VALUE,
+ "glPointParameterf[v]{EXT,ARB}(param)" );
+ return;
+ }
+ if (ctx->Point.MaxSize == params[0])
+ return;
+ FLUSH_VERTICES(ctx, _NEW_POINT);
+ ctx->Point.MaxSize = params[0];
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glPointParameterf[v]{EXT,ARB}(pname)");
return;
}
- if (ctx->Point.MaxSize == *params)
- return;
- FLUSH_VERTICES(ctx, _NEW_POINT);
- ctx->Point.MaxSize = *params;
break;
case GL_POINT_FADE_THRESHOLD_SIZE_EXT:
- if (*params < 0.0F) {
- _mesa_error( ctx, GL_INVALID_VALUE, "glPointParameterf[v]{EXT,ARB}(param)" );
+ if (ctx->Extensions.EXT_point_parameters) {
+ if (params[0] < 0.0F) {
+ _mesa_error( ctx, GL_INVALID_VALUE,
+ "glPointParameterf[v]{EXT,ARB}(param)" );
+ return;
+ }
+ if (ctx->Point.Threshold == params[0])
+ return;
+ FLUSH_VERTICES(ctx, _NEW_POINT);
+ ctx->Point.Threshold = params[0];
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glPointParameterf[v]{EXT,ARB}(pname)");
+ return;
+ }
+ break;
+ case GL_POINT_SPRITE_R_MODE_NV:
+ if (ctx->Extensions.NV_point_sprite) {
+ GLenum value = (GLenum) params[0];
+ if (value != GL_ZERO && value != GL_S && value != GL_R) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glPointParameterf[v]{EXT,ARB}(param)");
+ return;
+ }
+ if (ctx->Point.SpriteRMode == value)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_POINT);
+ ctx->Point.SpriteRMode = value;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glPointParameterf[v]{EXT,ARB}(pname)");
return;
}
- if (ctx->Point.Threshold == *params)
- return;
- FLUSH_VERTICES(ctx, _NEW_POINT);
- ctx->Point.Threshold = *params;
break;
default:
- _mesa_error( ctx, GL_INVALID_ENUM, "glPointParameterf[v]{EXT,ARB}(pname)" );
+ _mesa_error( ctx, GL_INVALID_ENUM,
+ "glPointParameterf[v]{EXT,ARB}(pname)" );
return;
}
diff --git a/src/mesa/main/points.h b/src/mesa/main/points.h
index 55407491bb..02a542feb9 100644
--- a/src/mesa/main/points.h
+++ b/src/mesa/main/points.h
@@ -1,4 +1,4 @@
-/* $Id: points.h,v 1.6 2002/04/02 16:15:17 brianp Exp $ */
+/* $Id: points.h,v 1.7 2002/05/27 17:04:53 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -36,7 +36,13 @@ extern void
_mesa_PointSize( GLfloat size );
extern void
-_mesa_PointParameterfEXT( GLenum pname, GLfloat param);
+_mesa_PointParameteriNV( GLenum pname, GLint param );
+
+extern void
+_mesa_PointParameterivNV( GLenum pname, const GLint *params );
+
+extern void
+_mesa_PointParameterfEXT( GLenum pname, GLfloat param );
extern void
_mesa_PointParameterfvEXT( GLenum pname, const GLfloat *params );
diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c
index 67cb4022dc..fe6d9157de 100644
--- a/src/mesa/main/texstate.c
+++ b/src/mesa/main/texstate.c
@@ -1,4 +1,4 @@
-/* $Id: texstate.c,v 1.71 2002/05/02 00:59:20 brianp Exp $ */
+/* $Id: texstate.c,v 1.72 2002/05/27 17:04:53 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -75,7 +75,7 @@ _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param )
_mesa_error(ctx, errCode, s); \
}
- if (target==GL_TEXTURE_ENV) {
+ if (target == GL_TEXTURE_ENV) {
switch (pname) {
case GL_TEXTURE_ENV_MODE:
{
@@ -402,24 +402,52 @@ _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param )
return;
}
}
- else if (target==GL_TEXTURE_FILTER_CONTROL_EXT) {
+ else if (target == GL_TEXTURE_FILTER_CONTROL_EXT) {
+ /* GL_EXT_texture_lod_bias */
if (!ctx->Extensions.EXT_texture_lod_bias) {
- _mesa_error( ctx, GL_INVALID_ENUM, "glTexEnv(param)" );
+ _mesa_error( ctx, GL_INVALID_ENUM, "glTexEnv(target)" );
return;
}
- switch (pname) {
- case GL_TEXTURE_LOD_BIAS_EXT:
+ if (pname == GL_TEXTURE_LOD_BIAS_EXT) {
if (texUnit->LodBias == param[0])
return;
FLUSH_VERTICES(ctx, _NEW_TEXTURE);
texUnit->LodBias = CLAMP(param[0], -ctx->Const.MaxTextureLodBias,
ctx->Const.MaxTextureLodBias);
- break;
- default:
+ }
+ else {
TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname);
return;
}
}
+ else if (target == GL_POINT_SPRITE_NV) {
+ /* GL_NV_point_sprite */
+ if (!ctx->Extensions.NV_point_sprite) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glTexEnv(target)" );
+ return;
+ }
+ if (pname == GL_COORD_REPLACE_NV) {
+ const GLenum value = (GLenum) param[0];
+ if (value == GL_TRUE || value == GL_FALSE) {
+ /* It's kind of weird to set point state via glTexEnv,
+ * but that's what the spec calls for.
+ */
+ const GLboolean state = (GLboolean) value;
+ if (ctx->Point.CoordReplace[ctx->Texture.CurrentUnit] == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_POINT);
+ ctx->Point.CoordReplace[ctx->Texture.CurrentUnit] = state;
+ }
+ else {
+ _mesa_error( ctx, GL_INVALID_VALUE, "glTexEnv(param)" );
+ return;
+ }
+ }
+ else {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glTexEnv(pname)" );
+ return;
+ }
+ }
else {
_mesa_error( ctx, GL_INVALID_ENUM, "glTexEnv(target)" );
return;
@@ -482,176 +510,205 @@ _mesa_GetTexEnvfv( GLenum target, GLenum pname, GLfloat *params )
const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
ASSERT_OUTSIDE_BEGIN_END(ctx);
- if (target!=GL_TEXTURE_ENV) {
- _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnvfv(target)" );
- return;
+ if (target == GL_TEXTURE_ENV) {
+ switch (pname) {
+ case GL_TEXTURE_ENV_MODE:
+ *params = ENUM_TO_FLOAT(texUnit->EnvMode);
+ break;
+ case GL_TEXTURE_ENV_COLOR:
+ COPY_4FV( params, texUnit->EnvColor );
+ break;
+ case GL_COMBINE_RGB_EXT:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ *params = (GLfloat) texUnit->CombineModeRGB;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
+ }
+ break;
+ case GL_COMBINE_ALPHA_EXT:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ *params = (GLfloat) texUnit->CombineModeA;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
+ }
+ break;
+ case GL_SOURCE0_RGB_EXT:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ *params = (GLfloat) texUnit->CombineSourceRGB[0];
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
+ }
+ break;
+ case GL_SOURCE1_RGB_EXT:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ *params = (GLfloat) texUnit->CombineSourceRGB[1];
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
+ }
+ break;
+ case GL_SOURCE2_RGB_EXT:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ *params = (GLfloat) texUnit->CombineSourceRGB[2];
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
+ }
+ break;
+ case GL_SOURCE0_ALPHA_EXT:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ *params = (GLfloat) texUnit->CombineSourceA[0];
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
+ }
+ break;
+ case GL_SOURCE1_ALPHA_EXT:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ *params = (GLfloat) texUnit->CombineSourceA[1];
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
+ }
+ break;
+ case GL_SOURCE2_ALPHA_EXT:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ *params = (GLfloat) texUnit->CombineSourceA[2];
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
+ }
+ break;
+ case GL_OPERAND0_RGB_EXT:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ *params = (GLfloat) texUnit->CombineOperandRGB[0];
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
+ }
+ break;
+ case GL_OPERAND1_RGB_EXT:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ *params = (GLfloat) texUnit->CombineOperandRGB[1];
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
+ }
+ break;
+ case GL_OPERAND2_RGB_EXT:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ *params = (GLfloat) texUnit->CombineOperandRGB[2];
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
+ }
+ break;
+ case GL_OPERAND0_ALPHA_EXT:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ *params = (GLfloat) texUnit->CombineOperandA[0];
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
+ }
+ break;
+ case GL_OPERAND1_ALPHA_EXT:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ *params = (GLfloat) texUnit->CombineOperandA[1];
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
+ }
+ break;
+ case GL_OPERAND2_ALPHA_EXT:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ *params = (GLfloat) texUnit->CombineOperandA[2];
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
+ }
+ break;
+ case GL_RGB_SCALE_EXT:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ if (texUnit->CombineScaleShiftRGB == 0)
+ *params = 1.0;
+ else if (texUnit->CombineScaleShiftRGB == 1)
+ *params = 2.0;
+ else
+ *params = 4.0;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
+ return;
+ }
+ break;
+ case GL_ALPHA_SCALE:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ if (texUnit->CombineScaleShiftA == 0)
+ *params = 1.0;
+ else if (texUnit->CombineScaleShiftA == 1)
+ *params = 2.0;
+ else
+ *params = 4.0;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
+ return;
+ }
+ break;
+ default:
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)" );
+ }
}
-
- switch (pname) {
- case GL_TEXTURE_ENV_MODE:
- *params = ENUM_TO_FLOAT(texUnit->EnvMode);
- break;
- case GL_TEXTURE_ENV_COLOR:
- COPY_4FV( params, texUnit->EnvColor );
- break;
- case GL_COMBINE_RGB_EXT:
- if (ctx->Extensions.EXT_texture_env_combine ||
- ctx->Extensions.ARB_texture_env_combine) {
- *params = (GLfloat) texUnit->CombineModeRGB;
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
- }
- break;
- case GL_COMBINE_ALPHA_EXT:
- if (ctx->Extensions.EXT_texture_env_combine ||
- ctx->Extensions.ARB_texture_env_combine) {
- *params = (GLfloat) texUnit->CombineModeA;
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
- }
- break;
- case GL_SOURCE0_RGB_EXT:
- if (ctx->Extensions.EXT_texture_env_combine ||
- ctx->Extensions.ARB_texture_env_combine) {
- *params = (GLfloat) texUnit->CombineSourceRGB[0];
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
- }
- break;
- case GL_SOURCE1_RGB_EXT:
- if (ctx->Extensions.EXT_texture_env_combine ||
- ctx->Extensions.ARB_texture_env_combine) {
- *params = (GLfloat) texUnit->CombineSourceRGB[1];
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
- }
- break;
- case GL_SOURCE2_RGB_EXT:
- if (ctx->Extensions.EXT_texture_env_combine ||
- ctx->Extensions.ARB_texture_env_combine) {
- *params = (GLfloat) texUnit->CombineSourceRGB[2];
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
- }
- break;
- case GL_SOURCE0_ALPHA_EXT:
- if (ctx->Extensions.EXT_texture_env_combine ||
- ctx->Extensions.ARB_texture_env_combine) {
- *params = (GLfloat) texUnit->CombineSourceA[0];
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
- }
- break;
- case GL_SOURCE1_ALPHA_EXT:
- if (ctx->Extensions.EXT_texture_env_combine ||
- ctx->Extensions.ARB_texture_env_combine) {
- *params = (GLfloat) texUnit->CombineSourceA[1];
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
- }
- break;
- case GL_SOURCE2_ALPHA_EXT:
- if (ctx->Extensions.EXT_texture_env_combine ||
- ctx->Extensions.ARB_texture_env_combine) {
- *params = (GLfloat) texUnit->CombineSourceA[2];
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
- }
- break;
- case GL_OPERAND0_RGB_EXT:
- if (ctx->Extensions.EXT_texture_env_combine ||
- ctx->Extensions.ARB_texture_env_combine) {
- *params = (GLfloat) texUnit->CombineOperandRGB[0];
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
- }
- break;
- case GL_OPERAND1_RGB_EXT:
- if (ctx->Extensions.EXT_texture_env_combine ||
- ctx->Extensions.ARB_texture_env_combine) {
- *params = (GLfloat) texUnit->CombineOperandRGB[1];
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
- }
- break;
- case GL_OPERAND2_RGB_EXT:
- if (ctx->Extensions.EXT_texture_env_combine ||
- ctx->Extensions.ARB_texture_env_combine) {
- *params = (GLfloat) texUnit->CombineOperandRGB[2];
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
- }
- break;
- case GL_OPERAND0_ALPHA_EXT:
- if (ctx->Extensions.EXT_texture_env_combine ||
- ctx->Extensions.ARB_texture_env_combine) {
- *params = (GLfloat) texUnit->CombineOperandA[0];
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
- }
- break;
- case GL_OPERAND1_ALPHA_EXT:
- if (ctx->Extensions.EXT_texture_env_combine ||
- ctx->Extensions.ARB_texture_env_combine) {
- *params = (GLfloat) texUnit->CombineOperandA[1];
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
- }
- break;
- case GL_OPERAND2_ALPHA_EXT:
- if (ctx->Extensions.EXT_texture_env_combine ||
- ctx->Extensions.ARB_texture_env_combine) {
- *params = (GLfloat) texUnit->CombineOperandA[2];
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
- }
- break;
- case GL_RGB_SCALE_EXT:
- if (ctx->Extensions.EXT_texture_env_combine ||
- ctx->Extensions.ARB_texture_env_combine) {
- if (texUnit->CombineScaleShiftRGB == 0)
- *params = 1.0;
- else if (texUnit->CombineScaleShiftRGB == 1)
- *params = 2.0;
- else
- *params = 4.0;
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
- return;
- }
- break;
- case GL_ALPHA_SCALE:
- if (ctx->Extensions.EXT_texture_env_combine ||
- ctx->Extensions.ARB_texture_env_combine) {
- if (texUnit->CombineScaleShiftA == 0)
- *params = 1.0;
- else if (texUnit->CombineScaleShiftA == 1)
- *params = 2.0;
- else
- *params = 4.0;
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
- return;
- }
- break;
- default:
+ else if (target == GL_TEXTURE_FILTER_CONTROL_EXT) {
+ /* GL_EXT_texture_lod_bias */
+ if (!ctx->Extensions.EXT_texture_lod_bias) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnvfv(target)" );
+ return;
+ }
+ if (pname == GL_TEXTURE_LOD_BIAS_EXT) {
+ *params = texUnit->LodBias;
+ }
+ else {
_mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)" );
+ return;
+ }
+ }
+ else if (target == GL_POINT_SPRITE_NV) {
+ /* GL_NV_point_sprite */
+ if (!ctx->Extensions.NV_point_sprite) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnvfv(target)" );
+ return;
+ }
+ if (pname == GL_COORD_REPLACE_NV) {
+ *params = (GLfloat) ctx->Point.CoordReplace[ctx->Texture.CurrentUnit];
+ }
+ else {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)" );
+ return;
+ }
+ }
+ else {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnvfv(target)" );
+ return;
}
}
@@ -663,179 +720,208 @@ _mesa_GetTexEnviv( GLenum target, GLenum pname, GLint *params )
const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
ASSERT_OUTSIDE_BEGIN_END(ctx);
- if (target != GL_TEXTURE_ENV) {
- _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnviv(target)" );
- return;
+ if (target == GL_TEXTURE_ENV) {
+ switch (pname) {
+ case GL_TEXTURE_ENV_MODE:
+ *params = (GLint) texUnit->EnvMode;
+ break;
+ case GL_TEXTURE_ENV_COLOR:
+ params[0] = FLOAT_TO_INT( texUnit->EnvColor[0] );
+ params[1] = FLOAT_TO_INT( texUnit->EnvColor[1] );
+ params[2] = FLOAT_TO_INT( texUnit->EnvColor[2] );
+ params[3] = FLOAT_TO_INT( texUnit->EnvColor[3] );
+ break;
+ case GL_COMBINE_RGB_EXT:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ *params = (GLint) texUnit->CombineModeRGB;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
+ }
+ break;
+ case GL_COMBINE_ALPHA_EXT:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ *params = (GLint) texUnit->CombineModeA;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
+ }
+ break;
+ case GL_SOURCE0_RGB_EXT:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ *params = (GLint) texUnit->CombineSourceRGB[0];
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
+ }
+ break;
+ case GL_SOURCE1_RGB_EXT:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ *params = (GLint) texUnit->CombineSourceRGB[1];
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
+ }
+ break;
+ case GL_SOURCE2_RGB_EXT:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ *params = (GLint) texUnit->CombineSourceRGB[2];
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
+ }
+ break;
+ case GL_SOURCE0_ALPHA_EXT:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ *params = (GLint) texUnit->CombineSourceA[0];
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
+ }
+ break;
+ case GL_SOURCE1_ALPHA_EXT:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ *params = (GLint) texUnit->CombineSourceA[1];
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
+ }
+ break;
+ case GL_SOURCE2_ALPHA_EXT:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ *params = (GLint) texUnit->CombineSourceA[2];
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
+ }
+ break;
+ case GL_OPERAND0_RGB_EXT:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ *params = (GLint) texUnit->CombineOperandRGB[0];
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
+ }
+ break;
+ case GL_OPERAND1_RGB_EXT:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ *params = (GLint) texUnit->CombineOperandRGB[1];
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
+ }
+ break;
+ case GL_OPERAND2_RGB_EXT:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ *params = (GLint) texUnit->CombineOperandRGB[2];
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
+ }
+ break;
+ case GL_OPERAND0_ALPHA_EXT:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ *params = (GLint) texUnit->CombineOperandA[0];
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
+ }
+ break;
+ case GL_OPERAND1_ALPHA_EXT:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ *params = (GLint) texUnit->CombineOperandA[1];
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
+ }
+ break;
+ case GL_OPERAND2_ALPHA_EXT:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ *params = (GLint) texUnit->CombineOperandA[2];
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
+ }
+ break;
+ case GL_RGB_SCALE_EXT:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ if (texUnit->CombineScaleShiftRGB == 0)
+ *params = 1;
+ else if (texUnit->CombineScaleShiftRGB == 1)
+ *params = 2;
+ else
+ *params = 4;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
+ return;
+ }
+ break;
+ case GL_ALPHA_SCALE:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ if (texUnit->CombineScaleShiftA == 0)
+ *params = 1;
+ else if (texUnit->CombineScaleShiftA == 1)
+ *params = 2;
+ else
+ *params = 4;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
+ return;
+ }
+ break;
+ default:
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)" );
+ }
}
-
- switch (pname) {
- case GL_TEXTURE_ENV_MODE:
- *params = (GLint) texUnit->EnvMode;
- break;
- case GL_TEXTURE_ENV_COLOR:
- params[0] = FLOAT_TO_INT( texUnit->EnvColor[0] );
- params[1] = FLOAT_TO_INT( texUnit->EnvColor[1] );
- params[2] = FLOAT_TO_INT( texUnit->EnvColor[2] );
- params[3] = FLOAT_TO_INT( texUnit->EnvColor[3] );
- break;
- case GL_COMBINE_RGB_EXT:
- if (ctx->Extensions.EXT_texture_env_combine ||
- ctx->Extensions.ARB_texture_env_combine) {
- *params = (GLint) texUnit->CombineModeRGB;
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
- }
- break;
- case GL_COMBINE_ALPHA_EXT:
- if (ctx->Extensions.EXT_texture_env_combine ||
- ctx->Extensions.ARB_texture_env_combine) {
- *params = (GLint) texUnit->CombineModeA;
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
- }
- break;
- case GL_SOURCE0_RGB_EXT:
- if (ctx->Extensions.EXT_texture_env_combine ||
- ctx->Extensions.ARB_texture_env_combine) {
- *params = (GLint) texUnit->CombineSourceRGB[0];
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
- }
- break;
- case GL_SOURCE1_RGB_EXT:
- if (ctx->Extensions.EXT_texture_env_combine ||
- ctx->Extensions.ARB_texture_env_combine) {
- *params = (GLint) texUnit->CombineSourceRGB[1];
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
- }
- break;
- case GL_SOURCE2_RGB_EXT:
- if (ctx->Extensions.EXT_texture_env_combine ||
- ctx->Extensions.ARB_texture_env_combine) {
- *params = (GLint) texUnit->CombineSourceRGB[2];
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
- }
- break;
- case GL_SOURCE0_ALPHA_EXT:
- if (ctx->Extensions.EXT_texture_env_combine ||
- ctx->Extensions.ARB_texture_env_combine) {
- *params = (GLint) texUnit->CombineSourceA[0];
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
- }
- break;
- case GL_SOURCE1_ALPHA_EXT:
- if (ctx->Extensions.EXT_texture_env_combine ||
- ctx->Extensions.ARB_texture_env_combine) {
- *params = (GLint) texUnit->CombineSourceA[1];
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
- }
- break;
- case GL_SOURCE2_ALPHA_EXT:
- if (ctx->Extensions.EXT_texture_env_combine ||
- ctx->Extensions.ARB_texture_env_combine) {
- *params = (GLint) texUnit->CombineSourceA[2];
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
- }
- break;
- case GL_OPERAND0_RGB_EXT:
- if (ctx->Extensions.EXT_texture_env_combine ||
- ctx->Extensions.ARB_texture_env_combine) {
- *params = (GLint) texUnit->CombineOperandRGB[0];
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
- }
- break;
- case GL_OPERAND1_RGB_EXT:
- if (ctx->Extensions.EXT_texture_env_combine ||
- ctx->Extensions.ARB_texture_env_combine) {
- *params = (GLint) texUnit->CombineOperandRGB[1];
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
- }
- break;
- case GL_OPERAND2_RGB_EXT:
- if (ctx->Extensions.EXT_texture_env_combine ||
- ctx->Extensions.ARB_texture_env_combine) {
- *params = (GLint) texUnit->CombineOperandRGB[2];
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
- }
- break;
- case GL_OPERAND0_ALPHA_EXT:
- if (ctx->Extensions.EXT_texture_env_combine ||
- ctx->Extensions.ARB_texture_env_combine) {
- *params = (GLint) texUnit->CombineOperandA[0];
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
- }
- break;
- case GL_OPERAND1_ALPHA_EXT:
- if (ctx->Extensions.EXT_texture_env_combine ||
- ctx->Extensions.ARB_texture_env_combine) {
- *params = (GLint) texUnit->CombineOperandA[1];
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
- }
- break;
- case GL_OPERAND2_ALPHA_EXT:
- if (ctx->Extensions.EXT_texture_env_combine ||
- ctx->Extensions.ARB_texture_env_combine) {
- *params = (GLint) texUnit->CombineOperandA[2];
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
- }
- break;
- case GL_RGB_SCALE_EXT:
- if (ctx->Extensions.EXT_texture_env_combine ||
- ctx->Extensions.ARB_texture_env_combine) {
- if (texUnit->CombineScaleShiftRGB == 0)
- *params = 1;
- else if (texUnit->CombineScaleShiftRGB == 1)
- *params = 2;
- else
- *params = 4;
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
- return;
- }
- break;
- case GL_ALPHA_SCALE:
- if (ctx->Extensions.EXT_texture_env_combine ||
- ctx->Extensions.ARB_texture_env_combine) {
- if (texUnit->CombineScaleShiftA == 0)
- *params = 1;
- else if (texUnit->CombineScaleShiftA == 1)
- *params = 2;
- else
- *params = 4;
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
- return;
- }
- break;
- default:
+ else if (target == GL_TEXTURE_FILTER_CONTROL_EXT) {
+ /* GL_EXT_texture_lod_bias */
+ if (!ctx->Extensions.EXT_texture_lod_bias) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnviv(target)" );
+ return;
+ }
+ if (pname == GL_TEXTURE_LOD_BIAS_EXT) {
+ *params = (GLint) texUnit->LodBias;
+ }
+ else {
_mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)" );
+ return;
+ }
+ }
+ else if (target == GL_POINT_SPRITE_NV) {
+ /* GL_NV_point_sprite */
+ if (!ctx->Extensions.NV_point_sprite) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnviv(target)" );
+ return;
+ }
+ if (pname == GL_COORD_REPLACE_NV) {
+ *params = (GLint) ctx->Point.CoordReplace[ctx->Texture.CurrentUnit];
+ }
+ else {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)" );
+ return;
+ }
+ }
+ else {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnviv(target)" );
+ return;
}
}
diff --git a/src/mesa/swrast/s_points.c b/src/mesa/swrast/s_points.c
index 2eac602f1b..d84fc7bd94 100644
--- a/src/mesa/swrast/s_points.c
+++ b/src/mesa/swrast/s_points.c
@@ -1,4 +1,4 @@
-/* $Id: s_points.c,v 1.17 2002/02/02 17:24:11 brianp Exp $ */
+/* $Id: s_points.c,v 1.18 2002/05/27 17:04:53 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -147,12 +147,12 @@
/*
* Sprite (textured point)
*/
-#define FLAGS (RGBA | TEXTURE | SPRITE)
+#define FLAGS (RGBA | SPRITE)
#define NAME sprite_point
#include "s_pointtemp.h"
-#define FLAGS (RGBA | ATTENUATE | TEXTURE | SPRITE)
+#define FLAGS (RGBA | ATTENUATE | SPRITE)
#define NAME atten_sprite_point
#include "s_pointtemp.h"
@@ -201,7 +201,8 @@ _swrast_choose_point( GLcontext *ctx )
GLboolean rgbMode = ctx->Visual.rgbMode;
if (ctx->RenderMode==GL_RENDER) {
- if (ctx->Point.SpriteMode) {
+ if (ctx->Point.PointSprite) {
+ /* GL_NV_point_sprite */
/* XXX this might not be good enough */
if (ctx->Point._Attenuated)
USE(atten_sprite_point);
diff --git a/src/mesa/swrast/s_pointtemp.h b/src/mesa/swrast/s_pointtemp.h
index 2e0618587e..1865e1a7d3 100644
--- a/src/mesa/swrast/s_pointtemp.h
+++ b/src/mesa/swrast/s_pointtemp.h
@@ -1,4 +1,4 @@
-/* $Id: s_pointtemp.h,v 1.15 2002/04/19 14:05:50 brianp Exp $ */
+/* $Id: s_pointtemp.h,v 1.16 2002/05/27 17:04:53 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -36,7 +36,7 @@
* SPECULAR = do separate specular color
* LARGE = do points with diameter > 1 pixel
* ATTENUATE = compute point size attenuation
- * SPRITE = GL_MESA_sprite_point
+ * SPRITE = GL_NV_point_sprite
*
* Notes: LARGE and ATTENUATE are exclusive of each other.
* TEXTURE requires RGBA
@@ -64,7 +64,7 @@ NAME ( GLcontext *ctx, const SWvertex *vert )
#if FLAGS & TEXTURE
GLuint u;
#endif
-#if FLAGS & (ATTENUATE | LARGE | SMOOTH)
+#if FLAGS & (ATTENUATE | LARGE | SMOOTH | SPRITE)
GLfloat size;
#endif
#if FLAGS & ATTENUATE
@@ -93,8 +93,10 @@ NAME ( GLcontext *ctx, const SWvertex *vert )
#if (FLAGS & RGBA)
#if (FLAGS & SMOOTH)
+ /* because we need per-fragment alpha values */
span->arrayMask |= SPAN_RGBA;
#else
+ /* same RGBA for all fragments */
span->interpMask |= SPAN_RGBA;
span->red = ChanToFixed(vert->color[0]);
span->green = ChanToFixed(vert->color[1]);
@@ -116,6 +118,7 @@ NAME ( GLcontext *ctx, const SWvertex *vert )
span->indexStep = 0;
#endif
#if FLAGS & TEXTURE
+ /* but not used for sprite mode */
span->interpMask |= SPAN_TEXTURE;
for (u = 0; u < ctx->Const.MaxTextureUnits; u++) {
if (ctx->Texture.Unit[u]._ReallyEnabled) {
@@ -135,6 +138,9 @@ NAME ( GLcontext *ctx, const SWvertex *vert )
#if FLAGS & SMOOTH
span->arrayMask |= SPAN_COVERAGE;
#endif
+#if FLAGS & SPRITE
+ span->arrayMask |= SPAN_TEXTURE;
+#endif
#if FLAGS & ATTENUATE
if (vert->pointSize >= ctx->Point.Threshold) {
@@ -146,68 +152,11 @@ NAME ( GLcontext *ctx, const SWvertex *vert )
size = MAX2(ctx->Point.Threshold, ctx->Point.MinSize);
alphaAtten = dsize * dsize;
}
-#elif FLAGS & (LARGE | SMOOTH)
+#elif FLAGS & (LARGE | SMOOTH | SPRITE)
size = ctx->Point._Size;
#endif
-#if FLAGS & SPRITE
- {
- SWcontext *swctx = SWRAST_CONTEXT(ctx);
- const GLfloat radius = 0.5F * vert->pointSize; /* XXX threshold, alpha */
- SWvertex v0, v1, v2, v3;
- GLuint unit;
-
-#if (FLAGS & RGBA) && (FLAGS & SMOOTH)
- (void) red;
- (void) green;
- (void) blue;
- (void) alpha;
-#endif
-
- /* lower left corner */
- v0 = *vert;
- v0.win[0] -= radius;
- v0.win[1] -= radius;
-
- /* lower right corner */
- v1 = *vert;
- v1.win[0] += radius;
- v1.win[1] -= radius;
-
- /* upper right corner */
- v2 = *vert;
- v2.win[0] += radius;
- v2.win[1] += radius;
-
- /* upper left corner */
- v3 = *vert;
- v3.win[0] -= radius;
- v3.win[1] += radius;
-
- for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) {
- if (ctx->Texture.Unit[unit]._ReallyEnabled) {
- v0.texcoord[unit][0] = 0.0;
- v0.texcoord[unit][1] = 0.0;
- v1.texcoord[unit][0] = 1.0;
- v1.texcoord[unit][1] = 0.0;
- v2.texcoord[unit][0] = 1.0;
- v2.texcoord[unit][1] = 1.0;
- v3.texcoord[unit][0] = 0.0;
- v3.texcoord[unit][1] = 1.0;
- }
- }
-
- /* XXX if radius < threshold, attenuate alpha? */
-
- /* XXX need to implement clipping!!! */
-
- /* render */
- swctx->Triangle(ctx, &v0, &v1, &v2);
- swctx->Triangle(ctx, &v0, &v2, &v3);
- }
-
-#elif FLAGS & (LARGE | ATTENUATE | SMOOTH)
-
+#if FLAGS & (LARGE | ATTENUATE | SMOOTH | SPRITE)
{
GLint x, y;
const GLfloat radius = 0.5F * size;
@@ -249,6 +198,9 @@ NAME ( GLcontext *ctx, const SWvertex *vert )
(void) radius;
for (y = ymin; y <= ymax; y++) {
for (x = xmin; x <= xmax; x++) {
+#if FLAGS & SPRITE
+ GLuint u;
+#endif
#if FLAGS & SMOOTH
/* compute coverage */
const GLfloat dx = x - vert->win[0] + 0.5F;
@@ -284,10 +236,32 @@ NAME ( GLcontext *ctx, const SWvertex *vert )
count++;
} /*if*/
#else /*SMOOTH*/
- /* not smooth (square points */
+ /* not smooth (square points) */
span->xArray[count] = x;
span->yArray[count] = y;
span->zArray[count] = z;
+#if FLAGS & SPRITE
+ for (u = 0; u < ctx->Const.MaxTextureUnits; u++) {
+ if (ctx->Texture.Unit[u]._ReallyEnabled) {
+ if (ctx->Point.CoordReplace[u]) {
+ GLfloat s = 0.5F + (x + 0.5F - vert->win[0]) / size;
+ GLfloat t = 0.5F - (y + 0.5F - vert->win[1]) / size;
+ span->texcoords[u][count][0] = s;
+ span->texcoords[u][count][1] = t;
+ span->texcoords[u][count][3] = 1.0F;
+ if (ctx->Point.SpriteRMode == GL_ZERO)
+ span->texcoords[u][count][2] = 0.0F;
+ else if (ctx->Point.SpriteRMode == GL_S)
+ span->texcoords[u][count][2] = vert->texcoord[u][0];
+ else /* GL_R */
+ span->texcoords[u][count][2] = vert->texcoord[u][2];
+ }
+ else {
+ COPY_4V(span->texcoords[u][count], vert->texcoord[u]);
+ }
+ }
+ }
+#endif /*SPRITE*/
count++;
#endif /*SMOOTH*/
} /*for x*/
@@ -295,7 +269,7 @@ NAME ( GLcontext *ctx, const SWvertex *vert )
span->end = count;
}
-#else /* LARGE || ATTENUATE || SMOOTH*/
+#else /* LARGE | ATTENUATE | SMOOTH | SPRITE */
{
/* size == 1 */
@@ -309,7 +283,7 @@ NAME ( GLcontext *ctx, const SWvertex *vert )
ASSERT(span->end > 0);
-#if FLAGS & TEXTURE
+#if FLAGS & (TEXTURE | SPRITE)
if (ctx->Texture._ReallyEnabled)
_mesa_write_texture_span(ctx, span);
else