summaryrefslogtreecommitdiff
path: root/xc/extras/Mesa/src/vector.c
diff options
context:
space:
mode:
authordawes <dawes>2000-11-07 22:09:49 +0000
committerdawes <dawes>2000-11-07 22:09:49 +0000
commitf93d27aa9ffc3e26ebb937ccd8dfe3319315c70c (patch)
tree4c21a480eb5dcca70013481c2f9e0873fa09ce6b /xc/extras/Mesa/src/vector.c
parent0aaf69d45917298d83ad7ddf346914232987aa70 (diff)
Import of XFree86 4.0.1dX_4_0_1d
Diffstat (limited to 'xc/extras/Mesa/src/vector.c')
-rw-r--r--xc/extras/Mesa/src/vector.c40
1 files changed, 20 insertions, 20 deletions
diff --git a/xc/extras/Mesa/src/vector.c b/xc/extras/Mesa/src/vector.c
index b63b8df69..a7daed715 100644
--- a/xc/extras/Mesa/src/vector.c
+++ b/xc/extras/Mesa/src/vector.c
@@ -22,6 +22,7 @@
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
+/* $XFree86: xc/extras/Mesa/src/vector.c,v 1.5 2000/09/26 15:56:35 tsi Exp $ */
/*
* New (3.1) transformation code written by Keith Whitwell.
@@ -68,6 +69,8 @@ static const GLubyte size_bits[5] = {
VEC_SIZE_4,
};
+
+
void gl_vector4f_init( GLvector4f *v, GLuint flags, GLfloat (*storage)[4] )
{
v->stride = 4*sizeof(GLfloat);
@@ -78,7 +81,6 @@ void gl_vector4f_init( GLvector4f *v, GLuint flags, GLfloat (*storage)[4] )
v->flags = size_bits[4] | flags | VEC_GOOD_STRIDE;
}
-
void gl_vector3f_init( GLvector3f *v, GLuint flags, GLfloat (*storage)[3] )
{
v->stride = 3*sizeof(GLfloat);
@@ -116,13 +118,6 @@ void gl_vector1ui_init( GLvector1ui *v, GLuint flags, GLuint *storage )
}
-#define ALIGN_MALLOC(vec, type, bytes, alignment) \
-do { \
- vec->storage = MALLOC( bytes + alignment - 1 ); \
- vec->start = type (((unsigned long)vec->storage + alignment - 1) \
- & ~(unsigned long)(alignment - 1)); \
-} while (0)
-
void gl_vector4f_alloc( GLvector4f *v, GLuint sz, GLuint flags, GLuint count,
GLuint alignment )
@@ -130,18 +125,19 @@ void gl_vector4f_alloc( GLvector4f *v, GLuint sz, GLuint flags, GLuint count,
(void) sz;
v->stride = 4*sizeof(GLfloat);
v->size = 2;
- ALIGN_MALLOC(v, (GLfloat *), count * 4 * sizeof(GLfloat), alignment);
+ v->storage = v->start = (GLfloat *)
+ ALIGN_MALLOC( count * 4 * sizeof(GLfloat), alignment );
v->data = (GLfloat (*)[4])v->start;
v->count = 0;
v->flags = size_bits[4] | flags | VEC_MALLOC | VEC_GOOD_STRIDE;
}
-
void gl_vector3f_alloc( GLvector3f *v, GLuint flags, GLuint count,
GLuint alignment )
{
v->stride = 3*sizeof(GLfloat);
- ALIGN_MALLOC(v, (GLfloat *), count * 3 * sizeof(GLfloat), alignment);
+ v->storage = v->start = (GLfloat *)
+ ALIGN_MALLOC( count * 3 * sizeof(GLfloat), alignment );
v->data = (GLfloat (*)[3])v->start;
v->count = 0;
v->flags = flags | VEC_MALLOC | VEC_GOOD_STRIDE;
@@ -151,7 +147,8 @@ void gl_vector4ub_alloc( GLvector4ub *v, GLuint flags, GLuint count,
GLuint alignment )
{
v->stride = 4*sizeof(GLubyte);
- ALIGN_MALLOC(v, (GLubyte *), count * 4 * sizeof(GLubyte), alignment);
+ v->storage = v->start = (GLubyte *)
+ ALIGN_MALLOC( count * 4 * sizeof(GLubyte), alignment );
v->data = (GLubyte (*)[4])v->start;
v->count = 0;
v->flags = flags | VEC_MALLOC | VEC_GOOD_STRIDE;
@@ -161,7 +158,8 @@ void gl_vector1ub_alloc( GLvector1ub *v, GLuint flags, GLuint count,
GLuint alignment )
{
v->stride = 1*sizeof(GLubyte);
- ALIGN_MALLOC(v, (GLubyte *), count * sizeof(GLubyte), alignment);
+ v->storage = v->start = (GLubyte *)
+ ALIGN_MALLOC( count * sizeof(GLubyte), alignment );
v->data = v->start;
v->count = 0;
v->flags = flags | VEC_MALLOC | VEC_GOOD_STRIDE;
@@ -171,7 +169,8 @@ void gl_vector1ui_alloc( GLvector1ui *v, GLuint flags, GLuint count,
GLuint alignment )
{
v->stride = 1*sizeof(GLuint);
- ALIGN_MALLOC(v, (GLuint *), count * sizeof(GLuint), alignment);
+ v->storage = v->start = (GLuint *)
+ ALIGN_MALLOC( count * sizeof(GLuint), alignment );
v->data = v->start;
v->count = 0;
v->flags = flags | VEC_MALLOC | VEC_GOOD_STRIDE;
@@ -182,7 +181,7 @@ void gl_vector1ui_alloc( GLvector1ui *v, GLuint flags, GLuint count,
void gl_vector4f_free( GLvector4f *v )
{
if (v->flags & VEC_MALLOC) {
- FREE( v->storage );
+ ALIGN_FREE( v->storage );
v->data = 0;
v->start = 0;
v->storage = 0;
@@ -193,7 +192,7 @@ void gl_vector4f_free( GLvector4f *v )
void gl_vector3f_free( GLvector3f *v )
{
if (v->flags & VEC_MALLOC) {
- FREE( v->storage );
+ ALIGN_FREE( v->storage );
v->data = 0;
v->start = 0;
v->storage = 0;
@@ -204,7 +203,7 @@ void gl_vector3f_free( GLvector3f *v )
void gl_vector4ub_free( GLvector4ub *v )
{
if (v->flags & VEC_MALLOC) {
- FREE( v->storage );
+ ALIGN_FREE( v->storage );
v->data = 0;
v->start = 0;
v->storage = 0;
@@ -215,7 +214,7 @@ void gl_vector4ub_free( GLvector4ub *v )
void gl_vector1ub_free( GLvector1ub *v )
{
if (v->flags & VEC_MALLOC) {
- FREE( v->storage );
+ ALIGN_FREE( v->storage );
v->data = 0;
v->start = 0;
v->storage = 0;
@@ -226,7 +225,7 @@ void gl_vector1ub_free( GLvector1ub *v )
void gl_vector1ui_free( GLvector1ui *v )
{
if (v->flags & VEC_MALLOC) {
- FREE( v->storage );
+ ALIGN_FREE( v->storage );
v->data = 0;
v->start = 0;
v->storage = 0;
@@ -234,6 +233,8 @@ void gl_vector1ui_free( GLvector1ui *v )
}
}
+
+
void gl_vector4f_print( GLvector4f *v, GLubyte *cullmask, GLboolean culling )
{
GLfloat c[4] = { 0, 0, 0, 1 };
@@ -282,7 +283,6 @@ void gl_vector4f_print( GLvector4f *v, GLubyte *cullmask, GLboolean culling )
}
}
-
void gl_vector3f_print( GLvector3f *v, GLubyte *cullmask, GLboolean culling )
{
GLfloat *d = (GLfloat *)v->data;