Changeset 3597 for trunk/src


Ignore:
Timestamp:
May 23, 2000, 10:35:01 PM (25 years ago)
Author:
jeroen
Message:

* empty log message *

Location:
trunk/src/opengl/mesa
Files:
6 added
45 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/opengl/mesa/hash.h

    r2938 r3597  
    1 /* $Id: hash.h,v 1.1 2000-02-29 00:48:31 sandervl Exp $ */
     1/* $Id: hash.h,v 1.2 2000-05-23 20:34:51 jeroen Exp $ */
    22
    33/*
    44 * Mesa 3-D graphics library
    5  * Version:  3.1
     5 * Version:  3.3
    66 *
    77 * Copyright (C) 1999  Brian Paul   All Rights Reserved.
     
    2626
    2727
    28 
    29 
    30 
    3128#ifndef HASH_H
    3229#define HASH_H
    3330
    3431
    35 #include "gl.h"
     32#include "glheader.h"
    3633
    3734
     
    4037
    4138
    42 extern struct HashTable *NewHashTable(void);
     39extern struct _mesa_HashTable *_mesa_NewHashTable(void);
    4340
    44 extern void DeleteHashTable(struct HashTable *table);
     41extern void _mesa_DeleteHashTable(struct _mesa_HashTable *table);
    4542
    46 extern void *HashLookup(const struct HashTable *table, GLuint key);
     43extern void *_mesa_HashLookup(const struct _mesa_HashTable *table, GLuint key);
    4744
    48 extern void HashInsert(struct HashTable *table, GLuint key, void *data);
     45extern void _mesa_HashInsert(struct _mesa_HashTable *table, GLuint key, void *data);
    4946
    50 extern void HashRemove(struct HashTable *table, GLuint key);
     47extern void _mesa_HashRemove(struct _mesa_HashTable *table, GLuint key);
    5148
    52 extern GLuint HashFirstEntry(const struct HashTable *table);
     49extern GLuint _mesa_HashFirstEntry(struct _mesa_HashTable *table);
    5350
    54 extern void HashPrint(const struct HashTable *table);
     51extern void _mesa_HashPrint(const struct _mesa_HashTable *table);
    5552
    56 extern GLuint HashFindFreeKeyBlock(const struct HashTable *table, GLuint numKeys);
     53extern GLuint _mesa_HashFindFreeKeyBlock(struct _mesa_HashTable *table, GLuint numKeys);
    5754
    5855
  • trunk/src/opengl/mesa/image.h

    r2938 r3597  
    1 /* $Id: image.h,v 1.1 2000-02-29 00:48:31 sandervl Exp $ */
     1/* $Id: image.h,v 1.2 2000-05-23 20:34:51 jeroen Exp $ */
    22
    33/*
    44 * Mesa 3-D graphics library
    5  * Version:  3.1
     5 * Version:  3.3
    66 *
    77 * Copyright (C) 1999  Brian Paul   All Rights Reserved.
     
    2626
    2727
    28 
    29 
    30 
    3128#ifndef IMAGE_H
    3229#define IMAGE_H
     
    3633
    3734
    38 extern void gl_flip_bytes( GLubyte *p, GLuint n );
     35extern const struct gl_pixelstore_attrib _mesa_native_packing;
    3936
    4037
    41 extern void gl_swap2( GLushort *p, GLuint n );
     38extern void
     39_mesa_swap2( GLushort *p, GLuint n );
    4240
    43 extern void gl_swap4( GLuint *p, GLuint n );
     41extern void
     42_mesa_swap4( GLuint *p, GLuint n );
    4443
     44extern GLint
     45_mesa_sizeof_type( GLenum type );
    4546
    46 extern GLint gl_sizeof_type( GLenum type );
     47extern GLint
     48_mesa_sizeof_packed_type( GLenum type );
    4749
    48 extern GLint gl_sizeof_packed_type( GLenum type );
     50extern GLint
     51_mesa_components_in_format( GLenum format );
    4952
    50 extern GLint gl_components_in_format( GLenum format );
     53extern GLint
     54_mesa_bytes_per_pixel( GLenum format, GLenum type );
    5155
    52 extern GLint gl_bytes_per_pixel( GLenum format, GLenum type );
    53 
    54 extern GLboolean gl_is_legal_format_and_type( GLenum format, GLenum type );
     56extern GLboolean
     57_mesa_is_legal_format_and_type( GLenum format, GLenum type );
    5558
    5659
    5760extern GLvoid *
    58 gl_pixel_addr_in_image( const struct gl_pixelstore_attrib *packing,
    59                         const GLvoid *image, GLsizei width,
    60                         GLsizei height, GLenum format, GLenum type,
    61                         GLint img, GLint row, GLint column );
     61_mesa_image_address( const struct gl_pixelstore_attrib *packing,
     62                     const GLvoid *image, GLsizei width,
     63                     GLsizei height, GLenum format, GLenum type,
     64                     GLint img, GLint row, GLint column );
    6265
    6366
    64 extern struct gl_image *
    65 gl_unpack_bitmap( GLcontext *ctx, GLsizei width, GLsizei height,
    66                   const GLubyte *bitmap,
    67                   const struct gl_pixelstore_attrib *packing );
    68 
    69 
    70 extern void gl_unpack_polygon_stipple( const GLcontext *ctx,
    71                                        const GLubyte *pattern,
    72                                        GLuint dest[32] );
    73 
    74 
    75 extern void gl_pack_polygon_stipple( const GLcontext *ctx,
    76                                      const GLuint pattern[32],
    77                                      GLubyte *dest );
    78 
    79 
    80 extern struct gl_image *
    81 gl_unpack_image( GLcontext *ctx, GLint width, GLint height,
    82                  GLenum srcFormat, GLenum srcType, const GLvoid *pixels,
    83                  const struct gl_pixelstore_attrib *packing );
    84 
    85 
    86 
    87 struct gl_image *
    88 gl_unpack_image3D( GLcontext *ctx, GLint width, GLint height,GLint depth,
    89                    GLenum srcFormat, GLenum srcType, const GLvoid *pixels,
    90                    const struct gl_pixelstore_attrib *packing );
     67extern GLint
     68_mesa_image_row_stride( const struct gl_pixelstore_attrib *packing,
     69                        GLint width, GLenum format, GLenum type );
    9170
    9271
    9372extern void
    94 gl_pack_rgba_span( const GLcontext *ctx,
    95                    GLuint n, CONST GLubyte rgba[][4],
    96                    GLenum format, GLenum type, GLvoid *dest,
    97                    const struct gl_pixelstore_attrib *packing,
    98                    GLboolean applyTransferOps );
     73_mesa_unpack_polygon_stipple( const GLubyte *pattern, GLuint dest[32],
     74                              const struct gl_pixelstore_attrib *unpacking );
    9975
    10076
    101 extern void gl_free_image( struct gl_image *image );
     77extern void
     78_mesa_pack_polygon_stipple( const GLuint pattern[32], GLubyte *dest,
     79                            const struct gl_pixelstore_attrib *packing );
    10280
    10381
    104 extern GLboolean gl_image_error_test( GLcontext *ctx,
    105                                       const struct gl_image *image,
    106                                       const char *msg );
    107 
    108 
    109 /*
    110  * New (3.3) functions
    111  */
     82extern void
     83_mesa_pack_rgba_span( const GLcontext *ctx,
     84                      GLuint n, CONST GLubyte rgba[][4],
     85                      GLenum format, GLenum type, GLvoid *dest,
     86                      const struct gl_pixelstore_attrib *packing,
     87                      GLboolean applyTransferOps );
    11288
    11389
     
    128104                         GLboolean applyTransferOps );
    129105
     106
     107extern void
     108_mesa_unpack_stencil_span( const GLcontext *ctx, GLuint n,
     109                           GLenum dstType, GLvoid *dest,
     110                           GLenum srcType, const GLvoid *source,
     111                           const struct gl_pixelstore_attrib *unpacking,
     112                           GLboolean applyTransferOps );
     113
     114
     115extern void
     116_mesa_unpack_depth_span( const GLcontext *ctx, GLuint n, GLdepth *dest,
     117                         GLenum srcType, const GLvoid *source,
     118                         const struct gl_pixelstore_attrib *unpacking,
     119                         GLboolean applyTransferOps );
     120
     121
    130122extern void *
    131123_mesa_unpack_image( GLsizei width, GLsizei height, GLsizei depth,
     
    134126
    135127
     128extern GLvoid *
     129_mesa_unpack_bitmap( GLint width, GLint height, const GLubyte *pixels,
     130                     const struct gl_pixelstore_attrib *packing );
     131
     132extern void
     133_mesa_pack_bitmap( GLint width, GLint height, const GLubyte *source,
     134                   GLubyte *dest, const struct gl_pixelstore_attrib *packing );
     135
     136
    136137#endif
  • trunk/src/opengl/mesa/interp_tmp.h

    r2938 r3597  
    1 /* $Id: interp_tmp.h,v 1.1 2000-02-29 00:48:32 sandervl Exp $ */
     1/* $Id: interp_tmp.h,v 1.2 2000-05-23 20:34:51 jeroen Exp $ */
    22
    33/*
     
    2525 */
    2626
     27#define INTERP_UBYTE( out, t, a, b ) {                  \
     28      GLfloat fa = UBYTE_COLOR_TO_FLOAT_COLOR(a);       \
     29      GLfloat fb = UBYTE_COLOR_TO_FLOAT_COLOR(b);       \
     30      GLfloat fo = LINTERP(t, fa, fb);                  \
     31      FLOAT_COLOR_TO_UBYTE_COLOR(out, fo);              \
     32}
     33
     34#if 1
     35
     36#define INTERP_RGBA(nr, t, out, a, b) {                 \
     37   int i;                                               \
     38   for (i = 0; i < nr; i++) {                           \
     39      GLfloat fa = UBYTE_COLOR_TO_FLOAT_COLOR(a[i]);    \
     40      GLfloat fb = UBYTE_COLOR_TO_FLOAT_COLOR(b[i]);    \
     41      GLfloat fo = LINTERP(t, fa, fb);                  \
     42      FLOAT_COLOR_TO_UBYTE_COLOR(out[i], fo);           \
     43   }                                                    \
     44}
     45#else
     46
     47#define INTERP_RGBA(nr, t, out, a, b) {                         \
     48   int n;                                                       \
     49   const GLuint ti = FloatToInt(t*256.0F);                      \
     50   const GLubyte *Ib = (const GLubyte *)&a[0];                  \
     51   const GLubyte *Jb = (const GLubyte *)&b[0];                  \
     52   GLubyte *Ob = (GLubyte *)&out[0];                            \
     53                                                                \
     54   for (n = 0 ; n < nr ; n++)                                   \
     55      Ob[n] = (GLubyte) (Ib[n] + ((ti * (Jb[n] - Ib[n]))/256)); \
     56}
     57#endif
    2758
    2859static void NAME( struct vertex_buffer *VB,
    29                   GLuint dst, GLfloat t, GLuint in, GLuint out )
     60                  GLuint dst, GLfloat t, GLuint in, GLuint out )
    3061{
    31 #if (IND & (CLIP_RGBA0|CLIP_FOG_COORD))
    32    GLfloat col[3][4];
    33 #endif
    34 
    3562   (void) VB;
    3663   (void) dst;
     
    4067
    4168#if (IND & CLIP_RGBA0)
    42    UBYTE_RGBA_TO_FLOAT_RGBA(col[1], VB->Color[0]->data[in]);
    43    UBYTE_RGBA_TO_FLOAT_RGBA(col[2], VB->Color[0]->data[out]);
    44    INTERP_SZ( t, col, 0, 1, 2, 4 );
    45    FLOAT_RGBA_TO_UBYTE_RGBA(VB->Color[0]->data[dst], col[0]);
     69   INTERP_RGBA( 4, t,
     70                VB->Color[0]->data[dst],
     71                VB->Color[0]->data[in],
     72                VB->Color[0]->data[out] );
    4673#endif
    4774
    4875#if (IND & CLIP_RGBA1)
    4976   if (VB->ctx->TriangleCaps & DD_TRI_LIGHT_TWOSIDE) {
    50       UBYTE_RGBA_TO_FLOAT_RGBA(col[1], VB->Color[1]->data[in]);
    51       UBYTE_RGBA_TO_FLOAT_RGBA(col[2], VB->Color[1]->data[out]);
    52       INTERP_SZ( t, col, 0, 1, 2, 4 );
    53       FLOAT_RGBA_TO_UBYTE_RGBA(VB->Color[1]->data[dst], col[0]);
     77      INTERP_RGBA( 4, t,
     78                   VB->Color[1]->data[dst],
     79                   VB->Color[1]->data[in],
     80                   VB->Color[1]->data[out] );
    5481   }
    5582
    5683   if (VB->ctx->TriangleCaps & DD_SEPERATE_SPECULAR)
    5784   {
    58       UBYTE_RGBA_TO_FLOAT_RGBA(col[1], VB->Spec[0][in]);
    59       UBYTE_RGBA_TO_FLOAT_RGBA(col[2], VB->Spec[0][out]);
    60       INTERP_SZ( t, col, 0, 1, 2, 3 );
    61       FLOAT_RGBA_TO_UBYTE_RGBA(VB->Spec[0][dst], col[0]);
     85      INTERP_RGBA( 3, t,
     86                   VB->Spec[0][dst],
     87                   VB->Spec[0][in],
     88                   VB->Spec[0][out] );
    6289
    6390      if (VB->ctx->TriangleCaps & DD_TRI_LIGHT_TWOSIDE) {
    64          UBYTE_RGBA_TO_FLOAT_RGBA(col[1], VB->Spec[1][in]);
    65          UBYTE_RGBA_TO_FLOAT_RGBA(col[2], VB->Spec[1][out]);
    66          INTERP_SZ( t, col, 0, 1, 2, 3 );
    67          FLOAT_RGBA_TO_UBYTE_RGBA(VB->Spec[1][dst], col[0]);
     91         INTERP_RGBA( 3, t,
     92                      VB->Spec[1][dst],
     93                      VB->Spec[1][in],
     94                      VB->Spec[1][out] );
    6895      }
    6996   }
     
    7198
    7299#if (IND & CLIP_FOG_COORD)
    73    col[0][0] = UBYTE_COLOR_TO_FLOAT_COLOR( VB->Spec[0][in][3]);
    74    col[0][1] = UBYTE_COLOR_TO_FLOAT_COLOR( VB->Spec[0][out][3]);
    75    col[0][2] = LINTERP( t, col[0][0], col[0][1] );
    76    FLOAT_COLOR_TO_UBYTE_COLOR(VB->Spec[0][dst][3], col[0][2]);
     100   {
     101      GLubyte a = VB->Spec[0][in][3], b = VB->Spec[0][out][3];
     102      INTERP_UBYTE( VB->Spec[0][dst][3], t, a, b );
     103   }
    77104#endif
    78105
     
    81108   VB->IndexPtr->data[dst] = (GLuint) (GLint)
    82109      LINTERP( t,
    83                (GLfloat) VB->Index[0]->data[in],
    84                (GLfloat) VB->Index[0]->data[out] );
     110               (GLfloat) VB->Index[0]->data[in],
     111               (GLfloat) VB->Index[0]->data[out] );
    85112#endif
    86113
     
    88115   VB->Index[1]->data[dst] = (GLuint) (GLint)
    89116      LINTERP( t,
    90                (GLfloat) VB->Index[1]->data[in],
    91                (GLfloat) VB->Index[1]->data[out] );
     117               (GLfloat) VB->Index[1]->data[in],
     118               (GLfloat) VB->Index[1]->data[out] );
    92119#endif
    93120
    94121#if (IND & CLIP_TEX0)
    95122   INTERP_SZ( t,
    96               VB->TexCoordPtr[0]->data,
    97               dst, in, out,
    98               VB->TexCoordPtr[0]->size );
     123              VB->TexCoordPtr[0]->data,
     124              dst, in, out,
     125              VB->TexCoordPtr[0]->size );
    99126#endif
    100127
    101128#if (IND & CLIP_TEX1)
    102129   INTERP_SZ( t,
    103               VB->TexCoordPtr[1]->data,
    104               dst, in, out,
    105               VB->TexCoordPtr[1]->size );
     130              VB->TexCoordPtr[1]->data,
     131              dst, in, out,
     132              VB->TexCoordPtr[1]->size );
    106133#endif
    107134}
  • trunk/src/opengl/mesa/light.h

    r2938 r3597  
    1 /* $Id: light.h,v 1.1 2000-02-29 00:48:32 sandervl Exp $ */
     1/* $Id: light.h,v 1.2 2000-05-23 20:34:51 jeroen Exp $ */
    22
    33/*
    44 * Mesa 3-D graphics library
    5  * Version:  3.1
     5 * Version:  3.3
    66 *
    77 * Copyright (C) 1999  Brian Paul   All Rights Reserved.
     
    4343
    4444
    45 extern void gl_ShadeModel( GLcontext *ctx, GLenum mode );
     45extern void
     46_mesa_ShadeModel( GLenum mode );
    4647
    47 extern void gl_ColorMaterial( GLcontext *ctx, GLenum face, GLenum mode );
     48extern void
     49_mesa_ColorMaterial( GLenum face, GLenum mode );
    4850
    49 extern void gl_Lightfv( GLcontext *ctx,
    50                         GLenum light, GLenum pname, const GLfloat *params,
    51                         GLint nparams );
     51extern void
     52_mesa_Lightf( GLenum light, GLenum pname, GLfloat param );
    5253
    53 extern void gl_LightModelfv( GLcontext *ctx,
    54                              GLenum pname, const GLfloat *params );
     54extern void
     55_mesa_Lightfv( GLenum light, GLenum pname, const GLfloat *params );
     56
     57extern void
     58_mesa_Lightiv( GLenum light, GLenum pname, const GLint *params );
     59
     60extern void
     61_mesa_Lighti( GLenum light, GLenum pname, GLint param );
     62
     63extern void
     64_mesa_LightModelf( GLenum pname, GLfloat param );
     65
     66extern void
     67_mesa_LightModelfv( GLenum pname, const GLfloat *params );
     68
     69extern void
     70_mesa_LightModeli( GLenum pname, GLint param );
     71
     72extern void
     73_mesa_LightModeliv( GLenum pname, const GLint *params );
     74
     75extern void
     76_mesa_Materialf( GLenum face, GLenum pname, GLfloat param );
     77
     78extern void
     79_mesa_Materialfv( GLenum face, GLenum pname, const GLfloat *params );
     80
     81extern void
     82_mesa_Materiali( GLenum face, GLenum pname, GLint param );
     83
     84extern void
     85_mesa_Materialiv( GLenum face, GLenum pname, const GLint *params );
     86
     87extern void
     88_mesa_GetLightfv( GLenum light, GLenum pname, GLfloat *params );
     89
     90extern void
     91_mesa_GetLightiv( GLenum light, GLenum pname, GLint *params );
     92
     93extern void
     94_mesa_GetMaterialfv( GLenum face, GLenum pname, GLfloat *params );
     95
     96extern void
     97_mesa_GetMaterialiv( GLenum face, GLenum pname, GLint *params );
     98
    5599
    56100
    57101extern GLuint gl_material_bitmask( GLcontext *ctx,
    58                                    GLenum face, GLenum pname,
    59                                    GLuint legal,
    60                                    const char * );
     102                                   GLenum face, GLenum pname,
     103                                   GLuint legal,
     104                                   const char * );
    61105
    62106extern void gl_set_material( GLcontext *ctx, GLuint bitmask,
    63107                             const GLfloat *params);
    64108
    65 extern void gl_Materialfv( GLcontext *ctx,
    66                            GLenum face, GLenum pname, const GLfloat *params );
    67 
    68 
    69 
    70 extern void gl_GetLightfv( GLcontext *ctx,
    71                            GLenum light, GLenum pname, GLfloat *params );
    72 
    73 extern void gl_GetLightiv( GLcontext *ctx,
    74                            GLenum light, GLenum pname, GLint *params );
    75 
    76 
    77 extern void gl_GetMaterialfv( GLcontext *ctx,
    78                               GLenum face, GLenum pname, GLfloat *params );
    79 
    80 extern void gl_GetMaterialiv( GLcontext *ctx,
    81                               GLenum face, GLenum pname, GLint *params );
    82 
    83 
    84109extern void gl_compute_spot_exp_table( struct gl_light *l );
    85110
    86111extern void gl_compute_shine_table( GLcontext *ctx, GLuint i,
    87                                     GLfloat shininess );
     112                                    GLfloat shininess );
    88113
    89114extern void gl_update_lighting( GLcontext *ctx );
     
    94119
    95120extern void gl_update_material( GLcontext *ctx,
    96                                 struct gl_material *m,
    97                                 GLuint bitmask );
     121                                struct gl_material *m,
     122                                GLuint bitmask );
    98123
    99124extern void gl_update_color_material( GLcontext *ctx, const GLubyte rgba[4] );
    100125
    101126
     127
     128
    102129#endif
    103130
  • trunk/src/opengl/mesa/lines.h

    r2938 r3597  
    1 /* $Id: lines.h,v 1.1 2000-02-29 00:48:32 sandervl Exp $ */
     1/* $Id: lines.h,v 1.2 2000-05-23 20:34:52 jeroen Exp $ */
    22
    33/*
    44 * Mesa 3-D graphics library
    5  * Version:  3.1
     5 * Version:  3.3
    66 *
    77 * Copyright (C) 1999  Brian Paul   All Rights Reserved.
     
    3636
    3737
    38 extern void gl_LineWidth( GLcontext *ctx, GLfloat width );
     38extern void
     39_mesa_LineWidth( GLfloat width );
    3940
    40 extern void gl_LineStipple( GLcontext *ctx, GLint factor, GLushort pattern );
     41extern void
     42_mesa_LineStipple( GLint factor, GLushort pattern );
    4143
    42 extern void gl_set_line_function( GLcontext *ctx );
     44extern void
     45gl_set_line_function( GLcontext *ctx );
    4346
    4447
  • trunk/src/opengl/mesa/linetemp.h

    r2938 r3597  
    1 /* $Id: linetemp.h,v 1.1 2000-02-29 00:48:32 sandervl Exp $ */
     1/* $Id: linetemp.h,v 1.2 2000-05-23 20:34:52 jeroen Exp $ */
    22
    33/*
     
    5353 *                          Y==0 at bottom of screen and increases upward.
    5454 *
     55 * Similarly, for direct depth buffer access, this type is used for depth
     56 * buffer addressing:
     57 *    DEPTH_TYPE          - either GLushort or GLuint
     58 *
    5559 * Optionally, one may provide one-time setup code
    5660 *    SETUP_CODE    - code which is to be executed once per line
     
    8286   GLint y1 = (GLint) VB->Win.data[vert1][1];
    8387   GLint dx, dy;
    84 #if INTERP_XY
     88#ifdef INTERP_XY
    8589   GLint xstep, ystep;
    8690#endif
    87 #if INTERP_Z
    88    GLint z0, z1, dz, zPtrXstep, zPtrYstep;
    89    GLdepth *zPtr;
    90 #endif
    91 #if INTERP_RGB
     91#ifdef INTERP_Z
     92   GLint z0, z1, dz;
     93   const GLint depthBits = ctx->Visual->DepthBits;
     94   const GLint fixedToDepthShift = depthBits <= 16 ? FIXED_SHIFT : 0;
     95#  define FixedToDepth(F)  ((F) >> fixedToDepthShift)
     96#  ifdef DEPTH_TYPE
     97     GLint zPtrXstep, zPtrYstep;
     98     DEPTH_TYPE *zPtr;
     99#  endif
     100#endif
     101#ifdef INTERP_RGB
    92102   GLfixed r0 = IntToFixed(VB->ColorPtr->data[vert0][0]);
    93103   GLfixed dr = IntToFixed(VB->ColorPtr->data[vert1][0]) - r0;
     
    97107   GLfixed db = IntToFixed(VB->ColorPtr->data[vert1][2]) - b0;
    98108#endif
    99 #if INTERP_SPEC
     109#ifdef INTERP_SPEC
    100110   GLfixed sr0 = VB->Specular ? IntToFixed(VB->Specular[vert0][0]) : 0;
    101111   GLfixed dsr = VB->Specular ? IntToFixed(VB->Specular[vert1][0]) - sr0 : 0;
     
    105115   GLfixed dsb = VB->Specular ? IntToFixed(VB->Specular[vert1][2]) - sb0 : 0;
    106116#endif
    107 #if INTERP_ALPHA
     117#ifdef INTERP_ALPHA
    108118   GLfixed a0 = IntToFixed(VB->ColorPtr->data[vert0][3]);
    109119   GLfixed da = IntToFixed(VB->ColorPtr->data[vert1][3]) - a0;
    110120#endif
    111 #if INTERP_INDEX
     121#ifdef INTERP_INDEX
    112122   GLint i0 = VB->IndexPtr->data[vert0] << 8;
    113    GLint di = (GLint) (VB->IndexPtr->data[vert1] << 8)-i0;
    114 #endif
    115 #if INTERP_ST
     123   GLint di = (GLint) (VB->IndexPtr->data[vert1] << 8) - i0;
     124#endif
     125#ifdef INTERP_ST
    116126   GLfixed s0 = FloatToFixed(VB->TexCoord[vert0][0] * S_SCALE);
    117127   GLfixed ds = FloatToFixed(VB->TexCoord[vert1][0] * S_SCALE) - s0;
     
    119129   GLfixed dt = FloatToFixed(VB->TexCoord[vert1][1] * T_SCALE) - t0;
    120130#endif
    121 #if INTERP_STUV0 || INTERP_STUV1
     131#if defined(INTERP_STUV0) || defined(INTERP_STUV1)
    122132   GLfloat invw0 = VB->Win.data[vert0][3];
    123133   GLfloat invw1 = VB->Win.data[vert1][3];
    124134#endif
    125 #if INTERP_STUV0
     135#ifdef INTERP_STUV0
    126136   /* h denotes hyperbolic */
    127137   GLfloat hs0 = invw0 * VB->TexCoordPtr[0]->data[vert0][0];
     
    132142   GLfloat hv0 = invw0, dhv = invw1 - invw0;
    133143#endif
    134 #if INTERP_STUV1
     144#ifdef INTERP_STUV1
    135145   GLfloat hs01 = invw0 * VB->TexCoordPtr[1]->data[vert0][0];
    136146   GLfloat dhs1 = invw1 * VB->TexCoordPtr[1]->data[vert1][0] - hs01;
     
    144154   GLint pixelXstep, pixelYstep;
    145155#endif
    146 #if WIDE
     156#ifdef WIDE
    147157   /* for wide lines, draw all X in [x+min, x+max] or Y in [y+min, y+max] */
    148158   GLint width, min, max;
     
    151161   max = min + width - 1;
    152162#endif
    153 #if INTERP_STUV0
     163#ifdef INTERP_STUV0
    154164   if (VB->TexCoordPtr[0]->size > 2) {
    155165      hu0 = invw0 * VB->TexCoordPtr[0]->data[vert0][2];
    156166      dhu = invw1 * VB->TexCoordPtr[0]->data[vert1][2] - hu0;
    157167      if (VB->TexCoordPtr[0]->size > 3) {
    158         hv0 = invw0 * VB->TexCoordPtr[0]->data[vert0][3];
    159         dhv = invw1 * VB->TexCoordPtr[0]->data[vert1][3] - hv0;
    160       }
    161    }
    162 #endif
    163 #if INTERP_STUV1
     168        hv0 = invw0 * VB->TexCoordPtr[0]->data[vert0][3];
     169        dhv = invw1 * VB->TexCoordPtr[0]->data[vert1][3] - hv0;
     170      }
     171   }
     172#endif
     173#ifdef INTERP_STUV1
    164174   if (VB->TexCoordPtr[1]->size > 2) {
    165175      hu01 = invw0 * VB->TexCoordPtr[1]->data[vert0][2];
    166176      dhu1 = invw1 * VB->TexCoordPtr[1]->data[vert1][2] - hu01;
    167177      if (VB->TexCoordPtr[1]->size > 3) {
    168         hv01 = invw0 * VB->TexCoordPtr[1]->data[vert0][3];
    169         dhv1 = invw1 * VB->TexCoordPtr[1]->data[vert1][3] - hv01;
     178        hv01 = invw0 * VB->TexCoordPtr[1]->data[vert0][3];
     179        dhv1 = invw1 * VB->TexCoordPtr[1]->data[vert1][3] - hv01;
    170180      }
    171181   }
     
    179189 * necessary.
    180190 */
    181 #if CLIP_HACK
     191#ifdef CLIP_HACK
    182192   {
    183       GLint w = ctx->Buffer->Width;
    184       GLint h = ctx->Buffer->Height;
     193      GLint w = ctx->DrawBuffer->Width;
     194      GLint h = ctx->DrawBuffer->Height;
    185195      if ((x0==w) | (x1==w)) {
    186196         if ((x0==w) & (x1==w))
     
    210220#endif
    211221
    212 #if INTERP_Z
    213    zPtr = Z_ADDRESS(ctx,x0,y0);
    214 #  if DEPTH_BITS==16
     222#ifdef INTERP_Z
     223#  ifdef DEPTH_TYPE
     224     zPtr = (DEPTH_TYPE *) _mesa_zbuffer_address(ctx, x0, y0);
     225#  endif
     226   if (depthBits <= 16) {
    215227      z0 = FloatToFixed(VB->Win.data[vert0][2]);
    216228      z1 = FloatToFixed(VB->Win.data[vert1][2]);
    217 #  else
     229   }
     230   else {
    218231      z0 = (int) VB->Win.data[vert0][2];
    219232      z1 = (int) VB->Win.data[vert1][2];
    220 #  endif
     233   }
    221234#endif
    222235#ifdef PIXEL_ADDRESS
     
    225238
    226239   if (dx<0) {
    227       dx = -dx;   /* make positive */
    228 #if INTERP_XY
     240      dx = -dx;                                            /* make positive*/
     241#ifdef INTERP_XY
    229242      xstep = -1;
    230243#endif
    231 #ifdef INTERP_Z
    232       zPtrXstep = -((GLint)sizeof(GLdepth));
     244#if defined(INTERP_Z) && defined(DEPTH_TYPE)
     245      zPtrXstep = -((GLint)sizeof(DEPTH_TYPE));
    233246#endif
    234247#ifdef PIXEL_ADDRESS
     
    237250   }
    238251   else {
    239 #if INTERP_XY
     252#ifdef INTERP_XY
    240253      xstep = 1;
    241254#endif
    242 #if INTERP_Z
    243       zPtrXstep = ((GLint)sizeof(GLdepth));
     255#if defined(INTERP_Z) && defined(DEPTH_TYPE)
     256      zPtrXstep = ((GLint)sizeof(DEPTH_TYPE));
    244257#endif
    245258#ifdef PIXEL_ADDRESS
     
    249262
    250263   if (dy<0) {
    251       dy = -dy;   /* make positive */
    252 #if INTERP_XY
     264      dy = -dy;                                            /* make positive*/
     265#ifdef INTERP_XY
    253266      ystep = -1;
    254267#endif
    255 #if INTERP_Z
    256       zPtrYstep = -ctx->Buffer->Width * ((GLint)sizeof(GLdepth));
     268#if defined(INTERP_Z) && defined(DEPTH_TYPE)
     269      zPtrYstep = -ctx->DrawBuffer->Width * ((GLint)sizeof(DEPTH_TYPE));
    257270#endif
    258271#ifdef PIXEL_ADDRESS
     
    261274   }
    262275   else {
    263 #if INTERP_XY
     276#ifdef INTERP_XY
    264277      ystep = 1;
    265278#endif
    266 #if INTERP_Z
    267       zPtrYstep = ctx->Buffer->Width * ((GLint)sizeof(GLdepth));
     279#if defined(INTERP_Z) && defined(DEPTH_TYPE)
     280      zPtrYstep = ctx->DrawBuffer->Width * ((GLint)sizeof(DEPTH_TYPE));
    268281#endif
    269282#ifdef PIXEL_ADDRESS
     
    282295      GLint error = errorInc-dx;
    283296      GLint errorDec = error-dx;
    284 #if INTERP_Z
     297#ifdef INTERP_Z
    285298      dz = (z1-z0) / dx;
    286299#endif
    287 #if INTERP_RGB
    288       dr /= dx;   /* convert from whole line delta to per-pixel delta */
     300#ifdef INTERP_RGB
     301      dr /= dx;         /* convert from whole line delta to per-pixel delta*/
    289302      dg /= dx;
    290303      db /= dx;
    291304#endif
    292 #if INTERP_SPEC
    293       dsr /= dx;   /* convert from whole line delta to per-pixel delta */
     305#ifdef INTERP_SPEC
     306      dsr /= dx;        /* convert from whole line delta to per-pixel delta*/
    294307      dsg /= dx;
    295308      dsb /= dx;
    296309#endif
    297 #if INTERP_ALPHA
     310#ifdef INTERP_ALPHA
    298311      da /= dx;
    299312#endif
    300 #if INTERP_INDEX
     313#ifdef INTERP_INDEX
    301314      di /= dx;
    302315#endif
    303 #if INTERP_ST
     316#ifdef INTERP_ST
    304317      ds /= dx;
    305318      dt /= dx;
    306319#endif
    307 #if INTERP_STUV0
     320#ifdef INTERP_STUV0
    308321      {
    309322         GLfloat invDx = 1.0F / (GLfloat) dx;
     
    314327      }
    315328#endif
    316 #if INTERP_STUV1
     329#ifdef INTERP_STUV1
    317330      {
    318331         GLfloat invDx = 1.0F / (GLfloat) dx;
     
    324337#endif
    325338      for (i=0;i<dx;i++) {
    326 #if STIPPLE
     339#ifdef STIPPLE
    327340         GLushort m;
    328341         m = 1 << ((ctx->StippleCounter/ctx->Line.StippleFactor) & 0xf);
    329342         if (ctx->Line.StipplePattern & m) {
    330343#endif
    331 #if INTERP_Z
    332 #  if DEPTH_BITS==16
    333             GLdepth Z = FixedToInt(z0);
    334 #  else
    335             GLdepth Z = z0;
    336 #  endif
    337 #endif
    338 #if INTERP_INDEX
     344#ifdef INTERP_Z
     345            GLdepth Z = FixedToDepth(z0);
     346#endif
     347#ifdef INTERP_INDEX
    339348            GLint I = i0 >> 8;
    340349#endif
    341 #if INTERP_STUV0
     350#ifdef INTERP_STUV0
    342351            GLfloat invQ = 1.0F / hv0;
    343352            GLfloat s = hs0 * invQ;
     
    345354            GLfloat u = hu0 * invQ;
    346355#endif
    347 #if INTERP_STUV1
     356#ifdef INTERP_STUV1
    348357            GLfloat invQ1 = 1.0F / hv01;
    349358            GLfloat s1 = hs01 * invQ1;
     
    351360            GLfloat u1 = hu01 * invQ1;
    352361#endif
    353 #if WIDE
     362#ifdef WIDE
    354363            GLint yy;
    355364            GLint ymin = y0 + min;
     
    364373            PLOT( x0, y0 );
    365374#  endif
    366 #endif /*WIDE*/
    367 #if STIPPLE
     375#endif                                 /* WIDE                             */
     376#ifdef STIPPLE
    368377        }
    369         ctx->StippleCounter++;
    370 #endif
    371 #if INTERP_XY
     378        ctx->StippleCounter++;
     379#endif
     380#ifdef INTERP_XY
    372381         x0 += xstep;
    373382#endif
    374 #if INTERP_Z
    375          zPtr = (GLdepth *) ((GLubyte*) zPtr + zPtrXstep);
     383#ifdef INTERP_Z
     384#  ifdef DEPTH_TYPE
     385         zPtr = (DEPTH_TYPE *) ((GLubyte*) zPtr + zPtrXstep);
     386#  endif
    376387         z0 += dz;
    377388#endif
    378 #if INTERP_RGB
     389#ifdef INTERP_RGB
    379390         r0 += dr;
    380391         g0 += dg;
    381392         b0 += db;
    382393#endif
    383 #if INTERP_SPEC
     394#ifdef INTERP_SPEC
    384395         sr0 += dsr;
    385396         sg0 += dsg;
    386397         sb0 += dsb;
    387398#endif
    388 #if INTERP_ALPHA
     399#ifdef INTERP_ALPHA
    389400         a0 += da;
    390401#endif
    391 #if INTERP_INDEX
     402#ifdef INTERP_INDEX
    392403         i0 += di;
    393404#endif
    394 #if INTERP_ST
     405#ifdef INTERP_ST
    395406         s0 += ds;
    396407         t0 += dt;
    397408#endif
    398 #if INTERP_STUV0
     409#ifdef INTERP_STUV0
    399410         hs0 += dhs;
    400411         ht0 += dht;
     
    402413         hv0 += dhv;
    403414#endif
    404 #if INTERP_STUV1
     415#ifdef INTERP_STUV1
    405416         hs01 += dhs1;
    406417         ht01 += dht1;
     
    416427         else {
    417428            error += errorDec;
    418 #if INTERP_XY
     429#ifdef INTERP_XY
    419430            y0 += ystep;
    420431#endif
    421 #if INTERP_Z
    422             zPtr = (GLdepth *) ((GLubyte*) zPtr + zPtrYstep);
     432#if defined(INTERP_Z) && defined(DEPTH_TYPE)
     433            zPtr = (DEPTH_TYPE *) ((GLubyte*) zPtr + zPtrYstep);
    423434#endif
    424435#ifdef PIXEL_ADDRESS
     
    434445      GLint error = errorInc-dy;
    435446      GLint errorDec = error-dy;
    436 #if INTERP_Z
     447#ifdef INTERP_Z
    437448      dz = (z1-z0) / dy;
    438449#endif
    439 #if INTERP_RGB
    440       dr /= dy;   /* convert from whole line delta to per-pixel delta */
     450#ifdef INTERP_RGB
     451      dr /= dy;         /* convert from whole line delta to per-pixel delta*/
    441452      dg /= dy;
    442453      db /= dy;
    443454#endif
    444 #if INTERP_SPEC
    445       dsr /= dy;   /* convert from whole line delta to per-pixel delta */
     455#ifdef INTERP_SPEC
     456      dsr /= dy;        /* convert from whole line delta to per-pixel delta*/
    446457      dsg /= dy;
    447458      dsb /= dy;
    448459#endif
    449 #if INTERP_ALPHA
     460#ifdef INTERP_ALPHA
    450461      da /= dy;
    451462#endif
    452 #if INTERP_INDEX
     463#ifdef INTERP_INDEX
    453464      di /= dy;
    454465#endif
    455 #if INTERP_ST
     466#ifdef INTERP_ST
    456467      ds /= dy;
    457468      dt /= dy;
    458469#endif
    459 #if INTERP_STUV0
     470#ifdef INTERP_STUV0
    460471      {
    461472         GLfloat invDy = 1.0F / (GLfloat) dy;
     
    466477      }
    467478#endif
    468 #if INTERP_STUV1
     479#ifdef INTERP_STUV1
    469480      {
    470481         GLfloat invDy = 1.0F / (GLfloat) dy;
     
    476487#endif
    477488      for (i=0;i<dy;i++) {
    478 #if STIPPLE
     489#ifdef STIPPLE
    479490         GLushort m;
    480491         m = 1 << ((ctx->StippleCounter/ctx->Line.StippleFactor) & 0xf);
    481492         if (ctx->Line.StipplePattern & m) {
    482493#endif
    483 #if INTERP_Z
    484 #  if DEPTH_BITS==16
    485             GLdepth Z = FixedToInt(z0);
    486 #  else
    487             GLdepth Z = z0;
    488 #  endif
    489 #endif
    490 #if INTERP_INDEX
     494#ifdef INTERP_Z
     495            GLdepth Z = FixedToDepth(z0);
     496#endif
     497#ifdef INTERP_INDEX
    491498            GLint I = i0 >> 8;
    492499#endif
    493 #if INTERP_STUV0
     500#ifdef INTERP_STUV0
    494501            GLfloat invQ = 1.0F / hv0;
    495502            GLfloat s = hs0 * invQ;
     
    497504            GLfloat u = hu0 * invQ;
    498505#endif
    499 #if INTERP_STUV1
     506#ifdef INTERP_STUV1
    500507            GLfloat invQ1 = 1.0F / hv01;
    501508            GLfloat s1 = hs01 * invQ1;
     
    503510            GLfloat u1 = hu01 * invQ1;
    504511#endif
    505 #if WIDE
     512#ifdef WIDE
    506513            GLint xx;
    507514            GLint xmin = x0 + min;
     
    516523            PLOT( x0, y0 );
    517524#  endif
    518 #endif /*WIDE*/
    519 #if STIPPLE
     525#endif                                 /* WIDE                             */
     526#ifdef STIPPLE
    520527        }
    521         ctx->StippleCounter++;
    522 #endif
    523 #if INTERP_XY
     528        ctx->StippleCounter++;
     529#endif
     530#ifdef INTERP_XY
    524531         y0 += ystep;
    525532#endif
    526 #if INTERP_Z
    527          zPtr = (GLdepth *) ((GLubyte*) zPtr + zPtrYstep);
     533#ifdef INTERP_Z
     534#  ifdef DEPTH_TYPE
     535         zPtr = (DEPTH_TYPE *) ((GLubyte*) zPtr + zPtrYstep);
     536#  endif
    528537         z0 += dz;
    529538#endif
    530 #if INTERP_RGB
     539#ifdef INTERP_RGB
    531540         r0 += dr;
    532541         g0 += dg;
    533542         b0 += db;
    534543#endif
    535 #if INTERP_SPEC
     544#ifdef INTERP_SPEC
    536545         sr0 += dsr;
    537546         sg0 += dsg;
    538547         sb0 += dsb;
    539548#endif
    540 #if INTERP_ALPHA
     549#ifdef INTERP_ALPHA
    541550         a0 += da;
    542551#endif
    543 #if INTERP_INDEX
     552#ifdef INTERP_INDEX
    544553         i0 += di;
    545554#endif
    546 #if INTERP_ST
     555#ifdef INTERP_ST
    547556         s0 += ds;
    548557         t0 += dt;
    549558#endif
    550 #if INTERP_STUV0
     559#ifdef INTERP_STUV0
    551560         hs0 += dhs;
    552561         ht0 += dht;
     
    554563         hv0 += dhv;
    555564#endif
    556 #if INTERP_STUV1
     565#ifdef INTERP_STUV1
    557566         hs01 += dhs1;
    558567         ht01 += dht1;
     
    568577         else {
    569578            error += errorDec;
    570 #if INTERP_XY
     579#ifdef INTERP_XY
    571580            x0 += xstep;
    572581#endif
    573 #if INTERP_Z
    574             zPtr = (GLdepth *) ((GLubyte*) zPtr + zPtrXstep);
     582#if defined(INTERP_Z) && defined(DEPTH_TYPE)
     583            zPtr = (DEPTH_TYPE *) ((GLubyte*) zPtr + zPtrXstep);
    575584#endif
    576585#ifdef PIXEL_ADDRESS
     
    594603#undef PIXEL_ADDRESS
    595604#undef PIXEL_TYPE
     605#undef DEPTH_TYPE
    596606#undef BYTES_PER_ROW
    597607#undef SETUP_CODE
     
    602612#undef STIPPLE
    603613#undef WIDE
     614#undef FixedToDepth
  • trunk/src/opengl/mesa/lnaatemp.h

    r2938 r3597  
    1 /* $Id: lnaatemp.h,v 1.1 2000-02-29 00:48:32 sandervl Exp $ */
     1/* $Id: lnaatemp.h,v 1.2 2000-05-23 20:34:52 jeroen Exp $ */
    22
    33/*
     
    5353   const struct vertex_buffer *VB = ctx->VB;
    5454   struct pixel_buffer *pb = ctx->PB;
    55    GLfloat halfWidth = 0.5F * ctx->Line.Width;  /* 0.5 is a bit of a hack */
     55   GLfloat halfWidth = 0.5F * ctx->Line.Width; /* 0.5 is a bit of a hack  */
    5656   GLboolean solid = !ctx->Line.StippleFlag;
    5757   GLint x0 = (GLint) VB->Win.data[vert0][0];
     
    6363   GLint xStep, yStep;
    6464   GLint z0, z1;
     65   const GLint depthBits = ctx->Visual->DepthBits;
     66   const GLint fixedToDepthShift = depthBits <= 16 ? FIXED_SHIFT : 0;
     67#define FixedToDepth(F)  ((F) >> fixedToDepthShift)
    6568#if INTERP_RGBA
    6669   GLfixed fr, fg, fb, fa;      /* fixed-pt RGBA */
     
    99102      return;
    100103
    101 #if DEPTH_BITS==16
    102    z0 = FloatToFixed(VB->Win.data[vert0][2]);
    103    z1 = FloatToFixed(VB->Win.data[vert1][2]);
    104 #else
    105    z0 = (int) VB->Win.data[vert0][2];
    106    z1 = (int) VB->Win.data[vert1][2];
    107 #endif
     104   if (depthBits <= 16) {
     105      z0 = FloatToFixed(VB->Win.data[vert0][2]);
     106      z1 = FloatToFixed(VB->Win.data[vert1][2]);
     107   }
     108   else {
     109      z0 = (int) VB->Win.data[vert0][2];
     110      z1 = (int) VB->Win.data[vert1][2];
     111   }
    108112
    109113#if INTERP_STUV0
     
    195199      GLint x = x0;
    196200      GLfloat y = VB->Win.data[vert0][1];
    197       GLfloat yStep = (VB->Win.data[vert1][1] - y) / (GLfloat) dx;
    198       GLint dz = (z1 - z0) / dx;
    199       GLfloat invDx = 1.0F / dx;
    200       (void) invDx;
     201      const GLfloat invDx = 1.0F / dx;
     202      GLfloat yStep = (VB->Win.data[vert1][1] - y) * invDx;
     203      GLint dz = (GLint) ((z1 - z0) * invDx);
    201204#if INTERP_RGBA
    202205      if (ctx->Light.ShadeModel == GL_SMOOTH) {
     
    226229      dhv1 *= invDx;
    227230#endif
     231#if INTERP_INDEX
     232      if (ctx->Light.ShadeModel == GL_SMOOTH) {
     233         dfi = (IntToFixed(VB->IndexPtr->data[vert1]) - fi) * invDx;
     234      }
     235#endif
     236
    228237      for (i = 0; i < dx; i++) {
    229238         if (solid || (ctx->Line.StipplePattern & (1 << ((ctx->StippleCounter/ctx->Line.StippleFactor) & 0xf)))) {
     
    250259            GLuint coverage;
    251260#endif
    252 #if DEPTH_BITS==16
    253             GLdepth z = FixedToInt(z0);
    254 #else
    255             GLdepth z = z0;
    256 #endif
     261            GLdepth z = FixedToDepth(z0);
    257262            ASSERT(yBoti <= yTopi);
    258263
     
    345350      GLint y = y0;
    346351      GLfloat x = VB->Win.data[vert0][0];
    347       GLfloat xStep = (VB->Win.data[vert1][0] - x) / (GLfloat) dy;
    348       GLint dz = (z1 - z0) / dy;
    349       GLfloat invDy = 1.0F / dy;
    350       (void) invDy;
     352      const GLfloat invDy = 1.0F / dy;
     353      GLfloat xStep = (VB->Win.data[vert1][0] - x) * invDy;
     354      GLint dz = (GLint) ((z1 - z0) * invDy);
    351355#if INTERP_RGBA
    352356      if (ctx->Light.ShadeModel == GL_SMOOTH) {
     
    378382#if INTERP_INDEX
    379383      if (ctx->Light.ShadeModel == GL_SMOOTH) {
    380          dfi = (IntToFixed(VB->IndexPtr->data[vert1]) - fi) / dy;
     384         dfi = (IntToFixed(VB->IndexPtr->data[vert1]) - fi) * invDy;
    381385      }
    382386#endif
     
    404408            GLuint coverage;
    405409#endif
    406 #if DEPTH_BITS==16
    407             GLdepth z = FixedToInt(z0);
    408 #else
    409             GLdepth z = z0;
    410 #endif
     410            GLdepth z = FixedToDepth(z0);
    411411
    412412            ASSERT(xLefti < xRight);
  • trunk/src/opengl/mesa/logic.h

    r2938 r3597  
    1 /* $Id: logic.h,v 1.1 2000-02-29 00:48:33 sandervl Exp $ */
     1/* $Id: logic.h,v 1.2 2000-05-23 20:34:52 jeroen Exp $ */
    22
    33/*
    44 * Mesa 3-D graphics library
    5  * Version:  3.1
     5 * Version:  3.3
    66 *
    77 * Copyright (C) 1999  Brian Paul   All Rights Reserved.
     
    3636
    3737
    38 extern void gl_LogicOp( GLcontext *ctx, GLenum opcode );
     38extern void
     39_mesa_LogicOp( GLenum opcode );
    3940
    4041
  • trunk/src/opengl/mesa/macros.h

    r2938 r3597  
    1 /* $Id: macros.h,v 1.1 2000-02-29 00:48:33 sandervl Exp $ */
     1/* $Id: macros.h,v 1.2 2000-05-23 20:34:52 jeroen Exp $ */
    22
    33/*
    44 * Mesa 3-D graphics library
    5  * Version:  3.1
     5 * Version:  3.3
    66 *
    77 * Copyright (C) 1999  Brian Paul   All Rights Reserved.
     
    2525 */
    2626
    27 
    28 
    29 
    30 
    3127/*
    3228 * A collection of useful macros.
     
    3733#define MACROS_H
    3834
    39 #ifndef XFree86Server
    40 #include <assert.h>
    41 #include <math.h>
    42 #include <string.h>
    43 #else
    44 #include <GL/glx_ansic.h>
    45 #endif
    46 
    47 
    48 #ifdef DEBUG
     35#if defined(DEBUG)
    4936#  define ASSERT(X)   assert(X)
     37#define ABORT()       abort()
     38#define EXIT(rc)      exit(rc)
    5039#else
    5140#  define ASSERT(X)
     41#define ABORT()       abort()
     42#define EXIT(rc)      exit(rc)
     43#endif
     44
     45#if defined(__WIN32OS2__)
     46#ifdef DEBUG
     47#undef ASSERT
     48#undef ABORT
     49#undef EXIT
     50#define ASSERT(X) if(!(X)) { char msg[200]; sprintf(msg,"Assertion failed at line %d in %s",__LINE__,__FILE__); \
     51MessageBox(0,msg,"Error",MB_OK); \
     52}
     53#define ABORT() {char msg[200]; sprintf(msg,"ABORT at line %d in %s",__FILE__,__LINE__); \
     54abort(); }
     55#define EXIT(rc) {char msg[200]; sprintf(msg,"EXIT at line %d in %s - rc %d",__FILE__,__LINE__,rc); \
     56exit(rc); }
     57#else
     58#define ASSERT(X)
     59#define ABORT()       abort()
     60#define EXIT(rc)      exit(rc)
     61#endif
    5262#endif
    5363
     
    6272
    6373
     74/* Limits: */
     75#define MAX_GLUSHORT    0xffff
     76#define MAX_GLUINT      0xffffffff
     77
     78
     79/* Some compilers don't like some of Mesa's const usage */
     80#ifdef NO_CONST
     81#  define CONST
     82#else
     83#  define CONST const
     84#endif
     85
     86
     87/* Pi */
     88#ifndef M_PI
     89#define M_PI (3.1415926)
     90#endif
     91
     92
     93/* Degrees to radians conversion: */
     94#define DEG2RAD (M_PI/180.0)
     95
     96
     97#ifndef NULL
     98#define NULL 0
     99#endif
     100
     101
     102
     103/*
     104 * Bitmask helpers
     105 */
     106#define SET_BITS(WORD, BITS)    (WORD) |= (BITS)
     107#define CLEAR_BITS(WORD, BITS)  (WORD) &= ~(BITS)
     108#define TEST_BITS(WORD, BITS)   ((WORD) & (BITS))
     109
     110
    64111/* Stepping a GLfloat pointer by a byte stride
    65112 */
     
    69116
    70117
    71 /* Limits: */
    72 #define MAX_GLUSHORT    0xffff
    73 #define MAX_GLUINT      0xffffffff
    74 
    75 
    76118#define ZERO_2V( DST )  (DST)[0] = (DST)[1] = 0
    77119#define ZERO_3V( DST )  (DST)[0] = (DST)[1] = (DST)[2] = 0
     
    81123/* Copy short vectors: */
    82124#define COPY_2V( DST, SRC )                     \
    83 /*do*/ {                                            \
     125do {                                            \
    84126   (DST)[0] = (SRC)[0];                         \
    85127   (DST)[1] = (SRC)[1];                         \
    86 }                                                              /* while (0)*/
     128} while (0)
    87129
    88130
    89131#define COPY_3V( DST, SRC )                     \
    90 /*do */{                                            \
     132do {                                            \
    91133   (DST)[0] = (SRC)[0];                         \
    92134   (DST)[1] = (SRC)[1];                         \
    93135   (DST)[2] = (SRC)[2];                         \
    94 }                                                              /* while (0)*/
     136} while (0)
    95137
    96138#define COPY_4V( DST, SRC )                     \
    97 /*do */{                                            \
     139do {                                            \
    98140   (DST)[0] = (SRC)[0];                         \
    99141   (DST)[1] = (SRC)[1];                         \
    100142   (DST)[2] = (SRC)[2];                         \
    101143   (DST)[3] = (SRC)[3];                         \
    102 }                                                              /* while (0)*/
     144} while (0)
    103145
    104146
    105147#define COPY_2FV( DST, SRC )                    \
    106 /*do*/ {                                            \
     148do {                                            \
    107149   const GLfloat *_tmp = (SRC);                 \
    108150   (DST)[0] = _tmp[0];                          \
    109151   (DST)[1] = _tmp[1];                          \
    110 }                                                              /* while (0)*/
     152} while (0)
    111153
    112154
    113155#define COPY_3FV( DST, SRC )                    \
    114 /*do*/ {                                            \
     156do {                                            \
    115157   const GLfloat *_tmp = (SRC);                 \
    116158   (DST)[0] = _tmp[0];                          \
    117159   (DST)[1] = _tmp[1];                          \
    118160   (DST)[2] = _tmp[2];                          \
    119 }                                                              /* while (0)*/
     161} while (0)
    120162
    121163#define COPY_4FV( DST, SRC )                    \
    122 /*do*/ {                                            \
     164do {                                            \
    123165   const GLfloat *_tmp = (SRC);                 \
    124166   (DST)[0] = _tmp[0];                          \
     
    126168   (DST)[2] = _tmp[2];                          \
    127169   (DST)[3] = _tmp[3];                          \
    128 }                                                              /* while (0)*/
     170} while (0)
    129171
    130172
    131173
    132174#define COPY_SZ_4V(DST, SZ, SRC)                \
    133 /*do */{                                            \
     175do {                                            \
    134176   switch (SZ) {                                \
    135177   case 4: (DST)[3] = (SRC)[3];                 \
     
    138180   case 1: (DST)[0] = (SRC)[0];                 \
    139181   }                                            \
    140 }                                                               /* while(0)*/
     182} while(0)
    141183
    142184#define SUB_4V( DST, SRCA, SRCB )               \
    143 /*do */{                                            \
     185do {                                            \
    144186      (DST)[0] = (SRCA)[0] - (SRCB)[0];         \
    145187      (DST)[1] = (SRCA)[1] - (SRCB)[1];         \
    146188      (DST)[2] = (SRCA)[2] - (SRCB)[2];         \
    147189      (DST)[3] = (SRCA)[3] - (SRCB)[3];         \
    148 }                                                              /* while (0)*/
     190} while (0)
    149191
    150192#define ADD_4V( DST, SRCA, SRCB )               \
    151 /*do*/ {                                            \
     193do {                                            \
    152194      (DST)[0] = (SRCA)[0] + (SRCB)[0];         \
    153195      (DST)[1] = (SRCA)[1] + (SRCB)[1];         \
    154196      (DST)[2] = (SRCA)[2] + (SRCB)[2];         \
    155197      (DST)[3] = (SRCA)[3] + (SRCB)[3];         \
    156 }                                                              /* while (0)*/
     198} while (0)
    157199
    158200#define SCALE_4V( DST, SRCA, SRCB )             \
    159 /*do*/ {                                            \
     201do {                                            \
    160202      (DST)[0] = (SRCA)[0] * (SRCB)[0];         \
    161203      (DST)[1] = (SRCA)[1] * (SRCB)[1];         \
    162204      (DST)[2] = (SRCA)[2] * (SRCB)[2];         \
    163205      (DST)[3] = (SRCA)[3] * (SRCB)[3];         \
    164 }                                                              /* while (0)*/
     206} while (0)
    165207
    166208#define ACC_4V( DST, SRC )                      \
    167 /*do*/ {                                            \
    168       (DST)[0] += (SRC)[0];                             \
    169       (DST)[1] += (SRC)[1];                             \
    170       (DST)[2] += (SRC)[2];                             \
    171       (DST)[3] += (SRC)[3];                             \
    172 }                                                              /* while (0)*/
     209do {                                            \
     210      (DST)[0] += (SRC)[0];                     \
     211      (DST)[1] += (SRC)[1];                     \
     212      (DST)[2] += (SRC)[2];                     \
     213      (DST)[3] += (SRC)[3];                     \
     214} while (0)
    173215
    174216#define ACC_SCALE_4V( DST, SRCA, SRCB )         \
    175 /*do*/ {                                            \
    176       (DST)[0] += (SRCA)[0] * (SRCB)[0];                \
    177       (DST)[1] += (SRCA)[1] * (SRCB)[1];                \
    178       (DST)[2] += (SRCA)[2] * (SRCB)[2];                \
    179       (DST)[3] += (SRCA)[3] * (SRCB)[3];                \
    180 }                                                              /* while (0)*/
     217do {                                            \
     218      (DST)[0] += (SRCA)[0] * (SRCB)[0];        \
     219      (DST)[1] += (SRCA)[1] * (SRCB)[1];        \
     220      (DST)[2] += (SRCA)[2] * (SRCB)[2];        \
     221      (DST)[3] += (SRCA)[3] * (SRCB)[3];        \
     222} while (0)
    181223
    182224#define ACC_SCALE_SCALAR_4V( DST, S, SRCB )     \
    183 /*do*/ {                                            \
    184       (DST)[0] += S * (SRCB)[0];                        \
    185       (DST)[1] += S * (SRCB)[1];                        \
    186       (DST)[2] += S * (SRCB)[2];                        \
    187       (DST)[3] += S * (SRCB)[3];                        \
    188 }                                                              /* while (0)*/
     225do {                                            \
     226      (DST)[0] += S * (SRCB)[0];                \
     227      (DST)[1] += S * (SRCB)[1];                \
     228      (DST)[2] += S * (SRCB)[2];                \
     229      (DST)[3] += S * (SRCB)[3];                \
     230} while (0)
    189231
    190232#define SCALE_SCALAR_4V( DST, S, SRCB )         \
    191 /*do*/ {                                            \
     233do {                                            \
    192234      (DST)[0] = S * (SRCB)[0];                 \
    193235      (DST)[1] = S * (SRCB)[1];                 \
    194236      (DST)[2] = S * (SRCB)[2];                 \
    195237      (DST)[3] = S * (SRCB)[3];                 \
    196 }                                                              /* while (0)*/
     238} while (0)
    197239
    198240
    199241#define SELF_SCALE_SCALAR_4V( DST, S )          \
    200 /*do*/ {                                            \
     242do {                                            \
    201243      (DST)[0] *= S;                            \
    202244      (DST)[1] *= S;                            \
    203245      (DST)[2] *= S;                            \
    204246      (DST)[3] *= S;                            \
    205 }                                                              /* while (0)*/
     247} while (0)
    206248
    207249
     
    210252 */
    211253#define SUB_3V( DST, SRCA, SRCB )               \
    212 /*do*/ {                                            \
     254do {                                            \
    213255      (DST)[0] = (SRCA)[0] - (SRCB)[0];         \
    214256      (DST)[1] = (SRCA)[1] - (SRCB)[1];         \
    215257      (DST)[2] = (SRCA)[2] - (SRCB)[2];         \
    216 }                                                              /* while (0)*/
     258} while (0)
    217259
    218260#define ADD_3V( DST, SRCA, SRCB )               \
    219 /*do*/ {                                            \
     261do {                                            \
    220262      (DST)[0] = (SRCA)[0] + (SRCB)[0];         \
    221263      (DST)[1] = (SRCA)[1] + (SRCB)[1];         \
    222264      (DST)[2] = (SRCA)[2] + (SRCB)[2];         \
    223 }                                                              /* while (0)*/
     265} while (0)
    224266
    225267#define SCALE_3V( DST, SRCA, SRCB )             \
    226 /*do*/ {                                            \
     268do {                                            \
    227269      (DST)[0] = (SRCA)[0] * (SRCB)[0];         \
    228270      (DST)[1] = (SRCA)[1] * (SRCB)[1];         \
    229271      (DST)[2] = (SRCA)[2] * (SRCB)[2];         \
    230 }                                                              /* while (0)*/
     272} while (0)
    231273
    232274#define ACC_3V( DST, SRC )                      \
    233 /*do*/ {                                            \
     275do {                                            \
    234276      (DST)[0] += (SRC)[0];                     \
    235277      (DST)[1] += (SRC)[1];                     \
    236278      (DST)[2] += (SRC)[2];                     \
    237 }                                                              /* while (0)*/
     279} while (0)
    238280
    239281#define ACC_SCALE_3V( DST, SRCA, SRCB )         \
    240 /*do*/ {                                            \
     282do {                                            \
    241283      (DST)[0] += (SRCA)[0] * (SRCB)[0];        \
    242284      (DST)[1] += (SRCA)[1] * (SRCB)[1];        \
    243285      (DST)[2] += (SRCA)[2] * (SRCB)[2];        \
    244 }                                                              /* while (0)*/
     286} while (0)
    245287
    246288#define SCALE_SCALAR_3V( DST, S, SRCB )         \
    247 /*do*/ {                                            \
     289do {                                            \
    248290      (DST)[0] = S * (SRCB)[0];                 \
    249291      (DST)[1] = S * (SRCB)[1];                 \
    250292      (DST)[2] = S * (SRCB)[2];                 \
    251 }                                                              /* while (0)*/
     293} while (0)
    252294
    253295#define ACC_SCALE_SCALAR_3V( DST, S, SRCB )     \
    254 /*do*/ {                                            \
     296do {                                            \
    255297      (DST)[0] += S * (SRCB)[0];                \
    256298      (DST)[1] += S * (SRCB)[1];                \
    257299      (DST)[2] += S * (SRCB)[2];                \
    258 }                                                              /* while (0)*/
     300} while (0)
    259301
    260302#define SELF_SCALE_SCALAR_3V( DST, S )          \
    261 /*do*/ {                                            \
     303do {                                            \
    262304      (DST)[0] *= S;                            \
    263305      (DST)[1] *= S;                            \
    264306      (DST)[2] *= S;                            \
    265 }                                                              /* while (0)*/
     307} while (0)
    266308
    267309#define ACC_SCALAR_3V( DST, S )                 \
    268 /*do*/ {                                            \
     310do {                                            \
    269311      (DST)[0] += S;                            \
    270312      (DST)[1] += S;                            \
    271313      (DST)[2] += S;                            \
    272 }                                                              /* while (0)*/
     314} while (0)
    273315
    274316/* And also for 2-vectors
    275317 */
    276318#define SUB_2V( DST, SRCA, SRCB )               \
    277 /*do*/ {                                            \
     319do {                                            \
    278320      (DST)[0] = (SRCA)[0] - (SRCB)[0];         \
    279321      (DST)[1] = (SRCA)[1] - (SRCB)[1];         \
    280 }                                                              /* while (0)*/
     322} while (0)
    281323
    282324#define ADD_2V( DST, SRCA, SRCB )               \
    283 /*do*/ {                                            \
     325do {                                            \
    284326      (DST)[0] = (SRCA)[0] + (SRCB)[0];         \
    285327      (DST)[1] = (SRCA)[1] + (SRCB)[1];         \
    286 }                                                              /* while (0)*/
     328} while (0)
    287329
    288330#define SCALE_2V( DST, SRCA, SRCB )             \
    289 /*do*/ {                                            \
     331do {                                            \
    290332      (DST)[0] = (SRCA)[0] * (SRCB)[0];         \
    291333      (DST)[1] = (SRCA)[1] * (SRCB)[1];         \
    292 }                                                              /* while (0)*/
     334} while (0)
    293335
    294336#define ACC_2V( DST, SRC )                      \
    295 /*do*/ {                                            \
     337do {                                            \
    296338      (DST)[0] += (SRC)[0];                     \
    297339      (DST)[1] += (SRC)[1];                     \
    298 }                                                              /* while (0)*/
     340} while (0)
    299341
    300342#define ACC_SCALE_2V( DST, SRCA, SRCB )         \
    301 /*do*/ {                                            \
     343do {                                            \
    302344      (DST)[0] += (SRCA)[0] * (SRCB)[0];        \
    303345      (DST)[1] += (SRCA)[1] * (SRCB)[1];        \
    304 }                                                              /* while (0)*/
     346} while (0)
    305347
    306348#define SCALE_SCALAR_2V( DST, S, SRCB )         \
    307 /*do*/ {                                            \
     349do {                                            \
    308350      (DST)[0] = S * (SRCB)[0];                 \
    309351      (DST)[1] = S * (SRCB)[1];                 \
    310 }                                                              /* while (0)*/
     352} while (0)
    311353
    312354#define ACC_SCALE_SCALAR_2V( DST, S, SRCB )     \
    313 /*do*/ {                                            \
     355do {                                            \
    314356      (DST)[0] += S * (SRCB)[0];                \
    315357      (DST)[1] += S * (SRCB)[1];                \
    316 }                                                              /* while (0)*/
     358} while (0)
    317359
    318360#define SELF_SCALE_SCALAR_2V( DST, S )          \
    319 /*do*/ {                                            \
     361do {                                            \
    320362      (DST)[0] *= S;                            \
    321363      (DST)[1] *= S;                            \
    322 }                                                              /* while (0)*/
     364} while (0)
    323365
    324366#define ACC_SCALAR_2V( DST, S )                 \
    325 /*do*/ {                                            \
     367do {                                            \
    326368      (DST)[0] += S;                            \
    327369      (DST)[1] += S;                            \
    328 }                                                              /* while (0)*/
     370} while (0)
    329371
    330372
     
    334376 */
    335377#define COPY_4UBV(DST, SRC)                     \
    336 /*do*/ {                                        \
     378do {                                            \
    337379   if (sizeof(GLuint)==4*sizeof(GLubyte)) {     \
    338380      *((GLuint*)(DST)) = *((GLuint*)(SRC));    \
     
    344386      (DST)[3] = (SRC)[3];                      \
    345387   }                                            \
    346 }                                                              /* while (0)*/
     388} while (0)
    347389
    348390
    349391/* Assign scalers to short vectors: */
    350392#define ASSIGN_2V( V, V0, V1 )  \
    351 /*do*/ { V[0] = V0;  V[1] = V1; } //while(0)
     393do { V[0] = V0;  V[1] = V1; } while(0)
    352394
    353395#define ASSIGN_3V( V, V0, V1, V2 )  \
    354 /*do*/ { V[0] = V0;  V[1] = V1;  V[2] = V2; } //while(0)
     396do { V[0] = V0;  V[1] = V1;  V[2] = V2; } while(0)
    355397
    356398#define ASSIGN_4V( V, V0, V1, V2, V3 )          \
    357 /*do*/ {                                            \
     399do {                                            \
    358400    V[0] = V0;                                  \
    359401    V[1] = V1;                                  \
    360402    V[2] = V2;                                  \
    361403    V[3] = V3;                                  \
    362 }                                                               /* while(0)*/
     404} while(0)
    363405
    364406
     
    421463 * Integer / float conversion for colors, normals, etc.
    422464 */
    423 
    424 
    425 
    426465
    427466#define BYTE_TO_UBYTE(b)   (b < 0 ? 0 : (GLubyte) b)
     
    430469#define INT_TO_UBYTE(i)    (i < 0 ? 0 : (GLubyte) (i >> 23))
    431470#define UINT_TO_UBYTE(i)                (GLubyte) (i >> 24)
    432 
    433 
    434 
    435471
    436472/* Convert GLubyte in [0,255] to GLfloat in [0.0,1.0] */
     
    480516
    481517
    482 
    483 /*
    484  * Memory allocation
    485  * XXX these should probably go into a new glmemory.h file.
    486  */
    487 #ifdef DEBUG
    488 extern void *gl_malloc(size_t bytes);
    489 extern void *gl_calloc(size_t bytes);
    490 extern void gl_free(void *ptr);
    491 #define MALLOC(BYTES)      gl_malloc(BYTES)
    492 #define CALLOC(BYTES)      gl_calloc(BYTES)
    493 #define MALLOC_STRUCT(T)   (struct T *) gl_malloc(sizeof(struct T))
    494 #define CALLOC_STRUCT(T)   (struct T *) gl_calloc(sizeof(struct T))
    495 #define FREE(PTR)          gl_free(PTR)
    496 #else
    497 #define MALLOC(BYTES)      (void *) malloc(BYTES)
    498 #define CALLOC(BYTES)      (void *) calloc(1, BYTES)
    499 #define MALLOC_STRUCT(T)   (struct T *) malloc(sizeof(struct T))
    500 #define CALLOC_STRUCT(T)   (struct T *) calloc(1,sizeof(struct T))
    501 #define FREE(PTR)          free(PTR)
    502 #endif
    503 
    504 
    505 /* Memory copy: */
    506 #ifdef SUNOS4
    507 #define MEMCPY( DST, SRC, BYTES) \
    508         memcpy( (char *) (DST), (char *) (SRC), (int) (BYTES) )
    509 #else
    510 #define MEMCPY( DST, SRC, BYTES) \
    511         memcpy( (void *) (DST), (void *) (SRC), (size_t) (BYTES) )
    512 #endif
    513 
    514 
    515 /* Memory set: */
    516 #ifdef SUNOS4
    517 #define MEMSET( DST, VAL, N ) \
    518         memset( (char *) (DST), (int) (VAL), (int) (N) )
    519 #else
    520 #define MEMSET( DST, VAL, N ) \
    521         memset( (void *) (DST), (int) (VAL), (size_t) (N) )
    522 #endif
    523 
    524 
    525 /* MACs and BeOS don't support static larger than 32kb, so... */
    526 #if defined(macintosh) && !defined(__MRC__)
    527   extern char *AGLAlloc(int size);
    528   extern void AGLFree(char* ptr);
    529 #  define DEFARRAY(TYPE,NAME,SIZE)                      TYPE *NAME = (TYPE*)AGLAlloc(sizeof(TYPE)*(SIZE))
    530 #  define DEFMARRAY(TYPE,NAME,SIZE1,SIZE2)              TYPE (*NAME)[SIZE2] = (TYPE(*)[SIZE2])AGLAlloc(sizeof(TYPE)*(SIZE1)*(SIZE2))
    531 #  define CHECKARRAY(NAME,CMD)                          do {if (!(NAME)) {CMD;}} while (0)
    532 #  define UNDEFARRAY(NAME)                              do {if ((NAME)) {AGLFree((char*)NAME);}  }while (0)
    533 #elif defined(__BEOS__)
    534 #  define DEFARRAY(TYPE,NAME,SIZE)                      TYPE *NAME = (TYPE*)malloc(sizeof(TYPE)*(SIZE))
    535 #  define DEFMARRAY(TYPE,NAME,SIZE1,SIZE2)              TYPE (*NAME)[SIZE2] = (TYPE(*)[SIZE2])malloc(sizeof(TYPE)*(SIZE1)*(SIZE2))
    536 #  define CHECKARRAY(NAME,CMD)                          do {if (!(NAME)) {CMD;}} while (0)
    537 #  define UNDEFARRAY(NAME)                              do {if ((NAME)) {free((char*)NAME);}  }while (0)
    538 #else
    539 #  define DEFARRAY(TYPE,NAME,SIZE)                      TYPE NAME[SIZE]
    540 #  define DEFMARRAY(TYPE,NAME,SIZE1,SIZE2)              TYPE NAME[SIZE1][SIZE2]
    541 #  define CHECKARRAY(NAME,CMD)                          do {} while(0)
    542 #  define UNDEFARRAY(NAME)
    543 #endif
    544 
    545 
    546 /* Some compilers don't like some of Mesa's const usage */
    547 #ifdef NO_CONST
    548 #  define CONST
    549 #else
    550 #  define CONST const
    551 #endif
    552 
    553 
    554 
    555 /* Pi */
    556 #ifndef M_PI
    557 #define M_PI (3.1415926)
    558 #endif
    559 
    560 
    561 /* Degrees to radians conversion: */
    562 #define DEG2RAD (M_PI/180.0)
    563 
    564 
    565 #ifndef NULL
    566 #define NULL 0
    567 #endif
    568 
    569 
    570 
    571518#endif /*MACROS_H*/
  • trunk/src/opengl/mesa/masking.h

    r2938 r3597  
    1 /* $Id: masking.h,v 1.1 2000-02-29 00:48:33 sandervl Exp $ */
     1/* $Id: masking.h,v 1.2 2000-05-23 20:34:52 jeroen Exp $ */
    22
    33/*
    44 * Mesa 3-D graphics library
    5  * Version:  3.1
     5 * Version:  3.3
    66 *
    77 * Copyright (C) 1999  Brian Paul   All Rights Reserved.
     
    3737
    3838
    39 extern void gl_IndexMask( GLcontext *ctx, GLuint mask );
     39extern void
     40_mesa_IndexMask( GLuint mask );
    4041
    41 extern void gl_ColorMask( GLcontext *ctx, GLboolean red, GLboolean green,
    42                           GLboolean blue, GLboolean alpha );
     42extern void
     43_mesa_ColorMask( GLboolean red, GLboolean green,
     44                 GLboolean blue, GLboolean alpha );
    4345
    4446
  • trunk/src/opengl/mesa/matrix.h

    r2938 r3597  
    1 /* $Id: matrix.h,v 1.1 2000-02-29 00:48:33 sandervl Exp $ */
     1/* $Id: matrix.h,v 1.2 2000-05-23 20:34:52 jeroen Exp $ */
    22
    33/*
    44 * Mesa 3-D graphics library
    5  * Version:  3.1
     5 * Version:  3.3
    66 *
    77 * Copyright (C) 1999  Brian Paul   All Rights Reserved.
     
    3333
    3434
    35 #include "gl.h"
    3635#include "config.h"
    3736
    3837typedef struct {
    3938   GLfloat m[16];
    40    GLfloat *inv;                /* optional */
     39   GLfloat *inv;                                                /* optional*/
    4140   GLuint flags;
    4241   GLuint type;
    4342} GLmatrix;
     43
    4444
    4545#ifdef VMS
     
    4848
    4949
     50extern void gl_matrix_transposef( GLfloat to[16], const GLfloat from[16] );
     51
     52extern void gl_matrix_transposed( GLdouble to[16], const GLdouble from[16] );
     53
     54
    5055extern void gl_rotation_matrix( GLfloat angle, GLfloat x, GLfloat y, GLfloat z,
    5156                                GLfloat m[] );
    5257
    5358
     59extern void gl_mat_mul_floats( GLmatrix *mat, const GLfloat *m, GLuint flags );
    5460
    55 extern void gl_Frustum( GLcontext *ctx,
    56                         GLdouble left, GLdouble right,
    57                         GLdouble bottom, GLdouble top,
    58                         GLdouble nearval, GLdouble farval );
    59 
    60 extern void gl_Ortho( GLcontext *ctx,
    61                       GLdouble left, GLdouble right,
    62                       GLdouble bottom, GLdouble top,
    63                       GLdouble nearval, GLdouble farval );
    64 
    65 extern void gl_PushMatrix( GLcontext *ctx );
    66 
    67 extern void gl_PopMatrix( GLcontext *ctx );
    68 
    69 extern void gl_LoadIdentity( GLcontext *ctx );
    70 
    71 extern void gl_LoadMatrixf( GLcontext *ctx, const GLfloat *m );
    72 
    73 extern void gl_MatrixMode( GLcontext *ctx, GLenum mode );
    74 
    75 extern void gl_MultMatrixf( GLcontext *ctx, const GLfloat *m );
    76 
    77 extern void gl_mat_mul_floats( GLmatrix *mat, const GLfloat *m, GLuint flags );
    7861extern void gl_mat_mul_mat( GLmatrix *mat, const GLmatrix *mat2 );
    79 
    80 extern void gl_Rotatef( GLcontext *ctx,
    81                         GLfloat angle, GLfloat x, GLfloat y, GLfloat z );
    82 
    83 extern void gl_Scalef( GLcontext *ctx, GLfloat x, GLfloat y, GLfloat z );
    84 
    85 extern void gl_Translatef( GLcontext *ctx, GLfloat x, GLfloat y, GLfloat z );
    86 
    87 extern void gl_Viewport( GLcontext *ctx,
    88                          GLint x, GLint y, GLsizei width, GLsizei height );
    89 
    90 extern void gl_DepthRange( GLcontext* ctx, GLclampd nearval, GLclampd farval );
    91 
    92 
    93 
    94 
    9562
    9663extern void gl_calculate_model_project_matrix( GLcontext *ctx );
    9764
     65extern void gl_matrix_copy( GLmatrix *to, const GLmatrix *from );
    9866
    9967extern void gl_matrix_ctr( GLmatrix *m );
     
    10371extern void gl_matrix_alloc_inv( GLmatrix *m );
    10472
    105 extern void gl_matrix_copy( GLmatrix *to, const GLmatrix *from );
    106 
    10773extern void gl_matrix_mul( GLmatrix *dest,
    10874                           const GLmatrix *a,
     
    11177extern void gl_matrix_analyze( GLmatrix *mat );
    11278
     79extern GLboolean gl_matrix_invert( GLmatrix *mat );
    11380
    114 extern void gl_MultMatrixd( GLcontext *ctx, const GLdouble *m );
    115 extern GLboolean gl_matrix_invert( GLmatrix *mat );
    11681extern void gl_print_matrix( const GLmatrix *m );
    11782
    11883
     84
     85extern void
     86_mesa_Frustum( GLdouble left, GLdouble right,
     87               GLdouble bottom, GLdouble top,
     88               GLdouble nearval, GLdouble farval );
     89
     90extern void
     91_mesa_Ortho( GLdouble left, GLdouble right,
     92             GLdouble bottom, GLdouble top,
     93             GLdouble nearval, GLdouble farval );
     94
     95extern void
     96_mesa_PushMatrix( void );
     97
     98extern void
     99_mesa_PopMatrix( void );
     100
     101extern void
     102_mesa_LoadIdentity( void );
     103
     104extern void
     105_mesa_LoadMatrixf( const GLfloat *m );
     106
     107extern void
     108_mesa_LoadMatrixd( const GLdouble *m );
     109
     110extern void
     111_mesa_MatrixMode( GLenum mode );
     112
     113extern void
     114_mesa_MultMatrixf( const GLfloat *m );
     115
     116extern void
     117_mesa_MultMatrixd( const GLdouble *m );
     118
     119extern void
     120_mesa_Rotatef( GLfloat angle, GLfloat x, GLfloat y, GLfloat z );
     121
     122extern void
     123_mesa_Rotated( GLdouble angle, GLdouble x, GLdouble y, GLdouble z );
     124
     125extern void
     126_mesa_Scalef( GLfloat x, GLfloat y, GLfloat z );
     127
     128extern void
     129_mesa_Scaled( GLdouble x, GLdouble y, GLdouble z );
     130
     131extern void
     132_mesa_Translatef( GLfloat x, GLfloat y, GLfloat z );
     133
     134extern void
     135_mesa_Translated( GLdouble x, GLdouble y, GLdouble z );
     136
     137extern void
     138_mesa_LoadTransposeMatrixfARB( const GLfloat *m );
     139
     140extern void
     141_mesa_LoadTransposeMatrixdARB( const GLdouble *m );
     142
     143extern void
     144_mesa_MultTransposeMatrixfARB( const GLfloat *m );
     145
     146extern void
     147_mesa_MultTransposeMatrixdARB( const GLdouble *m );
     148
     149extern void
     150_mesa_Viewport( GLint x, GLint y, GLsizei width, GLsizei height );
     151
     152extern void
     153gl_Viewport( GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height );
     154
     155extern void
     156_mesa_DepthRange( GLclampd nearval, GLclampd farval );
     157
     158
     159
    119160#endif
  • trunk/src/opengl/mesa/mesa_extend.h

    r2938 r3597  
    1 /* $Id: mesa_extend.h,v 1.1 2000-02-29 00:48:33 sandervl Exp $ */
     1/* $Id: mesa_extend.h,v 1.2 2000-05-23 20:34:53 jeroen Exp $ */
    22/* mesa_extend.h
    33 * for wmesa-2.3
     
    99 * struct DisplayOptions defined for tk_ddmesa.c to read the initial file
    1010 */
    11 
    12 #include "gl.h"
    13 #include <stdlib.h>
    14 #ifdef __WIN32OS2__
    15 #include <os2win.h>
    16 #else
    17 #include <windows.h>
    18 #include <winbase.h>
    19 #endif
    2011
    2112typedef enum SHIFT{ SHIFT_NONE, SHIFT_LEFT,SHIFT_RIGHT,SHIFT_UP,SHIFT_DOWN,SHIFT_FAR,SHIFT_NEAR};
  • trunk/src/opengl/mesa/mmath.h

    r2938 r3597  
    1 /* $Id: mmath.h,v 1.1 2000-02-29 00:48:34 sandervl Exp $ */
     1/* $Id: mmath.h,v 1.2 2000-05-23 20:34:53 jeroen Exp $ */
    22
    33/*
    44 * Mesa 3-D graphics library
    5  * Version:  3.1
     5 * Version:  3.3
    66 *
    77 * Copyright (C) 1999  Brian Paul   All Rights Reserved.
     
    2424 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
    2525 */
    26 /* $XFree86: xc/lib/GL/mesa/src/mmath.h,v 1.2 1999/04/04 00:20:28 dawes Exp $ */
    27 
    28 
    29 
    3026
    3127
     
    4036#define MMATH_H
    4137
    42 #ifdef HAVE_CONFIG_H
    43 #include "conf.h"
    44 #endif
    45 
    46 #ifndef XFree86Server
    47 #include <math.h>
    48 #else
    49 #include "GL/xf86glx.h"
    50 #endif
     38
     39#include "glheader.h"
     40
    5141
    5242/*
     
    7464 */
    7565#if !defined(NO_FAST_MATH)
    76 #define START_FAST_MATH(x)                                      \
     66#define START_FAST_MATH(x)                  \
    7767   {                                                            \
    7868      static fpu_control_t mask = _FPU_SINGLE | _FPU_MASK_IM    \
     
    9888   }
    9989
     90#define HAVE_FAST_MATH
     91
     92#elif defined(__WATCOMC__) && !defined(NO_FAST_MATH)
     93
     94/* This is the watcom specific inline assembly version of setcw and getcw */
     95
     96void START_FAST_MATH2(unsigned short *x);
     97#pragma aux START_FAST_MATH2 =          \
     98    "fstcw   word ptr [esi]"            \
     99    "or      word ptr [esi], 0x3f"      \
     100    "fldcw   word ptr [esi]"            \
     101    parm [esi]                          \
     102    modify exact [];
     103
     104void END_FAST_MATH2(unsigned short *x);
     105#pragma aux END_FAST_MATH2 =            \
     106    "fldcw   word ptr [esi]"            \
     107    parm [esi]                          \
     108    modify exact [];
     109
     110#define START_FAST_MATH(x)  START_FAST_MATH2(& x)
     111#define END_FAST_MATH(x)  END_FAST_MATH2(& x)
     112
     113/*
     114__inline START_FAST_MATH(unsigned short x)
     115    {
     116    _asm {
     117        fstcw   ax
     118        mov     x , ax
     119        or      ax, 0x3f
     120        fldcw   ax
     121        }
     122    }
     123
     124__inline END_FAST_MATH(unsigned short x)
     125    {
     126    _asm {
     127        fldcw   x
     128        }
     129    }
     130*/
    100131#define HAVE_FAST_MATH
    101132
     
    132163   int r;
    133164   _asm {
    134      fld f
    135      fistp r
    136     }
     165         fld f
     166         fistp r
     167        }
    137168   return r;
    138169}
    139 #elif defined(__WIN32OS2__)
     170#elif defined(__WATCOMC__)
     171long FloatToInt(float f);
     172#pragma aux FloatToInt =                \
     173        "push   eax"                        \
     174        "fistp  dword ptr [esp]"            \
     175        "pop    eax"                        \
     176        parm [8087]                         \
     177        value [eax]                         \
     178        modify exact [eax];
     179float asm_sqrt (float x);
     180#pragma aux asm_sqrt =                  \
     181        "fsqrt"                             \
     182        parm [8087]                         \
     183        value [8087]                        \
     184        modify exact [];
     185#else
    140186#define FloatToInt(F) ((int) (F))
    141187#endif
     
    145191
    146192
    147 
    148 
    149 
    150193/*
    151194 * Square root
     
    155198
    156199#ifdef FAST_MATH
     200#if defined (__WATCOMC__) && defined(USE_X86_ASM)
     201#  define GL_SQRT(X)  asm_sqrt(X)
     202#else
    157203#  define GL_SQRT(X)  gl_sqrt(X)
     204#endif
    158205#else
    159206#  define GL_SQRT(X)  sqrt(X)
     
    161208
    162209
    163 
    164210/*
    165211 * Normalize a 3-element vector to unit length.
    166212 */
    167 #define NORMALIZE_3FV( V )                      \
    168 do {                                            \
    169    GLdouble len = LEN_SQUARED_3FV(V);           \
    170    if (len > 1e-50) {                           \
    171       len = 1.0 / GL_SQRT(len);                 \
    172       V[0] = (GLfloat) (V[0] * len);            \
    173       V[1] = (GLfloat) (V[1] * len);            \
    174       V[2] = (GLfloat) (V[2] * len);            \
    175    }                                            \
     213#define NORMALIZE_3FV( V )                      \
     214do {                                            \
     215   GLdouble len = LEN_SQUARED_3FV(V);           \
     216   if (len > 1e-50) {                           \
     217      len = 1.0 / GL_SQRT(len);                 \
     218      V[0] = (GLfloat) (V[0] * len);            \
     219      V[1] = (GLfloat) (V[1] * len);            \
     220      V[2] = (GLfloat) (V[2] * len);            \
     221   }                                            \
    176222} while(0)
    177223
     
    194240#define IEEE_ONE 0x3f7f0000
    195241
    196 #define CLAMP_FLOAT_COLOR(f)                    \
    197         do {                                    \
    198            if (*(GLuint *)&f >= IEEE_ONE)       \
    199               f = (*(GLint *)&f < 0) ? 0 : 1;   \
    200         } while(0)
     242#define CLAMP_FLOAT_COLOR(f)                    \
     243        do {                                    \
     244           if (*(GLuint *)&f >= IEEE_ONE)       \
     245              f = (*(GLint *)&f < 0) ? 0 : 1;   \
     246        } while(0)
    201247
    202248#define CLAMP_FLOAT_COLOR_VALUE(f)              \
     
    283329
    284330
    285 extern void gl_init_math(void);
    286 
    287 
    288 #endif
     331extern void _mesa_init_math(void);
     332
     333
     334#endif
  • trunk/src/opengl/mesa/mmx.h

    r2962 r3597  
    1 /* $Id: mmx.h,v 1.2 2000-03-01 18:49:32 jeroen Exp $ */
     1/* $Id: mmx.h,v 1.3 2000-05-23 20:34:53 jeroen Exp $ */
    22
    33/*
     
    3333
    3434
    35 extern void __cdecl
     35extern void _ASMAPI
    3636gl_mmx_blend_transparency( GLcontext *ctx, GLuint n, const GLubyte mask[],
    3737                           GLubyte rgba[][4], const GLubyte dest[][4] );
  • trunk/src/opengl/mesa/norm_tmp.h

    r2938 r3597  
    1 /* $Id: norm_tmp.h,v 1.1 2000-02-29 00:48:34 sandervl Exp $ */
     1/* $Id: norm_tmp.h,v 1.2 2000-05-23 20:34:53 jeroen Exp $ */
    22
    33/*
     
    3030
    3131
    32 static void TAG(transform_normalize_normals)( const GLmatrix *mat,
    33                                               GLfloat scale,
    34                                               const GLvector3f *in,
    35                                               const GLfloat *lengths,
    36                                               const GLubyte mask[],
    37                                               GLvector3f *dest )
     32static void _XFORMAPI TAG(transform_normalize_normals)( const GLmatrix *mat,
     33                                              GLfloat scale,
     34                                              const GLvector3f *in,
     35                                              const GLfloat *lengths,
     36                                              const GLubyte mask[],
     37                                              GLvector3f *dest )
    3838{
    3939   GLuint i;
     
    5050   if (!lengths) {
    5151      STRIDE_LOOP {
    52         CULL_CHECK {
    53             GLfloat tx, ty, tz;
    54             {
    55                const GLfloat ux = from[0],  uy = from[1],  uz = from[2];
    56                tx = ux * m0 + uy * m1 + uz * m2;
    57                ty = ux * m4 + uy * m5 + uz * m6;
    58                tz = ux * m8 + uy * m9 + uz * m10;
    59             }
    60             {
    61                GLdouble len = tx*tx + ty*ty + tz*tz;
    62                if (len > 1e-20) {
    63                   GLdouble scale = 1.0 / GL_SQRT(len);
    64                   out[i][0] = (GLfloat) (tx * scale);
    65                   out[i][1] = (GLfloat) (ty * scale);
    66                   out[i][2] = (GLfloat) (tz * scale);
    67                }
    68                else
    69                {
    70                   out[i][0] = out[i][1] = out[i][2] = 0;
    71                }
    72             }
    73         }
     52        CULL_CHECK {
     53            GLfloat tx, ty, tz;
     54            {
     55               const GLfloat ux = from[0],  uy = from[1],  uz = from[2];
     56               tx = ux * m0 + uy * m1 + uz * m2;
     57               ty = ux * m4 + uy * m5 + uz * m6;
     58               tz = ux * m8 + uy * m9 + uz * m10;
     59            }
     60            {
     61               GLdouble len = tx*tx + ty*ty + tz*tz;
     62               if (len > 1e-20) {
     63                  GLdouble scale = 1.0 / GL_SQRT(len);
     64                  out[i][0] = (GLfloat) (tx * scale);
     65                  out[i][1] = (GLfloat) (ty * scale);
     66                  out[i][2] = (GLfloat) (tz * scale);
     67               }
     68               else
     69               {
     70                  out[i][0] = out[i][1] = out[i][2] = 0;
     71               }
     72            }
     73        }
    7474      }
    7575   } else {
     
    7878       */
    7979      if (scale != 1.0) {
    80         m0 *= scale,  m4 *= scale,  m8 *= scale;
    81         m1 *= scale,  m5 *= scale,  m9 *= scale;
    82         m2 *= scale,  m6 *= scale,  m10 *= scale;
    83       }
    84 
    85       STRIDE_LOOP {
    86         CULL_CHECK {
    87             GLfloat tx, ty, tz;
    88             {
    89                const GLfloat ux = from[0],  uy = from[1],  uz = from[2];
    90                tx = ux * m0 + uy * m1 + uz * m2;
    91                ty = ux * m4 + uy * m5 + uz * m6;
    92                tz = ux * m8 + uy * m9 + uz * m10;
    93             }
    94             {
    95                GLfloat len = lengths[i];
    96                out[i][0] = tx * len;
    97                out[i][1] = ty * len;
    98                out[i][2] = tz * len;
    99             }
    100         }
    101       }
    102    }
    103    dest->count = in->count;
    104 }
    105 
    106 static void TAG(transform_normalize_normals_no_rot)( const GLmatrix *mat,
    107                                                      GLfloat scale,
    108                                                      const GLvector3f *in,
    109                                                      const GLfloat *lengths,
    110                                                      const GLubyte mask[],
    111                                                      GLvector3f *dest )
     80        m0 *= scale,  m4 *= scale,  m8 *= scale;
     81        m1 *= scale,  m5 *= scale,  m9 *= scale;
     82        m2 *= scale,  m6 *= scale,  m10 *= scale;
     83      }
     84
     85      STRIDE_LOOP {
     86        CULL_CHECK {
     87            GLfloat tx, ty, tz;
     88            {
     89               const GLfloat ux = from[0],  uy = from[1],  uz = from[2];
     90               tx = ux * m0 + uy * m1 + uz * m2;
     91               ty = ux * m4 + uy * m5 + uz * m6;
     92               tz = ux * m8 + uy * m9 + uz * m10;
     93            }
     94            {
     95               GLfloat len = lengths[i];
     96               out[i][0] = tx * len;
     97               out[i][1] = ty * len;
     98               out[i][2] = tz * len;
     99            }
     100        }
     101      }
     102   }
     103   dest->count = in->count;
     104}
     105
     106static void _XFORMAPI TAG(transform_normalize_normals_no_rot)( const GLmatrix *mat,
     107                                                     GLfloat scale,
     108                                                     const GLvector3f *in,
     109                                                     const GLfloat *lengths,
     110                                                     const GLubyte mask[],
     111                                                     GLvector3f *dest )
    112112{
    113113   GLuint i;
     
    123123   if (!lengths) {
    124124      STRIDE_LOOP {
    125         CULL_CHECK {
    126             GLfloat tx, ty, tz;
    127             {
    128                const GLfloat ux = from[0],  uy = from[1],  uz = from[2];
    129                tx = ux * m0                    ;
    130                ty =           uy * m5          ;
    131                tz =                     uz * m10;
    132             }
    133             {
    134                GLdouble len = tx*tx + ty*ty + tz*tz;
    135                if (len > 1e-20) {
    136                   GLdouble scale = 1.0 / GL_SQRT(len);
    137                   out[i][0] = (GLfloat) (tx * scale);
    138                   out[i][1] = (GLfloat) (ty * scale);
    139                   out[i][2] = (GLfloat) (tz * scale);
    140                }
    141                else
    142                {
    143                   out[i][0] = out[i][1] = out[i][2] = 0;
    144                }
    145             }
    146         }
     125        CULL_CHECK {
     126            GLfloat tx, ty, tz;
     127            {
     128               const GLfloat ux = from[0],  uy = from[1],  uz = from[2];
     129               tx = ux * m0                    ;
     130               ty =           uy * m5          ;
     131               tz =                     uz * m10;
     132            }
     133            {
     134               GLdouble len = tx*tx + ty*ty + tz*tz;
     135               if (len > 1e-20) {
     136                  GLdouble scale = 1.0 / GL_SQRT(len);
     137                  out[i][0] = (GLfloat) (tx * scale);
     138                  out[i][1] = (GLfloat) (ty * scale);
     139                  out[i][2] = (GLfloat) (tz * scale);
     140               }
     141               else
     142               {
     143                  out[i][0] = out[i][1] = out[i][2] = 0;
     144               }
     145            }
     146        }
    147147      }
    148148   } else {
     
    150150       */
    151151      if (scale != 1.0) {
    152         m0 *= scale;
    153         m5 *= scale;
    154         m10 *= scale;
    155       }
    156 
    157       STRIDE_LOOP {
    158         CULL_CHECK {
    159             GLfloat tx, ty, tz;
    160             {
    161                const GLfloat ux = from[0],  uy = from[1],  uz = from[2];
    162                tx = ux * m0                    ;
    163                ty =           uy * m5          ;
    164                tz =                     uz * m10;
    165             }
    166             {
    167                GLfloat len = lengths[i];
    168                out[i][0] = tx * len;
    169                out[i][1] = ty * len;
    170                out[i][2] = tz * len;
    171             }
    172         }
    173       }
    174    }
    175    dest->count = in->count;
    176 }
    177 
    178 
    179 static void TAG(transform_rescale_normals_no_rot)( const GLmatrix *mat,
    180                                                    GLfloat scale,
    181                                                    const GLvector3f *in,
    182                                                    const GLfloat *lengths,
    183                                                    const GLubyte mask[],
    184                                                    GLvector3f *dest )
     152        m0 *= scale;
     153        m5 *= scale;
     154        m10 *= scale;
     155      }
     156
     157      STRIDE_LOOP {
     158        CULL_CHECK {
     159            GLfloat tx, ty, tz;
     160            {
     161               const GLfloat ux = from[0],  uy = from[1],  uz = from[2];
     162               tx = ux * m0                    ;
     163               ty =           uy * m5          ;
     164               tz =                     uz * m10;
     165            }
     166            {
     167               GLfloat len = lengths[i];
     168               out[i][0] = tx * len;
     169               out[i][1] = ty * len;
     170               out[i][2] = tz * len;
     171            }
     172        }
     173      }
     174   }
     175   dest->count = in->count;
     176}
     177
     178
     179static void _XFORMAPI TAG(transform_rescale_normals_no_rot)( const GLmatrix *mat,
     180                                                   GLfloat scale,
     181                                                   const GLvector3f *in,
     182                                                   const GLfloat *lengths,
     183                                                   const GLubyte mask[],
     184                                                   GLvector3f *dest )
    185185{
    186186   GLuint i;
     
    197197   STRIDE_LOOP {
    198198      CULL_CHECK {
    199         GLfloat ux = from[0],  uy = from[1],  uz = from[2];
    200         out[i][0] = ux * m0;
    201         out[i][1] =           uy * m5;
    202         out[i][2] =                     uz * m10;
    203       }
    204    }
    205    dest->count = in->count;
    206 }
    207 
    208 static void TAG(transform_rescale_normals)( const GLmatrix *mat,
    209                                             GLfloat scale,
    210                                             const GLvector3f *in,
    211                                             const GLfloat *lengths,
    212                                             const GLubyte mask[],
    213                                             GLvector3f *dest )
     199        GLfloat ux = from[0],  uy = from[1],  uz = from[2];
     200        out[i][0] = ux * m0;
     201        out[i][1] =           uy * m5;
     202        out[i][2] =                     uz * m10;
     203      }
     204   }
     205   dest->count = in->count;
     206}
     207
     208static void _XFORMAPI TAG(transform_rescale_normals)( const GLmatrix *mat,
     209                                            GLfloat scale,
     210                                            const GLvector3f *in,
     211                                            const GLfloat *lengths,
     212                                            const GLubyte mask[],
     213                                            GLvector3f *dest )
    214214{
    215215   GLuint i;
     
    229229   STRIDE_LOOP {
    230230      CULL_CHECK {
    231         GLfloat ux = from[0],  uy = from[1],  uz = from[2];
    232         out[i][0] = ux * m0 + uy * m1 + uz * m2;
    233         out[i][1] = ux * m4 + uy * m5 + uz * m6;
    234         out[i][2] = ux * m8 + uy * m9 + uz * m10;
    235       }
    236    }
    237    dest->count = in->count;
    238 }
    239 
    240 
    241 static void TAG(transform_normals_no_rot)(const GLmatrix *mat,
    242                                           GLfloat scale,
    243                                           const GLvector3f *in,
    244                                           const GLfloat *lengths,
    245                                           const GLubyte mask[],
    246                                           GLvector3f *dest )
     231        GLfloat ux = from[0],  uy = from[1],  uz = from[2];
     232        out[i][0] = ux * m0 + uy * m1 + uz * m2;
     233        out[i][1] = ux * m4 + uy * m5 + uz * m6;
     234        out[i][2] = ux * m8 + uy * m9 + uz * m10;
     235      }
     236   }
     237   dest->count = in->count;
     238}
     239
     240
     241static void _XFORMAPI TAG(transform_normals_no_rot)(const GLmatrix *mat,
     242                                          GLfloat scale,
     243                                          const GLvector3f *in,
     244                                          const GLfloat *lengths,
     245                                          const GLubyte mask[],
     246                                          GLvector3f *dest )
    247247{
    248248   GLuint i;
     
    260260   STRIDE_LOOP {
    261261      CULL_CHECK {
    262         GLfloat ux = from[0],  uy = from[1],  uz = from[2];
    263         out[i][0] = ux * m0;
    264         out[i][1] =           uy * m5;
    265         out[i][2] =                     uz * m10;
    266       }
    267    }
    268    dest->count = in->count;
    269 }
    270 
    271 static void TAG(transform_normals)( const GLmatrix *mat,
    272                                     GLfloat scale,
    273                                     const GLvector3f *in,
    274                                     const GLfloat *lengths,
    275                                     const GLubyte mask[],
    276                                     GLvector3f *dest )
     262        GLfloat ux = from[0],  uy = from[1],  uz = from[2];
     263        out[i][0] = ux * m0;
     264        out[i][1] =           uy * m5;
     265        out[i][2] =                     uz * m10;
     266      }
     267   }
     268   dest->count = in->count;
     269}
     270
     271static void _XFORMAPI TAG(transform_normals)( const GLmatrix *mat,
     272                                    GLfloat scale,
     273                                    const GLvector3f *in,
     274                                    const GLfloat *lengths,
     275                                    const GLubyte mask[],
     276                                    GLvector3f *dest )
    277277{
    278278   GLuint i;
     
    290290   STRIDE_LOOP {
    291291      CULL_CHECK {
    292         GLfloat ux = from[0],  uy = from[1],  uz = from[2];
    293         out[i][0] = ux * m0 + uy * m1 + uz * m2;
    294         out[i][1] = ux * m4 + uy * m5 + uz * m6;
    295         out[i][2] = ux * m8 + uy * m9 + uz * m10;
    296       }
    297    }
    298    dest->count = in->count;
    299 }
    300 
    301 
    302 static void TAG(normalize_normals)( const GLmatrix *mat,
    303                                     GLfloat scale,
    304                                     const GLvector3f *in,
    305                                     const GLfloat *lengths,
    306                                     const GLubyte mask[],
    307                                     GLvector3f *dest )
     292        GLfloat ux = from[0],  uy = from[1],  uz = from[2];
     293        out[i][0] = ux * m0 + uy * m1 + uz * m2;
     294        out[i][1] = ux * m4 + uy * m5 + uz * m6;
     295        out[i][2] = ux * m8 + uy * m9 + uz * m10;
     296      }
     297   }
     298   dest->count = in->count;
     299}
     300
     301
     302static void _XFORMAPI TAG(normalize_normals)( const GLmatrix *mat,
     303                                    GLfloat scale,
     304                                    const GLvector3f *in,
     305                                    const GLfloat *lengths,
     306                                    const GLubyte mask[],
     307                                    GLvector3f *dest )
    308308{
    309309   GLuint i;
     
    317317   if (lengths) {
    318318      STRIDE_LOOP {
    319         CULL_CHECK {
    320             const GLfloat x = from[0], y = from[1], z = from[2];
    321             GLfloat invlen = lengths[i];
    322             out[i][0] = x * invlen;
    323             out[i][1] = y * invlen;
    324             out[i][2] = z * invlen;
    325          }     
     319        CULL_CHECK {
     320            const GLfloat x = from[0], y = from[1], z = from[2];
     321            GLfloat invlen = lengths[i];
     322            out[i][0] = x * invlen;
     323            out[i][1] = y * invlen;
     324            out[i][2] = z * invlen;
     325         }
    326326      }
    327327   }
    328328   else {
    329329      STRIDE_LOOP {
    330         CULL_CHECK {
    331             const GLfloat x = from[0], y = from[1], z = from[2];
    332             GLdouble len = x * x + y * y + z * z;
    333             if (len > 1e-50) {
    334                len = 1.0 / GL_SQRT(len);
    335                out[i][0] = (GLfloat) (x * len);
    336                out[i][1] = (GLfloat) (y * len);
    337                out[i][2] = (GLfloat) (z * len);
    338             }
    339             else {
    340                out[i][0] = x;
    341                out[i][1] = y;
    342                out[i][2] = z;
    343             }
    344          }     
    345       }
    346    }
    347    dest->count = in->count;
    348 }
    349 
    350 
    351 static void TAG(rescale_normals)( const GLmatrix *mat,
    352                                   GLfloat scale,
    353                                   const GLvector3f *in,
    354                                   const GLfloat *lengths,
    355                                   const GLubyte mask[],
    356                                   GLvector3f *dest )
     330        CULL_CHECK {
     331            const GLfloat x = from[0], y = from[1], z = from[2];
     332            GLdouble len = x * x + y * y + z * z;
     333            if (len > 1e-50) {
     334               len = 1.0 / GL_SQRT(len);
     335               out[i][0] = (GLfloat) (x * len);
     336               out[i][1] = (GLfloat) (y * len);
     337               out[i][2] = (GLfloat) (z * len);
     338            }
     339            else {
     340               out[i][0] = x;
     341               out[i][1] = y;
     342               out[i][2] = z;
     343            }
     344         }
     345      }
     346   }
     347   dest->count = in->count;
     348}
     349
     350
     351static void _XFORMAPI TAG(rescale_normals)( const GLmatrix *mat,
     352                                  GLfloat scale,
     353                                  const GLvector3f *in,
     354                                  const GLfloat *lengths,
     355                                  const GLubyte mask[],
     356                                  GLvector3f *dest )
    357357{
    358358   GLuint i;
     
    367367   STRIDE_LOOP {
    368368      CULL_CHECK {
    369         SCALE_SCALAR_3V( out[i], scale, from );
    370       }
    371    }
    372    dest->count = in->count;
    373 }
    374 
    375 
    376 static void TAG(init_c_norm_transform)( void )
     369        SCALE_SCALAR_3V( out[i], scale, from );
     370      }
     371   }
     372   dest->count = in->count;
     373}
     374
     375
     376static void _XFORMAPI TAG(init_c_norm_transform)( void )
    377377{
    378378   gl_normal_tab[NORM_TRANSFORM_NO_ROT][IDX] =
  • trunk/src/opengl/mesa/pb.h

    r2938 r3597  
    1 /* $Id: pb.h,v 1.1 2000-02-29 00:48:35 sandervl Exp $ */
     1/* $Id: pb.h,v 1.2 2000-05-23 20:34:54 jeroen Exp $ */
    22
    33/*
    44 * Mesa 3-D graphics library
    5  * Version:  3.1
     5 * Version:  3.3
    66 *
    77 * Copyright (C) 1999  Brian Paul   All Rights Reserved.
     
    3636
    3737
    38 
    3938/*
    4039 * Pixel buffer size, must be larger than MAX_WIDTH.
     
    4443
    4544struct pixel_buffer {
    46         GLint x[PB_SIZE];         /* X window coord in [0,MAX_WIDTH) */
    47         GLint y[PB_SIZE];         /* Y window coord in [0,MAX_HEIGHT) */
    48         GLdepth z[PB_SIZE];       /* Z window coord in [0,MAX_DEPTH] */
    49         GLubyte rgba[PB_SIZE][4]; /* Colors */
    50         GLubyte spec[PB_SIZE][3]; /* Separate specular colors */
    51         GLuint i[PB_SIZE];        /* Index */
    52         GLfloat s[MAX_TEXTURE_UNITS][PB_SIZE];  /* Texture S coordinates */
    53         GLfloat t[MAX_TEXTURE_UNITS][PB_SIZE];  /* Texture T coordinates */
    54         GLfloat u[MAX_TEXTURE_UNITS][PB_SIZE];  /* Texture R coordinates */
    55         GLfloat lambda[MAX_TEXTURE_UNITS][PB_SIZE];/* Texture lambda values */
    56         GLint color[4];         /* Mono color, integers! */
    57         GLuint index;           /* Mono index */
    58         GLuint count;           /* Number of pixels in buffer */
    59         GLboolean mono;         /* Same color or index for all pixels? */
    60         GLenum primitive;       /* GL_POINT, GL_LINE, GL_POLYGON or GL_BITMAP*/
     45        GLint x[PB_SIZE];         /* X window coord in [0,MAX_WIDTH) */
     46        GLint y[PB_SIZE];         /* Y window coord in [0,MAX_HEIGHT) */
     47        GLdepth z[PB_SIZE];       /* Z window coord in [0,Visual.MaxDepth] */
     48        GLubyte rgba[PB_SIZE][4]; /* Colors */
     49        GLubyte spec[PB_SIZE][3]; /* Separate specular colors */
     50        GLuint i[PB_SIZE];        /* Index */
     51        GLfloat s[MAX_TEXTURE_UNITS][PB_SIZE];  /* Texture S coordinates */
     52        GLfloat t[MAX_TEXTURE_UNITS][PB_SIZE];  /* Texture T coordinates */
     53        GLfloat u[MAX_TEXTURE_UNITS][PB_SIZE];  /* Texture R coordinates */
     54        GLfloat lambda[MAX_TEXTURE_UNITS][PB_SIZE];/* Texture lambda values */
     55        GLint color[4];         /* Mono color, integers! */
     56        GLuint index;           /* Mono index */
     57        GLuint count;           /* Number of pixels in buffer */
     58        GLboolean mono;         /* Same color or index for all pixels? */
     59        GLenum primitive;       /* GL_POINT, GL_LINE, GL_POLYGON or GL_BITMAP*/
    6160};
    62 
    63 
    6461
    6562
     
    6865 * Set the color used for all subsequent pixels in the buffer.
    6966 */
    70 #define PB_SET_COLOR( CTX, PB, R, G, B, A )                     \
    71         if ((PB)->color[RCOMP]!=(R) || (PB)->color[GCOMP]!=(G)  \
    72          || (PB)->color[BCOMP]!=(B) || (PB)->color[ACOMP]!=(A)  \
    73          || !(PB)->mono) {                                      \
    74                 gl_flush_pb( ctx );                             \
    75         }                                                               \
    76         (PB)->color[RCOMP] = R;                                 \
    77         (PB)->color[GCOMP] = G;                                 \
    78         (PB)->color[BCOMP] = B;                                 \
    79         (PB)->color[ACOMP] = A;                                 \
    80         (PB)->mono = GL_TRUE;
     67#define PB_SET_COLOR( CTX, PB, R, G, B, A )                     \
     68        if ((PB)->color[RCOMP]!=(R) || (PB)->color[GCOMP]!=(G)  \
     69         || (PB)->color[BCOMP]!=(B) || (PB)->color[ACOMP]!=(A)  \
     70         || !(PB)->mono) {                                      \
     71                gl_flush_pb( ctx );                             \
     72        }                                                       \
     73        (PB)->color[RCOMP] = R;                                 \
     74        (PB)->color[GCOMP] = G;                                 \
     75        (PB)->color[BCOMP] = B;                                 \
     76        (PB)->color[ACOMP] = A;                                 \
     77        (PB)->mono = GL_TRUE;
    8178
    8279
     
    8481 * Set the color index used for all subsequent pixels in the buffer.
    8582 */
    86 #define PB_SET_INDEX( CTX, PB, I )              \
    87         if ((PB)->index!=(I) || !(PB)->mono) {  \
    88                 gl_flush_pb( CTX );             \
    89         }                                       \
    90         (PB)->index = I;                        \
    91         (PB)->mono = GL_TRUE;
     83#define PB_SET_INDEX( CTX, PB, I )              \
     84        if ((PB)->index!=(I) || !(PB)->mono) {  \
     85                gl_flush_pb( CTX );             \
     86        }                                       \
     87        (PB)->index = I;                        \
     88        (PB)->mono = GL_TRUE;
    9289
    9390
     
    9592 * "write" a pixel using current color or index
    9693 */
    97 #define PB_WRITE_PIXEL( PB, X, Y, Z )           \
    98         (PB)->x[(PB)->count] = X;               \
    99         (PB)->y[(PB)->count] = Y;               \
    100         (PB)->z[(PB)->count] = Z;               \
    101         (PB)->count++;
     94#define PB_WRITE_PIXEL( PB, X, Y, Z )           \
     95        (PB)->x[(PB)->count] = X;               \
     96        (PB)->y[(PB)->count] = Y;               \
     97        (PB)->z[(PB)->count] = Z;               \
     98        (PB)->count++;
    10299
    103100
     
    105102 * "write" an RGBA pixel
    106103 */
    107 #define PB_WRITE_RGBA_PIXEL( PB, X, Y, Z, R, G, B, A )  \
    108         (PB)->x[(PB)->count] = X;                       \
    109         (PB)->y[(PB)->count] = Y;                       \
    110         (PB)->z[(PB)->count] = Z;                       \
    111         (PB)->rgba[(PB)->count][RCOMP] = R;             \
    112         (PB)->rgba[(PB)->count][GCOMP] = G;             \
    113         (PB)->rgba[(PB)->count][BCOMP] = B;             \
    114         (PB)->rgba[(PB)->count][ACOMP] = A;             \
    115         (PB)->count++;
     104#define PB_WRITE_RGBA_PIXEL( PB, X, Y, Z, R, G, B, A )  \
     105        (PB)->x[(PB)->count] = X;                       \
     106        (PB)->y[(PB)->count] = Y;                       \
     107        (PB)->z[(PB)->count] = Z;                       \
     108        (PB)->rgba[(PB)->count][RCOMP] = R;             \
     109        (PB)->rgba[(PB)->count][GCOMP] = G;             \
     110        (PB)->rgba[(PB)->count][BCOMP] = B;             \
     111        (PB)->rgba[(PB)->count][ACOMP] = A;             \
     112        (PB)->count++;
    116113
    117114/*
    118115 * "write" a color-index pixel
    119116 */
    120 #define PB_WRITE_CI_PIXEL( PB, X, Y, Z, I )     \
    121         (PB)->x[(PB)->count] = X;               \
    122         (PB)->y[(PB)->count] = Y;               \
    123         (PB)->z[(PB)->count] = Z;               \
    124         (PB)->i[(PB)->count] = I;               \
    125         (PB)->count++;
     117#define PB_WRITE_CI_PIXEL( PB, X, Y, Z, I )     \
     118        (PB)->x[(PB)->count] = X;               \
     119        (PB)->y[(PB)->count] = Y;               \
     120        (PB)->z[(PB)->count] = Z;               \
     121        (PB)->i[(PB)->count] = I;               \
     122        (PB)->count++;
    126123
    127124
     
    129126 * "write" an RGBA pixel with texture coordinates
    130127 */
    131 #define PB_WRITE_TEX_PIXEL( PB, X, Y, Z, R, G, B, A, S, T, U )  \
    132         (PB)->x[(PB)->count] = X;                               \
    133         (PB)->y[(PB)->count] = Y;                               \
    134         (PB)->z[(PB)->count] = Z;                               \
    135         (PB)->rgba[(PB)->count][RCOMP] = R;                     \
    136         (PB)->rgba[(PB)->count][GCOMP] = G;                     \
    137         (PB)->rgba[(PB)->count][BCOMP] = B;                     \
    138         (PB)->rgba[(PB)->count][ACOMP] = A;                     \
    139         (PB)->s[0][(PB)->count] = S;                            \
    140         (PB)->t[0][(PB)->count] = T;                            \
    141         (PB)->u[0][(PB)->count] = U;                            \
    142         (PB)->count++;
     128#define PB_WRITE_TEX_PIXEL( PB, X, Y, Z, R, G, B, A, S, T, U )  \
     129        (PB)->x[(PB)->count] = X;                               \
     130        (PB)->y[(PB)->count] = Y;                               \
     131        (PB)->z[(PB)->count] = Z;                               \
     132        (PB)->rgba[(PB)->count][RCOMP] = R;                     \
     133        (PB)->rgba[(PB)->count][GCOMP] = G;                     \
     134        (PB)->rgba[(PB)->count][BCOMP] = B;                     \
     135        (PB)->rgba[(PB)->count][ACOMP] = A;                     \
     136        (PB)->s[0][(PB)->count] = S;                            \
     137        (PB)->t[0][(PB)->count] = T;                            \
     138        (PB)->u[0][(PB)->count] = U;                            \
     139        (PB)->count++;
    143140
    144141/*
    145142 * "write" an RGBA pixel with multiple texture coordinates
    146143 */
    147 #define PB_WRITE_MULTITEX_PIXEL( PB, X, Y, Z, R, G, B, A, S, T, U, S1, T1, U1 ) \
    148         (PB)->x[(PB)->count] = X;                               \
    149         (PB)->y[(PB)->count] = Y;                               \
    150         (PB)->z[(PB)->count] = Z;                               \
    151         (PB)->rgba[(PB)->count][RCOMP] = R;                     \
    152         (PB)->rgba[(PB)->count][GCOMP] = G;                     \
    153         (PB)->rgba[(PB)->count][BCOMP] = B;                     \
    154         (PB)->rgba[(PB)->count][ACOMP] = A;                     \
    155         (PB)->s[0][(PB)->count] = S;                            \
    156         (PB)->t[0][(PB)->count] = T;                            \
    157         (PB)->u[0][(PB)->count] = U;                            \
    158         (PB)->s[1][(PB)->count] = S1;                           \
    159         (PB)->t[1][(PB)->count] = T1;                           \
    160         (PB)->u[1][(PB)->count] = U1;                           \
    161         (PB)->count++;
     144#define PB_WRITE_MULTITEX_PIXEL( PB, X, Y, Z, R, G, B, A, S, T, U, S1, T1, U1 ) \
     145        (PB)->x[(PB)->count] = X;                               \
     146        (PB)->y[(PB)->count] = Y;                               \
     147        (PB)->z[(PB)->count] = Z;                               \
     148        (PB)->rgba[(PB)->count][RCOMP] = R;                     \
     149        (PB)->rgba[(PB)->count][GCOMP] = G;                     \
     150        (PB)->rgba[(PB)->count][BCOMP] = B;                     \
     151        (PB)->rgba[(PB)->count][ACOMP] = A;                     \
     152        (PB)->s[0][(PB)->count] = S;                            \
     153        (PB)->t[0][(PB)->count] = T;                            \
     154        (PB)->u[0][(PB)->count] = U;                            \
     155        (PB)->s[1][(PB)->count] = S1;                           \
     156        (PB)->t[1][(PB)->count] = T1;                           \
     157        (PB)->u[1][(PB)->count] = U1;                           \
     158        (PB)->count++;
    162159
    163160/*
    164161 * "write" an RGBA pixel with multiple texture coordinates and specular color
    165162 */
    166 #define PB_WRITE_MULTITEX_SPEC_PIXEL( PB, X, Y, Z, R, G, B, A,  \
    167                         SR, SG, SB, S, T, U, S1, T1, U1 )       \
    168         (PB)->x[(PB)->count] = X;                               \
    169         (PB)->y[(PB)->count] = Y;                               \
    170         (PB)->z[(PB)->count] = Z;                               \
    171         (PB)->rgba[(PB)->count][RCOMP] = R;                     \
    172         (PB)->rgba[(PB)->count][GCOMP] = G;                     \
    173         (PB)->rgba[(PB)->count][BCOMP] = B;                     \
    174         (PB)->rgba[(PB)->count][ACOMP] = A;                     \
    175         (PB)->spec[(PB)->count][RCOMP] = SR;                    \
    176         (PB)->spec[(PB)->count][GCOMP] = SG;                    \
    177         (PB)->spec[(PB)->count][BCOMP] = SB;                    \
    178         (PB)->s[0][(PB)->count] = S;                            \
    179         (PB)->t[0][(PB)->count] = T;                            \
    180         (PB)->u[0][(PB)->count] = U;                            \
    181         (PB)->s[1][(PB)->count] = S1;                           \
    182         (PB)->t[1][(PB)->count] = T1;                           \
    183         (PB)->u[1][(PB)->count] = U1;                           \
    184         (PB)->count++;
     163#define PB_WRITE_MULTITEX_SPEC_PIXEL( PB, X, Y, Z, R, G, B, A,  \
     164                        SR, SG, SB, S, T, U, S1, T1, U1 )       \
     165        (PB)->x[(PB)->count] = X;                               \
     166        (PB)->y[(PB)->count] = Y;                               \
     167        (PB)->z[(PB)->count] = Z;                               \
     168        (PB)->rgba[(PB)->count][RCOMP] = R;                     \
     169        (PB)->rgba[(PB)->count][GCOMP] = G;                     \
     170        (PB)->rgba[(PB)->count][BCOMP] = B;                     \
     171        (PB)->rgba[(PB)->count][ACOMP] = A;                     \
     172        (PB)->spec[(PB)->count][RCOMP] = SR;                    \
     173        (PB)->spec[(PB)->count][GCOMP] = SG;                    \
     174        (PB)->spec[(PB)->count][BCOMP] = SB;                    \
     175        (PB)->s[0][(PB)->count] = S;                            \
     176        (PB)->t[0][(PB)->count] = T;                            \
     177        (PB)->u[0][(PB)->count] = U;                            \
     178        (PB)->s[1][(PB)->count] = S1;                           \
     179        (PB)->t[1][(PB)->count] = T1;                           \
     180        (PB)->u[1][(PB)->count] = U1;                           \
     181        (PB)->count++;
    185182
    186183
     
    189186 * Call this function at least every MAX_WIDTH pixels:
    190187 */
    191 #define PB_CHECK_FLUSH( CTX, PB )               \
    192 do {                                            \
    193         if ((PB)->count>=PB_SIZE-MAX_WIDTH) {   \
    194            gl_flush_pb( CTX );                  \
    195         }                                       \
     188#define PB_CHECK_FLUSH( CTX, PB )               \
     189do {                                            \
     190        if ((PB)->count>=PB_SIZE-MAX_WIDTH) {   \
     191           gl_flush_pb( CTX );                  \
     192        }                                       \
    196193} while(0)
    197194
  • trunk/src/opengl/mesa/pixel.h

    r2938 r3597  
    1 /* $Id: pixel.h,v 1.1 2000-02-29 00:48:35 sandervl Exp $ */
     1/* $Id: pixel.h,v 1.2 2000-05-23 20:34:54 jeroen Exp $ */
    22
    33/*
    44 * Mesa 3-D graphics library
    5  * Version:  3.1
     5 * Version:  3.3
    66 *
    77 * Copyright (C) 1999  Brian Paul   All Rights Reserved.
     
    4141
    4242
    43 extern void gl_GetPixelMapfv( GLcontext *ctx, GLenum map, GLfloat *values );
     43extern void
     44_mesa_GetPixelMapfv( GLenum map, GLfloat *values );
    4445
    45 extern void gl_GetPixelMapuiv( GLcontext *ctx, GLenum map, GLuint *values );
     46extern void
     47_mesa_GetPixelMapuiv( GLenum map, GLuint *values );
    4648
    47 extern void gl_GetPixelMapusv( GLcontext *ctx, GLenum map, GLushort *values );
     49extern void
     50_mesa_GetPixelMapusv( GLenum map, GLushort *values );
    4851
     52extern void
     53_mesa_PixelMapfv( GLenum map, GLint mapsize, const GLfloat *values );
    4954
    50 extern void gl_PixelMapfv( GLcontext *ctx,
    51                            GLenum map, GLint mapsize, const GLfloat *values );
     55extern void
     56_mesa_PixelMapuiv(GLenum map, GLint mapsize, const GLuint *values );
    5257
    53 extern void gl_PixelStorei( GLcontext *ctx, GLenum pname, GLint param );
     58extern void
     59_mesa_PixelMapusv(GLenum map, GLint mapsize, const GLushort *values );
    5460
    55 extern void gl_PixelTransferf( GLcontext *ctx, GLenum pname, GLfloat param );
     61extern void
     62_mesa_PixelStoref( GLenum pname, GLfloat param );
    5663
    57 extern void gl_PixelZoom( GLcontext *ctx, GLfloat xfactor, GLfloat yfactor );
     64extern void
     65_mesa_PixelStorei( GLenum pname, GLint param );
     66
     67extern void
     68_mesa_PixelTransferf( GLenum pname, GLfloat param );
     69
     70extern void
     71_mesa_PixelTransferi( GLenum pname, GLint param );
     72
     73extern void
     74_mesa_PixelZoom( GLfloat xfactor, GLfloat yfactor );
     75
    5876
    5977
  • trunk/src/opengl/mesa/points.h

    r2938 r3597  
    1 /* $Id: points.h,v 1.1 2000-02-29 00:48:35 sandervl Exp $ */
     1/* $Id: points.h,v 1.2 2000-05-23 20:34:54 jeroen Exp $ */
    22
    33/*
    44 * Mesa 3-D graphics library
    5  * Version:  3.1
     5 * Version:  3.3
    66 *
    77 * Copyright (C) 1999  Brian Paul   All Rights Reserved.
     
    3636
    3737
    38 extern void gl_PointSize( GLcontext *ctx, GLfloat size );
     38extern void
     39_mesa_PointSize( GLfloat size );
     40
     41
     42extern void
     43_mesa_PointParameterfEXT( GLenum pname, GLfloat param);
     44
     45
     46extern void
     47_mesa_PointParameterfvEXT( GLenum pname, const GLfloat *params );
     48
    3949
    4050extern void gl_set_point_function( GLcontext *ctx );
    4151
    42 extern void gl_PointParameterfvEXT( GLcontext *ctx, GLenum pname,
    43                                     const GLfloat *params );
    4452
    4553#endif
  • trunk/src/opengl/mesa/polygon.h

    r2938 r3597  
    1 /* $Id: polygon.h,v 1.1 2000-02-29 00:48:36 sandervl Exp $ */
     1/* $Id: polygon.h,v 1.2 2000-05-23 20:34:54 jeroen Exp $ */
    22
    33/*
    44 * Mesa 3-D graphics library
    5  * Version:  3.1
     5 * Version:  3.3
    66 *
    77 * Copyright (C) 1999  Brian Paul   All Rights Reserved.
     
    3636
    3737
    38 extern void gl_CullFace( GLcontext *ctx, GLenum mode );
     38extern void
     39_mesa_CullFace( GLenum mode );
    3940
    40 extern void gl_FrontFace( GLcontext *ctx, GLenum mode );
     41extern void
     42_mesa_FrontFace( GLenum mode );
    4143
    42 extern void gl_PolygonMode( GLcontext *ctx, GLenum face, GLenum mode );
     44extern void
     45_mesa_PolygonMode( GLenum face, GLenum mode );
    4346
    44 extern void gl_PolygonOffset( GLcontext *ctx,
    45                               GLfloat factor, GLfloat units );
     47extern void
     48_mesa_PolygonOffset( GLfloat factor, GLfloat units );
    4649
    47 extern void gl_PolygonStipple( GLcontext *ctx, const GLuint pattern[32] );
     50extern void
     51_mesa_PolygonOffsetEXT( GLfloat factor, GLfloat bias );
    4852
    49 extern void gl_GetPolygonStipple( GLcontext *ctx, GLubyte *mask );
     53extern void
     54_mesa_PolygonStipple( const GLubyte *mask );
     55
     56extern void
     57_mesa_GetPolygonStipple( GLubyte *mask );
    5058
    5159
  • trunk/src/opengl/mesa/rastpos.h

    r2938 r3597  
    1 /* $Id: rastpos.h,v 1.1 2000-02-29 00:48:36 sandervl Exp $ */
     1/* $Id: rastpos.h,v 1.2 2000-05-23 20:34:54 jeroen Exp $ */
    22
    33/*
    44 * Mesa 3-D graphics library
    5  * Version:  3.1
     5 * Version:  3.3
    66 *
    77 * Copyright (C) 1999  Brian Paul   All Rights Reserved.
     
    3636
    3737
    38 extern void gl_RasterPos4f( GLcontext *ctx,
    39                             GLfloat x, GLfloat y, GLfloat z, GLfloat w );
     38extern void
     39_mesa_RasterPos2d(GLdouble x, GLdouble y);
    4040
     41extern void
     42_mesa_RasterPos2f(GLfloat x, GLfloat y);
    4143
    42 extern void gl_windowpos( GLcontext *ctx,
    43                           GLfloat x, GLfloat y, GLfloat z, GLfloat w );
     44extern void
     45_mesa_RasterPos2i(GLint x, GLint y);
    4446
     47extern void
     48_mesa_RasterPos2s(GLshort x, GLshort y);
     49
     50extern void
     51_mesa_RasterPos3d(GLdouble x, GLdouble y, GLdouble z);
     52
     53extern void
     54_mesa_RasterPos3f(GLfloat x, GLfloat y, GLfloat z);
     55
     56extern void
     57_mesa_RasterPos3i(GLint x, GLint y, GLint z);
     58
     59extern void
     60_mesa_RasterPos3s(GLshort x, GLshort y, GLshort z);
     61
     62extern void
     63_mesa_RasterPos4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w);
     64
     65extern void
     66_mesa_RasterPos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w);
     67
     68extern void
     69_mesa_RasterPos4i(GLint x, GLint y, GLint z, GLint w);
     70
     71extern void
     72_mesa_RasterPos4s(GLshort x, GLshort y, GLshort z, GLshort w);
     73
     74extern void
     75_mesa_RasterPos2dv(const GLdouble *v);
     76
     77extern void
     78_mesa_RasterPos2fv(const GLfloat *v);
     79
     80extern void
     81_mesa_RasterPos2iv(const GLint *v);
     82
     83extern void
     84_mesa_RasterPos2sv(const GLshort *v);
     85
     86extern void
     87_mesa_RasterPos3dv(const GLdouble *v);
     88
     89extern void
     90_mesa_RasterPos3fv(const GLfloat *v);
     91
     92extern void
     93_mesa_RasterPos3iv(const GLint *v);
     94
     95extern void
     96_mesa_RasterPos3sv(const GLshort *v);
     97
     98extern void
     99_mesa_RasterPos4dv(const GLdouble *v);
     100
     101extern void
     102_mesa_RasterPos4fv(const GLfloat *v);
     103
     104extern void
     105_mesa_RasterPos4iv(const GLint *v);
     106
     107extern void
     108_mesa_RasterPos4sv(const GLshort *v);
    45109
    46110
  • trunk/src/opengl/mesa/readpix.h

    r2938 r3597  
    1 /* $Id: readpix.h,v 1.1 2000-02-29 00:48:36 sandervl Exp $ */
     1/* $Id: readpix.h,v 1.2 2000-05-23 20:34:55 jeroen Exp $ */
    22
    33/*
    44 * Mesa 3-D graphics library
    5  * Version:  3.1
     5 * Version:  3.3
    66 *
    77 * Copyright (C) 1999  Brian Paul   All Rights Reserved.
     
    3535#include "types.h"
    3636
    37 
    38 extern void gl_ReadPixels( GLcontext *ctx,
    39                            GLint x, GLint y, GLsizei width, GLsizei height,
    40                            GLenum format, GLenum type, GLvoid *pixels );
     37extern void
     38_mesa_ReadPixels( GLint x, GLint y, GLsizei width, GLsizei height,
     39                  GLenum format, GLenum type, GLvoid *pixels );
    4140
    4241
  • trunk/src/opengl/mesa/rect.h

    r2938 r3597  
    1 /* $Id: rect.h,v 1.1 2000-02-29 00:48:36 sandervl Exp $ */
     1/* $Id: rect.h,v 1.2 2000-05-23 20:34:55 jeroen Exp $ */
    22
    33/*
    44 * Mesa 3-D graphics library
    5  * Version:  3.1
     5 * Version:  3.3
    66 *
    77 * Copyright (C) 1999  Brian Paul   All Rights Reserved.
     
    3333
    3434
    35 #include "types.h"
     35#include "glheader.h"
    3636
    3737
    38 extern void gl_Rectf( GLcontext *ctx,
    39                       GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2 );
     38extern void
     39_mesa_Rectd(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2);
     40
     41extern void
     42_mesa_Rectdv(const GLdouble *v1, const GLdouble *v2);
     43
     44extern void
     45_mesa_Rectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2);
     46
     47extern void
     48_mesa_Rectfv(const GLfloat *v1, const GLfloat *v2);
     49
     50extern void
     51_mesa_Recti(GLint x1, GLint y1, GLint x2, GLint y2);
     52
     53extern void
     54_mesa_Rectiv(const GLint *v1, const GLint *v2);
     55
     56extern void
     57_mesa_Rects(GLshort x1, GLshort y1, GLshort x2, GLshort y2);
     58
     59extern void
     60_mesa_Rectsv(const GLshort *v1, const GLshort *v2);
     61
    4062
    4163
  • trunk/src/opengl/mesa/render_tmp.h

    r2938 r3597  
    1 /* $Id: render_tmp.h,v 1.1 2000-02-29 00:48:37 sandervl Exp $ */
     1/* $Id: render_tmp.h,v 1.2 2000-05-23 20:34:55 jeroen Exp $ */
    22
    33/*
     
    4040#define NEED_EDGEFLAG_SETUP 0
    4141#define EDGEFLAG_TRI(a,b,c,d,e)
     42#define EDGEFLAG_POLY_TRI_PRE(a,b,c,d)
     43#define EDGEFLAG_POLY_TRI_POST(a,b,c,d)
    4244#define EDGEFLAG_QUAD(a,b,c,d,e)
    4345#endif
     
    4951
    5052static void TAG(render_vb_points)( struct vertex_buffer *VB,
    51                                    GLuint start,
    52                                    GLuint count,
    53                                    GLuint parity )
     53                                   GLuint start,
     54                                   GLuint count,
     55                                   GLuint parity )
    5456{
    5557   LOCAL_VARS;
     
    6163
    6264static void TAG(render_vb_lines)( struct vertex_buffer *VB,
    63                                   GLuint start,
    64                                   GLuint count,
    65                                   GLuint parity )
     65                                  GLuint start,
     66                                  GLuint count,
     67                                  GLuint parity )
    6668{
    6769   GLuint j;
     
    7981
    8082static void TAG(render_vb_line_strip)( struct vertex_buffer *VB,
    81                                        GLuint start,
    82                                        GLuint count,
    83                                        GLuint parity )
     83                                       GLuint start,
     84                                       GLuint count,
     85                                       GLuint parity )
    8486{
    8587   GLuint j;
     
    9193      RENDER_LINE( j-1, j );
    9294   }
    93    RESET_STIPPLE;
     95
     96   if (VB->Flag[count] & VERT_END) {
     97      RESET_STIPPLE;
     98   }
    9499   POSTFIX;
    95100}
     
    97102
    98103static void TAG(render_vb_line_loop)( struct vertex_buffer *VB,
    99                                       GLuint start,
    100                                       GLuint count,
    101                                       GLuint parity )
    102 {
    103    GLuint i = start < VB->Start ? VB->Start : start + 1;       
     104                                      GLuint start,
     105                                      GLuint count,
     106                                      GLuint parity )
     107{
     108   GLuint i = start < VB->Start ? VB->Start : start + 1;
    104109   LOCAL_VARS;
    105110   (void) parity;
     
    112117   if (VB->Flag[count] & VERT_END) {
    113118      RENDER_LINE( i-1, start );
    114    }
    115 
    116    RESET_STIPPLE;
     119      RESET_STIPPLE;
     120   }
     121
    117122   POSTFIX;
    118123}
     
    120125
    121126static void TAG(render_vb_triangles)( struct vertex_buffer *VB,
    122                                       GLuint start,
    123                                       GLuint count,
    124                                       GLuint parity )
     127                                      GLuint start,
     128                                      GLuint count,
     129                                      GLuint parity )
    125130{
    126131   GLuint j;
     
    139144
    140145static void TAG(render_vb_tri_strip)( struct vertex_buffer *VB,
    141                                       GLuint start,
    142                                       GLuint count,
    143                                       GLuint parity )
     146                                      GLuint start,
     147                                      GLuint count,
     148                                      GLuint parity )
    144149{
    145150   GLuint j;
     
    149154   if (NEED_EDGEFLAG_SETUP) {
    150155      for (j=start+2;j<count;j++,parity^=1) {
    151         EDGEFLAG_TRI( j-2, j-1, j, j, parity );
    152         RENDER_TRI( j-2, j-1, j, j, parity );
    153         RESET_STIPPLE;
     156        EDGEFLAG_TRI( j-2, j-1, j, j, parity );
     157        RENDER_TRI( j-2, j-1, j, j, parity );
     158        RESET_STIPPLE;
    154159      }
    155160   } else {
    156161      for (j=start+2;j<count;j++,parity^=1) {
    157         RENDER_TRI( j-2, j-1, j, j, parity );
     162        RENDER_TRI( j-2, j-1, j, j, parity );
    158163      }
    159164   }
     
    163168
    164169static void TAG(render_vb_tri_fan)( struct vertex_buffer *VB,
    165                                     GLuint start,
    166                                     GLuint count,
    167                                     GLuint parity )
     170                                    GLuint start,
     171                                    GLuint count,
     172                                    GLuint parity )
    168173{
    169174   GLuint j;
     
    173178   if (NEED_EDGEFLAG_SETUP) {
    174179      for (j=start+2;j<count;j++) {
    175         EDGEFLAG_TRI( start, j-1, j, j, 0 );
    176         RENDER_TRI( start, j-1, j, j, 0 );
    177         RESET_STIPPLE;
     180        EDGEFLAG_TRI( start, j-1, j, j, 0 );
     181        RENDER_TRI( start, j-1, j, j, 0 );
     182        RESET_STIPPLE;
    178183      }
    179184   } else {
    180185      for (j=start+2;j<count;j++) {
    181         RENDER_TRI( start, j-1, j, j, 0 );
     186        RENDER_TRI( start, j-1, j, j, 0 );
    182187      }
    183188   }
     
    188193
    189194static void TAG(render_vb_poly)( struct vertex_buffer *VB,
    190                                  GLuint start,
    191                                  GLuint count,
    192                                  GLuint parity )
    193 {
    194    GLuint j;
    195    LOCAL_VARS;
    196    (void) parity;
    197    INIT(GL_POLYGON);
    198    for (j=start+2;j<count;j++) {
    199       RENDER_TRI( start, j-1, j, start, 0 );
     195                                 GLuint start,
     196                                 GLuint count,
     197                                 GLuint parity )
     198{
     199   GLuint j;
     200   LOCAL_VARS;
     201   (void) parity;
     202   INIT(GL_POLYGON);
     203   if (NEED_EDGEFLAG_SETUP) {
     204      for (j=start+2;j<count;j++) {
     205         EDGEFLAG_POLY_TRI_PRE( start, j-1, j, start );
     206         RENDER_TRI( start, j-1, j, start, 0 );
     207         EDGEFLAG_POLY_TRI_POST( start, j-1, j, start );
     208      }
     209   }
     210   else {
     211      for (j=start+2;j<count;j++) {
     212         RENDER_TRI( start, j-1, j, start, 0 );
     213      }
    200214   }
    201215   RESET_STIPPLE;
     
    205219
    206220static void TAG(render_vb_quads)( struct vertex_buffer *VB,
    207                                   GLuint start,
    208                                   GLuint count,
    209                                   GLuint parity )
     221                                  GLuint start,
     222                                  GLuint count,
     223                                  GLuint parity )
    210224{
    211225   GLuint j;
     
    221235
    222236static void TAG(render_vb_quad_strip)( struct vertex_buffer *VB,
    223                                        GLuint start,
    224                                        GLuint count,
    225                                        GLuint parity )
     237                                       GLuint start,
     238                                       GLuint count,
     239                                       GLuint parity )
    226240{
    227241   GLuint j;
     
    231245   if (NEED_EDGEFLAG_SETUP) {
    232246      for (j=start+3;j<count;j+=2) {
    233         EDGEFLAG_QUAD( j-3, j-2, j, j-1, j );
    234         RENDER_QUAD( j-3, j-2, j, j-1, j );
    235         RESET_STIPPLE;
     247        EDGEFLAG_QUAD( j-3, j-2, j, j-1, j );
     248        RENDER_QUAD( j-3, j-2, j, j-1, j );
     249        RESET_STIPPLE;
    236250      }
    237251   } else {
    238252      for (j=start+3;j<count;j+=2) {
    239         RENDER_QUAD( j-3, j-2, j, j-1, j );
     253        RENDER_QUAD( j-3, j-2, j, j-1, j );
    240254      }
    241255   }
     
    244258
    245259static void TAG(render_vb_noop)( struct vertex_buffer *VB,
    246                                 GLuint start,
    247                                 GLuint count,
    248                                 GLuint parity )
     260                                GLuint start,
     261                                GLuint count,
     262                                GLuint parity )
    249263{
    250264   (void) VB;
  • trunk/src/opengl/mesa/scissor.h

    r2938 r3597  
    1 /* $Id: scissor.h,v 1.1 2000-02-29 00:48:37 sandervl Exp $ */
     1/* $Id: scissor.h,v 1.2 2000-05-23 20:34:55 jeroen Exp $ */
    22
    33/*
    44 * Mesa 3-D graphics library
    5  * Version:  3.1
     5 * Version:  3.3
    66 *
    77 * Copyright (C) 1999  Brian Paul   All Rights Reserved.
     
    3636
    3737
    38 extern void gl_Scissor( GLcontext *ctx,
    39                         GLint x, GLint y, GLsizei width, GLsizei height );
     38extern void
     39_mesa_Scissor( GLint x, GLint y, GLsizei width, GLsizei height );
    4040
    4141
    42 extern GLint gl_scissor_span( GLcontext *ctx,
    43                               GLuint n, GLint x, GLint y, GLubyte mask[] );
     42extern GLint
     43gl_scissor_span( GLcontext *ctx, GLuint n, GLint x, GLint y, GLubyte mask[] );
    4444
    4545
    46 extern GLuint gl_scissor_pixels( GLcontext *ctx,
    47                                 GLuint n, const GLint x[], const GLint y[],
    48                                  GLubyte mask[] );
     46extern GLuint
     47gl_scissor_pixels( GLcontext *ctx, GLuint n, const GLint x[], const GLint y[],
     48                   GLubyte mask[] );
    4949
    5050
  • trunk/src/opengl/mesa/shade_tmp.h

    r2938 r3597  
    1 /* $Id: shade_tmp.h,v 1.1 2000-02-29 00:48:37 sandervl Exp $ */
     1/* $Id: shade_tmp.h,v 1.2 2000-05-23 20:34:55 jeroen Exp $ */
    22
    33/*
     
    2929 */
    3030
    31 #ifdef __WIN32OS2__
    32 #include <misc.h>
    33 #endif
    34 
    3531static void TAG(shade_rgba_spec)( struct vertex_buffer *VB )
    3632{
     
    139135            }
    140136
    141             d = LEN_3FV( VP );
     137            d = (GLfloat) LEN_3FV( VP );
    142138
    143139            if (d > 1e-6) {
     
    161157                  double x = PV_dot_dir * (EXP_TABLE_SIZE-1);
    162158                  int k = (int) x;
    163                   GLfloat spot = (light->SpotExpTable[k][0]
     159                  GLfloat spot = (GLfloat) (light->SpotExpTable[k][0]
    164160                                  + (x-k)*light->SpotExpTable[k][1]);
    165161                  attenuation *= spot;
     
    238234
    239235            if (n_dot_h>1.0) {
    240                spec_coef = pow( n_dot_h, tab->shininess );
     236               spec_coef = (GLfloat) pow( n_dot_h, tab->shininess );
    241237            } else
    242238               GET_SHINE_TAB_ENTRY( tab, n_dot_h, spec_coef );
     
    558554            if (NR_SIDES == 2)  COPY_3V(sum[1], base[1]);
    559555
    560 #ifdef __WIN32OS2__
    561                dprintf(("light normal %d/%d, %f %f %f\n",
    562                        j, VB->Start, normal[0], normal[1], normal[2]));
    563 #else
    564             if (0)
    565 /*             if (ctx->Light.ShadeModel == GL_SMOOTH) */
     556            if (MESA_VERBOSE&VERBOSE_LIGHTING)
    566557               fprintf(stderr, "light normal %d/%d, %f %f %f\n",
    567558                       j, VB->Start, normal[0], normal[1], normal[2]);
    568 #endif
     559
    569560
    570561            foreach (light, &ctx->Light.EnabledList) {
  • trunk/src/opengl/mesa/span.h

    r2938 r3597  
    1 /* $Id: span.h,v 1.1 2000-02-29 00:48:38 sandervl Exp $ */
     1/* $Id: span.h,v 1.2 2000-05-23 20:34:56 jeroen Exp $ */
    22
    33/*
     
    3838extern void gl_write_index_span( GLcontext *ctx,
    3939                                 GLuint n, GLint x, GLint y, const GLdepth z[],
    40                                 GLuint index[], GLenum primitive );
     40                                GLuint index[], GLenum primitive );
    4141
    4242
     
    4444                                     GLuint n, GLint x, GLint y,
    4545                                     const GLdepth z[],
    46                                      GLuint index, GLenum primitive );
     46                                     GLuint index, GLenum primitive );
    4747
    4848
     
    6161                                   GLuint n, GLint x, GLint y,
    6262                                   const GLdepth z[],
    63                                    const GLfloat s[], const GLfloat t[],
     63                                   const GLfloat s[], const GLfloat t[],
    6464                                   const GLfloat u[], GLfloat lambda[],
    65                                    GLubyte rgba[][4], CONST GLubyte spec[][4],
     65                                   GLubyte rgba[][4], CONST GLubyte spec[][4],
    6666                                   GLenum primitive );
    6767
    6868
    69 extern void gl_write_multitexture_span( GLcontext *ctx, GLuint texSets,
    70                                         GLuint n, GLint x, GLint y,
    71                                         const GLdepth z[],
    72                                         CONST GLfloat s[][MAX_WIDTH],
    73                                         CONST GLfloat t[][MAX_WIDTH],
    74                                         CONST GLfloat u[][MAX_WIDTH],
    75                                         GLfloat lambda[][MAX_WIDTH],
    76                                         GLubyte rgba[][4],
    77                                         CONST GLubyte spec[][4],
    78                                         GLenum primitive );
     69extern void
     70gl_write_multitexture_span( GLcontext *ctx, GLuint texSets,
     71                            GLuint n, GLint x, GLint y,
     72                            const GLdepth z[],
     73                            CONST GLfloat s[MAX_TEXTURE_UNITS][MAX_WIDTH],
     74                            CONST GLfloat t[MAX_TEXTURE_UNITS][MAX_WIDTH],
     75                            CONST GLfloat u[MAX_TEXTURE_UNITS][MAX_WIDTH],
     76                            GLfloat lambda[MAX_TEXTURE_UNITS][MAX_WIDTH],
     77                            GLubyte rgba[][4],
     78                            CONST GLubyte spec[][4],
     79                            GLenum primitive );
    7980
    8081
    81 extern void gl_read_rgba_span( GLcontext *ctx,
     82extern void gl_read_rgba_span( GLcontext *ctx, GLframebuffer *buffer,
    8283                               GLuint n, GLint x, GLint y,
    8384                               GLubyte rgba[][4] );
    8485
    8586
    86 extern void gl_read_index_span( GLcontext *ctx,
     87extern void gl_read_index_span( GLcontext *ctx, GLframebuffer *buffer,
    8788                                GLuint n, GLint x, GLint y, GLuint indx[] );
    8889
  • trunk/src/opengl/mesa/stages.h

    r2938 r3597  
    1 /* $Id: stages.h,v 1.1 2000-02-29 00:48:38 sandervl Exp $ */
     1/* $Id: stages.h,v 1.2 2000-05-23 20:34:56 jeroen Exp $ */
    22
    33/*
    44 * Mesa 3-D graphics library
    5  * Version:  3.1
     5 * Version:  3.3
    66 *
    77 * Copyright (C) 1999  Brian Paul   All Rights Reserved.
     
    3535
    3636extern void gl_import_client_data( struct vertex_buffer *VB,
    37                                    GLuint required,
    38                                    GLuint vec_flags );
     37                                   GLuint required,
     38                                   GLuint vec_flags );
    3939
    4040#endif
  • trunk/src/opengl/mesa/stencil.h

    r2938 r3597  
    1 /* $Id: stencil.h,v 1.1 2000-02-29 00:48:38 sandervl Exp $ */
     1/* $Id: stencil.h,v 1.2 2000-05-23 20:34:57 jeroen Exp $ */
    22
    33/*
    44 * Mesa 3-D graphics library
    5  * Version:  3.1
     5 * Version:  3.3
    66 *
    77 * Copyright (C) 1999  Brian Paul   All Rights Reserved.
     
    3636
    3737
    38 extern void gl_ClearStencil( GLcontext *ctx, GLint s );
     38extern void
     39_mesa_ClearStencil( GLint s );
    3940
    4041
    41 extern void gl_StencilFunc( GLcontext *ctx, GLenum func,
    42                             GLint ref, GLuint mask );
     42extern void
     43_mesa_StencilFunc( GLenum func, GLint ref, GLuint mask );
    4344
    4445
    45 extern void gl_StencilMask( GLcontext *ctx, GLuint mask );
     46extern void
     47_mesa_StencilMask( GLuint mask );
    4648
    4749
    48 extern void gl_StencilOp( GLcontext *ctx, GLenum fail,
    49                           GLenum zfail, GLenum zpass );
     50extern void
     51_mesa_StencilOp( GLenum fail, GLenum zfail, GLenum zpass );
    5052
    5153
    5254
    53 extern GLint gl_stencil_span( GLcontext *ctx,
    54                               GLuint n, GLint x, GLint y, GLubyte mask[] );
     55extern GLboolean
     56gl_stencil_and_depth_test_span( GLcontext *ctx, GLuint n, GLint x, GLint y,
     57                                const GLdepth z[], GLubyte mask[] );
     58
     59#ifdef VMS /* VMS allows externals of 31 characters maximum */
     60#define gl_stencil_and_depth_test_pixels gl_stencil_and_depth_test_pixel
     61#endif
     62extern GLboolean
     63gl_stencil_and_depth_test_pixels( GLcontext *ctx, GLuint n,
     64                                  const GLint x[], const GLint y[],
     65                                  const GLdepth z[], GLubyte mask[] );
    5566
    5667
    57 extern void gl_depth_stencil_span( GLcontext *ctx, GLuint n, GLint x, GLint y,
    58                                    const GLdepth z[], GLubyte mask[] );
     68
     69extern void
     70gl_read_stencil_span( GLcontext *ctx, GLint n, GLint x, GLint y,
     71                      GLstencil stencil[] );
    5972
    6073
    61 extern GLint gl_stencil_pixels( GLcontext *ctx,
    62                                 GLuint n, const GLint x[], const GLint y[],
    63                                 GLubyte mask[] );
    64 
    65 
    66 extern void gl_depth_stencil_pixels( GLcontext *ctx,
    67                                      GLuint n, const GLint x[],
    68                                      const GLint y[], const GLdepth z[],
    69                                      GLubyte mask[] );
    70 
    71 
    72 extern void gl_read_stencil_span( GLcontext *ctx,
    73                                   GLuint n, GLint x, GLint y,
    74                                   GLstencil stencil[] );
    75 
    76 
    77 extern void gl_write_stencil_span( GLcontext *ctx,
    78                                    GLuint n, GLint x, GLint y,
    79                                    const GLstencil stencil[] );
     74extern void
     75gl_write_stencil_span( GLcontext *ctx, GLint n, GLint x, GLint y,
     76                       const GLstencil stencil[] );
    8077
    8178
  • trunk/src/opengl/mesa/stereo.h

    r2938 r3597  
    1 /* $Id: stereo.h,v 1.1 2000-02-29 00:48:38 sandervl Exp $ */
     1/* $Id: stereo.h,v 1.2 2000-05-23 20:34:57 jeroen Exp $ */
    22/* File name stereov.h
    33   header file for stereo display driver
     
    1717
    1818*/
    19 #if defined( __WIN32__) || defined (WIN32)
    20    #include <windows.h>
    21 #endif
    22 
    23 #if defined(__WIN32OS2__)
    24    #include <os2win.h>
    25 #endif
    2619
    2720typedef enum VIEW_INDICATOR { FIRST, SECOND};
  • trunk/src/opengl/mesa/teximage.h

    r2938 r3597  
    1 /* $Id: teximage.h,v 1.1 2000-02-29 00:48:39 sandervl Exp $ */
     1/* $Id: teximage.h,v 1.2 2000-05-23 20:34:57 jeroen Exp $ */
    22
    33/*
    44 * Mesa 3-D graphics library
    5  * Version:  3.1
     5 * Version:  3.3
    66 *
    77 * Copyright (C) 1999  Brian Paul   All Rights Reserved.
     
    3636
    3737
    38 extern struct gl_texture_image *gl_alloc_texture_image( void );
     38extern GLint
     39_mesa_base_tex_format( GLint format );
    3940
    4041
    41 extern void gl_free_texture_image( struct gl_texture_image *teximage );
     42extern struct gl_texture_image *
     43gl_alloc_texture_image( void );
     44
     45
     46extern void
     47gl_free_texture_image( struct gl_texture_image *teximage );
    4248
    4349
    4450
    45 
    46 /*** API entry points ***/
     51/*** API entry point functions ***/
    4752
    4853
    49 extern void gl_TexImage1D( GLcontext *ctx,
    50                           GLenum target, GLint level, GLint internalformat,
    51                            GLsizei width, GLint border, GLenum format,
    52                           GLenum type, const GLvoid *pixels );
     54extern void
     55_mesa_TexImage1D( GLenum target, GLint level, GLint internalformat,
     56                  GLsizei width, GLint border,
     57                  GLenum format, GLenum type, const GLvoid *pixels );
    5358
    5459
    55 extern void gl_TexImage2D( GLcontext *ctx,
    56                            GLenum target, GLint level, GLint internalformat,
    57                            GLsizei width, GLsizei height, GLint border,
    58                            GLenum format, GLenum type,
    59                            const GLvoid *pixels );
     60extern void
     61_mesa_TexImage2D( GLenum target, GLint level, GLint internalformat,
     62                  GLsizei width, GLsizei height, GLint border,
     63                  GLenum format, GLenum type, const GLvoid *pixels );
    6064
    6165
    62 extern void gl_TexImage3D( GLcontext *ctx,
    63                            GLenum target, GLint level, GLint internalformat,
    64                            GLsizei width, GLsizei height, GLsizei depth,
    65                            GLint border, GLenum format, GLenum type,
    66                            const GLvoid *pixels );
     66extern void
     67_mesa_TexImage3D( GLenum target, GLint level, GLint internalformat,
     68                  GLsizei width, GLsizei height, GLsizei depth, GLint border,
     69                  GLenum format, GLenum type, const GLvoid *pixels );
    6770
    6871
    69 extern void gl_GetTexImage( GLcontext *ctx, GLenum target, GLint level,
    70                             GLenum format, GLenum type, GLvoid *pixels );
     72extern void
     73_mesa_TexImage3DEXT( GLenum target, GLint level, GLenum internalformat,
     74                     GLsizei width, GLsizei height, GLsizei depth,
     75                     GLint border, GLenum format, GLenum type,
     76                     const GLvoid *pixels );
    7177
    7278
    73 
    74 extern void gl_TexSubImage1D( GLcontext *ctx,
    75                               GLenum target, GLint level, GLint xoffset,
    76                               GLsizei width, GLenum format, GLenum type,
    77                               const GLvoid *pixels );
     79extern void
     80_mesa_GetTexImage( GLenum target, GLint level,
     81                   GLenum format, GLenum type, GLvoid *pixels );
    7882
    7983
    80 extern void gl_TexSubImage2D( GLcontext *ctx,
    81                               GLenum target, GLint level,
    82                               GLint xoffset, GLint yoffset,
    83                               GLsizei width, GLsizei height,
    84                               GLenum format, GLenum type,
    85                               const GLvoid *pixels );
     84extern void
     85_mesa_TexSubImage1D( GLenum target, GLint level, GLint xoffset,
     86                     GLsizei width,
     87                     GLenum format, GLenum type,
     88                     const GLvoid *pixels );
    8689
    8790
    88 extern void gl_TexSubImage3D( GLcontext *ctx,
    89                               GLenum target, GLint level,
    90                               GLint xoffset, GLint yoffset, GLint zoffset,
    91                               GLsizei width, GLsizei height, GLsizei depth,
    92                               GLenum format, GLenum type,
    93                               const GLvoid *pixels );
     91extern void
     92_mesa_TexSubImage2D( GLenum target, GLint level,
     93                     GLint xoffset, GLint yoffset,
     94                     GLsizei width, GLsizei height,
     95                     GLenum format, GLenum type,
     96                     const GLvoid *pixels );
    9497
    9598
    96 extern void gl_CopyTexImage1D( GLcontext *ctx,
    97                                GLenum target, GLint level,
    98                                GLenum internalformat,
    99                                GLint x, GLint y,
    100                                GLsizei width, GLint border );
     99extern void
     100_mesa_TexSubImage3D( GLenum target, GLint level,
     101                     GLint xoffset, GLint yoffset, GLint zoffset,
     102                     GLsizei width, GLsizei height, GLsizei depth,
     103                     GLenum format, GLenum type,
     104                     const GLvoid *pixels );
    101105
    102106
    103 extern void gl_CopyTexImage2D( GLcontext *ctx,
    104                                GLenum target, GLint level,
    105                                GLenum internalformat, GLint x, GLint y,
    106                                GLsizei width, GLsizei height,
    107                                GLint border );
     107extern void
     108_mesa_CopyTexImage1D( GLenum target, GLint level, GLenum internalformat,
     109                      GLint x, GLint y, GLsizei width, GLint border );
    108110
    109111
    110 extern void gl_CopyTexSubImage1D( GLcontext *ctx,
    111                                   GLenum target, GLint level,
    112                                   GLint xoffset, GLint x, GLint y,
    113                                   GLsizei width );
     112extern void
     113_mesa_CopyTexImage2D( GLenum target, GLint level,
     114                      GLenum internalformat, GLint x, GLint y,
     115                      GLsizei width, GLsizei height, GLint border );
    114116
    115117
    116 extern void gl_CopyTexSubImage2D( GLcontext *ctx,
    117                                   GLenum target, GLint level,
    118                                   GLint xoffset, GLint yoffset,
    119                                   GLint x, GLint y,
    120                                   GLsizei width, GLsizei height );
     118extern void
     119_mesa_CopyTexSubImage1D( GLenum target, GLint level, GLint xoffset,
     120                         GLint x, GLint y, GLsizei width );
    121121
    122122
    123 extern void gl_CopyTexSubImage3D( GLcontext *ctx,
    124                                   GLenum target, GLint level,
    125                                   GLint xoffset, GLint yoffset,
    126                                   GLint zoffset,
    127                                   GLint x, GLint y,
    128                                   GLsizei width, GLsizei height );
     123extern void
     124_mesa_CopyTexSubImage2D( GLenum target, GLint level,
     125                         GLint xoffset, GLint yoffset,
     126                         GLint x, GLint y, GLsizei width, GLsizei height );
     127
     128
     129extern void
     130_mesa_CopyTexSubImage3D( GLenum target, GLint level,
     131                         GLint xoffset, GLint yoffset, GLint zoffset,
     132                         GLint x, GLint y, GLsizei width, GLsizei height );
    129133
    130134#endif
  • trunk/src/opengl/mesa/texobj.h

    r2938 r3597  
    1 /* $Id: texobj.h,v 1.1 2000-02-29 00:48:39 sandervl Exp $ */
     1/* $Id: texobj.h,v 1.2 2000-05-23 20:34:57 jeroen Exp $ */
    22
    33/*
    44 * Mesa 3-D graphics library
    5  * Version:  3.1
     5 * Version:  3.3
    66 *
    77 * Copyright (C) 1999  Brian Paul   All Rights Reserved.
     
    6060 */
    6161
    62 extern void gl_GenTextures( GLcontext *ctx, GLsizei n, GLuint *textures );
     62extern void
     63_mesa_GenTextures( GLsizei n, GLuint *textures );
    6364
    6465
    65 extern void gl_DeleteTextures( GLcontext *ctx,
    66                               GLsizei n, const GLuint *textures);
     66extern void
     67_mesa_DeleteTextures( GLsizei n, const GLuint *textures);
    6768
    6869
    69 extern void gl_BindTexture( GLcontext *ctx, GLenum target, GLuint texture );
     70extern void
     71_mesa_BindTexture( GLenum target, GLuint texture );
    7072
    7173
    72 extern void gl_PrioritizeTextures( GLcontext *ctx,
    73                                   GLsizei n, const GLuint *textures,
    74                                    const GLclampf *priorities );
     74extern void
     75_mesa_PrioritizeTextures( GLsizei n, const GLuint *textures,
     76                          const GLclampf *priorities );
    7577
    7678
    77 extern GLboolean gl_AreTexturesResident( GLcontext *ctx, GLsizei n,
    78                                         const GLuint *textures,
    79                                          GLboolean *residences );
     79extern GLboolean
     80_mesa_AreTexturesResident( GLsizei n, const GLuint *textures,
     81                           GLboolean *residences );
    8082
    8183
    82 extern GLboolean gl_IsTexture( GLcontext *ctx, GLuint texture );
     84extern GLboolean
     85_mesa_IsTexture( GLuint texture );
    8386
    8487
  • trunk/src/opengl/mesa/texstate.h

    r2938 r3597  
    1 /* $Id: texstate.h,v 1.1 2000-02-29 00:48:39 sandervl Exp $ */
     1/* $Id: texstate.h,v 1.2 2000-05-23 20:34:58 jeroen Exp $ */
    22
    33/*
     
    3838/*** Called from API ***/
    3939
    40 extern void gl_GetTexEnvfv( GLcontext *ctx,
    41                             GLenum target, GLenum pname, GLfloat *params );
     40extern void
     41_mesa_GetTexEnvfv( GLenum target, GLenum pname, GLfloat *params );
    4242
    43 extern void gl_GetTexEnviv( GLcontext *ctx,
    44                             GLenum target, GLenum pname, GLint *params );
     43extern void
     44_mesa_GetTexEnviv( GLenum target, GLenum pname, GLint *params );
    4545
    46 extern void gl_GetTexGendv( GLcontext *ctx,
    47                             GLenum coord, GLenum pname, GLdouble *params );
     46extern void
     47_mesa_GetTexGendv( GLenum coord, GLenum pname, GLdouble *params );
    4848
    49 extern void gl_GetTexGenfv( GLcontext *ctx,
    50                             GLenum coord, GLenum pname, GLfloat *params );
     49extern void
     50_mesa_GetTexGenfv( GLenum coord, GLenum pname, GLfloat *params );
    5151
    52 extern void gl_GetTexGeniv( GLcontext *ctx,
    53                             GLenum coord, GLenum pname, GLint *params );
     52extern void
     53_mesa_GetTexGeniv( GLenum coord, GLenum pname, GLint *params );
    5454
    55 extern void gl_GetTexLevelParameterfv( GLcontext *ctx,
    56                                       GLenum target, GLint level,
    57                                        GLenum pname, GLfloat *params );
     55extern void
     56_mesa_GetTexLevelParameterfv( GLenum target, GLint level,
     57                              GLenum pname, GLfloat *params );
    5858
    59 extern void gl_GetTexLevelParameteriv( GLcontext *ctx,
    60                                       GLenum target, GLint level,
    61                                        GLenum pname, GLint *params );
     59extern void
     60_mesa_GetTexLevelParameteriv( GLenum target, GLint level,
     61                              GLenum pname, GLint *params );
    6262
    63 extern void gl_GetTexParameterfv( GLcontext *ctx, GLenum target,
    64                                   GLenum pname, GLfloat *params );
     63extern void
     64_mesa_GetTexParameterfv( GLenum target, GLenum pname, GLfloat *params );
    6565
    66 extern void gl_GetTexParameteriv( GLcontext *ctx,
    67                                   GLenum target, GLenum pname, GLint *params );
     66extern void
     67_mesa_GetTexParameteriv( GLenum target, GLenum pname, GLint *params );
    6868
    6969
    70 extern void gl_TexEnvfv( GLcontext *ctx,
    71                          GLenum target, GLenum pname, const GLfloat *param );
     70extern void
     71_mesa_TexEnvf( GLenum target, GLenum pname, GLfloat param );
     72
     73extern void
     74_mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param );
     75
     76extern void
     77_mesa_TexEnvi( GLenum target, GLenum pname, GLint param );
     78
     79extern void
     80_mesa_TexEnviv( GLenum target, GLenum pname, const GLint *param );
    7281
    7382
    74 extern void gl_TexParameterfv( GLcontext *ctx, GLenum target, GLenum pname,
    75                                const GLfloat *params );
     83extern void
     84_mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params );
     85
     86extern void
     87_mesa_TexParameterf( GLenum target, GLenum pname, GLfloat param );
    7688
    7789
    78 extern void gl_TexGenfv( GLcontext *ctx,
    79                          GLenum coord, GLenum pname, const GLfloat *params );
     90extern void
     91_mesa_TexParameteri( GLenum target, GLenum pname, const GLint param );
     92
     93extern void
     94_mesa_TexParameteriv( GLenum target, GLenum pname, const GLint *params );
     95
     96
     97extern void
     98_mesa_TexGend( GLenum coord, GLenum pname, GLdouble param );
     99
     100extern void
     101_mesa_TexGendv( GLenum coord, GLenum pname, const GLdouble *params );
     102
     103extern void
     104_mesa_TexGenf( GLenum coord, GLenum pname, GLfloat param );
     105
     106extern void
     107_mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params );
     108
     109extern void
     110_mesa_TexGeni( GLenum coord, GLenum pname, GLint param );
     111
     112extern void
     113_mesa_TexGeniv( GLenum coord, GLenum pname, const GLint *params );
    80114
    81115
     
    87121 * GL_ARB_multitexture
    88122 */
    89 extern void gl_ActiveTexture( GLcontext *ctx, GLenum target );
     123extern void
     124_mesa_ActiveTextureARB( GLenum target );
    90125
    91 extern void gl_ClientActiveTexture( GLcontext *ctx, GLenum target );
     126extern void
     127_mesa_ClientActiveTextureARB( GLenum target );
    92128
    93129
  • trunk/src/opengl/mesa/trans_tmp.h

    r2938 r3597  
    1 /* $Id: trans_tmp.h,v 1.1 2000-02-29 00:48:40 sandervl Exp $ */
     1/* $Id: trans_tmp.h,v 1.2 2000-05-23 20:34:58 jeroen Exp $ */
    22
    33/*
     
    3737#ifdef DEST_4F
    3838static void DEST_4F( GLfloat (*t)[4],
    39                      const struct gl_client_array *from,
    40                      ARGS)
     39                     const struct gl_client_array *from,
     40                     ARGS)
    4141{
    4242   GLuint stride = from->StrideB;
     
    5050      CHECK {
    5151         NEXT_F2;
    52         if (SZ >= 1) t[i][0] = TRX_4F(f, 0);
    53         if (SZ >= 2) t[i][1] = TRX_4F(f, 1);
    54         if (SZ >= 3) t[i][2] = TRX_4F(f, 2);
    55         if (SZ == 4) t[i][3] = TRX_4F(f, 3);
     52        if (SZ >= 1) t[i][0] = TRX_4F(f, 0);
     53        if (SZ >= 2) t[i][1] = TRX_4F(f, 1);
     54        if (SZ >= 3) t[i][2] = TRX_4F(f, 2);
     55        if (SZ == 4) t[i][3] = TRX_4F(f, 3);
    5656      }
    5757   }
     
    6262#ifdef DEST_3F
    6363static void DEST_3F( GLfloat (*t)[3],
    64                      const struct gl_client_array *from,
    65                      ARGS)
     64                     const struct gl_client_array *from,
     65                     ARGS)
    6666{
    6767   GLuint stride = from->StrideB;
     
    7474      CHECK {
    7575         NEXT_F2;
    76         t[i][0] = TRX_3F(f, 0);
    77         t[i][1] = TRX_3F(f, 1);
    78         t[i][2] = TRX_3F(f, 2);
     76        t[i][0] = TRX_3F(f, 0);
     77        t[i][1] = TRX_3F(f, 1);
     78        t[i][2] = TRX_3F(f, 2);
    7979      }
    8080   }
     
    8484#ifdef DEST_4UB
    8585static void DEST_4UB( GLubyte (*t)[4],
    86                       const struct gl_client_array *from,
    87                       ARGS)
     86                      const struct gl_client_array *from,
     87                      ARGS)
    8888{
    8989   GLuint stride = from->StrideB;
     
    9696      CHECK {
    9797         NEXT_F2;
    98         if (SZ >= 1) TRX_UB(t[i][0], f, 0);
    99         if (SZ >= 2) TRX_UB(t[i][1], f, 1);
    100         if (SZ >= 3) TRX_UB(t[i][2], f, 2);
    101         if (SZ == 4) TRX_UB(t[i][3], f, 3); else t[i][3] = 255;
     98        if (SZ >= 1) TRX_UB(t[i][0], f, 0);
     99        if (SZ >= 2) TRX_UB(t[i][1], f, 1);
     100        if (SZ >= 3) TRX_UB(t[i][2], f, 2);
     101        if (SZ == 4) TRX_UB(t[i][3], f, 3); else t[i][3] = 255;
    102102      }
    103103   }
     
    108108#ifdef DEST_1UB
    109109static void DEST_1UB( GLubyte *t,
    110                       const struct gl_client_array *from,
    111                       ARGS)
     110                      const struct gl_client_array *from,
     111                      ARGS)
    112112{
    113113   GLuint stride = from->StrideB;
     
    120120      CHECK {
    121121         NEXT_F2;
    122           TRX_UB(t[i], f, 0);
     122          TRX_UB(t[i], f, 0);
    123123      }
    124124   }
     
    129129#ifdef DEST_1UI
    130130static void DEST_1UI( GLuint *t,
    131                       const struct gl_client_array *from,
    132                       ARGS)
     131                      const struct gl_client_array *from,
     132                      ARGS)
    133133{
    134134   GLuint stride = from->StrideB;
     
    142142      CHECK {
    143143         NEXT_F2;
    144         t[i] = TRX_UI(f, 0);
     144        t[i] = TRX_UI(f, 0);
    145145      }
    146146   }
     
    153153#ifdef DEST_1UI
    154154   ASSERT(SZ == 1);
    155    TAB(1ui)[SRC_IDX] = DEST_1UI;
     155   TAB(_1ui)[SRC_IDX] = DEST_1UI;
    156156#endif
    157157#ifdef DEST_1UB
    158158   ASSERT(SZ == 1);
    159    TAB(1ub)[SRC_IDX] = DEST_1UB;
     159   TAB(_1ub)[SRC_IDX] = DEST_1UB;
    160160#endif
    161161#ifdef DEST_3F
    162162   ASSERT(SZ == 3);
    163    TAB(3f)[SRC_IDX] = DEST_3F;
     163   TAB(_3f)[SRC_IDX] = DEST_3F;
    164164#endif
    165165#ifdef DEST_4UB
    166    TAB(4ub)[SZ][SRC_IDX] = DEST_4UB;
     166   TAB(_4ub)[SZ][SRC_IDX] = DEST_4UB;
    167167#endif
    168168#ifdef DEST_4F
    169    TAB(4f)[SZ][SRC_IDX] = DEST_4F;
     169   TAB(_4f)[SZ][SRC_IDX] = DEST_4F;
    170170#endif
    171171
  • trunk/src/opengl/mesa/tritemp.h

    r2938 r3597  
    1 /* $Id: tritemp.h,v 1.1 2000-02-29 00:48:40 sandervl Exp $ */
     1/* $Id: tritemp.h,v 1.2 2000-05-23 20:34:58 jeroen Exp $ */
    22
    33/*
    44 * Mesa 3-D graphics library
    5  * Version:  3.1
     5 * Version:  3.3
    66 *
    77 * Copyright (C) 1999  Brian Paul   All Rights Reserved.
     
    5151 *    PIXEL_ADDRESS(X,Y)  - returns the address of pixel at (X,Y) where
    5252 *                          Y==0 at bottom of screen and increases upward.
     53 *
     54 * Similarly, for direct depth buffer access, this type is used for depth
     55 * buffer addressing:
     56 *    DEPTH_TYPE          - either GLushort or GLuint
    5357 *
    5458 * Optionally, one may provide one-time setup code per triangle:
     
    8488   } EdgeT;
    8589
    86    struct vertex_buffer *VB = ctx->VB;
     90#ifdef INTERP_Z
     91   const GLint depthBits = ctx->Visual->DepthBits;
     92   const GLint fixedToDepthShift = depthBits <= 16 ? FIXED_SHIFT : 0;
     93   const GLfloat maxDepth = ctx->Visual->DepthMaxF;
     94#define FixedToDepth(F)  ((F) >> fixedToDepthShift)
     95#endif
     96   const struct vertex_buffer *VB = ctx->VB;
    8797   EdgeT eMaj, eTop, eBot;
    8898   GLfloat oneOverArea;
     
    135145   /* compute oneOverArea */
    136146   {
    137       GLfloat area = eMaj.dx * eBot.dy - eBot.dx * eMaj.dy;
     147      const GLfloat area = eMaj.dx * eBot.dy - eBot.dx * eMaj.dy;
    138148
    139149      /* Do backface culling */
    140       if (
    141          area * bf < 0 ||
    142          area * area < .0025
    143          )
     150      if (area * bf < 0 || area * area < .0025)
    144151         return;
    145 
    146152
    147153      oneOverArea = 1.0F / area;
     
    227233   {
    228234      GLint ltor;               /* true if scanning left-to-right */
    229 #if INTERP_Z
     235#ifdef INTERP_Z
    230236      GLfloat dzdx, dzdy;      GLfixed fdzdx;
    231237#endif
    232 #if INTERP_RGB
     238#ifdef INTERP_RGB
    233239      GLfloat drdx, drdy;      GLfixed fdrdx;
    234240      GLfloat dgdx, dgdy;      GLfixed fdgdx;
    235241      GLfloat dbdx, dbdy;      GLfixed fdbdx;
    236242#endif
    237 #if INTERP_SPEC
     243#ifdef INTERP_SPEC
    238244      GLfloat dsrdx, dsrdy;    GLfixed fdsrdx;
    239245      GLfloat dsgdx, dsgdy;    GLfixed fdsgdx;
    240246      GLfloat dsbdx, dsbdy;    GLfixed fdsbdx;
    241247#endif
    242 #if INTERP_ALPHA
     248#ifdef INTERP_ALPHA
    243249      GLfloat dadx, dady;      GLfixed fdadx;
    244250#endif
    245 #if INTERP_INDEX
     251#ifdef INTERP_INDEX
    246252      GLfloat didx, didy;      GLfixed fdidx;
    247253#endif
    248 #if INTERP_INT_ST
     254#ifdef INTERP_INT_ST
    249255      GLfloat dsdx, dsdy;      GLfixed fdsdx;
    250256      GLfloat dtdx, dtdy;      GLfixed fdtdx;
    251257#endif
    252 #if INTERP_STUV
     258#ifdef INTERP_STUV
    253259      GLfloat dsdx, dsdy;
    254260      GLfloat dtdx, dtdy;
     
    256262      GLfloat dvdx, dvdy;
    257263#endif
    258 #if INTERP_STUV1
     264#ifdef INTERP_STUV1
    259265      GLfloat ds1dx, ds1dy;
    260266      GLfloat dt1dx, dt1dy;
     
    273279
    274280      /* compute d?/dx and d?/dy derivatives */
    275 #if INTERP_Z
     281#ifdef INTERP_Z
    276282      {
    277283         GLfloat eMaj_dz, eBot_dz;
     
    279285         eBot_dz = VB->Win.data[vMid][2] - VB->Win.data[vMin][2];
    280286         dzdx = oneOverArea * (eMaj_dz * eBot.dy - eMaj.dy * eBot_dz);
    281          if (dzdx>DEPTH_SCALE || dzdx<-DEPTH_SCALE) {
     287         if (dzdx > maxDepth || dzdx < -maxDepth) {
    282288            /* probably a sliver triangle */
    283289            dzdx = 0.0;
     
    287293            dzdy = oneOverArea * (eMaj.dx * eBot_dz - eMaj_dz * eBot.dx);
    288294         }
    289 #if DEPTH_BITS==16
    290          fdzdx = SignedFloatToFixed(dzdx);
    291 #else
    292          fdzdx = (GLint) dzdx;
    293 #endif
    294       }
    295 #endif
    296 #if INTERP_RGB
     295         if (depthBits <= 16)
     296            fdzdx = SignedFloatToFixed(dzdx);
     297         else
     298            fdzdx = (GLint) dzdx;
     299      }
     300#endif
     301#ifdef INTERP_RGB
    297302      {
    298303         GLfloat eMaj_dr, eBot_dr;
     
    320325      }
    321326#endif
    322 #if INTERP_SPEC
     327#ifdef INTERP_SPEC
    323328      {
    324329         GLfloat eMaj_dsr, eBot_dsr;
     
    346351      }
    347352#endif
    348 #if INTERP_ALPHA
     353#ifdef INTERP_ALPHA
    349354      {
    350355         GLfloat eMaj_da, eBot_da;
     
    356361      }
    357362#endif
    358 #if INTERP_INDEX
     363#ifdef INTERP_INDEX
    359364      {
    360365         GLfloat eMaj_di, eBot_di;
     
    366371      }
    367372#endif
    368 #if INTERP_INT_ST
     373#ifdef INTERP_INT_ST
    369374      {
    370375         GLfloat eMaj_ds, eBot_ds;
     
    390395
    391396#endif
    392 #if INTERP_STUV
     397#ifdef INTERP_STUV
    393398      {
    394399         GLfloat wMax = VB->Win.data[vMax][3];
     
    442447      }
    443448#endif
    444 #if INTERP_STUV1
     449#ifdef INTERP_STUV1
    445450      {
    446451         GLfloat wMax = VB->Win.data[vMax][3];
     
    461466            eBot_dt = VB->TexCoordPtr[1]->data[vMid][1]*wMid - VB->TexCoordPtr[1]->data[vMin][1]*wMin;
    462467            dt1dx = oneOverArea * (eMaj_dt * eBot.dy - eMaj.dy * eBot_dt);
    463             dt1dy = oneOverArea * (eMaj.dx * eBot_dt - eMaj_dt * eBot.dx);
    464         }
    465         else
    466         {
    467             dt1dx = 0;
    468             dt1dy = 0;
    469         }
    470 
    471         if (VB->TexCoordPtr[1]->size > 2)
    472         {
    473             eMaj_du = VB->TexCoordPtr[1]->data[vMax][2]*wMax - VB->TexCoordPtr[1]->data[vMin][2]*wMin;
    474             eBot_du = VB->TexCoordPtr[1]->data[vMid][2]*wMid - VB->TexCoordPtr[1]->data[vMin][2]*wMin;
    475             du1dx = oneOverArea * (eMaj_du * eBot.dy - eMaj.dy * eBot_du);
    476             du1dy = oneOverArea * (eMaj.dx * eBot_du - eMaj_du * eBot.dx);
    477         }
    478         else
    479         {
    480             du1dx = 0;
    481             du1dy = 0;
    482         }
    483 
    484         if (VB->TexCoordPtr[1]->size > 3)
    485         {
    486             eMaj_dv = VB->TexCoordPtr[1]->data[vMax][3]*wMax - VB->TexCoordPtr[1]->data[vMin][3]*wMin;
    487             eBot_dv = VB->TexCoordPtr[1]->data[vMid][3]*wMid - VB->TexCoordPtr[1]->data[vMin][3]*wMin;
    488             dv1dx = oneOverArea * (eMaj_dv * eBot.dy - eMaj.dy * eBot_dv);
    489             dv1dy = oneOverArea * (eMaj.dx * eBot_dv - eMaj_dv * eBot.dx);
    490         }
    491         else
    492         {
    493             eMaj_dv = wMax - wMin;
    494             eBot_dv = wMid - wMin;
    495             dv1dx = oneOverArea * (eMaj_dv * eBot.dy - eMaj.dy * eBot_dv);
    496             dv1dy = oneOverArea * (eMaj.dx * eBot_dv - eMaj_dv * eBot.dx);
    497         }
     468            dt1dy = oneOverArea * (eMaj.dx * eBot_dt - eMaj_dt * eBot.dx);
     469        }
     470        else
     471        {
     472            dt1dx = 0;
     473            dt1dy = 0;
     474        }
     475
     476        if (VB->TexCoordPtr[1]->size > 2)
     477        {
     478            eMaj_du = VB->TexCoordPtr[1]->data[vMax][2]*wMax - VB->TexCoordPtr[1]->data[vMin][2]*wMin;
     479            eBot_du = VB->TexCoordPtr[1]->data[vMid][2]*wMid - VB->TexCoordPtr[1]->data[vMin][2]*wMin;
     480            du1dx = oneOverArea * (eMaj_du * eBot.dy - eMaj.dy * eBot_du);
     481            du1dy = oneOverArea * (eMaj.dx * eBot_du - eMaj_du * eBot.dx);
     482        }
     483        else
     484        {
     485            du1dx = 0;
     486            du1dy = 0;
     487        }
     488
     489        if (VB->TexCoordPtr[1]->size > 3)
     490        {
     491            eMaj_dv = VB->TexCoordPtr[1]->data[vMax][3]*wMax - VB->TexCoordPtr[1]->data[vMin][3]*wMin;
     492            eBot_dv = VB->TexCoordPtr[1]->data[vMid][3]*wMid - VB->TexCoordPtr[1]->data[vMin][3]*wMin;
     493            dv1dx = oneOverArea * (eMaj_dv * eBot.dy - eMaj.dy * eBot_dv);
     494            dv1dy = oneOverArea * (eMaj.dx * eBot_dv - eMaj_dv * eBot.dx);
     495        }
     496        else
     497        {
     498            eMaj_dv = wMax - wMin;
     499            eBot_dv = wMid - wMin;
     500            dv1dx = oneOverArea * (eMaj_dv * eBot.dy - eMaj.dy * eBot_dv);
     501            dv1dy = oneOverArea * (eMaj.dx * eBot_dv - eMaj_dv * eBot.dx);
     502        }
    498503      }
    499504#endif
     
    560565         int dPRowOuter, dPRowInner;  /* offset in bytes */
    561566#endif
    562 #if INTERP_Z
    563          GLdepth *zRow;
     567#ifdef INTERP_Z
     568#  ifdef DEPTH_TYPE
     569         DEPTH_TYPE *zRow;
    564570         int dZRowOuter, dZRowInner;  /* offset in bytes */
     571#  endif
    565572         GLfixed fz, fdzOuter, fdzInner;
    566573#endif
    567 #if INTERP_RGB
     574#ifdef INTERP_RGB
    568575         GLfixed fr, fdrOuter, fdrInner;
    569576         GLfixed fg, fdgOuter, fdgInner;
    570577         GLfixed fb, fdbOuter, fdbInner;
    571578#endif
    572 #if INTERP_SPEC
     579#ifdef INTERP_SPEC
    573580         GLfixed fsr, fdsrOuter, fdsrInner;
    574581         GLfixed fsg, fdsgOuter, fdsgInner;
    575582         GLfixed fsb, fdsbOuter, fdsbInner;
    576583#endif
    577 #if INTERP_ALPHA
     584#ifdef INTERP_ALPHA
    578585         GLfixed fa, fdaOuter, fdaInner;
    579586#endif
    580 #if INTERP_INDEX
     587#ifdef INTERP_INDEX
    581588         GLfixed fi, fdiOuter, fdiInner;
    582589#endif
    583 #if INTERP_INT_ST
     590#ifdef INTERP_INT_ST
    584591         GLfixed fs, fdsOuter, fdsInner;
    585592         GLfixed ft, fdtOuter, fdtInner;
    586593#endif
    587 #if INTERP_STUV
     594#ifdef INTERP_STUV
    588595         GLfloat sLeft, dsOuter, dsInner;
    589596         GLfloat tLeft, dtOuter, dtInner;
     
    591598         GLfloat vLeft, dvOuter, dvInner;
    592599#endif
    593 #if INTERP_STUV1
     600#ifdef INTERP_STUV1
    594601         GLfloat s1Left, ds1Outer, ds1Inner;
    595602         GLfloat t1Left, dt1Outer, dt1Inner;
     
    665672#ifdef PIXEL_ADDRESS
    666673               {
    667                   pRow = (PIXEL_TYPE *) PIXEL_ADDRESS( FixedToInt(fxLeftEdge), iy );
     674                  pRow = (PIXEL_TYPE *)PIXEL_ADDRESS( FixedToInt(fxLeftEdge), iy );
    668675                  dPRowOuter = -((int)BYTES_PER_ROW) + idxOuter * sizeof(PIXEL_TYPE);
    669676                  /* negative because Y=0 at bottom and increases upward */
     
    680687                */
    681688
    682 #if INTERP_Z
     689#ifdef INTERP_Z
    683690               {
    684                   GLfloat z0, tmp;
    685                   z0 = VB->Win.data[vLower][2] + ctx->PolygonZoffset;
    686 #if DEPTH_BITS==16
    687                   /* interpolate fixed-pt values */
    688                   tmp = (z0 * FIXED_SCALE + dzdx * adjx + dzdy * adjy) + FIXED_HALF;
    689                   if (tmp < MAX_GLUINT/2)
    690                      fz = (GLfixed) tmp;
    691                   else
    692                      fz = MAX_GLUINT/2;
    693                   fdzOuter = SignedFloatToFixed(dzdy + dxOuter * dzdx);
    694 #else
    695                   (void) tmp;
    696                   /* interpolate depth values exactly */
    697                   fz = (GLint) (z0 + dzdx*FixedToFloat(adjx) + dzdy*FixedToFloat(adjy));
    698                   fdzOuter = (GLint) (dzdy + dxOuter * dzdx);
    699 #endif
    700                   zRow = Z_ADDRESS( ctx, FixedToInt(fxLeftEdge), iy );
    701                   dZRowOuter = (ctx->Buffer->Width + idxOuter) * sizeof(GLdepth);
    702                }
    703 #endif
    704 #if INTERP_RGB
     691                  GLfloat z0 = VB->Win.data[vLower][2] + ctx->PolygonZoffset;
     692                  if (depthBits <= 16) {
     693                     /* interpolate fixed-pt values */
     694                     GLfloat tmp = (z0 * FIXED_SCALE + dzdx * adjx + dzdy * adjy) + FIXED_HALF;
     695                     if (tmp < MAX_GLUINT / 2)
     696                        fz = (GLfixed) tmp;
     697                     else
     698                        fz = MAX_GLUINT / 2;
     699                     fdzOuter = SignedFloatToFixed(dzdy + dxOuter * dzdx);
     700                  }
     701                  else {
     702                     /* interpolate depth values exactly */
     703                     fz = (GLint) (z0 + dzdx*FixedToFloat(adjx) + dzdy*FixedToFloat(adjy));
     704                     fdzOuter = (GLint) (dzdy + dxOuter * dzdx);
     705                  }
     706#  ifdef DEPTH_TYPE
     707                  zRow = (DEPTH_TYPE *) _mesa_zbuffer_address(ctx, FixedToInt(fxLeftEdge), iy);
     708                  dZRowOuter = (ctx->DrawBuffer->Width + idxOuter) * sizeof(DEPTH_TYPE);
     709#  endif
     710               }
     711#endif
     712#ifdef INTERP_RGB
    705713               fr = (GLfixed)(IntToFixed(VB->ColorPtr->data[vLower][0]) + drdx * adjx + drdy * adjy)
    706714                    + FIXED_HALF;
     
    715723               fdbOuter = SignedFloatToFixed(dbdy + dxOuter * dbdx);
    716724#endif
    717 #if INTERP_SPEC
     725#ifdef INTERP_SPEC
    718726               fsr = (GLfixed)(IntToFixed(VB->Specular[vLower][0]) + dsrdx * adjx + dsrdy * adjy)
    719727                    + FIXED_HALF;
     
    728736               fdsbOuter = SignedFloatToFixed(dsbdy + dxOuter * dsbdx);
    729737#endif
    730 #if INTERP_ALPHA
     738#ifdef INTERP_ALPHA
    731739               fa = (GLfixed)(IntToFixed(VB->ColorPtr->data[vLower][3]) + dadx * adjx + dady * adjy)
    732740                    + FIXED_HALF;
    733741               fdaOuter = SignedFloatToFixed(dady + dxOuter * dadx);
    734742#endif
    735 #if INTERP_INDEX
     743#ifdef INTERP_INDEX
    736744               fi = (GLfixed)(VB->IndexPtr->data[vLower] * FIXED_SCALE + didx * adjx
    737745                              + didy * adjy) + FIXED_HALF;
    738746               fdiOuter = SignedFloatToFixed(didy + dxOuter * didx);
    739747#endif
    740 #if INTERP_INT_ST
     748#ifdef INTERP_INT_ST
    741749               {
    742750                  GLfloat s0, t0;
     
    745753                  fdsOuter = SignedFloatToFixed(dsdy + dxOuter * dsdx);
    746754
    747                   if (VB->TexCoordPtr[0]->size > 1)
    748                   {
    749                      t0 = VB->TexCoordPtr[0]->data[vLower][1] * T_SCALE;
    750                      ft = (GLfixed)(t0 * FIXED_SCALE + dtdx * adjx + dtdy * adjy) + FIXED_HALF;
    751                      fdtOuter = SignedFloatToFixed(dtdy + dxOuter * dtdx);
    752                   }
    753                   else
    754                   {
    755                      t0 = 0;
    756                      ft = (GLfixed) FIXED_HALF;
    757                      fdtOuter = SignedFloatToFixed(0);
    758                   }
    759                }
    760 #endif
    761 #if INTERP_STUV
     755                  if (VB->TexCoordPtr[0]->size > 1)
     756                  {
     757                     t0 = VB->TexCoordPtr[0]->data[vLower][1] * T_SCALE;
     758                     ft = (GLfixed)(t0 * FIXED_SCALE + dtdx * adjx + dtdy * adjy) + FIXED_HALF;
     759                     fdtOuter = SignedFloatToFixed(dtdy + dxOuter * dtdx);
     760                  }
     761                  else
     762                  {
     763                     t0 = 0;
     764                     ft = (GLfixed) FIXED_HALF;
     765                     fdtOuter = SignedFloatToFixed(0);
     766                  }
     767               }
     768#endif
     769#ifdef INTERP_STUV
    762770               {
    763771                  GLfloat invW = VB->Win.data[vLower][3];
     
    766774                  sLeft = s0 + (dsdx * adjx + dsdy * adjy) * (1.0F/FIXED_SCALE);
    767775                  dsOuter = dsdy + dxOuter * dsdx;
    768                   if (VB->TexCoordPtr[0]->size > 1)
    769                   {             
    770                      t0 = VB->TexCoordPtr[0]->data[vLower][1] * invW;
    771                      tLeft = t0 + (dtdx * adjx + dtdy * adjy) * (1.0F/FIXED_SCALE);
    772                      dtOuter = dtdy + dxOuter * dtdx;
    773                   } else {
    774                      tLeft = dtOuter = 0;
    775                   }
    776                   if (VB->TexCoordPtr[0]->size > 2)
    777                   {             
    778                      u0 = VB->TexCoordPtr[0]->data[vLower][2] * invW;
    779                      uLeft = u0 + (dudx * adjx + dudy * adjy) * (1.0F/FIXED_SCALE);
    780                      duOuter = dudy + dxOuter * dudx;
    781                   } else {
    782                      uLeft = duOuter = 0;
    783                   }
    784                   if (VB->TexCoordPtr[0]->size > 3)
    785                   {             
    786                      v0 = VB->TexCoordPtr[0]->data[vLower][3] * invW;
    787                   } else {
    788                      v0 = invW;
    789                   }
    790                   vLeft = v0 + (dvdx * adjx + dvdy * adjy) * (1.0F/FIXED_SCALE);
    791                   dvOuter = dvdy + dxOuter * dvdx;
    792                }
    793 #endif
    794 #if INTERP_STUV1
     776                  if (VB->TexCoordPtr[0]->size > 1)
     777                  {
     778                     t0 = VB->TexCoordPtr[0]->data[vLower][1] * invW;
     779                     tLeft = t0 + (dtdx * adjx + dtdy * adjy) * (1.0F/FIXED_SCALE);
     780                     dtOuter = dtdy + dxOuter * dtdx;
     781                  } else {
     782                     tLeft = dtOuter = 0;
     783                  }
     784                  if (VB->TexCoordPtr[0]->size > 2)
     785                  {
     786                     u0 = VB->TexCoordPtr[0]->data[vLower][2] * invW;
     787                     uLeft = u0 + (dudx * adjx + dudy * adjy) * (1.0F/FIXED_SCALE);
     788                     duOuter = dudy + dxOuter * dudx;
     789                  } else {
     790                     uLeft = duOuter = 0;
     791                  }
     792                  if (VB->TexCoordPtr[0]->size > 3)
     793                  {
     794                     v0 = VB->TexCoordPtr[0]->data[vLower][3] * invW;
     795                  } else {
     796                     v0 = invW;
     797                  }
     798                  vLeft = v0 + (dvdx * adjx + dvdy * adjy) * (1.0F/FIXED_SCALE);
     799                  dvOuter = dvdy + dxOuter * dvdx;
     800               }
     801#endif
     802#ifdef INTERP_STUV1
    795803               {
    796804                  GLfloat invW = VB->Win.data[vLower][3];
     
    799807                  s1Left = s0 + (ds1dx * adjx + ds1dy * adjy) * (1.0F/FIXED_SCALE);
    800808                  ds1Outer = ds1dy + dxOuter * ds1dx;
    801                   if (VB->TexCoordPtr[0]->size > 1)
    802                   {             
    803                      t0 = VB->TexCoordPtr[1]->data[vLower][1] * invW;
    804                      t1Left = t0 + (dt1dx * adjx + dt1dy * adjy) * (1.0F/FIXED_SCALE);
    805                      dt1Outer = dt1dy + dxOuter * dt1dx;
    806                   } else {
    807                      t1Left = dt1Outer = 0;
    808                   }
    809                   if (VB->TexCoordPtr[0]->size > 2)
    810                   {             
    811                      u0 = VB->TexCoordPtr[1]->data[vLower][2] * invW;
    812                      u1Left = u0 + (du1dx * adjx + du1dy * adjy) * (1.0F/FIXED_SCALE);
    813                      du1Outer = du1dy + dxOuter * du1dx;
    814                   } else {
    815                      u1Left = du1Outer = 0;
    816                   }
    817                   if (VB->TexCoordPtr[0]->size > 3)
    818                   {             
    819                      v0 = VB->TexCoordPtr[1]->data[vLower][3] * invW;
    820                   } else {
    821                      v0 =  invW;
    822                   }
    823                   v1Left = v0 + (dv1dx * adjx + dv1dy * adjy) * (1.0F/FIXED_SCALE);
    824                   dv1Outer = dv1dy + dxOuter * dv1dx;
     809                  if (VB->TexCoordPtr[0]->size > 1)
     810                  {
     811                     t0 = VB->TexCoordPtr[1]->data[vLower][1] * invW;
     812                     t1Left = t0 + (dt1dx * adjx + dt1dy * adjy) * (1.0F/FIXED_SCALE);
     813                     dt1Outer = dt1dy + dxOuter * dt1dx;
     814                  } else {
     815                     t1Left = dt1Outer = 0;
     816                  }
     817                  if (VB->TexCoordPtr[0]->size > 2)
     818                  {
     819                     u0 = VB->TexCoordPtr[1]->data[vLower][2] * invW;
     820                     u1Left = u0 + (du1dx * adjx + du1dy * adjy) * (1.0F/FIXED_SCALE);
     821                     du1Outer = du1dy + dxOuter * du1dx;
     822                  } else {
     823                     u1Left = du1Outer = 0;
     824                  }
     825                  if (VB->TexCoordPtr[0]->size > 3)
     826                  {
     827                     v0 = VB->TexCoordPtr[1]->data[vLower][3] * invW;
     828                  } else {
     829                     v0 =  invW;
     830                  }
     831                  v1Left = v0 + (dv1dx * adjx + dv1dy * adjy) * (1.0F/FIXED_SCALE);
     832                  dv1Outer = dv1dy + dxOuter * dv1dx;
    825833               }
    826834#endif
     
    843851            dPRowInner = dPRowOuter + sizeof(PIXEL_TYPE);
    844852#endif
    845 #if INTERP_Z
    846             dZRowInner = dZRowOuter + sizeof(GLdepth);
     853#ifdef INTERP_Z
     854#  ifdef DEPTH_TYPE
     855            dZRowInner = dZRowOuter + sizeof(DEPTH_TYPE);
     856#  endif
    847857            fdzInner = fdzOuter + fdzdx;
    848858#endif
    849 #if INTERP_RGB
     859#ifdef INTERP_RGB
    850860            fdrInner = fdrOuter + fdrdx;
    851861            fdgInner = fdgOuter + fdgdx;
    852862            fdbInner = fdbOuter + fdbdx;
    853863#endif
    854 #if INTERP_SPEC
     864#ifdef INTERP_SPEC
    855865            fdsrInner = fdsrOuter + fdsrdx;
    856866            fdsgInner = fdsgOuter + fdsgdx;
    857867            fdsbInner = fdsbOuter + fdsbdx;
    858868#endif
    859 #if INTERP_ALPHA
     869#ifdef INTERP_ALPHA
    860870            fdaInner = fdaOuter + fdadx;
    861871#endif
    862 #if INTERP_INDEX
     872#ifdef INTERP_INDEX
    863873            fdiInner = fdiOuter + fdidx;
    864874#endif
    865 #if INTERP_INT_ST
     875#ifdef INTERP_INT_ST
    866876            fdsInner = fdsOuter + fdsdx;
    867877            fdtInner = fdtOuter + fdtdx;
    868878#endif
    869 #if INTERP_STUV
    870             dsInner = dsOuter + dsdx;
    871             dtInner = dtOuter + dtdx;
    872             duInner = duOuter + dudx;
    873             dvInner = dvOuter + dvdx;
    874 #endif
    875 #if INTERP_STUV1
    876             ds1Inner = ds1Outer + ds1dx;
    877             dt1Inner = dt1Outer + dt1dx;
    878             du1Inner = du1Outer + du1dx;
    879             dv1Inner = dv1Outer + dv1dx;
     879#ifdef INTERP_STUV
     880            dsInner = dsOuter + dsdx;
     881            dtInner = dtOuter + dtdx;
     882            duInner = duOuter + dudx;
     883            dvInner = dvOuter + dvdx;
     884#endif
     885#ifdef INTERP_STUV1
     886            ds1Inner = ds1Outer + ds1dx;
     887            dt1Inner = dt1Outer + dt1dx;
     888            du1Inner = du1Outer + du1dx;
     889            dv1Inner = dv1Outer + dv1dx;
    880890#endif
    881891
     
    883893               /* initialize the span interpolants to the leftmost value */
    884894               /* ff = fixed-pt fragment */
    885 #if INTERP_Z
     895#ifdef INTERP_Z
    886896               GLfixed ffz = fz;
    887                /*GLdepth *zp = zRow;*/
    888 #endif
    889 #if INTERP_RGB
     897#endif
     898#ifdef INTERP_RGB
    890899               GLfixed ffr = fr,  ffg = fg,  ffb = fb;
    891900#endif
    892 #if INTERP_SPEC
     901#ifdef INTERP_SPEC
    893902               GLfixed ffsr = fsr,  ffsg = fsg,  ffsb = fsb;
    894903#endif
    895 #if INTERP_ALPHA
     904#ifdef INTERP_ALPHA
    896905               GLfixed ffa = fa;
    897906#endif
    898 #if INTERP_INDEX
     907#ifdef INTERP_INDEX
    899908               GLfixed ffi = fi;
    900909#endif
    901 #if INTERP_INT_ST
     910#ifdef INTERP_INT_ST
    902911               GLfixed ffs = fs,  fft = ft;
    903912#endif
    904 #if INTERP_STUV
     913#ifdef INTERP_STUV
    905914               GLfloat ss = sLeft, tt = tLeft, uu = uLeft, vv = vLeft;
    906915#endif
    907 #if INTERP_STUV1
     916#ifdef INTERP_STUV1
    908917               GLfloat ss1 = s1Left, tt1 = t1Left, uu1 = u1Left, vv1 = v1Left;
    909918#endif
     
    911920               GLint right = FixedToInt(fxRightEdge);
    912921
    913 #if INTERP_RGB
     922#ifdef INTERP_RGB
    914923               {
    915924                  /* need this to accomodate round-off errors */
     
    925934               }
    926935#endif
    927 #if INTERP_SPEC
     936#ifdef INTERP_SPEC
    928937               {
    929938                  /* need this to accomodate round-off errors */
     
    939948               }
    940949#endif
    941 #if INTERP_ALPHA
     950#ifdef INTERP_ALPHA
    942951               {
    943952                  GLfixed ffaend = ffa+(right-left-1)*fdadx;
     
    946955               }
    947956#endif
    948 #if INTERP_INDEX
     957#ifdef INTERP_INDEX
    949958               if (ffi<0) ffi = 0;
    950959#endif
     
    969978                  fError -= FIXED_ONE;
    970979#ifdef PIXEL_ADDRESS
    971                   pRow = (PIXEL_TYPE*) ((GLubyte*)pRow + dPRowOuter);
    972 #endif
    973 #if INTERP_Z
    974                   zRow = (GLdepth*) ((GLubyte*)zRow + dZRowOuter);
     980                  pRow = (PIXEL_TYPE *) ((GLubyte*)pRow + dPRowOuter);
     981#endif
     982#ifdef INTERP_Z
     983#  ifdef DEPTH_TYPE
     984                  zRow = (DEPTH_TYPE *) ((GLubyte*)zRow + dZRowOuter);
     985#  endif
    975986                  fz += fdzOuter;
    976987#endif
    977 #if INTERP_RGB
     988#ifdef INTERP_RGB
    978989                  fr += fdrOuter;   fg += fdgOuter;   fb += fdbOuter;
    979990#endif
    980 #if INTERP_SPEC
     991#ifdef INTERP_SPEC
    981992                  fsr += fdsrOuter;   fsg += fdsgOuter;   fsb += fdsbOuter;
    982993#endif
    983 #if INTERP_ALPHA
     994#ifdef INTERP_ALPHA
    984995                  fa += fdaOuter;
    985996#endif
    986 #if INTERP_INDEX
     997#ifdef INTERP_INDEX
    987998                  fi += fdiOuter;
    988999#endif
    989 #if INTERP_INT_ST
     1000#ifdef INTERP_INT_ST
    9901001                  fs += fdsOuter;   ft += fdtOuter;
    9911002#endif
    992 #if INTERP_STUV
    993                   sLeft += dsOuter;
    994                   tLeft += dtOuter;
    995                   uLeft += duOuter;
    996                   vLeft += dvOuter;
    997 #endif
    998 #if INTERP_STUV1
    999                   s1Left += ds1Outer;
    1000                   t1Left += dt1Outer;
    1001                   u1Left += du1Outer;
    1002                   v1Left += dv1Outer;
     1003#ifdef INTERP_STUV
     1004                  sLeft += dsOuter;
     1005                  tLeft += dtOuter;
     1006                  uLeft += duOuter;
     1007                  vLeft += dvOuter;
     1008#endif
     1009#ifdef INTERP_STUV1
     1010                  s1Left += ds1Outer;
     1011                  t1Left += dt1Outer;
     1012                  u1Left += du1Outer;
     1013                  v1Left += dv1Outer;
    10031014#endif
    10041015               }
    10051016               else {
    10061017#ifdef PIXEL_ADDRESS
    1007                   pRow = (PIXEL_TYPE*) ((GLubyte*)pRow + dPRowInner);
    1008 #endif
    1009 #if INTERP_Z
    1010                   zRow = (GLdepth*) ((GLubyte*)zRow + dZRowInner);
     1018                  pRow = (PIXEL_TYPE *) ((GLubyte*)pRow + dPRowInner);
     1019#endif
     1020#ifdef INTERP_Z
     1021#  ifdef DEPTH_TYPE
     1022                  zRow = (DEPTH_TYPE *) ((GLubyte*)zRow + dZRowInner);
     1023#  endif
    10111024                  fz += fdzInner;
    10121025#endif
    1013 #if INTERP_RGB
     1026#ifdef INTERP_RGB
    10141027                  fr += fdrInner;   fg += fdgInner;   fb += fdbInner;
    10151028#endif
    1016 #if INTERP_SPEC
     1029#ifdef INTERP_SPEC
    10171030                  fsr += fdsrInner;   fsg += fdsgInner;   fsb += fdsbInner;
    10181031#endif
    1019 #if INTERP_ALPHA
     1032#ifdef INTERP_ALPHA
    10201033                  fa += fdaInner;
    10211034#endif
    1022 #if INTERP_INDEX
     1035#ifdef INTERP_INDEX
    10231036                  fi += fdiInner;
    10241037#endif
    1025 #if INTERP_INT_ST
     1038#ifdef INTERP_INT_ST
    10261039                  fs += fdsInner;   ft += fdtInner;
    10271040#endif
    1028 #if INTERP_STUV
    1029                   sLeft += dsInner;
    1030                   tLeft += dtInner;
    1031                   uLeft += duInner;
    1032                   vLeft += dvInner;
    1033 #endif
    1034 #if INTERP_STUV1
    1035                   s1Left += ds1Inner;
    1036                   t1Left += dt1Inner;
    1037                   u1Left += du1Inner;
    1038                   v1Left += dv1Inner;
     1041#ifdef INTERP_STUV
     1042                  sLeft += dsInner;
     1043                  tLeft += dtInner;
     1044                  uLeft += duInner;
     1045                  vLeft += dvInner;
     1046#endif
     1047#ifdef INTERP_STUV1
     1048                  s1Left += ds1Inner;
     1049                  t1Left += dt1Inner;
     1050                  u1Left += du1Inner;
     1051                  v1Left += dv1Inner;
    10391052#endif
    10401053               }
     
    10651078#undef S_SCALE
    10661079#undef T_SCALE
     1080
     1081#undef FixedToDepth
  • trunk/src/opengl/mesa/types.h

    r2962 r3597  
    1 /* $Id: types.h,v 1.2 2000-03-01 18:49:38 jeroen Exp $ */
     1/* $Id: types.h,v 1.3 2000-05-23 20:34:58 jeroen Exp $ */
    22
    33/*
    44 * Mesa 3-D graphics library
    5  * Version:  3.1
     5 * Version:  3.3
    66 *
    77 * Copyright (C) 1999  Brian Paul   All Rights Reserved.
     
    3030
    3131
    32 #include "gl.h"
    33 #ifdef HAVE_CONFIG_H
    34 #include "conf.h"
    35 #endif
     32#include "glheader.h"
    3633#include "config.h"
     34#include "glthread.h"
     35#include "glapitable.h"
    3736#include "macros.h"
    3837#include "fixed.h"
     
    104103#  define STENCIL_MAX 0xff
    105104#elif STENCIL_BITS==16
    106    typedef GLushort GLstencil
     105   typedef GLushort GLstencil;
    107106#  define STENCIL_MAX 0xffff
    108107#else
     
    115114 * Depth buffer data type:
    116115 */
    117 #if DEPTH_BITS==16
    118    typedef GLushort GLdepth;
    119 #elif DEPTH_BITS==32
    120    typedef GLint GLdepth;
    121 #else
    122 #  error "illegal number of depth bits"
    123 #endif
     116typedef GLuint GLdepth;  /* Must be 32-bits! */
    124117
    125118
     
    128121 * Some forward type declarations
    129122 */
    130 struct HashTable;
     123struct _mesa_HashTable;
    131124
    132125typedef struct gl_visual GLvisual;
     
    134127typedef struct gl_frame_buffer GLframebuffer;
    135128
    136 struct gl_pixelstore_attrib;
    137 
    138129
    139130/*
    140131 * Functions for transformation of normals in the VB.
    141132 */
    142 typedef void (*normal_func)( const GLmatrix *mat,
     133typedef void (_NORMAPIP normal_func)( const GLmatrix *mat,
    143134                             GLfloat scale,
    144135                             const GLvector3f *in,
     
    181172
    182173
     174
     175typedef void (*render_func)( struct vertex_buffer *VB,
     176                             GLuint start,
     177                             GLuint count,
     178                             GLuint parity );
     179
     180
    183181/*
    184182 * Blending function
    185183 */
    186 typedef void (* __cdecl blend_func)( GLcontext *ctx, GLuint n, const GLubyte mask[],
     184#ifdef USE_MMX_ASM
     185typedef void (_ASMAPIP blend_func)( GLcontext *ctx, GLuint n,
     186                                    const GLubyte mask[],
     187                                    GLubyte src[][4], CONST GLubyte dst[][4] );
     188#else
     189typedef void (*blend_func)( GLcontext *ctx, GLuint n, const GLubyte mask[],
    187190                            GLubyte src[][4], CONST GLubyte dst[][4] );
     191#endif
    188192
    189193
     
    199203                                   const GLfloat u[], const GLfloat lambda[],
    200204                                   GLubyte rgba[][4] );
    201 
    202 
    203 
    204 /* Generic internal image format */
    205 struct gl_image {
    206         GLint Width;
    207         GLint Height;
    208         GLint Depth;            /* for 3-D texturing */
    209         GLint Components;       /* 1, 2, 3 or 4 */
    210         GLenum Format;          /* GL_COLOR_INDEX, GL_RED, GL_RGB, etc */
    211         GLenum Type;            /* GL_UNSIGNED_BYTE or GL_FLOAT or GL_BITMAP */
    212         GLvoid *Data;
    213         GLboolean ErrorFlag;
    214         GLint RefCount;
    215 };
    216205
    217206
     
    249238
    250239
    251 /*
    252  * All gl* API functions in api*.c jump through pointers in this struct.
    253  */
    254 struct gl_api_table {
    255    void (*Accum)( GLcontext *, GLenum, GLfloat );
    256    void (*AlphaFunc)( GLcontext *, GLenum, GLclampf );
    257    GLboolean (*AreTexturesResident)( GLcontext *, GLsizei,
    258                                      const GLuint *, GLboolean * );
    259    void (*BindTexture)( GLcontext *, GLenum, GLuint );
    260    void (*Bitmap)( GLcontext *, GLsizei, GLsizei, GLfloat, GLfloat,
    261                    GLfloat, GLfloat, const GLubyte *,
    262                    const struct gl_pixelstore_attrib *packing );
    263    void (*BlendColor)( GLcontext *, GLclampf, GLclampf, GLclampf, GLclampf);
    264    void (*BlendEquation)( GLcontext *, GLenum );
    265    void (*BlendFunc)( GLcontext *, GLenum, GLenum );
    266    void (*BlendFuncSeparate)( GLcontext *, GLenum, GLenum, GLenum, GLenum );
    267    void (*CallList)( GLcontext *, GLuint list );
    268    void (*CallLists)( GLcontext *, GLsizei, GLenum, const GLvoid * );
    269    void (*Clear)( GLcontext *, GLbitfield );
    270    void (*ClearAccum)( GLcontext *, GLfloat, GLfloat, GLfloat, GLfloat );
    271    void (*ClearColor)( GLcontext *, GLclampf, GLclampf, GLclampf, GLclampf );
    272    void (*ClearDepth)( GLcontext *, GLclampd );
    273    void (*ClearIndex)( GLcontext *, GLfloat );
    274    void (*ClearStencil)( GLcontext *, GLint );
    275    void (*ClipPlane)( GLcontext *, GLenum, const GLfloat * );
    276    void (*ColorMask)( GLcontext *,
    277                         GLboolean, GLboolean, GLboolean, GLboolean );
    278    void (*ColorMaterial)( GLcontext *, GLenum, GLenum );
    279    void (*ColorTable)( GLcontext *, GLenum, GLenum, struct gl_image * );
    280    void (*ColorSubTable)( GLcontext *, GLenum, GLsizei, struct gl_image * );
    281    void (*CopyPixels)( GLcontext *, GLint, GLint, GLsizei, GLsizei, GLenum );
    282    void (*CopyTexImage1D)( GLcontext *, GLenum, GLint, GLenum,
    283                            GLint, GLint, GLsizei, GLint );
    284    void (*CopyTexImage2D)( GLcontext *, GLenum, GLint, GLenum,
    285                            GLint, GLint, GLsizei, GLsizei, GLint );
    286    void (*CopyTexSubImage1D)( GLcontext *, GLenum, GLint, GLint,
    287                               GLint, GLint, GLsizei );
    288    void (*CopyTexSubImage2D)( GLcontext *, GLenum, GLint, GLint, GLint,
    289                               GLint, GLint, GLsizei, GLsizei );
    290    void (*CopyTexSubImage3D)(GLcontext *, GLenum, GLint, GLint, GLint, GLint,
    291                              GLint, GLint, GLsizei, GLsizei  );
    292    void (*CullFace)( GLcontext *, GLenum );
    293    void (*DeleteLists)( GLcontext *, GLuint, GLsizei );
    294    void (*DeleteTextures)( GLcontext *, GLsizei, const GLuint *);
    295    void (*DepthFunc)( GLcontext *, GLenum );
    296    void (*DepthMask)( GLcontext *, GLboolean );
    297    void (*DepthRange)( GLcontext *, GLclampd, GLclampd );
    298    void (*Disable)( GLcontext *, GLenum );
    299    void (*DisableClientState)( GLcontext *, GLenum );
    300    void (*DrawBuffer)( GLcontext *, GLenum );
    301    void (*DrawPixels)( GLcontext *, struct gl_image *image );
    302    void (*Enable)( GLcontext *, GLenum );
    303    void (*Error)( GLcontext *, GLenum, const char * );
    304    void (*EnableClientState)( GLcontext *, GLenum );
    305    void (*EndList)( GLcontext * );
    306    void (*EvalMesh1)( GLcontext *, GLenum, GLint, GLint );
    307    void (*EvalMesh2)( GLcontext *, GLenum, GLint, GLint, GLint, GLint );
    308    void (*FeedbackBuffer)( GLcontext *, GLsizei, GLenum, GLfloat * );
    309    void (*Finish)( GLcontext * );
    310    void (*Flush)( GLcontext * );
    311    void (*Fogfv)( GLcontext *, GLenum, const GLfloat * );
    312    void (*FrontFace)( GLcontext *, GLenum );
    313    void (*Frustum)( GLcontext *, GLdouble, GLdouble, GLdouble, GLdouble,
    314                     GLdouble, GLdouble );
    315    GLuint (*GenLists)( GLcontext *, GLsizei );
    316    void (*GenTextures)( GLcontext *, GLsizei, GLuint * );
    317    void (*GetBooleanv)( GLcontext *, GLenum, GLboolean * );
    318    void (*GetClipPlane)( GLcontext *, GLenum, GLdouble * );
    319    void (*GetColorTable)( GLcontext *, GLenum, GLenum, GLenum, GLvoid *);
    320    void (*GetColorTableParameteriv)( GLcontext *, GLenum, GLenum, GLint *);
    321    void (*GetDoublev)( GLcontext *, GLenum, GLdouble * );
    322    GLenum (*GetError)( GLcontext * );
    323    void (*GetFloatv)( GLcontext *, GLenum, GLfloat * );
    324    void (*GetIntegerv)( GLcontext *, GLenum, GLint * );
    325    const GLubyte* (*GetString)( GLcontext *, GLenum name );
    326    void (*GetLightfv)( GLcontext *, GLenum light, GLenum, GLfloat * );
    327    void (*GetLightiv)( GLcontext *, GLenum light, GLenum, GLint * );
    328    void (*GetMapdv)( GLcontext *, GLenum, GLenum, GLdouble * );
    329    void (*GetMapfv)( GLcontext *, GLenum, GLenum, GLfloat * );
    330    void (*GetMapiv)( GLcontext *, GLenum, GLenum, GLint * );
    331    void (*GetMaterialfv)( GLcontext *, GLenum, GLenum, GLfloat * );
    332    void (*GetMaterialiv)( GLcontext *, GLenum, GLenum, GLint * );
    333    void (*GetPixelMapfv)( GLcontext *, GLenum, GLfloat * );
    334    void (*GetPixelMapuiv)( GLcontext *, GLenum, GLuint * );
    335    void (*GetPixelMapusv)( GLcontext *, GLenum, GLushort * );
    336    void (*GetPointerv)( GLcontext *, GLenum, GLvoid ** );
    337    void (*GetPolygonStipple)( GLcontext *, GLubyte * );
    338    void (*PrioritizeTextures)( GLcontext *, GLsizei, const GLuint *,
    339                                const GLclampf * );
    340    void (*GetTexEnvfv)( GLcontext *, GLenum, GLenum, GLfloat * );
    341    void (*GetTexEnviv)( GLcontext *, GLenum, GLenum, GLint * );
    342    void (*GetTexGendv)( GLcontext *, GLenum coord, GLenum, GLdouble * );
    343    void (*GetTexGenfv)( GLcontext *, GLenum coord, GLenum, GLfloat * );
    344    void (*GetTexGeniv)( GLcontext *, GLenum coord, GLenum, GLint * );
    345    void (*GetTexImage)( GLcontext *, GLenum, GLint level, GLenum, GLenum,
    346                         GLvoid * );
    347    void (*GetTexLevelParameterfv)( GLcontext *,
    348                                      GLenum, GLint, GLenum, GLfloat * );
    349    void (*GetTexLevelParameteriv)( GLcontext *,
    350                                      GLenum, GLint, GLenum, GLint * );
    351    void (*GetTexParameterfv)( GLcontext *, GLenum, GLenum, GLfloat *);
    352    void (*GetTexParameteriv)( GLcontext *, GLenum, GLenum, GLint * );
    353    GLboolean (*Hint)( GLcontext *, GLenum, GLenum );
    354    void (*IndexMask)( GLcontext *, GLuint );
    355    void (*InitNames)( GLcontext * );
    356    GLboolean (*IsEnabled)( GLcontext *, GLenum );
    357    GLboolean (*IsList)( GLcontext *, GLuint );
    358    GLboolean (*IsTexture)( GLcontext *, GLuint );
    359    void (*LightModelfv)( GLcontext *, GLenum, const GLfloat * );
    360    void (*Lightfv)( GLcontext *, GLenum light, GLenum, const GLfloat *, GLint);
    361    void (*LineStipple)( GLcontext *, GLint factor, GLushort );
    362    void (*LineWidth)( GLcontext *, GLfloat );
    363    void (*ListBase)( GLcontext *, GLuint );
    364    void (*LoadIdentity)( GLcontext * );
    365    /* LoadMatrixd implemented with glLoadMatrixf */
    366    void (*LoadMatrixf)( GLcontext *, const GLfloat * );
    367    void (*LoadName)( GLcontext *, GLuint );
    368    void (*LogicOp)( GLcontext *, GLenum );
    369    void (*Map1f)( GLcontext *, GLenum, GLfloat, GLfloat, GLint, GLint,
    370                   const GLfloat *, GLboolean );
    371    void (*Map2f)( GLcontext *, GLenum, GLfloat, GLfloat, GLint, GLint,
    372                   GLfloat, GLfloat, GLint, GLint, const GLfloat *,
    373                   GLboolean );
    374    void (*MapGrid1f)( GLcontext *, GLint, GLfloat, GLfloat );
    375    void (*MapGrid2f)( GLcontext *, GLint, GLfloat, GLfloat,
    376                         GLint, GLfloat, GLfloat );
    377    void (*MatrixMode)( GLcontext *, GLenum );
    378    /* MultMatrixd implemented with glMultMatrixf */
    379    void (*MultMatrixf)( GLcontext *, const GLfloat * );
    380    void (*NewList)( GLcontext *, GLuint list, GLenum );
    381    void (*Ortho)( GLcontext *, GLdouble, GLdouble, GLdouble, GLdouble,
    382                   GLdouble, GLdouble );
    383    void (*PassThrough)( GLcontext *, GLfloat );
    384    void (*PixelMapfv)( GLcontext *, GLenum, GLint, const GLfloat * );
    385    void (*PixelStorei)( GLcontext *, GLenum, GLint );
    386    void (*PixelTransferf)( GLcontext *, GLenum, GLfloat );
    387    void (*PixelZoom)( GLcontext *, GLfloat, GLfloat );
    388    void (*PointParameterfvEXT)( GLcontext *, GLenum, const GLfloat * );
    389    void (*PointSize)( GLcontext *, GLfloat );
    390    void (*PolygonMode)( GLcontext *, GLenum, GLenum );
    391    void (*PolygonOffset)( GLcontext *, GLfloat, GLfloat );
    392    void (*PolygonStipple)( GLcontext *, const GLuint * );
    393    void (*PopAttrib)( GLcontext * );
    394    void (*PopClientAttrib)( GLcontext * );
    395    void (*PopMatrix)( GLcontext * );
    396    void (*PopName)( GLcontext * );
    397    void (*PushAttrib)( GLcontext *, GLbitfield );
    398    void (*PushClientAttrib)( GLcontext *, GLbitfield );
    399    void (*PushMatrix)( GLcontext * );
    400    void (*PushName)( GLcontext *, GLuint );
    401    void (*RasterPos4f)( GLcontext *,
    402                         GLfloat x, GLfloat y, GLfloat z, GLfloat w );
    403    void (*ReadBuffer)( GLcontext *, GLenum );
    404    void (*ReadPixels)( GLcontext *, GLint, GLint, GLsizei, GLsizei, GLenum,
    405                          GLenum, GLvoid * );
    406    void (*Rectf)( GLcontext *, GLfloat, GLfloat, GLfloat, GLfloat );
    407    GLint (*RenderMode)( GLcontext *, GLenum );
    408    void (*Rotatef)( GLcontext *, GLfloat, GLfloat, GLfloat, GLfloat );
    409    void (*Scalef)( GLcontext *, GLfloat, GLfloat, GLfloat );
    410    void (*Scissor)( GLcontext *, GLint, GLint, GLsizei, GLsizei);
    411    void (*SelectBuffer)( GLcontext *, GLsizei, GLuint * );
    412    void (*ShadeModel)( GLcontext *, GLenum );
    413    void (*StencilFunc)( GLcontext *, GLenum, GLint, GLuint );
    414    void (*StencilMask)( GLcontext *, GLuint );
    415    void (*StencilOp)( GLcontext *, GLenum, GLenum, GLenum );
    416 
    417    void (*TexEnvfv)( GLcontext *, GLenum, GLenum, const GLfloat * );
    418    void (*TexGenfv)( GLcontext *, GLenum coord, GLenum, const GLfloat * );
    419    void (*TexImage1D)( GLcontext *, GLenum, GLint, GLint, GLsizei,
    420                        GLint, GLenum, GLenum, const GLvoid * );
    421    void (*TexImage2D)( GLcontext *, GLenum, GLint, GLint, GLsizei, GLsizei,
    422                        GLint, GLenum, GLenum, const GLvoid *);
    423    void (*TexSubImage1D)( GLcontext *, GLenum, GLint, GLint, GLsizei,
    424                           GLenum, GLenum, const GLvoid * );
    425    void (*TexSubImage2D)( GLcontext *, GLenum, GLint, GLint, GLint,
    426                           GLsizei, GLsizei, GLenum, GLenum, const GLvoid *);
    427    void (*TexImage3D)(GLcontext *, GLenum, GLint, GLint, GLsizei, GLsizei,
    428                       GLsizei, GLint, GLenum, GLenum, const GLvoid *);
    429    void (*TexSubImage3D)(GLcontext *, GLenum, GLint, GLint, GLint, GLint,
    430                          GLsizei, GLsizei, GLsizei, GLenum, GLenum,
    431                          const GLvoid *);
    432    void (*TexParameterfv)( GLcontext *, GLenum, GLenum, const GLfloat * );
    433    /* Translated implemented by Translatef */
    434    void (*Translatef)( GLcontext *, GLfloat, GLfloat, GLfloat );
    435 
    436    void (*Viewport)( GLcontext *, GLint, GLint, GLsizei, GLsizei );
    437 
    438    /* GL_MESA_window_pos extension */
    439    void (*WindowPos4fMESA)( GLcontext *, GLfloat, GLfloat, GLfloat, GLfloat );
    440 
    441    /* GL_MESA_resize_buffers extension */
    442    void (*ResizeBuffersMESA)( GLcontext * );
    443 
    444    /* GL_ARB_multitexture */
    445    void (*ActiveTexture)( GLcontext *, GLenum );
    446    void (*ClientActiveTexture)( GLcontext *, GLenum );
    447 };
    448 
    449 
    450 
    451 typedef void (*render_func)( struct vertex_buffer *VB,
    452                              GLuint start,
    453                              GLuint count,
    454                              GLuint parity );
    455 
    456 
     240/* Data structure for color tables */
     241struct gl_color_table {
     242        GLubyte Table[4 * MAX_TEXTURE_PALETTE_SIZE];
     243        GLuint Size;           /* number of entries (rows) in table */
     244        GLenum Format;
     245        GLenum IntFormat;
     246};
    457247
    458248
     
    601391
    602392struct gl_current_attrib {
    603 
    604393        /* KW: These values valid only when the VB is flushed.
    605394         */
     
    629418        GLboolean Test;         /* Depth buffering enabled flag */
    630419        GLboolean Mask;         /* Depth buffer writable? */
     420        GLboolean OcclusionTest;/* XXX GL_HP_occlusion_test */
    631421};
    632422
     
    943733/* Texture object record */
    944734struct gl_texture_object {
     735        _glthread_Mutex Mutex;          /* for thread safety */
    945736        GLint RefCount;                 /* reference count */
    946737        GLuint Name;                    /* an unsigned integer */
     
    963754
    964755        /* GL_EXT_paletted_texture */
    965         GLubyte Palette[MAX_TEXTURE_PALETTE_SIZE*4];
    966         GLuint PaletteSize;
    967         GLenum PaletteIntFormat;
    968         GLenum PaletteFormat;
     756        struct gl_color_table Palette;
    969757
    970758        /* For device driver: */
     
    1013801        GLuint  TexgenSize;     /* size of element generated */
    1014802        GLboolean AnyTransform; /* texgen or non-identity matrix */
     803        GLfloat LodBias;        /* for biasing mipmap levels */
    1015804
    1016805        struct gl_texture_object *CurrentD[4];
     
    1046835        /* GL_EXT_shared_texture_palette */
    1047836        GLboolean SharedPalette;
    1048         GLubyte Palette[MAX_TEXTURE_PALETTE_SIZE*4];
    1049         GLuint PaletteSize;
    1050         GLenum PaletteIntFormat;
    1051         GLenum PaletteFormat;
     837        struct gl_color_table Palette;
    1052838};
    1053839
     
    13371123
    13381124struct gl_selection {
    1339         GLuint *Buffer;
    1340         GLuint BufferSize;      /* size of SelectBuffer */
    1341         GLuint BufferCount;     /* number of values in SelectBuffer */
    1342         GLuint Hits;            /* number of records in SelectBuffer */
    1343         GLuint NameStackDepth;
    1344         GLuint NameStack[MAX_NAME_STACK_DEPTH];
    1345         GLboolean HitFlag;
    1346         GLfloat HitMinZ, HitMaxZ;
     1125        GLuint *Buffer;
     1126        GLuint BufferSize;      /* size of SelectBuffer */
     1127        GLuint BufferCount;     /* number of values in SelectBuffer */
     1128        GLuint Hits;            /* number of records in SelectBuffer */
     1129        GLuint NameStackDepth;
     1130        GLuint NameStack[MAX_NAME_STACK_DEPTH];
     1131        GLboolean HitFlag;
     1132        GLfloat HitMinZ, HitMaxZ;
    13471133};
    13481134
     
    13531139 */
    13541140struct gl_1d_map {
    1355         GLuint Order;           /* Number of control points */
    1356         GLfloat u1, u2, du;     /* u1, u2, 1.0/(u2-u1) */
    1357         GLfloat *Points;        /* Points to contiguous control points */
    1358         GLboolean Retain;       /* Reference counter */
    1359 };
    1360        
     1141        GLuint Order;           /* Number of control points */
     1142        GLfloat u1, u2, du;     /* u1, u2, 1.0/(u2-u1) */
     1143        GLfloat *Points;        /* Points to contiguous control points */
     1144};
     1145
    13611146
    13621147/*
     
    13641149 */
    13651150struct gl_2d_map {
    1366         GLuint Uorder;          /* Number of control points in U dimension */
    1367         GLuint Vorder;          /* Number of control points in V dimension */
    1368         GLfloat u1, u2, du;
    1369         GLfloat v1, v2, dv;
    1370         GLfloat *Points;        /* Points to contiguous control points */
    1371         GLboolean Retain;       /* Reference counter */
     1151        GLuint Uorder;          /* Number of control points in U dimension */
     1152        GLuint Vorder;          /* Number of control points in V dimension */
     1153        GLfloat u1, u2, du;
     1154        GLfloat v1, v2, dv;
     1155        GLfloat *Points;        /* Points to contiguous control points */
    13721156};
    13731157
     
    13771161 */
    13781162struct gl_evaluators {
    1379         /* 1-D maps */
    1380         struct gl_1d_map Map1Vertex3;
    1381         struct gl_1d_map Map1Vertex4;
    1382         struct gl_1d_map Map1Index;
    1383         struct gl_1d_map Map1Color4;
    1384         struct gl_1d_map Map1Normal;
    1385         struct gl_1d_map Map1Texture1;
    1386         struct gl_1d_map Map1Texture2;
    1387         struct gl_1d_map Map1Texture3;
    1388         struct gl_1d_map Map1Texture4;
    1389 
    1390         /* 2-D maps */
    1391         struct gl_2d_map Map2Vertex3;
    1392         struct gl_2d_map Map2Vertex4;
    1393         struct gl_2d_map Map2Index;
    1394         struct gl_2d_map Map2Color4;
    1395         struct gl_2d_map Map2Normal;
    1396         struct gl_2d_map Map2Texture1;
    1397         struct gl_2d_map Map2Texture2;
    1398         struct gl_2d_map Map2Texture3;
    1399         struct gl_2d_map Map2Texture4;
     1163        /* 1-D maps */
     1164        struct gl_1d_map Map1Vertex3;
     1165        struct gl_1d_map Map1Vertex4;
     1166        struct gl_1d_map Map1Index;
     1167        struct gl_1d_map Map1Color4;
     1168        struct gl_1d_map Map1Normal;
     1169        struct gl_1d_map Map1Texture1;
     1170        struct gl_1d_map Map1Texture2;
     1171        struct gl_1d_map Map1Texture3;
     1172        struct gl_1d_map Map1Texture4;
     1173
     1174        /* 2-D maps */
     1175        struct gl_2d_map Map2Vertex3;
     1176        struct gl_2d_map Map2Vertex4;
     1177        struct gl_2d_map Map2Index;
     1178        struct gl_2d_map Map2Color4;
     1179        struct gl_2d_map Map2Normal;
     1180        struct gl_2d_map Map2Texture1;
     1181        struct gl_2d_map Map2Texture2;
     1182        struct gl_2d_map Map2Texture3;
     1183        struct gl_2d_map Map2Texture4;
    14001184};
    14011185
     
    14061190 */
    14071191struct gl_shared_state {
    1408    GLint RefCount;                         /* Reference count */
    1409    struct HashTable *DisplayList;          /* Display lists hash table */
    1410    struct HashTable *TexObjects;           /* Texture objects hash table */
     1192   _glthread_Mutex Mutex;                  /* for thread safety */
     1193   GLint RefCount;                         /* Reference count */
     1194   struct _mesa_HashTable *DisplayList;    /* Display lists hash table */
     1195   struct _mesa_HashTable *TexObjects;     /* Texture objects hash table */
    14111196   struct gl_texture_object *TexObjectList;/* Linked list of texture objects */
    14121197   struct gl_texture_object *DirtyTexObjList; /* List of dirty tex objects */
     
    14241209 */
    14251210struct gl_visual {
    1426         GLboolean RGBAflag;     /* Is frame buffer in RGBA mode, not CI? */
    1427         GLboolean DBflag;       /* Is color buffer double buffered? */
    1428         GLboolean StereoFlag;   /* stereo buffer? */
    1429 
    1430         GLint RedBits;          /* Bits per color component */
    1431         GLint GreenBits;
    1432         GLint BlueBits;
    1433         GLint AlphaBits;
    1434 
    1435         GLint IndexBits;        /* Bits/pixel if in color index mode */
    1436 
    1437         GLint AccumBits;        /* Number of bits per color channel, or 0 */
    1438         GLint DepthBits;        /* Number of bits in depth buffer, or 0 */
    1439         GLint StencilBits;      /* Number of bits in stencil buffer, or 0 */
    1440 
    1441         GLboolean SoftwareAlpha;/* Implement software alpha buffer? */
     1211   GLboolean RGBAflag;     /* Is frame buffer in RGBA mode, not CI? */
     1212   GLboolean DBflag;       /* Is color buffer double buffered? */
     1213   GLboolean StereoFlag;   /* stereo buffer? */
     1214
     1215   GLint RedBits;          /* Bits per color component */
     1216   GLint GreenBits;
     1217   GLint BlueBits;
     1218   GLint AlphaBits;
     1219
     1220   GLint IndexBits;        /* Bits/pixel if in color index mode */
     1221
     1222   GLint AccumBits;        /* Number of bits per color channel, or 0 */
     1223   GLint DepthBits;        /* Number of bits in depth buffer, or 0 */
     1224   GLint StencilBits;      /* Number of bits in stencil buffer, or 0 */
     1225
     1226   GLboolean SoftwareAlpha;/* Implement software alpha buffer? */
     1227
     1228   GLuint DepthMax;             /* Max depth buffer value */
     1229   GLfloat DepthMaxF;           /* Float max depth buffer value */
    14421230};
    14431231
     
    14511239 */
    14521240struct gl_frame_buffer {
    1453         GLvisual *Visual;       /* The corresponding visual */
    1454 
    1455         GLint Width;            /* Width of frame buffer in pixels */
    1456         GLint Height;           /* Height of frame buffer in pixels */
    1457 
    1458         GLdepth *Depth;         /* array [Width*Height] of GLdepth values */
    1459 
    1460         /* Stencil buffer */
    1461         GLstencil *Stencil;     /* array [Width*Height] of GLstencil values */
    1462 
    1463         /* Accumulation buffer */
    1464         GLaccum *Accum;         /* array [4*Width*Height] of GLaccum values */
    1465 
    1466         /* Software alpha planes: */
    1467         GLubyte *FrontLeftAlpha;  /* array [Width*Height] of GLubyte */
    1468         GLubyte *BackLeftAlpha;   /* array [Width*Height] of GLubyte */
    1469         GLubyte *FrontRightAlpha; /* array [Width*Height] of GLubyte */
    1470         GLubyte *BackRightAlpha;  /* array [Width*Height] of GLubyte */
    1471         GLubyte *Alpha;           /* Points to current alpha buffer */
    1472 
    1473         /* Drawing bounds: intersection of window size and scissor box */
    1474         GLint Xmin, Xmax, Ymin, Ymax;
     1241   GLvisual *Visual;       /* The corresponding visual */
     1242
     1243   GLint Width, Height;            /* Width of frame buffer in pixels */
     1244
     1245   GLboolean UseSoftwareDepthBuffer;
     1246   GLboolean UseSoftwareAccumBuffer;
     1247   GLboolean UseSoftwareStencilBuffer;
     1248   GLboolean UseSoftwareAlphaBuffers;
     1249
     1250
     1251   GLvoid *DepthBuffer;         /* array [Width*Height] of GLushort or GLint values */
     1252
     1253   /* Stencil buffer */
     1254   GLstencil *Stencil;     /* array [Width*Height] of GLstencil values */
     1255
     1256   /* Accumulation buffer */
     1257   GLaccum *Accum;         /* array [4*Width*Height] of GLaccum values */
     1258
     1259   /* Software alpha planes: */
     1260   GLubyte *FrontLeftAlpha;  /* array [Width*Height] of GLubyte */
     1261   GLubyte *BackLeftAlpha;   /* array [Width*Height] of GLubyte */
     1262   GLubyte *FrontRightAlpha; /* array [Width*Height] of GLubyte */
     1263   GLubyte *BackRightAlpha;  /* array [Width*Height] of GLubyte */
     1264   GLubyte *Alpha;           /* Points to current alpha buffer */
     1265
     1266   /* Drawing bounds: intersection of window size and scissor box */
     1267   GLint Xmin, Xmax, Ymin, Ymax;
    14751268};
    14761269
     
    14841277   GLuint MaxTextureUnits;
    14851278   GLuint MaxArrayLockSize;
     1279   GLint SubPixelBits;
     1280   GLfloat MinPointSize, MaxPointSize;          /* aliased */
     1281   GLfloat MinPointSizeAA, MaxPointSizeAA;      /* antialiased */
     1282   GLfloat PointSizeGranularity;
     1283   GLfloat MinLineWidth, MaxLineWidth;          /* aliased */
     1284   GLfloat MinLineWidthAA, MaxLineWidthAA;      /* antialiased */
     1285   GLfloat LineWidthGranularity;
     1286   GLuint NumAuxBuffers;
    14861287};
    14871288
     
    14941295   char *ext_string;
    14951296   struct extension *ext_list;
     1297   /* flags to quickly test if certain extensions are available */
     1298   GLboolean HaveTextureEnvAdd;
     1299   GLboolean HaveTextureLodBias;
     1300   GLboolean HaveHpOcclusionTest;
    14961301};
    14971302
     
    15001305 * Bitmasks to indicate which rasterization options are enabled (RasterMask)
    15011306 */
    1502 #define ALPHATEST_BIT           0x001   /* Alpha-test pixels */
    1503 #define BLEND_BIT               0x002   /* Blend pixels */
    1504 #define DEPTH_BIT               0x004   /* Depth-test pixels */
    1505 #define FOG_BIT                 0x008   /* Per-pixel fog */
    1506 #define LOGIC_OP_BIT            0x010   /* Apply logic op in software */
    1507 #define SCISSOR_BIT             0x020   /* Scissor pixels */
    1508 #define STENCIL_BIT             0x040   /* Stencil pixels */
    1509 #define MASKING_BIT             0x080   /* Do glColorMask or glIndexMask */
    1510 #define ALPHABUF_BIT            0x100   /* Using software alpha buffer */
    1511 #define WINCLIP_BIT             0x200   /* Clip pixels/primitives to window */
    1512 #define MULTI_DRAW_BIT          0x400   /* Write to more than one color- */
     1307#define ALPHATEST_BIT           0x001   /* Alpha-test pixels */
     1308#define BLEND_BIT               0x002   /* Blend pixels */
     1309#define DEPTH_BIT               0x004   /* Depth-test pixels */
     1310#define FOG_BIT                 0x008   /* Per-pixel fog */
     1311#define LOGIC_OP_BIT            0x010   /* Apply logic op in software */
     1312#define SCISSOR_BIT             0x020   /* Scissor pixels */
     1313#define STENCIL_BIT             0x040   /* Stencil pixels */
     1314#define MASKING_BIT             0x080   /* Do glColorMask or glIndexMask */
     1315#define ALPHABUF_BIT            0x100   /* Using software alpha buffer */
     1316#define WINCLIP_BIT             0x200   /* Clip pixels/primitives to window */
     1317#define MULTI_DRAW_BIT          0x400   /* Write to more than one color- */
    15131318                                        /* buffer or no buffers. */
     1319#define OCCLUSION_BIT           0x800   /* GL_HP_occlusion_test enabled */
     1320
    15141321
    15151322/*
    15161323 * Bits to indicate what state has to be updated (NewState)
    15171324 */
    1518 #define NEW_LIGHTING            0x1
    1519 #define NEW_RASTER_OPS          0x2
    1520 #define NEW_TEXTURING           0x4
    1521 #define NEW_POLYGON             0x8
    1522 #define NEW_DRVSTATE0           0x10 /* Reserved for drivers */
    1523 #define NEW_DRVSTATE1           0x20 /* Reserved for drivers */
    1524 #define NEW_DRVSTATE2           0x40 /* Reserved for drivers */
    1525 #define NEW_DRVSTATE3           0x80 /* Reserved for drivers */
    1526 #define NEW_MODELVIEW           0x100
    1527 #define NEW_PROJECTION          0x200
    1528 #define NEW_TEXTURE_MATRIX      0x400
    1529 #define NEW_USER_CLIP           0x800
     1325#define NEW_LIGHTING            0x1
     1326#define NEW_RASTER_OPS          0x2
     1327#define NEW_TEXTURING           0x4
     1328#define NEW_POLYGON             0x8
     1329#define NEW_DRVSTATE0           0x10 /* Reserved for drivers */
     1330#define NEW_DRVSTATE1           0x20 /* Reserved for drivers */
     1331#define NEW_DRVSTATE2           0x40 /* Reserved for drivers */
     1332#define NEW_DRVSTATE3           0x80 /* Reserved for drivers */
     1333#define NEW_MODELVIEW           0x100
     1334#define NEW_PROJECTION          0x200
     1335#define NEW_TEXTURE_MATRIX      0x400
     1336#define NEW_USER_CLIP           0x800
    15301337#define NEW_TEXTURE_ENV         0x1000
    15311338#define NEW_CLIENT_STATE        0x2000
     
    15341341#define NEW_VIEWPORT            0x10000
    15351342#define NEW_TEXTURE_ENABLE      0x20000
    1536 #define NEW_ALL                 ~0
    1537 
    1538 
    1539 #define NEW_DRIVER_STATE (NEW_DRVSTATE0 | NEW_DRVSTATE1 |       \
     1343#define NEW_ALL                 ~0
     1344
     1345
     1346#define NEW_DRIVER_STATE (NEW_DRVSTATE0 | NEW_DRVSTATE1 |       \
    15401347                          NEW_DRVSTATE2 | NEW_DRVSTATE3)
    15411348
     
    15701377#define DD_CLIP_FOG_COORD           0x2000000
    15711378
    1572 #define DD_SW_SETUP           (DD_TRI_CULL|             \
    1573                                DD_TRI_CULL_FRONT_BACK|  \
    1574                                DD_TRI_OFFSET|           \
    1575                                DD_TRI_LIGHT_TWOSIDE|    \
     1379
     1380
     1381#define DD_SW_SETUP           (DD_TRI_CULL|             \
     1382                               DD_TRI_CULL_FRONT_BACK|  \
     1383                               DD_TRI_OFFSET|           \
     1384                               DD_TRI_LIGHT_TWOSIDE|    \
    15761385                               DD_TRI_UNFILLED)
    15771386
    1578 #define DD_ANY_CULL           (DD_TRI_CULL_FRONT_BACK|  \
    1579                                DD_TRI_CULL|             \
     1387#define DD_ANY_CULL           (DD_TRI_CULL_FRONT_BACK|  \
     1388                               DD_TRI_CULL|             \
    15801389                               DD_LIGHTING_CULL)
    15811390
    1582 #define DD_SW_RASTERIZE       (DD_POINT_SW_RASTERIZE|   \
    1583                                DD_LINE_SW_RASTERIZE|    \
    1584                                DD_TRI_SW_RASTERIZE|     \
     1391#define DD_SW_RASTERIZE       (DD_POINT_SW_RASTERIZE|   \
     1392                               DD_LINE_SW_RASTERIZE|    \
     1393                               DD_TRI_SW_RASTERIZE|     \
    15851394                               DD_QUAD_SW_RASTERIZE)
    15861395
     
    15881397/* Vertex buffer clipping flags
    15891398 */
    1590 #define CLIP_RIGHT_SHIFT        0
    1591 #define CLIP_LEFT_SHIFT         1
    1592 #define CLIP_TOP_SHIFT          2
     1399#define CLIP_RIGHT_SHIFT        0
     1400#define CLIP_LEFT_SHIFT         1
     1401#define CLIP_TOP_SHIFT          2
    15931402#define CLIP_BOTTOM_SHIFT       3
    1594 #define CLIP_NEAR_SHIFT         4
    1595 #define CLIP_FAR_SHIFT          5
     1403#define CLIP_NEAR_SHIFT         4
     1404#define CLIP_FAR_SHIFT          5
    15961405
    15971406#define CLIP_RIGHT_BIT   0x01
     
    16021411#define CLIP_FAR_BIT     0x20
    16031412#define CLIP_USER_BIT    0x40
    1604 #define CLIP_CULLED_BIT  0x80   /* Vertex has been culled */
     1413#define CLIP_CULLED_BIT  0x80   /* Vertex has been culled */
    16051414#define CLIP_ALL_BITS    0x3f
    16061415
     
    16111420 * and some misc. flags.
    16121421 */
    1613 #define VERT_FACE_FRONT       0x1       /* is in a front-color primitive */
    1614 #define VERT_FACE_REAR        0x2       /* is in a rear-color primitive */
    1615 #define PRIM_FACE_FRONT       0x4       /* use front color */
    1616 #define PRIM_FACE_REAR        0x8       /* use rear color */
    1617 #define PRIM_CLIPPED          0x10      /* needs clipping */
    1618 #define PRIM_USER_CLIPPED     CLIP_USER_BIT     /* 0x40 */
     1422#define VERT_FACE_FRONT       0x1       /* is in a front-color primitive */
     1423#define VERT_FACE_REAR        0x2       /* is in a rear-color primitive */
     1424#define PRIM_FACE_FRONT       0x4       /* use front color */
     1425#define PRIM_FACE_REAR        0x8       /* use rear color */
     1426#define PRIM_CLIPPED          0x10      /* needs clipping */
     1427#define PRIM_USER_CLIPPED     CLIP_USER_BIT     /* 0x40 */
    16191428
    16201429
     
    16431452/* Flags for selecting a normal transformation function.
    16441453 */
    1645 #define NORM_RESCALE   0x1      /* apply the scale factor */
    1646 #define NORM_NORMALIZE 0x2      /* normalize */
    1647 #define NORM_TRANSFORM 0x4      /* apply the transformation matrix */
    1648 #define NORM_TRANSFORM_NO_ROT 0x8       /* apply the transformation matrix */
     1454#define NORM_RESCALE   0x1      /* apply the scale factor */
     1455#define NORM_NORMALIZE 0x2      /* normalize */
     1456#define NORM_TRANSFORM 0x4      /* apply the transformation matrix */
     1457#define NORM_TRANSFORM_NO_ROT 0x8       /* apply the transformation matrix */
    16491458
    16501459
     
    16521461 * Different kinds of 4x4 transformation matrices:
    16531462 */
    1654 #define MATRIX_GENERAL          0       /* general 4x4 matrix */
    1655 #define MATRIX_IDENTITY         1       /* identity matrix */
    1656 #define MATRIX_3D_NO_ROT        2       /* ortho projection and others... */
    1657 #define MATRIX_PERSPECTIVE      3       /* perspective projection matrix */
    1658 #define MATRIX_2D               4       /* 2-D transformation */
    1659 #define MATRIX_2D_NO_ROT        5       /* 2-D scale & translate only */
    1660 #define MATRIX_3D               6       /* 3-D transformation */
     1463#define MATRIX_GENERAL          0       /* general 4x4 matrix */
     1464#define MATRIX_IDENTITY         1       /* identity matrix */
     1465#define MATRIX_3D_NO_ROT        2       /* ortho projection and others... */
     1466#define MATRIX_PERSPECTIVE      3       /* perspective projection matrix */
     1467#define MATRIX_2D               4       /* 2-D transformation */
     1468#define MATRIX_2D_NO_ROT        5       /* 2-D scale & translate only */
     1469#define MATRIX_3D               6       /* 3-D transformation */
    16611470
    16621471#define MAT_FLAG_IDENTITY        0
     
    16861495
    16871496#define MAT_FLAGS_ANGLE_PRESERVING (MAT_FLAG_ROTATION | \
    1688                                     MAT_FLAG_TRANSLATION | \
    1689                                     MAT_FLAG_UNIFORM_SCALE)
     1497                                    MAT_FLAG_TRANSLATION | \
     1498                                    MAT_FLAG_UNIFORM_SCALE)
    16901499
    16911500#define MAT_FLAGS_LENGTH_PRESERVING (MAT_FLAG_ROTATION | \
    1692                                      MAT_FLAG_TRANSLATION)
     1501                                     MAT_FLAG_TRANSLATION)
    16931502
    16941503#define MAT_FLAGS_3D (MAT_FLAG_ROTATION | \
    1695                       MAT_FLAG_TRANSLATION | \
    1696                       MAT_FLAG_UNIFORM_SCALE | \
    1697                       MAT_FLAG_GENERAL_SCALE | \
    1698                       MAT_FLAG_GENERAL_3D)
     1504                      MAT_FLAG_TRANSLATION | \
     1505                      MAT_FLAG_UNIFORM_SCALE | \
     1506                      MAT_FLAG_GENERAL_SCALE | \
     1507                      MAT_FLAG_GENERAL_3D)
    16991508
    17001509#define MAT_FLAGS_GEOMETRY (MAT_FLAG_GENERAL | \
    1701                             MAT_FLAG_ROTATION | \
    1702                             MAT_FLAG_TRANSLATION | \
    1703                             MAT_FLAG_UNIFORM_SCALE | \
    1704                             MAT_FLAG_GENERAL_SCALE | \
    1705                             MAT_FLAG_GENERAL_3D | \
    1706                             MAT_FLAG_PERSPECTIVE)
     1510                            MAT_FLAG_ROTATION | \
     1511                            MAT_FLAG_TRANSLATION | \
     1512                            MAT_FLAG_UNIFORM_SCALE | \
     1513                            MAT_FLAG_GENERAL_SCALE | \
     1514                            MAT_FLAG_GENERAL_3D | \
     1515                            MAT_FLAG_PERSPECTIVE)
    17071516
    17081517#define MAT_DIRTY_ALL_OVER (MAT_DIRTY_TYPE | \
    1709                             MAT_DIRTY_DEPENDENTS | \
    1710                             MAT_DIRTY_FLAGS | \
    1711                             MAT_DIRTY_INVERSE)
     1518                            MAT_DIRTY_DEPENDENTS | \
     1519                            MAT_DIRTY_FLAGS | \
     1520                            MAT_DIRTY_INVERSE)
    17121521
    17131522#define TEST_MAT_FLAGS(mat, a)  ((MAT_FLAGS_GEOMETRY&(~(a))&((mat)->flags))==0)
     
    17171526 * FogMode values:
    17181527 */
    1719 #define FOG_NONE        0       /* no fog */
    1720 #define FOG_VERTEX      1       /* apply per vertex */
    1721 #define FOG_FRAGMENT    2       /* apply per fragment */
     1528#define FOG_NONE        0       /* no fog */
     1529#define FOG_VERTEX      1       /* apply per vertex */
     1530#define FOG_FRAGMENT    2       /* apply per fragment */
    17221531
    17231532
     
    17431552 */
    17441553
    1745 #define VERT_OBJ_2           0x1        /* glVertex2 */
     1554#define VERT_OBJ_2           0x1        /* glVertex2 */
    17461555#define VERT_OBJ_3           0x2        /* glVertex3 */
    17471556#define VERT_OBJ_4           0x4        /* glVertex4 */
    1748 #define VERT_BEGIN           0x8        /* glBegin */
    1749 #define VERT_END             0x10       /* glEnd */
    1750 #define VERT_ELT             0x20       /* glArrayElement */
    1751 #define VERT_RGBA            0x40       /* glColor */
    1752 #define VERT_NORM            0x80       /* glNormal */
    1753 #define VERT_INDEX           0x100      /* glIndex */
    1754 #define VERT_EDGE            0x200      /* glEdgeFlag */
    1755 #define VERT_MATERIAL        0x400      /* glMaterial */
    1756 #define VERT_TEX0_1          0x800     
     1557#define VERT_BEGIN           0x8        /* glBegin */
     1558#define VERT_END             0x10       /* glEnd */
     1559#define VERT_ELT             0x20       /* glArrayElement */
     1560#define VERT_RGBA            0x40       /* glColor */
     1561#define VERT_NORM            0x80       /* glNormal */
     1562#define VERT_INDEX           0x100      /* glIndex */
     1563#define VERT_EDGE            0x200      /* glEdgeFlag */
     1564#define VERT_MATERIAL        0x400      /* glMaterial */
     1565#define VERT_TEX0_1          0x800
    17571566#define VERT_TEX0_2          0x1000
    17581567#define VERT_TEX0_3          0x2000
     
    17711580#define VERT_EVAL_P1         0x4000000  /*  */
    17721581#define VERT_EVAL_P2         0x8000000  /*  */
    1773 #define VERT_FLOAT_RGBA      0x10000000 /* allow partial support for this */
    1774 #define VERT_FOG_COORD       0x20000000 /* internal use only, currently */
     1582#define VERT_SPEC_RGB        0x10000000
     1583#define VERT_FOG_COORD       0x20000000 /* internal use only, currently */
    17751584
    17761585#define VERT_EYE             VERT_BEGIN /* for pipeline management & cva */
     
    17841593#define VERT_TEX0_SHIFT 11
    17851594
    1786 #define VERT_EVAL_ANY      (VERT_EVAL_C1|VERT_EVAL_P1|  \
     1595#define VERT_EVAL_ANY      (VERT_EVAL_C1|VERT_EVAL_P1|  \
    17871596                            VERT_EVAL_C2|VERT_EVAL_P2)
    17881597
     
    18181627
    18191628#define VERT_FIXUP         (VERT_TEX0_ANY|VERT_TEX1_ANY|VERT_RGBA| \
    1820                             VERT_INDEX|VERT_EDGE|VERT_NORM)
     1629                            VERT_INDEX|VERT_EDGE|VERT_NORM)
    18211630
    18221631#define VERT_DATA          (VERT_TEX0_ANY|VERT_TEX1_ANY|VERT_RGBA| \
    1823                             VERT_INDEX|VERT_EDGE|VERT_NORM| \
    1824                             VERT_OBJ_ANY|VERT_MATERIAL|VERT_ELT| \
    1825                             VERT_EVAL_ANY|VERT_FOG_COORD)
     1632                            VERT_INDEX|VERT_EDGE|VERT_NORM| \
     1633                            VERT_OBJ_ANY|VERT_MATERIAL|VERT_ELT| \
     1634                            VERT_EVAL_ANY|VERT_FOG_COORD)
    18261635
    18271636
     
    18351644/* For beginstate
    18361645 */
    1837 #define VERT_BEGIN_0    0x1        /* glBegin (if initially inside beg/end) */
    1838 #define VERT_BEGIN_1    0x2        /* glBegin (if initially outside beg/end) */
    1839 #define VERT_ERROR_0    0x4        /* invalid_operation in initial state 0 */
     1646#define VERT_BEGIN_0    0x1        /* glBegin (if initially inside beg/end) */
     1647#define VERT_BEGIN_1    0x2        /* glBegin (if initially outside beg/end) */
     1648#define VERT_ERROR_0    0x4        /* invalid_operation in initial state 0 */
    18401649#define VERT_ERROR_1    0x8        /* invalid_operation in initial state 1 */
    18411650
     
    18471656
    18481657typedef GLuint (*clip_line_func)( struct vertex_buffer *VB,
    1849                                   GLuint *i, GLuint *j,
    1850                                   GLubyte mask);
     1658                                  GLuint *i, GLuint *j,
     1659                                  GLubyte mask);
    18511660typedef GLuint (*clip_poly_func)( struct vertex_buffer *VB,
    1852                                   GLuint n, GLuint vlist[],
    1853                                   GLubyte mask );
     1661                                  GLuint n, GLuint vlist[],
     1662                                  GLubyte mask );
    18541663
    18551664/*
     
    18581667
    18591668struct gl_context {
    1860         /* State possibly shared with other contexts in the address space */
    1861         struct gl_shared_state *Shared;
    1862 
    1863         /* API function pointer tables */
    1864         struct gl_api_table API;                /* For api.c */
    1865         struct gl_api_table Save;               /* Display list save funcs */
    1866         struct gl_api_table Exec;               /* Execute funcs */
     1669        /* State possibly shared with other contexts in the address space */
     1670        struct gl_shared_state *Shared;
     1671
     1672        /* API function pointer tables */
     1673        struct _glapi_table *Save;      /* Display list save funcs */
     1674        struct _glapi_table *Exec;      /* Execute funcs */
     1675        struct _glapi_table *CurrentDispatch;  /* == Save or Exec !! */
    18671676
    18681677        GLvisual *Visual;
    1869         GLframebuffer *Buffer;
    1870 
    1871         /* Driver function pointer table */
    1872         struct dd_function_table Driver;
    1873        
     1678        GLframebuffer *DrawBuffer;
     1679        GLframebuffer *ReadBuffer;
     1680
     1681        /* Driver function pointer table */
     1682        struct dd_function_table Driver;
     1683
    18741684        triangle_func TriangleFunc; /* driver or indirect triangle func */
    18751685        quad_func     QuadFunc;
    18761686        triangle_func ClippedTriangleFunc;
    1877         clip_poly_func *poly_clip_tab;
    1878         clip_line_func *line_clip_tab;
    1879 
    1880         void *DriverCtx;        /* Points to device driver context/state */
    1881         void *DriverMgrCtx;     /* Points to device driver manager (optional)*/
    1882 
    1883         /* Core/Driver constants */
    1884         struct gl_constants Const;
    1885 
    1886         /* Modelview matrix and stack */
    1887         GLmatrix ModelView;     
    1888         GLuint ModelViewStackDepth;
    1889         GLmatrix ModelViewStack[MAX_MODELVIEW_STACK_DEPTH];
    1890 
    1891         /* Projection matrix and stack */
    1892         GLmatrix ProjectionMatrix;
    1893         GLuint ProjectionStackDepth;
    1894         GLmatrix ProjectionStack[MAX_PROJECTION_STACK_DEPTH];
    1895         GLfloat NearFarStack[MAX_PROJECTION_STACK_DEPTH][2];
     1687        clip_poly_func *poly_clip_tab;
     1688        clip_line_func *line_clip_tab;
     1689
     1690        void *DriverCtx;        /* Points to device driver context/state */
     1691        void *DriverMgrCtx;     /* Points to device driver manager (optional)*/
     1692
     1693        /* Core/Driver constants */
     1694        struct gl_constants Const;
     1695
     1696        /* Modelview matrix and stack */
     1697        GLmatrix ModelView;
     1698        GLuint ModelViewStackDepth;
     1699        GLmatrix ModelViewStack[MAX_MODELVIEW_STACK_DEPTH - 1];
     1700
     1701        /* Projection matrix and stack */
     1702        GLmatrix ProjectionMatrix;
     1703        GLuint ProjectionStackDepth;
     1704        GLmatrix ProjectionStack[MAX_PROJECTION_STACK_DEPTH - 1];
     1705        GLfloat NearFarStack[MAX_PROJECTION_STACK_DEPTH - 1][2];
    18961706
    18971707        /* Combined modelview and projection matrix */
     
    19021712        GLboolean ModelProjectWinMatrixUptodate;
    19031713
    1904         /* Texture matrix and stack */
    1905         GLmatrix TextureMatrix[MAX_TEXTURE_UNITS];
    1906         GLuint TextureStackDepth[MAX_TEXTURE_UNITS];
    1907         GLmatrix TextureStack[MAX_TEXTURE_UNITS][MAX_TEXTURE_STACK_DEPTH];
    1908 
    1909         /* Display lists */
    1910         GLuint CallDepth;       /* Current recursion calling depth */
    1911         GLboolean ExecuteFlag;  /* Execute GL commands? */
    1912         GLboolean CompileFlag;  /* Compile GL commands into display list? */
    1913         GLboolean CompileCVAFlag;
    1914         Node *CurrentListPtr;   /* Head of list being compiled */
    1915         GLuint CurrentListNum;  /* Number of the list being compiled */
    1916         Node *CurrentBlock;     /* Pointer to current block of nodes */
    1917         GLuint CurrentPos;      /* Index into current block of nodes */
    1918 
    1919         /* Extensions */
    1920         struct gl_extensions Extensions;
    1921 
    1922 
    1923         /* Pipeline stages - shared between the two pipelines,
    1924         * which live in CVA.
    1925         */
    1926         struct gl_pipeline_stage PipelineStage[MAX_PIPELINE_STAGES];
    1927         GLuint NrPipelineStages;
    1928 
    1929         /* Cva */
    1930         struct gl_cva CVA;
    1931 
    1932         /* Renderer attribute stack */
    1933         GLuint AttribStackDepth;
    1934         struct gl_attrib_node *AttribStack[MAX_ATTRIB_STACK_DEPTH];
    1935 
    1936         /* Renderer attribute groups */
    1937         struct gl_accum_attrib          Accum;
    1938         struct gl_colorbuffer_attrib    Color;
    1939         struct gl_current_attrib        Current;
    1940         struct gl_depthbuffer_attrib    Depth;
    1941         struct gl_eval_attrib           Eval;
    1942         struct gl_fog_attrib            Fog;
    1943         struct gl_hint_attrib           Hint;
    1944         struct gl_light_attrib          Light;
    1945         struct gl_line_attrib           Line;
    1946         struct gl_list_attrib           List;
    1947         struct gl_pixel_attrib          Pixel;
    1948         struct gl_point_attrib          Point;
    1949         struct gl_polygon_attrib        Polygon;
    1950         GLuint PolygonStipple[32];
    1951         struct gl_scissor_attrib        Scissor;
    1952         struct gl_stencil_attrib        Stencil;
    1953         struct gl_texture_attrib        Texture;
    1954         struct gl_transform_attrib      Transform;
    1955         struct gl_viewport_attrib       Viewport;
    1956 
    1957         /* Client attribute stack */
    1958         GLuint ClientAttribStackDepth;
    1959         struct gl_attrib_node *ClientAttribStack[MAX_CLIENT_ATTRIB_STACK_DEPTH];
    1960 
    1961         /* Client attribute groups */
    1962         struct gl_array_attrib          Array;  /* Vertex arrays */
    1963         struct gl_pixelstore_attrib     Pack;   /* Pixel packing */
    1964         struct gl_pixelstore_attrib     Unpack; /* Pixel unpacking */
    1965 
    1966         struct gl_evaluators EvalMap;   /* All evaluators */
    1967         struct gl_feedback Feedback;    /* Feedback */
    1968         struct gl_selection Select;     /* Selection */
    1969 
    1970         /* Optimized Accumulation buffer info */
    1971         GLboolean IntegerAccumMode;     /* Storing unscaled integers? */
    1972         GLfloat IntegerAccumScaler;     /* Implicit scale factor */
    1973 
    1974 
    1975         struct gl_fallback_arrays Fallback;
    1976 
    1977         GLenum ErrorValue;              /* Last error code */
    1978 
    1979         /* Miscellaneous */
     1714        /* Texture matrix and stack */
     1715        GLmatrix TextureMatrix[MAX_TEXTURE_UNITS];
     1716        GLuint TextureStackDepth[MAX_TEXTURE_UNITS];
     1717        GLmatrix TextureStack[MAX_TEXTURE_UNITS][MAX_TEXTURE_STACK_DEPTH - 1];
     1718
     1719        /* Display lists */
     1720        GLuint CallDepth;       /* Current recursion calling depth */
     1721        GLboolean ExecuteFlag;  /* Execute GL commands? */
     1722        GLboolean CompileFlag;  /* Compile GL commands into display list? */
     1723        GLboolean CompileCVAFlag;
     1724        Node *CurrentListPtr;   /* Head of list being compiled */
     1725        GLuint CurrentListNum;  /* Number of the list being compiled */
     1726        Node *CurrentBlock;     /* Pointer to current block of nodes */
     1727        GLuint CurrentPos;      /* Index into current block of nodes */
     1728
     1729        /* Extensions */
     1730        struct gl_extensions Extensions;
     1731
     1732
     1733        /* Pipeline stages - shared between the two pipelines,
     1734        * which live in CVA.
     1735        */
     1736        struct gl_pipeline_stage PipelineStage[MAX_PIPELINE_STAGES];
     1737        GLuint NrPipelineStages;
     1738
     1739        /* Cva */
     1740        struct gl_cva CVA;
     1741
     1742        /* Renderer attribute stack */
     1743        GLuint AttribStackDepth;
     1744        struct gl_attrib_node *AttribStack[MAX_ATTRIB_STACK_DEPTH];
     1745
     1746        /* Renderer attribute groups */
     1747        struct gl_accum_attrib          Accum;
     1748        struct gl_colorbuffer_attrib    Color;
     1749        struct gl_current_attrib        Current;
     1750        struct gl_depthbuffer_attrib    Depth;
     1751        struct gl_eval_attrib           Eval;
     1752        struct gl_fog_attrib            Fog;
     1753        struct gl_hint_attrib           Hint;
     1754        struct gl_light_attrib          Light;
     1755        struct gl_line_attrib           Line;
     1756        struct gl_list_attrib           List;
     1757        struct gl_pixel_attrib          Pixel;
     1758        struct gl_point_attrib          Point;
     1759        struct gl_polygon_attrib        Polygon;
     1760        GLuint PolygonStipple[32];
     1761        struct gl_scissor_attrib        Scissor;
     1762        struct gl_stencil_attrib        Stencil;
     1763        struct gl_texture_attrib        Texture;
     1764        struct gl_transform_attrib      Transform;
     1765        struct gl_viewport_attrib       Viewport;
     1766
     1767        /* Client attribute stack */
     1768        GLuint ClientAttribStackDepth;
     1769        struct gl_attrib_node *ClientAttribStack[MAX_CLIENT_ATTRIB_STACK_DEPTH];
     1770
     1771        /* Client attribute groups */
     1772        struct gl_array_attrib          Array;  /* Vertex arrays */
     1773        struct gl_pixelstore_attrib     Pack;   /* Pixel packing */
     1774        struct gl_pixelstore_attrib     Unpack; /* Pixel unpacking */
     1775
     1776        struct gl_evaluators EvalMap;   /* All evaluators */
     1777        struct gl_feedback Feedback;    /* Feedback */
     1778        struct gl_selection Select;     /* Selection */
     1779
     1780        /* Optimized Accumulation buffer info */
     1781        GLboolean IntegerAccumMode;     /* Storing unscaled integers? */
     1782        GLfloat IntegerAccumScaler;     /* Implicit scale factor */
     1783
     1784
     1785        struct gl_fallback_arrays Fallback;
     1786
     1787        GLenum ErrorValue;              /* Last error code */
     1788
     1789        /* Miscellaneous */
    19801790        GLuint NewState;        /* bitwise OR of NEW_* flags */
    1981         GLuint Enabled;         /* bitwise or of ENABLE_* flags */
    1982         GLenum RenderMode;      /* either GL_RENDER, GL_SELECT, GL_FEEDBACK */
    1983         GLuint StippleCounter;  /* Line stipple counter */
    1984         GLuint RasterMask;      /* OR of rasterization flags */
    1985         GLuint TriangleCaps;      /* OR of DD_* flags */
    1986         GLuint IndirectTriangles; /* TriangleCaps not handled by the driver */
    1987         GLfloat PolygonZoffset; /* Z offset for GL_FILL polygons */
    1988         GLfloat LineZoffset;    /* Z offset for GL_LINE polygons */
    1989         GLfloat PointZoffset;   /* Z offset for GL_POINT polygons */
    1990         GLboolean NeedNormals;  /* Are vertex normal vectors needed? */
     1791        GLuint Enabled;         /* bitwise or of ENABLE_* flags */
     1792        GLenum RenderMode;      /* either GL_RENDER, GL_SELECT, GL_FEEDBACK */
     1793        GLuint StippleCounter;  /* Line stipple counter */
     1794        GLuint RasterMask;      /* OR of rasterization flags */
     1795        GLuint TriangleCaps;      /* OR of DD_* flags */
     1796        GLuint IndirectTriangles; /* TriangleCaps not handled by the driver */
     1797        GLfloat PolygonZoffset; /* Z offset for GL_FILL polygons */
     1798        GLfloat LineZoffset;    /* Z offset for GL_LINE polygons */
     1799        GLfloat PointZoffset;   /* Z offset for GL_POINT polygons */
     1800        GLboolean NeedNormals;  /* Are vertex normal vectors needed? */
    19911801        GLboolean MutablePixels;/* Can rasterization change pixel's color? */
    19921802        GLboolean MonoPixels;   /* Are all pixels likely to be same color? */
    1993         GLuint FogMode;         /* FOG_OFF, FOG_VERTEX or FOG_FRAGMENT */
    1994 
    1995         GLboolean DoViewportMapping;
    1996 
    1997 
    1998         GLuint RenderFlags;     /* Active inputs to render stage */
    1999 
    2000         GLuint RequireWriteableFlags; /* What can the driver/clipping tolerate? */
    2001 
    2002         /* Points to function which interpolates colors, etc when clipping */
    2003         clip_interp_func ClipInterpFunc;
    2004         GLuint ClipTabMask;
     1803        GLuint FogMode;         /* FOG_OFF, FOG_VERTEX or FOG_FRAGMENT */
     1804
     1805        GLboolean DoViewportMapping;
     1806
     1807        GLuint RenderFlags;     /* Active inputs to render stage */
     1808
     1809        GLuint RequireWriteableFlags; /* What can the driver/clipping tolerate? */
     1810
     1811        /* Points to function which interpolates colors, etc when clipping */
     1812        clip_interp_func ClipInterpFunc;
     1813        GLuint ClipTabMask;
    20051814
    20061815        normal_func *NormalTransform;
    20071816
    2008         /* Current shading function */
     1817        /* Current shading function */
    20091818        GLuint shade_func_flags;
    20101819
     
    20121821        GLfloat rescale_factor;
    20131822
    2014         GLfloat vb_rescale_factor;
    2015         GLmatrix *vb_proj_matrix;
    2016 
    2017         GLubyte   AllowVertexCull; /* To be set by the geometry driver */
     1823        GLfloat vb_rescale_factor;
     1824        GLmatrix *vb_proj_matrix;
     1825
     1826        GLubyte   AllowVertexCull; /* To be set by the geometry driver */
    20181827        GLboolean NeedEyeCoords;
    20191828        GLboolean NeedEyeNormals;
    20201829        GLboolean NeedClipCoords;
    20211830
    2022         GLfloat backface_sign;
     1831        GLfloat backface_sign;
     1832
     1833        GLboolean OcclusionResult;  /* GL_HP_occlusion_test */
    20231834
    20241835        /* Destination of immediate mode commands */
     
    20261837
    20271838
    2028         /* Cache of unused immediate structs
    2029         */
    2030         struct immediate *freed_im_queue;
    2031         GLuint nr_im_queued;
     1839        /* Cache of unused immediate structs
     1840        */
     1841        struct immediate *freed_im_queue;
     1842        GLuint nr_im_queued;
    20321843
    20331844        /* The vertex buffer being used by this context.
    2034         */
     1845        */
    20351846        struct vertex_buffer *VB;
    20361847
     
    20441855#ifdef PROFILE
    20451856        /* Performance measurements */
    2046         GLuint BeginEndCount;   /* number of glBegin/glEnd pairs */
    2047         GLdouble BeginEndTime;  /* seconds spent between glBegin/glEnd */
    2048         GLuint VertexCount;     /* number of vertices processed */
    2049         GLdouble VertexTime;    /* total time in seconds */
    2050         GLuint PointCount;      /* number of points rendered */
    2051         GLdouble PointTime;     /* total time in seconds */
    2052         GLuint LineCount;       /* number of lines rendered */
    2053         GLdouble LineTime;      /* total time in seconds */
    2054         GLuint PolygonCount;    /* number of polygons rendered */
    2055         GLdouble PolygonTime;   /* total time in seconds */
    2056         GLuint ClearCount;      /* number of glClear calls */
    2057         GLdouble ClearTime;     /* seconds spent in glClear */
    2058         GLuint SwapCount;       /* number of swap-buffer calls */
    2059         GLdouble SwapTime;      /* seconds spent in swap-buffers */
     1857        GLuint BeginEndCount;   /* number of glBegin/glEnd pairs */
     1858        GLdouble BeginEndTime;  /* seconds spent between glBegin/glEnd */
     1859        GLuint VertexCount;     /* number of vertices processed */
     1860        GLdouble VertexTime;    /* total time in seconds */
     1861        GLuint PointCount;      /* number of points rendered */
     1862        GLdouble PointTime;     /* total time in seconds */
     1863        GLuint LineCount;       /* number of lines rendered */
     1864        GLdouble LineTime;      /* total time in seconds */
     1865        GLuint PolygonCount;    /* number of polygons rendered */
     1866        GLdouble PolygonTime;   /* total time in seconds */
     1867        GLuint ClearCount;      /* number of glClear calls */
     1868        GLdouble ClearTime;            /* seconds spent in glClear        */
     1869        GLuint SwapCount;              /* number of swap-buffer calls      */
     1870        GLdouble SwapTime;             /* seconds spent in swap-buffers    */
    20601871#endif
    20611872
     
    20841895
    20851896enum _verbose {
    2086         VERBOSE_VARRAY          = 0x1,
    2087         VERBOSE_TEXTURE         = 0x2,
    2088         VERBOSE_IMMEDIATE       = 0x4,
    2089         VERBOSE_PIPELINE        = 0x8,
    2090         VERBOSE_DRIVER          = 0x10,
    2091         VERBOSE_STATE           = 0x20,
    2092         VERBOSE_API             = 0x40,
    2093         VERBOSE_TRIANGLE_CHECKS = 0x80,
    2094         VERBOSE_CULL            = 0x100,
    2095         VERBOSE_DISPLAY_LIST    = 0x200
     1897        VERBOSE_VARRAY          = 0x1,
     1898        VERBOSE_TEXTURE         = 0x2,
     1899        VERBOSE_IMMEDIATE       = 0x4,
     1900        VERBOSE_PIPELINE        = 0x8,
     1901        VERBOSE_DRIVER          = 0x10,
     1902        VERBOSE_STATE           = 0x20,
     1903        VERBOSE_API             = 0x40,
     1904        VERBOSE_TRIANGLE_CHECKS = 0x80,
     1905        VERBOSE_CULL            = 0x100,
     1906        VERBOSE_DISPLAY_LIST    = 0x200,
     1907        VERBOSE_LIGHTING        = 0x400
    20961908};
    20971909
    20981910
    20991911enum _debug {
    2100         DEBUG_ALWAYS_FLUSH          = 0x1
     1912        DEBUG_ALWAYS_FLUSH          = 0x1
    21011913};
    21021914
     
    21061918extern void RESET_IMMEDIATE( GLcontext *ctx );
    21071919
    2108 #define FLUSH_VB( ctx, where )                  \
    2109 do {                                            \
    2110         struct immediate *IM = ctx->input;      \
    2111         if (IM->Flag[IM->Start])                \
    2112                 gl_flush_vb( ctx, where );      \
     1920#define FLUSH_VB( ctx, where )                  \
     1921do {                                            \
     1922        struct immediate *IM = ctx->input;      \
     1923        if (IM->Flag[IM->Start])                \
     1924                gl_flush_vb( ctx, where );      \
    21131925} while (0)
    21141926
     
    21181930/* Test if we're inside a glBegin / glEnd pair:
    21191931*/
    2120 #define ASSERT_OUTSIDE_BEGIN_END( ctx, where )                          \
    2121 do {                                                                    \
    2122         struct immediate *IM = ctx->input;                              \
    2123         GLuint flag = IM->Flag[IM->Count];                              \
    2124         if ((flag & (VERT_BEGIN|VERT_END)) != VERT_END) {               \
    2125                 FLUSH_VB(ctx, where);                                   \
    2126                 if (ctx->Current.Primitive != GL_POLYGON+1) {           \
    2127                         gl_error( ctx, GL_INVALID_OPERATION, where );   \
    2128                         return;                                         \
    2129                 }                                                       \
    2130         }                                                               \
     1932#define ASSERT_OUTSIDE_BEGIN_END( ctx, where )                          \
     1933do {                                                                    \
     1934        struct immediate *IM = ctx->input;                              \
     1935        GLuint flag = IM->Flag[IM->Count];                              \
     1936        if ((flag & (VERT_BEGIN|VERT_END)) != VERT_END) {               \
     1937                FLUSH_VB(ctx, where);                                   \
     1938                if (ctx->Current.Primitive != GL_POLYGON+1) {           \
     1939                        gl_error( ctx, GL_INVALID_OPERATION, where );   \
     1940                        return;                                         \
     1941                }                                                       \
     1942        }                                                               \
    21311943} while (0)
    21321944
    2133 #define ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL( ctx, where, what )        \
    2134 do {                                                                    \
    2135         struct immediate *IM = ctx->input;                              \
    2136         GLuint flag = IM->Flag[IM->Count];                              \
    2137         if ((flag & (VERT_BEGIN|VERT_END)) != VERT_END) {               \
    2138                 FLUSH_VB(ctx, where);                                   \
    2139                 if (ctx->Current.Primitive != GL_POLYGON+1) {           \
    2140                         gl_error( ctx, GL_INVALID_OPERATION, where );   \
    2141                         return what;                                    \
    2142                 }                                                       \
    2143         }                                                               \
     1945#define ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL( ctx, where, what )        \
     1946do {                                                                    \
     1947        struct immediate *IM = ctx->input;                              \
     1948        GLuint flag = IM->Flag[IM->Count];                              \
     1949        if ((flag & (VERT_BEGIN|VERT_END)) != VERT_END) {               \
     1950                FLUSH_VB(ctx, where);                                   \
     1951                if (ctx->Current.Primitive != GL_POLYGON+1) {           \
     1952                        gl_error( ctx, GL_INVALID_OPERATION, where );   \
     1953                        return what;                                    \
     1954                }                                                       \
     1955        }                                                               \
    21441956} while (0)
    21451957
    21461958
    2147 #define ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx, where )        \
    2148 do {                                                            \
    2149         FLUSH_VB( ctx, where );                                 \
    2150         if (ctx->Current.Primitive != GL_POLYGON+1) {           \
    2151                 gl_error( ctx, GL_INVALID_OPERATION, where );   \
    2152                 return;                                         \
    2153         }                                                       \
     1959#define ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx, where )        \
     1960do {                                                            \
     1961        FLUSH_VB( ctx, where );                                 \
     1962        if (ctx->Current.Primitive != GL_POLYGON+1) {           \
     1963                gl_error( ctx, GL_INVALID_OPERATION, where );   \
     1964                return;                                         \
     1965        }                                                       \
    21541966} while (0)
    21551967
    21561968
    21571969#define ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH_WITH_RETVAL( ctx, where, what )  \
    2158 do {                                                            \
    2159         FLUSH_VB( ctx, where );                                 \
    2160         if (ctx->Current.Primitive != GL_POLYGON+1) {           \
    2161                 gl_error( ctx, GL_INVALID_OPERATION, where );   \
    2162                 return what;                                    \
    2163         }                                                       \
     1970do {                                                            \
     1971        FLUSH_VB( ctx, where );                                 \
     1972        if (ctx->Current.Primitive != GL_POLYGON+1) {           \
     1973                gl_error( ctx, GL_INVALID_OPERATION, where );   \
     1974                return what;                                    \
     1975        }                                                       \
    21641976} while (0)
    21651977
  • trunk/src/opengl/mesa/varray.h

    r2938 r3597  
    1 /* $Id: varray.h,v 1.1 2000-02-29 00:48:42 sandervl Exp $ */
     1/* $Id: varray.h,v 1.2 2000-05-23 20:34:59 jeroen Exp $ */
    22
    33/*
     
    3333
    3434
    35 extern void gl_VertexPointer( GLcontext *ctx,
    36                               GLint size, GLenum type, GLsizei stride,
    37                               const GLvoid *ptr );
     35extern void
     36_mesa_VertexPointer(GLint size, GLenum type, GLsizei stride,
     37                    const GLvoid *ptr);
    3838
    3939
    40 extern void gl_NormalPointer( GLcontext *ctx,
    41                               GLenum type, GLsizei stride, const GLvoid *ptr );
     40extern void
     41_mesa_NormalPointer(GLenum type, GLsizei stride, const GLvoid *ptr);
    4242
    4343
    44 extern void gl_ColorPointer( GLcontext *ctx,
    45                              GLint size, GLenum type, GLsizei stride,
    46                              const GLvoid *ptr );
     44extern void
     45_mesa_ColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr);
    4746
    4847
    49 extern void gl_IndexPointer( GLcontext *ctx,
    50                                 GLenum type, GLsizei stride,
    51                                 const GLvoid *ptr );
     48extern void
     49_mesa_IndexPointer(GLenum type, GLsizei stride, const GLvoid *ptr);
    5250
    5351
    54 extern void gl_TexCoordPointer( GLcontext *ctx,
    55                                 GLint size, GLenum type, GLsizei stride,
    56                                 const GLvoid *ptr );
     52extern void
     53_mesa_TexCoordPointer(GLint size, GLenum type, GLsizei stride,
     54                      const GLvoid *ptr);
    5755
    5856
    59 extern void gl_EdgeFlagPointer( GLcontext *ctx,
    60                                 GLsizei stride, const GLboolean *ptr );
     57extern void
     58_mesa_EdgeFlagPointer(GLsizei stride, const GLvoid *ptr);
    6159
    6260
    63 extern void gl_GetPointerv( GLcontext *ctx, GLenum pname, GLvoid **params );
     61extern void
     62_mesa_ArrayElement( GLint );
    6463
    6564
    66 
    67 extern void gl_DrawArrays( GLcontext *ctx,
    68                            GLenum mode, GLint first, GLsizei count );
    69 
    70 extern void gl_save_DrawArrays( GLcontext *ctx,
    71                                 GLenum mode, GLint first, GLsizei count );
     65extern void
     66_mesa_DrawArrays(GLenum mode, GLint first, GLsizei count);
    7267
    7368
    74 extern void gl_DrawElements( GLcontext *ctx,
    75                              GLenum mode, GLsizei count,
    76                              GLenum type, const GLvoid *indices );
    77 
    78 extern void gl_save_DrawElements( GLcontext *ctx,
    79                                   GLenum mode, GLsizei count,
    80                                   GLenum type, const GLvoid *indices );
     69extern void
     70_mesa_save_DrawArrays(GLenum mode, GLint first, GLsizei count);
    8171
    8272
    83 extern void gl_InterleavedArrays( GLcontext *ctx,
    84                                   GLenum format, GLsizei stride,
    85                                   const GLvoid *pointer );
    86 
    87 extern void gl_save_InterleavedArrays( GLcontext *ctx,
    88                                        GLenum format, GLsizei stride,
    89                                        const GLvoid *pointer );
     73extern void
     74_mesa_DrawElements(GLenum mode, GLsizei count, GLenum type,
     75                   const GLvoid *indices);
    9076
    9177
    92 extern void gl_DrawRangeElements( GLcontext *ctx, GLenum mode, GLuint start,
    93                                   GLuint end, GLsizei count, GLenum type,
    94                                   const GLvoid *indices );
     78extern void
     79_mesa_save_DrawElements(GLenum mode, GLsizei count,
     80                        GLenum type, const GLvoid *indices);
    9581
    96 extern void gl_save_DrawRangeElements( GLcontext *ctx, GLenum mode,
    97                                        GLuint start, GLuint end, GLsizei count,
    98                                        GLenum type, const GLvoid *indices );
     82
     83extern void
     84_mesa_InterleavedArrays(GLenum format, GLsizei stride, const GLvoid *pointer);
     85
     86extern void
     87_mesa_save_InterleavedArrays(GLenum format, GLsizei stride,
     88                             const GLvoid *pointer);
     89
     90
     91extern void
     92_mesa_DrawRangeElements(GLenum mode, GLuint start,
     93                        GLuint end, GLsizei count, GLenum type,
     94                        const GLvoid *indices);
     95
     96extern void
     97_mesa_save_DrawRangeElements(GLenum mode,
     98                             GLuint start, GLuint end, GLsizei count,
     99                             GLenum type, const GLvoid *indices );
    99100
    100101
    101102extern void gl_exec_array_elements( GLcontext *ctx,
    102                                     struct immediate *IM,
    103                                     GLuint start,
    104                                     GLuint end );
     103                                    struct immediate *IM,
     104                                    GLuint start,
     105                                    GLuint end );
    105106
    106107extern void gl_update_client_state( GLcontext *ctx );
  • trunk/src/opengl/mesa/vb.h

    r2938 r3597  
    1 /* $Id: vb.h,v 1.1 2000-02-29 00:48:42 sandervl Exp $ */
     1/* $Id: vb.h,v 1.2 2000-05-23 20:34:59 jeroen Exp $ */
    22
    33/*
    44 * Mesa 3-D graphics library
    5  * Version:  3.1
     5 * Version:  3.3
    66 *
    77 * Copyright (C) 1999  Brian Paul   All Rights Reserved.
     
    5454#endif
    5555
    56 #include "gl.h"
    5756#include "vector.h"
    5857#include "matrix.h"
     
    114113   GLfloat Emission[4];
    115114   GLfloat Shininess;
    116    GLfloat AmbientIndex;        /* for color index lighting */
    117    GLfloat DiffuseIndex;        /* for color index lighting */
    118    GLfloat SpecularIndex;       /* for color index lighting */
     115   GLfloat AmbientIndex;        /* for color index lighting */
     116   GLfloat DiffuseIndex;        /* for color index lighting */
     117   GLfloat SpecularIndex;       /* for color index lighting */
    119118};
    120119
     
    131130struct immediate
    132131{
    133    struct immediate *next;      /* for cache of free IM's */
     132   struct immediate *next;      /* for cache of free IM's */
    134133   GLuint id, ref_count;
    135134
     
    137136    */
    138137   GLuint Start, Count;
    139    GLuint LastData;             /* count or count+1 */
     138   GLuint LastData;             /* count or count+1 */
    140139   GLuint AndFlag, OrFlag, BeginState;
    141    GLuint LastPrimitive;       
    142 
    143    GLuint ArrayAndFlags;        /* precalc'ed for glArrayElt */
     140   GLuint LastPrimitive;
     141
     142   GLuint ArrayAndFlags;        /* precalc'ed for glArrayElt */
    144143   GLuint ArrayIncr;
    145144   GLuint ArrayEltFlush;
    146145   GLuint FlushElt;
    147146
    148    GLuint TF1[2];               /* precalc'ed for glTexCoord */
     147   GLuint TF1[2];               /* precalc'ed for glTexCoord */
    149148   GLuint TF2[2];
    150149   GLuint TF3[2];
    151150   GLuint TF4[2];
    152151
    153    GLuint  Primitive[VB_SIZE];  /* GLubyte would do... */
     152   GLuint  Primitive[VB_SIZE];  /* GLubyte would do... */
    154153   GLuint  NextPrimitive[VB_SIZE];
    155154
     
    163162   struct vertex_arrays v;
    164163
    165    struct gl_context *backref;         
     164   struct gl_context *backref;
    166165   void (*maybe_transform_vb)( struct immediate * );
    167166
     
    206205    * case the values will be scribbled during transform_vb.
    207206    */
    208    struct immediate *IM;       
    209    struct vertex_array_pointers store; 
     207   struct immediate *IM;
     208   struct vertex_array_pointers store;
    210209
    211210   /* Where to find outstanding untransformed vertices.
     
    220219   GLuint     Parity, Ovf;
    221220   GLuint     PurgeFlags;
    222    GLuint     IndirectCount;    /* defaults to count */
     221   GLuint     IndirectCount;    /* defaults to count */
    223222   GLuint     OrFlag, SavedOrFlag;
    224223   GLuint     EarlyCull;
     
    242241   GLuint      LastPrimitive;
    243242
    244    GLfloat (*BoundsPtr)[3];     /* Bounds for cull check */
    245    GLfloat  *NormalLengthPtr;   /* Array of precomputed inv. normal lengths */
     243   GLfloat (*BoundsPtr)[3];     /* Bounds for cull check */
     244   GLfloat  *NormalLengthPtr;   /* Array of precomputed inv. normal lengths */
    246245
    247246
     
    252251   GLvector4f Clip;
    253252   GLvector4f Win;
    254    GLvector4ub BColor;          /* not used in cva */
    255    GLvector1ui BIndex;          /* not used in cva */
     253   GLvector4ub BColor;          /* not used in cva */
     254   GLvector1ui BIndex;          /* not used in cva */
    256255   GLubyte (*Specular)[4];
    257256   GLubyte (*Spec[2])[4];
     
    301300    */
    302301   GLubyte *NormCullStart;
    303    GLubyte *CullMask;           /* Results of vertex culling */
     302   GLubyte *CullMask;           /* Results of vertex culling */
    304303   GLubyte *NormCullMask;       /* Compressed onto shared normals */
    305304
    306305
    307    GLubyte ClipOrMask;          /* bitwise-OR of all ClipMask[] values */
    308    GLubyte ClipAndMask;         /* bitwise-AND of all ClipMask[] values */
     306   GLubyte ClipOrMask;          /* bitwise-OR of all ClipMask[] values */
     307   GLubyte ClipAndMask;         /* bitwise-AND of all ClipMask[] values */
    309308   GLubyte CullFlag[2];
    310    GLubyte CullMode;            /* see flags below */
    311 
    312    GLuint CopyCount;            /* max 3 vertices to copy after transform */
     309   GLubyte CullMode;            /* see flags below */
     310
     311   GLuint CopyCount;            /* max 3 vertices to copy after transform */
    313312   GLuint Copy[3];
    314    GLfloat CopyProj[3][4];      /* temporary store for projected clip coords */
     313   GLfloat CopyProj[3][4];      /* temporary store for projected clip coords */
    315314};
    316315
     
    322321extern struct vertex_buffer *gl_vb_create_for_immediate( GLcontext *ctx );
    323322extern struct vertex_buffer *gl_vb_create_for_cva( GLcontext *ctx,
    324                                                    GLuint size );
     323                                                   GLuint size );
    325324extern void gl_vb_free( struct vertex_buffer * );
    326325extern struct immediate *gl_immediate_alloc( GLcontext *ctx );
  • trunk/src/opengl/mesa/vbfill.h

    r2938 r3597  
    1 /* $Id: vbfill.h,v 1.1 2000-02-29 00:48:42 sandervl Exp $ */
     1/* $Id: vbfill.h,v 1.2 2000-05-23 20:34:59 jeroen Exp $ */
    22
    33/*
    44 * Mesa 3-D graphics library
    5  * Version:  3.1
     5 * Version:  3.3
    66 *
    77 * Copyright (C) 1999  Brian Paul   All Rights Reserved.
     
    3636
    3737
    38 /* Small number of API equivalent functions provided for internal
    39  * use:
    40  */
    4138extern void gl_Begin( GLcontext *ctx, GLenum p );
    42 extern void gl_Vertex2f( GLcontext *ctx, GLfloat, GLfloat );
    43 extern void gl_ArrayElement( GLcontext *ctx, GLint );
    44 extern void gl_EvalCoord1f( GLcontext *ctx, GLfloat );
    45 extern void gl_EvalCoord2f( GLcontext *ctx, GLfloat, GLfloat );
    4639extern void gl_End( GLcontext *ctx );
     40extern void gl_Vertex2f( GLcontext *ctx, GLfloat x, GLfloat y);
     41
     42
     43extern void
     44_mesa_Begin( GLenum p );
     45
     46extern void
     47_mesa_End( void );
     48
     49
     50
     51extern void _mesa_Color3b(GLbyte red, GLbyte green, GLbyte blue);
     52
     53extern void _mesa_Color3d(GLdouble red, GLdouble green, GLdouble blue);
     54
     55extern void _mesa_Color3f(GLfloat red, GLfloat green, GLfloat blue);
     56
     57extern void _mesa_Color3i(GLint red, GLint green, GLint blue);
     58
     59extern void _mesa_Color3s(GLshort red, GLshort green, GLshort blue);
     60
     61extern void _mesa_Color3ub(GLubyte red, GLubyte green, GLubyte blue);
     62
     63extern void _mesa_Color3ui(GLuint red, GLuint green, GLuint blue);
     64
     65extern void _mesa_Color3us(GLushort red, GLushort green, GLushort blue);
     66
     67extern void _mesa_Color4b(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha);
     68
     69extern void _mesa_Color4d(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha);
     70
     71extern void _mesa_Color4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
     72
     73extern void _mesa_Color4i(GLint red, GLint green, GLint blue, GLint alpha);
     74
     75extern void _mesa_Color4s(GLshort red, GLshort green, GLshort blue, GLshort alpha);
     76
     77extern void _mesa_Color4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha);
     78
     79extern void _mesa_Color4ui(GLuint red, GLuint green, GLuint blue, GLuint alpha);
     80
     81extern void _mesa_Color4us(GLushort red, GLushort green, GLushort blue, GLushort alpha);
     82
     83extern void _mesa_Color3bv(const GLbyte *v);
     84
     85extern void _mesa_Color3dv(const GLdouble *v);
     86
     87extern void _mesa_Color3fv(const GLfloat *v);
     88
     89extern void _mesa_Color3iv(const GLint *v);
     90
     91extern void _mesa_Color3sv(const GLshort *v);
     92
     93extern void _mesa_Color3ubv(const GLubyte *v);
     94
     95extern void _mesa_Color3uiv(const GLuint *v);
     96
     97extern void _mesa_Color3usv(const GLushort *v);
     98
     99extern void _mesa_Color4bv(const GLbyte *v);
     100
     101extern void _mesa_Color4dv(const GLdouble *v);
     102
     103extern void _mesa_Color4fv(const GLfloat *v);
     104
     105extern void _mesa_Color4iv(const GLint *v);
     106
     107extern void _mesa_Color4sv(const GLshort *v);
     108
     109extern void _mesa_Color4ubv(const GLubyte *v);
     110
     111extern void _mesa_Color4uiv(const GLuint *v);
     112
     113extern void _mesa_Color4usv(const GLushort *v);
     114
     115
     116
     117extern void _mesa_EdgeFlag( GLboolean flag );
     118
     119extern void _mesa_EdgeFlagv( const GLboolean *flag );
     120
     121
     122
     123extern void _mesa_Indexd(GLdouble c);
     124
     125extern void _mesa_Indexdv(const GLdouble *c);
     126
     127extern void _mesa_Indexf(GLfloat c);
     128
     129extern void _mesa_Indexfv(const GLfloat *c);
     130
     131extern void _mesa_Indexi(GLint c);
     132
     133extern void _mesa_Indexiv(const GLint *c);
     134
     135extern void _mesa_Indexs(GLshort c);
     136
     137extern void _mesa_Indexsv(const GLshort *c);
     138
     139extern void _mesa_Indexub(GLubyte b);
     140
     141extern void _mesa_Indexubv(const GLubyte *b);
     142
     143
     144
     145extern void _mesa_Normal3b(GLbyte nx, GLbyte ny, GLbyte nz);
     146
     147extern void _mesa_Normal3bv(const GLbyte *v);
     148
     149extern void _mesa_Normal3d(GLdouble nx, GLdouble ny, GLdouble nz);
     150
     151extern void _mesa_Normal3dv(const GLdouble *v);
     152
     153extern void _mesa_Normal3f(GLfloat nx, GLfloat ny, GLfloat nz);
     154
     155extern void _mesa_Normal3fv(const GLfloat *v);
     156
     157extern void _mesa_Normal3i(GLint nx, GLint ny, GLint nz);
     158
     159extern void _mesa_Normal3iv(const GLint *v);
     160
     161extern void _mesa_Normal3s(GLshort nx, GLshort ny, GLshort nz);
     162
     163extern void _mesa_Normal3sv(const GLshort *v);
     164
     165
     166
     167extern void _mesa_TexCoord1d(GLdouble s);
     168
     169extern void _mesa_TexCoord1dv(const GLdouble *v);
     170
     171extern void _mesa_TexCoord1f(GLfloat s);
     172
     173extern void _mesa_TexCoord1fv(const GLfloat *v);
     174
     175extern void _mesa_TexCoord1i(GLint s);
     176
     177extern void _mesa_TexCoord1iv(const GLint *v);
     178
     179extern void _mesa_TexCoord1s(GLshort s);
     180
     181extern void _mesa_TexCoord1sv(const GLshort *v);
     182
     183extern void _mesa_TexCoord2d(GLdouble s, GLdouble t);
     184
     185extern void _mesa_TexCoord2dv(const GLdouble *v);
     186
     187extern void _mesa_TexCoord2f(GLfloat s, GLfloat t);
     188
     189extern void _mesa_TexCoord2fv(const GLfloat *v);
     190
     191extern void _mesa_TexCoord2s(GLshort s, GLshort t);
     192
     193extern void _mesa_TexCoord2sv(const GLshort *v);
     194
     195extern void _mesa_TexCoord2i(GLint s, GLint t);
     196
     197extern void _mesa_TexCoord2iv(const GLint *v);
     198
     199extern void _mesa_TexCoord3d(GLdouble s, GLdouble t, GLdouble r);
     200
     201extern void _mesa_TexCoord3dv(const GLdouble *v);
     202
     203extern void _mesa_TexCoord3f(GLfloat s, GLfloat t, GLfloat r);
     204
     205extern void _mesa_TexCoord3fv(const GLfloat *v);
     206
     207extern void _mesa_TexCoord3i(GLint s, GLint t, GLint r);
     208
     209extern void _mesa_TexCoord3iv(const GLint *v);
     210
     211extern void _mesa_TexCoord3s(GLshort s, GLshort t, GLshort r);
     212
     213extern void _mesa_TexCoord3sv(const GLshort *v);
     214
     215extern void _mesa_TexCoord4d(GLdouble s, GLdouble t, GLdouble r, GLdouble q);
     216
     217extern void _mesa_TexCoord4dv(const GLdouble *v);
     218
     219extern void _mesa_TexCoord4f(GLfloat s, GLfloat t, GLfloat r, GLfloat q);
     220
     221extern void _mesa_TexCoord4fv(const GLfloat *v);
     222
     223extern void _mesa_TexCoord4i(GLint s, GLint t, GLint r, GLint q);
     224
     225extern void _mesa_TexCoord4iv(const GLint *v);
     226
     227extern void _mesa_TexCoord4s(GLshort s, GLshort t, GLshort r, GLshort q);
     228
     229extern void _mesa_TexCoord4sv(const GLshort *v);
     230
     231
     232
     233extern void _mesa_Vertex2d(GLdouble x, GLdouble y);
     234
     235extern void _mesa_Vertex2dv(const GLdouble *v);
     236
     237extern void _mesa_Vertex2f(GLfloat x, GLfloat y);
     238
     239extern void _mesa_Vertex2fv(const GLfloat *v);
     240
     241extern void _mesa_Vertex2i(GLint x, GLint y);
     242
     243extern void _mesa_Vertex2iv(const GLint *v);
     244
     245extern void _mesa_Vertex2s(GLshort x, GLshort y);
     246
     247extern void _mesa_Vertex2sv(const GLshort *v);
     248
     249extern void _mesa_Vertex3d(GLdouble x, GLdouble y, GLdouble z);
     250
     251extern void _mesa_Vertex3dv(const GLdouble *v);
     252
     253extern void _mesa_Vertex3f(GLfloat x, GLfloat y, GLfloat z);
     254
     255extern void _mesa_Vertex3fv(const GLfloat *v);
     256
     257extern void _mesa_Vertex3i(GLint x, GLint y, GLint z);
     258
     259extern void _mesa_Vertex3iv(const GLint *v);
     260
     261extern void _mesa_Vertex3s(GLshort x, GLshort y, GLshort z);
     262
     263extern void _mesa_Vertex3sv(const GLshort *v);
     264
     265extern void _mesa_Vertex4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w);
     266
     267extern void _mesa_Vertex4dv(const GLdouble *v);
     268
     269extern void _mesa_Vertex4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w);
     270
     271extern void _mesa_Vertex4fv(const GLfloat *v);
     272
     273extern void _mesa_Vertex4i(GLint x, GLint y, GLint z, GLint w);
     274
     275extern void _mesa_Vertex4iv(const GLint *v);
     276
     277extern void _mesa_Vertex4s(GLshort x, GLshort y, GLshort z, GLshort w);
     278
     279extern void _mesa_Vertex4sv(const GLshort *v);
     280
     281
     282
     283extern void _mesa_MultiTexCoord1dARB(GLenum target, GLdouble s);
     284
     285extern void _mesa_MultiTexCoord1dvARB(GLenum target, const GLdouble *v);
     286
     287extern void _mesa_MultiTexCoord1fARB(GLenum target, GLfloat s);
     288
     289extern void _mesa_MultiTexCoord1fvARB(GLenum target, const GLfloat *v);
     290
     291extern void _mesa_MultiTexCoord1iARB(GLenum target, GLint s);
     292
     293extern void _mesa_MultiTexCoord1ivARB(GLenum target, const GLint *v);
     294
     295extern void _mesa_MultiTexCoord1sARB(GLenum target, GLshort s);
     296
     297extern void _mesa_MultiTexCoord1svARB(GLenum target, const GLshort *v);
     298
     299extern void _mesa_MultiTexCoord2dARB(GLenum target, GLdouble s, GLdouble t);
     300
     301extern void _mesa_MultiTexCoord2dvARB(GLenum target, const GLdouble *v);
     302
     303extern void _mesa_MultiTexCoord2fARB(GLenum target, GLfloat s, GLfloat t);
     304
     305extern void _mesa_MultiTexCoord2fvARB(GLenum target, const GLfloat *v);
     306
     307extern void _mesa_MultiTexCoord2iARB(GLenum target, GLint s, GLint t);
     308
     309extern void _mesa_MultiTexCoord2ivARB(GLenum target, const GLint *v);
     310
     311extern void _mesa_MultiTexCoord2sARB(GLenum target, GLshort s, GLshort t);
     312
     313extern void _mesa_MultiTexCoord2svARB(GLenum target, const GLshort *v);
     314
     315extern void _mesa_MultiTexCoord3dARB(GLenum target, GLdouble s, GLdouble t, GLdouble r);
     316
     317extern void _mesa_MultiTexCoord3dvARB(GLenum target, const GLdouble *v);
     318
     319extern void _mesa_MultiTexCoord3fARB(GLenum target, GLfloat s, GLfloat t, GLfloat r);
     320
     321extern void _mesa_MultiTexCoord3fvARB(GLenum target, const GLfloat *v);
     322
     323extern void _mesa_MultiTexCoord3iARB(GLenum target, GLint s, GLint t, GLint r);
     324
     325extern void _mesa_MultiTexCoord3ivARB(GLenum target, const GLint *v);
     326
     327extern void _mesa_MultiTexCoord3sARB(GLenum target, GLshort s, GLshort t, GLshort r);
     328
     329extern void _mesa_MultiTexCoord3svARB(GLenum target, const GLshort *v);
     330
     331extern void _mesa_MultiTexCoord4dARB(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q);
     332
     333extern void _mesa_MultiTexCoord4dvARB(GLenum target, const GLdouble *v);
     334
     335extern void _mesa_MultiTexCoord4fARB(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q);
     336
     337extern void _mesa_MultiTexCoord4fvARB(GLenum target, const GLfloat *v);
     338
     339extern void _mesa_MultiTexCoord4iARB(GLenum target, GLint s, GLint t, GLint r, GLint q);
     340
     341extern void _mesa_MultiTexCoord4ivARB(GLenum target, const GLint *v);
     342
     343extern void _mesa_MultiTexCoord4sARB(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q);
     344
     345extern void _mesa_MultiTexCoord4svARB(GLenum target, const GLshort *v);
     346
    47347
    48348
  • trunk/src/opengl/mesa/vector.h

    r2938 r3597  
    1 /* $Id: vector.h,v 1.1 2000-02-29 00:48:43 sandervl Exp $ */
     1/* $Id: vector.h,v 1.2 2000-05-23 20:35:00 jeroen Exp $ */
    22
    33/*
    44 * Mesa 3-D graphics library
    5  * Version:  3.1
     5 * Version:  3.3
    66 *
    77 * Copyright (C) 1999  Brian Paul   All Rights Reserved.
     
    3333#define _VECTOR_H_
    3434
    35 #include "gl.h"
    36 
    3735/* Wrap all the information about vertices up in a struct.  Has
    3836 * additional fields compared to the other vectors to help us track of
     
    4846   GLfloat *start;
    4947   GLuint count;
    50    GLuint stride;                /* start to start */
    51    GLuint size;                  /* 2-4 for vertices and 1-4 for texcoords */
    52    GLuint flags;                /* which columns are dirty */
     48   GLuint stride;                /* start to start */
     49   GLuint size;                  /* 2-4 for vertices and 1-4 for texcoords */
     50   GLuint flags;                /* which columns are dirty */
    5351   void *storage;
    5452} GLvector4f;
     
    5755extern void gl_vector4f_print( GLvector4f *v, GLubyte *, GLboolean );
    5856extern void gl_vector4f_init( GLvector4f *v, GLuint flags,
    59                               GLfloat (*storage)[4] );
     57                              GLfloat (*storage)[4] );
    6058extern void gl_vector4f_alloc( GLvector4f *v, GLuint sz, GLuint flags,
    61                                GLuint count, GLuint alignment );
     59                               GLuint count, GLuint alignment );
    6260extern void gl_vector4f_free( GLvector4f *v );
    6361extern void gl_vector4f_clean_elem( GLvector4f *vec, GLuint nr, GLuint elt );
    6462
    6563
    66 #define VEC_DIRTY_0        0x1  /* dirty flags not really used any more */
     64#define VEC_DIRTY_0        0x1  /* dirty flags not really used any more */
    6765#define VEC_DIRTY_1        0x2
    6866#define VEC_DIRTY_2        0x4
    6967#define VEC_DIRTY_3        0x8
    7068#define VEC_MALLOC         0x10
    71 #define VEC_WRITABLE       0x20 /* keep both + and - bits for easy testing */
     69#define VEC_WRITABLE       0x20 /* keep both + and - bits for easy testing */
    7270#define VEC_NOT_WRITABLE   0x40
    73 #define VEC_GOOD_STRIDE    0x80 
     71#define VEC_GOOD_STRIDE    0x80
    7472#define VEC_BAD_STRIDE     0x100
    7573
     
    10098extern void gl_vector3f_init( GLvector3f *v, GLuint flags, GLfloat (*)[3] );
    10199extern void gl_vector3f_alloc( GLvector3f *v, GLuint flags, GLuint count,
    102                                GLuint alignment );
     100                               GLuint alignment );
    103101
    104102
     
    109107   GLubyte *start;
    110108   GLuint count;
    111    GLuint stride;               
     109   GLuint stride;
    112110   GLuint flags;
    113111   void *storage;
     
    115113
    116114extern void gl_vector4ub_init( GLvector4ub *v, GLuint flags,
    117                                GLubyte (*storage)[4] );
     115                               GLubyte (*storage)[4] );
    118116extern void gl_vector4ub_free( GLvector4ub * );
    119117extern void gl_vector4ub_alloc( GLvector4ub *v, GLuint flags, GLuint count,
    120                                 GLuint alignment );
     118                                GLuint alignment );
    121119
    122120
     
    129127   GLubyte *start;
    130128   GLuint count;
    131    GLuint stride;               
     129   GLuint stride;
    132130   GLuint flags;
    133131   void *storage;
     
    137135extern void gl_vector1ub_free( GLvector1ub * );
    138136extern void gl_vector1ub_alloc( GLvector1ub *v, GLuint flags, GLuint count,
    139                                 GLuint alignment );
     137                                GLuint alignment );
    140138
    141139
     
    156154extern void gl_vector1ui_free( GLvector1ui * );
    157155extern void gl_vector1ui_alloc( GLvector1ui *v, GLuint flags, GLuint count,
    158                                 GLuint alignment );
     156                                GLuint alignment );
    159157
    160158
  • trunk/src/opengl/mesa/vertices.h

    r2962 r3597  
    1 /* $Id: vertices.h,v 1.2 2000-03-01 18:49:39 jeroen Exp $ */
     1/* $Id: vertices.h,v 1.3 2000-05-23 20:35:00 jeroen Exp $ */
    22
    33/*
    44 * Mesa 3-D graphics library
    5  * Version:  3.1
     5 * Version:  3.3
    66 *
    77 * Copyright (C) 1999  Brian Paul   All Rights Reserved.
     
    2929#define VERTICES_H_
    3030
     31#ifdef USE_X86_ASM
     32#define _PROJAPI _ASMAPI
     33#define _PROJAPIP _ASMAPIP
     34#else
     35#define _PROJAPI
     36#define _PROJAPIP *
     37#endif
    3138
    32 typedef void (* __cdecl gl_transform_func)( GLfloat *first_vert,
     39typedef void (_PROJAPIP gl_transform_func)( GLfloat *first_vert,
    3340                                   const GLfloat *m,
    3441                                   const GLfloat *src,
     
    3643                                   GLuint count );
    3744
    38 typedef void (* __cdecl gl_cliptest_func)( GLfloat *first_vert,
    39                                   GLfloat *last_vert, /* use count instead? */
     45typedef void (_PROJAPIP gl_cliptest_func)( GLfloat *first_vert,
     46                                  GLfloat *last_vert, /* use count instead?*/
    4047                                  GLubyte *or_mask,
    4148                                  GLubyte *and_mask,
    4249                                  GLubyte *clip_mask );
    4350
    44 typedef void (*gl_project_clipped_func)( GLfloat *first,
    45                                         GLfloat *last,
    46                                         const GLfloat *m,
    47                                         GLuint stride,
    48                                         const GLubyte *clipmask );
     51typedef void (_PROJAPIP gl_project_clipped_func)( GLfloat *first,
     52                                        GLfloat *last,
     53                                        const GLfloat *m,
     54                                        GLuint stride,
     55                                        const GLubyte *clipmask );
    4956
    50 typedef void (*gl_project_func)( GLfloat *first,
    51                                 GLfloat *last,
    52                                 const GLfloat *m,
    53                                 GLuint stride );
     57typedef void (_PROJAPIP gl_project_func)( GLfloat *first,
     58                                GLfloat *last,
     59                                const GLfloat *m,
     60                                GLuint stride );
    5461
    5562
     
    5764 */
    5865extern gl_transform_func       gl_xform_points3_v16_general;
    59 extern gl_cliptest_func        gl_cliptest_points4_v16;                 
    60 extern gl_project_clipped_func gl_project_clipped_v16;                 
    61 extern gl_project_func         gl_project_v16;                 
     66extern gl_cliptest_func        gl_cliptest_points4_v16;
     67extern gl_project_clipped_func gl_project_clipped_v16;
     68extern gl_project_func         gl_project_v16;
    6269
    6370
     
    6774
    6875typedef void (*gl_vertex_interp_func)( GLfloat t,
    69                                        GLfloat *result,
    70                                        const GLfloat *in,
    71                                        const GLfloat *out );
    72                                
     76                                       GLfloat *result,
     77                                       const GLfloat *in,
     78                                       const GLfloat *out );
     79
    7380
    7481#endif
  • trunk/src/opengl/mesa/winpos.h

    r2938 r3597  
    1 /* $Id: winpos.h,v 1.1 2000-02-29 00:48:44 sandervl Exp $ */
     1/* $Id: winpos.h,v 1.2 2000-05-23 20:35:00 jeroen Exp $ */
    22
    33/*
    44 * Mesa 3-D graphics library
    5  * Version:  3.1
     5 * Version:  3.3
    66 *
    77 * Copyright (C) 1999  Brian Paul   All Rights Reserved.
     
    3737
    3838
    39 #ifndef GL_MESA_window_pos
     39extern void
     40_mesa_WindowPos2dMESA(GLdouble x, GLdouble y);
    4041
    41 extern void glWindowPos2iMESA( GLint x, GLint y );
    42 extern void glWindowPos2fMESA( GLfloat x, GLfloat y );
    43 extern void glWindowPos2dMESA( GLdouble x, GLdouble y );
     42extern void
     43_mesa_WindowPos2fMESA(GLfloat x, GLfloat y);
    4444
    45 extern void glWindowPos2ivMESA( const GLint *p );
    46 extern void glWindowPos2fvMESA( const GLfloat *p );
    47 extern void glWindowPos2dvMESA( const GLdouble *p );
     45extern void
     46_mesa_WindowPos2iMESA(GLint x, GLint y);
    4847
    49 extern void glWindowPos3iMESA( GLint x, GLint y, GLint z );
    50 extern void glWindowPos3fMESA( GLfloat x, GLfloat y, GLfloat z );
    51 extern void glWindowPos3dMESA( GLdouble x, GLdouble y, GLdouble z );
     48extern void
     49_mesa_WindowPos2sMESA(GLshort x, GLshort y);
    5250
    53 extern void glWindowPos3ivMESA( const GLint *p );
    54 extern void glWindowPos3fvMESA( const GLfloat *p );
    55 extern void glWindowPos3dvMESA( const GLdouble *p );
     51extern void
     52_mesa_WindowPos3dMESA(GLdouble x, GLdouble y, GLdouble z);
    5653
    57 extern void glWindowPos4iMESA( GLint x, GLint y, GLint z, GLint w );
    58 extern void glWindowPos4fMESA( GLfloat x, GLfloat y, GLfloat z, GLfloat w );
    59 extern void glWindowPos4dMESA( GLdouble x, GLdouble y, GLdouble z, GLdouble w);
     54extern void
     55_mesa_WindowPos3fMESA(GLfloat x, GLfloat y, GLfloat z);
    6056
    61 extern void glWindowPos4ivMESA( const GLint *p );
    62 extern void glWindowPos4fvMESA( const GLfloat *p );
    63 extern void glWindowPos4dvMESA( const GLdouble *p );
     57extern void
     58_mesa_WindowPos3iMESA(GLint x, GLint y, GLint z);
     59
     60extern void
     61_mesa_WindowPos3sMESA(GLshort x, GLshort y, GLshort z);
     62
     63extern void
     64_mesa_WindowPos4dMESA(GLdouble x, GLdouble y, GLdouble z, GLdouble w);
     65
     66extern void
     67_mesa_WindowPos4fMESA(GLfloat x, GLfloat y, GLfloat z, GLfloat w);
     68
     69extern void
     70_mesa_WindowPos4iMESA(GLint x, GLint y, GLint z, GLint w);
     71
     72extern void
     73_mesa_WindowPos4sMESA(GLshort x, GLshort y, GLshort z, GLshort w);
     74
     75extern void
     76_mesa_WindowPos2dvMESA(const GLdouble *v);
     77
     78extern void
     79_mesa_WindowPos2fvMESA(const GLfloat *v);
     80
     81extern void
     82_mesa_WindowPos2ivMESA(const GLint *v);
     83
     84extern void
     85_mesa_WindowPos2svMESA(const GLshort *v);
     86
     87extern void
     88_mesa_WindowPos3dvMESA(const GLdouble *v);
     89
     90extern void
     91_mesa_WindowPos3fvMESA(const GLfloat *v);
     92
     93extern void
     94_mesa_WindowPos3ivMESA(const GLint *v);
     95
     96extern void
     97_mesa_WindowPos3svMESA(const GLshort *v);
     98
     99extern void
     100_mesa_WindowPos4dvMESA(const GLdouble *v);
     101
     102extern void
     103_mesa_WindowPos4fvMESA(const GLfloat *v);
     104
     105extern void
     106_mesa_WindowPos4ivMESA(const GLint *v);
     107
     108extern void
     109_mesa_WindowPos4svMESA(const GLshort *v);
     110
    64111
    65112#endif
    66 
    67 
    68 extern void gl_WindowPos4fMESA( GLcontext *ctx,
    69                                 GLfloat x, GLfloat y, GLfloat z, GLfloat w );
    70 
    71 #endif
  • trunk/src/opengl/mesa/wmesadef.h

    r2962 r3597  
    1 /* $Id: wmesadef.h,v 1.2 2000-03-01 18:49:40 jeroen Exp $ */
     1/* $Id: wmesadef.h,v 1.3 2000-05-23 20:35:00 jeroen Exp $ */
    22/*      File name       :       wmesadef.h
    33 *  Version             :       2.3
     
    2020/*
    2121 * $Log: wmesadef.h,v $
    22  * Revision 1.2  2000-03-01 18:49:40  jeroen
     22 * Revision 1.3  2000-05-23 20:35:00  jeroen
     23 * *** empty log message ***
     24 *
     25 * Revision 1.2  2000/03/01 18:49:40  jeroen
    2326 * *** empty log message ***
    2427 *
     
    3740/*
    3841 * $Log: wmesadef.h,v $
    39  * Revision 1.2  2000-03-01 18:49:40  jeroen
     42 * Revision 1.3  2000-05-23 20:35:00  jeroen
     43 * *** empty log message ***
     44 *
     45 * Revision 1.2  2000/03/01 18:49:40  jeroen
    4046 * *** empty log message ***
    4147 *
     
    5662/*
    5763 * $Log: wmesadef.h,v $
    58  * Revision 1.2  2000-03-01 18:49:40  jeroen
     64 * Revision 1.3  2000-05-23 20:35:00  jeroen
     65 * *** empty log message ***
     66 *
     67 * Revision 1.2  2000/03/01 18:49:40  jeroen
    5968 * *** empty log message ***
    6069 *
     
    7786#define DDMESADEF_H
    7887
    79 #ifdef __WIN32OS2__/* Nope, we use this hdr in DIVE code, so instead include*/
    80                    /* os2win.h in the source if it is needed! */
    81 //#include <os2win.h>
    82 #else
    83 #include <windows.h>
    84 #endif
    85 
    8688#if defined(DDRAW)
    87 #include <ddraw.h>
    88 #endif
    89 
    90 //#include "gl.h"
    91 //#include "context.h"
    92 //#include "profile.h"
     89#ifdef __WIN32OS2__
     90#define __WINE_DD_OBJ_BASE_H/* Don't include dd_obj_base.h, or the file won't*/
     91#endif                                 /* compile due to redefined symbols.*/
     92#include <ddraw.h>          /* Is this a bug in the Odin DDRAW implementation??*/
     93#endif
    9394
    9495#define REDBITS         0x03
     
    99100#define BLUESHIFT       0x06
    100101
     102typedef HANDLE ULONG;
     103
    101104typedef struct _dibSection{
    102         HDC             hDC;
     105        HDC     hDC;
    103106        HANDLE  hFileMap;
    104107        BOOL    fFlushed;
     
    120123    ULONG               hDiveInstance; /* This actually is a DIVE Handle   */
    121124    ULONG               BackBufferNumber;
    122     PVOID               ppFrameBuffer;
     125    PVOID               ppFrameBuffer; /* FrameBuffer address - used for DIRECT access to screen only */
    123126    ULONG               ScanLineBytes,ScanLines;
    124127    POINT               WinPos;
     
    130133    HDC                 hps;
    131134    BOOL                BackBufferOwnAllocation;
    132     GLint               awidth,aheight; /* Allocated w/h for ImageBuffer */
     135    GLint               awidth,aheight;/* Allocated w/h for ImageBuffer    */
    133136#endif
    134137    PBYTE               pbPixels;
     
    149152    GLvisual           *gl_visual;                 /* Describes the buffers*/
    150153    GLframebuffer      *gl_buffer;    /* Depth, stencil, accum, etc buffers*/
     154
     155    /* 3D projection stuff */
    151156    RECT                drawRect;
    152157    UINT                uiDIBoffset;
    153     PBYTE               ScreenMem;     /* WinG memory                      */
    154     HPALETTE            hPal;          /* Current Palette                  */
    155     HPALETTE            hPalHalfTone;
     158                                       /* OpenGL stuff                     */
    156159    HPALETTE            hGLPalette;
    157     WMDIBSECTION        dib;
    158     BITMAPINFO         *IndexFormat;
     160    PBYTE                           ScreenMem; /* WinG memory              */
     161    BITMAPINFO                      *IndexFormat;
     162    HPALETTE                        hPal;      /* Current Palette          */
     163    HPALETTE                        hPalHalfTone;
     164
     165
     166    WMDIBSECTION            dib;
    159167    BITMAPINFO          bmi;
    160168    HBITMAP             hbmDIB;
    161169    HBITMAP             hOldBitmap;
    162     HBITMAP             Old_Compat_BM;
    163     HBITMAP             Compat_BM;     /* Bitmap for double buffering      */
     170    HBITMAP                         Old_Compat_BM;
     171    HBITMAP                         Compat_BM;/* Bitmap for double buffering*/
     172
    164173    HWND                Window;
    165174    HDC                 hDC;
  • trunk/src/opengl/mesa/xform.h

    r2962 r3597  
    1 /* $Id: xform.h,v 1.2 2000-03-01 18:49:41 jeroen Exp $ */
     1/* $Id: xform.h,v 1.3 2000-05-23 20:35:00 jeroen Exp $ */
    22
    33/*
    44 * Mesa 3-D graphics library
    5  * Version:  3.1
     5 * Version:  3.3
    66 *
    77 * Copyright (C) 1999  Brian Paul   All Rights Reserved.
     
    3535#include "types.h"
    3636
     37#ifdef USE_X86_ASM
     38#define _XFORMAPI _ASMAPI
     39#define _XFORMAPIP _ASMAPIP
     40#else
     41#define _XFORMAPI
     42#define _XFORMAPIP *
     43#endif
    3744
    3845/*
    3946 * Transform a point (column vector) by a matrix:   Q = M * P
    4047 */
    41 #define TRANSFORM_POINT( Q, M, P )                                      \
    42    Q[0] = M[0] * P[0] + M[4] * P[1] + M[8] *  P[2] + M[12] * P[3];      \
    43    Q[1] = M[1] * P[0] + M[5] * P[1] + M[9] *  P[2] + M[13] * P[3];      \
    44    Q[2] = M[2] * P[0] + M[6] * P[1] + M[10] * P[2] + M[14] * P[3];      \
     48#define TRANSFORM_POINT( Q, M, P )                                      \
     49   Q[0] = M[0] * P[0] + M[4] * P[1] + M[8] *  P[2] + M[12] * P[3];      \
     50   Q[1] = M[1] * P[0] + M[5] * P[1] + M[9] *  P[2] + M[13] * P[3];      \
     51   Q[2] = M[2] * P[0] + M[6] * P[1] + M[10] * P[2] + M[14] * P[3];      \
    4552   Q[3] = M[3] * P[0] + M[7] * P[1] + M[11] * P[2] + M[15] * P[3];
    4653
    4754
    48 #define TRANSFORM_POINT3( Q, M, P )                             \
    49    Q[0] = M[0] * P[0] + M[4] * P[1] + M[8] *  P[2] + M[12];     \
    50    Q[1] = M[1] * P[0] + M[5] * P[1] + M[9] *  P[2] + M[13];     \
    51    Q[2] = M[2] * P[0] + M[6] * P[1] + M[10] * P[2] + M[14];     \
     55#define TRANSFORM_POINT3( Q, M, P )                             \
     56   Q[0] = M[0] * P[0] + M[4] * P[1] + M[8] *  P[2] + M[12];     \
     57   Q[1] = M[1] * P[0] + M[5] * P[1] + M[9] *  P[2] + M[13];     \
     58   Q[2] = M[2] * P[0] + M[6] * P[1] + M[10] * P[2] + M[14];     \
    5259   Q[3] = M[3] * P[0] + M[7] * P[1] + M[11] * P[2] + M[15];
    5360
     
    5663 * Transform a normal (row vector) by a matrix:  [NX NY NZ] = N * MAT
    5764 */
    58 #define TRANSFORM_NORMAL( TO, N, MAT )                          \
    59 do {                                                            \
    60    TO[0] = N[0] * MAT[0] + N[1] * MAT[1] + N[2] * MAT[2];       \
    61    TO[1] = N[0] * MAT[4] + N[1] * MAT[5] + N[2] * MAT[6];       \
    62    TO[2] = N[0] * MAT[8] + N[1] * MAT[9] + N[2] * MAT[10];      \
     65#define TRANSFORM_NORMAL( TO, N, MAT )                          \
     66do {                                                            \
     67   TO[0] = N[0] * MAT[0] + N[1] * MAT[1] + N[2] * MAT[2];       \
     68   TO[1] = N[0] * MAT[4] + N[1] * MAT[5] + N[2] * MAT[6];       \
     69   TO[2] = N[0] * MAT[8] + N[1] * MAT[9] + N[2] * MAT[10];      \
    6370} while (0)
    6471
    6572
    6673extern void gl_transform_vector( GLfloat u[4],
    67                                 const GLfloat v[4],
     74                                const GLfloat v[4],
    6875                                 const GLfloat m[16] );
    6976
     
    104111 * automatically available.
    105112 */
    106 typedef GLvector4f *(* __cdecl clip_func)( GLvector4f *vClip,
     113typedef GLvector4f * (_XFORMAPIP clip_func)( GLvector4f *vClip,
    107114                                  GLvector4f *vProj,
    108115                                  GLubyte clipMask[],
    109116                                  GLubyte *orMask,
    110117                                  GLubyte *andMask );
    111 
    112118
    113119typedef void (*dotprod_func)( GLvector4f *out_vec,
     
    129135 *     parameter, to allow a unified interface.
    130136 */
    131 typedef void (* __cdecl transform_func)( GLvector4f *to_vec,
     137typedef void (_XFORMAPIP transform_func)( GLvector4f *to_vec,
    132138                                const GLmatrix *mat,
    133139                                const GLvector4f *from_vec,
     
    141147extern void gl_transform_bounds3( GLubyte *orMask, GLubyte *andMask,
    142148                           const GLmatrix *mat,
    143                            CONST GLfloat src[][3] );
     149                           CONST GLfloat src[][3] );
    144150
    145151extern void gl_transform_bounds2( GLubyte *orMask, GLubyte *andMask,
    146                            const GLmatrix *mat,
    147                            CONST GLfloat src[][3] );
     152                           const GLmatrix *mat,
     153                           CONST GLfloat src[][3] );
    148154
    149155
     
    160166
    161167extern void gl_transform_point_sz( GLfloat Q[4], const GLfloat M[16],
    162                                    const GLfloat P[4], GLuint sz );
     168                                   const GLfloat P[4], GLuint sz );
    163169
    164170
     
    169175#define Transform( to, mat, from, mask, cull ) \
    170176      ( (*gl_transform_tab[cull!=0][(from)->size][(mat)->type])( to, mat, from, mask, cull ), \
    171         (to) )
     177        (to) )
    172178
    173179
  • trunk/src/opengl/mesa/xform_tmp.h

    r2962 r3597  
    1 /* $Id: xform_tmp.h,v 1.2 2000-03-01 18:49:41 jeroen Exp $ */
     1/* $Id: xform_tmp.h,v 1.3 2000-05-23 20:35:00 jeroen Exp $ */
    22
    33/*
     
    6666 */
    6767
    68 static void __cdecl TAG(transform_points1_general)( GLvector4f *to_vec,
     68static void _XFORMAPI TAG(transform_points1_general)( GLvector4f *to_vec,
    6969                                            const GLmatrix *mat,
    7070                                            const GLvector4f *from_vec,
     
    8686   STRIDE_LOOP {
    8787      CLIP_CHECK {
    88         const GLfloat ox = from[0];
    89         to[i][0] = m0 * ox + m12;
     88        const GLfloat ox = from[0];
     89        to[i][0] = m0 * ox + m12;
    9090         to[i][1] = m1 * ox + m13;
    9191         to[i][2] = m2 * ox + m14;
     
    9999}
    100100
    101 static void __cdecl TAG(transform_points1_identity)( GLvector4f *to_vec,
     101static void _XFORMAPI TAG(transform_points1_identity)( GLvector4f *to_vec,
    102102                                             const GLmatrix *mat,
    103103                                             const GLvector4f *from_vec,
     
    126126}
    127127
    128 static void __cdecl TAG(transform_points1_2d)( GLvector4f *to_vec,
     128static void _XFORMAPI TAG(transform_points1_2d)( GLvector4f *to_vec,
    129129                                       const GLmatrix *mat,
    130130                                       const GLvector4f *from_vec,
     
    155155}
    156156
    157 static void __cdecl TAG(transform_points1_2d_no_rot)( GLvector4f *to_vec,
     157static void _XFORMAPI TAG(transform_points1_2d_no_rot)( GLvector4f *to_vec,
    158158                                              const GLmatrix *mat,
    159159                                              const GLvector4f *from_vec,
     
    184184}
    185185
    186 static void __cdecl TAG(transform_points1_3d)( GLvector4f *to_vec,
     186static void _XFORMAPI TAG(transform_points1_3d)( GLvector4f *to_vec,
    187187                                       const GLmatrix *mat,
    188188                                       const GLvector4f *from_vec,
     
    203203   STRIDE_LOOP {
    204204      CLIP_CHECK {
    205         const GLfloat ox = from[0];
     205        const GLfloat ox = from[0];
    206206         to[i][0] = m0 * ox + m12;
    207207         to[i][1] = m1 * ox + m13;
     
    215215
    216216
    217 static void __cdecl TAG(transform_points1_3d_no_rot)( GLvector4f *to_vec,
     217static void _XFORMAPI TAG(transform_points1_3d_no_rot)( GLvector4f *to_vec,
    218218                                              const GLmatrix *mat,
    219219                                              const GLvector4f *from_vec,
     
    245245}
    246246
    247 static void __cdecl TAG(transform_points1_perspective)( GLvector4f *to_vec,
     247static void _XFORMAPI TAG(transform_points1_perspective)( GLvector4f *to_vec,
    248248                                                const GLmatrix *mat,
    249249                                                const GLvector4f *from_vec,
     
    263263   STRIDE_LOOP {
    264264      CLIP_CHECK {
    265         const GLfloat ox = from[0];
    266         to[i][0] = m0 * ox                ;
    267         to[i][1] =           0            ;
    268         to[i][2] =                     m14;
    269         to[i][3] = 0;
     265        const GLfloat ox = from[0];
     266        to[i][0] = m0 * ox                ;
     267        to[i][1] =           0            ;
     268        to[i][2] =                     m14;
     269        to[i][3] = 0;
    270270      }
    271271   }
     
    282282 * texture pipeline.
    283283 */
    284 static void __cdecl TAG(transform_points2_general)( GLvector4f *to_vec,
     284static void _XFORMAPI TAG(transform_points2_general)( GLvector4f *to_vec,
    285285                                            const GLmatrix *mat,
    286286                                            const GLvector4f *from_vec,
     
    302302   STRIDE_LOOP {
    303303      CLIP_CHECK {
    304         const GLfloat ox = from[0], oy = from[1];
     304        const GLfloat ox = from[0], oy = from[1];
    305305         to[i][0] = m0 * ox + m4 * oy + m12;
    306306         to[i][1] = m1 * ox + m5 * oy + m13;
     
    314314}
    315315
    316 static void __cdecl TAG(transform_points2_identity)( GLvector4f *to_vec,
     316static void _XFORMAPI TAG(transform_points2_identity)( GLvector4f *to_vec,
    317317                                             const GLmatrix *mat,
    318318                                             const GLvector4f *from_vec,
     
    341341}
    342342
    343 static void __cdecl TAG(transform_points2_2d)( GLvector4f *to_vec,
     343static void _XFORMAPI TAG(transform_points2_2d)( GLvector4f *to_vec,
    344344                                       const GLmatrix *mat,
    345345                                       const GLvector4f *from_vec,
     
    371371}
    372372
    373 static void __cdecl TAG(transform_points2_2d_no_rot)( GLvector4f *to_vec,
     373static void _XFORMAPI TAG(transform_points2_2d_no_rot)( GLvector4f *to_vec,
    374374                                              const GLmatrix *mat,
    375375                                              const GLvector4f *from_vec,
     
    400400}
    401401
    402 static void __cdecl TAG(transform_points2_3d)( GLvector4f *to_vec,
     402static void _XFORMAPI TAG(transform_points2_3d)( GLvector4f *to_vec,
    403403                                       const GLmatrix *mat,
    404404                                       const GLvector4f *from_vec,
     
    419419   STRIDE_LOOP {
    420420      CLIP_CHECK {
    421         const GLfloat ox = from[0], oy = from[1];
    422         to[i][0] = m0 * ox + m4 * oy + m12;
    423         to[i][1] = m1 * ox + m5 * oy + m13;
    424         to[i][2] = m2 * ox + m6 * oy + m14;
     421        const GLfloat ox = from[0], oy = from[1];
     422        to[i][0] = m0 * ox + m4 * oy + m12;
     423        to[i][1] = m1 * ox + m5 * oy + m13;
     424        to[i][2] = m2 * ox + m6 * oy + m14;
    425425      }
    426426   }
     
    434434 * a texture transformation point of view.
    435435 */
    436 static void __cdecl TAG(transform_points2_3d_no_rot)( GLvector4f *to_vec,
     436static void _XFORMAPI TAG(transform_points2_3d_no_rot)( GLvector4f *to_vec,
    437437                                              const GLmatrix *mat,
    438438                                              const GLvector4f *from_vec,
     
    453453   STRIDE_LOOP {
    454454      CLIP_CHECK {
    455         const GLfloat ox = from[0], oy = from[1];
    456         to[i][0] = m0 * ox           + m12;
    457         to[i][1] =           m5 * oy + m13;
    458         to[i][2] =                     m14;
     455        const GLfloat ox = from[0], oy = from[1];
     456        to[i][0] = m0 * ox           + m12;
     457        to[i][1] =           m5 * oy + m13;
     458        to[i][2] =                     m14;
    459459      }
    460460   }
     
    473473 * attached to the assertions that have appeared in them.
    474474 */
    475 static void __cdecl TAG(transform_points2_perspective)( GLvector4f *to_vec,
     475static void _XFORMAPI TAG(transform_points2_perspective)( GLvector4f *to_vec,
    476476                                                const GLmatrix *mat,
    477477                                                const GLvector4f *from_vec,
     
    491491   STRIDE_LOOP {
    492492      CLIP_CHECK {
    493         const GLfloat ox = from[0], oy = from[1];
    494         to[i][0] = m0 * ox                ;
    495         to[i][1] =           m5 * oy      ;
     493        const GLfloat ox = from[0], oy = from[1];
     494        to[i][0] = m0 * ox                ;
     495        to[i][1] =           m5 * oy      ;
    496496         to[i][2] =                     m14;
    497497         to[i][3] = 0;
     
    505505
    506506
    507 static void __cdecl TAG(transform_points3_general)( GLvector4f *to_vec,
     507static void _XFORMAPI TAG(transform_points3_general)( GLvector4f *to_vec,
    508508                                            const GLmatrix *mat,
    509509                                            const GLvector4f *from_vec,
     
    538538}
    539539
    540 static void __cdecl TAG(transform_points3_identity)( GLvector4f *to_vec,
     540static void _XFORMAPI TAG(transform_points3_identity)( GLvector4f *to_vec,
    541541                                             const GLmatrix *mat,
    542542                                             const GLvector4f *from_vec,
     
    566566}
    567567
    568 static void __cdecl TAG(transform_points3_2d)( GLvector4f *to_vec,
     568static void _XFORMAPI TAG(transform_points3_2d)( GLvector4f *to_vec,
    569569                                       const GLmatrix *mat,
    570570                                       const GLvector4f *from_vec,
     
    596596}
    597597
    598 static void __cdecl TAG(transform_points3_2d_no_rot)( GLvector4f *to_vec,
     598static void _XFORMAPI TAG(transform_points3_2d_no_rot)( GLvector4f *to_vec,
    599599                                              const GLmatrix *mat,
    600600                                              const GLvector4f *from_vec,
     
    625625}
    626626
    627 static void __cdecl TAG(transform_points3_3d)( GLvector4f *to_vec,
     627static void _XFORMAPI TAG(transform_points3_3d)( GLvector4f *to_vec,
    628628                                       const GLmatrix *mat,
    629629                                       const GLvector4f *from_vec,
     
    658658/* previously known as ortho...
    659659 */
    660 static void __cdecl TAG(transform_points3_3d_no_rot)( GLvector4f *to_vec,
     660static void _XFORMAPI TAG(transform_points3_3d_no_rot)( GLvector4f *to_vec,
    661661                                              const GLmatrix *mat,
    662662                                              const GLvector4f *from_vec,
     
    688688}
    689689
    690 static void __cdecl TAG(transform_points3_perspective)( GLvector4f *to_vec,
     690static void _XFORMAPI TAG(transform_points3_perspective)( GLvector4f *to_vec,
    691691                                                const GLmatrix *mat,
    692692                                                const GLvector4f *from_vec,
     
    721721
    722722
    723 static void __cdecl TAG(transform_points4_general)( GLvector4f *to_vec,
     723static void _XFORMAPI TAG(transform_points4_general)( GLvector4f *to_vec,
    724724                                            const GLmatrix *mat,
    725725                                            const GLvector4f *from_vec,
     
    754754}
    755755
    756 static void __cdecl TAG(transform_points4_identity)( GLvector4f *to_vec,
     756static void _XFORMAPI TAG(transform_points4_identity)( GLvector4f *to_vec,
    757757                                             const GLmatrix *mat,
    758758                                             const GLvector4f *from_vec,
     
    783783}
    784784
    785 static void __cdecl TAG(transform_points4_2d)( GLvector4f *to_vec,
     785static void _XFORMAPI TAG(transform_points4_2d)( GLvector4f *to_vec,
    786786                                       const GLmatrix *mat,
    787787                                       const GLvector4f *from_vec,
     
    814814}
    815815
    816 static void __cdecl TAG(transform_points4_2d_no_rot)( GLvector4f *to_vec,
     816static void _XFORMAPI TAG(transform_points4_2d_no_rot)( GLvector4f *to_vec,
    817817                                              const GLmatrix *mat,
    818818                                              const GLvector4f *from_vec,
     
    844844}
    845845
    846 static void __cdecl TAG(transform_points4_3d)( GLvector4f *to_vec,
     846static void _XFORMAPI TAG(transform_points4_3d)( GLvector4f *to_vec,
    847847                                       const GLmatrix *mat,
    848848                                       const GLvector4f *from_vec,
     
    876876}
    877877
    878 static void __cdecl TAG(transform_points4_3d_no_rot)( GLvector4f *to_vec,
     878static void _XFORMAPI TAG(transform_points4_3d_no_rot)( GLvector4f *to_vec,
    879879                                              const GLmatrix *mat,
    880880                                              const GLvector4f *from_vec,
     
    907907}
    908908
    909 static void __cdecl TAG(transform_points4_perspective)( GLvector4f *to_vec,
     909static void _XFORMAPI TAG(transform_points4_perspective)( GLvector4f *to_vec,
    910910                                                const GLmatrix *mat,
    911911                                                const GLvector4f *from_vec,
     
    939939}
    940940
    941 static transform_func TAG(transform_tab_1)[7];
    942 static transform_func TAG(transform_tab_2)[7];
    943 static transform_func TAG(transform_tab_3)[7];
    944 static transform_func TAG(transform_tab_4)[7];
     941static transform_func /* _XFORMAPI */ TAG(transform_tab_1)[7];
     942static transform_func /* _XFORMAPI */ TAG(transform_tab_2)[7];
     943static transform_func /* _XFORMAPI */ TAG(transform_tab_3)[7];
     944static transform_func /* _XFORMAPI */ TAG(transform_tab_4)[7];
    945945
    946946/* Similar functions could be called several times, with more highly
     
    948948 * startup.
    949949 */
    950 static void TAG(init_c_transformations)( void )
     950static void _XFORMAPI TAG(init_c_transformations)( void )
    951951{
    952952#define TAG_TAB   gl_transform_tab[IDX]
  • trunk/src/opengl/mesa/zoom.h

    r2938 r3597  
    1 /* $Id: zoom.h,v 1.1 2000-02-29 00:48:45 sandervl Exp $ */
     1/* $Id: zoom.h,v 1.2 2000-05-23 20:35:01 jeroen Exp $ */
    22
    33
    44/*
    55 * Mesa 3-D graphics library
    6  * Version:  3.1
     6 * Version:  3.3
    77 *
    88 * Copyright (C) 1999  Brian Paul   All Rights Reserved.
Note: See TracChangeset for help on using the changeset viewer.