mechanism.
LogicOp state change callback
-/* $Id: glxapi.c,v 1.11 2000/02/23 23:09:12 brianp Exp $ */
+/* $Id: glxapi.c,v 1.12 2000/02/25 03:55:40 keithw Exp $ */
/*
* Mesa 3-D graphics library
void glXCopyContext(Display *dpy, GLXContext src, GLXContext dst,
- unsigned long mask)
+ GLuint mask)
{
struct _glxapi_table *t = get_dispatch(dpy);
if (!t)
-/* $Id: attrib.c,v 1.15 2000/02/02 22:03:31 brianp Exp $ */
+/* $Id: attrib.c,v 1.16 2000/02/25 03:55:39 keithw Exp $ */
/*
* Mesa 3-D graphics library
GLubyte oldAlphaRef = ctx->Color.AlphaRef;
GLenum oldBlendSrc = ctx->Color.BlendSrcRGB;
GLenum oldBlendDst = ctx->Color.BlendDstRGB;
+ GLenum oldLogicOp = ctx->Color.LogicOp;
MEMCPY( &ctx->Color, attr->data,
sizeof(struct gl_colorbuffer_attrib) );
if (ctx->Color.DrawBuffer != oldDrawBuffer) {
ctx->Driver.BlendFunc)
(*ctx->Driver.BlendFunc)( ctx, ctx->Color.BlendSrcRGB,
ctx->Color.BlendDstRGB);
+ if (ctx->Color.LogicOp != oldLogicOp &&
+ ctx->Driver.LogicOpcode)
+ ctx->Driver.LogicOpcode( ctx, ctx->Color.LogicOp );
}
break;
case GL_CURRENT_BIT:
-/* $Id: clip.c,v 1.5 1999/11/11 01:22:25 brianp Exp $ */
+/* $Id: clip.c,v 1.6 2000/02/25 03:55:39 keithw Exp $ */
/*
* Mesa 3-D graphics library
+#define CLIP_RGBA0 0x1
+#define CLIP_RGBA1 0x2
+#define CLIP_TEX0 0x4
+#define CLIP_TEX1 0x8
+#define CLIP_INDEX0 0x10
+#define CLIP_INDEX1 0x20
+#define CLIP_FOG_COORD 0x40
+
+
/* Linear interpolation between A and B: */
#define LINTERP( T, A, B ) ( (A) + (T) * ( (B) - (A) ) )
} while(0)
-
-
-#define CLIP_RGBA0 0x1
-#define CLIP_RGBA1 0x2
-#define CLIP_TEX0 0x4
-#define CLIP_TEX1 0x8
-#define CLIP_INDEX0 0x10
-#define CLIP_INDEX1 0x20
-
-static clip_interp_func clip_interp_tab[0x40];
+static clip_interp_func clip_interp_tab[0x80];
#define IND 0
#define NAME clip_nil
#define NAME clipINDEX0_INDEX1
#include "interp_tmp.h"
+#define IND (CLIP_FOG_COORD)
+#define NAME clip_FOG
+#include "interp_tmp.h"
+
+#define IND (CLIP_RGBA0|CLIP_FOG_COORD)
+#define NAME clipRGBA0_FOG
+#include "interp_tmp.h"
+
+#define IND (CLIP_RGBA0|CLIP_RGBA1|CLIP_FOG_COORD)
+#define NAME clipRGBA0_RGBA1_FOG
+#include "interp_tmp.h"
+
+#define IND (CLIP_TEX0|CLIP_RGBA0|CLIP_FOG_COORD)
+#define NAME clipTEX0_RGBA0_FOG
+#include "interp_tmp.h"
+
+#define IND (CLIP_TEX0|CLIP_RGBA0|CLIP_RGBA1|CLIP_FOG_COORD)
+#define NAME clipTEX0_RGBA0_RGBA1_FOG
+#include "interp_tmp.h"
+
+#define IND (CLIP_TEX1|CLIP_TEX0|CLIP_RGBA0|CLIP_FOG_COORD)
+#define NAME clipTEX1_TEX0_RGBA0_FOG
+#include "interp_tmp.h"
+
+#define IND (CLIP_TEX0|CLIP_FOG_COORD)
+#define NAME clipTEX0_FOG
+#include "interp_tmp.h"
+
+#define IND (CLIP_TEX1|CLIP_TEX0|CLIP_FOG_COORD)
+#define NAME clipTEX1_TEX0_FOG
+#include "interp_tmp.h"
+
+#define IND (CLIP_TEX1|CLIP_TEX0|CLIP_RGBA0|CLIP_RGBA1|CLIP_FOG_COORD)
+#define NAME clipTEX1_TEX0_RGBA0_RGBA1_FOG
+#include "interp_tmp.h"
+
+#define IND (CLIP_INDEX0|CLIP_FOG_COORD)
+#define NAME clipINDEX0_FOG
+#include "interp_tmp.h"
+
+#define IND (CLIP_INDEX0|CLIP_INDEX1|CLIP_FOG_COORD)
+#define NAME clipINDEX0_INDEX1_FOG
+#include "interp_tmp.h"
+
mask |= CLIP_INDEX1;
}
+ if (ctx->FogMode == FOG_FRAGMENT && (ctx->TriangleCaps & DD_CLIP_FOG_COORD))
+ mask |= CLIP_FOG_COORD;
ctx->ClipInterpFunc = clip_interp_tab[mask];
ctx->poly_clip_tab = gl_poly_clip_tab[0];
clip_interp_tab[CLIP_TEX1|CLIP_TEX0|CLIP_RGBA0] = clipTEX1_TEX0_RGBA0;
clip_interp_tab[CLIP_TEX1|CLIP_TEX0|CLIP_RGBA0|CLIP_RGBA1] =
clipTEX1_TEX0_RGBA0_RGBA1;
-
clip_interp_tab[CLIP_TEX0] = clipTEX0;
clip_interp_tab[CLIP_TEX1|CLIP_TEX0] = clipTEX1_TEX0;
-
clip_interp_tab[CLIP_INDEX0] = clipINDEX0;
clip_interp_tab[CLIP_INDEX0|CLIP_INDEX1] = clipINDEX0_INDEX1;
+
+ clip_interp_tab[CLIP_FOG_COORD] = clip_FOG;
+ clip_interp_tab[CLIP_RGBA0|CLIP_FOG_COORD] = clipRGBA0_FOG;
+ clip_interp_tab[CLIP_RGBA0|CLIP_RGBA1|CLIP_FOG_COORD] = clipRGBA0_RGBA1_FOG;
+ clip_interp_tab[CLIP_TEX0|CLIP_RGBA0|CLIP_FOG_COORD] = clipTEX0_RGBA0_FOG;
+ clip_interp_tab[CLIP_TEX0|CLIP_RGBA0|CLIP_RGBA1|CLIP_FOG_COORD] = clipTEX0_RGBA0_RGBA1_FOG;
+ clip_interp_tab[CLIP_TEX1|CLIP_TEX0|CLIP_RGBA0|CLIP_FOG_COORD] = clipTEX1_TEX0_RGBA0_FOG;
+ clip_interp_tab[CLIP_TEX1|CLIP_TEX0|CLIP_RGBA0|CLIP_RGBA1|CLIP_FOG_COORD] =
+ clipTEX1_TEX0_RGBA0_RGBA1_FOG;
+ clip_interp_tab[CLIP_TEX0|CLIP_FOG_COORD] = clipTEX0_FOG;
+ clip_interp_tab[CLIP_TEX1|CLIP_TEX0|CLIP_FOG_COORD] = clipTEX1_TEX0_FOG;
+ clip_interp_tab[CLIP_INDEX0|CLIP_FOG_COORD] = clipINDEX0_FOG;
+ clip_interp_tab[CLIP_INDEX0|CLIP_INDEX1|CLIP_FOG_COORD] = clipINDEX0_INDEX1_FOG;
}
-/* $Id: dd.h,v 1.10 2000/02/17 20:53:48 brianp Exp $ */
+/* $Id: dd.h,v 1.11 2000/02/25 03:55:39 keithw Exp $ */
/*
* Mesa 3-D graphics library
void (*Lightfv)(GLcontext *ctx, GLenum light,
GLenum pname, const GLfloat *params, GLint nparams );
void (*LightModelfv)(GLcontext *ctx, GLenum pname, const GLfloat *params);
+ void (*LogicOpcode)(GLcontext *ctx, GLenum opcode);
void (*PolygonMode)(GLcontext *ctx, GLenum face, GLenum mode);
void (*Scissor)(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h);
void (*ShadeModel)(GLcontext *ctx, GLenum mode);
-/* $Id: dlist.c,v 1.31 2000/02/24 22:04:03 brianp Exp $ */
+/* $Id: dlist.c,v 1.32 2000/02/25 03:55:39 keithw Exp $ */
/*
* Mesa 3-D graphics library
(MESA_VERBOSE & VERBOSE_IMMEDIATE))
gl_print_cassette( (struct immediate *) n[1].data );
- if (0)
- fprintf(stderr, "Run cassette %d, rows %d..%d, beginstate %x\n",
+ if (MESA_VERBOSE & VERBOSE_DISPLAY_LIST) {
+ fprintf(stderr, "Run cassette %d, rows %d..%d, beginstate %x ",
IM->id,
IM->Start, IM->Count, IM->BeginState);
+ gl_print_vert_flags("orflag", IM->OrFlag);
+ }
gl_fixup_cassette( ctx, (struct immediate *) n[1].data );
gl_execute_cassette( ctx, (struct immediate *) n[1].data );
((struct immediate *) n[1].data)->id,
n[2].ui,
n[3].ui);
+ gl_print_cassette( (struct immediate *) n[1].data );
break;
case OPCODE_CONTINUE:
fprintf(f,"DISPLAY-LIST-CONTINUE\n");
-/* $Id: extensions.c,v 1.17 2000/02/23 22:31:35 brianp Exp $ */
+/* $Id: extensions.c,v 1.18 2000/02/25 03:55:40 keithw Exp $ */
/*
* Mesa 3-D graphics library
{ DEFAULT_ON, "GL_EXT_texture3D" },
{ ALWAYS_ENABLED, "GL_MESA_window_pos" },
{ ALWAYS_ENABLED, "GL_MESA_resize_buffers" },
- { ALWAYS_ENABLED, "GL_EXT_shared_texture_palette" },
+ { DEFAULT_ON, "GL_EXT_shared_texture_palette" },
{ ALWAYS_ENABLED, "GL_EXT_rescale_normal" },
{ ALWAYS_ENABLED, "GL_EXT_abgr" },
{ ALWAYS_ENABLED, "GL_SGIS_texture_edge_clamp" },
{ ALWAYS_ENABLED, "GL_NV_texgen_reflection" },
{ DEFAULT_ON, "GL_PGI_misc_hints" },
{ DEFAULT_ON, "GL_EXT_compiled_vertex_array" },
- { DEFAULT_OFF, "GL_EXT_vertex_array_set" },
{ DEFAULT_ON, "GL_EXT_clip_volume_hint" },
{ DEFAULT_ON, "GL_EXT_texture_env_add" },
{ ALWAYS_ENABLED, "GL_ARB_tranpose_matrix" },
+ { DEFAULT_OFF, "GL_EXT_vertex_array_set" },
+ { DEFAULT_OFF, "GL_EXT_texture_env" },
};
-/* $Id: fog.c,v 1.6 2000/02/02 22:22:59 brianp Exp $ */
+/* $Id: fog.c,v 1.7 2000/02/25 03:55:40 keithw Exp $ */
/*
* Mesa 3-D graphics library
#include "macros.h"
#include "mmath.h"
#include "types.h"
+#include "xform.h"
#endif
}
break;
case GL_FOG_START:
-#if 0
- /* Prior to OpenGL 1.1, this was an error */
- if (*params<0.0F) {
- gl_error( ctx, GL_INVALID_VALUE, "glFog(GL_FOG_START)" );
- return;
- }
-#endif
ctx->Fog.Start = *params;
break;
case GL_FOG_END:
-#if 0
- /* Prior to OpenGL 1.1, this was an error */
- if (*params<0.0F) {
- gl_error( ctx, GL_INVALID_VALUE, "glFog(GL_FOG_END)" );
- return;
- }
-#endif
ctx->Fog.End = *params;
break;
case GL_FOG_INDEX:
typedef void (*fog_func)( struct vertex_buffer *VB, GLuint side,
GLubyte flag );
+typedef void (*fog_coord_func)( struct vertex_buffer *VB,
+ const GLvector4f *from,
+ GLubyte flag );
static fog_func fog_ci_tab[2];
static fog_func fog_rgba_tab[2];
+static fog_coord_func make_fog_coord_tab[2];
/*
* Compute the fogged color for an array of vertices.
}
}
+
+static void check_fog_coords( GLcontext *ctx, struct gl_pipeline_stage *d )
+{
+ d->type = 0;
+
+ if (ctx->FogMode==FOG_FRAGMENT)
+ {
+ d->type = PIPE_IMMEDIATE|PIPE_PRECALC;
+ d->inputs = VERT_OBJ_ANY;
+ d->outputs = VERT_FOG_COORD;
+ }
+}
+
+void gl_make_fog_coords( struct vertex_buffer *VB )
+{
+ GLcontext *ctx = VB->ctx;
+
+ /* If full eye coords weren't required, just calculate the eye Z
+ * values.
+ */
+ if (!ctx->NeedEyeCoords) {
+ GLfloat *m = ctx->ModelView.m;
+ GLfloat plane[4];
+
+ plane[0] = m[2];
+ plane[1] = m[6];
+ plane[2] = m[10];
+ plane[3] = m[14];
+
+ gl_dotprod_tab[0][VB->ObjPtr->size](&VB->Eye,
+ 2, /* fill z coordinates */
+ VB->ObjPtr,
+ plane,
+ 0 );
+
+ make_fog_coord_tab[0]( VB, &VB->Eye, 0 );
+ }
+ else
+ {
+ make_fog_coord_tab[0]( VB, VB->EyePtr, 0 );
+ }
+}
+
+
+/* Drivers that want fog coordinates in VB->Spec[0] alpha, can substitute this
+ * stage for the default PIPE_OP_FOG pipeline stage.
+ */
+struct gl_pipeline_stage gl_fog_coord_stage = {
+ "build fog coordinates",
+ PIPE_OP_FOG,
+ PIPE_PRECALC|PIPE_IMMEDIATE,
+ 0,
+ NEW_FOG,
+ NEW_LIGHTING|NEW_RASTER_OPS|NEW_FOG|NEW_MODELVIEW,
+ 0, 0,
+ 0, 0, 0,
+ check_fog_coords,
+ gl_make_fog_coords
+};
+
+
+
+
+
/*
* Apply fog to an array of RGBA pixels.
* Input: n - number of pixels
-/* $Id: lines.c,v 1.6 1999/11/11 01:22:27 brianp Exp $ */
+/* $Id: lines.c,v 1.7 2000/02/25 03:55:40 keithw Exp $ */
/*
* Mesa 3-D graphics library
else {
if (ctx->Light.ShadeModel==GL_SMOOTH) {
/* Width==1, non-stippled, smooth-shaded */
- if (ctx->Depth.Test
- || (ctx->Fog.Enabled && ctx->Hint.Fog==GL_NICEST)) {
+ if (ctx->Depth.Test || ctx->FogMode == FOG_FRAGMENT) {
if (rgbmode)
ctx->Driver.LineFunc = smooth_rgba_z_line;
else
}
else {
/* Width==1, non-stippled, flat-shaded */
- if (ctx->Depth.Test
- || (ctx->Fog.Enabled && ctx->Hint.Fog==GL_NICEST)) {
+ if (ctx->Depth.Test || ctx->FogMode == FOG_FRAGMENT) {
if (rgbmode)
ctx->Driver.LineFunc = flat_rgba_z_line;
else
-/* $Id: varray.c,v 1.20 2000/02/05 02:05:14 brianp Exp $ */
+/* $Id: varray.c,v 1.21 2000/02/25 03:55:40 keithw Exp $ */
/*
* Mesa 3-D graphics library
VB->NextPrimitive[VB->CopyStart] = VB->Count;
VB->Primitive[VB->CopyStart] = mode;
+ ctx->Array.Flag[count] |= VERT_END_VB;
/* Transform and render.
*/
return;
}
- if (mode > GL_POLYGON) {
+ if (mode < 0 || mode > GL_POLYGON) {
gl_error( ctx, GL_INVALID_ENUM, "glDrawArrays(mode)" );
return;
}