summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/drivers/common')
-rw-r--r--src/mesa/drivers/common/t_dd_unfilled.h6
-rw-r--r--src/mesa/drivers/common/t_dd_vb.c122
-rw-r--r--src/mesa/drivers/common/t_dd_vbtmp.h6
3 files changed, 129 insertions, 5 deletions
diff --git a/src/mesa/drivers/common/t_dd_unfilled.h b/src/mesa/drivers/common/t_dd_unfilled.h
index 08fc69f0a9..b89b37bfe1 100644
--- a/src/mesa/drivers/common/t_dd_unfilled.h
+++ b/src/mesa/drivers/common/t_dd_unfilled.h
@@ -1,4 +1,4 @@
-/* $Id: t_dd_unfilled.h,v 1.3 2001/03/12 00:48:44 gareth Exp $ */
+/* $Id: t_dd_unfilled.h,v 1.4 2001/04/28 15:26:43 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -75,6 +75,10 @@ static void TAG(unfilled_tri)( GLcontext *ctx,
}
}
+/* fprintf(stderr, "%s %s %d %d %d\n", __FUNCTION__, */
+/* _mesa_lookup_enum_by_nr( mode ), */
+/* ef[e0], ef[e1], ef[e2]); */
+
if (mode == GL_POINT) {
RASTERIZE(GL_POINTS);
if (ef[e0]) POINT( v[0] );
diff --git a/src/mesa/drivers/common/t_dd_vb.c b/src/mesa/drivers/common/t_dd_vb.c
index 18e93959ba..1affe3132c 100644
--- a/src/mesa/drivers/common/t_dd_vb.c
+++ b/src/mesa/drivers/common/t_dd_vb.c
@@ -1,4 +1,4 @@
-/* $Id: t_dd_vb.c,v 1.8 2001/03/30 00:39:02 keithw Exp $ */
+/* $Id: t_dd_vb.c,v 1.9 2001/04/28 15:26:43 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -26,6 +26,7 @@
* Authors:
* Keith Whitwell <keithw@valinux.com>
*/
+#include "math/m_translate.h"
#if (HAVE_HW_VIEWPORT)
#define UNVIEWPORT_VARS
@@ -212,5 +213,124 @@ void TAG(print_vertex)( GLcontext *ctx, const VERTEX *v )
fprintf(stderr, "\n");
}
+static void do_import( struct vertex_buffer *VB,
+ struct gl_client_array *to,
+ struct gl_client_array *from )
+{
+ GLuint count = VB->Count;
+
+ if (!to->Ptr) {
+ to->Ptr = ALIGN_MALLOC( VB->Size * 4 * sizeof(GLubyte), 32 );
+ to->Type = GL_UNSIGNED_BYTE;
+ }
+
+ /* No need to transform the same value 3000 times.
+ */
+ if (!from->StrideB) {
+ to->StrideB = 0;
+ count = 1;
+ }
+ else
+ to->StrideB = 4 * sizeof(GLubyte);
+
+ _math_trans_4ub( (GLubyte (*)[4]) to->Ptr,
+ from->Ptr,
+ from->StrideB,
+ from->Type,
+ from->Size,
+ 0,
+ count);
+}
+
+#ifndef IMPORT_QUALIFIER
+#define IMPORT_QUALIFIER static
+#endif
+
+IMPORT_QUALIFIER void TAG(import_float_colors)( GLcontext *ctx )
+{
+ LOCALVARS
+ struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
+ struct gl_client_array *to = GET_UBYTE_COLOR_STORE();
+ do_import( VB, to, VB->ColorPtr[0] );
+ VB->ColorPtr[0] = to;
+}
+
+IMPORT_QUALIFIER void TAG(import_float_spec_colors)( GLcontext *ctx )
+{
+ LOCALVARS
+ struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
+ struct gl_client_array *to = GET_UBYTE_SPEC_COLOR_STORE();
+ do_import( VB, to, VB->SecondaryColorPtr[0] );
+ VB->SecondaryColorPtr[0] = to;
+}
+
+/* Interpolate the elements of the VB not included in typical hardware
+ * vertices.
+ *
+ * NOTE: All these arrays are guarenteed by tnl to be writeable and
+ * have good stride.
+ */
+#ifndef INTERP_QUALIFIER
+#define INTERP_QUALIFIER static
+#endif
+
+#define GET_COLOR(ptr, idx) (((GLfloat (*)[4])((ptr)->Ptr))[idx])
+
+
+INTERP_QUALIFIER void TAG(interp_extras)( GLcontext *ctx,
+ GLfloat t,
+ GLuint dst, GLuint out, GLuint in,
+ GLboolean force_boundary )
+{
+ LOCALVARS
+ struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
+
+ fprintf(stderr, "%s\n", __FUNCTION__);
+
+ if (VB->ColorPtr[1]) {
+ INTERP_4F( t,
+ GET_COLOR(VB->ColorPtr[1], dst),
+ GET_COLOR(VB->ColorPtr[1], out),
+ GET_COLOR(VB->ColorPtr[1], in) );
+
+ if (VB->SecondaryColorPtr[1]) {
+ INTERP_3F( t,
+ GET_COLOR(VB->SecondaryColorPtr[1], dst),
+ GET_COLOR(VB->SecondaryColorPtr[1], out),
+ GET_COLOR(VB->SecondaryColorPtr[1], in) );
+ }
+ }
+
+ if (VB->EdgeFlag) {
+ VB->EdgeFlag[dst] = VB->EdgeFlag[out] || force_boundary || 1;
+ }
+
+ INTERP_VERTEX(ctx, t, dst, out, in, force_boundary);
+}
+
+INTERP_QUALIFIER void TAG(copy_pv_extras)( GLcontext *ctx,
+ GLuint dst, GLuint src )
+{
+ LOCALVARS
+ struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
+
+ if (VB->ColorPtr[1]) {
+ COPY_4FV( GET_COLOR(VB->ColorPtr[1], dst),
+ GET_COLOR(VB->ColorPtr[1], src) );
+
+ if (VB->SecondaryColorPtr[1]) {
+ COPY_4FV( GET_COLOR(VB->SecondaryColorPtr[1], dst),
+ GET_COLOR(VB->SecondaryColorPtr[1], src) );
+ }
+ }
+
+ COPY_PV_VERTEX(ctx, dst, src);
+}
+
+
+#undef INTERP_QUALIFIER
+#undef IMPORT_QUALIFIER
+#undef GET_COLOR
+#undef IND
#undef TAG
diff --git a/src/mesa/drivers/common/t_dd_vbtmp.h b/src/mesa/drivers/common/t_dd_vbtmp.h
index 65e00a13ad..0a3305e915 100644
--- a/src/mesa/drivers/common/t_dd_vbtmp.h
+++ b/src/mesa/drivers/common/t_dd_vbtmp.h
@@ -1,4 +1,4 @@
-/* $Id: t_dd_vbtmp.h,v 1.11 2001/04/28 08:39:18 keithw Exp $ */
+/* $Id: t_dd_vbtmp.h,v 1.12 2001/04/28 15:26:43 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -483,8 +483,8 @@ static void TAG(emit)( GLcontext *ctx, GLuint start, GLuint end,
if (VB->ColorPtr[0]->Type != GL_UNSIGNED_BYTE)
IMPORT_FLOAT_COLORS( ctx );
- col = VB->ColorPtr[0]->data;
- col_stride = VB->ColorPtr[0]->stride;
+ col = VB->ColorPtr[0]->Ptr;
+ col_stride = VB->ColorPtr[0]->StrideB;
if (start)
STRIDE_4UB(col, col_stride * start);