summaryrefslogtreecommitdiff
path: root/src/mesa/math
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/math')
-rw-r--r--src/mesa/math/m_translate.c20
-rw-r--r--src/mesa/math/m_translate.h11
-rw-r--r--src/mesa/math/m_vector.c33
-rw-r--r--src/mesa/math/m_vector.h22
4 files changed, 82 insertions, 4 deletions
diff --git a/src/mesa/math/m_translate.c b/src/mesa/math/m_translate.c
index 0eb2ee8281..967f6a54cf 100644
--- a/src/mesa/math/m_translate.c
+++ b/src/mesa/math/m_translate.c
@@ -1,4 +1,4 @@
-/* $Id: m_translate.c,v 1.4 2001/01/24 00:04:59 brianp Exp $ */
+/* $Id: m_translate.c,v 1.5 2001/02/20 18:28:52 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -30,6 +30,7 @@
#include "glheader.h"
+#include "mtypes.h" /* GLchan hack */
#include "colormac.h"
#include "mem.h"
#include "mmath.h"
@@ -603,6 +604,23 @@ void _math_trans_4ub(GLubyte (*to)[4],
_math_trans_4ub_tab[size][TYPE_IDX(type)]( to, ptr, stride, start, n );
}
+void _math_trans_4chan( GLchan (*to)[4],
+ CONST void *ptr,
+ GLuint stride,
+ GLenum type,
+ GLuint size,
+ GLuint start,
+ GLuint n )
+{
+#if CHAN_TYPE == GL_UNSIGNED_BYTE
+ _math_trans_4ub( to, ptr, stride, type, size, start, n );
+#elif CHAN_TYPE == GL_UNSIGNED_SHORT
+ _math_trans_4us( to, ptr, stride, type, size, start, n );
+#elif CHAN_TYPE == GL_FLOAT
+ _math_trans_4f( to, ptr, stride, type, size, start, n );
+#endif
+}
+
void _math_trans_4us(GLushort (*to)[4],
CONST void *ptr,
GLuint stride,
diff --git a/src/mesa/math/m_translate.h b/src/mesa/math/m_translate.h
index 3151e45817..55ac887e24 100644
--- a/src/mesa/math/m_translate.h
+++ b/src/mesa/math/m_translate.h
@@ -1,4 +1,4 @@
-/* $Id: m_translate.h,v 1.4 2001/01/24 00:04:59 brianp Exp $ */
+/* $Id: m_translate.h,v 1.5 2001/02/20 18:28:52 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -29,6 +29,7 @@
#define _M_TRANSLATE_H_
#include "config.h"
+#include "mtypes.h" /* hack for GLchan */
@@ -61,6 +62,14 @@ extern void _math_trans_4ub(GLubyte (*to)[4],
GLuint start,
GLuint n );
+extern void _math_trans_4chan( GLchan (*to)[4],
+ CONST void *ptr,
+ GLuint stride,
+ GLenum type,
+ GLuint size,
+ GLuint start,
+ GLuint n );
+
extern void _math_trans_4us(GLushort (*to)[4],
CONST void *ptr,
GLuint stride,
diff --git a/src/mesa/math/m_vector.c b/src/mesa/math/m_vector.c
index 7fa2b726e4..02a558ac38 100644
--- a/src/mesa/math/m_vector.c
+++ b/src/mesa/math/m_vector.c
@@ -1,4 +1,4 @@
-/* $Id: m_vector.c,v 1.3 2001/01/24 00:04:59 brianp Exp $ */
+/* $Id: m_vector.c,v 1.4 2001/02/20 18:28:52 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -115,6 +115,15 @@ void gl_vector4ub_init( GLvector4ub *v, GLuint flags, GLubyte (*storage)[4] )
v->flags = flags ;
}
+void gl_vector4chan_init( GLvector4chan *v, GLuint flags, GLchan (*storage)[4] )
+{
+ v->stride = 4 * sizeof(GLchan);
+ v->data = storage;
+ v->start = (GLchan *) storage;
+ v->count = 0;
+ v->flags = flags ;
+}
+
void gl_vector4us_init( GLvector4us *v, GLuint flags, GLushort (*storage)[4] )
{
v->stride = 4 * sizeof(GLushort);
@@ -198,6 +207,17 @@ void gl_vector4ub_alloc( GLvector4ub *v, GLuint flags, GLuint count,
v->flags = flags | VEC_MALLOC ;
}
+void gl_vector4chan_alloc( GLvector4chan *v, GLuint flags, GLuint count,
+ GLuint alignment )
+{
+ v->stride = 4 * sizeof(GLchan);
+ v->storage = ALIGN_MALLOC( count * 4 * sizeof(GLchan), alignment );
+ v->start = (GLchan *) v->storage;
+ v->data = (GLchan (*)[4]) v->storage;
+ v->count = 0;
+ v->flags = flags | VEC_MALLOC ;
+}
+
void gl_vector4us_alloc( GLvector4us *v, GLuint flags, GLuint count,
GLuint alignment )
{
@@ -284,6 +304,17 @@ void gl_vector4ub_free( GLvector4ub *v )
}
}
+void gl_vector4chan_free( GLvector4chan *v )
+{
+ if (v->flags & VEC_MALLOC) {
+ ALIGN_FREE( v->storage );
+ v->data = NULL;
+ v->start = NULL;
+ v->storage = NULL;
+ v->flags &= ~VEC_MALLOC;
+ }
+}
+
void gl_vector4us_free( GLvector4us *v )
{
if (v->flags & VEC_MALLOC) {
diff --git a/src/mesa/math/m_vector.h b/src/mesa/math/m_vector.h
index 12200f960c..fc51b2006c 100644
--- a/src/mesa/math/m_vector.h
+++ b/src/mesa/math/m_vector.h
@@ -1,4 +1,4 @@
-/* $Id: m_vector.h,v 1.3 2001/01/24 00:04:59 brianp Exp $ */
+/* $Id: m_vector.h,v 1.4 2001/02/20 18:28:52 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -33,6 +33,7 @@
#define _M_VECTOR_H_
#include "glheader.h"
+#include "mtypes.h" /* hack for GLchan */
#define VEC_DIRTY_0 0x1
@@ -132,6 +133,25 @@ extern void gl_vector4ub_alloc( GLvector4ub *v, GLuint flags, GLuint count,
extern void gl_vector4ub_free( GLvector4ub * );
+/* For 4 * GLchan values.
+ */
+typedef struct {
+ GLchan (*data)[4];
+ GLchan *start;
+ GLuint count;
+ GLuint stride;
+ GLuint flags;
+ void *storage;
+} GLvector4chan;
+
+extern void gl_vector4chan_init( GLvector4chan *v, GLuint flags,
+ GLchan (*storage)[4] );
+extern void gl_vector4chan_alloc( GLvector4chan *v, GLuint flags, GLuint count,
+ GLuint alignment );
+extern void gl_vector4chan_free( GLvector4chan * );
+
+
+
/* For 4 * GLushort rgba values.
*/