Browse Source

first big check-in of new Mesa 3.3 code

tags/mesa_3_1
Brian Paul 26 years ago
parent
commit
fbd8f212c3
72 changed files with 11285 additions and 5200 deletions
  1. 1469
    982
      include/GL/gl.h
  2. 206
    204
      include/GL/glu.h
  3. 33
    30
      include/GL/glx.h
  4. 8
    6
      src/mesa/Makefile.X11
  5. 4
    12
      src/mesa/drivers/x11/fakeglx.c
  6. 71
    0
      src/mesa/drivers/x11/glxheader.h
  7. 3
    3
      src/mesa/drivers/x11/xfonts.c
  8. 3505
    0
      src/mesa/glapi/glapi.c
  9. 591
    0
      src/mesa/glapi/glapi.h
  10. 8
    6
      src/mesa/main/Makefile.X11
  11. 9
    15
      src/mesa/main/accum.c
  12. 6
    5
      src/mesa/main/accum.h
  13. 43
    20
      src/mesa/main/attrib.c
  14. 15
    5
      src/mesa/main/attrib.h
  15. 13
    14
      src/mesa/main/blend.c
  16. 6
    10
      src/mesa/main/blend.h
  17. 15
    13
      src/mesa/main/clip.c
  18. 3
    5
      src/mesa/main/clip.h
  19. 220
    81
      src/mesa/main/colortab.c
  20. 16
    15
      src/mesa/main/colortab.h
  21. 7
    27
      src/mesa/main/config.h
  22. 104
    156
      src/mesa/main/context.c
  23. 27
    11
      src/mesa/main/context.h
  24. 13
    21
      src/mesa/main/depth.c
  25. 11
    9
      src/mesa/main/depth.h
  26. 546
    0
      src/mesa/main/dispatch.c
  27. 1639
    635
      src/mesa/main/dlist.c
  28. 10
    11
      src/mesa/main/dlist.h
  29. 159
    414
      src/mesa/main/drawpix.c
  30. 5
    19
      src/mesa/main/drawpix.h
  31. 27
    23
      src/mesa/main/enable.c
  32. 14
    11
      src/mesa/main/enable.h
  33. 8
    10
      src/mesa/main/enums.c
  34. 343
    164
      src/mesa/main/eval.c
  35. 74
    23
      src/mesa/main/eval.h
  36. 7
    6
      src/mesa/main/extensions.c
  37. 26
    19
      src/mesa/main/feedback.c
  38. 19
    14
      src/mesa/main/feedback.h
  39. 47
    11
      src/mesa/main/fog.c
  40. 17
    4
      src/mesa/main/fog.h
  41. 55
    30
      src/mesa/main/get.c
  42. 18
    11
      src/mesa/main/get.h
  43. 65
    0
      src/mesa/main/glheader.h
  44. 5
    12
      src/mesa/main/hash.c
  45. 3
    6
      src/mesa/main/hash.h
  46. 354
    1198
      src/mesa/main/image.c
  47. 33
    42
      src/mesa/main/image.h
  48. 196
    50
      src/mesa/main/light.c
  49. 50
    28
      src/mesa/main/light.h
  50. 9
    12
      src/mesa/main/lines.c
  51. 8
    8
      src/mesa/main/lines.h
  52. 16
    87
      src/mesa/main/macros.h
  53. 85
    38
      src/mesa/main/matrix.c
  54. 61
    41
      src/mesa/main/matrix.h
  55. 75
    23
      src/mesa/main/pixel.c
  56. 28
    13
      src/mesa/main/pixel.h
  57. 40
    34
      src/mesa/main/points.c
  58. 13
    5
      src/mesa/main/points.h
  59. 30
    19
      src/mesa/main/polygon.c
  60. 17
    12
      src/mesa/main/polygon.h
  61. 141
    71
      src/mesa/main/rastpos.c
  62. 70
    9
      src/mesa/main/rastpos.h
  63. 17
    16
      src/mesa/main/stencil.c
  64. 10
    11
      src/mesa/main/stencil.h
  65. 91
    90
      src/mesa/main/teximage.c
  66. 57
    64
      src/mesa/main/teximage.h
  67. 31
    30
      src/mesa/main/texobj.c
  68. 16
    16
      src/mesa/main/texobj.h
  69. 150
    42
      src/mesa/main/texstate.c
  70. 65
    29
      src/mesa/main/texstate.h
  71. 90
    98
      src/mesa/main/varray.c
  72. 39
    41
      src/mesa/main/varray.h

+ 1469
- 982
include/GL/gl.h
File diff suppressed because it is too large
View File


+ 206
- 204
include/GL/glu.h View File

/* $Id: glu.h,v 1.14 1999/11/09 06:17:08 brianp Exp $ */
/* $Id: glu.h,v 1.15 1999/11/11 01:27:17 brianp Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
* Version: 3.1
* Version: 3.3
*
* Copyright (C) 1995-1999 Brian Paul * Copyright (C) 1995-1999 Brian Paul
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
#endif #endif




#define GLU_VERSION_1_1 1
#define GLU_VERSION_1_2 1


#define GLU_TRUE GL_TRUE
#define GLU_FALSE GL_FALSE


enum {
/* Normal vectors */
GLU_SMOOTH = 100000,
GLU_FLAT = 100001,
GLU_NONE = 100002,

/* Quadric draw styles */
GLU_POINT = 100010,
GLU_LINE = 100011,
GLU_FILL = 100012,
GLU_SILHOUETTE = 100013,

/* Quadric orientation */
GLU_OUTSIDE = 100020,
GLU_INSIDE = 100021,

/* Tessellator */
GLU_TESS_BEGIN = 100100,
GLU_TESS_VERTEX = 100101,
GLU_TESS_END = 100102,
GLU_TESS_ERROR = 100103,
GLU_TESS_EDGE_FLAG = 100104,
GLU_TESS_COMBINE = 100105,

GLU_TESS_BEGIN_DATA = 100106,
GLU_TESS_VERTEX_DATA = 100107,
GLU_TESS_END_DATA = 100108,
GLU_TESS_ERROR_DATA = 100109,
GLU_TESS_EDGE_FLAG_DATA = 100110,
GLU_TESS_COMBINE_DATA = 100111,

/* Winding rules */
GLU_TESS_WINDING_ODD = 100130,
GLU_TESS_WINDING_NONZERO = 100131,
GLU_TESS_WINDING_POSITIVE = 100132,
GLU_TESS_WINDING_NEGATIVE = 100133,
GLU_TESS_WINDING_ABS_GEQ_TWO = 100134,

/* Tessellation properties */
GLU_TESS_WINDING_RULE = 100140,
GLU_TESS_BOUNDARY_ONLY = 100141,
GLU_TESS_TOLERANCE = 100142,

/* Tessellation errors */
GLU_TESS_ERROR1 = 100151, /* Missing gluBeginPolygon */
GLU_TESS_ERROR2 = 100152, /* Missing gluBeginContour */
GLU_TESS_ERROR3 = 100153, /* Missing gluEndPolygon */
GLU_TESS_ERROR4 = 100154, /* Missing gluEndContour */
GLU_TESS_ERROR5 = 100155, /* */
GLU_TESS_ERROR6 = 100156, /* */
GLU_TESS_ERROR7 = 100157, /* */
GLU_TESS_ERROR8 = 100158, /* */

/* NURBS */
GLU_AUTO_LOAD_MATRIX = 100200,
GLU_CULLING = 100201,
GLU_PARAMETRIC_TOLERANCE= 100202,
GLU_SAMPLING_TOLERANCE = 100203,
GLU_DISPLAY_MODE = 100204,
GLU_SAMPLING_METHOD = 100205,
GLU_U_STEP = 100206,
GLU_V_STEP = 100207,

GLU_PATH_LENGTH = 100215,
GLU_PARAMETRIC_ERROR = 100216,
GLU_DOMAIN_DISTANCE = 100217,

GLU_MAP1_TRIM_2 = 100210,
GLU_MAP1_TRIM_3 = 100211,

GLU_OUTLINE_POLYGON = 100240,
GLU_OUTLINE_PATCH = 100241,

GLU_NURBS_ERROR1 = 100251, /* spline order un-supported */
GLU_NURBS_ERROR2 = 100252, /* too few knots */
GLU_NURBS_ERROR3 = 100253, /* valid knot range is empty */
GLU_NURBS_ERROR4 = 100254, /* decreasing knot sequence */
GLU_NURBS_ERROR5 = 100255, /* knot multiplicity > spline order */
GLU_NURBS_ERROR6 = 100256, /* endcurve() must follow bgncurve() */
GLU_NURBS_ERROR7 = 100257, /* bgncurve() must precede endcurve() */
GLU_NURBS_ERROR8 = 100258, /* ctrlarray or knot vector is NULL */
GLU_NURBS_ERROR9 = 100259, /* can't draw pwlcurves */
GLU_NURBS_ERROR10 = 100260, /* missing gluNurbsCurve() */
GLU_NURBS_ERROR11 = 100261, /* missing gluNurbsSurface() */
GLU_NURBS_ERROR12 = 100262, /* endtrim() must precede endsurface() */
GLU_NURBS_ERROR13 = 100263, /* bgnsurface() must precede endsurface() */
GLU_NURBS_ERROR14 = 100264, /* curve of improper type passed as trim curve */
GLU_NURBS_ERROR15 = 100265, /* bgnsurface() must precede bgntrim() */
GLU_NURBS_ERROR16 = 100266, /* endtrim() must follow bgntrim() */
GLU_NURBS_ERROR17 = 100267, /* bgntrim() must precede endtrim()*/
GLU_NURBS_ERROR18 = 100268, /* invalid or missing trim curve*/
GLU_NURBS_ERROR19 = 100269, /* bgntrim() must precede pwlcurve() */
GLU_NURBS_ERROR20 = 100270, /* pwlcurve referenced twice*/
GLU_NURBS_ERROR21 = 100271, /* pwlcurve and nurbscurve mixed */
GLU_NURBS_ERROR22 = 100272, /* improper usage of trim data type */
GLU_NURBS_ERROR23 = 100273, /* nurbscurve referenced twice */
GLU_NURBS_ERROR24 = 100274, /* nurbscurve and pwlcurve mixed */
GLU_NURBS_ERROR25 = 100275, /* nurbssurface referenced twice */
GLU_NURBS_ERROR26 = 100276, /* invalid property */
GLU_NURBS_ERROR27 = 100277, /* endsurface() must follow bgnsurface() */
GLU_NURBS_ERROR28 = 100278, /* intersecting or misoriented trim curves */
GLU_NURBS_ERROR29 = 100279, /* intersecting trim curves */
GLU_NURBS_ERROR30 = 100280, /* UNUSED */
GLU_NURBS_ERROR31 = 100281, /* unconnected trim curves */
GLU_NURBS_ERROR32 = 100282, /* unknown knot error */
GLU_NURBS_ERROR33 = 100283, /* negative vertex count encountered */
GLU_NURBS_ERROR34 = 100284, /* negative byte-stride */
GLU_NURBS_ERROR35 = 100285, /* unknown type descriptor */
GLU_NURBS_ERROR36 = 100286, /* null control point reference */
GLU_NURBS_ERROR37 = 100287, /* duplicate point on pwlcurve */

/* Errors */
GLU_INVALID_ENUM = 100900,
GLU_INVALID_VALUE = 100901,
GLU_OUT_OF_MEMORY = 100902,
GLU_INCOMPATIBLE_GL_VERSION = 100903,

/* New in GLU 1.1 */
GLU_VERSION = 100800,
GLU_EXTENSIONS = 100801,

/*** GLU 1.0 tessellation - obsolete! ***/

/* Contour types */
GLU_CW = 100120,
GLU_CCW = 100121,
GLU_INTERIOR = 100122,
GLU_EXTERIOR = 100123,
GLU_UNKNOWN = 100124,

/* Tessellator */
GLU_BEGIN = GLU_TESS_BEGIN,
GLU_VERTEX = GLU_TESS_VERTEX,
GLU_END = GLU_TESS_END,
GLU_ERROR = GLU_TESS_ERROR,
GLU_EDGE_FLAG = GLU_TESS_EDGE_FLAG
};
#define GLU_VERSION_1_1 1
#define GLU_VERSION_1_2 1


#define GLU_TRUE 1
#define GLU_FALSE 0


/* Normal vectors */
#define GLU_SMOOTH 100000
#define GLU_FLAT 100001
#define GLU_NONE 100002

/* Quadric draw styles */
#define GLU_POINT 100010
#define GLU_LINE 100011
#define GLU_FILL 100012
#define GLU_SILHOUETTE 100013

/* Quadric orientation */
#define GLU_OUTSIDE 100020
#define GLU_INSIDE 100021

/* Tessellator */
#define GLU_TESS_BEGIN 100100
#define GLU_TESS_VERTEX 100101
#define GLU_TESS_END 100102
#define GLU_TESS_ERROR 100103
#define GLU_TESS_EDGE_FLAG 100104
#define GLU_TESS_COMBINE 100105

#define GLU_TESS_BEGIN_DATA 100106
#define GLU_TESS_VERTEX_DATA 100107
#define GLU_TESS_END_DATA 100108
#define GLU_TESS_ERROR_DATA 100109
#define GLU_TESS_EDGE_FLAG_DATA 100110
#define GLU_TESS_COMBINE_DATA 100111

/* Winding rules */
#define GLU_TESS_WINDING_ODD 100130
#define GLU_TESS_WINDING_NONZERO 100131
#define GLU_TESS_WINDING_POSITIVE 100132
#define GLU_TESS_WINDING_NEGATIVE 100133
#define GLU_TESS_WINDING_ABS_GEQ_TWO 100134

/* Tessellation properties */
#define GLU_TESS_WINDING_RULE 100140
#define GLU_TESS_BOUNDARY_ONLY 100141
#define GLU_TESS_TOLERANCE 100142

/* Tessellation errors */
#define GLU_TESS_ERROR1 100151 /* Missing gluBeginPolygon */
#define GLU_TESS_ERROR2 100152 /* Missing gluBeginContour */
#define GLU_TESS_ERROR3 100153 /* Missing gluEndPolygon */
#define GLU_TESS_ERROR4 100154 /* Missing gluEndContour */
#define GLU_TESS_ERROR5 100155 /* */
#define GLU_TESS_ERROR6 100156 /* */
#define GLU_TESS_ERROR7 100157 /* */
#define GLU_TESS_ERROR8 100158 /* */

/* NURBS */
#define GLU_AUTO_LOAD_MATRIX 100200
#define GLU_CULLING 100201
#define GLU_PARAMETRIC_TOLERANC 100202
#define GLU_SAMPLING_TOLERANCE 100203
#define GLU_DISPLAY_MODE 100204
#define GLU_SAMPLING_METHOD 100205
#define GLU_U_STEP 100206
#define GLU_V_STEP 100207

#define GLU_PATH_LENGTH 100215
#define GLU_PARAMETRIC_ERROR 100216
#define GLU_DOMAIN_DISTANCE 100217

#define GLU_MAP1_TRIM_2 100210
#define GLU_MAP1_TRIM_3 100211

#define GLU_OUTLINE_POLYGON 100240
#define GLU_OUTLINE_PATCH 100241

#define GLU_NURBS_ERROR1 100251 /* spline order un-supported */
#define GLU_NURBS_ERROR2 100252 /* too few knots */
#define GLU_NURBS_ERROR3 100253 /* valid knot range is empty */
#define GLU_NURBS_ERROR4 100254 /* decreasing knot sequence */
#define GLU_NURBS_ERROR5 100255 /* knot multiplicity > spline order */
#define GLU_NURBS_ERROR6 100256 /* endcurve() must follow bgncurve() */
#define GLU_NURBS_ERROR7 100257 /* bgncurve() must precede endcurve() */
#define GLU_NURBS_ERROR8 100258 /* ctrlarray or knot vector is NULL */
#define GLU_NURBS_ERROR9 100259 /* can't draw pwlcurves */
#define GLU_NURBS_ERROR10 100260 /* missing gluNurbsCurve() */
#define GLU_NURBS_ERROR11 100261 /* missing gluNurbsSurface() */
#define GLU_NURBS_ERROR12 100262 /* endtrim() must precede endsurface() */
#define GLU_NURBS_ERROR13 100263 /* bgnsurface() must precede endsurface() */
#define GLU_NURBS_ERROR14 100264 /* curve of improper type passed as trim curve */
#define GLU_NURBS_ERROR15 100265 /* bgnsurface() must precede bgntrim() */
#define GLU_NURBS_ERROR16 100266 /* endtrim() must follow bgntrim() */
#define GLU_NURBS_ERROR17 100267 /* bgntrim() must precede endtrim()*/
#define GLU_NURBS_ERROR18 100268 /* invalid or missing trim curve*/
#define GLU_NURBS_ERROR19 100269 /* bgntrim() must precede pwlcurve() */
#define GLU_NURBS_ERROR20 100270 /* pwlcurve referenced twice*/
#define GLU_NURBS_ERROR21 100271 /* pwlcurve and nurbscurve mixed */
#define GLU_NURBS_ERROR22 100272 /* improper usage of trim data type */
#define GLU_NURBS_ERROR23 100273 /* nurbscurve referenced twice */
#define GLU_NURBS_ERROR24 100274 /* nurbscurve and pwlcurve mixed */
#define GLU_NURBS_ERROR25 100275 /* nurbssurface referenced twice */
#define GLU_NURBS_ERROR26 100276 /* invalid property */
#define GLU_NURBS_ERROR27 100277 /* endsurface() must follow bgnsurface() */
#define GLU_NURBS_ERROR28 100278 /* intersecting or misoriented trim curves */
#define GLU_NURBS_ERROR29 100279 /* intersecting trim curves */
#define GLU_NURBS_ERROR30 100280 /* UNUSED */
#define GLU_NURBS_ERROR31 100281 /* unconnected trim curves */
#define GLU_NURBS_ERROR32 100282 /* unknown knot error */
#define GLU_NURBS_ERROR33 100283 /* negative vertex count encountered */
#define GLU_NURBS_ERROR34 100284 /* negative byte-stride */
#define GLU_NURBS_ERROR35 100285 /* unknown type descriptor */
#define GLU_NURBS_ERROR36 100286 /* null control point reference */
#define GLU_NURBS_ERROR37 100287 /* duplicate point on pwlcurve */

/* Errors */
#define GLU_INVALID_ENUM 100900
#define GLU_INVALID_VALUE 100901
#define GLU_OUT_OF_MEMORY 100902
#define GLU_INCOMPATIBLE_GL_VERSION 100903

/* New in GLU 1.1 */
#define GLU_VERSION 100800
#define GLU_EXTENSIONS 100801

/*** GLU 1.0 tessellation - obsolete! ***/

/* Contour types */
#define GLU_CW 100120
#define GLU_CCW 100121
#define GLU_INTERIOR 100122
#define GLU_EXTERIOR 100123
#define GLU_UNKNOWN 100124

/* Tessellator */
#define GLU_BEGIN GLU_TESS_BEGIN
#define GLU_VERTEX GLU_TESS_VERTEX
#define GLU_END GLU_TESS_END
#define GLU_ERROR GLU_TESS_ERROR
#define GLU_EDGE_FLAG GLU_TESS_EDGE_FLAG




/* /*
*/ */


GLUAPI void GLAPIENTRY gluLookAt( GLdouble eyex, GLdouble eyey, GLdouble eyez, GLUAPI void GLAPIENTRY gluLookAt( GLdouble eyex, GLdouble eyey, GLdouble eyez,
GLdouble centerx, GLdouble centery,
GLdouble centerz,
GLdouble upx, GLdouble upy, GLdouble upz );
GLdouble centerx, GLdouble centery,
GLdouble centerz,
GLdouble upx, GLdouble upy, GLdouble upz );




GLUAPI void GLAPIENTRY gluOrtho2D( GLdouble left, GLdouble right, GLUAPI void GLAPIENTRY gluOrtho2D( GLdouble left, GLdouble right,
GLdouble bottom, GLdouble top );
GLdouble bottom, GLdouble top );




GLUAPI void GLAPIENTRY gluPerspective( GLdouble fovy, GLdouble aspect, GLUAPI void GLAPIENTRY gluPerspective( GLdouble fovy, GLdouble aspect,
GLdouble zNear, GLdouble zFar );
GLdouble zNear, GLdouble zFar );




GLUAPI void GLAPIENTRY gluPickMatrix( GLdouble x, GLdouble y, GLUAPI void GLAPIENTRY gluPickMatrix( GLdouble x, GLdouble y,
GLdouble width, GLdouble height,
const GLint viewport[4] );
GLdouble width, GLdouble height,
const GLint viewport[4] );


GLUAPI GLint GLAPIENTRY gluProject( GLdouble objx, GLdouble objy, GLdouble objz, GLUAPI GLint GLAPIENTRY gluProject( GLdouble objx, GLdouble objy, GLdouble objz,
const GLdouble modelMatrix[16],
const GLdouble projMatrix[16],
const GLint viewport[4],
GLdouble *winx, GLdouble *winy,
GLdouble *winz );

GLUAPI GLint GLAPIENTRY gluUnProject( GLdouble winx, GLdouble winy,
GLdouble winz,
const GLdouble modelMatrix[16], const GLdouble modelMatrix[16],
const GLdouble projMatrix[16], const GLdouble projMatrix[16],
const GLint viewport[4], const GLint viewport[4],
GLdouble *objx, GLdouble *objy,
GLdouble *objz );
GLdouble *winx, GLdouble *winy,
GLdouble *winz );

GLUAPI GLint GLAPIENTRY gluUnProject( GLdouble winx, GLdouble winy,
GLdouble winz,
const GLdouble modelMatrix[16],
const GLdouble projMatrix[16],
const GLint viewport[4],
GLdouble *objx, GLdouble *objy,
GLdouble *objz );


GLUAPI const GLubyte* GLAPIENTRY gluErrorString( GLenum errorCode ); GLUAPI const GLubyte* GLAPIENTRY gluErrorString( GLenum errorCode );


*/ */


GLUAPI GLint GLAPIENTRY gluScaleImage( GLenum format, GLUAPI GLint GLAPIENTRY gluScaleImage( GLenum format,
GLsizei widthin, GLsizei heightin,
GLenum typein, const void *datain,
GLsizei widthout, GLsizei heightout,
GLenum typeout, void *dataout );
GLint widthin, GLint heightin,
GLenum typein, const void *datain,
GLint widthout, GLint heightout,
GLenum typeout, void *dataout );


GLUAPI GLint GLAPIENTRY gluBuild1DMipmaps( GLenum target, GLint components, GLUAPI GLint GLAPIENTRY gluBuild1DMipmaps( GLenum target, GLint components,
GLsizei width, GLenum format,
GLenum type, const void *data );
GLint width, GLenum format,
GLenum type, const void *data );


GLUAPI GLint GLAPIENTRY gluBuild2DMipmaps( GLenum target, GLint components, GLUAPI GLint GLAPIENTRY gluBuild2DMipmaps( GLenum target, GLint components,
GLsizei width, GLsizei height,
GLenum format,
GLenum type, const void *data );
GLint width, GLint height,
GLenum format,
GLenum type, const void *data );






GLUAPI void GLAPIENTRY gluDeleteQuadric( GLUquadricObj *state ); GLUAPI void GLAPIENTRY gluDeleteQuadric( GLUquadricObj *state );


GLUAPI void GLAPIENTRY gluQuadricDrawStyle( GLUquadricObj *quadObject, GLUAPI void GLAPIENTRY gluQuadricDrawStyle( GLUquadricObj *quadObject,
GLenum drawStyle );
GLenum drawStyle );


GLUAPI void GLAPIENTRY gluQuadricOrientation( GLUquadricObj *quadObject, GLUAPI void GLAPIENTRY gluQuadricOrientation( GLUquadricObj *quadObject,
GLenum orientation );
GLenum orientation );


GLUAPI void GLAPIENTRY gluQuadricNormals( GLUquadricObj *quadObject, GLUAPI void GLAPIENTRY gluQuadricNormals( GLUquadricObj *quadObject,
GLenum normals );
GLenum normals );


GLUAPI void GLAPIENTRY gluQuadricTexture( GLUquadricObj *quadObject, GLUAPI void GLAPIENTRY gluQuadricTexture( GLUquadricObj *quadObject,
GLboolean textureCoords );
GLboolean textureCoords );


GLUAPI void GLAPIENTRY gluQuadricCallback( GLUquadricObj *qobj, GLUAPI void GLAPIENTRY gluQuadricCallback( GLUquadricObj *qobj,
GLenum which, void (GLCALLBACK *fn)() );
GLenum which,
void (GLCALLBACK *fn)() );


GLUAPI void GLAPIENTRY gluCylinder( GLUquadricObj *qobj, GLUAPI void GLAPIENTRY gluCylinder( GLUquadricObj *qobj,
GLdouble baseRadius,
GLdouble topRadius,
GLdouble height,
GLint slices, GLint stacks );
GLdouble baseRadius,
GLdouble topRadius,
GLdouble height,
GLint slices, GLint stacks );


GLUAPI void GLAPIENTRY gluSphere( GLUquadricObj *qobj, GLUAPI void GLAPIENTRY gluSphere( GLUquadricObj *qobj,
GLdouble radius, GLint slices, GLint stacks );
GLdouble radius, GLint slices,
GLint stacks );


GLUAPI void GLAPIENTRY gluDisk( GLUquadricObj *qobj, GLUAPI void GLAPIENTRY gluDisk( GLUquadricObj *qobj,
GLdouble innerRadius, GLdouble outerRadius,
GLint slices, GLint loops );
GLdouble innerRadius, GLdouble outerRadius,
GLint slices, GLint loops );


GLUAPI void GLAPIENTRY gluPartialDisk( GLUquadricObj *qobj, GLdouble innerRadius, GLUAPI void GLAPIENTRY gluPartialDisk( GLUquadricObj *qobj, GLdouble innerRadius,
GLdouble outerRadius, GLint slices,
GLint loops, GLdouble startAngle,
GLdouble sweepAngle );
GLdouble outerRadius, GLint slices,
GLint loops, GLdouble startAngle,
GLdouble sweepAngle );






GLUAPI void GLAPIENTRY gluDeleteNurbsRenderer( GLUnurbsObj *nobj ); GLUAPI void GLAPIENTRY gluDeleteNurbsRenderer( GLUnurbsObj *nobj );


GLUAPI void GLAPIENTRY gluLoadSamplingMatrices( GLUnurbsObj *nobj, GLUAPI void GLAPIENTRY gluLoadSamplingMatrices( GLUnurbsObj *nobj,
const GLfloat modelMatrix[16],
const GLfloat projMatrix[16],
const GLint viewport[4] );
const GLfloat modelMatrix[16],
const GLfloat projMatrix[16],
const GLint viewport[4] );


GLUAPI void GLAPIENTRY gluNurbsProperty( GLUnurbsObj *nobj, GLenum property, GLUAPI void GLAPIENTRY gluNurbsProperty( GLUnurbsObj *nobj, GLenum property,
GLfloat value );
GLfloat value );


GLUAPI void GLAPIENTRY gluGetNurbsProperty( GLUnurbsObj *nobj, GLenum property, GLUAPI void GLAPIENTRY gluGetNurbsProperty( GLUnurbsObj *nobj, GLenum property,
GLfloat *value );
GLfloat *value );


GLUAPI void GLAPIENTRY gluBeginCurve( GLUnurbsObj *nobj ); GLUAPI void GLAPIENTRY gluBeginCurve( GLUnurbsObj *nobj );


GLUAPI void GLAPIENTRY gluEndCurve( GLUnurbsObj * nobj ); GLUAPI void GLAPIENTRY gluEndCurve( GLUnurbsObj * nobj );


GLUAPI void GLAPIENTRY gluNurbsCurve( GLUnurbsObj *nobj, GLint nknots, GLUAPI void GLAPIENTRY gluNurbsCurve( GLUnurbsObj *nobj, GLint nknots,
GLfloat *knot, GLint stride,
GLfloat *ctlarray, GLint order,
GLenum type );
GLfloat *knot, GLint stride,
GLfloat *ctlarray, GLint order,
GLenum type );


GLUAPI void GLAPIENTRY gluBeginSurface( GLUnurbsObj *nobj ); GLUAPI void GLAPIENTRY gluBeginSurface( GLUnurbsObj *nobj );


GLUAPI void GLAPIENTRY gluEndSurface( GLUnurbsObj * nobj ); GLUAPI void GLAPIENTRY gluEndSurface( GLUnurbsObj * nobj );


GLUAPI void GLAPIENTRY gluNurbsSurface( GLUnurbsObj *nobj, GLUAPI void GLAPIENTRY gluNurbsSurface( GLUnurbsObj *nobj,
GLint sknot_count, GLfloat *sknot,
GLint tknot_count, GLfloat *tknot,
GLint s_stride, GLint t_stride,
GLfloat *ctlarray,
GLint sorder, GLint torder,
GLenum type );
GLint sknot_count, GLfloat *sknot,
GLint tknot_count, GLfloat *tknot,
GLint s_stride, GLint t_stride,
GLfloat *ctlarray,
GLint sorder, GLint torder,
GLenum type );


GLUAPI void GLAPIENTRY gluBeginTrim( GLUnurbsObj *nobj ); GLUAPI void GLAPIENTRY gluBeginTrim( GLUnurbsObj *nobj );


GLUAPI void GLAPIENTRY gluEndTrim( GLUnurbsObj *nobj ); GLUAPI void GLAPIENTRY gluEndTrim( GLUnurbsObj *nobj );


GLUAPI void GLAPIENTRY gluPwlCurve( GLUnurbsObj *nobj, GLint count, GLUAPI void GLAPIENTRY gluPwlCurve( GLUnurbsObj *nobj, GLint count,
GLfloat *array, GLint stride, GLenum type );
GLfloat *array, GLint stride,
GLenum type );


GLUAPI void GLAPIENTRY gluNurbsCallback( GLUnurbsObj *nobj, GLenum which, GLUAPI void GLAPIENTRY gluNurbsCallback( GLUnurbsObj *nobj, GLenum which,
void (GLCALLBACK *fn)() );
void (GLCALLBACK *fn)() );







+ 33
- 30
include/GL/glx.h View File

/* $Id: glx.h,v 1.5 1999/10/27 09:46:07 brianp Exp $ */
/* $Id: glx.h,v 1.6 1999/11/11 01:27:17 brianp Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
* Version: 3.1
* Version: 3.3
* *
* Copyright (C) 1999 Brian Paul All Rights Reserved. * Copyright (C) 1999 Brian Paul All Rights Reserved.
* *


#define GLX_VERSION_1_1 1 #define GLX_VERSION_1_1 1


#define GLX_EXTENSION_NAME "GLX"




/* /*
* Tokens for glXChooseVisual and glXGetConfig: * Tokens for glXChooseVisual and glXGetConfig:
*/ */
enum _GLX_CONFIGS {
GLX_USE_GL = 1,
GLX_BUFFER_SIZE = 2,
GLX_LEVEL = 3,
GLX_RGBA = 4,
GLX_DOUBLEBUFFER = 5,
GLX_STEREO = 6,
GLX_AUX_BUFFERS = 7,
GLX_RED_SIZE = 8,
GLX_GREEN_SIZE = 9,
GLX_BLUE_SIZE = 10,
GLX_ALPHA_SIZE = 11,
GLX_DEPTH_SIZE = 12,
GLX_STENCIL_SIZE = 13,
GLX_ACCUM_RED_SIZE = 14,
GLX_ACCUM_GREEN_SIZE = 15,
GLX_ACCUM_BLUE_SIZE = 16,
GLX_ACCUM_ALPHA_SIZE = 17,
/* GLX_EXT_visual_info extension */
GLX_X_VISUAL_TYPE_EXT = 0x22,
GLX_TRANSPARENT_TYPE_EXT = 0x23,
GLX_TRANSPARENT_INDEX_VALUE_EXT = 0x24,
GLX_TRANSPARENT_RED_VALUE_EXT = 0x25,
GLX_TRANSPARENT_GREEN_VALUE_EXT = 0x26,
GLX_TRANSPARENT_BLUE_VALUE_EXT = 0x27,
GLX_TRANSPARENT_ALPHA_VALUE_EXT = 0x28
};
#define GLX_USE_GL 1
#define GLX_BUFFER_SIZE 2
#define GLX_LEVEL 3
#define GLX_RGBA 4
#define GLX_DOUBLEBUFFER 5
#define GLX_STEREO 6
#define GLX_AUX_BUFFERS 7
#define GLX_RED_SIZE 8
#define GLX_GREEN_SIZE 9
#define GLX_BLUE_SIZE 10
#define GLX_ALPHA_SIZE 11
#define GLX_DEPTH_SIZE 12
#define GLX_STENCIL_SIZE 13
#define GLX_ACCUM_RED_SIZE 14
#define GLX_ACCUM_GREEN_SIZE 15
#define GLX_ACCUM_BLUE_SIZE 16
#define GLX_ACCUM_ALPHA_SIZE 17
/* GLX_EXT_visual_info extension */
#define GLX_X_VISUAL_TYPE_EXT 0x22
#define GLX_TRANSPARENT_TYPE_EXT 0x23
#define GLX_TRANSPARENT_INDEX_VALUE_EXT 0x24
#define GLX_TRANSPARENT_RED_VALUE_EXT 0x25
#define GLX_TRANSPARENT_GREEN_VALUE_EXT 0x26
#define GLX_TRANSPARENT_BLUE_VALUE_EXT 0x27
#define GLX_TRANSPARENT_ALPHA_VALUE_EXT 0x28




/* /*

+ 8
- 6
src/mesa/Makefile.X11 View File

# $Id: Makefile.X11,v 1.6 1999/10/08 09:27:09 keithw Exp $
# $Id: Makefile.X11,v 1.7 1999/11/11 01:22:28 brianp Exp $


# Mesa 3-D graphics library # Mesa 3-D graphics library
# Version: 3.1
# Version: 3.3
# Copyright (C) 1995-1999 Brian Paul # Copyright (C) 1995-1999 Brian Paul


# Makefile for core library # Makefile for core library
INCDIR = ../include INCDIR = ../include
LIBDIR = ../lib LIBDIR = ../lib



CORE_SOURCES = \ CORE_SOURCES = \
glapi.c \
glapinoop.c \
accum.c \ accum.c \
alpha.c \ alpha.c \
alphabuf.c \ alphabuf.c \
api1.c \
api2.c \
apiext.c \
attrib.c \ attrib.c \
bbox.c \ bbox.c \
bitmap.c \ bitmap.c \
cva.c \ cva.c \
debug_xform.c \ debug_xform.c \
depth.c \ depth.c \
dispatch.c \
dlist.c \ dlist.c \
drawpix.c \ drawpix.c \
enable.c \ enable.c \
glmisc.c \ glmisc.c \
hash.c \ hash.c \
image.c \ image.c \
imaging.c \
light.c \ light.c \
lines.c \ lines.c \
logic.c \ logic.c \
masking.c \ masking.c \
matrix.c \ matrix.c \
mem.c \
mmath.c \ mmath.c \
mthreads.c \ mthreads.c \
pb.c \ pb.c \
pixel.c \ pixel.c \
pipeline.c \ pipeline.c \
points.c \ points.c \
pointers.c \
polygon.c \ polygon.c \
quads.c \ quads.c \
rastpos.c \ rastpos.c \

+ 4
- 12
src/mesa/drivers/x11/fakeglx.c View File

/* $Id: fakeglx.c,v 1.12 1999/10/27 09:50:10 brianp Exp $ */
/* $Id: fakeglx.c,v 1.13 1999/11/11 01:29:28 brianp Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library






#ifdef HAVE_CONFIG_H
#include "conf.h"
#endif

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include "GL/gl.h"
#include "glxheader.h"
#include "GL/xmesa.h" #include "GL/xmesa.h"
#include "context.h" #include "context.h"
#include "config.h" #include "config.h"
{ {
if (ctx && drawable) { if (ctx && drawable) {
XMesaBuffer buffer; XMesaBuffer buffer;
XMesaContext xmctx = (XMesaContext) ctx;


if (drawable==MakeCurrent_PrevDrawable && ctx==MakeCurrent_PrevContext) { if (drawable==MakeCurrent_PrevDrawable && ctx==MakeCurrent_PrevContext) {
buffer = MakeCurrent_PrevBuffer; buffer = MakeCurrent_PrevBuffer;
} }
if (!buffer) { if (!buffer) {
/* drawable must be a new window! */ /* drawable must be a new window! */
buffer = XMesaCreateWindowBuffer2( ctx->xm_visual, drawable, ctx );
buffer = XMesaCreateWindowBuffer2( xmctx->xm_visual, drawable, ctx );
if (!buffer) { if (!buffer) {
/* Out of memory, or context/drawable depth mismatch */ /* Out of memory, or context/drawable depth mismatch */
return False; return False;

+ 71
- 0
src/mesa/drivers/x11/glxheader.h View File

/* $Id: glxheader.h,v 1.1 1999/11/11 01:29:28 brianp Exp $ */

/*
* Mesa 3-D graphics library
* Version: 3.3
*
* Copyright (C) 1999 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/


#ifndef GLX_HEADER_H
#define GLX_HEADER_H


#ifdef HAVE_CONFIG_H
#include "conf.h"
#endif


#include "glheader.h"


#ifdef XFree86Server

# include "resource.h"
# include "windowstr.h"
# include "gcstruct.h"
# include "GL/xf86glx.h"
# include "xf86glx_util.h"

#else

# ifdef GLX_DIRECT_RENDERING
# include "dri_mesaint.h"
# endif
# include <X11/Xlib.h>
# include <X11/Xutil.h>
# ifdef USE_XSHM /* was SHM */
# include <sys/ipc.h>
# include <sys/shm.h>
# include <X11/extensions/XShm.h>
# endif

#endif



/* this silences a compiler warning on several systems */
struct timespec;
struct itimerspec;



#endif /*GLX_HEADER*/

+ 3
- 3
src/mesa/drivers/x11/xfonts.c View File

/* $Id: xfonts.c,v 1.2 1999/10/13 18:49:47 brianp Exp $ */
/* $Id: xfonts.c,v 1.3 1999/11/11 01:29:28 brianp Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
* Version: 3.1
* Version: 3.3
* *
* Copyright (C) 1999 Brian Paul All Rights Reserved. * Copyright (C) 1999 Brian Paul All Rights Reserved.
* *
#include "GL/xmesa.h" #include "GL/xmesa.h"
#include "context.h" #include "context.h"
#include "fakeglx.h" #include "fakeglx.h"
#include "macros.h"
#include "mem.h"
#include "xmesaP.h" #include "xmesaP.h"


/* Some debugging info. */ /* Some debugging info. */

+ 3505
- 0
src/mesa/glapi/glapi.c
File diff suppressed because it is too large
View File


+ 591
- 0
src/mesa/glapi/glapi.h View File

/* $Id: glapi.h,v 1.1 1999/11/11 01:22:26 brianp Exp $ */

/*
* Mesa 3-D graphics library
* Version: 3.3
*
* Copyright (C) 1999 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/


/*
* This file is not specific to Mesa. It defines a dispatch table
* which could be used by any number of OpenGL implementations.
* It's designed to be gl.h-independent as well. That is, it does
* not depend on any particular extensions being defined in the gl.h
* header. We #define extension symbols (like _GLAPI_EXT_blend_color)
* to determine which entry points to compile. Clients of this dispatcher
* (like Mesa) can #ifdef test these symbols to know how to fill in the
* table.
*/


#ifndef _GLAPI_H
#define _GLAPI_H


#include "GL/gl.h"


/* Which OpenGL API revisisions are supported by the table: */
#define _GLAPI_VERSION_1_1 1
#define _GLAPI_VERSION_1_2 1

/* And which extensions: */
#define _GLAPI_ARB_imaging 1
#define _GLAPI_ARB_multitexture 1
#define _GLAPI_EXT_color_table 1
#define _GLAPI_EXT_compiled_vertex_array 1
#define _GLAPI_EXT_point_parameters 1
#define _GLAPI_EXT_polygon_offset 1
#define _GLAPI_EXT_blend_minmax 1
#define _GLAPI_EXT_blend_color 1
#define _GLAPI_EXT_texture3D 1
#define _GLAPI_EXT_texture_object 1
#define _GLAPI_EXT_vertex_array 1
#define _GLAPI_INGR_blend_func_separate 1
#define _GLAPI_MESA_window_pos 1
#define _GLAPI_MESA_resize_buffers 1




/*
* This struct contains pointers for all the GL API entrypoints
* plus some reserved slots for dynamic extensions.
*
*/
struct _glapi_table
{
/*
* OpenGL 1.0
*/
void (*Accum)(GLenum, GLfloat);
void (*AlphaFunc)(GLenum, GLclampf);
void (*Begin)(GLenum);
void (*Bitmap)(GLsizei, GLsizei, GLfloat, GLfloat, GLfloat, GLfloat, const GLubyte *);
void (*BlendFunc)(GLenum, GLenum);
void (*CallList)(GLuint list);
void (*CallLists)(GLsizei, GLenum, const GLvoid *);
void (*Clear)(GLbitfield);
void (*ClearAccum)(GLfloat, GLfloat, GLfloat, GLfloat);
void (*ClearColor)(GLclampf, GLclampf, GLclampf, GLclampf);
void (*ClearDepth)(GLclampd);
void (*ClearIndex)(GLfloat);
void (*ClearStencil)(GLint);
void (*ClipPlane)(GLenum, const GLdouble *);
void (*Color3b)(GLbyte, GLbyte, GLbyte);
void (*Color3bv)(const GLbyte *);
void (*Color3d)(GLdouble, GLdouble, GLdouble);
void (*Color3dv)(const GLdouble *);
void (*Color3f)(GLfloat, GLfloat, GLfloat);
void (*Color3fv)(const GLfloat *);
void (*Color3i)(GLint, GLint, GLint);
void (*Color3iv)(const GLint *);
void (*Color3s)(GLshort, GLshort, GLshort);
void (*Color3sv)(const GLshort *);
void (*Color3ub)(GLubyte, GLubyte, GLubyte);
void (*Color3ubv)(const GLubyte *);
void (*Color3ui)(GLuint, GLuint, GLuint);
void (*Color3uiv)(const GLuint *);
void (*Color3us)(GLushort, GLushort, GLushort);
void (*Color3usv)(const GLushort *);
void (*Color4b)(GLbyte, GLbyte, GLbyte, GLbyte);
void (*Color4bv)(const GLbyte *);
void (*Color4d)(GLdouble, GLdouble, GLdouble, GLdouble);
void (*Color4dv)(const GLdouble *);
void (*Color4f)(GLfloat, GLfloat, GLfloat, GLfloat);
void (*Color4fv)(const GLfloat *);
void (*Color4i)(GLint, GLint, GLint, GLint);
void (*Color4iv)(const GLint *);
void (*Color4s)(GLshort, GLshort, GLshort, GLshort);
void (*Color4sv)(const GLshort *);
void (*Color4ub)(GLubyte, GLubyte, GLubyte, GLubyte);
void (*Color4ubv)(const GLubyte *);
void (*Color4ui)(GLuint, GLuint, GLuint, GLuint);
void (*Color4uiv)(const GLuint *);
void (*Color4us)(GLushort, GLushort, GLushort, GLushort);
void (*Color4usv)(const GLushort *);
void (*ColorMask)(GLboolean, GLboolean, GLboolean, GLboolean);
void (*ColorMaterial)(GLenum, GLenum);
void (*CopyPixels)(GLint, GLint, GLsizei, GLsizei, GLenum);
void (*CullFace)(GLenum);
void (*DeleteLists)(GLuint, GLsizei);
void (*DepthFunc)(GLenum);
void (*DepthMask)(GLboolean);
void (*DepthRange)(GLclampd, GLclampd);
void (*Disable)(GLenum);
void (*DrawBuffer)(GLenum);
void (*DrawPixels)(GLsizei, GLsizei, GLenum, GLenum, const GLvoid *);
void (*EdgeFlag)(GLboolean);
void (*EdgeFlagv)(const GLboolean *);
void (*Enable)(GLenum);
void (*End)(void);
void (*EndList)(void);
void (*EvalCoord1d)(GLdouble);
void (*EvalCoord1dv)(const GLdouble *);
void (*EvalCoord1f)(GLfloat);
void (*EvalCoord1fv)(const GLfloat *);
void (*EvalCoord2d)(GLdouble u, GLdouble);
void (*EvalCoord2dv)(const GLdouble *);
void (*EvalCoord2f)(GLfloat u, GLfloat);
void (*EvalCoord2fv)(const GLfloat *);
void (*EvalMesh1)(GLenum, GLint, GLint);
void (*EvalMesh2)(GLenum, GLint, GLint, GLint, GLint);
void (*EvalPoint1)(GLint);
void (*EvalPoint2)(GLint, GLint);
void (*FeedbackBuffer)(GLsizei, GLenum, GLfloat *);
void (*Finish)(void);
void (*Flush)(void);
void (*Fogf)(GLenum, GLfloat);
void (*Fogfv)(GLenum, const GLfloat *);
void (*Fogi)(GLenum, GLint);
void (*Fogiv)(GLenum, const GLint *);
void (*FrontFace)(GLenum);
void (*Frustum)(GLdouble, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble);
GLuint (*GenLists)(GLsizei);
void (*GetBooleanv)(GLenum, GLboolean *);
void (*GetClipPlane)(GLenum, GLdouble *);
void (*GetDoublev)(GLenum, GLdouble *);
GLenum (*GetError)(void);
void (*GetFloatv)(GLenum, GLfloat *);
void (*GetIntegerv)(GLenum, GLint *);
void (*GetLightfv)(GLenum light, GLenum, GLfloat *);
void (*GetLightiv)(GLenum light, GLenum, GLint *);
void (*GetMapdv)(GLenum, GLenum, GLdouble *);
void (*GetMapfv)(GLenum, GLenum, GLfloat *);
void (*GetMapiv)(GLenum, GLenum, GLint *);
void (*GetMaterialfv)(GLenum, GLenum, GLfloat *);
void (*GetMaterialiv)(GLenum, GLenum, GLint *);
void (*GetPixelMapfv)(GLenum, GLfloat *);
void (*GetPixelMapuiv)(GLenum, GLuint *);
void (*GetPixelMapusv)(GLenum, GLushort *);
void (*GetPolygonStipple)(GLubyte *);
const GLubyte* (*GetString)(GLenum name);
void (*GetTexEnvfv)(GLenum, GLenum, GLfloat *);
void (*GetTexEnviv)(GLenum, GLenum, GLint *);
void (*GetTexGendv)(GLenum coord, GLenum, GLdouble *);
void (*GetTexGenfv)(GLenum coord, GLenum, GLfloat *);
void (*GetTexGeniv)(GLenum coord, GLenum, GLint *);
void (*GetTexImage)(GLenum, GLint level, GLenum, GLenum, GLvoid *);
void (*GetTexLevelParameterfv)(GLenum, GLint, GLenum, GLfloat *);
void (*GetTexLevelParameteriv)(GLenum, GLint, GLenum, GLint *);
void (*GetTexParameterfv)(GLenum, GLenum, GLfloat *);
void (*GetTexParameteriv)(GLenum, GLenum, GLint *);
void (*Hint)(GLenum, GLenum);
void (*IndexMask)(GLuint);
void (*Indexd)(GLdouble);
void (*Indexdv)(const GLdouble *);
void (*Indexf)(GLfloat);
void (*Indexfv)(const GLfloat *);
void (*Indexi)(GLint);
void (*Indexiv)(const GLint *);
void (*Indexs)(GLshort);
void (*Indexsv)(const GLshort *);
void (*InitNames)(void);
GLboolean (*IsEnabled)(GLenum);
GLboolean (*IsList)(GLuint);
void (*LightModelf)(GLenum, GLfloat);
void (*LightModelfv)(GLenum, const GLfloat *);
void (*LightModeli)(GLenum, GLint);
void (*LightModeliv)(GLenum, const GLint *);
void (*Lightf)(GLenum light, GLenum, GLfloat);
void (*Lightfv)(GLenum light, GLenum, const GLfloat *);
void (*Lighti)(GLenum light, GLenum, GLint);
void (*Lightiv)(GLenum light, GLenum, const GLint *);
void (*LineStipple)(GLint factor, GLushort);
void (*LineWidth)(GLfloat);
void (*ListBase)(GLuint);
void (*LoadIdentity)(void);
void (*LoadMatrixd)(const GLdouble *);
void (*LoadMatrixf)(const GLfloat *);
void (*LoadName)(GLuint);
void (*LogicOp)(GLenum);
void (*Map1d)(GLenum, GLdouble, GLdouble, GLint, GLint, const GLdouble *);
void (*Map1f)(GLenum, GLfloat, GLfloat, GLint, GLint, const GLfloat *);
void (*Map2d)(GLenum, GLdouble, GLdouble, GLint, GLint, GLdouble, GLdouble, GLint, GLint, const GLdouble *);
void (*Map2f)(GLenum, GLfloat, GLfloat, GLint, GLint, GLfloat, GLfloat, GLint, GLint, const GLfloat *);
void (*MapGrid1d)(GLint, GLdouble, GLdouble);
void (*MapGrid1f)(GLint, GLfloat, GLfloat);
void (*MapGrid2d)(GLint, GLdouble, GLdouble, GLint, GLdouble, GLdouble);
void (*MapGrid2f)(GLint, GLfloat, GLfloat, GLint, GLfloat, GLfloat);
void (*Materialf)(GLenum, GLenum, GLfloat);
void (*Materialfv)(GLenum, GLenum, const GLfloat *);
void (*Materiali)(GLenum, GLenum, GLint);
void (*Materialiv)(GLenum, GLenum, const GLint *);
void (*MatrixMode)(GLenum);
void (*MultMatrixd)(const GLdouble *);
void (*MultMatrixf)(const GLfloat *);
void (*NewList)(GLuint list, GLenum);
void (*Normal3b)(GLbyte, GLbyte, GLbyte);
void (*Normal3bv)(const GLbyte *);
void (*Normal3d)(GLdouble, GLdouble, GLdouble);
void (*Normal3dv)(const GLdouble *);
void (*Normal3f)(GLfloat, GLfloat, GLfloat);
void (*Normal3fv)(const GLfloat *);
void (*Normal3i)(GLint, GLint, GLint);
void (*Normal3iv)(const GLint *);
void (*Normal3s)(GLshort, GLshort, GLshort);
void (*Normal3sv)(const GLshort *);
void (*Ortho)(GLdouble, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble);
void (*PassThrough)(GLfloat);
void (*PixelMapfv)(GLenum, GLint, const GLfloat *);
void (*PixelMapuiv)(GLenum, GLint, const GLuint *);
void (*PixelMapusv)(GLenum, GLint, const GLushort *);
void (*PixelStoref)(GLenum, GLfloat);
void (*PixelStorei)(GLenum, GLint);
void (*PixelTransferf)(GLenum, GLfloat);
void (*PixelTransferi)(GLenum, GLint);
void (*PixelZoom)(GLfloat, GLfloat);
void (*PointSize)(GLfloat);
void (*PolygonMode)(GLenum, GLenum);
void (*PolygonOffset)(GLfloat, GLfloat);
void (*PolygonStipple)(const GLubyte *);
void (*PopAttrib)(void);
void (*PopMatrix)(void);
void (*PopName)(void);
void (*PushAttrib)(GLbitfield);
void (*PushMatrix)(void);
void (*PushName)(GLuint);
void (*RasterPos2d)(GLdouble, GLdouble);
void (*RasterPos2dv)(const GLdouble *);
void (*RasterPos2f)(GLfloat, GLfloat);
void (*RasterPos2fv)(const GLfloat *);
void (*RasterPos2i)(GLint, GLint);
void (*RasterPos2iv)(const GLint *);
void (*RasterPos2s)(GLshort, GLshort);
void (*RasterPos2sv)(const GLshort *);
void (*RasterPos3d)(GLdouble, GLdouble, GLdouble);
void (*RasterPos3dv)(const GLdouble *);
void (*RasterPos3f)(GLfloat, GLfloat, GLfloat);
void (*RasterPos3fv)(const GLfloat *);
void (*RasterPos3i)(GLint, GLint, GLint);
void (*RasterPos3iv)(const GLint *);
void (*RasterPos3s)(GLshort, GLshort, GLshort);
void (*RasterPos3sv)(const GLshort *);
void (*RasterPos4d)(GLdouble, GLdouble, GLdouble, GLdouble);
void (*RasterPos4dv)(const GLdouble *);
void (*RasterPos4f)(GLfloat, GLfloat, GLfloat, GLfloat);
void (*RasterPos4fv)(const GLfloat *);
void (*RasterPos4i)(GLint, GLint, GLint, GLint);
void (*RasterPos4iv)(const GLint *);
void (*RasterPos4s)(GLshort, GLshort, GLshort, GLshort);
void (*RasterPos4sv)(const GLshort *);
void (*ReadBuffer)(GLenum);
void (*ReadPixels)(GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, GLvoid *);
void (*Rectd)(GLdouble, GLdouble, GLdouble, GLdouble);
void (*Rectdv)(const GLdouble *, const GLdouble *);
void (*Rectf)(GLfloat, GLfloat, GLfloat, GLfloat);
void (*Rectfv)(const GLfloat *, const GLfloat *);
void (*Recti)(GLint, GLint, GLint, GLint);
void (*Rectiv)(const GLint *, const GLint *);
void (*Rects)(GLshort, GLshort, GLshort, GLshort);
void (*Rectsv)(const GLshort *, const GLshort *);
GLint (*RenderMode)(GLenum);
void (*Rotated)(GLdouble, GLdouble, GLdouble, GLdouble);
void (*Rotatef)(GLfloat, GLfloat, GLfloat, GLfloat);
void (*Scaled)(GLdouble, GLdouble, GLdouble);
void (*Scalef)(GLfloat, GLfloat, GLfloat);
void (*Scissor)(GLint, GLint, GLsizei, GLsizei);
void (*SelectBuffer)(GLsizei, GLuint *);
void (*ShadeModel)(GLenum);
void (*StencilFunc)(GLenum, GLint, GLuint);
void (*StencilMask)(GLuint);
void (*StencilOp)(GLenum, GLenum, GLenum);
void (*TexCoord1d)(GLdouble);
void (*TexCoord1dv)(const GLdouble *);
void (*TexCoord1f)(GLfloat);
void (*TexCoord1fv)(const GLfloat *);
void (*TexCoord1i)(GLint);
void (*TexCoord1iv)(const GLint *);
void (*TexCoord1s)(GLshort);
void (*TexCoord1sv)(const GLshort *);
void (*TexCoord2d)(GLdouble, GLdouble);
void (*TexCoord2dv)(const GLdouble *);
void (*TexCoord2f)(GLfloat, GLfloat);
void (*TexCoord2fv)(const GLfloat *);
void (*TexCoord2i)(GLint, GLint);
void (*TexCoord2iv)(const GLint *);
void (*TexCoord2s)(GLshort, GLshort);
void (*TexCoord2sv)(const GLshort *);
void (*TexCoord3d)(GLdouble, GLdouble, GLdouble);
void (*TexCoord3dv)(const GLdouble *);
void (*TexCoord3f)(GLfloat, GLfloat, GLfloat);
void (*TexCoord3fv)(const GLfloat *);
void (*TexCoord3i)(GLint, GLint, GLint);
void (*TexCoord3iv)(const GLint *);
void (*TexCoord3s)(GLshort, GLshort, GLshort);
void (*TexCoord3sv)(const GLshort *);
void (*TexCoord4d)(GLdouble, GLdouble, GLdouble, GLdouble);
void (*TexCoord4dv)(const GLdouble *);
void (*TexCoord4f)(GLfloat, GLfloat, GLfloat, GLfloat);
void (*TexCoord4fv)(const GLfloat *);
void (*TexCoord4i)(GLint, GLint, GLint, GLint);
void (*TexCoord4iv)(const GLint *);
void (*TexCoord4s)(GLshort, GLshort, GLshort, GLshort);
void (*TexCoord4sv)(const GLshort *);
void (*TexEnvf)(GLenum, GLenum, GLfloat);
void (*TexEnvfv)(GLenum, GLenum, const GLfloat *);
void (*TexEnvi)(GLenum, GLenum, GLint);
void (*TexEnviv)(GLenum, GLenum, const GLint *);
void (*TexGend)(GLenum, GLenum, GLdouble);
void (*TexGendv)(GLenum, GLenum, const GLdouble *);
void (*TexGenf)(GLenum, GLenum, GLfloat);
void (*TexGenfv)(GLenum, GLenum, const GLfloat *);
void (*TexGeni)(GLenum, GLenum, GLint);
void (*TexGeniv)(GLenum, GLenum, const GLint *);
void (*TexImage1D)(GLenum, GLint, GLint, GLsizei, GLint, GLenum, GLenum, const GLvoid *);
void (*TexImage2D)(GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *);
void (*TexParameterf)(GLenum, GLenum, GLfloat);
void (*TexParameterfv)(GLenum, GLenum, const GLfloat *);
void (*TexParameteri)(GLenum, GLenum, GLint);
void (*TexParameteriv)(GLenum, GLenum, const GLint *);
void (*Translated)(GLdouble, GLdouble, GLdouble);
void (*Translatef)(GLfloat, GLfloat, GLfloat);
void (*Vertex2d)(GLdouble, GLdouble);
void (*Vertex2dv)(const GLdouble *);
void (*Vertex2f)(GLfloat, GLfloat);
void (*Vertex2fv)(const GLfloat *);
void (*Vertex2i)(GLint, GLint);
void (*Vertex2iv)(const GLint *);
void (*Vertex2s)(GLshort, GLshort);
void (*Vertex2sv)(const GLshort *);
void (*Vertex3d)(GLdouble, GLdouble, GLdouble);
void (*Vertex3dv)(const GLdouble *);
void (*Vertex3f)(GLfloat, GLfloat, GLfloat);
void (*Vertex3fv)(const GLfloat *);
void (*Vertex3i)(GLint, GLint, GLint);
void (*Vertex3iv)(const GLint *);
void (*Vertex3s)(GLshort, GLshort, GLshort);
void (*Vertex3sv)(const GLshort *);
void (*Vertex4d)(GLdouble, GLdouble, GLdouble, GLdouble);
void (*Vertex4dv)(const GLdouble *);
void (*Vertex4f)(GLfloat, GLfloat, GLfloat, GLfloat);
void (*Vertex4fv)(const GLfloat *);
void (*Vertex4i)(GLint, GLint, GLint, GLint);
void (*Vertex4iv)(const GLint *);
void (*Vertex4s)(GLshort, GLshort, GLshort, GLshort);
void (*Vertex4sv)(const GLshort *);
void (*Viewport)(GLint, GLint, GLsizei, GLsizei);

/*
* OpenGL 1.1
*/
#ifdef _GLAPI_VERSION_1_1
GLboolean (*AreTexturesResident)(GLsizei, const GLuint *, GLboolean *);
void (*ArrayElement)(GLint);
void (*BindTexture)(GLenum, GLuint);
void (*ColorPointer)(GLint, GLenum, GLsizei, const GLvoid *);
void (*CopyTexImage1D)(GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLint);
void (*CopyTexImage2D)(GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLsizei, GLint);
void (*CopyTexSubImage1D)(GLenum, GLint, GLint, GLint, GLint, GLsizei);
void (*CopyTexSubImage2D)(GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei);
void (*DeleteTextures)(GLsizei, const GLuint *);
void (*DisableClientState)(GLenum);
void (*DrawArrays)(GLenum, GLint, GLsizei);
void (*DrawElements)(GLenum, GLsizei, GLenum, const GLvoid *);
void (*EdgeFlagPointer)(GLsizei, const GLvoid *);
void (*EnableClientState)(GLenum);
void (*GenTextures)(GLsizei, GLuint *);
void (*GetPointerv)(GLenum, GLvoid **);
void (*IndexPointer)(GLenum, GLsizei, const GLvoid *);
void (*Indexub)(GLubyte);
void (*Indexubv)(const GLubyte *);
void (*InterleavedArrays)(GLenum, GLsizei, const GLvoid *);
GLboolean (*IsTexture)(GLuint);
void (*NormalPointer)(GLenum, GLsizei, const GLvoid *);
void (*PopClientAttrib)(void);
void (*PrioritizeTextures)(GLsizei, const GLuint *, const GLclampf *);
void (*PushClientAttrib)(GLbitfield);
void (*TexCoordPointer)(GLint, GLenum, GLsizei, const GLvoid *);
void (*TexSubImage1D)(GLenum, GLint, GLint, GLsizei, GLenum, GLenum, const GLvoid *);
void (*TexSubImage2D)(GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *);
void (*VertexPointer)(GLint, GLenum, GLsizei, const GLvoid *);
#endif

/*
* OpenGL 1.2
*/
#ifdef _GLAPI_VERSION_1_2
void (*CopyTexSubImage3D)(GLenum, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei);
void (*DrawRangeElements)(GLenum, GLuint, GLuint, GLsizei, GLenum, const GLvoid *);
void (*TexImage3D)(GLenum, GLint, GLint, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *);
void (*TexSubImage3D)(GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *);

#ifdef _GLAPI_ARB_imaging
void (*BlendColor)(GLclampf, GLclampf, GLclampf, GLclampf);
void (*BlendEquation)(GLenum);
void (*ColorSubTable)(GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *);
void (*ColorTable)(GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *);
void (*ColorTableParameterfv)(GLenum, GLenum, const GLfloat *);
void (*ColorTableParameteriv)(GLenum, GLenum, const GLint *);
void (*ConvolutionFilter1D)(GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *);
void (*ConvolutionFilter2D)(GLenum, GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *);
void (*ConvolutionParameterf)(GLenum, GLenum, GLfloat);
void (*ConvolutionParameterfv)(GLenum, GLenum, const GLfloat *);
void (*ConvolutionParameteri)(GLenum, GLenum, GLint);
void (*ConvolutionParameteriv)(GLenum, GLenum, const GLint *);
void (*CopyColorSubTable)(GLenum, GLsizei, GLint, GLint, GLsizei);
void (*CopyColorTable)(GLenum, GLenum, GLint, GLint, GLsizei);
void (*CopyConvolutionFilter1D)(GLenum, GLenum, GLint x, GLint y, GLsizei);
void (*CopyConvolutionFilter2D)(GLenum, GLenum, GLint x, GLint y, GLsizei, GLsizei);
void (*GetColorTable)(GLenum, GLenum, GLenum, GLvoid *);
void (*GetColorTableParameterfv)(GLenum, GLenum, GLfloat *);
void (*GetColorTableParameteriv)(GLenum, GLenum, GLint *);
void (*GetConvolutionFilter)(GLenum, GLenum, GLenum, GLvoid *);
void (*GetConvolutionParameterfv)(GLenum, GLenum, GLfloat *);
void (*GetConvolutionParameteriv)(GLenum, GLenum, GLint *);
void (*GetHistogram)(GLenum, GLboolean, GLenum, GLenum, GLvoid *);
void (*GetHistogramParameterfv)(GLenum, GLenum, GLfloat *);
void (*GetHistogramParameteriv)(GLenum, GLenum, GLint *);
void (*GetMinmax)(GLenum, GLboolean, GLenum, GLenum, GLvoid *);
void (*GetMinmaxParameterfv)(GLenum, GLenum, GLfloat *);
void (*GetMinmaxParameteriv)(GLenum, GLenum, GLint *);
void (*GetSeparableFilter)(GLenum, GLenum, GLenum, GLvoid *, GLvoid *, GLvoid *);
void (*Histogram)(GLenum, GLsizei, GLenum, GLboolean);
void (*Minmax)(GLenum, GLenum, GLboolean);
void (*ResetHistogram)(GLenum);
void (*ResetMinmax)(GLenum);
void (*SeparableFilter2D)(GLenum, GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *, const GLvoid *);
#endif /*_GLAPI_ARB_imaging*/
#endif /*_GLAPI_VERSION_1_2*/


/*
* Extensions
*/

#ifdef _GLAPI_EXT_color_table
void (*ColorTableEXT)(GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *);
void (*ColorSubTableEXT)(GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *);
void (*GetColorTableEXT)(GLenum, GLenum, GLenum, GLvoid *);
void (*GetColorTableParameterfvEXT)(GLenum, GLenum, GLfloat *);
void (*GetColorTableParameterivEXT)(GLenum, GLenum, GLint *);
#endif

#ifdef _GLAPI_EXT_compiled_vertex_array
void (*LockArraysEXT)(GLint, GLsizei);
void (*UnlockArraysEXT)(void);
#endif

#ifdef _GLAPI_EXT_point_parameters
void (*PointParameterfEXT)(GLenum, GLfloat);
void (*PointParameterfvEXT)(GLenum, const GLfloat *);
#endif

#ifdef _GLAPI_EXT_polygon_offset
void (*PolygonOffsetEXT)(GLfloat, GLfloat);
#endif

#ifdef _GLAPI_EXT_blend_minmax
void (*BlendEquationEXT)(GLenum);
#endif

#ifdef _GLAPI_EXT_blend_color
void (*BlendColorEXT)(GLclampf, GLclampf, GLclampf, GLclampf);
#endif

#ifdef _GLAPI_ARB_multitexture
void (*ActiveTextureARB)(GLenum);
void (*ClientActiveTextureARB)(GLenum);
void (*MultiTexCoord1dARB)(GLenum, GLdouble);
void (*MultiTexCoord1dvARB)(GLenum, const GLdouble *);
void (*MultiTexCoord1fARB)(GLenum, GLfloat);
void (*MultiTexCoord1fvARB)(GLenum, const GLfloat *);
void (*MultiTexCoord1iARB)(GLenum, GLint);
void (*MultiTexCoord1ivARB)(GLenum, const GLint *);
void (*MultiTexCoord1sARB)(GLenum, GLshort);
void (*MultiTexCoord1svARB)(GLenum, const GLshort *);
void (*MultiTexCoord2dARB)(GLenum, GLdouble, GLdouble);
void (*MultiTexCoord2dvARB)(GLenum, const GLdouble *);
void (*MultiTexCoord2fARB)(GLenum, GLfloat, GLfloat);
void (*MultiTexCoord2fvARB)(GLenum, const GLfloat *);
void (*MultiTexCoord2iARB)(GLenum, GLint, GLint);
void (*MultiTexCoord2ivARB)(GLenum, const GLint *);
void (*MultiTexCoord2sARB)(GLenum, GLshort, GLshort);
void (*MultiTexCoord2svARB)(GLenum, const GLshort *);
void (*MultiTexCoord3dARB)(GLenum, GLdouble, GLdouble, GLdouble);
void (*MultiTexCoord3dvARB)(GLenum, const GLdouble *);
void (*MultiTexCoord3fARB)(GLenum, GLfloat, GLfloat, GLfloat);
void (*MultiTexCoord3fvARB)(GLenum, const GLfloat *);
void (*MultiTexCoord3iARB)(GLenum, GLint, GLint, GLint);
void (*MultiTexCoord3ivARB)(GLenum, const GLint *);
void (*MultiTexCoord3sARB)(GLenum, GLshort, GLshort, GLshort);
void (*MultiTexCoord3svARB)(GLenum, const GLshort *);
void (*MultiTexCoord4dARB)(GLenum, GLdouble, GLdouble, GLdouble, GLdouble);
void (*MultiTexCoord4dvARB)(GLenum, const GLdouble *);
void (*MultiTexCoord4fARB)(GLenum, GLfloat, GLfloat, GLfloat, GLfloat);
void (*MultiTexCoord4fvARB)(GLenum, const GLfloat *);
void (*MultiTexCoord4iARB)(GLenum, GLint, GLint, GLint, GLint);
void (*MultiTexCoord4ivARB)(GLenum, const GLint *);
void (*MultiTexCoord4sARB)(GLenum, GLshort, GLshort, GLshort, GLshort);
void (*MultiTexCoord4svARB)(GLenum, const GLshort *);
#endif

#ifdef _GLAPI_INGR_blend_func_separate
void (*BlendFuncSeparateINGR)(GLenum, GLenum, GLenum, GLenum);
#endif

#ifdef _GLAPI_MESA_window_pos
void (*WindowPos4fMESA)(GLfloat x, GLfloat y, GLfloat z, GLfloat w);
#endif

#ifdef _GLAPI_MESA_resize_buffers
void (*ResizeBuffersMESA)(void);
#endif

};




extern void
_glapi_set_dispatch(struct _glapi_table *dispatch);


extern struct _glapi_table *
_glapi_get_dispatch(void);


extern const char *
_glapi_get_version(void);


extern const char *
_glapi_get_extensions(void);


extern void
_glapi_check_table(const struct _glapi_table *table);


extern GLint
_glapi_alloc_entrypoint(const char *funcName);


extern GLint
_glapi_get_entrypoint(const char *funcName);


extern const GLvoid *
_glapi_get_proc_address(const char *funcName);


#endif

+ 8
- 6
src/mesa/main/Makefile.X11 View File

# $Id: Makefile.X11,v 1.6 1999/10/08 09:27:09 keithw Exp $
# $Id: Makefile.X11,v 1.7 1999/11/11 01:22:28 brianp Exp $


# Mesa 3-D graphics library # Mesa 3-D graphics library
# Version: 3.1
# Version: 3.3
# Copyright (C) 1995-1999 Brian Paul # Copyright (C) 1995-1999 Brian Paul


# Makefile for core library # Makefile for core library
INCDIR = ../include INCDIR = ../include
LIBDIR = ../lib LIBDIR = ../lib



CORE_SOURCES = \ CORE_SOURCES = \
glapi.c \
glapinoop.c \
accum.c \ accum.c \
alpha.c \ alpha.c \
alphabuf.c \ alphabuf.c \
api1.c \
api2.c \
apiext.c \
attrib.c \ attrib.c \
bbox.c \ bbox.c \
bitmap.c \ bitmap.c \
cva.c \ cva.c \
debug_xform.c \ debug_xform.c \
depth.c \ depth.c \
dispatch.c \
dlist.c \ dlist.c \
drawpix.c \ drawpix.c \
enable.c \ enable.c \
glmisc.c \ glmisc.c \
hash.c \ hash.c \
image.c \ image.c \
imaging.c \
light.c \ light.c \
lines.c \ lines.c \
logic.c \ logic.c \
masking.c \ masking.c \
matrix.c \ matrix.c \
mem.c \
mmath.c \ mmath.c \
mthreads.c \ mthreads.c \
pb.c \ pb.c \
pixel.c \ pixel.c \
pipeline.c \ pipeline.c \
points.c \ points.c \
pointers.c \
polygon.c \ polygon.c \
quads.c \ quads.c \
rastpos.c \ rastpos.c \

+ 9
- 15
src/mesa/main/accum.c View File

/* $Id: accum.c,v 1.10 1999/11/08 07:36:43 brianp Exp $ */
/* $Id: accum.c,v 1.11 1999/11/11 01:22:25 brianp Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
*/ */




/* $XFree86: xc/lib/GL/mesa/src/accum.c,v 1.3 1999/04/04 00:20:17 dawes Exp $ */

#ifdef PC_HEADER #ifdef PC_HEADER
#include "all.h" #include "all.h"
#else #else
#ifndef XFree86Server
#include <assert.h>
#include <limits.h>
#include <stdlib.h>
#include <string.h>
#else
#include "GL/xf86glx.h"
#endif
#include "glheader.h"
#include "accum.h" #include "accum.h"
#include "context.h" #include "context.h"
#include "macros.h"
#include "mem.h"
#include "masking.h" #include "masking.h"
#include "span.h" #include "span.h"
#include "types.h" #include "types.h"






void gl_ClearAccum( GLcontext *ctx,
GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha )
void
_mesa_ClearAccum( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha )
{ {
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glAccum"); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glAccum");


ctx->Accum.ClearColor[0] = CLAMP( red, -1.0, 1.0 ); ctx->Accum.ClearColor[0] = CLAMP( red, -1.0, 1.0 );






void gl_Accum( GLcontext *ctx, GLenum op, GLfloat value )
void
_mesa_Accum( GLenum op, GLfloat value )
{ {
GET_CURRENT_CONTEXT(ctx);
GLuint xpos, ypos, width, height, width4; GLuint xpos, ypos, width, height, width4;
GLfloat acc_scale; GLfloat acc_scale;
GLubyte rgba[MAX_WIDTH][4]; GLubyte rgba[MAX_WIDTH][4];

+ 6
- 5
src/mesa/main/accum.h View File

/* $Id: accum.h,v 1.1 1999/08/19 00:55:41 jtg Exp $ */
/* $Id: accum.h,v 1.2 1999/11/11 01:22:25 brianp Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
extern void gl_alloc_accum_buffer( GLcontext *ctx ); extern void gl_alloc_accum_buffer( GLcontext *ctx );




extern void gl_Accum( GLcontext *ctx, GLenum op, GLfloat value );
extern void gl_clear_accum_buffer( GLcontext *ctx );




extern void gl_ClearAccum( GLcontext *ctx, GLfloat red, GLfloat green,
GLfloat blue, GLfloat alpha );
extern void
_mesa_Accum( GLenum op, GLfloat value );




extern void gl_clear_accum_buffer( GLcontext *ctx );
extern void
_mesa_ClearAccum( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha );




#endif #endif

+ 43
- 20
src/mesa/main/attrib.c View File

/* $Id: attrib.c,v 1.10 1999/11/08 15:28:08 brianp Exp $ */
/* $Id: attrib.c,v 1.11 1999/11/11 01:22:25 brianp Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
*/ */





#include <stdlib.h>

#ifdef PC_HEADER #ifdef PC_HEADER
#include "all.h" #include "all.h"
#else #else
#ifndef XFree86Server
#include <stdio.h>
#else
#include "GL/xf86glx.h"
#endif
#include "glheader.h"
#include "attrib.h" #include "attrib.h"
#include "context.h" #include "context.h"
#include "glmisc.h" #include "glmisc.h"
#include "enable.h" #include "enable.h"
#include "enums.h" #include "enums.h"
#include "macros.h"
#include "mem.h"
#include "simple_list.h" #include "simple_list.h"
#include "texstate.h" #include "texstate.h"
#include "types.h" #include "types.h"
dest->P = src->P; dest->P = src->P;
dest->M = src->M; dest->M = src->M;
dest->MinMagThresh = src->MinMagThresh; dest->MinMagThresh = src->MinMagThresh;
memcpy( dest->Palette, src->Palette,
sizeof(GLubyte) * MAX_TEXTURE_PALETTE_SIZE * 4 );
dest->PaletteSize = src->PaletteSize;
dest->PaletteIntFormat = src->PaletteIntFormat;
dest->PaletteFormat = src->PaletteFormat;
dest->Palette = src->Palette;
dest->Complete = src->Complete; dest->Complete = src->Complete;
dest->SampleFunc = src->SampleFunc; dest->SampleFunc = src->SampleFunc;
} }
MEMCPY( &ctx->Color, attr->data, MEMCPY( &ctx->Color, attr->data,
sizeof(struct gl_colorbuffer_attrib) ); sizeof(struct gl_colorbuffer_attrib) );
if (ctx->Color.DrawBuffer != oldDrawBuffer) { if (ctx->Color.DrawBuffer != oldDrawBuffer) {
gl_DrawBuffer(ctx, ctx->Color.DrawBuffer);
_mesa_DrawBuffer( ctx->Color.DrawBuffer);
} }
if ((ctx->Color.AlphaFunc != oldAlphaFunc || if ((ctx->Color.AlphaFunc != oldAlphaFunc ||
ctx->Color.AlphaRef != oldAlphaRef) && ctx->Color.AlphaRef != oldAlphaRef) &&


#define TEST_AND_UPDATE(VALUE, NEWVALUE, ENUM) \ #define TEST_AND_UPDATE(VALUE, NEWVALUE, ENUM) \
if ((VALUE) != (NEWVALUE)) { \ if ((VALUE) != (NEWVALUE)) { \
gl_set_enable( ctx, ENUM, (NEWVALUE) ); \
_mesa_set_enable( ctx, ENUM, (NEWVALUE) ); \
} }


TEST_AND_UPDATE(ctx->Color.AlphaEnabled, enable->AlphaTest, GL_ALPHA_TEST); TEST_AND_UPDATE(ctx->Color.AlphaEnabled, enable->AlphaTest, GL_ALPHA_TEST);
GLuint i; GLuint i;
for (i=0;i<MAX_CLIP_PLANES;i++) { for (i=0;i<MAX_CLIP_PLANES;i++) {
if (ctx->Transform.ClipEnabled[i] != enable->ClipPlane[i]) if (ctx->Transform.ClipEnabled[i] != enable->ClipPlane[i])
gl_set_enable( ctx, (GLenum) (GL_CLIP_PLANE0 + i), enable->ClipPlane[i] );
_mesa_set_enable( ctx, (GLenum) (GL_CLIP_PLANE0 + i), enable->ClipPlane[i] );
} }
} }
TEST_AND_UPDATE(ctx->Light.ColorMaterialEnabled, enable->ColorMaterial, GL_COLOR_MATERIAL); TEST_AND_UPDATE(ctx->Light.ColorMaterialEnabled, enable->ColorMaterial, GL_COLOR_MATERIAL);
struct gl_viewport_attrib *v = struct gl_viewport_attrib *v =
(struct gl_viewport_attrib *)attr->data; (struct gl_viewport_attrib *)attr->data;
gl_Viewport( ctx, v->X, v->Y, v->Width, v->Height );
gl_DepthRange( ctx, v->Near, v->Far );
_mesa_Viewport( v->X, v->Y, v->Width, v->Height );
_mesa_DepthRange( v->Near, v->Far );
break; break;
} }
default: default:
ctx->NewState = NEW_ALL; ctx->NewState = NEW_ALL;
} }




void
_mesa_PushAttrib( GLbitfield mask )
{
GET_CURRENT_CONTEXT(ctx);
gl_PushAttrib(ctx, mask);
}


void
_mesa_PopAttrib( void )
{
GET_CURRENT_CONTEXT(ctx);
gl_PopAttrib(ctx);
}


void
_mesa_PushClientAttrib( GLbitfield mask )
{
GET_CURRENT_CONTEXT(ctx);
gl_PushClientAttrib(ctx, mask);
}


void
_mesa_PopClientAttrib( void )
{
GET_CURRENT_CONTEXT(ctx);
gl_PopClientAttrib(ctx);
}



+ 15
- 5
src/mesa/main/attrib.h View File

/* $Id: attrib.h,v 1.1 1999/08/19 00:55:41 jtg Exp $ */
/* $Id: attrib.h,v 1.2 1999/11/11 01:22:25 brianp Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
* Version: 3.1
* Version: 3.3
* *
* Copyright (C) 1999 Brian Paul All Rights Reserved. * Copyright (C) 1999 Brian Paul All Rights Reserved.
* *
*/ */







#ifndef ATTRIB_H #ifndef ATTRIB_H
#define ATTRIB_h #define ATTRIB_h


extern void gl_PopClientAttrib( GLcontext *ctx ); extern void gl_PopClientAttrib( GLcontext *ctx );




extern void
_mesa_PushAttrib( GLbitfield mask );

extern void
_mesa_PopAttrib( void );

extern void
_mesa_PushClientAttrib( GLbitfield mask );

extern void
_mesa_PopClientAttrib( void );


#endif #endif

+ 13
- 14
src/mesa/main/blend.c View File

/* $Id: blend.c,v 1.7 1999/11/08 15:28:08 brianp Exp $ */
/* $Id: blend.c,v 1.8 1999/11/11 01:22:25 brianp Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
#ifdef PC_HEADER #ifdef PC_HEADER
#include "all.h" #include "all.h"
#else #else
#ifndef XFree86Server
#include <stdio.h>
#include <assert.h>
#include <stdlib.h>
#else
#include "GL/xf86glx.h"
#endif
#include "glheader.h"
#include "alphabuf.h" #include "alphabuf.h"
#include "blend.h" #include "blend.h"
#include "context.h" #include "context.h"
#endif #endif




void gl_BlendFunc( GLcontext *ctx, GLenum sfactor, GLenum dfactor )
void _mesa_BlendFunc( GLenum sfactor, GLenum dfactor )
{ {
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glBlendFunc"); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glBlendFunc");


if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))


/* GL_INGR_blend_func_separate */ /* GL_INGR_blend_func_separate */
void void
gl_BlendFuncSeparate( GLcontext *ctx, GLenum sfactorRGB, GLenum dfactorRGB,
GLenum sfactorA, GLenum dfactorA )
_mesa_BlendFuncSeparateINGR( GLenum sfactorRGB, GLenum dfactorRGB,
GLenum sfactorA, GLenum dfactorA )
{ {
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glBlendFuncSeparate"); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glBlendFuncSeparate");


if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))




/* This is really an extension function! */ /* This is really an extension function! */
void gl_BlendEquation( GLcontext *ctx, GLenum mode )
void
_mesa_BlendEquationEXT( GLenum mode )
{ {
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glBlendEquation"); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glBlendEquation");


if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))






void gl_BlendColor( GLcontext *ctx, GLclampf red, GLclampf green,
GLclampf blue, GLclampf alpha )
void
_mesa_BlendColorEXT( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha )
{ {
GET_CURRENT_CONTEXT(ctx);
ctx->Color.BlendColor[0] = CLAMP( red, 0.0F, 1.0F ); ctx->Color.BlendColor[0] = CLAMP( red, 0.0F, 1.0F );
ctx->Color.BlendColor[1] = CLAMP( green, 0.0F, 1.0F ); ctx->Color.BlendColor[1] = CLAMP( green, 0.0F, 1.0F );
ctx->Color.BlendColor[2] = CLAMP( blue, 0.0F, 1.0F ); ctx->Color.BlendColor[2] = CLAMP( blue, 0.0F, 1.0F );

+ 6
- 10
src/mesa/main/blend.h View File

/* $Id: blend.h,v 1.1 1999/08/19 00:55:41 jtg Exp $ */
/* $Id: blend.h,v 1.2 1999/11/11 01:22:25 brianp Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
*/ */







#ifndef BLEND_H #ifndef BLEND_H
#define BLEND_H #define BLEND_H






extern void extern void
gl_BlendFunc( GLcontext *ctx, GLenum sfactor, GLenum dfactor );
_mesa_BlendFunc( GLenum sfactor, GLenum dfactor );




extern void extern void
gl_BlendFuncSeparate( GLcontext *ctx, GLenum sfactorRGB, GLenum dfactorRGB,
GLenum sfactorA, GLenum dfactorA );
_mesa_BlendFuncSeparateINGR( GLenum sfactorRGB, GLenum dfactorRGB,
GLenum sfactorA, GLenum dfactorA );




extern void extern void
gl_BlendEquation( GLcontext *ctx, GLenum mode );
_mesa_BlendEquationEXT( GLenum mode );




extern void extern void
gl_BlendColor( GLcontext *ctx, GLclampf red, GLclampf green,
GLclampf blue, GLclampf alpha );
_mesa_BlendColorEXT(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);




#endif #endif

+ 15
- 13
src/mesa/main/clip.c View File

/* $Id: clip.c,v 1.4 1999/11/08 07:36:43 brianp Exp $ */
/* $Id: clip.c,v 1.5 1999/11/11 01:22:25 brianp Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
* Version: 3.1
* Version: 3.3
* *
* Copyright (C) 1999 Brian Paul All Rights Reserved. * Copyright (C) 1999 Brian Paul All Rights Reserved.
* *
*/ */







#ifdef PC_HEADER #ifdef PC_HEADER
#include "all.h" #include "all.h"
#else #else
#ifndef XFree86Server
#include <string.h>
#include <stdlib.h>
#else
#include "GL/xf86glx.h"
#endif
#include "glheader.h"
#include "clip.h" #include "clip.h"
#include "context.h" #include "context.h"
#include "macros.h" #include "macros.h"






void gl_ClipPlane( GLcontext* ctx, GLenum plane, const GLfloat *equation )
void
_mesa_ClipPlane( GLenum plane, const GLdouble *eq )
{ {
GET_CURRENT_CONTEXT(ctx);
GLint p; GLint p;
GLfloat equation[4];

equation[0] = eq[0];
equation[1] = eq[1];
equation[2] = eq[2];
equation[3] = eq[3];


ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glClipPlane"); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glClipPlane");


} }
} }


void gl_GetClipPlane( GLcontext* ctx, GLenum plane, GLdouble *equation )
void
_mesa_GetClipPlane( GLenum plane, GLdouble *equation )
{ {
GET_CURRENT_CONTEXT(ctx);
GLint p; GLint p;


ASSERT_OUTSIDE_BEGIN_END(ctx, "glGetClipPlane"); ASSERT_OUTSIDE_BEGIN_END(ctx, "glGetClipPlane");

+ 3
- 5
src/mesa/main/clip.h View File

/* $Id: clip.h,v 1.2 1999/09/18 20:41:22 keithw Exp $ */
/* $Id: clip.h,v 1.3 1999/11/11 01:22:25 brianp Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
extern void gl_user_cliptest( struct vertex_buffer *VB ); extern void gl_user_cliptest( struct vertex_buffer *VB );




extern void gl_ClipPlane( GLcontext* ctx,
GLenum plane, const GLfloat *equation );
extern void _mesa_ClipPlane( GLenum plane, const GLdouble *equation );


extern void gl_GetClipPlane( GLcontext* ctx,
GLenum plane, GLdouble *equation );
extern void _mesa_GetClipPlane( GLenum plane, GLdouble *equation );




/* /*

+ 220
- 81
src/mesa/main/colortab.c View File

/* $Id: colortab.c,v 1.3 1999/11/08 07:36:43 brianp Exp $ */
/* $Id: colortab.c,v 1.4 1999/11/11 01:22:25 brianp Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
/* $XFree86: xc/lib/GL/mesa/src/colortab.c,v 1.2 1999/04/04 00:20:21 dawes Exp $ */







#ifdef PC_HEADER #ifdef PC_HEADER
#include "all.h" #include "all.h"
#else #else
#ifdef XFree86Server
#include "GL/xf86glx.h"
#endif
#include "glheader.h"
#include "colortab.h" #include "colortab.h"
#include "context.h" #include "context.h"
#include "image.h"
#include "macros.h" #include "macros.h"
#endif #endif


/* /*
* Return GL_TRUE if k is a power of two, else return GL_FALSE. * Return GL_TRUE if k is a power of two, else return GL_FALSE.
*/ */
static GLboolean power_of_two( GLint k )
static GLboolean
power_of_two( GLint k )
{ {
GLint i, m = 1; GLint i, m = 1;
for (i=0; i<32; i++) { for (i=0; i<32; i++) {
} }




static GLint decode_internal_format( GLint format )
static GLint
decode_internal_format( GLint format )
{ {
switch (format) { switch (format) {
case GL_ALPHA: case GL_ALPHA:
} }




void gl_ColorTable( GLcontext *ctx, GLenum target,
GLenum internalFormat, struct gl_image *table )
void
_mesa_ColorTable( GLenum target, GLenum internalFormat,
GLsizei width, GLenum format, GLenum type,
const GLvoid *table )
{ {
GET_CURRENT_CONTEXT(ctx);
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
struct gl_texture_object *texObj; struct gl_texture_object *texObj;
struct gl_palette *palette;
GLboolean proxy = GL_FALSE; GLboolean proxy = GL_FALSE;


ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glColorTable"); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glColorTable");


if (decode_internal_format(internalFormat) < 0) {
gl_error( ctx, GL_INVALID_ENUM, "glColorTable(internalFormat)" );
return;
}

switch (target) { switch (target) {
case GL_TEXTURE_1D: case GL_TEXTURE_1D:
texObj = texUnit->CurrentD[1]; texObj = texUnit->CurrentD[1];
palette = &texObj->Palette;
break; break;
case GL_TEXTURE_2D: case GL_TEXTURE_2D:
texObj = texUnit->CurrentD[2]; texObj = texUnit->CurrentD[2];
palette = &texObj->Palette;
break; break;
case GL_TEXTURE_3D_EXT:
case GL_TEXTURE_3D:
texObj = texUnit->CurrentD[3]; texObj = texUnit->CurrentD[3];
palette = &texObj->Palette;
break; break;
case GL_PROXY_TEXTURE_1D: case GL_PROXY_TEXTURE_1D:
texObj = ctx->Texture.Proxy1D; texObj = ctx->Texture.Proxy1D;
palette = &texObj->Palette;
proxy = GL_TRUE; proxy = GL_TRUE;
break; break;
case GL_PROXY_TEXTURE_2D: case GL_PROXY_TEXTURE_2D:
texObj = ctx->Texture.Proxy2D; texObj = ctx->Texture.Proxy2D;
palette = &texObj->Palette;
proxy = GL_TRUE; proxy = GL_TRUE;
break; break;
case GL_PROXY_TEXTURE_3D_EXT:
case GL_PROXY_TEXTURE_3D:
texObj = ctx->Texture.Proxy3D; texObj = ctx->Texture.Proxy3D;
palette = &texObj->Palette;
proxy = GL_TRUE; proxy = GL_TRUE;
break; break;
case GL_SHARED_TEXTURE_PALETTE_EXT: case GL_SHARED_TEXTURE_PALETTE_EXT:
texObj = NULL; texObj = NULL;
palette = &ctx->Texture.Palette;
break; break;
default: default:
gl_error(ctx, GL_INVALID_ENUM, "glColorTableEXT(target)");
gl_error(ctx, GL_INVALID_ENUM, "glColorTable(target)");
return; return;
} }


/* internalformat = just like glTexImage */
assert(palette);

if (!gl_is_legal_format_and_type(format, type)) {
gl_error(ctx, GL_INVALID_ENUM, "glColorTable(format or type)");
return;
}

if (decode_internal_format(internalFormat) < 0) {
gl_error( ctx, GL_INVALID_ENUM, "glColorTable(internalFormat)" );
return;
}


if (table->Width < 1 || table->Width > MAX_TEXTURE_PALETTE_SIZE
|| !power_of_two(table->Width)) {
gl_error(ctx, GL_INVALID_VALUE, "glColorTableEXT(width)");
if (width < 1 || width > MAX_TEXTURE_PALETTE_SIZE || !power_of_two(width)) {
gl_error(ctx, GL_INVALID_VALUE, "glColorTable(width)");
if (proxy) { if (proxy) {
texObj->PaletteSize = 0;
texObj->PaletteIntFormat = (GLenum) 0;
texObj->PaletteFormat = (GLenum) 0;
palette->Size = 0;
palette->IntFormat = (GLenum) 0;
palette->Format = (GLenum) 0;
} }
return; return;
} }


palette->Size = width;
palette->IntFormat = internalFormat;
palette->Format = (GLenum) decode_internal_format(internalFormat);
if (!proxy) {
_mesa_unpack_ubyte_color_span(ctx, width, palette->Format,
palette->Table, /* dest */
format, type, table,
&ctx->Unpack, GL_FALSE);
}
if (texObj) { if (texObj) {
/* per-texture object palette */ /* per-texture object palette */
texObj->PaletteSize = table->Width;
texObj->PaletteIntFormat = internalFormat;
texObj->PaletteFormat = (GLenum) decode_internal_format(internalFormat);
if (!proxy) {
MEMCPY(texObj->Palette, table->Data, table->Width*table->Components);
if (ctx->Driver.UpdateTexturePalette) {
(*ctx->Driver.UpdateTexturePalette)( ctx, texObj );
}
if (ctx->Driver.UpdateTexturePalette) {
(*ctx->Driver.UpdateTexturePalette)( ctx, texObj );
} }
} }
else { else {
/* shared texture palette */ /* shared texture palette */
ctx->Texture.PaletteSize = table->Width;
ctx->Texture.PaletteIntFormat = internalFormat;
ctx->Texture.PaletteFormat = (GLenum) decode_internal_format(internalFormat);
MEMCPY(ctx->Texture.Palette, table->Data, table->Width*table->Components);
if (ctx->Driver.UpdateTexturePalette) { if (ctx->Driver.UpdateTexturePalette) {
(*ctx->Driver.UpdateTexturePalette)( ctx, NULL ); (*ctx->Driver.UpdateTexturePalette)( ctx, NULL );
} }






void gl_ColorSubTable( GLcontext *ctx, GLenum target,
GLsizei start, struct gl_image *data )
void
_mesa_ColorSubTable( GLenum target, GLsizei start,
GLsizei count, GLenum format, GLenum type,
const GLvoid *table )
{ {
/* XXX TODO */
gl_problem(ctx, "glColorSubTableEXT not implemented");
(void) target;
(void) start;
(void) data;
GET_CURRENT_CONTEXT(ctx);
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
struct gl_texture_object *texObj;
struct gl_palette *palette;
GLint comps;
GLubyte *dest;

ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glColorSubTable");

switch (target) {
case GL_TEXTURE_1D:
texObj = texUnit->CurrentD[1];
palette = &texObj->Palette;
break;
case GL_TEXTURE_2D:
texObj = texUnit->CurrentD[2];
palette = &texObj->Palette;
break;
case GL_TEXTURE_3D:
texObj = texUnit->CurrentD[3];
palette = &texObj->Palette;
break;
case GL_SHARED_TEXTURE_PALETTE_EXT:
texObj = NULL;
palette = &ctx->Texture.Palette;
break;
default:
gl_error(ctx, GL_INVALID_ENUM, "glColorSubTable(target)");
return;
}

assert(palette);

if (!gl_is_legal_format_and_type(format, type)) {
gl_error(ctx, GL_INVALID_ENUM, "glColorSubTable(format or type)");
return;
}

if (count < 1) {
gl_error(ctx, GL_INVALID_VALUE, "glColorSubTable(count)");
return;
}

comps = gl_components_in_format(format);
assert(comps > 0); /* error should be caught sooner */

if (start + count > palette->Size) {
gl_error(ctx, GL_INVALID_VALUE, "glColorSubTable(count)");
return;
}
dest = palette->Table + start * comps * sizeof(GLubyte);
_mesa_unpack_ubyte_color_span(ctx, count, palette->Format, dest,
format, type, table,
&ctx->Unpack, GL_FALSE);

if (texObj) {
/* per-texture object palette */
if (ctx->Driver.UpdateTexturePalette) {
(*ctx->Driver.UpdateTexturePalette)( ctx, texObj );
}
}
else {
/* shared texture palette */
if (ctx->Driver.UpdateTexturePalette) {
(*ctx->Driver.UpdateTexturePalette)( ctx, NULL );
}
}
} }






void gl_GetColorTable( GLcontext *ctx, GLenum target, GLenum format,
GLenum type, GLvoid *table )
void
_mesa_GetColorTable( GLenum target, GLenum format,
GLenum type, GLvoid *table )
{ {
GET_CURRENT_CONTEXT(ctx);
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
struct gl_palette *palette;
GLubyte rgba[MAX_TEXTURE_PALETTE_SIZE][4];
GLint i;

ASSERT_OUTSIDE_BEGIN_END(ctx, "glGetBooleanv"); ASSERT_OUTSIDE_BEGIN_END(ctx, "glGetBooleanv");


switch (target) { switch (target) {
case GL_TEXTURE_1D: case GL_TEXTURE_1D:
palette = &texUnit->CurrentD[1]->Palette;
break; break;
case GL_TEXTURE_2D: case GL_TEXTURE_2D:
palette = &texUnit->CurrentD[2]->Palette;
break; break;
case GL_TEXTURE_3D_EXT:
case GL_TEXTURE_3D:
palette = &texUnit->CurrentD[3]->Palette;
break; break;
case GL_SHARED_TEXTURE_PALETTE_EXT: case GL_SHARED_TEXTURE_PALETTE_EXT:
palette = &ctx->Texture.Palette;
break;
default:
gl_error(ctx, GL_INVALID_ENUM, "glGetColorTable(target)");
return;
}

assert(palette);

switch (palette->Format) {
case GL_ALPHA:
for (i = 0; i < palette->Size; i++) {
rgba[i][RCOMP] = 0;
rgba[i][GCOMP] = 0;
rgba[i][BCOMP] = 0;
rgba[i][ACOMP] = palette->Table[i];
}
break;
case GL_LUMINANCE:
for (i = 0; i < palette->Size; i++) {
rgba[i][RCOMP] = palette->Table[i];
rgba[i][GCOMP] = palette->Table[i];
rgba[i][BCOMP] = palette->Table[i];
rgba[i][ACOMP] = 255;
}
break;
case GL_LUMINANCE_ALPHA:
for (i = 0; i < palette->Size; i++) {
rgba[i][RCOMP] = palette->Table[i*2+0];
rgba[i][GCOMP] = palette->Table[i*2+0];
rgba[i][BCOMP] = palette->Table[i*2+0];
rgba[i][ACOMP] = palette->Table[i*2+1];
}
break;
case GL_INTENSITY:
for (i = 0; i < palette->Size; i++) {
rgba[i][RCOMP] = palette->Table[i];
rgba[i][GCOMP] = palette->Table[i];
rgba[i][BCOMP] = palette->Table[i];
rgba[i][ACOMP] = 255;
}
break;
case GL_RGB:
for (i = 0; i < palette->Size; i++) {
rgba[i][RCOMP] = palette->Table[i*3+0];
rgba[i][GCOMP] = palette->Table[i*3+1];
rgba[i][BCOMP] = palette->Table[i*3+2];
rgba[i][ACOMP] = 255;
}
break;
case GL_RGBA:
for (i = 0; i < palette->Size; i++) {
rgba[i][RCOMP] = palette->Table[i*4+0];
rgba[i][GCOMP] = palette->Table[i*4+1];
rgba[i][BCOMP] = palette->Table[i*4+2];
rgba[i][ACOMP] = palette->Table[i*4+3];
}
break; break;
default: default:
gl_error(ctx, GL_INVALID_ENUM, "glGetColorTableEXT(target)");
gl_problem(ctx, "bad palette format in glGetColorTable");
return; return;
} }


gl_problem(ctx, "glGetColorTableEXT not implemented!");
gl_pack_rgba_span(ctx, palette->Size, (const GLubyte (*)[]) rgba,
format, type, table, &ctx->Pack, GL_FALSE);

gl_problem(ctx, "glGetColorTable not implemented!");
(void) format; (void) format;
(void) type; (void) type;
(void) table; (void) table;






void gl_GetColorTableParameterfv( GLcontext *ctx, GLenum target,
GLenum pname, GLfloat *params )
void
_mesa_GetColorTableParameterfv( GLenum target, GLenum pname, GLfloat *params )
{ {
GLint iparams[10]; GLint iparams[10];

gl_GetColorTableParameteriv( ctx, target, pname, iparams );
_mesa_GetColorTableParameteriv( target, pname, iparams );
*params = (GLfloat) iparams[0]; *params = (GLfloat) iparams[0];
} }






void gl_GetColorTableParameteriv( GLcontext *ctx, GLenum target,
GLenum pname, GLint *params )
void
_mesa_GetColorTableParameteriv( GLenum target, GLenum pname, GLint *params )
{ {
GET_CURRENT_CONTEXT(ctx);
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
struct gl_texture_object *texObj;
struct gl_palette *palette;


ASSERT_OUTSIDE_BEGIN_END(ctx, "glGetColorTableParameter"); ASSERT_OUTSIDE_BEGIN_END(ctx, "glGetColorTableParameter");


switch (target) { switch (target) {
case GL_TEXTURE_1D: case GL_TEXTURE_1D:
texObj = texUnit->CurrentD[1];
palette = &texUnit->CurrentD[1]->Palette;
break; break;
case GL_TEXTURE_2D: case GL_TEXTURE_2D:
texObj = texUnit->CurrentD[2];
palette = &texUnit->CurrentD[2]->Palette;
break; break;
case GL_TEXTURE_3D_EXT:
texObj = texUnit->CurrentD[3];
case GL_TEXTURE_3D:
palette = &texUnit->CurrentD[3]->Palette;
break; break;
case GL_SHARED_TEXTURE_PALETTE_EXT: case GL_SHARED_TEXTURE_PALETTE_EXT:
texObj = NULL;
palette = &ctx->Texture.Palette;
break; break;
default: default:
gl_error(ctx, GL_INVALID_ENUM, "glGetColorTableParameter(target)"); gl_error(ctx, GL_INVALID_ENUM, "glGetColorTableParameter(target)");
} }


switch (pname) { switch (pname) {
case GL_COLOR_TABLE_FORMAT_EXT:
if (texObj)
*params = texObj->PaletteIntFormat;
else
*params = ctx->Texture.PaletteIntFormat;
break;
case GL_COLOR_TABLE_WIDTH_EXT:
if (texObj)
*params = texObj->PaletteSize;
else
*params = ctx->Texture.PaletteSize;
break;
case GL_COLOR_TABLE_RED_SIZE_EXT:
case GL_COLOR_TABLE_FORMAT:
*params = palette->IntFormat;
break;
case GL_COLOR_TABLE_WIDTH:
*params = palette->Size;
break;
case GL_COLOR_TABLE_RED_SIZE:
*params = 8; *params = 8;
break; break;
case GL_COLOR_TABLE_GREEN_SIZE_EXT:
case GL_COLOR_TABLE_GREEN_SIZE:
*params = 8; *params = 8;
break; break;
case GL_COLOR_TABLE_BLUE_SIZE_EXT:
case GL_COLOR_TABLE_BLUE_SIZE:
*params = 8; *params = 8;
break; break;
case GL_COLOR_TABLE_ALPHA_SIZE_EXT:
case GL_COLOR_TABLE_ALPHA_SIZE:
*params = 8; *params = 8;
break; break;
case GL_COLOR_TABLE_LUMINANCE_SIZE_EXT:
case GL_COLOR_TABLE_LUMINANCE_SIZE:
*params = 8; *params = 8;
break; break;
case GL_COLOR_TABLE_INTENSITY_SIZE_EXT:
case GL_COLOR_TABLE_INTENSITY_SIZE:
*params = 8; *params = 8;
break; break;
default: default:

+ 16
- 15
src/mesa/main/colortab.h View File

/* $Id: colortab.h,v 1.1 1999/08/19 00:55:41 jtg Exp $ */
/* $Id: colortab.h,v 1.2 1999/11/11 01:22:25 brianp Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
*/ */







#ifndef COLORTAB_H #ifndef COLORTAB_H
#define COLORTAB_H #define COLORTAB_H


#include "types.h" #include "types.h"




extern void gl_ColorTable( GLcontext *ctx, GLenum target,
GLenum internalformat,
struct gl_image *table );
extern void
_mesa_ColorTable( GLenum target, GLenum internalformat,
GLsizei width, GLenum format, GLenum type,
const GLvoid *table );


extern void gl_ColorSubTable( GLcontext *ctx, GLenum target,
GLsizei start, struct gl_image *data );
extern void
_mesa_ColorSubTable( GLenum target, GLsizei start,
GLsizei count, GLenum format, GLenum type,
const GLvoid *table );


extern void gl_GetColorTable( GLcontext *ctx, GLenum target, GLenum format,
GLenum type, GLvoid *table );
extern void
_mesa_GetColorTable( GLenum target, GLenum format,
GLenum type, GLvoid *table );


extern void gl_GetColorTableParameterfv( GLcontext *ctx, GLenum target,
GLenum pname, GLfloat *params );
extern void
_mesa_GetColorTableParameterfv( GLenum target, GLenum pname, GLfloat *params );


extern void gl_GetColorTableParameteriv( GLcontext *ctx, GLenum target,
GLenum pname, GLint *params );
extern void
_mesa_GetColorTableParameteriv( GLenum target, GLenum pname, GLint *params );




#endif #endif

+ 7
- 27
src/mesa/main/config.h View File

/* $Id: config.h,v 1.1 1999/08/19 00:55:41 jtg Exp $ */
/* $Id: config.h,v 1.2 1999/11/11 01:22:25 brianp Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
* Version: 3.1
* Version: 3.3
* *
* Copyright (C) 1999 Brian Paul All Rights Reserved. * Copyright (C) 1999 Brian Paul All Rights Reserved.
* *
*/ */








/* /*
* Tunable configuration parameters. * Tunable configuration parameters.
*/ */
#include "conf.h" #include "conf.h"
#endif #endif



/* /*
*
* OpenGL implementation limits * OpenGL implementation limits
*
*/ */



/* Maximum modelview matrix stack depth: */ /* Maximum modelview matrix stack depth: */
#define MAX_MODELVIEW_STACK_DEPTH 32 #define MAX_MODELVIEW_STACK_DEPTH 32


#define MAX_ARRAY_LOCK_SIZE 3000 #define MAX_ARRAY_LOCK_SIZE 3000





/* /*
*
* Mesa-specific parameters * Mesa-specific parameters
*
*/ */




#define ACCUM_BITS 16 #define ACCUM_BITS 16




/*
* Bits per depth buffer value: 16 or 32
*/
#ifdef MESAD3D #ifdef MESAD3D
/* Mesa / Direct3D driver only */ /* Mesa / Direct3D driver only */
extern float g_DepthScale, g_MaxDepth; extern float g_DepthScale, g_MaxDepth;
# define DEPTH_SCALE g_DepthScale # define DEPTH_SCALE g_DepthScale
# define MAX_DEPTH g_MaxDepth # define MAX_DEPTH g_MaxDepth
#else #else
/*
* Bits per depth buffer value: 16 or 32
*/
# define DEPTH_BITS 16 # define DEPTH_BITS 16
# if DEPTH_BITS==16 # if DEPTH_BITS==16
# define MAX_DEPTH 0xffff # define MAX_DEPTH 0xffff
#define VB_SIZE (VB_MAX + VB_MAX_CLIPPED_VERTS) #define VB_SIZE (VB_MAX + VB_MAX_CLIPPED_VERTS)




/*
*
* For X11 driver only:
*
*/

/*
* When defined, use 6x6x6 dithering instead of 5x9x5.
* 5x9x5 better for general colors, 6x6x6 better for grayscale.
*/
/*#define DITHER666*/




typedef struct gl_context GLcontext; typedef struct gl_context GLcontext;



+ 104
- 156
src/mesa/main/context.c View File

/* $Id: context.c,v 1.18 1999/11/08 07:36:43 brianp Exp $ */
/* $Id: context.c,v 1.19 1999/11/11 01:22:25 brianp Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
* Version: 3.1
* Version: 3.3
* *
* Copyright (C) 1999 Brian Paul All Rights Reserved. * Copyright (C) 1999 Brian Paul All Rights Reserved.
* *
*/ */




/* $XFree86: xc/lib/GL/mesa/src/context.c,v 1.4 1999/04/04 00:20:21 dawes Exp $ */

/* /*
* If multi-threading is enabled (-DTHREADS) then each thread has it's * If multi-threading is enabled (-DTHREADS) then each thread has it's
* own rendering context. A thread obtains the pointer to its GLcontext * own rendering context. A thread obtains the pointer to its GLcontext
*/ */





#ifdef PC_HEADER #ifdef PC_HEADER
#include "all.h" #include "all.h"
#else #else
#ifndef XFree86Server
#include <assert.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#else
#include "GL/xf86glx.h"
#endif
#include "glheader.h"
#include "accum.h" #include "accum.h"
#include "alphabuf.h" #include "alphabuf.h"
#include "api.h"
#include "clip.h" #include "clip.h"
#include "context.h" #include "context.h"
#include "cva.h" #include "cva.h"
#include "depth.h" #include "depth.h"
#include "dispatch.h"
#include "dlist.h" #include "dlist.h"
#include "eval.h" #include "eval.h"
#include "enums.h" #include "enums.h"
#include "extensions.h" #include "extensions.h"
#include "fog.h" #include "fog.h"
#include "glapi.h"
#include "hash.h" #include "hash.h"
#include "light.h" #include "light.h"
#include "lines.h" #include "lines.h"
#include "dlist.h" #include "dlist.h"
#include "macros.h" #include "macros.h"
#include "matrix.h" #include "matrix.h"
#include "mem.h"
#include "mmath.h" #include "mmath.h"
#include "pb.h" #include "pb.h"
#include "pipeline.h" #include "pipeline.h"
#include "points.h" #include "points.h"
#include "pointers.h"
#include "quads.h" #include "quads.h"
#include "shade.h" #include "shade.h"
#include "simple_list.h" #include "simple_list.h"
#endif #endif




/*
* Memory allocation functions. Called via the MALLOC, CALLOC and
* FREE macros when DEBUG symbol is defined.
* You might want to set breakpoints on these functions or plug in
* other memory allocation functions. The Mesa sources should only
* use the MALLOC and FREE macros (which could also be overriden).
*
* XXX these functions should probably go into a new glmemory.c file.
*/

/*
* Allocate memory (uninitialized)
*/
void *gl_malloc(size_t bytes)
{
return malloc(bytes);
}

/*
* Allocate memory and initialize to zero.
*/
void *gl_calloc(size_t bytes)
{
return calloc(1, bytes);
}

/*
* Free memory
*/
void gl_free(void *ptr)
{
free(ptr);
}



/**********************************************************************/ /**********************************************************************/
/***** Context and Thread management *****/ /***** Context and Thread management *****/
#else #else


/* One Current Context pointer for all threads in the address space */ /* One Current Context pointer for all threads in the address space */
GLcontext *CC = NULL;
GLcontext *_mesa_current_context = NULL;
struct immediate *CURRENT_INPUT = NULL; struct immediate *CURRENT_INPUT = NULL;


#endif /*THREADS*/ #endif /*THREADS*/
for (i=0;i<n;i++) for (i=0;i<n;i++)
map->Points[i] = initial[i]; map->Points[i] = initial[i];
} }
map->Retain = GL_FALSE;
} }




for (i=0;i<n;i++) for (i=0;i<n;i++)
map->Points[i] = initial[i]; map->Points[i] = initial[i];
} }
map->Retain = GL_FALSE;
} }




static void init_palette( struct gl_palette *p )
{
p->Table[0] = 255;
p->Table[1] = 255;
p->Table[2] = 255;
p->Table[3] = 255;
p->Size = 1;
p->IntFormat = GL_RGBA;
p->Format = GL_RGBA;
}



/* /*
* Initialize a gl_context structure to default values. * Initialize a gl_context structure to default values.
for (i=0; i<MAX_TEXTURE_UNITS; i++) for (i=0; i<MAX_TEXTURE_UNITS; i++)
init_texture_unit( ctx, i ); init_texture_unit( ctx, i );


ctx->Texture.SharedPalette = GL_FALSE;
ctx->Texture.Palette[0] = 255;
ctx->Texture.Palette[1] = 255;
ctx->Texture.Palette[2] = 255;
ctx->Texture.Palette[3] = 255;
ctx->Texture.PaletteSize = 1;
ctx->Texture.PaletteIntFormat = GL_RGBA;
ctx->Texture.PaletteFormat = GL_RGBA;
init_palette(&ctx->Texture.Palette);


/* Transformation group */ /* Transformation group */
ctx->Transform.MatrixMode = GL_MODELVIEW; ctx->Transform.MatrixMode = GL_MODELVIEW;
ctx->Driver.ReadDepthSpanFloat = gl_read_depth_span_float; ctx->Driver.ReadDepthSpanFloat = gl_read_depth_span_float;
ctx->Driver.ReadDepthSpanInt = gl_read_depth_span_int; ctx->Driver.ReadDepthSpanInt = gl_read_depth_span_int;



#ifdef PROFILE #ifdef PROFILE
init_timings( ctx ); init_timings( ctx );
#endif #endif


#ifdef GL_VERSION_1_1
if (!alloc_proxy_textures(ctx)) { if (!alloc_proxy_textures(ctx)) {
free_shared_state(ctx, ctx->Shared); free_shared_state(ctx, ctx->Shared);
FREE(ctx->VB); FREE(ctx->VB);
FREE(ctx); FREE(ctx);
return NULL; return NULL;
} }
#endif


gl_init_api_function_pointers( ctx );
ctx->API = ctx->Exec; /* GL_EXECUTE is default */
/* setup API dispatch tables */
_mesa_init_exec_table( &ctx->Exec );
_mesa_init_dlist_table( &ctx->Save );
ctx->CurrentDispatch = &ctx->Exec;


return ctx; return ctx;
} }
FREE( (void *) ctx ); FREE( (void *) ctx );


#ifndef THREADS #ifndef THREADS
if (ctx==CC) {
CC = NULL;
if (ctx == _mesa_current_context) {
_mesa_current_context = NULL;
CURRENT_INPUT = NULL; CURRENT_INPUT = NULL;
} }
#endif #endif
/* /*
* Set the current context, binding the given frame buffer to the context. * Set the current context, binding the given frame buffer to the context.
*/ */
void gl_make_current( GLcontext *ctx, GLframebuffer *buffer )
void gl_make_current( GLcontext *newCtx, GLframebuffer *buffer )
{ {
GET_CONTEXT;
GET_CURRENT_CONTEXT(oldCtx);


/* Flush the old context /* Flush the old context
*/ */
if (CC) {
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(CC, "gl_make_current");
if (oldCtx) {
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(oldCtx, "gl_make_current");
} }


#ifdef THREADS #ifdef THREADS
/* TODO: unbind old buffer from context? */ /* TODO: unbind old buffer from context? */
set_thread_context( ctx );
set_thread_context( newCtx );
#else #else
if (CC && CC->Buffer) {
if (oldCtx && oldCtx->Buffer) {
/* unbind frame buffer from context */ /* unbind frame buffer from context */
CC->Buffer = NULL;
oldCtx->Buffer = NULL;
} }
CC = ctx;
if (ctx) {
SET_IMMEDIATE(ctx, ctx->input);
_mesa_current_context = newCtx;
if (newCtx) {
SET_IMMEDIATE(newCtx, newCtx->input);
} }
#endif #endif


if (newCtx)
_glapi_set_dispatch(newCtx->CurrentDispatch);
else
_glapi_set_dispatch(NULL); /* none current */

if (MESA_VERBOSE) fprintf(stderr, "gl_make_current()\n"); if (MESA_VERBOSE) fprintf(stderr, "gl_make_current()\n");


if (ctx && buffer) {
/* TODO: check if ctx and buffer's visual match??? */
ctx->Buffer = buffer; /* Bind the frame buffer to the context */
ctx->NewState = NEW_ALL; /* just to be safe */
gl_update_state( ctx );
if (newCtx && buffer) {
/* TODO: check if newCtx and buffer's visual match??? */
newCtx->Buffer = buffer; /* Bind the frame buffer to the context */
newCtx->NewState = NEW_ALL; /* just to be safe */
gl_update_state( newCtx );
} }
} }


#ifdef THREADS #ifdef THREADS
return gl_get_thread_context(); return gl_get_thread_context();
#else #else
return CC;
return _mesa_current_context;
#endif #endif
} }


} }




/*
* This should be called by device drivers just before they do a
* swapbuffers. Any pending rendering commands will be executed.
*/
void
_mesa_swapbuffers(GLcontext *ctx)
{
FLUSH_VB( ctx, "swap buffers" );
}



/* /*
* Someday a GLS library or OpenGL-like debugger may call this function
* to register it's own set of API entry points.
* Input: ctx - the context to set API pointers for
* api - if NULL, restore original API pointers
* else, set API function table to this table.
* Return pointer to this context's current API dispatch table.
* It'll either be the immediate-mode execute dispatcher or the
* display list compile dispatcher.
*/ */
void gl_set_api_table( GLcontext *ctx, const struct gl_api_table *api )
struct _glapi_table *
_mesa_get_dispatch(GLcontext *ctx)
{
return ctx->CurrentDispatch;
}



void
_mesa_ResizeBuffersMESA( void )
{ {
if (api) {
MEMCPY( &ctx->API, api, sizeof(struct gl_api_table) );
GET_CURRENT_CONTEXT(ctx);

GLuint buf_width, buf_height;

if (MESA_VERBOSE & VERBOSE_API)
fprintf(stderr, "glResizeBuffersMESA\n");

/* ask device driver for size of output buffer */
(*ctx->Driver.GetBufferSize)( ctx, &buf_width, &buf_height );

/* see if size of device driver's color buffer (window) has changed */
if (ctx->Buffer->Width == (GLint) buf_width &&
ctx->Buffer->Height == (GLint) buf_height)
return;

ctx->NewState |= NEW_RASTER_OPS; /* to update scissor / window bounds */

/* save buffer size */
ctx->Buffer->Width = buf_width;
ctx->Buffer->Height = buf_height;

/* Reallocate other buffers if needed. */
if (ctx->Visual->DepthBits>0) {
/* reallocate depth buffer */
(*ctx->Driver.AllocDepthBuffer)( ctx );
} }
else {
MEMCPY( &ctx->API, &ctx->Exec, sizeof(struct gl_api_table) );
if (ctx->Visual->StencilBits>0) {
/* reallocate stencil buffer */
gl_alloc_stencil_buffer( ctx );
}
if (ctx->Visual->AccumBits>0) {
/* reallocate accum buffer */
gl_alloc_accum_buffer( ctx );
}
if (ctx->Visual->SoftwareAlpha) {
gl_alloc_alpha_buffers( ctx );
} }
} }







/**********************************************************************/ /**********************************************************************/
/***** Miscellaneous functions *****/ /***** Miscellaneous functions *****/
/**********************************************************************/ /**********************************************************************/






/*
* Execute a glGetError command
*/
GLenum gl_GetError( GLcontext *ctx )
{
GLenum e = ctx->ErrorValue;

ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL( ctx, "glGetError", (GLenum) 0);

if (MESA_VERBOSE & VERBOSE_API)
fprintf(stderr, "glGetError <-- %s\n", gl_lookup_enum_by_nr(e));

ctx->ErrorValue = (GLenum) GL_NO_ERROR;
return e;
}



void gl_ResizeBuffersMESA( GLcontext *ctx )
{
GLuint buf_width, buf_height;

if (MESA_VERBOSE & VERBOSE_API)
fprintf(stderr, "glResizeBuffersMESA\n");

/* ask device driver for size of output buffer */
(*ctx->Driver.GetBufferSize)( ctx, &buf_width, &buf_height );

/* see if size of device driver's color buffer (window) has changed */
if (ctx->Buffer->Width == (GLint) buf_width &&
ctx->Buffer->Height == (GLint) buf_height)
return;

ctx->NewState |= NEW_RASTER_OPS; /* to update scissor / window bounds */

/* save buffer size */
ctx->Buffer->Width = buf_width;
ctx->Buffer->Height = buf_height;

/* Reallocate other buffers if needed. */
if (ctx->Visual->DepthBits>0) {
/* reallocate depth buffer */
(*ctx->Driver.AllocDepthBuffer)( ctx );
}
if (ctx->Visual->StencilBits>0) {
/* reallocate stencil buffer */
gl_alloc_stencil_buffer( ctx );
}
if (ctx->Visual->AccumBits>0) {
/* reallocate accum buffer */
gl_alloc_accum_buffer( ctx );
}
if (ctx->Visual->SoftwareAlpha) {
gl_alloc_alpha_buffers( ctx );
}
}




/**********************************************************************/ /**********************************************************************/
/***** State update logic *****/ /***** State update logic *****/
/**********************************************************************/ /**********************************************************************/

+ 27
- 11
src/mesa/main/context.h View File

/* $Id: context.h,v 1.1 1999/08/19 00:55:41 jtg Exp $ */
/* $Id: context.h,v 1.2 1999/11/11 01:22:25 brianp Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
* Version: 3.1
* Version: 3.3
* *
* Copyright (C) 1999 Brian Paul All Rights Reserved. * Copyright (C) 1999 Brian Paul All Rights Reserved.
* *
*/ */







#ifndef CONTEXT_H #ifndef CONTEXT_H
#define CONTEXT_H #define CONTEXT_H


#include "types.h" #include "types.h"





#ifdef THREADS #ifdef THREADS
/* /*
* A seperate GLcontext for each thread * A seperate GLcontext for each thread
*/ */
extern GLcontext *gl_get_thread_context( void ); extern GLcontext *gl_get_thread_context( void );

#define GET_IMMEDIATE struct immediate *IM = (gl_get_thread_context())->input;
#define SET_IMMEDIATE(ctx, im) \
do { \
ctx->input = im; \
} while (0)


#else #else
/* /*
* All threads use same pointer to current context. * All threads use same pointer to current context.
*/ */
extern GLcontext *CC;
extern GLcontext *_mesa_current_context;
extern struct immediate *CURRENT_INPUT; extern struct immediate *CURRENT_INPUT;
#define GET_CURRENT_CONTEXT(C) GLcontext *C = _mesa_current_context

#define GET_IMMEDIATE struct immediate *IM = CURRENT_INPUT
#define SET_IMMEDIATE(ctx, im) \
do { \
ctx->input = im; \
CURRENT_INPUT = im; \
} while (0)


#endif #endif






extern void gl_copy_context(const GLcontext *src, GLcontext *dst, GLuint mask); extern void gl_copy_context(const GLcontext *src, GLcontext *dst, GLuint mask);


extern void gl_set_api_table( GLcontext *ctx, const struct gl_api_table *api );
extern void
_mesa_swapbuffers(GLcontext *ctx);

extern struct _glapi_table *
_mesa_get_dispatch(GLcontext *ctx);






/* /*
* GL_MESA_resize_buffers extension * GL_MESA_resize_buffers extension
*/ */
extern void gl_ResizeBuffersMESA( GLcontext *ctx );
extern void _mesa_ResizeBuffersMESA( void );






extern void gl_error( GLcontext *ctx, GLenum error, const char *s ); extern void gl_error( GLcontext *ctx, GLenum error, const char *s );
extern void gl_compile_error( GLcontext *ctx, GLenum error, const char *s ); extern void gl_compile_error( GLcontext *ctx, GLenum error, const char *s );


extern GLenum gl_GetError( GLcontext *ctx );



extern void gl_update_state( GLcontext *ctx ); extern void gl_update_state( GLcontext *ctx );



+ 13
- 21
src/mesa/main/depth.c View File

/* $Id: depth.c,v 1.8 1999/11/08 07:36:43 brianp Exp $ */
/* $Id: depth.c,v 1.9 1999/11/11 01:22:26 brianp Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
* Version: 3.1
* Version: 3.3
* *
* Copyright (C) 1999 Brian Paul All Rights Reserved. * Copyright (C) 1999 Brian Paul All Rights Reserved.
* *
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */



/* $XFree86: xc/lib/GL/mesa/src/depth.c,v 1.3 1999/04/04 00:20:22 dawes Exp $ */

/*
* Depth buffer functions
*/

#include <stdlib.h>

#ifdef PC_HEADER #ifdef PC_HEADER
#include "all.h" #include "all.h"
#else #else
#ifndef XFree86Server
#include <stdio.h>
#include <string.h>
#else
#include "GL/xf86glx.h"
#endif
#include "glheader.h"
#include "context.h" #include "context.h"
#include "enums.h" #include "enums.h"
#include "depth.h" #include "depth.h"
#include "macros.h"
#include "mem.h"
#include "types.h" #include "types.h"
#endif #endif








void gl_ClearDepth( GLcontext* ctx, GLclampd depth )
void
_mesa_ClearDepth( GLclampd depth )
{ {
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glClearDepth"); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glClearDepth");
ctx->Depth.Clear = (GLfloat) CLAMP( depth, 0.0, 1.0 ); ctx->Depth.Clear = (GLfloat) CLAMP( depth, 0.0, 1.0 );
if (ctx->Driver.ClearDepth) if (ctx->Driver.ClearDepth)






void gl_DepthFunc( GLcontext* ctx, GLenum func )
void
_mesa_DepthFunc( GLenum func )
{ {
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glDepthFunc"); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glDepthFunc");


if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))






void gl_DepthMask( GLcontext* ctx, GLboolean flag )
void
_mesa_DepthMask( GLboolean flag )
{ {
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glDepthMask"); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glDepthMask");


if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))

+ 11
- 9
src/mesa/main/depth.h View File


/* $Id: depth.h,v 1.2 1999/10/08 09:27:10 keithw Exp $ */
/* $Id: depth.h,v 1.3 1999/11/11 01:22:26 brianp Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
* Version: 3.1
* Version: 3.3
* *
* Copyright (C) 1999 Brian Paul All Rights Reserved. * Copyright (C) 1999 Brian Paul All Rights Reserved.
* *
*/ */







#ifndef DEPTH_H #ifndef DEPTH_H
#define DEPTH_H #define DEPTH_H


extern void gl_clear_depth_buffer( GLcontext* ctx ); extern void gl_clear_depth_buffer( GLcontext* ctx );




extern void gl_ClearDepth( GLcontext* ctx, GLclampd depth );


extern void gl_DepthFunc( GLcontext* ctx, GLenum func );
extern void
_mesa_ClearDepth( GLclampd depth );

extern void
_mesa_DepthFunc( GLenum func );


extern void
_mesa_DepthMask( GLboolean flag );


extern void gl_DepthMask( GLcontext* ctx, GLboolean flag );


#endif #endif

+ 546
- 0
src/mesa/main/dispatch.c View File

/* $Id: dispatch.c,v 1.1 1999/11/11 01:22:26 brianp Exp $ */

/*
* Mesa 3-D graphics library
* Version: 3.3
*
* Copyright (C) 1999 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/


#ifdef PC_HEADER
#include "all.h"
#else
#include "glheader.h"
#include "accum.h"
#include "alpha.h"
#include "attrib.h"
#include "bitmap.h"
#include "blend.h"
#include "clip.h"
#include "context.h"
#include "colortab.h"
#include "copypix.h"
#include "cva.h"
#include "depth.h"
#include "dlist.h"
#include "drawpix.h"
#include "enable.h"
#include "eval.h"
#include "feedback.h"
#include "fog.h"
#include "get.h"
#include "glmisc.h"
#include "imaging.h"
#include "light.h"
#include "lines.h"
#include "logic.h"
#include "masking.h"
#include "matrix.h"
#include "pixel.h"
#include "points.h"
#include "polygon.h"
#include "rastpos.h"
#include "readpix.h"
#include "rect.h"
#include "scissor.h"
#include "stencil.h"
#include "teximage.h"
#include "texobj.h"
#include "texstate.h"
#include "types.h"
#include "varray.h"
#include "vbfill.h"
#include "winpos.h"
#endif


/*
* Initialize the given dispatch table with pointers to Mesa's
* immediate-mode commands.
*/
void
_mesa_init_exec_table(struct _glapi_table *exec)
{
exec->Accum = _mesa_Accum;
exec->AlphaFunc = _mesa_AlphaFunc;
exec->Begin = _mesa_Begin;
exec->Bitmap = _mesa_Bitmap;
exec->BlendFunc = _mesa_BlendFunc;
exec->CallList = _mesa_CallList;
exec->CallLists = _mesa_CallLists;
exec->Clear = _mesa_Clear;
exec->ClearAccum = _mesa_ClearAccum;
exec->ClearColor = _mesa_ClearColor;
exec->ClearDepth = _mesa_ClearDepth;
exec->ClearIndex = _mesa_ClearIndex;
exec->ClearStencil = _mesa_ClearStencil;
exec->ClipPlane = _mesa_ClipPlane;
exec->Color3b = _mesa_Color3b;
exec->Color3bv = _mesa_Color3bv;
exec->Color3d = _mesa_Color3d;
exec->Color3dv = _mesa_Color3dv;
exec->Color3f = _mesa_Color3f;
exec->Color3fv = _mesa_Color3fv;
exec->Color3i = _mesa_Color3i;
exec->Color3iv = _mesa_Color3iv;
exec->Color3s = _mesa_Color3s;
exec->Color3sv = _mesa_Color3sv;
exec->Color3ub = _mesa_Color3ub;
exec->Color3ubv = _mesa_Color3ubv;
exec->Color3ui = _mesa_Color3ui;
exec->Color3uiv = _mesa_Color3uiv;
exec->Color3us = _mesa_Color3us;
exec->Color3usv = _mesa_Color3usv;
exec->Color4b = _mesa_Color4b;
exec->Color4bv = _mesa_Color4bv;
exec->Color4d = _mesa_Color4d;
exec->Color4dv = _mesa_Color4dv;
exec->Color4f = _mesa_Color4f;
exec->Color4fv = _mesa_Color4fv;
exec->Color4i = _mesa_Color4i;
exec->Color4iv = _mesa_Color4iv;
exec->Color4s = _mesa_Color4s;
exec->Color4sv = _mesa_Color4sv;
exec->Color4ub = _mesa_Color4ub;
exec->Color4ubv = _mesa_Color4ubv;
exec->Color4ui = _mesa_Color4ui;
exec->Color4uiv = _mesa_Color4uiv;
exec->Color4us = _mesa_Color4us;
exec->Color4usv = _mesa_Color4usv;
exec->ColorMask = _mesa_ColorMask;
exec->ColorMaterial = _mesa_ColorMaterial;
exec->CopyPixels = _mesa_CopyPixels;
exec->CullFace = _mesa_CullFace;
exec->DeleteLists = _mesa_DeleteLists;
exec->DepthFunc = _mesa_DepthFunc;
exec->DepthMask = _mesa_DepthMask;
exec->DepthRange = _mesa_DepthRange;
exec->Disable = _mesa_Disable;
exec->DrawBuffer = _mesa_DrawBuffer;
exec->DrawPixels = _mesa_DrawPixels;
exec->EdgeFlag = _mesa_EdgeFlag;
exec->EdgeFlagv = _mesa_EdgeFlagv;
exec->Enable = _mesa_Enable;
exec->End = _mesa_End;
exec->EndList = _mesa_EndList;
exec->EvalCoord1d = _mesa_EvalCoord1d;
exec->EvalCoord1dv = _mesa_EvalCoord1dv;
exec->EvalCoord1f = _mesa_EvalCoord1f;
exec->EvalCoord1fv = _mesa_EvalCoord1fv;
exec->EvalCoord2d = _mesa_EvalCoord2d;
exec->EvalCoord2dv = _mesa_EvalCoord2dv;
exec->EvalCoord2f = _mesa_EvalCoord2f;
exec->EvalCoord2fv = _mesa_EvalCoord2fv;
exec->EvalMesh1 = _mesa_EvalMesh1;
exec->EvalMesh2 = _mesa_EvalMesh2;
exec->EvalPoint1 = _mesa_EvalPoint1;
exec->EvalPoint2 = _mesa_EvalPoint2;
exec->FeedbackBuffer = _mesa_FeedbackBuffer;
exec->Finish = _mesa_Finish;
exec->Flush = _mesa_Flush;
exec->Fogf = _mesa_Fogf;
exec->Fogfv = _mesa_Fogfv;
exec->Fogi = _mesa_Fogi;
exec->Fogiv = _mesa_Fogiv;
exec->FrontFace = _mesa_FrontFace;
exec->Frustum = _mesa_Frustum;
exec->GenLists = _mesa_GenLists;
exec->GetBooleanv = _mesa_GetBooleanv;
exec->GetClipPlane = _mesa_GetClipPlane;
exec->GetDoublev = _mesa_GetDoublev;
exec->GetError = _mesa_GetError;
exec->GetFloatv = _mesa_GetFloatv;
exec->GetIntegerv = _mesa_GetIntegerv;
exec->GetLightfv = _mesa_GetLightfv;
exec->GetLightiv = _mesa_GetLightiv;
exec->GetMapdv = _mesa_GetMapdv;
exec->GetMapfv = _mesa_GetMapfv;
exec->GetMapiv = _mesa_GetMapiv;
exec->GetMaterialfv = _mesa_GetMaterialfv;
exec->GetMaterialiv = _mesa_GetMaterialiv;
exec->GetPixelMapfv = _mesa_GetPixelMapfv;
exec->GetPixelMapuiv = _mesa_GetPixelMapuiv;
exec->GetPixelMapusv = _mesa_GetPixelMapusv;
exec->GetPolygonStipple = _mesa_GetPolygonStipple;
exec->GetString = _mesa_GetString;
exec->GetTexEnvfv = _mesa_GetTexEnvfv;
exec->GetTexEnviv = _mesa_GetTexEnviv;
exec->GetTexGendv = _mesa_GetTexGendv;
exec->GetTexGenfv = _mesa_GetTexGenfv;
exec->GetTexGeniv = _mesa_GetTexGeniv;
exec->GetTexImage = _mesa_GetTexImage;
exec->GetTexLevelParameterfv = _mesa_GetTexLevelParameterfv;
exec->GetTexLevelParameteriv = _mesa_GetTexLevelParameteriv;
exec->GetTexParameterfv = _mesa_GetTexParameterfv;
exec->GetTexParameteriv = _mesa_GetTexParameteriv;
exec->Hint = _mesa_Hint;
exec->IndexMask = _mesa_IndexMask;
exec->Indexd = _mesa_Indexd;
exec->Indexdv = _mesa_Indexdv;
exec->Indexf = _mesa_Indexf;
exec->Indexfv = _mesa_Indexfv;
exec->Indexi = _mesa_Indexi;
exec->Indexiv = _mesa_Indexiv;
exec->Indexs = _mesa_Indexs;
exec->Indexsv = _mesa_Indexsv;
exec->InitNames = _mesa_InitNames;
exec->IsEnabled = _mesa_IsEnabled;
exec->IsList = _mesa_IsList;
exec->LightModelf = _mesa_LightModelf;
exec->LightModelfv = _mesa_LightModelfv;
exec->LightModeli = _mesa_LightModeli;
exec->LightModeliv = _mesa_LightModeliv;
exec->Lightf = _mesa_Lightf;
exec->Lightfv = _mesa_Lightfv;
exec->Lighti = _mesa_Lighti;
exec->Lightiv = _mesa_Lightiv;
exec->LineStipple = _mesa_LineStipple;
exec->LineWidth = _mesa_LineWidth;
exec->ListBase = _mesa_ListBase;
exec->LoadIdentity = _mesa_LoadIdentity;
exec->LoadMatrixd = _mesa_LoadMatrixd;
exec->LoadMatrixf = _mesa_LoadMatrixf;
exec->LoadName = _mesa_LoadName;
exec->LogicOp = _mesa_LogicOp;
exec->Map1d = _mesa_Map1d;
exec->Map1f = _mesa_Map1f;
exec->Map2d = _mesa_Map2d;
exec->Map2f = _mesa_Map2f;
exec->MapGrid1d = _mesa_MapGrid1d;
exec->MapGrid1f = _mesa_MapGrid1f;
exec->MapGrid2d = _mesa_MapGrid2d;
exec->MapGrid2f = _mesa_MapGrid2f;
exec->Materialf = _mesa_Materialf;
exec->Materialfv = _mesa_Materialfv;
exec->Materiali = _mesa_Materiali;
exec->Materialiv = _mesa_Materialiv;
exec->MatrixMode = _mesa_MatrixMode;
exec->MultMatrixd = _mesa_MultMatrixd;
exec->MultMatrixf = _mesa_MultMatrixf;
exec->NewList = _mesa_NewList;
exec->Normal3b = _mesa_Normal3b;
exec->Normal3bv = _mesa_Normal3bv;
exec->Normal3d = _mesa_Normal3d;
exec->Normal3dv = _mesa_Normal3dv;
exec->Normal3f = _mesa_Normal3f;
exec->Normal3fv = _mesa_Normal3fv;
exec->Normal3i = _mesa_Normal3i;
exec->Normal3iv = _mesa_Normal3iv;
exec->Normal3s = _mesa_Normal3s;
exec->Normal3sv = _mesa_Normal3sv;
exec->Ortho = _mesa_Ortho;
exec->PassThrough = _mesa_PassThrough;
exec->PixelMapfv = _mesa_PixelMapfv;
exec->PixelMapuiv = _mesa_PixelMapuiv;
exec->PixelMapusv = _mesa_PixelMapusv;
exec->PixelStoref = _mesa_PixelStoref;
exec->PixelStorei = _mesa_PixelStorei;
exec->PixelTransferf = _mesa_PixelTransferf;
exec->PixelTransferi = _mesa_PixelTransferi;
exec->PixelZoom = _mesa_PixelZoom;
exec->PointSize = _mesa_PointSize;
exec->PolygonMode = _mesa_PolygonMode;
exec->PolygonOffset = _mesa_PolygonOffset;
exec->PolygonStipple = _mesa_PolygonStipple;
exec->PopAttrib = _mesa_PopAttrib;
exec->PopMatrix = _mesa_PopMatrix;
exec->PopName = _mesa_PopName;
exec->PushAttrib = _mesa_PushAttrib;
exec->PushMatrix = _mesa_PushMatrix;
exec->PushName = _mesa_PushName;
exec->RasterPos2d = _mesa_RasterPos2d;
exec->RasterPos2dv = _mesa_RasterPos2dv;
exec->RasterPos2f = _mesa_RasterPos2f;
exec->RasterPos2fv = _mesa_RasterPos2fv;
exec->RasterPos2i = _mesa_RasterPos2i;
exec->RasterPos2iv = _mesa_RasterPos2iv;
exec->RasterPos2s = _mesa_RasterPos2s;
exec->RasterPos2sv = _mesa_RasterPos2sv;
exec->RasterPos3d = _mesa_RasterPos3d;
exec->RasterPos3dv = _mesa_RasterPos3dv;
exec->RasterPos3f = _mesa_RasterPos3f;
exec->RasterPos3fv = _mesa_RasterPos3fv;
exec->RasterPos3i = _mesa_RasterPos3i;
exec->RasterPos3iv = _mesa_RasterPos3iv;
exec->RasterPos3s = _mesa_RasterPos3s;
exec->RasterPos3sv = _mesa_RasterPos3sv;
exec->RasterPos4d = _mesa_RasterPos4d;
exec->RasterPos4dv = _mesa_RasterPos4dv;
exec->RasterPos4f = _mesa_RasterPos4f;
exec->RasterPos4fv = _mesa_RasterPos4fv;
exec->RasterPos4i = _mesa_RasterPos4i;
exec->RasterPos4iv = _mesa_RasterPos4iv;
exec->RasterPos4s = _mesa_RasterPos4s;
exec->RasterPos4sv = _mesa_RasterPos4sv;
exec->ReadBuffer = _mesa_ReadBuffer;
exec->ReadPixels = _mesa_ReadPixels;
exec->Rectd = _mesa_Rectd;
exec->Rectdv = _mesa_Rectdv;
exec->Rectf = _mesa_Rectf;
exec->Rectfv = _mesa_Rectfv;
exec->Recti = _mesa_Recti;
exec->Rectiv = _mesa_Rectiv;
exec->Rects = _mesa_Rects;
exec->Rectsv = _mesa_Rectsv;
exec->RenderMode = _mesa_RenderMode;
exec->Rotated = _mesa_Rotated;
exec->Rotatef = _mesa_Rotatef;
exec->Scaled = _mesa_Scaled;
exec->Scalef = _mesa_Scalef;
exec->Scissor = _mesa_Scissor;
exec->SelectBuffer = _mesa_SelectBuffer;
exec->ShadeModel = _mesa_ShadeModel;
exec->StencilFunc = _mesa_StencilFunc;
exec->StencilMask = _mesa_StencilMask;
exec->StencilOp = _mesa_StencilOp;
exec->TexCoord1d = _mesa_TexCoord1d;
exec->TexCoord1dv = _mesa_TexCoord1dv;
exec->TexCoord1f = _mesa_TexCoord1f;
exec->TexCoord1fv = _mesa_TexCoord1fv;
exec->TexCoord1i = _mesa_TexCoord1i;
exec->TexCoord1iv = _mesa_TexCoord1iv;
exec->TexCoord1s = _mesa_TexCoord1s;
exec->TexCoord1sv = _mesa_TexCoord1sv;
exec->TexCoord2d = _mesa_TexCoord2d;
exec->TexCoord2dv = _mesa_TexCoord2dv;
exec->TexCoord2f = _mesa_TexCoord2f;
exec->TexCoord2fv = _mesa_TexCoord2fv;
exec->TexCoord2i = _mesa_TexCoord2i;
exec->TexCoord2iv = _mesa_TexCoord2iv;
exec->TexCoord2s = _mesa_TexCoord2s;
exec->TexCoord2sv = _mesa_TexCoord2sv;
exec->TexCoord3d = _mesa_TexCoord3d;
exec->TexCoord3dv = _mesa_TexCoord3dv;
exec->TexCoord3f = _mesa_TexCoord3f;
exec->TexCoord3fv = _mesa_TexCoord3fv;
exec->TexCoord3i = _mesa_TexCoord3i;
exec->TexCoord3iv = _mesa_TexCoord3iv;
exec->TexCoord3s = _mesa_TexCoord3s;
exec->TexCoord3sv = _mesa_TexCoord3sv;
exec->TexCoord4d = _mesa_TexCoord4d;
exec->TexCoord4dv = _mesa_TexCoord4dv;
exec->TexCoord4f = _mesa_TexCoord4f;
exec->TexCoord4fv = _mesa_TexCoord4fv;
exec->TexCoord4i = _mesa_TexCoord4i;
exec->TexCoord4iv = _mesa_TexCoord4iv;
exec->TexCoord4s = _mesa_TexCoord4s;
exec->TexCoord4sv = _mesa_TexCoord4sv;
exec->TexEnvf = _mesa_TexEnvf;
exec->TexEnvfv = _mesa_TexEnvfv;
exec->TexEnvi = _mesa_TexEnvi;
exec->TexEnviv = _mesa_TexEnviv;
exec->TexGend = _mesa_TexGend;
exec->TexGendv = _mesa_TexGendv;
exec->TexGenf = _mesa_TexGenf;
exec->TexGenfv = _mesa_TexGenfv;
exec->TexGeni = _mesa_TexGeni;
exec->TexGeniv = _mesa_TexGeniv;
exec->TexImage1D = _mesa_TexImage1D;
exec->TexImage2D = _mesa_TexImage2D;
exec->TexParameterf = _mesa_TexParameterf;
exec->TexParameterfv = _mesa_TexParameterfv;
exec->TexParameteri = _mesa_TexParameteri;
exec->TexParameteriv = _mesa_TexParameteriv;
exec->Translated = _mesa_Translated;
exec->Translatef = _mesa_Translatef;
exec->Vertex2d = _mesa_Vertex2d;
exec->Vertex2dv = _mesa_Vertex2dv;
exec->Vertex2f = _mesa_Vertex2f;
exec->Vertex2fv = _mesa_Vertex2fv;
exec->Vertex2i = _mesa_Vertex2i;
exec->Vertex2iv = _mesa_Vertex2iv;
exec->Vertex2s = _mesa_Vertex2s;
exec->Vertex2sv = _mesa_Vertex2sv;
exec->Vertex3d = _mesa_Vertex3d;
exec->Vertex3dv = _mesa_Vertex3dv;
exec->Vertex3f = _mesa_Vertex3f;
exec->Vertex3fv = _mesa_Vertex3fv;
exec->Vertex3i = _mesa_Vertex3i;
exec->Vertex3iv = _mesa_Vertex3iv;
exec->Vertex3s = _mesa_Vertex3s;
exec->Vertex3sv = _mesa_Vertex3sv;
exec->Vertex4d = _mesa_Vertex4d;
exec->Vertex4dv = _mesa_Vertex4dv;
exec->Vertex4f = _mesa_Vertex4f;
exec->Vertex4fv = _mesa_Vertex4fv;
exec->Vertex4i = _mesa_Vertex4i;
exec->Vertex4iv = _mesa_Vertex4iv;
exec->Vertex4s = _mesa_Vertex4s;
exec->Vertex4sv = _mesa_Vertex4sv;
exec->Viewport = _mesa_Viewport;

#ifdef _GLAPI_VERSION_1_1
exec->AreTexturesResident = _mesa_AreTexturesResident;
exec->ArrayElement = _mesa_ArrayElement;
exec->BindTexture = _mesa_BindTexture;
exec->ColorPointer = _mesa_ColorPointer;
exec->CopyTexImage1D = _mesa_CopyTexImage1D;
exec->CopyTexImage2D = _mesa_CopyTexImage2D;
exec->CopyTexSubImage1D = _mesa_CopyTexSubImage1D;
exec->CopyTexSubImage2D = _mesa_CopyTexSubImage2D;
exec->DeleteTextures = _mesa_DeleteTextures;
exec->DisableClientState = _mesa_DisableClientState;
exec->DrawArrays = _mesa_DrawArrays;
exec->DrawElements = _mesa_DrawElements;
exec->EdgeFlagPointer = _mesa_EdgeFlagPointer;
exec->EnableClientState = _mesa_EnableClientState;
exec->GenTextures = _mesa_GenTextures;
exec->GetPointerv = _mesa_GetPointerv;
exec->IndexPointer = _mesa_IndexPointer;
exec->Indexub = _mesa_Indexub;
exec->Indexubv = _mesa_Indexubv;
exec->InterleavedArrays = _mesa_InterleavedArrays;
exec->IsTexture = _mesa_IsTexture;
exec->NormalPointer = _mesa_NormalPointer;
exec->PopClientAttrib = _mesa_PopClientAttrib;
exec->PrioritizeTextures = _mesa_PrioritizeTextures;
exec->PushClientAttrib = _mesa_PushClientAttrib;
exec->TexCoordPointer = _mesa_TexCoordPointer;
exec->TexSubImage1D = _mesa_TexSubImage1D;
exec->TexSubImage2D = _mesa_TexSubImage2D;
exec->VertexPointer = _mesa_VertexPointer;
#endif

#ifdef _GLAPI_VERSION_1_2
exec->CopyTexSubImage3D = _mesa_CopyTexSubImage3D;
exec->DrawRangeElements = _mesa_DrawRangeElements;
exec->TexImage3D = _mesa_TexImage3D;
exec->TexSubImage3D = _mesa_TexSubImage3D;
#endif

/* OpenGL 1.2 GL_ARB_imaging */
#ifdef _GLAPI_ARB_imaging
exec->BlendColor = _mesa_BlendColor;
exec->BlendEquation = _mesa_BlendEquation;
exec->ColorSubTable = _mesa_ColorSubTable;
exec->ColorTable = _mesa_ColorTable;
exec->ColorTableParameterfv = _mesa_ColorTableParameterfv;
exec->ColorTableParameteriv = _mesa_ColorTableParameteriv;
exec->ConvolutionFilter1D = _mesa_ConvolutionFilter1D;
exec->ConvolutionFilter2D = _mesa_ConvolutionFilter2D;
exec->ConvolutionParameterf = _mesa_ConvolutionParameterf;
exec->ConvolutionParameterfv = _mesa_ConvolutionParameterfv;
exec->ConvolutionParameteri = _mesa_ConvolutionParameteri;
exec->ConvolutionParameteriv = _mesa_ConvolutionParameteriv;
exec->CopyColorSubTable = _mesa_CopyColorSubTable;
exec->CopyColorTable = _mesa_CopyColorTable;
exec->CopyConvolutionFilter1D = _mesa_CopyConvolutionFilter1D;
exec->CopyConvolutionFilter2D = _mesa_CopyConvolutionFilter2D;
exec->GetColorTable = _mesa_GetColorTable;
exec->GetColorTableParameterfv = _mesa_GetColorTableParameterfv;
exec->GetColorTableParameteriv = _mesa_GetColorTableParameteriv;
exec->GetConvolutionFilter = _mesa_GetConvolutionFilter;
exec->GetConvolutionParameterfv = _mesa_GetConvolutionParameterfv;
exec->GetConvolutionParameteriv = _mesa_GetConvolutionParameteriv;
exec->GetHistogram = _mesa_GetHistogram;
exec->GetHistogramParameterfv = _mesa_GetHistogramParameterfv;
exec->GetHistogramParameteriv = _mesa_GetHistogramParameteriv;
exec->GetMinmax = _mesa_GetMinmax;
exec->GetMinmaxParameterfv = _mesa_GetMinmaxParameterfv;
exec->GetMinmaxParameteriv = _mesa_GetMinmaxParameteriv;
exec->GetSeparableFilter = _mesa_GetSeparableFilter;
exec->Histogram = _mesa_Histogram;
exec->Minmax = _mesa_Minmax;
exec->ResetHistogram = _mesa_ResetHistogram;
exec->ResetMinmax = _mesa_ResetMinmax;
exec->SeparableFilter2D = _mesa_SeparableFilter2D;
#endif

#ifdef _GLAPI_EXT_color_table
exec->ColorTableEXT = _mesa_ColorTable;
exec->ColorSubTableEXT = _mesa_ColorSubTable;
exec->GetColorTableEXT = _mesa_GetColorTable;
exec->GetColorTableParameterfvEXT = _mesa_GetColorTableParameterfv;
exec->GetColorTableParameterivEXT = _mesa_GetColorTableParameteriv;
#endif

#ifdef _GLAPI_EXT_compiled_vertex_array
exec->LockArraysEXT = _mesa_LockArraysEXT;
exec->UnlockArraysEXT = _mesa_UnlockArraysEXT;
#endif

#ifdef _GLAPI_EXT_point_parameters
exec->PointParameterfEXT = _mesa_PointParameterfEXT;
exec->PointParameterfvEXT = _mesa_PointParameterfvEXT;
#endif

#ifdef _GLAPI_EXT_polygon_offset
exec->PolygonOffsetEXT = _mesa_PolygonOffsetEXT;
#endif

#ifdef _GLAPI_EXT_blend_minmax
exec->BlendEquationEXT = _mesa_BlendEquationEXT;
#endif

#ifdef _GLAPI_EXT_blend_color
exec->BlendColorEXT = _mesa_BlendColorEXT;
#endif

#ifdef _GLAPI_ARB_multitexture
exec->ActiveTextureARB = _mesa_ActiveTextureARB;
exec->ClientActiveTextureARB = _mesa_ClientActiveTextureARB;
exec->MultiTexCoord1dARB = _mesa_MultiTexCoord1dARB;
exec->MultiTexCoord1dvARB = _mesa_MultiTexCoord1dvARB;
exec->MultiTexCoord1fARB = _mesa_MultiTexCoord1fARB;
exec->MultiTexCoord1fvARB = _mesa_MultiTexCoord1fvARB;
exec->MultiTexCoord1iARB = _mesa_MultiTexCoord1iARB;
exec->MultiTexCoord1ivARB = _mesa_MultiTexCoord1ivARB;
exec->MultiTexCoord1sARB = _mesa_MultiTexCoord1sARB;
exec->MultiTexCoord1svARB = _mesa_MultiTexCoord1svARB;
exec->MultiTexCoord2dARB = _mesa_MultiTexCoord2dARB;
exec->MultiTexCoord2dvARB = _mesa_MultiTexCoord2dvARB;
exec->MultiTexCoord2fARB = _mesa_MultiTexCoord2fARB;
exec->MultiTexCoord2fvARB = _mesa_MultiTexCoord2fvARB;
exec->MultiTexCoord2iARB = _mesa_MultiTexCoord2iARB;
exec->MultiTexCoord2ivARB = _mesa_MultiTexCoord2ivARB;
exec->MultiTexCoord2sARB = _mesa_MultiTexCoord2sARB;
exec->MultiTexCoord2svARB = _mesa_MultiTexCoord2svARB;
exec->MultiTexCoord3dARB = _mesa_MultiTexCoord3dARB;
exec->MultiTexCoord3dvARB = _mesa_MultiTexCoord3dvARB;
exec->MultiTexCoord3fARB = _mesa_MultiTexCoord3fARB;
exec->MultiTexCoord3fvARB = _mesa_MultiTexCoord3fvARB;
exec->MultiTexCoord3iARB = _mesa_MultiTexCoord3iARB;
exec->MultiTexCoord3ivARB = _mesa_MultiTexCoord3ivARB;
exec->MultiTexCoord3sARB = _mesa_MultiTexCoord3sARB;
exec->MultiTexCoord3svARB = _mesa_MultiTexCoord3svARB;
exec->MultiTexCoord4dARB = _mesa_MultiTexCoord4dARB;
exec->MultiTexCoord4dvARB = _mesa_MultiTexCoord4dvARB;
exec->MultiTexCoord4fARB = _mesa_MultiTexCoord4fARB;
exec->MultiTexCoord4fvARB = _mesa_MultiTexCoord4fvARB;
exec->MultiTexCoord4iARB = _mesa_MultiTexCoord4iARB;
exec->MultiTexCoord4ivARB = _mesa_MultiTexCoord4ivARB;
exec->MultiTexCoord4sARB = _mesa_MultiTexCoord4sARB;
exec->MultiTexCoord4svARB = _mesa_MultiTexCoord4svARB;
#endif

#ifdef _GLAPI_INGR_blend_func_separate
exec->BlendFuncSeparateINGR = _mesa_BlendFuncSeparateINGR;
#endif

#ifdef _GLAPI_MESA_window_pos
exec->WindowPos4fMESA = _mesa_WindowPos4fMESA;
#endif

#ifdef _GLAPI_MESA_resize_buffers
exec->ResizeBuffersMESA = _mesa_ResizeBuffersMESA;
#endif
}


+ 1639
- 635
src/mesa/main/dlist.c
File diff suppressed because it is too large
View File


+ 10
- 11
src/mesa/main/dlist.h View File

/* $Id: dlist.h,v 1.1 1999/08/19 00:55:41 jtg Exp $ */
/* $Id: dlist.h,v 1.2 1999/11/11 01:22:26 brianp Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library


extern void gl_destroy_list( GLcontext *ctx, GLuint list ); extern void gl_destroy_list( GLcontext *ctx, GLuint list );


extern void gl_CallList( GLcontext *ctx, GLuint list );
extern void _mesa_CallList( GLuint list );


extern void gl_CallLists( GLcontext *ctx,
GLsizei n, GLenum type, const GLvoid *lists );
extern void _mesa_CallLists( GLsizei n, GLenum type, const GLvoid *lists );


extern void gl_DeleteLists( GLcontext *ctx, GLuint list, GLsizei range );
extern void _mesa_DeleteLists( GLuint list, GLsizei range );


extern void gl_EndList( GLcontext *ctx );
extern void _mesa_EndList( void );


extern GLuint gl_GenLists( GLcontext *ctx, GLsizei range );
extern GLuint _mesa_GenLists( GLsizei range );


extern GLboolean gl_IsList( GLcontext *ctx, GLuint list );
extern GLboolean _mesa_IsList( GLuint list );


extern void gl_ListBase( GLcontext *ctx, GLuint base );
extern void _mesa_ListBase( GLuint base );


extern void gl_NewList( GLcontext *ctx, GLuint list, GLenum mode );
extern void _mesa_NewList( GLuint list, GLenum mode );


extern void gl_init_dlist_pointers( struct gl_api_table *table );
extern void _mesa_init_dlist_table( struct _glapi_table *table );




extern void gl_compile_cassette( GLcontext *ctx ); extern void gl_compile_cassette( GLcontext *ctx );

+ 159
- 414
src/mesa/main/drawpix.c View File

/* $Id: drawpix.c,v 1.5 1999/11/08 07:36:44 brianp Exp $ */
/* $Id: drawpix.c,v 1.6 1999/11/11 01:22:26 brianp Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
* Version: 3.1
* Version: 3.3
* *
* Copyright (C) 1999 Brian Paul All Rights Reserved. * Copyright (C) 1999 Brian Paul All Rights Reserved.
* *
*/ */







#ifdef PC_HEADER #ifdef PC_HEADER
#include "all.h" #include "all.h"
#else #else
#ifndef XFree86Server
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#else
#include "GL/xf86glx.h"
#endif
#include "glheader.h"
#include "context.h" #include "context.h"
#include "drawpix.h" #include "drawpix.h"
#include "feedback.h" #include "feedback.h"






/* TODO: apply texture mapping to fragments */


/* /*
* Try to do a fast glDrawPixels. Conditions include:
* not using a display list
* simple pixel unpacking
* no raster ops
* etc....
* Try to do a fast and simple RGB(a) glDrawPixels.
* Return: GL_TRUE if success, GL_FALSE if slow path must be used instead * Return: GL_TRUE if success, GL_FALSE if slow path must be used instead
*/ */
GLboolean gl_direct_DrawPixels( GLcontext *ctx,
const struct gl_pixelstore_attrib *unpack,
GLsizei width, GLsizei height,
GLenum format, GLenum type,
const GLvoid *pixels )
static GLboolean
simple_DrawPixels( GLcontext *ctx, GLint x, GLint y,
GLsizei width, GLsizei height, GLenum format, GLenum type,
const GLvoid *pixels )
{ {
const struct gl_pixelstore_attrib *unpack = &ctx->Unpack;
GLubyte rgb[MAX_WIDTH][3]; GLubyte rgb[MAX_WIDTH][3];
GLubyte rgba[MAX_WIDTH][4]; GLubyte rgba[MAX_WIDTH][4];


} }


/* see if device driver can do the drawpix */ /* see if device driver can do the drawpix */
if (ctx->Driver.DrawPixels) {
GLint x = (GLint) (ctx->Current.RasterPos[0] + 0.5F);
GLint y = (GLint) (ctx->Current.RasterPos[1] + 0.5F);
if ((*ctx->Driver.DrawPixels)(ctx, x, y, width, height, format, type,
unpack, pixels))
return GL_TRUE;
if (ctx->Driver.DrawPixels
&& (*ctx->Driver.DrawPixels)(ctx, x, y, width, height, format, type,
unpack, pixels)) {
return GL_TRUE;
} }


if ((ctx->RasterMask&(~(SCISSOR_BIT|WINCLIP_BIT)))==0 if ((ctx->RasterMask&(~(SCISSOR_BIT|WINCLIP_BIT)))==0
&& !unpack->SwapBytes && !unpack->SwapBytes
&& !unpack->LsbFirst) { && !unpack->LsbFirst) {


GLint destX = (GLint) (ctx->Current.RasterPos[0] + 0.5F);
GLint destY = (GLint) (ctx->Current.RasterPos[1] + 0.5F);
GLint destX = x;
GLint destY = y;
GLint drawWidth = width; /* actual width drawn */ GLint drawWidth = width; /* actual width drawn */
GLint drawHeight = height; /* actual height drawn */ GLint drawHeight = height; /* actual height drawn */
GLint skipPixels = unpack->SkipPixels; GLint skipPixels = unpack->SkipPixels;
return GL_FALSE; return GL_FALSE;
} }
} }
else {
/* can't do direct render, have to use slow path */
return GL_FALSE;
}

/* can't do a simple draw, have to use slow path */
return GL_FALSE;
} }




/* /*
* Do glDrawPixels of index pixels. * Do glDrawPixels of index pixels.
*/ */
static void draw_index_pixels( GLcontext *ctx, GLint x, GLint y,
const struct gl_image *image )
static void
draw_index_pixels( GLcontext *ctx, GLint x, GLint y,
GLsizei width, GLsizei height,
GLenum type, const GLvoid *pixels )
{ {
GLint width, height, widthInBytes;
const GLboolean zoom = ctx->Pixel.ZoomX!=1.0 || ctx->Pixel.ZoomY!=1.0;
const GLint desty = y; const GLint desty = y;
GLint i, j;
GLint row, drawWidth;
GLdepth zspan[MAX_WIDTH]; GLdepth zspan[MAX_WIDTH];
const GLboolean zoom = ctx->Pixel.ZoomX!=1.0 || ctx->Pixel.ZoomY!=1.0;


assert(image);
assert(image->Format == GL_COLOR_INDEX);

width = image->Width;
height = image->Height;
if (image->Type == GL_BITMAP)
widthInBytes = (width + 7) / 8;
else
widthInBytes = width;
drawWidth = (width > MAX_WIDTH) ? MAX_WIDTH : width;


/* Fragment depth values */ /* Fragment depth values */
if (ctx->Depth.Test) { if (ctx->Depth.Test) {
GLdepth zval = (GLdepth) (ctx->Current.RasterPos[2] * DEPTH_SCALE); GLdepth zval = (GLdepth) (ctx->Current.RasterPos[2] * DEPTH_SCALE);
for (i=0;i<width;i++) {
GLint i;
for (i = 0; i < drawWidth; i++) {
zspan[i] = zval; zspan[i] = zval;
} }
} }


/* process the image row by row */
for (i=0;i<height;i++,y++) {
GLuint ispan[MAX_WIDTH];

/* convert to uints */
switch (image->Type) {
case GL_UNSIGNED_BYTE:
{
GLubyte *src = (GLubyte *) image->Data + i * width;
for (j=0;j<width;j++) {
ispan[j] = (GLuint) *src++;
}
}
break;
case GL_FLOAT:
{
GLfloat *src = (GLfloat *) image->Data + i * width;
for (j=0;j<width;j++) {
ispan[j] = (GLuint) (GLint) *src++;
}
}
break;
case GL_BITMAP:
{
GLubyte *src = (GLubyte *) image->Data + i * widthInBytes;
for (j=0;j<width;j++) {
ispan[j] = ( src[j >> 3] >> (7 - (j & 0x7)) ) & 1;
}
}
break;
default:
gl_problem( ctx, "draw_index_pixels type" );
return;
}

/* apply shift and offset */
if (ctx->Pixel.IndexOffset || ctx->Pixel.IndexShift) {
gl_shift_and_offset_ci( ctx, width, ispan );
}

if (ctx->Visual->RGBAflag) {
/* Convert index to RGBA and write to frame buffer */
GLubyte rgba[MAX_WIDTH][4];
gl_map_ci_to_rgba( ctx, width, ispan, rgba );
if (zoom) {
gl_write_zoomed_rgba_span( ctx, width, x, y, zspan,
(const GLubyte (*)[4])rgba, desty );
}
else {
gl_write_rgba_span( ctx, width, x, y, zspan, rgba, GL_BITMAP );
}
/*
* General solution
*/
for (row = 0; row < height; row++, y++) {
GLuint indexes[MAX_WIDTH];
const GLvoid *source = gl_pixel_addr_in_image(&ctx->Unpack,
pixels, width, height, GL_COLOR_INDEX, type, 0, row, 0);
_mesa_unpack_index_span(ctx, drawWidth, GL_UNSIGNED_INT, indexes,
type, source, &ctx->Unpack, GL_TRUE);
if (zoom) {
gl_write_zoomed_index_span(ctx, drawWidth, x, y, zspan, indexes, desty);
} }
else { else {
/* optionally apply index map then write to frame buffer */
if (ctx->Pixel.MapColorFlag) {
gl_map_ci(ctx, width, ispan);
}
if (zoom) {
gl_write_zoomed_index_span( ctx, width, x, y, zspan, ispan, desty );
}
else {
gl_write_index_span( ctx, width, x, y, zspan, ispan, GL_BITMAP );
}
gl_write_index_span(ctx, drawWidth, x, y, zspan, indexes, GL_BITMAP);
} }
} }

} }




* Do glDrawPixels of stencil image. The image datatype may either * Do glDrawPixels of stencil image. The image datatype may either
* be GLubyte or GLbitmap. * be GLubyte or GLbitmap.
*/ */
static void draw_stencil_pixels( GLcontext *ctx, GLint x, GLint y,
const struct gl_image *image )
static void
draw_stencil_pixels( GLcontext *ctx, GLint x, GLint y,
GLsizei width, GLsizei height,
GLenum type, const GLvoid *pixels )
{ {
GLint widthInBytes, width, height;
const GLint desty = y;
GLint i;
const GLboolean zoom = ctx->Pixel.ZoomX!=1.0 || ctx->Pixel.ZoomY!=1.0; const GLboolean zoom = ctx->Pixel.ZoomX!=1.0 || ctx->Pixel.ZoomY!=1.0;

if (image->Type != GL_BYTE &&
image->Type != GL_UNSIGNED_BYTE &&
image->Type != GL_SHORT &&
image->Type != GL_UNSIGNED_SHORT &&
image->Type != GL_INT &&
image->Type != GL_UNSIGNED_INT &&
image->Type != GL_FLOAT &&
image->Type != GL_BITMAP) {
gl_error( ctx, GL_INVALID_OPERATION, "glDrawPixels(stencil type)");
const GLint desty = y;
GLint row, drawWidth;

if (type != GL_BYTE &&
type != GL_UNSIGNED_BYTE &&
type != GL_SHORT &&
type != GL_UNSIGNED_SHORT &&
type != GL_INT &&
type != GL_UNSIGNED_INT &&
type != GL_FLOAT &&
type != GL_BITMAP) {
gl_error( ctx, GL_INVALID_ENUM, "glDrawPixels(stencil type)");
return; return;
} }


assert(image);
assert(image->Format == GL_STENCIL_INDEX);
assert(image->Type == GL_UNSIGNED_BYTE || image->Type == GL_BITMAP);

if (image->Type == GL_UNSIGNED_BYTE)
widthInBytes = image->Width;
else
widthInBytes = (image->Width + 7) / 8;
width = image->Width;
height = image->Height;

/* process the image row by row */
for (i=0;i<height;i++,y++) {
GLstencil *src = (GLstencil*)image->Data + i * widthInBytes;
GLstencil *stencilValues;
GLstencil stencilCopy[MAX_WIDTH];

if (image->Type == GL_BITMAP) {
/* convert bitmap data to GLubyte (0 or 1) data */
GLint j;
for (j = 0; j < width; j++) {
stencilCopy[j] = ( src[j >> 3] >> (7 - (j & 0x7)) ) & 1;
}
src = stencilCopy;
}

if (ctx->Pixel.IndexOffset || ctx->Pixel.IndexShift
|| ctx->Pixel.MapStencilFlag) {
drawWidth = (width > MAX_WIDTH) ? MAX_WIDTH : width;


/* make copy of stencil values */
if (src != stencilCopy)
MEMCPY( stencilCopy, src, width * sizeof(GLstencil));
for (row = 0; row < height; row++, y++) {
GLstencil values[MAX_WIDTH];
GLenum destType = (sizeof(GLstencil) == sizeof(GLubyte))
? GL_UNSIGNED_BYTE : GL_UNSIGNED_SHORT;
const GLvoid *source = gl_pixel_addr_in_image(&ctx->Unpack,
pixels, width, height, GL_COLOR_INDEX, type, 0, row, 0);
_mesa_unpack_index_span(ctx, drawWidth, destType, values,
type, source, &ctx->Unpack, GL_TRUE);


/* apply shift and offset */
if (ctx->Pixel.IndexOffset || ctx->Pixel.IndexShift) {
gl_shift_and_offset_stencil( ctx, width, stencilCopy );
}

/* mapping */
if (ctx->Pixel.MapStencilFlag) {
gl_map_stencil( ctx, width, stencilCopy );
}

stencilValues = stencilCopy;
}
else {
/* use stencil values in-place */
stencilValues = src;
}

/* write stencil values to stencil buffer */
if (zoom) { if (zoom) {
gl_write_zoomed_stencil_span( ctx, (GLuint) width, x, y,
stencilValues, desty );
gl_write_zoomed_stencil_span( ctx, (GLuint) drawWidth, x, y,
values, desty );
} }
else { else {
gl_write_stencil_span( ctx, (GLuint) width, x, y, stencilValues );
gl_write_stencil_span( ctx, (GLuint) drawWidth, x, y, values );
} }
} }
} }
/* /*
* Do a glDrawPixels of depth values. * Do a glDrawPixels of depth values.
*/ */
static void draw_depth_pixels( GLcontext *ctx, GLint x, GLint y,
const struct gl_image *image )
static void
draw_depth_pixels( GLcontext *ctx, GLint x, GLint y,
GLsizei width, GLsizei height,
GLenum type, const GLvoid *pixels )
{ {
GLint width, height;
const GLboolean bias_or_scale = ctx->Pixel.DepthBias!=0.0 || ctx->Pixel.DepthScale!=1.0;
const GLboolean zoom = ctx->Pixel.ZoomX!=1.0 || ctx->Pixel.ZoomY!=1.0;
const GLint desty = y; const GLint desty = y;
GLubyte rgba[MAX_WIDTH][4]; GLubyte rgba[MAX_WIDTH][4];
GLuint ispan[MAX_WIDTH]; GLuint ispan[MAX_WIDTH];
const GLboolean bias_or_scale = ctx->Pixel.DepthBias!=0.0 || ctx->Pixel.DepthScale!=1.0;
const GLboolean zoom = ctx->Pixel.ZoomX!=1.0 || ctx->Pixel.ZoomY!=1.0;

assert(image);
assert(image->Format == GL_DEPTH_COMPONENT);

width = image->Width;
height = image->Height;
GLint drawWidth = (width > MAX_WIDTH) ? MAX_WIDTH : width;

if (type != GL_UNSIGNED_BYTE
&& type != GL_UNSIGNED_BYTE
&& type != GL_UNSIGNED_SHORT
&& type != GL_UNSIGNED_SHORT
&& type != GL_UNSIGNED_INT
&& type != GL_UNSIGNED_INT
&& type != GL_FLOAT) {
gl_error(ctx, GL_INVALID_ENUM, "glDrawPixels(type)");
return;
}


/* Color or index */
/* Colors or indexes */
if (ctx->Visual->RGBAflag) { if (ctx->Visual->RGBAflag) {
GLint r = (GLint) (ctx->Current.RasterColor[0] * 255.0F); GLint r = (GLint) (ctx->Current.RasterColor[0] * 255.0F);
GLint g = (GLint) (ctx->Current.RasterColor[1] * 255.0F); GLint g = (GLint) (ctx->Current.RasterColor[1] * 255.0F);
GLint b = (GLint) (ctx->Current.RasterColor[2] * 255.0F); GLint b = (GLint) (ctx->Current.RasterColor[2] * 255.0F);
GLint a = (GLint) (ctx->Current.RasterColor[3] * 255.0F); GLint a = (GLint) (ctx->Current.RasterColor[3] * 255.0F);
GLint i; GLint i;
for (i=0; i<width; i++) {
for (i = 0; i < drawWidth; i++) {
rgba[i][RCOMP] = r; rgba[i][RCOMP] = r;
rgba[i][GCOMP] = g; rgba[i][GCOMP] = g;
rgba[i][BCOMP] = b; rgba[i][BCOMP] = b;
} }
else { else {
GLint i; GLint i;
for (i=0;i<width;i++) {
for (i = 0; i < drawWidth; i++) {
ispan[i] = ctx->Current.RasterIndex; ispan[i] = ctx->Current.RasterIndex;
} }
} }


if (image->Type==GL_UNSIGNED_SHORT && sizeof(GLdepth)==sizeof(GLushort)
if (type==GL_UNSIGNED_SHORT && sizeof(GLdepth)==sizeof(GLushort)
&& !bias_or_scale && !zoom && ctx->Visual->RGBAflag) { && !bias_or_scale && !zoom && ctx->Visual->RGBAflag) {
/* Special case: directly write 16-bit depth values */ /* Special case: directly write 16-bit depth values */
GLint j;
for (j=0;j<height;j++,y++) {
GLdepth *zptr = (GLdepth *) image->Data + j * width;
GLint row;
for (row = 0; row < height; row++, y++) {
const GLdepth *zptr = gl_pixel_addr_in_image(&ctx->Unpack,
pixels, width, height, GL_DEPTH_COMPONENT, type, 0, row, 0);
gl_write_rgba_span( ctx, width, x, y, zptr, rgba, GL_BITMAP ); gl_write_rgba_span( ctx, width, x, y, zptr, rgba, GL_BITMAP );
} }
} }
else if (image->Type==GL_UNSIGNED_INT && sizeof(GLdepth)==sizeof(GLuint)
else if (type==GL_UNSIGNED_INT && sizeof(GLdepth)==sizeof(GLuint)
&& !bias_or_scale && !zoom && ctx->Visual->RGBAflag) { && !bias_or_scale && !zoom && ctx->Visual->RGBAflag) {
/* Special case: directly write 32-bit depth values */ /* Special case: directly write 32-bit depth values */
GLint i, j;
GLint i, row;
/* Compute shift value to scale 32-bit uints down to depth values. */ /* Compute shift value to scale 32-bit uints down to depth values. */
GLuint shift = 0; GLuint shift = 0;
GLuint max = MAX_DEPTH; GLuint max = MAX_DEPTH;
while ((max&0x80000000)==0) {
while ((max & 0x80000000) == 0) {
max = max << 1; max = max << 1;
shift++; shift++;
} }
for (j=0;j<height;j++,y++) {
for (row = 0; row < height; row++, y++) {
GLdepth zspan[MAX_WIDTH]; GLdepth zspan[MAX_WIDTH];
GLuint *zptr = (GLuint *) image->Data + j * width;
const GLdepth *zptr = gl_pixel_addr_in_image(&ctx->Unpack,
pixels, width, height, GL_DEPTH_COMPONENT, type, 0, row, 0);
for (i=0;i<width;i++) { for (i=0;i<width;i++) {
zspan[i] = zptr[i] >> shift; zspan[i] = zptr[i] >> shift;
} }
} }
} }
else { else {
/* General case (slower) */
GLint i, j;

/* process image row by row */
for (i=0;i<height;i++,y++) {
GLfloat depth[MAX_WIDTH];
/* General case */
GLint row;
for (row = 0; row < height; row++, y++) {
GLdepth zspan[MAX_WIDTH]; GLdepth zspan[MAX_WIDTH];

switch (image->Type) {
case GL_UNSIGNED_SHORT:
{
GLushort *src = (GLushort *) image->Data + i * width;
for (j=0;j<width;j++) {
depth[j] = USHORT_TO_FLOAT( *src++ );
}
}
break;
case GL_UNSIGNED_INT:
{
GLuint *src = (GLuint *) image->Data + i * width;
for (j=0;j<width;j++) {
depth[j] = UINT_TO_FLOAT( *src++ );
}
}
break;
case GL_FLOAT:
{
GLfloat *src = (GLfloat *) image->Data + i * width;
for (j=0;j<width;j++) {
depth[j] = *src++;
}
}
break;
default:
gl_problem(ctx, "Bad type in draw_depth_pixels");
return;
}

/* apply depth scale and bias */
if (ctx->Pixel.DepthScale!=1.0 || ctx->Pixel.DepthBias!=0.0) {
for (j=0;j<width;j++) {
depth[j] = depth[j] * ctx->Pixel.DepthScale + ctx->Pixel.DepthBias;
}
}

/* clamp depth values to [0,1] and convert from floats to integers */
for (j=0;j<width;j++) {
zspan[j] = (GLdepth) (CLAMP( depth[j], 0.0F, 1.0F ) * DEPTH_SCALE);
}

const GLvoid *src = gl_pixel_addr_in_image(&ctx->Unpack,
pixels, width, height, GL_DEPTH_COMPONENT, type, 0, row, 0);
_mesa_unpack_depth_span( ctx, drawWidth, zspan, type, src,
&ctx->Unpack, GL_TRUE );
if (ctx->Visual->RGBAflag) { if (ctx->Visual->RGBAflag) {
if (zoom) { if (zoom) {
gl_write_zoomed_rgba_span( ctx, width, x, y, zspan,
(const GLubyte (*)[4])rgba, desty );
gl_write_zoomed_rgba_span(ctx, width, x, y, zspan,
(const GLubyte (*)[4])rgba, desty);
} }
else { else {
gl_write_rgba_span( ctx, width, x, y, zspan, rgba, GL_BITMAP );
gl_write_rgba_span(ctx, width, x, y, zspan, rgba, GL_BITMAP);
} }
} }
else { else {
if (zoom) { if (zoom) {
gl_write_zoomed_index_span( ctx, width, x, y, zspan,
ispan, GL_BITMAP );
gl_write_zoomed_index_span(ctx, width, x, y, zspan,
ispan, GL_BITMAP);
} }
else { else {
gl_write_index_span( ctx, width, x, y, zspan, ispan, GL_BITMAP );
gl_write_index_span(ctx, width, x, y, zspan, ispan, GL_BITMAP);
} }
} }


} }





/* Simple unpacking parameters: */
static struct gl_pixelstore_attrib NoUnpack = {
1, /* Alignment */
0, /* RowLength */
0, /* SkipPixels */
0, /* SkipRows */
0, /* ImageHeight */
0, /* SkipImages */
GL_FALSE, /* SwapBytes */
GL_FALSE /* LsbFirst */
};


/* /*
* Do glDrawPixels of RGBA pixels. * Do glDrawPixels of RGBA pixels.
*/ */
static void draw_rgba_pixels( GLcontext *ctx, GLint x, GLint y,
const struct gl_image *image )
static void
draw_rgba_pixels( GLcontext *ctx, GLint x, GLint y,
GLsizei width, GLsizei height,
GLenum format, GLenum type, const GLvoid *pixels )
{ {
GLint width, height;
GLint i, j;
const struct gl_pixelstore_attrib *unpack = &ctx->Unpack;
const GLboolean zoom = ctx->Pixel.ZoomX!=1.0 || ctx->Pixel.ZoomY!=1.0;
const GLint desty = y; const GLint desty = y;
GLdepth zspan[MAX_WIDTH]; GLdepth zspan[MAX_WIDTH];
GLboolean quickDraw; GLboolean quickDraw;
const GLboolean zoom = ctx->Pixel.ZoomX!=1.0 || ctx->Pixel.ZoomY!=1.0;

assert(image);


/* Try an optimized glDrawPixels first */ /* Try an optimized glDrawPixels first */
if (gl_direct_DrawPixels(ctx, &NoUnpack, image->Width, image->Height,
image->Format, image->Type, image->Data ))
if (simple_DrawPixels(ctx, x, y, width, height, format, type, pixels))
return; return;


width = image->Width;
height = image->Height;

/* Fragment depth values */ /* Fragment depth values */
if (ctx->Depth.Test) { if (ctx->Depth.Test) {
/* fill in array of z values */ /* fill in array of z values */
GLdepth z = (GLdepth) (ctx->Current.RasterPos[2] * DEPTH_SCALE); GLdepth z = (GLdepth) (ctx->Current.RasterPos[2] * DEPTH_SCALE);
GLint i;
for (i=0;i<width;i++) { for (i=0;i<width;i++) {
zspan[i] = z; zspan[i] = z;
} }
} }


if (ctx->RasterMask==0 && !zoom && x>=0 && y>=0
&& x+width<=ctx->Buffer->Width && y+height<=ctx->Buffer->Height) {

if (ctx->RasterMask == 0 && !zoom
&& x >= 0 && y >= 0
&& x + width <= ctx->Buffer->Width
&& y + height <= ctx->Buffer->Height) {
quickDraw = GL_TRUE; quickDraw = GL_TRUE;
} }
else { else {
quickDraw = GL_FALSE; quickDraw = GL_FALSE;
} }


/*
* General solution
*/
{ {
/* General solution */
GLboolean r_flag, g_flag, b_flag, a_flag, l_flag;
GLuint components;
GLubyte rgba[MAX_WIDTH][4]; GLubyte rgba[MAX_WIDTH][4];
GLfloat rf[MAX_WIDTH];
GLfloat gf[MAX_WIDTH];
GLfloat bf[MAX_WIDTH];
DEFARRAY(GLfloat,af,MAX_WIDTH);
CHECKARRAY(af,return);

r_flag = g_flag = b_flag = a_flag = l_flag = GL_FALSE;
switch (image->Format) {
case GL_RED:
r_flag = GL_TRUE;
components = 1;
break;
case GL_GREEN:
g_flag = GL_TRUE;
components = 1;
break;
case GL_BLUE:
b_flag = GL_TRUE;
components = 1;
break;
case GL_ALPHA:
a_flag = GL_TRUE;
components = 1;
break;
case GL_RGB:
r_flag = g_flag = b_flag = GL_TRUE;
components = 3;
break;
case GL_LUMINANCE:
l_flag = GL_TRUE;
components = 1;
break;
case GL_LUMINANCE_ALPHA:
l_flag = a_flag = GL_TRUE;
components = 2;
break;
case GL_RGBA:
r_flag = g_flag = b_flag = a_flag = GL_TRUE;
components = 4;
break;
default:
gl_problem(ctx, "Bad type in draw_rgba_pixels");
goto cleanup;
}
GLint row;
if (width > MAX_WIDTH)
width = MAX_WIDTH;
for (row = 0; row < height; row++, y++) {
const GLvoid *source = gl_pixel_addr_in_image(unpack,
pixels, width, height, format, type, 0, row, 0);
_mesa_unpack_ubyte_color_span(ctx, width, GL_RGBA, (void*) rgba,
format, type, source, unpack, GL_TRUE);


/* process the image row by row */
for (i=0;i<height;i++,y++) {
/* convert to floats */
switch (image->Type) {
case GL_UNSIGNED_BYTE:
{
GLubyte *src = (GLubyte *) image->Data + i * width * components;
for (j=0;j<width;j++) {
if (l_flag) {
rf[j] = gf[j] = bf[j] = UBYTE_TO_FLOAT(*src++);
}
else {
rf[j] = r_flag ? UBYTE_TO_FLOAT(*src++) : 0.0;
gf[j] = g_flag ? UBYTE_TO_FLOAT(*src++) : 0.0;
bf[j] = b_flag ? UBYTE_TO_FLOAT(*src++) : 0.0;
}
af[j] = a_flag ? UBYTE_TO_FLOAT(*src++) : 1.0;
}
}
break;
case GL_FLOAT:
{
GLfloat *src = (GLfloat *) image->Data + i * width * components;
for (j=0;j<width;j++) {
if (l_flag) {
rf[j] = gf[j] = bf[j] = *src++;
}
else {
rf[j] = r_flag ? *src++ : 0.0;
gf[j] = g_flag ? *src++ : 0.0;
bf[j] = b_flag ? *src++ : 0.0;
}
af[j] = a_flag ? *src++ : 1.0;
}
}
break;
default:
gl_problem( ctx, "draw_rgba_pixels type" );
goto cleanup;
}

/* apply scale and bias */
if (ctx->Pixel.ScaleOrBiasRGBA) {
gl_scale_and_bias_color(ctx, width, rf, gf, bf, af);
}

/* apply pixel mappings */
if (ctx->Pixel.MapColorFlag) {
gl_map_color(ctx, width, rf, gf, bf, af);
}

/* convert to integers */
for (j=0;j<width;j++) {
rgba[j][RCOMP] = (GLint) (rf[j] * 255.0F);
rgba[j][GCOMP] = (GLint) (gf[j] * 255.0F);
rgba[j][BCOMP] = (GLint) (bf[j] * 255.0F);
rgba[j][ACOMP] = (GLint) (af[j] * 255.0F);
}

/* write to frame buffer */
if (quickDraw) { if (quickDraw) {
(*ctx->Driver.WriteRGBASpan)( ctx, width, x, y,
(const GLubyte (*)[4])rgba, NULL);
(*ctx->Driver.WriteRGBASpan)( ctx, width, x, y,
(CONST GLubyte (*)[]) rgba, NULL);
} }
else if (zoom) { else if (zoom) {
gl_write_zoomed_rgba_span( ctx, width, x, y, zspan, gl_write_zoomed_rgba_span( ctx, width, x, y, zspan,
(const GLubyte (*)[4])rgba, desty );
(CONST GLubyte (*)[]) rgba, desty );
} }
else { else {
gl_write_rgba_span( ctx, (GLuint) width, x, y, zspan, rgba, GL_BITMAP); gl_write_rgba_span( ctx, (GLuint) width, x, y, zspan, rgba, GL_BITMAP);
} }
} }
cleanup:
UNDEFARRAY(af);
} }
} }


/* /*
* Execute glDrawPixels * Execute glDrawPixels
*/ */
void gl_DrawPixels( GLcontext* ctx, struct gl_image *image )
void
_mesa_DrawPixels( GLsizei width, GLsizei height,
GLenum format, GLenum type, const GLvoid *pixels )
{ {
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glDrawPixels"); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glDrawPixels");



if (gl_image_error_test( ctx, image, "glDrawPixels" ))
return;

if (ctx->RenderMode==GL_RENDER) { if (ctx->RenderMode==GL_RENDER) {
GLint x, y; GLint x, y;
if (!ctx->Current.RasterPosValid) {
if (!pixels || !ctx->Current.RasterPosValid) {
return; return;
} }


x = (GLint) (ctx->Current.RasterPos[0] + 0.5F); x = (GLint) (ctx->Current.RasterPos[0] + 0.5F);
y = (GLint) (ctx->Current.RasterPos[1] + 0.5F); y = (GLint) (ctx->Current.RasterPos[1] + 0.5F);


switch (image->Format) {
case GL_COLOR_INDEX:
draw_index_pixels( ctx, x, y, image );
break;
switch (format) {
case GL_STENCIL_INDEX: case GL_STENCIL_INDEX:
draw_stencil_pixels( ctx, x, y, image );
draw_stencil_pixels( ctx, x, y, width, height, type, pixels );
break; break;
case GL_DEPTH_COMPONENT: case GL_DEPTH_COMPONENT:
draw_depth_pixels( ctx, x, y, image );
draw_depth_pixels( ctx, x, y, width, height, type, pixels );
break;
case GL_COLOR_INDEX:
if (ctx->Visual->RGBAflag)
draw_index_pixels(ctx, x, y, width, height, type, pixels);
else
draw_rgba_pixels(ctx, x,y, width, height, format, type, pixels);
break; break;
case GL_RED: case GL_RED:
case GL_GREEN: case GL_GREEN:
case GL_BLUE: case GL_BLUE:
case GL_ALPHA: case GL_ALPHA:
case GL_RGB:
case GL_LUMINANCE: case GL_LUMINANCE:
case GL_LUMINANCE_ALPHA: case GL_LUMINANCE_ALPHA:
case GL_RGB:
case GL_BGR:
case GL_RGBA: case GL_RGBA:
draw_rgba_pixels( ctx, x, y, image );
case GL_BGRA:
case GL_ABGR_EXT:
draw_rgba_pixels(ctx, x, y, width, height, format, type, pixels);
break; break;
default: default:
gl_error( ctx, GL_INVALID_ENUM, "glDrawPixels" );
gl_error( ctx, GL_INVALID_ENUM, "glDrawPixels(format)" );
return; return;
} }
} }

+ 5
- 19
src/mesa/main/drawpix.h View File

/* $Id: drawpix.h,v 1.1 1999/08/19 00:55:41 jtg Exp $ */
/* $Id: drawpix.h,v 1.2 1999/11/11 01:22:26 brianp Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
* Version: 3.1
* Version: 3.3
* *
* Copyright (C) 1999 Brian Paul All Rights Reserved. * Copyright (C) 1999 Brian Paul All Rights Reserved.
* *
*/ */







#ifndef DRAWPIXELS_H #ifndef DRAWPIXELS_H
#define DRAWPIXELS_H #define DRAWPIXELS_H


#include "types.h" #include "types.h"




extern GLboolean
gl_direct_DrawPixels( GLcontext *ctx,
const struct gl_pixelstore_attrib *unpack,
GLsizei width, GLsizei height,
GLenum format, GLenum type, const GLvoid *pixels );


#if 000
extern void gl_DrawPixels( GLcontext *ctx, GLsizei width, GLsizei height,
GLenum format, GLenum type, const GLvoid *pixels );
#endif


extern void gl_DrawPixels( GLcontext *ctx, struct gl_image *image );
extern void
_mesa_DrawPixels( GLsizei width, GLsizei height,
GLenum format, GLenum type, const GLvoid *pixels );




#endif #endif

+ 27
- 23
src/mesa/main/enable.c View File

/* $Id: enable.c,v 1.9 1999/11/10 06:29:44 keithw Exp $ */
/* $Id: enable.c,v 1.10 1999/11/11 01:22:26 brianp Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
* Version: 3.1
* Version: 3.3
* *
* Copyright (C) 1999 Brian Paul All Rights Reserved. * Copyright (C) 1999 Brian Paul All Rights Reserved.
* *
*/ */




/* $XFree86: xc/lib/GL/mesa/src/enable.c,v 1.3 1999/04/04 00:20:23 dawes Exp $ */

#ifdef PC_HEADER #ifdef PC_HEADER
#include "all.h" #include "all.h"
#else #else
#ifndef XFree86Server
#include <stdio.h>
#include <string.h>
#else
#include "GL/xf86glx.h"
#endif
#include "glheader.h"
#include "context.h" #include "context.h"
#include "enable.h" #include "enable.h"
#include "light.h" #include "light.h"
/* /*
* Perform glEnable and glDisable calls. * Perform glEnable and glDisable calls.
*/ */
void gl_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
{ {
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx, "gl_enable/disable" ); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx, "gl_enable/disable" );


if (ctx->Light.ColorMaterialEnabled!=state) { if (ctx->Light.ColorMaterialEnabled!=state) {
ctx->Light.ColorMaterialEnabled = state; ctx->Light.ColorMaterialEnabled = state;
ctx->NewState |= NEW_LIGHTING; ctx->NewState |= NEW_LIGHTING;
if (state)
gl_update_color_material( ctx, ctx->Current.ByteColor );
if (state)
gl_update_color_material( ctx, ctx->Current.ByteColor );
} }
break; break;
case GL_CULL_FACE: case GL_CULL_FACE:






void gl_Enable( GLcontext* ctx, GLenum cap )
void
_mesa_Enable( GLenum cap )
{ {
gl_set_enable( ctx, cap, GL_TRUE );
GET_CURRENT_CONTEXT(ctx);
_mesa_set_enable( ctx, cap, GL_TRUE );
} }






void gl_Disable( GLcontext* ctx, GLenum cap )
void
_mesa_Disable( GLenum cap )
{ {
gl_set_enable( ctx, cap, GL_FALSE );
GET_CURRENT_CONTEXT(ctx);
_mesa_set_enable( ctx, cap, GL_FALSE );
} }






GLboolean gl_IsEnabled( GLcontext* ctx, GLenum cap )
GLboolean
_mesa_IsEnabled( GLenum cap )
{ {
GET_CURRENT_CONTEXT(ctx);
switch (cap) { switch (cap) {
case GL_ALPHA_TEST: case GL_ALPHA_TEST:
return ctx->Color.AlphaEnabled; return ctx->Color.AlphaEnabled;






static void gl_client_state( GLcontext *ctx, GLenum cap, GLboolean state )
static void
client_state( GLcontext *ctx, GLenum cap, GLboolean state )
{ {
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx, ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx,
(state (state






void gl_EnableClientState( GLcontext *ctx, GLenum cap )
void
_mesa_EnableClientState( GLenum cap )
{ {
gl_client_state( ctx, cap, GL_TRUE );
GET_CURRENT_CONTEXT(ctx);
client_state( ctx, cap, GL_TRUE );
} }






void gl_DisableClientState( GLcontext *ctx, GLenum cap )
void
_mesa_DisableClientState( GLenum cap )
{ {
gl_client_state( ctx, cap, GL_FALSE );
GET_CURRENT_CONTEXT(ctx);
client_state( ctx, cap, GL_FALSE );
} }



+ 14
- 11
src/mesa/main/enable.h View File

/* $Id: enable.h,v 1.1 1999/08/19 00:55:41 jtg Exp $ */
/* $Id: enable.h,v 1.2 1999/11/11 01:22:26 brianp Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
* Version: 3.1
* Version: 3.3
* *
* Copyright (C) 1999 Brian Paul All Rights Reserved. * Copyright (C) 1999 Brian Paul All Rights Reserved.
* *
*/ */







#ifndef ENABLE_H #ifndef ENABLE_H
#define ENABLE_H #define ENABLE_H


#include "types.h" #include "types.h"




extern void gl_set_enable( GLcontext* ctx, GLenum cap, GLboolean state );
extern void
_mesa_set_enable( GLcontext* ctx, GLenum cap, GLboolean state );


extern void gl_Disable( GLcontext* ctx, GLenum cap );
extern void
_mesa_Disable( GLenum cap );


extern void gl_Enable( GLcontext* ctx, GLenum cap );
extern void
_mesa_Enable( GLenum cap );


extern GLboolean gl_IsEnabled( GLcontext* ctx, GLenum cap );
extern GLboolean
_mesa_IsEnabled( GLenum cap );


extern void gl_EnableClientState( GLcontext *ctx, GLenum cap );
extern void
_mesa_EnableClientState( GLenum cap );


extern void gl_DisableClientState( GLcontext *ctx, GLenum cap );
extern void
_mesa_DisableClientState( GLenum cap );




#endif #endif

+ 8
- 10
src/mesa/main/enums.c View File

/* $Id: enums.c,v 1.4 1999/11/08 07:36:44 brianp Exp $ */
/* $Id: enums.c,v 1.5 1999/11/11 01:22:26 brianp Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
* Version: 3.1
* Version: 3.3
* *
* Copyright (C) 1999 Brian Paul All Rights Reserved. * Copyright (C) 1999 Brian Paul All Rights Reserved.
* *
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */


#ifndef XFree86Server
#include <stdlib.h>
#include <string.h>
#else
#include "GL/xf86glx.h"
#endif


#include "GL/gl.h"
#ifdef PC_HEADER
#include "all.h"
#else
#include "glheader.h"
#include "enums.h" #include "enums.h"
#include "macros.h"
#include "mem.h"
#endif




typedef struct { typedef struct {

+ 343
- 164
src/mesa/main/eval.c View File

/* $Id: eval.c,v 1.6 1999/11/08 15:30:05 brianp Exp $ */
/* $Id: eval.c,v 1.7 1999/11/11 01:22:26 brianp Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
* Version: 3.1
* Version: 3.3
* *
* Copyright (C) 1999 Brian Paul All Rights Reserved. * Copyright (C) 1999 Brian Paul All Rights Reserved.
* *
#ifdef PC_HEADER #ifdef PC_HEADER
#include "all.h" #include "all.h"
#else #else
#ifndef XFree86Server
#include <math.h>
#include <stdlib.h>
#include <string.h>
#else
#include "GL/xf86glx.h"
#endif
#include "glheader.h"
#include "context.h" #include "context.h"
#include "eval.h" #include "eval.h"
#include "macros.h" #include "macros.h"
#include "mem.h"
#include "mmath.h" #include "mmath.h"
#include "types.h" #include "types.h"
#include "vbcull.h" #include "vbcull.h"
/* /*
* Return the number of components per control point for any type of * Return the number of components per control point for any type of
* evaluator. Return 0 if bad target. * evaluator. Return 0 if bad target.
* See table 5.1 in the OpenGL 1.2 spec.
*/ */

static GLint components( GLenum target )
GLuint _mesa_evaluator_components( GLenum target )
{ {
switch (target) { switch (target) {
case GL_MAP1_VERTEX_3: return 3; case GL_MAP1_VERTEX_3: return 3;
* Return: pointer to buffer of contiguous control points or NULL if out * Return: pointer to buffer of contiguous control points or NULL if out
* of memory. * of memory.
*/ */
GLfloat *gl_copy_map_points1f( GLenum target,
GLint ustride, GLint uorder,
GLfloat *gl_copy_map_points1f( GLenum target, GLint ustride, GLint uorder,
const GLfloat *points ) const GLfloat *points )
{ {
GLfloat *buffer, *p; GLfloat *buffer, *p;
GLint i, k, size = components(target);
GLint i, k, size = _mesa_evaluator_components(target);


if (!points || size==0) { if (!points || size==0) {
return NULL; return NULL;
/* /*
* Same as above but convert doubles to floats. * Same as above but convert doubles to floats.
*/ */
GLfloat *gl_copy_map_points1d( GLenum target,
GLint ustride, GLint uorder,
const GLdouble *points )
GLfloat *gl_copy_map_points1d( GLenum target, GLint ustride, GLint uorder,
const GLdouble *points )
{ {
GLfloat *buffer, *p; GLfloat *buffer, *p;
GLint i, k, size = components(target);
GLint i, k, size = _mesa_evaluator_components(target);


if (!points || size==0) { if (!points || size==0) {
return NULL; return NULL;
* of memory. * of memory.
*/ */
GLfloat *gl_copy_map_points2f( GLenum target, GLfloat *gl_copy_map_points2f( GLenum target,
GLint ustride, GLint uorder,
GLint vstride, GLint vorder,
const GLfloat *points )
GLint ustride, GLint uorder,
GLint vstride, GLint vorder,
const GLfloat *points )
{ {
GLfloat *buffer, *p; GLfloat *buffer, *p;
GLint i, j, k, size, dsize, hsize; GLint i, j, k, size, dsize, hsize;
GLint uinc; GLint uinc;


size = components(target);
size = _mesa_evaluator_components(target);


if (!points || size==0) { if (!points || size==0) {
return NULL; return NULL;
GLint i, j, k, size, hsize, dsize; GLint i, j, k, size, hsize, dsize;
GLint uinc; GLint uinc;


size = components(target);
size = _mesa_evaluator_components(target);


if (!points || size==0) { if (!points || size==0) {
return NULL; return NULL;
} }




#if 00
/* /*
* This function is called by the display list deallocator function to * This function is called by the display list deallocator function to
* specify that a given set of control points are no longer needed. * specify that a given set of control points are no longer needed.
} }


} }
#endif










/* /*
* Note that the array of control points must be 'unpacked' at this time.
* Input: retain - if TRUE, this control point data is also in a display
* list and can't be freed until the list is freed.
* This does the work of glMap1[fd].
*/ */
void gl_Map1f( GLcontext* ctx, GLenum target,
GLfloat u1, GLfloat u2, GLint stride,
GLint order, const GLfloat *points, GLboolean retain )
static void
map1(GLenum target, GLfloat u1, GLfloat u2, GLint ustride,
GLint uorder, const GLvoid *points, GLenum type )
{ {
GET_CURRENT_CONTEXT(ctx);
GLint k; GLint k;

if (!points) {
gl_error( ctx, GL_OUT_OF_MEMORY, "glMap1f" );
return;
}

/* may be a new stride after copying control points */
stride = components( target );
GLfloat *pnts;


ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glMap1"); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glMap1");


if (u1==u2) {
assert(type == GL_FLOAT || type == GL_DOUBLE);

if (u1 == u2) {
gl_error( ctx, GL_INVALID_VALUE, "glMap1(u1,u2)" ); gl_error( ctx, GL_INVALID_VALUE, "glMap1(u1,u2)" );
return; return;
} }

if (order<1 || order>MAX_EVAL_ORDER) {
if (uorder < 1 || uorder > MAX_EVAL_ORDER) {
gl_error( ctx, GL_INVALID_VALUE, "glMap1(order)" ); gl_error( ctx, GL_INVALID_VALUE, "glMap1(order)" );
return; return;
} }
if (!points) {
gl_error( ctx, GL_INVALID_VALUE, "glMap1(points)" );
return;
}


k = components( target );
if (k==0) {
k = _mesa_evaluator_components( target );
if (k == 0) {
gl_error( ctx, GL_INVALID_ENUM, "glMap1(target)" ); gl_error( ctx, GL_INVALID_ENUM, "glMap1(target)" );
} }


if (stride < k) {
if (ustride < k) {
gl_error( ctx, GL_INVALID_VALUE, "glMap1(stride)" ); gl_error( ctx, GL_INVALID_VALUE, "glMap1(stride)" );
return; return;
} }


/* make copy of the control points */
if (type == GL_FLOAT)
pnts = gl_copy_map_points1f(target, ustride, uorder, (GLfloat*) points);
else
pnts = gl_copy_map_points1d(target, ustride, uorder, (GLdouble*) points);

switch (target) { switch (target) {
case GL_MAP1_VERTEX_3: case GL_MAP1_VERTEX_3:
ctx->EvalMap.Map1Vertex3.Order = order;
ctx->EvalMap.Map1Vertex3.Order = uorder;
ctx->EvalMap.Map1Vertex3.u1 = u1; ctx->EvalMap.Map1Vertex3.u1 = u1;
ctx->EvalMap.Map1Vertex3.u2 = u2; ctx->EvalMap.Map1Vertex3.u2 = u2;
ctx->EvalMap.Map1Vertex3.du = 1.0 / (u2 - u1); ctx->EvalMap.Map1Vertex3.du = 1.0 / (u2 - u1);
if (ctx->EvalMap.Map1Vertex3.Points
&& !ctx->EvalMap.Map1Vertex3.Retain) {
if (ctx->EvalMap.Map1Vertex3.Points)
FREE( ctx->EvalMap.Map1Vertex3.Points ); FREE( ctx->EvalMap.Map1Vertex3.Points );
}
ctx->EvalMap.Map1Vertex3.Points = (GLfloat *) points;
ctx->EvalMap.Map1Vertex3.Retain = retain;
ctx->EvalMap.Map1Vertex3.Points = pnts;
break; break;
case GL_MAP1_VERTEX_4: case GL_MAP1_VERTEX_4:
ctx->EvalMap.Map1Vertex4.Order = order;
ctx->EvalMap.Map1Vertex4.Order = uorder;
ctx->EvalMap.Map1Vertex4.u1 = u1; ctx->EvalMap.Map1Vertex4.u1 = u1;
ctx->EvalMap.Map1Vertex4.u2 = u2; ctx->EvalMap.Map1Vertex4.u2 = u2;
ctx->EvalMap.Map1Vertex4.du = 1.0 / (u2 - u1); ctx->EvalMap.Map1Vertex4.du = 1.0 / (u2 - u1);
if (ctx->EvalMap.Map1Vertex4.Points
&& !ctx->EvalMap.Map1Vertex4.Retain) {
if (ctx->EvalMap.Map1Vertex4.Points)
FREE( ctx->EvalMap.Map1Vertex4.Points ); FREE( ctx->EvalMap.Map1Vertex4.Points );
}
ctx->EvalMap.Map1Vertex4.Points = (GLfloat *) points;
ctx->EvalMap.Map1Vertex4.Retain = retain;
ctx->EvalMap.Map1Vertex4.Points = pnts;
break; break;
case GL_MAP1_INDEX: case GL_MAP1_INDEX:
ctx->EvalMap.Map1Index.Order = order;
ctx->EvalMap.Map1Index.Order = uorder;
ctx->EvalMap.Map1Index.u1 = u1; ctx->EvalMap.Map1Index.u1 = u1;
ctx->EvalMap.Map1Index.u2 = u2; ctx->EvalMap.Map1Index.u2 = u2;
ctx->EvalMap.Map1Index.du = 1.0 / (u2 - u1); ctx->EvalMap.Map1Index.du = 1.0 / (u2 - u1);
if (ctx->EvalMap.Map1Index.Points
&& !ctx->EvalMap.Map1Index.Retain) {
if (ctx->EvalMap.Map1Index.Points)
FREE( ctx->EvalMap.Map1Index.Points ); FREE( ctx->EvalMap.Map1Index.Points );
}
ctx->EvalMap.Map1Index.Points = (GLfloat *) points;
ctx->EvalMap.Map1Index.Retain = retain;
ctx->EvalMap.Map1Index.Points = pnts;
break; break;
case GL_MAP1_COLOR_4: case GL_MAP1_COLOR_4:
ctx->EvalMap.Map1Color4.Order = order;
ctx->EvalMap.Map1Color4.Order = uorder;
ctx->EvalMap.Map1Color4.u1 = u1; ctx->EvalMap.Map1Color4.u1 = u1;
ctx->EvalMap.Map1Color4.u2 = u2; ctx->EvalMap.Map1Color4.u2 = u2;
ctx->EvalMap.Map1Color4.du = 1.0 / (u2 - u1); ctx->EvalMap.Map1Color4.du = 1.0 / (u2 - u1);
if (ctx->EvalMap.Map1Color4.Points
&& !ctx->EvalMap.Map1Color4.Retain) {
if (ctx->EvalMap.Map1Color4.Points)
FREE( ctx->EvalMap.Map1Color4.Points ); FREE( ctx->EvalMap.Map1Color4.Points );
}
ctx->EvalMap.Map1Color4.Points = (GLfloat *) points;
ctx->EvalMap.Map1Color4.Retain = retain;
ctx->EvalMap.Map1Color4.Points = pnts;
break; break;
case GL_MAP1_NORMAL: case GL_MAP1_NORMAL:
ctx->EvalMap.Map1Normal.Order = order;
ctx->EvalMap.Map1Normal.Order = uorder;
ctx->EvalMap.Map1Normal.u1 = u1; ctx->EvalMap.Map1Normal.u1 = u1;
ctx->EvalMap.Map1Normal.u2 = u2; ctx->EvalMap.Map1Normal.u2 = u2;
ctx->EvalMap.Map1Normal.du = 1.0 / (u2 - u1); ctx->EvalMap.Map1Normal.du = 1.0 / (u2 - u1);
if (ctx->EvalMap.Map1Normal.Points
&& !ctx->EvalMap.Map1Normal.Retain) {
if (ctx->EvalMap.Map1Normal.Points)
FREE( ctx->EvalMap.Map1Normal.Points ); FREE( ctx->EvalMap.Map1Normal.Points );
}
ctx->EvalMap.Map1Normal.Points = (GLfloat *) points;
ctx->EvalMap.Map1Normal.Retain = retain;
ctx->EvalMap.Map1Normal.Points = pnts;
break; break;
case GL_MAP1_TEXTURE_COORD_1: case GL_MAP1_TEXTURE_COORD_1:
ctx->EvalMap.Map1Texture1.Order = order;
ctx->EvalMap.Map1Texture1.Order = uorder;
ctx->EvalMap.Map1Texture1.u1 = u1; ctx->EvalMap.Map1Texture1.u1 = u1;
ctx->EvalMap.Map1Texture1.u2 = u2; ctx->EvalMap.Map1Texture1.u2 = u2;
ctx->EvalMap.Map1Texture1.du = 1.0 / (u2 - u1); ctx->EvalMap.Map1Texture1.du = 1.0 / (u2 - u1);
if (ctx->EvalMap.Map1Texture1.Points
&& !ctx->EvalMap.Map1Texture1.Retain) {
if (ctx->EvalMap.Map1Texture1.Points)
FREE( ctx->EvalMap.Map1Texture1.Points ); FREE( ctx->EvalMap.Map1Texture1.Points );
}
ctx->EvalMap.Map1Texture1.Points = (GLfloat *) points;
ctx->EvalMap.Map1Texture1.Retain = retain;
ctx->EvalMap.Map1Texture1.Points = pnts;
break; break;
case GL_MAP1_TEXTURE_COORD_2: case GL_MAP1_TEXTURE_COORD_2:
ctx->EvalMap.Map1Texture2.Order = order;
ctx->EvalMap.Map1Texture2.Order = uorder;
ctx->EvalMap.Map1Texture2.u1 = u1; ctx->EvalMap.Map1Texture2.u1 = u1;
ctx->EvalMap.Map1Texture2.u2 = u2; ctx->EvalMap.Map1Texture2.u2 = u2;
ctx->EvalMap.Map1Texture2.du = 1.0 / (u2 - u1); ctx->EvalMap.Map1Texture2.du = 1.0 / (u2 - u1);
if (ctx->EvalMap.Map1Texture2.Points
&& !ctx->EvalMap.Map1Texture2.Retain) {
if (ctx->EvalMap.Map1Texture2.Points)
FREE( ctx->EvalMap.Map1Texture2.Points ); FREE( ctx->EvalMap.Map1Texture2.Points );
}
ctx->EvalMap.Map1Texture2.Points = (GLfloat *) points;
ctx->EvalMap.Map1Texture2.Retain = retain;
ctx->EvalMap.Map1Texture2.Points = pnts;
break; break;
case GL_MAP1_TEXTURE_COORD_3: case GL_MAP1_TEXTURE_COORD_3:
ctx->EvalMap.Map1Texture3.Order = order;
ctx->EvalMap.Map1Texture3.Order = uorder;
ctx->EvalMap.Map1Texture3.u1 = u1; ctx->EvalMap.Map1Texture3.u1 = u1;
ctx->EvalMap.Map1Texture3.u2 = u2; ctx->EvalMap.Map1Texture3.u2 = u2;
ctx->EvalMap.Map1Texture3.du = 1.0 / (u2 - u1); ctx->EvalMap.Map1Texture3.du = 1.0 / (u2 - u1);
if (ctx->EvalMap.Map1Texture3.Points
&& !ctx->EvalMap.Map1Texture3.Retain) {
if (ctx->EvalMap.Map1Texture3.Points)
FREE( ctx->EvalMap.Map1Texture3.Points ); FREE( ctx->EvalMap.Map1Texture3.Points );
}
ctx->EvalMap.Map1Texture3.Points = (GLfloat *) points;
ctx->EvalMap.Map1Texture3.Retain = retain;
ctx->EvalMap.Map1Texture3.Points = pnts;
break; break;
case GL_MAP1_TEXTURE_COORD_4: case GL_MAP1_TEXTURE_COORD_4:
ctx->EvalMap.Map1Texture4.Order = order;
ctx->EvalMap.Map1Texture4.Order = uorder;
ctx->EvalMap.Map1Texture4.u1 = u1; ctx->EvalMap.Map1Texture4.u1 = u1;
ctx->EvalMap.Map1Texture4.u2 = u2; ctx->EvalMap.Map1Texture4.u2 = u2;
ctx->EvalMap.Map1Texture4.du = 1.0 / (u2 - u1); ctx->EvalMap.Map1Texture4.du = 1.0 / (u2 - u1);
if (ctx->EvalMap.Map1Texture4.Points
&& !ctx->EvalMap.Map1Texture4.Retain) {
if (ctx->EvalMap.Map1Texture4.Points)
FREE( ctx->EvalMap.Map1Texture4.Points ); FREE( ctx->EvalMap.Map1Texture4.Points );
}
ctx->EvalMap.Map1Texture4.Points = (GLfloat *) points;
ctx->EvalMap.Map1Texture4.Retain = retain;
ctx->EvalMap.Map1Texture4.Points = pnts;
break; break;
default: default:
gl_error( ctx, GL_INVALID_ENUM, "glMap1(target)" ); gl_error( ctx, GL_INVALID_ENUM, "glMap1(target)" );






void
_mesa_Map1f( GLenum target, GLfloat u1, GLfloat u2, GLint stride,
GLint order, const GLfloat *points )
{
map1(target, u1, u2, stride, order, points, GL_FLOAT);
}


/*
* Note that the array of control points must be 'unpacked' at this time.
* Input: retain - if TRUE, this control point data is also in a display
* list and can't be freed until the list is freed.
*/
void gl_Map2f( GLcontext* ctx, GLenum target,
GLfloat u1, GLfloat u2, GLint ustride, GLint uorder,
GLfloat v1, GLfloat v2, GLint vstride, GLint vorder,
const GLfloat *points, GLboolean retain )

void
_mesa_Map1d( GLenum target, GLdouble u1, GLdouble u2, GLint stride,
GLint order, const GLdouble *points )
{ {
map1(target, u1, u2, stride, order, points, GL_DOUBLE);
}


static void
map2( GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder,
GLfloat v1, GLfloat v2, GLint vstride, GLint vorder,
const GLvoid *points, GLenum type )
{
GET_CURRENT_CONTEXT(ctx);
GLint k; GLint k;
GLfloat *pnts;


ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glMap2"); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glMap2");


return; return;
} }


k = components( target );
k = _mesa_evaluator_components( target );
if (k==0) { if (k==0) {
gl_error( ctx, GL_INVALID_ENUM, "glMap2(target)" ); gl_error( ctx, GL_INVALID_ENUM, "glMap2(target)" );
} }
return; return;
} }


/* make copy of the control points */
if (type == GL_FLOAT)
pnts = gl_copy_map_points2f(target, ustride, uorder,
vstride, vorder, (GLfloat*) points);
else
pnts = gl_copy_map_points2d(target, ustride, uorder,
vstride, vorder, (GLdouble*) points);

switch (target) { switch (target) {
case GL_MAP2_VERTEX_3: case GL_MAP2_VERTEX_3:
ctx->EvalMap.Map2Vertex3.Uorder = uorder; ctx->EvalMap.Map2Vertex3.Uorder = uorder;
ctx->EvalMap.Map2Vertex3.v1 = v1; ctx->EvalMap.Map2Vertex3.v1 = v1;
ctx->EvalMap.Map2Vertex3.v2 = v2; ctx->EvalMap.Map2Vertex3.v2 = v2;
ctx->EvalMap.Map2Vertex3.dv = 1.0 / (v2 - v1); ctx->EvalMap.Map2Vertex3.dv = 1.0 / (v2 - v1);
if (ctx->EvalMap.Map2Vertex3.Points
&& !ctx->EvalMap.Map2Vertex3.Retain) {
if (ctx->EvalMap.Map2Vertex3.Points)
FREE( ctx->EvalMap.Map2Vertex3.Points ); FREE( ctx->EvalMap.Map2Vertex3.Points );
}
ctx->EvalMap.Map2Vertex3.Retain = retain;
ctx->EvalMap.Map2Vertex3.Points = (GLfloat *) points;
ctx->EvalMap.Map2Vertex3.Points = pnts;
break; break;
case GL_MAP2_VERTEX_4: case GL_MAP2_VERTEX_4:
ctx->EvalMap.Map2Vertex4.Uorder = uorder; ctx->EvalMap.Map2Vertex4.Uorder = uorder;
ctx->EvalMap.Map2Vertex4.v1 = v1; ctx->EvalMap.Map2Vertex4.v1 = v1;
ctx->EvalMap.Map2Vertex4.v2 = v2; ctx->EvalMap.Map2Vertex4.v2 = v2;
ctx->EvalMap.Map2Vertex4.dv = 1.0 / (v2 - v1); ctx->EvalMap.Map2Vertex4.dv = 1.0 / (v2 - v1);
if (ctx->EvalMap.Map2Vertex4.Points
&& !ctx->EvalMap.Map2Vertex4.Retain) {
if (ctx->EvalMap.Map2Vertex4.Points)
FREE( ctx->EvalMap.Map2Vertex4.Points ); FREE( ctx->EvalMap.Map2Vertex4.Points );
}
ctx->EvalMap.Map2Vertex4.Points = (GLfloat *) points;
ctx->EvalMap.Map2Vertex4.Retain = retain;
ctx->EvalMap.Map2Vertex4.Points = pnts;
break; break;
case GL_MAP2_INDEX: case GL_MAP2_INDEX:
ctx->EvalMap.Map2Index.Uorder = uorder; ctx->EvalMap.Map2Index.Uorder = uorder;
ctx->EvalMap.Map2Index.v1 = v1; ctx->EvalMap.Map2Index.v1 = v1;
ctx->EvalMap.Map2Index.v2 = v2; ctx->EvalMap.Map2Index.v2 = v2;
ctx->EvalMap.Map2Index.dv = 1.0 / (v2 - v1); ctx->EvalMap.Map2Index.dv = 1.0 / (v2 - v1);
if (ctx->EvalMap.Map2Index.Points
&& !ctx->EvalMap.Map2Index.Retain) {
if (ctx->EvalMap.Map2Index.Points)
FREE( ctx->EvalMap.Map2Index.Points ); FREE( ctx->EvalMap.Map2Index.Points );
}
ctx->EvalMap.Map2Index.Retain = retain;
ctx->EvalMap.Map2Index.Points = (GLfloat *) points;
ctx->EvalMap.Map2Index.Points = pnts;
break; break;
case GL_MAP2_COLOR_4: case GL_MAP2_COLOR_4:
ctx->EvalMap.Map2Color4.Uorder = uorder; ctx->EvalMap.Map2Color4.Uorder = uorder;
ctx->EvalMap.Map2Color4.v1 = v1; ctx->EvalMap.Map2Color4.v1 = v1;
ctx->EvalMap.Map2Color4.v2 = v2; ctx->EvalMap.Map2Color4.v2 = v2;
ctx->EvalMap.Map2Color4.dv = 1.0 / (v2 - v1); ctx->EvalMap.Map2Color4.dv = 1.0 / (v2 - v1);
if (ctx->EvalMap.Map2Color4.Points
&& !ctx->EvalMap.Map2Color4.Retain) {
if (ctx->EvalMap.Map2Color4.Points)
FREE( ctx->EvalMap.Map2Color4.Points ); FREE( ctx->EvalMap.Map2Color4.Points );
}
ctx->EvalMap.Map2Color4.Retain = retain;
ctx->EvalMap.Map2Color4.Points = (GLfloat *) points;
ctx->EvalMap.Map2Color4.Points = pnts;
break; break;
case GL_MAP2_NORMAL: case GL_MAP2_NORMAL:
ctx->EvalMap.Map2Normal.Uorder = uorder; ctx->EvalMap.Map2Normal.Uorder = uorder;
ctx->EvalMap.Map2Normal.v1 = v1; ctx->EvalMap.Map2Normal.v1 = v1;
ctx->EvalMap.Map2Normal.v2 = v2; ctx->EvalMap.Map2Normal.v2 = v2;
ctx->EvalMap.Map2Normal.dv = 1.0 / (v2 - v1); ctx->EvalMap.Map2Normal.dv = 1.0 / (v2 - v1);
if (ctx->EvalMap.Map2Normal.Points
&& !ctx->EvalMap.Map2Normal.Retain) {
if (ctx->EvalMap.Map2Normal.Points)
FREE( ctx->EvalMap.Map2Normal.Points ); FREE( ctx->EvalMap.Map2Normal.Points );
}
ctx->EvalMap.Map2Normal.Retain = retain;
ctx->EvalMap.Map2Normal.Points = (GLfloat *) points;
ctx->EvalMap.Map2Normal.Points = pnts;
break; break;
case GL_MAP2_TEXTURE_COORD_1: case GL_MAP2_TEXTURE_COORD_1:
ctx->EvalMap.Map2Texture1.Uorder = uorder; ctx->EvalMap.Map2Texture1.Uorder = uorder;
ctx->EvalMap.Map2Texture1.v1 = v1; ctx->EvalMap.Map2Texture1.v1 = v1;
ctx->EvalMap.Map2Texture1.v2 = v2; ctx->EvalMap.Map2Texture1.v2 = v2;
ctx->EvalMap.Map2Texture1.dv = 1.0 / (v2 - v1); ctx->EvalMap.Map2Texture1.dv = 1.0 / (v2 - v1);
if (ctx->EvalMap.Map2Texture1.Points
&& !ctx->EvalMap.Map2Texture1.Retain) {
if (ctx->EvalMap.Map2Texture1.Points)
FREE( ctx->EvalMap.Map2Texture1.Points ); FREE( ctx->EvalMap.Map2Texture1.Points );
}
ctx->EvalMap.Map2Texture1.Retain = retain;
ctx->EvalMap.Map2Texture1.Points = (GLfloat *) points;
ctx->EvalMap.Map2Texture1.Points = pnts;
break; break;
case GL_MAP2_TEXTURE_COORD_2: case GL_MAP2_TEXTURE_COORD_2:
ctx->EvalMap.Map2Texture2.Uorder = uorder; ctx->EvalMap.Map2Texture2.Uorder = uorder;
ctx->EvalMap.Map2Texture2.v1 = v1; ctx->EvalMap.Map2Texture2.v1 = v1;
ctx->EvalMap.Map2Texture2.v2 = v2; ctx->EvalMap.Map2Texture2.v2 = v2;
ctx->EvalMap.Map2Texture2.dv = 1.0 / (v2 - v1); ctx->EvalMap.Map2Texture2.dv = 1.0 / (v2 - v1);
if (ctx->EvalMap.Map2Texture2.Points
&& !ctx->EvalMap.Map2Texture2.Retain) {
if (ctx->EvalMap.Map2Texture2.Points)
FREE( ctx->EvalMap.Map2Texture2.Points ); FREE( ctx->EvalMap.Map2Texture2.Points );
}
ctx->EvalMap.Map2Texture2.Retain = retain;
ctx->EvalMap.Map2Texture2.Points = (GLfloat *) points;
ctx->EvalMap.Map2Texture2.Points = pnts;
break; break;
case GL_MAP2_TEXTURE_COORD_3: case GL_MAP2_TEXTURE_COORD_3:
ctx->EvalMap.Map2Texture3.Uorder = uorder; ctx->EvalMap.Map2Texture3.Uorder = uorder;
ctx->EvalMap.Map2Texture3.v1 = v1; ctx->EvalMap.Map2Texture3.v1 = v1;
ctx->EvalMap.Map2Texture3.v2 = v2; ctx->EvalMap.Map2Texture3.v2 = v2;
ctx->EvalMap.Map2Texture3.dv = 1.0 / (v2 - v1); ctx->EvalMap.Map2Texture3.dv = 1.0 / (v2 - v1);
if (ctx->EvalMap.Map2Texture3.Points
&& !ctx->EvalMap.Map2Texture3.Retain) {
if (ctx->EvalMap.Map2Texture3.Points)
FREE( ctx->EvalMap.Map2Texture3.Points ); FREE( ctx->EvalMap.Map2Texture3.Points );
}
ctx->EvalMap.Map2Texture3.Retain = retain;
ctx->EvalMap.Map2Texture3.Points = (GLfloat *) points;
ctx->EvalMap.Map2Texture3.Points = pnts;
break; break;
case GL_MAP2_TEXTURE_COORD_4: case GL_MAP2_TEXTURE_COORD_4:
ctx->EvalMap.Map2Texture4.Uorder = uorder; ctx->EvalMap.Map2Texture4.Uorder = uorder;
ctx->EvalMap.Map2Texture4.v1 = v1; ctx->EvalMap.Map2Texture4.v1 = v1;
ctx->EvalMap.Map2Texture4.v2 = v2; ctx->EvalMap.Map2Texture4.v2 = v2;
ctx->EvalMap.Map2Texture4.dv = 1.0 / (v2 - v1); ctx->EvalMap.Map2Texture4.dv = 1.0 / (v2 - v1);
if (ctx->EvalMap.Map2Texture4.Points
&& !ctx->EvalMap.Map2Texture4.Retain) {
if (ctx->EvalMap.Map2Texture4.Points)
FREE( ctx->EvalMap.Map2Texture4.Points ); FREE( ctx->EvalMap.Map2Texture4.Points );
}
ctx->EvalMap.Map2Texture4.Retain = retain;
ctx->EvalMap.Map2Texture4.Points = (GLfloat *) points;
ctx->EvalMap.Map2Texture4.Points = pnts;
break; break;
default: default:
gl_error( ctx, GL_INVALID_ENUM, "glMap2(target)" ); gl_error( ctx, GL_INVALID_ENUM, "glMap2(target)" );
} }




void
_mesa_Map2f( GLenum target,
GLfloat u1, GLfloat u2, GLint ustride, GLint uorder,
GLfloat v1, GLfloat v2, GLint vstride, GLint vorder,
const GLfloat *points)
{
map2(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder,
points, GL_FLOAT);
}




void gl_GetMapdv( GLcontext* ctx, GLenum target, GLenum query, GLdouble *v )
void
_mesa_Map2d( GLenum target,
GLdouble u1, GLdouble u2, GLint ustride, GLint uorder,
GLdouble v1, GLdouble v2, GLint vstride, GLint vorder,
const GLdouble *points )
{ {
map2(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder,
points, GL_DOUBLE);
}


void
_mesa_GetMapdv( GLenum target, GLenum query, GLdouble *v )
{
GET_CURRENT_CONTEXT(ctx);
GLint i, n; GLint i, n;
GLfloat *data; GLfloat *data;


} }




void gl_GetMapfv( GLcontext* ctx, GLenum target, GLenum query, GLfloat *v )
void
_mesa_GetMapfv( GLenum target, GLenum query, GLfloat *v )
{ {
GET_CURRENT_CONTEXT(ctx);
GLint i, n; GLint i, n;
GLfloat *data; GLfloat *data;


} }




void gl_GetMapiv( GLcontext* ctx, GLenum target, GLenum query, GLint *v )
void
_mesa_GetMapiv( GLenum target, GLenum query, GLint *v )
{ {
GET_CURRENT_CONTEXT(ctx);
GLuint i, n; GLuint i, n;
GLfloat *data; GLfloat *data;


} }




void gl_MapGrid1f( GLcontext* ctx, GLint un, GLfloat u1, GLfloat u2 )
void
_mesa_MapGrid1f( GLint un, GLfloat u1, GLfloat u2 )
{ {
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glMapGrid1f"); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glMapGrid1f");


if (un<1) { if (un<1) {
} }




void gl_MapGrid2f( GLcontext* ctx, GLint un, GLfloat u1, GLfloat u2,
GLint vn, GLfloat v1, GLfloat v2 )
void
_mesa_MapGrid1d( GLint un, GLdouble u1, GLdouble u2 )
{
_mesa_MapGrid1f( un, u1, u2 );
}


void
_mesa_MapGrid2f( GLint un, GLfloat u1, GLfloat u2,
GLint vn, GLfloat v1, GLfloat v2 )
{ {
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glMapGrid2f"); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glMapGrid2f");
if (un<1) { if (un<1) {
gl_error( ctx, GL_INVALID_VALUE, "glMapGrid2f(un)" ); gl_error( ctx, GL_INVALID_VALUE, "glMapGrid2f(un)" );
} }




void
_mesa_MapGrid2d( GLint un, GLdouble u1, GLdouble u2,
GLint vn, GLdouble v1, GLdouble v2 )
{
_mesa_MapGrid2f( un, u1, u2, vn, v1, v2 );
}




/* KW: If are compiling, we don't know whether eval will produce a
* vertex when it is run in the future. If this is pure immediate
* mode, eval is a noop if neither vertex map is enabled.
*
* Thus we need to have a check in the display list code or
* elsewhere for eval(1,2) vertices in the case where
* map(1,2)_vertex is disabled, and to purge those vertices from
* the vb. This is currently done
* via modifications to the cull_vb and render_vb operations, and
* by using the existing cullmask mechanism for all other operations.
*/


/* KW: Because the eval values don't become 'current', fixup will flow
* through these vertices, and then evaluation will write on top
* of the fixup results.
*
* This is a little inefficient, but at least it is correct. This
* could be short-circuited in the case where all vertices are
* eval-vertices, or more generally by a cullmask in fixup.
*
* Note: using Obj to hold eval coord data. This data is actually
* transformed if eval is disabled. But disabling eval & sending
* eval coords is stupid, right?
*/


#define EVALCOORD1(IM, x) \
{ \
GLuint count = IM->Count++; \
IM->Flag[count] |= VERT_EVAL_C1; \
ASSIGN_4V(IM->Obj[count], x, 0, 0, 1); \
if (count == VB_MAX-1) \
IM->maybe_transform_vb( IM ); \
}

#define EVALCOORD2(IM, x, y) \
{ \
GLuint count = IM->Count++; \
IM->Flag[count] |= VERT_EVAL_C2; \
ASSIGN_4V(IM->Obj[count], x, y, 0, 1); \
if (count == VB_MAX-1) \
IM->maybe_transform_vb( IM ); \
}

#define EVALPOINT1(IM, x) \
{ \
GLuint count = IM->Count++; \
IM->Flag[count] |= VERT_EVAL_P1; \
ASSIGN_4V(IM->Obj[count], x, 0, 0, 1); \
if (count == VB_MAX-1) \
IM->maybe_transform_vb( IM ); \
}
#define EVALPOINT2(IM, x, y) \
{ \
GLuint count = IM->Count++; \
IM->Flag[count] |= VERT_EVAL_P2; \
ASSIGN_4V(IM->Obj[count], x, y, 0, 1); \
if (count == VB_MAX-1) \
IM->maybe_transform_vb( IM ); \
}


/* Lame internal function:
*/
void gl_EvalCoord1f( GLcontext *CC, GLfloat u )
{
struct immediate *i = CC->input;
EVALCOORD1( i, u );
}


void
_mesa_EvalCoord1d( GLdouble u )
{
GET_IMMEDIATE;
EVALCOORD1( IM, (GLfloat) u );
}


void
_mesa_EvalCoord1f( GLfloat u )
{
GET_IMMEDIATE;
EVALCOORD1( IM, u );
}


void
_mesa_EvalCoord1dv( const GLdouble *u )
{
GET_IMMEDIATE;
EVALCOORD1( IM, (GLfloat) *u );
}


void
_mesa_EvalCoord1fv( const GLfloat *u )
{
GET_IMMEDIATE;
EVALCOORD1( IM, (GLfloat) *u );
}


void
_mesa_EvalCoord2d( GLdouble u, GLdouble v )
{
GET_IMMEDIATE;
EVALCOORD2( IM, (GLfloat) u, (GLfloat) v );
}


void
_mesa_EvalCoord2f( GLfloat u, GLfloat v )
{
GET_IMMEDIATE;
EVALCOORD2( IM, u, v );
}


/* Lame internal function:
*/
void gl_EvalCoord2f( GLcontext *CC, GLfloat u, GLfloat v )
{
struct immediate *i = CC->input;
EVALCOORD2( i, u, v );
}


void
_mesa_EvalCoord2dv( const GLdouble *u )
{
GET_IMMEDIATE;
EVALCOORD2( IM, (GLfloat) u[0], (GLfloat) u[1] );
}


void
_mesa_EvalCoord2fv( const GLfloat *u )
{
GET_IMMEDIATE;
EVALCOORD2( IM, u[0], u[1] );
}


void
_mesa_EvalPoint1( GLint i )
{
GET_IMMEDIATE;
EVALPOINT1( IM, i );
}


void
_mesa_EvalPoint2( GLint i, GLint j )
{
GET_IMMEDIATE;
EVALPOINT2( IM, i, j );
}





void gl_EvalMesh1( GLcontext* ctx, GLenum mode, GLint i1, GLint i2 )

void
_mesa_EvalMesh1( GLenum mode, GLint i1, GLint i2 )
{ {
GET_CURRENT_CONTEXT(ctx);
GLint i; GLint i;
GLfloat u, du; GLfloat u, du;
GLenum prim; GLenum prim;






void gl_EvalMesh2( GLcontext* ctx,
GLenum mode,
GLint i1, GLint i2,
GLint j1, GLint j2 )
void
_mesa_EvalMesh2( GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 )
{ {
GET_CURRENT_CONTEXT(ctx);
GLint i, j; GLint i, j;
GLfloat u, du, v, dv, v1, u1; GLfloat u, du, v, dv, v1, u1;


return; return;
} }
} }




+ 74
- 23
src/mesa/main/eval.h View File

/* $Id: eval.h,v 1.1 1999/08/19 00:55:41 jtg Exp $ */
/* $Id: eval.h,v 1.2 1999/11/11 01:22:26 brianp Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
* Version: 3.1
* Version: 3.3
* *
* Copyright (C) 1999 Brian Paul All Rights Reserved. * Copyright (C) 1999 Brian Paul All Rights Reserved.
* *
extern void gl_init_eval( void ); extern void gl_init_eval( void );




extern GLuint _mesa_evaluator_components( GLenum target );


extern void gl_free_control_points( GLcontext *ctx, extern void gl_free_control_points( GLcontext *ctx,
GLenum target, GLfloat *data ); GLenum target, GLfloat *data );


const GLdouble *points ); const GLdouble *points );




extern void gl_Map1f( GLcontext* ctx,
GLenum target, GLfloat u1, GLfloat u2, GLint stride,
GLint order, const GLfloat *points, GLboolean retain );
extern void gl_eval_vb( struct vertex_buffer *VB );


extern void gl_Map2f( GLcontext* ctx, GLenum target,
GLfloat u1, GLfloat u2, GLint ustride, GLint uorder,
GLfloat v1, GLfloat v2, GLint vstride, GLint vorder,
const GLfloat *points, GLboolean retain );


extern void
_mesa_Map1f( GLenum target, GLfloat u1, GLfloat u2, GLint stride,
GLint order, const GLfloat *points );


extern void
_mesa_Map2f( GLenum target,
GLfloat u1, GLfloat u2, GLint ustride, GLint uorder,
GLfloat v1, GLfloat v2, GLint vstride, GLint vorder,
const GLfloat *points );


extern void gl_MapGrid1f( GLcontext* ctx, GLint un, GLfloat u1, GLfloat u2 );
extern void
_mesa_Map1d( GLenum target, GLdouble u1, GLdouble u2, GLint stride,
GLint order, const GLdouble *points );


extern void gl_MapGrid2f( GLcontext* ctx,
GLint un, GLfloat u1, GLfloat u2,
GLint vn, GLfloat v1, GLfloat v2 );
extern void
_mesa_Map2d( GLenum target,
GLdouble u1, GLdouble u2, GLint ustride, GLint uorder,
GLdouble v1, GLdouble v2, GLint vstride, GLint vorder,
const GLdouble *points );


extern void gl_GetMapdv( GLcontext* ctx,
GLenum target, GLenum query, GLdouble *v );
extern void
_mesa_MapGrid1f( GLint un, GLfloat u1, GLfloat u2 );


extern void gl_GetMapfv( GLcontext* ctx,
GLenum target, GLenum query, GLfloat *v );
extern void
_mesa_MapGrid1d( GLint un, GLdouble u1, GLdouble u2 );


extern void gl_GetMapiv( GLcontext* ctx,
GLenum target, GLenum query, GLint *v );
extern void
_mesa_MapGrid2f( GLint un, GLfloat u1, GLfloat u2,
GLint vn, GLfloat v1, GLfloat v2 );


extern void gl_EvalMesh1( GLcontext* ctx, GLenum mode, GLint i1, GLint i2 );
extern void
_mesa_MapGrid2d( GLint un, GLdouble u1, GLdouble u2,
GLint vn, GLdouble v1, GLdouble v2 );


extern void gl_EvalMesh2( GLcontext* ctx, GLenum mode,
GLint i1, GLint i2, GLint j1, GLint j2 );
extern void
_mesa_GetMapdv( GLenum target, GLenum query, GLdouble *v );


extern void gl_eval_vb( struct vertex_buffer *VB );
extern void
_mesa_GetMapfv( GLenum target, GLenum query, GLfloat *v );

extern void
_mesa_GetMapiv( GLenum target, GLenum query, GLint *v );

extern void
_mesa_EvalMesh1( GLenum mode, GLint i1, GLint i2 );

extern void
_mesa_EvalMesh2( GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 );

extern void
_mesa_EvalCoord1d( GLdouble u );

extern void
_mesa_EvalCoord1f( GLfloat u );

extern void
_mesa_EvalCoord1dv( const GLdouble *u );

extern void
_mesa_EvalCoord1fv( const GLfloat *u );

extern void
_mesa_EvalCoord2d( GLdouble u, GLdouble v );

extern void
_mesa_EvalCoord2f( GLfloat u, GLfloat v );

extern void
_mesa_EvalCoord2dv( const GLdouble *u );

extern void
_mesa_EvalCoord2fv( const GLfloat *u );

extern void
_mesa_EvalPoint1( GLint i );


extern void
_mesa_EvalPoint2( GLint i, GLint j );


#endif #endif

+ 7
- 6
src/mesa/main/extensions.c View File

/* $Id: extensions.c,v 1.10 1999/11/08 07:36:44 brianp Exp $ */
/* $Id: extensions.c,v 1.11 1999/11/11 01:22:26 brianp Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
* Version: 3.1
* Version: 3.3
* *
* Copyright (C) 1999 Brian Paul All Rights Reserved. * Copyright (C) 1999 Brian Paul All Rights Reserved.
* *
*/ */




#ifndef XFree86Server
#include <stdlib.h>
#ifdef PC_HEADER
#include "all.h"
#else #else
#include "GL/xf86glx.h"
#endif
#include "glheader.h"
#include "context.h" #include "context.h"
#include "extensions.h" #include "extensions.h"
#include "mem.h"
#include "simple_list.h" #include "simple_list.h"
#include "types.h" #include "types.h"
#endif




#define MAX_EXT_NAMELEN 80 #define MAX_EXT_NAMELEN 80

+ 26
- 19
src/mesa/main/feedback.c View File

/* $Id: feedback.c,v 1.5 1999/11/08 07:36:44 brianp Exp $ */
/* $Id: feedback.c,v 1.6 1999/11/11 01:22:26 brianp Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
* Version: 3.1
* Version: 3.3
* *
* Copyright (C) 1999 Brian Paul All Rights Reserved. * Copyright (C) 1999 Brian Paul All Rights Reserved.
* *
*/ */







#ifdef PC_HEADER #ifdef PC_HEADER
#include "all.h" #include "all.h"
#else #else
#ifndef XFree86Server
#include <assert.h>
#include <stdio.h>
#else
#include "GL/xf86glx.h"
#endif
#include "glheader.h"
#include "context.h" #include "context.h"
#include "enums.h" #include "enums.h"
#include "feedback.h" #include "feedback.h"




void void
gl_FeedbackBuffer( GLcontext *ctx, GLsizei size, GLenum type, GLfloat *buffer )
_mesa_FeedbackBuffer( GLsizei size, GLenum type, GLfloat *buffer )
{ {
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx, "glFeedbackBuffer" ); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx, "glFeedbackBuffer" );


if (ctx->RenderMode==GL_FEEDBACK) { if (ctx->RenderMode==GL_FEEDBACK) {






void gl_PassThrough( GLcontext *ctx, GLfloat token )
void
_mesa_PassThrough( GLfloat token )
{ {
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPassThrough"); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPassThrough");


if (ctx->RenderMode==GL_FEEDBACK) { if (ctx->RenderMode==GL_FEEDBACK) {
/* /*
* NOTE: this function can't be put in a display list. * NOTE: this function can't be put in a display list.
*/ */
void gl_SelectBuffer( GLcontext *ctx, GLsizei size, GLuint *buffer )
void
_mesa_SelectBuffer( GLsizei size, GLuint *buffer )
{ {
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glSelectBuffer"); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glSelectBuffer");
if (ctx->RenderMode==GL_SELECT) { if (ctx->RenderMode==GL_SELECT) {
gl_error( ctx, GL_INVALID_OPERATION, "glSelectBuffer" ); gl_error( ctx, GL_INVALID_OPERATION, "glSelectBuffer" );






void gl_InitNames( GLcontext *ctx )
void
_mesa_InitNames( void )
{ {
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glInitNames"); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glInitNames");
/* Record the hit before the HitFlag is wiped out again. */ /* Record the hit before the HitFlag is wiped out again. */
if (ctx->RenderMode==GL_SELECT) { if (ctx->RenderMode==GL_SELECT) {






void gl_LoadName( GLcontext *ctx, GLuint name )
void
_mesa_LoadName( GLuint name )
{ {
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glLoadName"); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glLoadName");
if (ctx->RenderMode!=GL_SELECT) { if (ctx->RenderMode!=GL_SELECT) {
return; return;
} }




void gl_PushName( GLcontext *ctx, GLuint name )
void
_mesa_PushName( GLuint name )
{ {
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPushName"); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPushName");
if (ctx->RenderMode!=GL_SELECT) { if (ctx->RenderMode!=GL_SELECT) {
return; return;






void gl_PopName( GLcontext *ctx )
void
_mesa_PopName( void )
{ {
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPopName"); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPopName");
if (ctx->RenderMode!=GL_SELECT) { if (ctx->RenderMode!=GL_SELECT) {
return; return;
/* /*
* NOTE: this function can't be put in a display list. * NOTE: this function can't be put in a display list.
*/ */
GLint gl_RenderMode( GLcontext *ctx, GLenum mode )
GLint
_mesa_RenderMode( GLenum mode )
{ {
GET_CURRENT_CONTEXT(ctx);
GLint result; GLint result;


ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, "glRenderMode", 0); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, "glRenderMode", 0);

+ 19
- 14
src/mesa/main/feedback.h View File

/* $Id: feedback.h,v 1.2 1999/09/18 20:41:23 keithw Exp $ */
/* $Id: feedback.h,v 1.3 1999/11/11 01:22:26 brianp Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
* Version: 3.1
* Version: 3.3
* *
* Copyright (C) 1999 Brian Paul All Rights Reserved. * Copyright (C) 1999 Brian Paul All Rights Reserved.
* *
*/ */







#ifndef FEEDBACK_H #ifndef FEEDBACK_H
#define FEEDBACK_H #define FEEDBACK_H


extern void gl_update_hitflag( GLcontext *ctx, GLfloat z ); extern void gl_update_hitflag( GLcontext *ctx, GLfloat z );




extern void gl_PassThrough( GLcontext *ctx, GLfloat token );
extern void
_mesa_PassThrough( GLfloat token );

extern void
_mesa_FeedbackBuffer( GLsizei size, GLenum type, GLfloat *buffer );


extern void gl_FeedbackBuffer( GLcontext *ctx, GLsizei size,
GLenum type, GLfloat *buffer );
extern void
_mesa_SelectBuffer( GLsizei size, GLuint *buffer );


extern void gl_SelectBuffer( GLcontext *ctx, GLsizei size, GLuint *buffer );
extern void
_mesa_InitNames( void );


extern void gl_InitNames( GLcontext *ctx );
extern void
_mesa_LoadName( GLuint name );


extern void gl_LoadName( GLcontext *ctx, GLuint name );
extern void
_mesa_PushName( GLuint name );


extern void gl_PushName( GLcontext *ctx, GLuint name );
extern void
_mesa_PopName( void );


extern void gl_PopName( GLcontext *ctx );
extern GLint
_mesa_RenderMode( GLenum mode );


extern GLint gl_RenderMode( GLcontext *ctx, GLenum mode );


extern void gl_feedback_points( GLcontext *ctx, GLuint first, GLuint last ); extern void gl_feedback_points( GLcontext *ctx, GLuint first, GLuint last );
extern void gl_feedback_line( GLcontext *ctx, GLuint v1, GLuint v2, GLuint pv ); extern void gl_feedback_line( GLcontext *ctx, GLuint v1, GLuint v2, GLuint pv );

+ 47
- 11
src/mesa/main/fog.c View File

/* $Id: fog.c,v 1.3 1999/11/08 07:36:44 brianp Exp $ */
/* $Id: fog.c,v 1.4 1999/11/11 01:22:26 brianp Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
* Version: 3.1
* Version: 3.3
* *
* Copyright (C) 1999 Brian Paul All Rights Reserved. * Copyright (C) 1999 Brian Paul All Rights Reserved.
* *
*/ */




/* $XFree86: xc/lib/GL/mesa/src/fog.c,v 1.4 1999/04/04 00:20:24 dawes Exp $ */

#ifdef PC_HEADER #ifdef PC_HEADER
#include "all.h" #include "all.h"
#else #else
#ifndef XFree86Server
#include <math.h>
#include <stdlib.h>
#else
#include "GL/xf86glx.h"
#endif
#include "glheader.h"
#include "context.h" #include "context.h"
#include "fog.h" #include "fog.h"
#include "macros.h" #include "macros.h"






void gl_Fogfv( GLcontext *ctx, GLenum pname, const GLfloat *params )
void
_mesa_Fogf(GLenum pname, GLfloat param)
{
_mesa_Fogfv(pname, &param);
}


void
_mesa_Fogi(GLenum pname, GLint param )
{
GLfloat fparam = (GLfloat) param;
_mesa_Fogfv(pname, &fparam);
}


void
_mesa_Fogiv(GLenum pname, const GLint *params )
{
GLfloat p[4];
switch (pname) {
case GL_FOG_MODE:
case GL_FOG_DENSITY:
case GL_FOG_START:
case GL_FOG_END:
case GL_FOG_INDEX:
p[0] = (GLfloat) *params;
break;
case GL_FOG_COLOR:
p[0] = INT_TO_FLOAT( params[0] );
p[1] = INT_TO_FLOAT( params[1] );
p[2] = INT_TO_FLOAT( params[2] );
p[3] = INT_TO_FLOAT( params[3] );
break;
default:
/* Error will be caught later in gl_Fogfv */
;
}
_mesa_Fogfv(pname, p);
}


void
_mesa_Fogfv( GLenum pname, const GLfloat *params )
{ {
GET_CURRENT_CONTEXT(ctx);
GLenum m; GLenum m;


switch (pname) { switch (pname) {

+ 17
- 4
src/mesa/main/fog.h View File

/* $Id: fog.h,v 1.1 1999/08/19 00:55:41 jtg Exp $ */
/* $Id: fog.h,v 1.2 1999/11/11 01:22:26 brianp Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
* Version: 3.1
* Version: 3.3
* *
* Copyright (C) 1999 Brian Paul All Rights Reserved. * Copyright (C) 1999 Brian Paul All Rights Reserved.
* *
*/ */





#ifndef FOG_H #ifndef FOG_H
#define FOG_H #define FOG_H


#include "types.h" #include "types.h"




extern void gl_Fogfv( GLcontext *ctx, GLenum pname, const GLfloat *params );
extern void
_mesa_Fogf(GLenum pname, GLfloat param);


extern void
_mesa_Fogi(GLenum pname, GLint param );


extern void
_mesa_Fogfv(GLenum pname, const GLfloat *params );


extern void
_mesa_Fogiv(GLenum pname, const GLint *params );





extern void gl_fog_vertices( struct vertex_buffer *VB ); extern void gl_fog_vertices( struct vertex_buffer *VB );

+ 55
- 30
src/mesa/main/get.c View File

/* $Id: get.c,v 1.5 1999/10/17 22:36:35 brianp Exp $ */
/* $Id: get.c,v 1.6 1999/11/11 01:22:26 brianp Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
* Version: 3.1
* Version: 3.3
* *
* Copyright (C) 1999 Brian Paul All Rights Reserved. * Copyright (C) 1999 Brian Paul All Rights Reserved.
* *
*/ */




/* $XFree86: xc/lib/GL/mesa/src/get.c,v 1.3 1999/04/04 00:20:25 dawes Exp $ */

#ifdef PC_HEADER #ifdef PC_HEADER
#include "all.h" #include "all.h"
#else #else
#ifndef XFree86Server
#include <assert.h>
#include <stdio.h>
#include <string.h>
#else
#include "GL/xf86glx.h"
#endif
#include "glheader.h"
#include "context.h" #include "context.h"
#include "enable.h" #include "enable.h"
#include "enums.h" #include "enums.h"






void gl_GetBooleanv( GLcontext *ctx, GLenum pname, GLboolean *params )
void
_mesa_GetBooleanv( GLenum pname, GLboolean *params )
{ {
GET_CURRENT_CONTEXT(ctx);
GLuint i; GLuint i;
GLuint texUnit = ctx->Texture.CurrentUnit; GLuint texUnit = ctx->Texture.CurrentUnit;
GLuint texTransformUnit = ctx->Texture.CurrentTransformUnit; GLuint texTransformUnit = ctx->Texture.CurrentTransformUnit;
*params = INT_TO_BOOL(0); /* TODO */ *params = INT_TO_BOOL(0); /* TODO */
break; break;
case GL_TEXTURE_1D: case GL_TEXTURE_1D:
*params = gl_IsEnabled( ctx, GL_TEXTURE_1D );
*params = _mesa_IsEnabled(GL_TEXTURE_1D );
break; break;
case GL_TEXTURE_2D: case GL_TEXTURE_2D:
*params = gl_IsEnabled( ctx, GL_TEXTURE_2D );
*params = _mesa_IsEnabled(GL_TEXTURE_2D );
break; break;
case GL_TEXTURE_3D: case GL_TEXTURE_3D:
*params = gl_IsEnabled( ctx, GL_TEXTURE_3D );
*params = _mesa_IsEnabled(GL_TEXTURE_3D );
break; break;
case GL_TEXTURE_BINDING_1D: case GL_TEXTURE_BINDING_1D:
*params = INT_TO_BOOL(textureUnit->CurrentD[1]->Name); *params = INT_TO_BOOL(textureUnit->CurrentD[1]->Name);






void gl_GetDoublev( GLcontext *ctx, GLenum pname, GLdouble *params )
void
_mesa_GetDoublev( GLenum pname, GLdouble *params )
{ {
GET_CURRENT_CONTEXT(ctx);
GLuint i; GLuint i;
GLuint texUnit = ctx->Texture.CurrentUnit; GLuint texUnit = ctx->Texture.CurrentUnit;
GLuint texTransformUnit = ctx->Texture.CurrentTransformUnit; GLuint texTransformUnit = ctx->Texture.CurrentTransformUnit;
*params = 0.0; /* TODO */ *params = 0.0; /* TODO */
break; break;
case GL_TEXTURE_1D: case GL_TEXTURE_1D:
*params = gl_IsEnabled(ctx, GL_TEXTURE_1D) ? 1.0 : 0.0;
*params = _mesa_IsEnabled(GL_TEXTURE_1D) ? 1.0 : 0.0;
break; break;
case GL_TEXTURE_2D: case GL_TEXTURE_2D:
*params = gl_IsEnabled(ctx, GL_TEXTURE_2D) ? 1.0 : 0.0;
*params = _mesa_IsEnabled(GL_TEXTURE_2D) ? 1.0 : 0.0;
break; break;
case GL_TEXTURE_3D: case GL_TEXTURE_3D:
*params = gl_IsEnabled(ctx, GL_TEXTURE_3D) ? 1.0 : 0.0;
*params = _mesa_IsEnabled(GL_TEXTURE_3D) ? 1.0 : 0.0;
break; break;
case GL_TEXTURE_BINDING_1D: case GL_TEXTURE_BINDING_1D:
*params = (GLdouble) textureUnit->CurrentD[1]->Name; *params = (GLdouble) textureUnit->CurrentD[1]->Name;






void gl_GetFloatv( GLcontext *ctx, GLenum pname, GLfloat *params )
void
_mesa_GetFloatv( GLenum pname, GLfloat *params )
{ {
GET_CURRENT_CONTEXT(ctx);
GLuint i; GLuint i;
GLuint texUnit = ctx->Texture.CurrentUnit; GLuint texUnit = ctx->Texture.CurrentUnit;
GLuint texTransformUnit = ctx->Texture.CurrentTransformUnit; GLuint texTransformUnit = ctx->Texture.CurrentTransformUnit;
*params = 0.0F; /* TODO */ *params = 0.0F; /* TODO */
break; break;
case GL_TEXTURE_1D: case GL_TEXTURE_1D:
*params = gl_IsEnabled(ctx, GL_TEXTURE_1D) ? 1.0 : 0.0;
*params = _mesa_IsEnabled(GL_TEXTURE_1D) ? 1.0 : 0.0;
break; break;
case GL_TEXTURE_2D: case GL_TEXTURE_2D:
*params = gl_IsEnabled(ctx, GL_TEXTURE_2D) ? 1.0 : 0.0;
*params = _mesa_IsEnabled(GL_TEXTURE_2D) ? 1.0 : 0.0;
break; break;
case GL_TEXTURE_3D: case GL_TEXTURE_3D:
*params = gl_IsEnabled(ctx, GL_TEXTURE_3D) ? 1.0 : 0.0;
*params = _mesa_IsEnabled(GL_TEXTURE_3D) ? 1.0 : 0.0;
break; break;
case GL_TEXTURE_BINDING_1D: case GL_TEXTURE_BINDING_1D:
*params = (GLfloat) textureUnit->CurrentD[1]->Name; *params = (GLfloat) textureUnit->CurrentD[1]->Name;






void gl_GetIntegerv( GLcontext *ctx, GLenum pname, GLint *params )
void
_mesa_GetIntegerv( GLenum pname, GLint *params )
{ {
GET_CURRENT_CONTEXT(ctx);
GLuint i; GLuint i;
GLuint texUnit = ctx->Texture.CurrentUnit; GLuint texUnit = ctx->Texture.CurrentUnit;
GLuint texTransformUnit = ctx->Texture.CurrentTransformUnit; GLuint texTransformUnit = ctx->Texture.CurrentTransformUnit;
*params = 0; /* TODO */ *params = 0; /* TODO */
break; break;
case GL_TEXTURE_1D: case GL_TEXTURE_1D:
*params = gl_IsEnabled(ctx, GL_TEXTURE_1D) ? 1 : 0;
*params = _mesa_IsEnabled(GL_TEXTURE_1D) ? 1 : 0;
break; break;
case GL_TEXTURE_2D: case GL_TEXTURE_2D:
*params = gl_IsEnabled(ctx, GL_TEXTURE_2D) ? 1 : 0;
*params = _mesa_IsEnabled(GL_TEXTURE_2D) ? 1 : 0;
break; break;
case GL_TEXTURE_3D: case GL_TEXTURE_3D:
*params = gl_IsEnabled(ctx, GL_TEXTURE_3D) ? 1 : 0;
*params = _mesa_IsEnabled(GL_TEXTURE_3D) ? 1 : 0;
break; break;
case GL_TEXTURE_BINDING_1D: case GL_TEXTURE_BINDING_1D:
*params = textureUnit->CurrentD[1]->Name; *params = textureUnit->CurrentD[1]->Name;






void gl_GetPointerv( GLcontext *ctx, GLenum pname, GLvoid **params )
void
_mesa_GetPointerv( GLenum pname, GLvoid **params )
{ {
GET_CURRENT_CONTEXT(ctx);
GLuint texUnit = ctx->Texture.CurrentUnit; GLuint texUnit = ctx->Texture.CurrentUnit;
/*GLuint texTransformUnit = ctx->Texture.CurrentTransformUnit;*/ /*GLuint texTransformUnit = ctx->Texture.CurrentTransformUnit;*/








const GLubyte *gl_GetString( GLcontext *ctx, GLenum name )
const GLubyte *
_mesa_GetString( GLenum name )
{ {
GET_CURRENT_CONTEXT(ctx);
static char result[1000]; static char result[1000];
static char *vendor = "Brian Paul"; static char *vendor = "Brian Paul";
static char *version = "1.2 Mesa 3.1 beta";
static char *version = "1.2 Mesa 3.3 beta";


ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, "glGetString", 0); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, "glGetString", 0);


return NULL; return NULL;
} }
} }


/*
* Execute a glGetError command
*/
GLenum
_mesa_GetError( void )
{
GET_CURRENT_CONTEXT(ctx);

GLenum e = ctx->ErrorValue;

ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL( ctx, "glGetError", (GLenum) 0);

if (MESA_VERBOSE & VERBOSE_API)
fprintf(stderr, "glGetError <-- %s\n", gl_lookup_enum_by_nr(e));

ctx->ErrorValue = (GLenum) GL_NO_ERROR;
return e;
}


+ 18
- 11
src/mesa/main/get.h View File

/* $Id: get.h,v 1.2 1999/09/09 23:47:09 brianp Exp $ */
/* $Id: get.h,v 1.3 1999/11/11 01:22:26 brianp Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
* Version: 3.1
* Version: 3.3
* *
* Copyright (C) 1999 Brian Paul All Rights Reserved. * Copyright (C) 1999 Brian Paul All Rights Reserved.
* *
*/ */







#ifndef GET_H #ifndef GET_H
#define GET_H #define GET_H


#include "types.h" #include "types.h"




extern void gl_GetBooleanv( GLcontext *ctx, GLenum pname, GLboolean *params );
extern void
_mesa_GetBooleanv( GLenum pname, GLboolean *params );

extern void
_mesa_GetDoublev( GLenum pname, GLdouble *params );

extern void
_mesa_GetFloatv( GLenum pname, GLfloat *params );


extern void gl_GetDoublev( GLcontext *ctx, GLenum pname, GLdouble *params );
extern void
_mesa_GetIntegerv( GLenum pname, GLint *params );


extern void gl_GetFloatv( GLcontext *ctx, GLenum pname, GLfloat *params );
extern void
_mesa_GetPointerv( GLenum pname, GLvoid **params );


extern void gl_GetIntegerv( GLcontext *ctx, GLenum pname, GLint *params );
extern const GLubyte *
_mesa_GetString( GLenum name );


extern void gl_GetPointerv( GLcontext *ctx, GLenum pname, GLvoid **params );
extern GLenum
_mesa_GetError( void );


extern const GLubyte *gl_GetString( GLcontext *ctx, GLenum name );




#endif #endif

+ 65
- 0
src/mesa/main/glheader.h View File

/* $Id: glheader.h,v 1.1 1999/11/11 01:22:26 brianp Exp $ */

/*
* Mesa 3-D graphics library
* Version: 3.3
*
* Copyright (C) 1999 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/


#ifndef GLHEADER_H
#define GLHEADER_H


/*
* This is the top-most include file of the Mesa sources.
* It includes gl.h and all system headers which are needed.
* Other Mesa source files should _not_ directly include any system
* headers. This allows Mesa to be integrated into XFree86 and
* allows system-dependent hacks/work-arounds to be collected in one place.
*
* If you touch this file, everything gets recompiled!
*
* This file should be included before any other header in the .c files.
*/


#ifdef XFree86LOADER
#include "xf86_ansic.h"
#else
#include <assert.h>
#include <ctype.h>
#include <float.h>
#include <math.h>
#include <limits.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#endif

#ifdef HAVE_CONFIG_H
#include "conf.h"
#endif

#include <GL/gl.h>


#endif

+ 5
- 12
src/mesa/main/hash.c View File

/* $Id: hash.c,v 1.3 1999/10/13 18:42:50 brianp Exp $ */
/* $Id: hash.c,v 1.4 1999/11/11 01:22:26 brianp Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
* Version: 3.1
* Version: 3.3
* *
* Copyright (C) 1999 Brian Paul All Rights Reserved. * Copyright (C) 1999 Brian Paul All Rights Reserved.
* *
*/ */





#ifdef PC_HEADER #ifdef PC_HEADER
#include "all.h" #include "all.h"
#else #else
#ifndef XFree86Server
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#else
#include "GL/xf86glx.h"
#endif
#include "glheader.h"
#include "hash.h" #include "hash.h"
#include "macros.h"
#include "mem.h"
#endif #endif




/* /*
* Generic hash table. Only dependency is the GLuint datatype.
* Generic hash table.
* *
* This is used to implement display list and texture object lookup. * This is used to implement display list and texture object lookup.
* NOTE: key=0 is illegal. * NOTE: key=0 is illegal.

+ 3
- 6
src/mesa/main/hash.h View File

/* $Id: hash.h,v 1.1 1999/08/19 00:55:41 jtg Exp $ */
/* $Id: hash.h,v 1.2 1999/11/11 01:22:26 brianp Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
* Version: 3.1
* Version: 3.3
* *
* Copyright (C) 1999 Brian Paul All Rights Reserved. * Copyright (C) 1999 Brian Paul All Rights Reserved.
* *
*/ */







#ifndef HASH_H #ifndef HASH_H
#define HASH_H #define HASH_H




#include "GL/gl.h"
#include "glheader.h"




struct HashTable; struct HashTable;

+ 354
- 1198
src/mesa/main/image.c
File diff suppressed because it is too large
View File


+ 33
- 42
src/mesa/main/image.h View File

/* $Id: image.h,v 1.2 1999/11/03 17:27:05 brianp Exp $ */
/* $Id: image.h,v 1.3 1999/11/11 01:22:27 brianp Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
*/ */







#ifndef IMAGE_H #ifndef IMAGE_H
#define IMAGE_H #define IMAGE_H


#include "types.h" #include "types.h"




extern struct gl_pixelstore_attrib _mesa_native_packing;


extern void gl_flip_bytes( GLubyte *p, GLuint n ); extern void gl_flip_bytes( GLubyte *p, GLuint n );




GLint img, GLint row, GLint column ); GLint img, GLint row, GLint column );




extern struct gl_image *
gl_unpack_bitmap( GLcontext *ctx, GLsizei width, GLsizei height,
const GLubyte *bitmap,
const struct gl_pixelstore_attrib *packing );


extern void gl_unpack_polygon_stipple( const GLcontext *ctx,
const GLubyte *pattern,
GLuint dest[32] );


extern void gl_pack_polygon_stipple( const GLcontext *ctx,
const GLuint pattern[32],
GLubyte *dest );


extern struct gl_image *
gl_unpack_image( GLcontext *ctx, GLint width, GLint height,
GLenum srcFormat, GLenum srcType, const GLvoid *pixels,
const struct gl_pixelstore_attrib *packing );

extern void
gl_unpack_polygon_stipple( const GLcontext *ctx,
const GLubyte *pattern,
GLuint dest[32] );




struct gl_image *
gl_unpack_image3D( GLcontext *ctx, GLint width, GLint height,GLint depth,
GLenum srcFormat, GLenum srcType, const GLvoid *pixels,
const struct gl_pixelstore_attrib *packing );
extern void
gl_pack_polygon_stipple( const GLcontext *ctx,
const GLuint pattern[32],
GLubyte *dest );




extern void extern void
GLboolean applyTransferOps ); GLboolean applyTransferOps );




extern void gl_free_image( struct gl_image *image );


extern GLboolean gl_image_error_test( GLcontext *ctx,
const struct gl_image *image,
const char *msg );


/*
* New (3.3) functions
*/


extern void extern void
_mesa_unpack_ubyte_color_span( const GLcontext *ctx, _mesa_unpack_ubyte_color_span( const GLcontext *ctx,
GLuint n, GLenum dstFormat, GLubyte dest[], GLuint n, GLenum dstFormat, GLubyte dest[],
const struct gl_pixelstore_attrib *unpacking, const struct gl_pixelstore_attrib *unpacking,
GLboolean applyTransferOps ); GLboolean applyTransferOps );



extern void
_mesa_unpack_stencil_span( const GLcontext *ctx, GLuint n,
GLenum dstType, GLvoid *dest,
GLenum srcType, const GLvoid *source,
const struct gl_pixelstore_attrib *unpacking,
GLboolean applyTransferOps );


extern void
_mesa_unpack_depth_span( const GLcontext *ctx, GLuint n, GLdepth *dest,
GLenum srcType, const GLvoid *source,
const struct gl_pixelstore_attrib *unpacking,
GLboolean applyTransferOps );


extern void * extern void *
_mesa_unpack_image( GLsizei width, GLsizei height, GLsizei depth, _mesa_unpack_image( GLsizei width, GLsizei height, GLsizei depth,
GLenum format, GLenum type, const GLvoid *pixels, GLenum format, GLenum type, const GLvoid *pixels,
const struct gl_pixelstore_attrib *unpack ); const struct gl_pixelstore_attrib *unpack );




extern GLvoid *
_mesa_unpack_bitmap( GLint width, GLint height, const GLubyte *pixels,
const struct gl_pixelstore_attrib *packing );


#endif #endif

+ 196
- 50
src/mesa/main/light.c View File

/* $Id: light.c,v 1.8 1999/11/10 06:29:44 keithw Exp $ */
/* $Id: light.c,v 1.9 1999/11/11 01:22:27 brianp Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
* Version: 3.1
* Version: 3.3
* *
* Copyright (C) 1999 Brian Paul All Rights Reserved. * Copyright (C) 1999 Brian Paul All Rights Reserved.
* *
*/ */







#ifdef PC_HEADER #ifdef PC_HEADER
#include "all.h" #include "all.h"
#else #else
#include <float.h>
#ifndef XFree86Server
#include <assert.h>
#include <float.h>
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#else
#include "GL/xf86glx.h"
#endif
#include "glheader.h"
#include "context.h" #include "context.h"
#include "enums.h" #include "enums.h"
#include "light.h" #include "light.h"
#include "macros.h" #include "macros.h"
#include "matrix.h" #include "matrix.h"
#include "mem.h"
#include "mmath.h" #include "mmath.h"
#include "simple_list.h" #include "simple_list.h"
#include "types.h" #include "types.h"






void gl_ShadeModel( GLcontext *ctx, GLenum mode )
void
_mesa_ShadeModel( GLenum mode )
{ {
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glShadeModel"); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glShadeModel");


if (MESA_VERBOSE & VERBOSE_API) if (MESA_VERBOSE & VERBOSE_API)
fprintf(stderr, "glShadeModel %s\n", gl_lookup_enum_by_nr(mode)); fprintf(stderr, "glShadeModel %s\n", gl_lookup_enum_by_nr(mode));



switch (mode) {
case GL_FLAT:
case GL_SMOOTH:
if (mode == GL_FLAT || mode == GL_SMOOTH) {
if (ctx->Light.ShadeModel!=mode) { if (ctx->Light.ShadeModel!=mode) {
ctx->Light.ShadeModel = mode;
ctx->TriangleCaps ^= DD_FLATSHADE;
ctx->NewState |= NEW_RASTER_OPS;
ctx->Light.ShadeModel = mode;
ctx->TriangleCaps ^= DD_FLATSHADE;
ctx->NewState |= NEW_RASTER_OPS;
if (ctx->Driver.ShadeModel)
(*ctx->Driver.ShadeModel)( ctx, mode );
} }
break;
default:
}
else {
gl_error( ctx, GL_INVALID_ENUM, "glShadeModel" ); gl_error( ctx, GL_INVALID_ENUM, "glShadeModel" );
} }

if (ctx->Driver.ShadeModel)
(*ctx->Driver.ShadeModel)( ctx, mode );
} }






void gl_Lightfv( GLcontext *ctx,
GLenum light, GLenum pname, const GLfloat *params,
GLint nparams )
void
_mesa_Lightf( GLenum light, GLenum pname, GLfloat param )
{ {
GLint l;
_mesa_Lightfv( light, pname, &param );
}


(void) nparams;

void
_mesa_Lightfv( GLenum light, GLenum pname, const GLfloat *params )
{
GET_CURRENT_CONTEXT(ctx);
GLint l;
GLint nParams;


ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glLight"); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glLight");


l = (GLint) (light - GL_LIGHT0); l = (GLint) (light - GL_LIGHT0);


if (l<0 || l>=MAX_LIGHTS) {
if (l < 0 || l >= MAX_LIGHTS) {
gl_error( ctx, GL_INVALID_ENUM, "glLight" ); gl_error( ctx, GL_INVALID_ENUM, "glLight" );
return; return;
} }
switch (pname) { switch (pname) {
case GL_AMBIENT: case GL_AMBIENT:
COPY_4V( ctx->Light.Light[l].Ambient, params ); COPY_4V( ctx->Light.Light[l].Ambient, params );
nParams = 4;
break; break;
case GL_DIFFUSE: case GL_DIFFUSE:
COPY_4V( ctx->Light.Light[l].Diffuse, params ); COPY_4V( ctx->Light.Light[l].Diffuse, params );
nParams = 4;
break; break;
case GL_SPECULAR: case GL_SPECULAR:
COPY_4V( ctx->Light.Light[l].Specular, params ); COPY_4V( ctx->Light.Light[l].Specular, params );
nParams = 4;
break; break;
case GL_POSITION: case GL_POSITION:
/* transform position by ModelView matrix */ /* transform position by ModelView matrix */
TRANSFORM_POINT( ctx->Light.Light[l].EyePosition, TRANSFORM_POINT( ctx->Light.Light[l].EyePosition,
ctx->ModelView.m, ctx->ModelView.m,
params ); params );
nParams = 4;
break; break;
case GL_SPOT_DIRECTION: case GL_SPOT_DIRECTION:
/* transform direction by inverse modelview */ /* transform direction by inverse modelview */
TRANSFORM_NORMAL( ctx->Light.Light[l].EyeDirection, TRANSFORM_NORMAL( ctx->Light.Light[l].EyeDirection,
params, params,
ctx->ModelView.inv ); ctx->ModelView.inv );
nParams = 3;
break; break;
case GL_SPOT_EXPONENT: case GL_SPOT_EXPONENT:
if (params[0]<0.0 || params[0]>128.0) { if (params[0]<0.0 || params[0]>128.0) {
ctx->Light.Light[l].SpotExponent = params[0]; ctx->Light.Light[l].SpotExponent = params[0];
gl_compute_spot_exp_table( &ctx->Light.Light[l] ); gl_compute_spot_exp_table( &ctx->Light.Light[l] );
} }
nParams = 1;
break; break;
case GL_SPOT_CUTOFF: case GL_SPOT_CUTOFF:
if ((params[0]<0.0 || params[0]>90.0) && params[0]!=180.0) { if ((params[0]<0.0 || params[0]>90.0) && params[0]!=180.0) {
ctx->Light.Light[l].CosCutoff = cos(params[0]*DEG2RAD); ctx->Light.Light[l].CosCutoff = cos(params[0]*DEG2RAD);
if (ctx->Light.Light[l].CosCutoff < 0) if (ctx->Light.Light[l].CosCutoff < 0)
ctx->Light.Light[l].CosCutoff = 0; ctx->Light.Light[l].CosCutoff = 0;
nParams = 1;
break; break;
case GL_CONSTANT_ATTENUATION: case GL_CONSTANT_ATTENUATION:
if (params[0]<0.0) { if (params[0]<0.0) {
return; return;
} }
ctx->Light.Light[l].ConstantAttenuation = params[0]; ctx->Light.Light[l].ConstantAttenuation = params[0];
nParams = 1;
break; break;
case GL_LINEAR_ATTENUATION: case GL_LINEAR_ATTENUATION:
if (params[0]<0.0) { if (params[0]<0.0) {
return; return;
} }
ctx->Light.Light[l].LinearAttenuation = params[0]; ctx->Light.Light[l].LinearAttenuation = params[0];
nParams = 1;
break; break;
case GL_QUADRATIC_ATTENUATION: case GL_QUADRATIC_ATTENUATION:
if (params[0]<0.0) { if (params[0]<0.0) {
return; return;
} }
ctx->Light.Light[l].QuadraticAttenuation = params[0]; ctx->Light.Light[l].QuadraticAttenuation = params[0];
nParams = 1;
break; break;
default: default:
gl_error( ctx, GL_INVALID_ENUM, "glLight" ); gl_error( ctx, GL_INVALID_ENUM, "glLight" );
break;
return;
} }


if (ctx->Driver.Lightfv) if (ctx->Driver.Lightfv)
ctx->Driver.Lightfv( ctx, light, pname, params, nparams );
ctx->Driver.Lightfv( ctx, light, pname, params, nParams );


ctx->NewState |= NEW_LIGHTING; ctx->NewState |= NEW_LIGHTING;
} }




void
_mesa_Lighti( GLenum light, GLenum pname, GLint param )
{
_mesa_Lightiv( light, pname, &param );
}



void gl_GetLightfv( GLcontext *ctx,
GLenum light, GLenum pname, GLfloat *params )
void
_mesa_Lightiv( GLenum light, GLenum pname, const GLint *params )
{ {
GLfloat fparam[4];

switch (pname) {
case GL_AMBIENT:
case GL_DIFFUSE:
case GL_SPECULAR:
fparam[0] = INT_TO_FLOAT( params[0] );
fparam[1] = INT_TO_FLOAT( params[1] );
fparam[2] = INT_TO_FLOAT( params[2] );
fparam[3] = INT_TO_FLOAT( params[3] );
break;
case GL_POSITION:
fparam[0] = (GLfloat) params[0];
fparam[1] = (GLfloat) params[1];
fparam[2] = (GLfloat) params[2];
fparam[3] = (GLfloat) params[3];
break;
case GL_SPOT_DIRECTION:
fparam[0] = (GLfloat) params[0];
fparam[1] = (GLfloat) params[1];
fparam[2] = (GLfloat) params[2];
break;
case GL_SPOT_EXPONENT:
case GL_SPOT_CUTOFF:
case GL_CONSTANT_ATTENUATION:
case GL_LINEAR_ATTENUATION:
case GL_QUADRATIC_ATTENUATION:
fparam[0] = (GLfloat) params[0];
break;
default:
/* error will be caught later in gl_Lightfv */
;
}

_mesa_Lightfv( light, pname, fparam );
}



void
_mesa_GetLightfv( GLenum light, GLenum pname, GLfloat *params )
{
GET_CURRENT_CONTEXT(ctx);
GLint l = (GLint) (light - GL_LIGHT0); GLint l = (GLint) (light - GL_LIGHT0);


ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetLight"); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetLight");






void gl_GetLightiv( GLcontext *ctx, GLenum light, GLenum pname, GLint *params )
void
_mesa_GetLightiv( GLenum light, GLenum pname, GLint *params )
{ {
GET_CURRENT_CONTEXT(ctx);
GLint l = (GLint) (light - GL_LIGHT0); GLint l = (GLint) (light - GL_LIGHT0);


ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetLight"); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetLight");
/**********************************************************************/ /**********************************************************************/




void gl_LightModelfv( GLcontext *ctx, GLenum pname, const GLfloat *params )
void
_mesa_LightModelfv( GLenum pname, const GLfloat *params )
{ {
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glLightModel");
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glLightModelfv");


switch (pname) { switch (pname) {
case GL_LIGHT_MODEL_AMBIENT: case GL_LIGHT_MODEL_AMBIENT:
} }




void
_mesa_LightModeliv( GLenum pname, const GLint *params )
{
GLfloat fparam[4];
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glLightModeliv");

switch (pname) {
case GL_LIGHT_MODEL_AMBIENT:
fparam[0] = INT_TO_FLOAT( params[0] );
fparam[1] = INT_TO_FLOAT( params[1] );
fparam[2] = INT_TO_FLOAT( params[2] );
fparam[3] = INT_TO_FLOAT( params[3] );
break;
case GL_LIGHT_MODEL_LOCAL_VIEWER:
case GL_LIGHT_MODEL_TWO_SIDE:
case GL_LIGHT_MODEL_COLOR_CONTROL:
fparam[0] = (GLfloat) params[0];
break;
default:
/* Error will be caught later in gl_LightModelfv */
;
}
_mesa_LightModelfv( pname, fparam );
}


void
_mesa_LightModeli( GLenum pname, GLint param )
{
_mesa_LightModeliv( pname, &param );
}


void
_mesa_LightModelf( GLenum pname, GLfloat param )
{
_mesa_LightModelfv( pname, &param );
}





/********** MATERIAL **********/ /********** MATERIAL **********/
GLfloat tmp[4], color[4]; GLfloat tmp[4], color[4];


UBYTE_RGBA_TO_FLOAT_RGBA( color, rgba ); UBYTE_RGBA_TO_FLOAT_RGBA( color, rgba );
if (MESA_VERBOSE&VERBOSE_IMMEDIATE) if (MESA_VERBOSE&VERBOSE_IMMEDIATE)
fprintf(stderr, "gl_update_color_material, mask %x\n", bitmask); fprintf(stderr, "gl_update_color_material, mask %x\n", bitmask);


if (bitmask & FRONT_AMBIENT_BIT) { if (bitmask & FRONT_AMBIENT_BIT) {
struct gl_material *mat = &ctx->Light.Material[0]; struct gl_material *mat = &ctx->Light.Material[0];
SUB_3V( tmp, color, mat->Ambient ); SUB_3V( tmp, color, mat->Ambient );






void gl_ColorMaterial( GLcontext *ctx, GLenum face, GLenum mode )
void
_mesa_ColorMaterial( GLenum face, GLenum mode )
{ {
GET_CURRENT_CONTEXT(ctx);
GLuint bitmask; GLuint bitmask;
GLuint legal = (FRONT_EMISSION_BIT | BACK_EMISSION_BIT | GLuint legal = (FRONT_EMISSION_BIT | BACK_EMISSION_BIT |
FRONT_SPECULAR_BIT | BACK_SPECULAR_BIT | FRONT_SPECULAR_BIT | BACK_SPECULAR_BIT |







void
_mesa_Materialf( GLenum face, GLenum pname, GLfloat param )
{
_mesa_Materialfv( face, pname, &param );
}


/* KW: This is now called directly (ie by name) from the glMaterial* /* KW: This is now called directly (ie by name) from the glMaterial*
* API functions. * API functions.
*/ */
void gl_Materialfv( GLcontext *ctx,
GLenum face, GLenum pname, const GLfloat *params )
void
_mesa_Materialfv( GLenum face, GLenum pname, const GLfloat *params )
{ {
GET_CURRENT_CONTEXT(ctx);
struct immediate *IM; struct immediate *IM;
struct gl_material *mat; struct gl_material *mat;
GLuint bitmask; GLuint bitmask;
IM->MaterialMask[count] = 0; IM->MaterialMask[count] = 0;
} }



IM->MaterialMask[count] |= bitmask; IM->MaterialMask[count] |= bitmask;
mat = IM->Material[count]; mat = IM->Material[count];


} }




void
_mesa_Materiali(GLenum face, GLenum pname, GLint param )
{
_mesa_Materialiv(face, pname, &param);
}


void
_mesa_Materialiv(GLenum face, GLenum pname, const GLint *params )
{
GLfloat fparam[4];
switch (pname) {
case GL_AMBIENT:
case GL_DIFFUSE:
case GL_SPECULAR:
case GL_EMISSION:
case GL_AMBIENT_AND_DIFFUSE:
fparam[0] = INT_TO_FLOAT( params[0] );
fparam[1] = INT_TO_FLOAT( params[1] );
fparam[2] = INT_TO_FLOAT( params[2] );
fparam[3] = INT_TO_FLOAT( params[3] );
break;
case GL_SHININESS:
fparam[0] = (GLfloat) params[0];
break;
case GL_COLOR_INDEXES:
fparam[0] = (GLfloat) params[0];
fparam[1] = (GLfloat) params[1];
fparam[2] = (GLfloat) params[2];
break;
default:
/* Error will be caught later in gl_Materialfv */
;
}
_mesa_Materialfv(face, pname, fparam);
}




void gl_GetMaterialfv( GLcontext *ctx,
GLenum face, GLenum pname, GLfloat *params )
void
_mesa_GetMaterialfv( GLenum face, GLenum pname, GLfloat *params )
{ {
GET_CURRENT_CONTEXT(ctx);
GLuint f; GLuint f;


ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetMaterialfv"); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetMaterialfv");






void gl_GetMaterialiv( GLcontext *ctx,
GLenum face, GLenum pname, GLint *params )
void
_mesa_GetMaterialiv( GLenum face, GLenum pname, GLint *params )
{ {
GET_CURRENT_CONTEXT(ctx);
GLuint f; GLuint f;


ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetMaterialiv"); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetMaterialiv");

+ 50
- 28
src/mesa/main/light.h View File

/* $Id: light.h,v 1.1 1999/08/19 00:55:41 jtg Exp $ */
/* $Id: light.h,v 1.2 1999/11/11 01:22:27 brianp Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
* Version: 3.1
* Version: 3.3
* *
* Copyright (C) 1999 Brian Paul All Rights Reserved. * Copyright (C) 1999 Brian Paul All Rights Reserved.
* *
*/ */







#ifndef LIGHT_H #ifndef LIGHT_H
#define LIGHT_H #define LIGHT_H


}; };




extern void gl_ShadeModel( GLcontext *ctx, GLenum mode );
extern void
_mesa_ShadeModel( GLenum mode );


extern void gl_ColorMaterial( GLcontext *ctx, GLenum face, GLenum mode );
extern void
_mesa_ColorMaterial( GLenum face, GLenum mode );


extern void gl_Lightfv( GLcontext *ctx,
GLenum light, GLenum pname, const GLfloat *params,
GLint nparams );
extern void
_mesa_Lightf( GLenum light, GLenum pname, GLfloat param );


extern void gl_LightModelfv( GLcontext *ctx,
GLenum pname, const GLfloat *params );
extern void
_mesa_Lightfv( GLenum light, GLenum pname, const GLfloat *params );


extern void
_mesa_Lightiv( GLenum light, GLenum pname, const GLint *params );


extern GLuint gl_material_bitmask( GLcontext *ctx,
GLenum face, GLenum pname,
GLuint legal,
const char * );
extern void
_mesa_Lighti( GLenum light, GLenum pname, GLint param );


extern void gl_set_material( GLcontext *ctx, GLuint bitmask,
const GLfloat *params);
extern void
_mesa_LightModelf( GLenum pname, GLfloat param );

extern void
_mesa_LightModelfv( GLenum pname, const GLfloat *params );

extern void
_mesa_LightModeli( GLenum pname, GLint param );


extern void gl_Materialfv( GLcontext *ctx,
GLenum face, GLenum pname, const GLfloat *params );
extern void
_mesa_LightModeliv( GLenum pname, const GLint *params );


extern void
_mesa_Materialf( GLenum face, GLenum pname, GLfloat param );


extern void
_mesa_Materialfv( GLenum face, GLenum pname, const GLfloat *params );


extern void gl_GetLightfv( GLcontext *ctx,
GLenum light, GLenum pname, GLfloat *params );
extern void
_mesa_Materiali( GLenum face, GLenum pname, GLint param );


extern void gl_GetLightiv( GLcontext *ctx,
GLenum light, GLenum pname, GLint *params );
extern void
_mesa_Materialiv( GLenum face, GLenum pname, const GLint *params );


extern void
_mesa_GetLightfv( GLenum light, GLenum pname, GLfloat *params );


extern void gl_GetMaterialfv( GLcontext *ctx,
GLenum face, GLenum pname, GLfloat *params );
extern void
_mesa_GetLightiv( GLenum light, GLenum pname, GLint *params );


extern void gl_GetMaterialiv( GLcontext *ctx,
GLenum face, GLenum pname, GLint *params );
extern void
_mesa_GetMaterialfv( GLenum face, GLenum pname, GLfloat *params );


extern void
_mesa_GetMaterialiv( GLenum face, GLenum pname, GLint *params );



extern GLuint gl_material_bitmask( GLcontext *ctx,
GLenum face, GLenum pname,
GLuint legal,
const char * );

extern void gl_set_material( GLcontext *ctx, GLuint bitmask,
const GLfloat *params);


extern void gl_compute_spot_exp_table( struct gl_light *l ); extern void gl_compute_spot_exp_table( struct gl_light *l );



+ 9
- 12
src/mesa/main/lines.c View File

/* $Id: lines.c,v 1.5 1999/11/08 14:36:32 brianp Exp $ */
/* $Id: lines.c,v 1.6 1999/11/11 01:22:27 brianp Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
* Version: 3.1
* Version: 3.3
* *
* Copyright (C) 1999 Brian Paul All Rights Reserved. * Copyright (C) 1999 Brian Paul All Rights Reserved.
* *
*/ */







#ifdef PC_HEADER #ifdef PC_HEADER
#include "all.h" #include "all.h"
#else #else
#ifndef XFree86Server
#include <assert.h>
#else
#include "GL/xf86glx.h"
#endif
#include "glheader.h"
#include "context.h" #include "context.h"
#include "depth.h" #include "depth.h"
#include "feedback.h" #include "feedback.h"






void gl_LineWidth( GLcontext *ctx, GLfloat width )
void
_mesa_LineWidth( GLfloat width )
{ {
GET_CURRENT_CONTEXT(ctx);
if (width<=0.0) { if (width<=0.0) {
gl_error( ctx, GL_INVALID_VALUE, "glLineWidth" ); gl_error( ctx, GL_INVALID_VALUE, "glLineWidth" );
return; return;






void gl_LineStipple( GLcontext *ctx, GLint factor, GLushort pattern )
void
_mesa_LineStipple( GLint factor, GLushort pattern )
{ {
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glLineStipple"); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glLineStipple");
ctx->Line.StippleFactor = CLAMP( factor, 1, 256 ); ctx->Line.StippleFactor = CLAMP( factor, 1, 256 );
ctx->Line.StipplePattern = pattern; ctx->Line.StipplePattern = pattern;

+ 8
- 8
src/mesa/main/lines.h View File

/* $Id: lines.h,v 1.1 1999/08/19 00:55:41 jtg Exp $ */
/* $Id: lines.h,v 1.2 1999/11/11 01:22:27 brianp Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
* Version: 3.1
* Version: 3.3
* *
* Copyright (C) 1999 Brian Paul All Rights Reserved. * Copyright (C) 1999 Brian Paul All Rights Reserved.
* *
*/ */







#ifndef LINES_H #ifndef LINES_H
#define LINES_H #define LINES_H


#include "types.h" #include "types.h"




extern void gl_LineWidth( GLcontext *ctx, GLfloat width );
extern void
_mesa_LineWidth( GLfloat width );


extern void gl_LineStipple( GLcontext *ctx, GLint factor, GLushort pattern );
extern void
_mesa_LineStipple( GLint factor, GLushort pattern );


extern void gl_set_line_function( GLcontext *ctx );
extern void
gl_set_line_function( GLcontext *ctx );




#endif #endif

+ 16
- 87
src/mesa/main/macros.h View File

/* $Id: macros.h,v 1.6 1999/11/08 15:29:43 brianp Exp $ */
/* $Id: macros.h,v 1.7 1999/11/11 01:22:27 brianp Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
* Version: 3.1
* Version: 3.3
* *
* Copyright (C) 1999 Brian Paul All Rights Reserved. * Copyright (C) 1999 Brian Paul All Rights Reserved.
* *
*/ */







/* /*
* A collection of useful macros. * A collection of useful macros.
*/ */
#ifndef MACROS_H #ifndef MACROS_H
#define MACROS_H #define MACROS_H


#ifndef XFree86Server
#include <assert.h>
#include <math.h>
#include <string.h>
#else
#include <GL/glx_ansic.h>
#endif

#include "glheader.h"




#ifdef DEBUG #ifdef DEBUG


#define ACC_4V( DST, SRC ) \ #define ACC_4V( DST, SRC ) \
do { \ do { \
(DST)[0] += (SRC)[0]; \
(DST)[1] += (SRC)[1]; \
(DST)[2] += (SRC)[2]; \
(DST)[3] += (SRC)[3]; \
(DST)[0] += (SRC)[0]; \
(DST)[1] += (SRC)[1]; \
(DST)[2] += (SRC)[2]; \
(DST)[3] += (SRC)[3]; \
} while (0) } while (0)


#define ACC_SCALE_4V( DST, SRCA, SRCB ) \ #define ACC_SCALE_4V( DST, SRCA, SRCB ) \
do { \ do { \
(DST)[0] += (SRCA)[0] * (SRCB)[0]; \
(DST)[1] += (SRCA)[1] * (SRCB)[1]; \
(DST)[2] += (SRCA)[2] * (SRCB)[2]; \
(DST)[3] += (SRCA)[3] * (SRCB)[3]; \
(DST)[0] += (SRCA)[0] * (SRCB)[0]; \
(DST)[1] += (SRCA)[1] * (SRCB)[1]; \
(DST)[2] += (SRCA)[2] * (SRCB)[2]; \
(DST)[3] += (SRCA)[3] * (SRCB)[3]; \
} while (0) } while (0)


#define ACC_SCALE_SCALAR_4V( DST, S, SRCB ) \ #define ACC_SCALE_SCALAR_4V( DST, S, SRCB ) \
do { \ do { \
(DST)[0] += S * (SRCB)[0]; \
(DST)[1] += S * (SRCB)[1]; \
(DST)[2] += S * (SRCB)[2]; \
(DST)[3] += S * (SRCB)[3]; \
(DST)[0] += S * (SRCB)[0]; \
(DST)[1] += S * (SRCB)[1]; \
(DST)[2] += S * (SRCB)[2]; \
(DST)[3] += S * (SRCB)[3]; \
} while (0) } while (0)


#define SCALE_SCALAR_4V( DST, S, SRCB ) \ #define SCALE_SCALAR_4V( DST, S, SRCB ) \






/*
* Memory allocation
* XXX these should probably go into a new glmemory.h file.
*/
#ifdef DEBUG
extern void *gl_malloc(size_t bytes);
extern void *gl_calloc(size_t bytes);
extern void gl_free(void *ptr);
#define MALLOC(BYTES) gl_malloc(BYTES)
#define CALLOC(BYTES) gl_calloc(BYTES)
#define MALLOC_STRUCT(T) (struct T *) gl_malloc(sizeof(struct T))
#define CALLOC_STRUCT(T) (struct T *) gl_calloc(sizeof(struct T))
#define FREE(PTR) gl_free(PTR)
#else
#define MALLOC(BYTES) (void *) malloc(BYTES)
#define CALLOC(BYTES) (void *) calloc(1, BYTES)
#define MALLOC_STRUCT(T) (struct T *) malloc(sizeof(struct T))
#define CALLOC_STRUCT(T) (struct T *) calloc(1,sizeof(struct T))
#define FREE(PTR) free(PTR)
#endif


/* Memory copy: */
#ifdef SUNOS4
#define MEMCPY( DST, SRC, BYTES) \
memcpy( (char *) (DST), (char *) (SRC), (int) (BYTES) )
#else
#define MEMCPY( DST, SRC, BYTES) \
memcpy( (void *) (DST), (void *) (SRC), (size_t) (BYTES) )
#endif


/* Memory set: */
#ifdef SUNOS4
#define MEMSET( DST, VAL, N ) \
memset( (char *) (DST), (int) (VAL), (int) (N) )
#else
#define MEMSET( DST, VAL, N ) \
memset( (void *) (DST), (int) (VAL), (size_t) (N) )
#endif


/* MACs and BeOS don't support static larger than 32kb, so... */
#if defined(macintosh) && !defined(__MRC__)
extern char *AGLAlloc(int size);
extern void AGLFree(char* ptr);
# define DEFARRAY(TYPE,NAME,SIZE) TYPE *NAME = (TYPE*)AGLAlloc(sizeof(TYPE)*(SIZE))
# define DEFMARRAY(TYPE,NAME,SIZE1,SIZE2) TYPE (*NAME)[SIZE2] = (TYPE(*)[SIZE2])AGLAlloc(sizeof(TYPE)*(SIZE1)*(SIZE2))
# define CHECKARRAY(NAME,CMD) do {if (!(NAME)) {CMD;}} while (0)
# define UNDEFARRAY(NAME) do {if ((NAME)) {AGLFree((char*)NAME);} }while (0)
#elif defined(__BEOS__)
# define DEFARRAY(TYPE,NAME,SIZE) TYPE *NAME = (TYPE*)malloc(sizeof(TYPE)*(SIZE))
# define DEFMARRAY(TYPE,NAME,SIZE1,SIZE2) TYPE (*NAME)[SIZE2] = (TYPE(*)[SIZE2])malloc(sizeof(TYPE)*(SIZE1)*(SIZE2))
# define CHECKARRAY(NAME,CMD) do {if (!(NAME)) {CMD;}} while (0)
# define UNDEFARRAY(NAME) do {if ((NAME)) {free((char*)NAME);} }while (0)
#else
# define DEFARRAY(TYPE,NAME,SIZE) TYPE NAME[SIZE]
# define DEFMARRAY(TYPE,NAME,SIZE1,SIZE2) TYPE NAME[SIZE1][SIZE2]
# define CHECKARRAY(NAME,CMD) do {} while(0)
# define UNDEFARRAY(NAME)
#endif


/* Some compilers don't like some of Mesa's const usage */ /* Some compilers don't like some of Mesa's const usage */
#ifdef NO_CONST #ifdef NO_CONST
# define CONST # define CONST

+ 85
- 38
src/mesa/main/matrix.c View File

/* $Id: matrix.c,v 1.8 1999/11/08 07:36:44 brianp Exp $ */
/* $Id: matrix.c,v 1.9 1999/11/11 01:22:27 brianp Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
* Version: 3.1
* Version: 3.3
* *
* Copyright (C) 1999 Brian Paul All Rights Reserved. * Copyright (C) 1999 Brian Paul All Rights Reserved.
* *
*/ */







/* /*
* Matrix operations * Matrix operations
* *
#ifdef PC_HEADER #ifdef PC_HEADER
#include "all.h" #include "all.h"
#else #else
#ifndef XFree86Server
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#else
#include "GL/xf86glx.h"
#endif
#include "glheader.h"
#include "context.h" #include "context.h"
#include "enums.h" #include "enums.h"
#include "macros.h"
#include "matrix.h" #include "matrix.h"
#include "mem.h"
#include "mmath.h" #include "mmath.h"
#include "types.h" #include "types.h"
#endif #endif
} while (0) } while (0)




void gl_Frustum( GLcontext *ctx,
GLdouble left, GLdouble right,
GLdouble bottom, GLdouble top,
GLdouble nearval, GLdouble farval )
void
_mesa_Frustum( GLdouble left, GLdouble right,
GLdouble bottom, GLdouble top,
GLdouble nearval, GLdouble farval )
{ {
GET_CURRENT_CONTEXT(ctx);
GLfloat x, y, a, b, c, d; GLfloat x, y, a, b, c, d;
GLfloat m[16]; GLfloat m[16];
GLmatrix *mat = 0; GLmatrix *mat = 0;
} }




void gl_Ortho( GLcontext *ctx,
GLdouble left, GLdouble right,
GLdouble bottom, GLdouble top,
GLdouble nearval, GLdouble farval )
void
_mesa_Ortho( GLdouble left, GLdouble right,
GLdouble bottom, GLdouble top,
GLdouble nearval, GLdouble farval )
{ {
GET_CURRENT_CONTEXT(ctx);
GLfloat x, y, z; GLfloat x, y, z;
GLfloat tx, ty, tz; GLfloat tx, ty, tz;
GLfloat m[16]; GLfloat m[16];
} }




void gl_MatrixMode( GLcontext *ctx, GLenum mode )
void
_mesa_MatrixMode( GLenum mode )
{ {
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glMatrixMode"); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glMatrixMode");
switch (mode) { switch (mode) {
case GL_MODELVIEW: case GL_MODELVIEW:






void gl_PushMatrix( GLcontext *ctx )
void
_mesa_PushMatrix( void )
{ {
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPushMatrix"); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPushMatrix");


if (MESA_VERBOSE&VERBOSE_API) if (MESA_VERBOSE&VERBOSE_API)






void gl_PopMatrix( GLcontext *ctx )
void
_mesa_PopMatrix( void )
{ {
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPopMatrix"); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPopMatrix");


if (MESA_VERBOSE&VERBOSE_API) if (MESA_VERBOSE&VERBOSE_API)






void gl_LoadIdentity( GLcontext *ctx )
void
_mesa_LoadIdentity( void )
{ {
GET_CURRENT_CONTEXT(ctx);
GLmatrix *mat = 0; GLmatrix *mat = 0;
GET_ACTIVE_MATRIX(ctx, mat, ctx->NewState, "glLoadIdentity"); GET_ACTIVE_MATRIX(ctx, mat, ctx->NewState, "glLoadIdentity");


} }




void gl_LoadMatrixf( GLcontext *ctx, const GLfloat *m )
void
_mesa_LoadMatrixf( const GLfloat *m )
{ {
GET_CURRENT_CONTEXT(ctx);
GLmatrix *mat = 0; GLmatrix *mat = 0;
GET_ACTIVE_MATRIX(ctx, mat, ctx->NewState, "glLoadMatrix"); GET_ACTIVE_MATRIX(ctx, mat, ctx->NewState, "glLoadMatrix");


} }




void
_mesa_LoadMatrixd( const GLdouble *m )
{
GLfloat f[16];
GLint i;
for (i = 0; i < 16; i++)
f[i] = m[i];
_mesa_LoadMatrixf(f);
}




/* /*
* Multiply the active matrix by an arbitary matrix. * Multiply the active matrix by an arbitary matrix.
*/ */
void gl_MultMatrixf( GLcontext *ctx, const GLfloat *m )
void
_mesa_MultMatrixf( const GLfloat *m )
{ {
GET_CURRENT_CONTEXT(ctx);
GLmatrix *mat = 0; GLmatrix *mat = 0;
GET_ACTIVE_MATRIX( ctx, mat, ctx->NewState, "glMultMatrix" ); GET_ACTIVE_MATRIX( ctx, mat, ctx->NewState, "glMultMatrix" );
matmul4( mat->m, mat->m, m ); matmul4( mat->m, mat->m, m );
/* /*
* Multiply the active matrix by an arbitary matrix. * Multiply the active matrix by an arbitary matrix.
*/ */
void gl_MultMatrixd( GLcontext *ctx, const GLdouble *m )
void
_mesa_MultMatrixd( const GLdouble *m )
{ {
GET_CURRENT_CONTEXT(ctx);
GLmatrix *mat = 0; GLmatrix *mat = 0;
GET_ACTIVE_MATRIX( ctx, mat, ctx->NewState, "glMultMatrix" ); GET_ACTIVE_MATRIX( ctx, mat, ctx->NewState, "glMultMatrix" );
matmul4fd( mat->m, mat->m, m ); matmul4fd( mat->m, mat->m, m );
/* /*
* Execute a glRotate call * Execute a glRotate call
*/ */
void gl_Rotatef( GLcontext *ctx,
GLfloat angle, GLfloat x, GLfloat y, GLfloat z )
void
_mesa_Rotatef( GLfloat angle, GLfloat x, GLfloat y, GLfloat z )
{ {
GET_CURRENT_CONTEXT(ctx);
GLfloat m[16]; GLfloat m[16];
if (angle != 0.0F) { if (angle != 0.0F) {
GLmatrix *mat = 0; GLmatrix *mat = 0;
} }
} }


void
_mesa_Rotated( GLdouble angle, GLdouble x, GLdouble y, GLdouble z )
{
_mesa_Rotatef(angle, x, y, z);
}


/* /*
* Execute a glScale call * Execute a glScale call
*/ */
void gl_Scalef( GLcontext *ctx, GLfloat x, GLfloat y, GLfloat z )
void
_mesa_Scalef( GLfloat x, GLfloat y, GLfloat z )
{ {
GET_CURRENT_CONTEXT(ctx);
GLmatrix *mat = 0; GLmatrix *mat = 0;
GLfloat *m; GLfloat *m;
GET_ACTIVE_MATRIX(ctx, mat, ctx->NewState, "glScale"); GET_ACTIVE_MATRIX(ctx, mat, ctx->NewState, "glScale");
MAT_DIRTY_DEPENDENTS); MAT_DIRTY_DEPENDENTS);
} }



void
_mesa_Scaled( GLdouble x, GLdouble y, GLdouble z )
{
_mesa_Scalef(x, y, z);
}


/* /*
* Execute a glTranslate call * Execute a glTranslate call
*/ */
void gl_Translatef( GLcontext *ctx, GLfloat x, GLfloat y, GLfloat z )
void
_mesa_Translatef( GLfloat x, GLfloat y, GLfloat z )
{ {
GET_CURRENT_CONTEXT(ctx);
GLmatrix *mat = 0; GLmatrix *mat = 0;
GLfloat *m; GLfloat *m;
GET_ACTIVE_MATRIX(ctx, mat, ctx->NewState, "glTranslate"); GET_ACTIVE_MATRIX(ctx, mat, ctx->NewState, "glTranslate");
} }




void
_mesa_Translated( GLdouble x, GLdouble y, GLdouble z )
{
_mesa_Translatef(x, y, z);
}



/* /*
* Define a new viewport and reallocate auxillary buffers if the size of * Define a new viewport and reallocate auxillary buffers if the size of
* the window (color buffer) has changed. * the window (color buffer) has changed.
*/ */
void gl_Viewport( GLcontext *ctx,
GLint x, GLint y, GLsizei width, GLsizei height )
void
_mesa_Viewport( GLint x, GLint y, GLsizei width, GLsizei height )
{ {
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glViewport"); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glViewport");


if (width<0 || height<0) { if (width<0 || height<0) {
/* Check if window/buffer has been resized and if so, reallocate the /* Check if window/buffer has been resized and if so, reallocate the
* ancillary buffers. * ancillary buffers.
*/ */
gl_ResizeBuffersMESA(ctx);
_mesa_ResizeBuffersMESA();




ctx->RasterMask &= ~WINCLIP_BIT; ctx->RasterMask &= ~WINCLIP_BIT;






void gl_DepthRange( GLcontext *ctx, GLclampd nearval, GLclampd farval )
void
_mesa_DepthRange( GLclampd nearval, GLclampd farval )
{ {
/* /*
* nearval - specifies mapping of the near clipping plane to window * nearval - specifies mapping of the near clipping plane to window
* this range to window z coords. * this range to window z coords.
*/ */
GLfloat n, f; GLfloat n, f;
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glDepthRange"); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glDepthRange");


if (MESA_VERBOSE&VERBOSE_API) if (MESA_VERBOSE&VERBOSE_API)

+ 61
- 41
src/mesa/main/matrix.h View File

/* $Id: matrix.h,v 1.2 1999/10/08 09:27:11 keithw Exp $ */
/* $Id: matrix.h,v 1.3 1999/11/11 01:22:27 brianp Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
* Version: 3.1
* Version: 3.3
* *
* Copyright (C) 1999 Brian Paul All Rights Reserved. * Copyright (C) 1999 Brian Paul All Rights Reserved.
* *
*/ */







#ifndef MATRIX_H #ifndef MATRIX_H
#define MATRIX_H #define MATRIX_H




#include "GL/gl.h"
#include "types.h"
#include "config.h" #include "config.h"



typedef struct { typedef struct {
GLfloat m[16]; GLfloat m[16];
GLfloat *inv; /* optional */ GLfloat *inv; /* optional */
GLuint type; GLuint type;
} GLmatrix; } GLmatrix;



#ifdef VMS #ifdef VMS
#define gl_calculate_model_project_matrix gl_calculate_model_project_matr #define gl_calculate_model_project_matrix gl_calculate_model_project_matr
#endif #endif
GLfloat m[] ); GLfloat m[] );




extern void gl_mat_mul_floats( GLmatrix *mat, const GLfloat *m, GLuint flags );


extern void gl_Frustum( GLcontext *ctx,
GLdouble left, GLdouble right,
GLdouble bottom, GLdouble top,
GLdouble nearval, GLdouble farval );
extern void gl_mat_mul_mat( GLmatrix *mat, const GLmatrix *mat2 );


extern void gl_Ortho( GLcontext *ctx,
GLdouble left, GLdouble right,
GLdouble bottom, GLdouble top,
GLdouble nearval, GLdouble farval );
extern void gl_calculate_model_project_matrix( GLcontext *ctx );


extern void gl_PushMatrix( GLcontext *ctx );
extern void gl_matrix_ctr( GLmatrix *m );


extern void gl_PopMatrix( GLcontext *ctx );
extern void gl_matrix_dtr( GLmatrix *m );


extern void gl_LoadIdentity( GLcontext *ctx );
extern void gl_matrix_alloc_inv( GLmatrix *m );


extern void gl_LoadMatrixf( GLcontext *ctx, const GLfloat *m );
extern void gl_matrix_copy( GLmatrix *to, const GLmatrix *from );


extern void gl_MatrixMode( GLcontext *ctx, GLenum mode );
extern void gl_matrix_mul( GLmatrix *dest,
const GLmatrix *a,
const GLmatrix *b );


extern void gl_MultMatrixf( GLcontext *ctx, const GLfloat *m );
extern void gl_matrix_analyze( GLmatrix *mat );


extern void gl_mat_mul_floats( GLmatrix *mat, const GLfloat *m, GLuint flags );
extern void gl_mat_mul_mat( GLmatrix *mat, const GLmatrix *mat2 );
extern GLboolean gl_matrix_invert( GLmatrix *mat );


extern void gl_Rotatef( GLcontext *ctx,
GLfloat angle, GLfloat x, GLfloat y, GLfloat z );
extern void gl_print_matrix( const GLmatrix *m );


extern void gl_Scalef( GLcontext *ctx, GLfloat x, GLfloat y, GLfloat z );


extern void gl_Translatef( GLcontext *ctx, GLfloat x, GLfloat y, GLfloat z );


extern void gl_Viewport( GLcontext *ctx,
GLint x, GLint y, GLsizei width, GLsizei height );
extern void
_mesa_Frustum( GLdouble left, GLdouble right,
GLdouble bottom, GLdouble top,
GLdouble nearval, GLdouble farval );


extern void gl_DepthRange( GLcontext* ctx, GLclampd nearval, GLclampd farval );
extern void
_mesa_Ortho( GLdouble left, GLdouble right,
GLdouble bottom, GLdouble top,
GLdouble nearval, GLdouble farval );


extern void
_mesa_PushMatrix( void );


extern void
_mesa_PopMatrix( void );


extern void
_mesa_LoadIdentity( void );


extern void
_mesa_LoadMatrixf( const GLfloat *m );


extern void gl_calculate_model_project_matrix( GLcontext *ctx );
extern void
_mesa_LoadMatrixd( const GLdouble *m );


extern void
_mesa_MatrixMode( GLenum mode );


extern void gl_matrix_ctr( GLmatrix *m );
extern void
_mesa_MultMatrixf( const GLfloat *m );


extern void gl_matrix_dtr( GLmatrix *m );
extern void
_mesa_MultMatrixd( const GLdouble *m );


extern void gl_matrix_alloc_inv( GLmatrix *m );
extern void
_mesa_Rotatef( GLfloat angle, GLfloat x, GLfloat y, GLfloat z );


extern void gl_matrix_copy( GLmatrix *to, const GLmatrix *from );
extern void
_mesa_Rotated( GLdouble angle, GLdouble x, GLdouble y, GLdouble z );


extern void gl_matrix_mul( GLmatrix *dest,
const GLmatrix *a,
const GLmatrix *b );
extern void
_mesa_Scalef( GLfloat x, GLfloat y, GLfloat z );


extern void gl_matrix_analyze( GLmatrix *mat );
extern void
_mesa_Scaled( GLdouble x, GLdouble y, GLdouble z );


extern void
_mesa_Translatef( GLfloat x, GLfloat y, GLfloat z );

extern void
_mesa_Translated( GLdouble x, GLdouble y, GLdouble z );

extern void
_mesa_Viewport( GLint x, GLint y, GLsizei width, GLsizei height );

extern void
_mesa_DepthRange( GLclampd nearval, GLclampd farval );


extern void gl_MultMatrixd( GLcontext *ctx, const GLdouble *m );
extern GLboolean gl_matrix_invert( GLmatrix *mat );
extern void gl_print_matrix( const GLmatrix *m );




#endif #endif

+ 75
- 23
src/mesa/main/pixel.c View File

/* $Id: pixel.c,v 1.4 1999/11/08 07:36:44 brianp Exp $ */
/* $Id: pixel.c,v 1.5 1999/11/11 01:22:27 brianp Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
* Version: 3.1
* Version: 3.3
* *
* Copyright (C) 1999 Brian Paul All Rights Reserved. * Copyright (C) 1999 Brian Paul All Rights Reserved.
* *
*/ */







/* /*
* glPixelStore, glPixelTransfer, glPixelMap, glPixelZoom, etc. * glPixelStore, glPixelTransfer, glPixelMap, glPixelZoom, etc.
*/ */
#ifdef PC_HEADER #ifdef PC_HEADER
#include "all.h" #include "all.h"
#else #else
#ifndef XFree86Server
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#else
#include "GL/xf86glx.h"
#endif
#include "glheader.h"
#include "context.h" #include "context.h"
#include "macros.h" #include "macros.h"
#include "mem.h"
#include "pixel.h" #include "pixel.h"
#include "types.h" #include "types.h"
#endif #endif






void gl_PixelZoom( GLcontext *ctx, GLfloat xfactor, GLfloat yfactor )
void
_mesa_PixelZoom( GLfloat xfactor, GLfloat yfactor )
{ {
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPixelZoom"); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPixelZoom");


ctx->Pixel.ZoomX = xfactor; ctx->Pixel.ZoomX = xfactor;
/**********************************************************************/ /**********************************************************************/




void gl_PixelStorei( GLcontext *ctx, GLenum pname, GLint param )
void
_mesa_PixelStorei( GLenum pname, GLint param )
{ {
/* NOTE: this call can't be compiled into the display list */ /* NOTE: this call can't be compiled into the display list */
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPixelStore"); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPixelStore");



switch (pname) { switch (pname) {
case GL_PACK_SWAP_BYTES: case GL_PACK_SWAP_BYTES:
ctx->Pack.SwapBytes = param ? GL_TRUE : GL_FALSE; ctx->Pack.SwapBytes = param ? GL_TRUE : GL_FALSE;
} }




void
_mesa_PixelStoref( GLenum pname, GLfloat param )
{
_mesa_PixelStorei( pname, (GLint) param );
}












void gl_PixelMapfv( GLcontext *ctx,
GLenum map, GLint mapsize, const GLfloat *values )
void
_mesa_PixelMapfv( GLenum map, GLint mapsize, const GLfloat *values )
{ {
GLint i; GLint i;
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPixelMapfv"); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPixelMapfv");










void
_mesa_PixelMapuiv(GLenum map, GLint mapsize, const GLuint *values )
{
GLfloat fvalues[MAX_PIXEL_MAP_TABLE];
GLint i;
if (map==GL_PIXEL_MAP_I_TO_I || map==GL_PIXEL_MAP_S_TO_S) {
for (i=0;i<mapsize;i++) {
fvalues[i] = (GLfloat) values[i];
}
}
else {
for (i=0;i<mapsize;i++) {
fvalues[i] = UINT_TO_FLOAT( values[i] );
}
}
_mesa_PixelMapfv(map, mapsize, fvalues);
}



void
_mesa_PixelMapusv(GLenum map, GLint mapsize, const GLushort *values )
{
GLfloat fvalues[MAX_PIXEL_MAP_TABLE];
GLint i;
if (map==GL_PIXEL_MAP_I_TO_I || map==GL_PIXEL_MAP_S_TO_S) {
for (i=0;i<mapsize;i++) {
fvalues[i] = (GLfloat) values[i];
}
}
else {
for (i=0;i<mapsize;i++) {
fvalues[i] = USHORT_TO_FLOAT( values[i] );
}
}
_mesa_PixelMapfv(map, mapsize, fvalues);
}





void gl_GetPixelMapfv( GLcontext *ctx, GLenum map, GLfloat *values )
void
_mesa_GetPixelMapfv( GLenum map, GLfloat *values )
{ {
GET_CURRENT_CONTEXT(ctx);
GLint i; GLint i;


ASSERT_OUTSIDE_BEGIN_END(ctx, "glGetPixelMapfv"); ASSERT_OUTSIDE_BEGIN_END(ctx, "glGetPixelMapfv");
} }




void gl_GetPixelMapuiv( GLcontext *ctx, GLenum map, GLuint *values )
void
_mesa_GetPixelMapuiv( GLenum map, GLuint *values )
{ {
GET_CURRENT_CONTEXT(ctx);
GLint i; GLint i;


ASSERT_OUTSIDE_BEGIN_END(ctx, "glGetPixelMapfv"); ASSERT_OUTSIDE_BEGIN_END(ctx, "glGetPixelMapfv");
} }




void gl_GetPixelMapusv( GLcontext *ctx, GLenum map, GLushort *values )
void
_mesa_GetPixelMapusv( GLenum map, GLushort *values )
{ {
GET_CURRENT_CONTEXT(ctx);
GLint i; GLint i;


ASSERT_OUTSIDE_BEGIN_END(ctx, "glGetPixelMapfv"); ASSERT_OUTSIDE_BEGIN_END(ctx, "glGetPixelMapfv");
* Implements glPixelTransfer[fi] whether called immediately or from a * Implements glPixelTransfer[fi] whether called immediately or from a
* display list. * display list.
*/ */
void gl_PixelTransferf( GLcontext *ctx, GLenum pname, GLfloat param )
void
_mesa_PixelTransferf( GLenum pname, GLfloat param )
{ {
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPixelTransfer"); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPixelTransfer");




} }




void
_mesa_PixelTransferi( GLenum pname, GLint param )
{
_mesa_PixelTransferf( pname, (GLfloat) param );
}






/* /*

+ 28
- 13
src/mesa/main/pixel.h View File

/* $Id: pixel.h,v 1.2 1999/10/30 08:20:57 brianp Exp $ */
/* $Id: pixel.h,v 1.3 1999/11/11 01:22:27 brianp Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
* Version: 3.1
* Version: 3.3
* *
* Copyright (C) 1999 Brian Paul All Rights Reserved. * Copyright (C) 1999 Brian Paul All Rights Reserved.
* *
*/ */







#ifndef PIXEL_H #ifndef PIXEL_H
#define PIXEL_H #define PIXEL_H


*/ */




extern void gl_GetPixelMapfv( GLcontext *ctx, GLenum map, GLfloat *values );
extern void
_mesa_GetPixelMapfv( GLenum map, GLfloat *values );

extern void
_mesa_GetPixelMapuiv( GLenum map, GLuint *values );

extern void
_mesa_GetPixelMapusv( GLenum map, GLushort *values );

extern void
_mesa_PixelMapfv( GLenum map, GLint mapsize, const GLfloat *values );

extern void
_mesa_PixelMapuiv(GLenum map, GLint mapsize, const GLuint *values );


extern void gl_GetPixelMapuiv( GLcontext *ctx, GLenum map, GLuint *values );
extern void
_mesa_PixelMapusv(GLenum map, GLint mapsize, const GLushort *values );


extern void gl_GetPixelMapusv( GLcontext *ctx, GLenum map, GLushort *values );
extern void
_mesa_PixelStoref( GLenum pname, GLfloat param );


extern void
_mesa_PixelStorei( GLenum pname, GLint param );


extern void gl_PixelMapfv( GLcontext *ctx,
GLenum map, GLint mapsize, const GLfloat *values );
extern void
_mesa_PixelTransferf( GLenum pname, GLfloat param );


extern void gl_PixelStorei( GLcontext *ctx, GLenum pname, GLint param );
extern void
_mesa_PixelTransferi( GLenum pname, GLint param );


extern void gl_PixelTransferf( GLcontext *ctx, GLenum pname, GLfloat param );
extern void
_mesa_PixelZoom( GLfloat xfactor, GLfloat yfactor );


extern void gl_PixelZoom( GLcontext *ctx, GLfloat xfactor, GLfloat yfactor );




/* /*

+ 40
- 34
src/mesa/main/points.c View File

/* $Id: points.c,v 1.4 1999/10/21 12:45:53 brianp Exp $ */
/* $Id: points.c,v 1.5 1999/11/11 01:22:27 brianp Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
* Version: 3.1
* Version: 3.3
* *
* Copyright (C) 1999 Brian Paul All Rights Reserved. * Copyright (C) 1999 Brian Paul All Rights Reserved.
* *
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
/* $XFree86: xc/lib/GL/mesa/src/points.c,v 1.4 1999/04/04 00:20:29 dawes Exp $ */





#ifdef PC_HEADER #ifdef PC_HEADER
#include "all.h" #include "all.h"
#else #else
#ifndef XFree86Server
#include <math.h>
#else
#include "GL/xf86glx.h"
#endif
#include "glheader.h"
#include "context.h" #include "context.h"
#include "feedback.h" #include "feedback.h"
#include "macros.h" #include "macros.h"
#include "texstate.h" #include "texstate.h"
#include "types.h" #include "types.h"
#include "vb.h" #include "vb.h"
#include "mmath.h"
#endif #endif






void gl_PointSize( GLcontext *ctx, GLfloat size )
void
_mesa_PointSize( GLfloat size )
{ {
if (size<=0.0) {
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPointSize");

if (size <= 0.0) {
gl_error( ctx, GL_INVALID_VALUE, "glPointSize" ); gl_error( ctx, GL_INVALID_VALUE, "glPointSize" );
return; return;
} }
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPointSize");


if (ctx->Point.Size != size) { if (ctx->Point.Size != size) {
ctx->Point.Size = size; ctx->Point.Size = size;






void gl_PointParameterfvEXT( GLcontext *ctx, GLenum pname,
const GLfloat *params)
void
_mesa_PointParameterfEXT( GLenum pname, GLfloat param)
{ {
_mesa_PointParameterfvEXT(pname, &param);
}


void
_mesa_PointParameterfvEXT( GLenum pname, const GLfloat *params)
{
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPointParameterfvEXT"); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPointParameterfvEXT");
if(pname==GL_DISTANCE_ATTENUATION_EXT) {

if (pname == GL_DISTANCE_ATTENUATION_EXT) {
GLboolean tmp = ctx->Point.Attenuated; GLboolean tmp = ctx->Point.Attenuated;
COPY_3V(ctx->Point.Params,params); COPY_3V(ctx->Point.Params,params);
ctx->Point.Attenuated = (params[0] != 1.0 || ctx->Point.Attenuated = (params[0] != 1.0 ||
ctx->TriangleCaps ^= DD_POINT_ATTEN; ctx->TriangleCaps ^= DD_POINT_ATTEN;
ctx->NewState |= NEW_RASTER_OPS; ctx->NewState |= NEW_RASTER_OPS;
} }
} else {
if (*params<0.0 ) {
gl_error( ctx, GL_INVALID_VALUE, "glPointParameterfvEXT" );
}
else {
if (*params<0.0 ) {
gl_error( ctx, GL_INVALID_VALUE, "glPointParameterfvEXT" );
return;
}
switch (pname) {
case GL_POINT_SIZE_MIN_EXT:
ctx->Point.MinSize=*params;
break;
case GL_POINT_SIZE_MAX_EXT:
ctx->Point.MaxSize=*params;
break;
case GL_POINT_FADE_THRESHOLD_SIZE_EXT:
ctx->Point.Threshold=*params;
break;
default:
gl_error( ctx, GL_INVALID_ENUM, "glPointParameterfvEXT" );
return; return;
}
switch (pname) {
case GL_POINT_SIZE_MIN_EXT:
ctx->Point.MinSize=*params;
break;
case GL_POINT_SIZE_MAX_EXT:
ctx->Point.MaxSize=*params;
break;
case GL_POINT_FADE_THRESHOLD_SIZE_EXT:
ctx->Point.Threshold=*params;
break;
default:
gl_error( ctx, GL_INVALID_ENUM, "glPointParameterfvEXT" );
return;
}
}
} }
ctx->NewState |= NEW_RASTER_OPS; ctx->NewState |= NEW_RASTER_OPS;
} }

+ 13
- 5
src/mesa/main/points.h View File

/* $Id: points.h,v 1.1 1999/08/19 00:55:41 jtg Exp $ */
/* $Id: points.h,v 1.2 1999/11/11 01:22:27 brianp Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
* Version: 3.1
* Version: 3.3
* *
* Copyright (C) 1999 Brian Paul All Rights Reserved. * Copyright (C) 1999 Brian Paul All Rights Reserved.
* *
#include "types.h" #include "types.h"




extern void gl_PointSize( GLcontext *ctx, GLfloat size );
extern void
_mesa_PointSize( GLfloat size );


extern void
_mesa_PointParameterfEXT( GLenum pname, GLfloat param);


extern void
_mesa_PointParameterfvEXT( GLenum pname, const GLfloat *params );



extern void gl_set_point_function( GLcontext *ctx ); extern void gl_set_point_function( GLcontext *ctx );


extern void gl_PointParameterfvEXT( GLcontext *ctx, GLenum pname,
const GLfloat *params );


#endif #endif

+ 30
- 19
src/mesa/main/polygon.c View File

/* $Id: polygon.c,v 1.6 1999/11/08 15:28:08 brianp Exp $ */
/* $Id: polygon.c,v 1.7 1999/11/11 01:22:27 brianp Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
* Version: 3.1
* Version: 3.3
* *
* Copyright (C) 1999 Brian Paul All Rights Reserved. * Copyright (C) 1999 Brian Paul All Rights Reserved.
* *
*/ */




/* $XFree86: xc/lib/GL/mesa/src/polygon.c,v 1.3 1999/04/04 00:20:29 dawes Exp $ */

#ifdef PC_HEADER #ifdef PC_HEADER
#include "all.h" #include "all.h"
#else #else
#ifndef XFree86Server
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#else
#include "GL/xf86glx.h"
#endif
#include "glheader.h"
#include "context.h" #include "context.h"
#include "image.h" #include "image.h"
#include "enums.h" #include "enums.h"
#include "macros.h" #include "macros.h"
#include "mem.h"
#include "polygon.h" #include "polygon.h"
#include "types.h" #include "types.h"
#endif #endif






void gl_CullFace( GLcontext *ctx, GLenum mode )
void
_mesa_CullFace( GLenum mode )
{ {
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glCullFace"); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glCullFace");


if (MESA_VERBOSE&VERBOSE_API) if (MESA_VERBOSE&VERBOSE_API)






void gl_FrontFace( GLcontext *ctx, GLenum mode )
void
_mesa_FrontFace( GLenum mode )
{ {
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glFrontFace"); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glFrontFace");


if (MESA_VERBOSE&VERBOSE_API) if (MESA_VERBOSE&VERBOSE_API)






void gl_PolygonMode( GLcontext *ctx, GLenum face, GLenum mode )
void
_mesa_PolygonMode( GLenum face, GLenum mode )
{ {
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPolygonMode"); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPolygonMode");


if (MESA_VERBOSE&VERBOSE_API) if (MESA_VERBOSE&VERBOSE_API)
/* /*
* NOTE: stipple pattern has already been unpacked. * NOTE: stipple pattern has already been unpacked.
*/ */
void gl_PolygonStipple( GLcontext *ctx, const GLuint pattern[32] )
void
_mesa_PolygonStipple( const GLubyte *mask )
{ {
GET_CURRENT_CONTEXT(ctx);
GLuint *pattern = (GLuint *) mask; /* XXX verify */
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPolygonStipple"); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPolygonStipple");


if (MESA_VERBOSE&VERBOSE_API) if (MESA_VERBOSE&VERBOSE_API)






void gl_GetPolygonStipple( GLcontext *ctx, GLubyte *dest )
void
_mesa_GetPolygonStipple( GLubyte *dest )
{ {
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPolygonOffset"); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPolygonOffset");


if (MESA_VERBOSE&VERBOSE_API) if (MESA_VERBOSE&VERBOSE_API)






void gl_PolygonOffset( GLcontext *ctx,
GLfloat factor, GLfloat units )
void
_mesa_PolygonOffset( GLfloat factor, GLfloat units )
{ {
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPolygonOffset"); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPolygonOffset");


if (MESA_VERBOSE&VERBOSE_API) if (MESA_VERBOSE&VERBOSE_API)
ctx->Polygon.OffsetUnits = units; ctx->Polygon.OffsetUnits = units;
} }



void
_mesa_PolygonOffsetEXT( GLfloat factor, GLfloat bias )
{
_mesa_PolygonOffset(factor, bias * DEPTH_SCALE );
}


+ 17
- 12
src/mesa/main/polygon.h View File

/* $Id: polygon.h,v 1.1 1999/08/19 00:55:41 jtg Exp $ */
/* $Id: polygon.h,v 1.2 1999/11/11 01:22:27 brianp Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
* Version: 3.1
* Version: 3.3
* *
* Copyright (C) 1999 Brian Paul All Rights Reserved. * Copyright (C) 1999 Brian Paul All Rights Reserved.
* *
*/ */







#ifndef POLYGON_H #ifndef POLYGON_H
#define POLYGON_H #define POLYGON_H


#include "types.h" #include "types.h"




extern void gl_CullFace( GLcontext *ctx, GLenum mode );
extern void
_mesa_CullFace( GLenum mode );

extern void
_mesa_FrontFace( GLenum mode );


extern void gl_FrontFace( GLcontext *ctx, GLenum mode );
extern void
_mesa_PolygonMode( GLenum face, GLenum mode );


extern void gl_PolygonMode( GLcontext *ctx, GLenum face, GLenum mode );
extern void
_mesa_PolygonOffset( GLfloat factor, GLfloat units );


extern void gl_PolygonOffset( GLcontext *ctx,
GLfloat factor, GLfloat units );
extern void
_mesa_PolygonOffsetEXT( GLfloat factor, GLfloat bias );


extern void gl_PolygonStipple( GLcontext *ctx, const GLuint pattern[32] );
extern void
_mesa_PolygonStipple( const GLubyte *mask );


extern void gl_GetPolygonStipple( GLcontext *ctx, GLubyte *mask );
extern void
_mesa_GetPolygonStipple( GLubyte *mask );




#endif #endif

+ 141
- 71
src/mesa/main/rastpos.c View File

/* $Id: rastpos.c,v 1.3 1999/11/08 15:28:08 brianp Exp $ */
/* $Id: rastpos.c,v 1.4 1999/11/11 01:22:27 brianp Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
* Version: 3.1
* Version: 3.3
* *
* Copyright (C) 1999 Brian Paul All Rights Reserved. * Copyright (C) 1999 Brian Paul All Rights Reserved.
* *
*/ */







#ifdef PC_HEADER #ifdef PC_HEADER
#include "all.h" #include "all.h"
#else #else
#ifndef XFree86Server
#include <assert.h>
#include <math.h>
#else
#include "GL/xf86glx.h"
#endif
#include "glheader.h"
#include "clip.h" #include "clip.h"
#include "context.h" #include "context.h"
#include "feedback.h" #include "feedback.h"
/* /*
* Caller: context->API.RasterPos4f * Caller: context->API.RasterPos4f
*/ */
void gl_RasterPos4f( GLcontext *ctx,
GLfloat x, GLfloat y, GLfloat z, GLfloat w )
static void raster_pos4f( GLcontext *ctx,
GLfloat x, GLfloat y, GLfloat z, GLfloat w )
{ {
GLfloat v[4], eye[4], clip[4], ndc[3], d; GLfloat v[4], eye[4], clip[4], ndc[3], d;








/*
* This is a MESA extension function. Pretty much just like glRasterPos
* except we don't apply the modelview or projection matrices; specify a
* window coordinate directly.
* Caller: context->API.WindowPos4fMESA pointer.
*/
void gl_windowpos( GLcontext *ctx, GLfloat x, GLfloat y, GLfloat z, GLfloat w )
void
_mesa_RasterPos2d(GLdouble x, GLdouble y)
{ {
/* KW: Assume that like rasterpos, this must be outside begin/end.
*/
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx, "glWindowPosMESA" );
_mesa_RasterPos4f(x, y, 0.0F, 1.0F);
}


/* set raster position */
ctx->Current.RasterPos[0] = x;
ctx->Current.RasterPos[1] = y;
ctx->Current.RasterPos[2] = CLAMP( z, 0.0F, 1.0F );
ctx->Current.RasterPos[3] = w;
void
_mesa_RasterPos2f(GLfloat x, GLfloat y)
{
_mesa_RasterPos4f(x, y, 0.0F, 1.0F);
}


ctx->Current.RasterPosValid = GL_TRUE;
void
_mesa_RasterPos2i(GLint x, GLint y)
{
_mesa_RasterPos4f(x, y, 0.0F, 1.0F);
}


/* raster color */
if (0 && ctx->Light.Enabled) {

/* KW: I don't see how this can work - would have to take the
* inverse of the projection matrix or the combined
* modelProjection matrix, transform point and normal, and
* do the lighting. Those inverses are not used for
* anything else. This is not an object-space lighting
* issue - what this is trying to do is something like
* clip-space or window-space lighting...
*
* Anyway, since the implementation was never correct, I'm
* not fixing it now - just use the unlit color.
*/

/* KW: As a reprise, we now *do* keep the inverse of the projection
* matrix, so it is not infeasible to try to swim up stream
* in this manner. I still don't want to implement it,
* however.
*/
}
else {
/* use current color or index */
if (ctx->Visual->RGBAflag) {
UBYTE_RGBA_TO_FLOAT_RGBA(ctx->Current.RasterColor,
ctx->Current.ByteColor);
}
else {
ctx->Current.RasterIndex = ctx->Current.Index;
}
}
void
_mesa_RasterPos2s(GLshort x, GLshort y)
{
_mesa_RasterPos4f(x, y, 0.0F, 1.0F);
}


ctx->Current.RasterDistance = 0.0;
void
_mesa_RasterPos3d(GLdouble x, GLdouble y, GLdouble z)
{
_mesa_RasterPos4f(x, y, z, 1.0F);
}


{
GLuint texSet;
for (texSet=0; texSet<MAX_TEXTURE_UNITS; texSet++) {
COPY_4FV( ctx->Current.RasterMultiTexCoord[texSet],
ctx->Current.Texcoord[texSet] );
}
}
void
_mesa_RasterPos3f(GLfloat x, GLfloat y, GLfloat z)
{
_mesa_RasterPos4f(x, y, z, 1.0F);
}


if (ctx->RenderMode==GL_SELECT) {
gl_update_hitflag( ctx, ctx->Current.RasterPos[2] );
}
void
_mesa_RasterPos3i(GLint x, GLint y, GLint z)
{
_mesa_RasterPos4f(x, y, z, 1.0F);
}

void
_mesa_RasterPos3s(GLshort x, GLshort y, GLshort z)
{
_mesa_RasterPos4f(x, y, z, 1.0F);
}

void
_mesa_RasterPos4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w)
{
_mesa_RasterPos4f(x, y, z, w);
}

void
_mesa_RasterPos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
{
GET_CURRENT_CONTEXT(ctx);
raster_pos4f(ctx, x, y, z, w);
}

void
_mesa_RasterPos4i(GLint x, GLint y, GLint z, GLint w)
{
_mesa_RasterPos4f(x, y, z, w);
}

void
_mesa_RasterPos4s(GLshort x, GLshort y, GLshort z, GLshort w)
{
_mesa_RasterPos4f(x, y, z, w);
}

void
_mesa_RasterPos2dv(const GLdouble *v)
{
_mesa_RasterPos4f(v[0], v[1], 0.0F, 1.0F);
}

void
_mesa_RasterPos2fv(const GLfloat *v)
{
_mesa_RasterPos4f(v[0], v[1], 0.0F, 1.0F);
}

void
_mesa_RasterPos2iv(const GLint *v)
{
_mesa_RasterPos4f(v[0], v[1], 0.0F, 1.0F);
}

void
_mesa_RasterPos2sv(const GLshort *v)
{
_mesa_RasterPos4f(v[0], v[1], 0.0F, 1.0F);
}

void
_mesa_RasterPos3dv(const GLdouble *v)
{
_mesa_RasterPos4f(v[0], v[1], v[2], 1.0F);
}

void
_mesa_RasterPos3fv(const GLfloat *v)
{
_mesa_RasterPos4f(v[0], v[1], v[2], 1.0F);
}

void
_mesa_RasterPos3iv(const GLint *v)
{
_mesa_RasterPos4f(v[0], v[1], v[2], 1.0F);
}

void
_mesa_RasterPos3sv(const GLshort *v)
{
_mesa_RasterPos4f(v[0], v[1], v[2], 1.0F);
}

void
_mesa_RasterPos4dv(const GLdouble *v)
{
_mesa_RasterPos4f(v[0], v[1], v[2], v[3]);
}

void
_mesa_RasterPos4fv(const GLfloat *v)
{
_mesa_RasterPos4f(v[0], v[1], v[2], v[3]);
}

void
_mesa_RasterPos4iv(const GLint *v)
{
_mesa_RasterPos4f(v[0], v[1], v[2], v[3]);
}

void
_mesa_RasterPos4sv(const GLshort *v)
{
_mesa_RasterPos4f(v[0], v[1], v[2], v[3]);
} }

+ 70
- 9
src/mesa/main/rastpos.h View File

/* $Id: rastpos.h,v 1.1 1999/08/19 00:55:41 jtg Exp $ */
/* $Id: rastpos.h,v 1.2 1999/11/11 01:22:27 brianp Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
* Version: 3.1
* Version: 3.3
* *
* Copyright (C) 1999 Brian Paul All Rights Reserved. * Copyright (C) 1999 Brian Paul All Rights Reserved.
* *
*/ */




#ifndef RASTPOS_H
#define RASTPOS_H




#include "glheader.h"


#ifndef RASTPOS_H
#define RASTPOS_H


extern void
_mesa_RasterPos2d(GLdouble x, GLdouble y);

extern void
_mesa_RasterPos2f(GLfloat x, GLfloat y);

extern void
_mesa_RasterPos2i(GLint x, GLint y);

extern void
_mesa_RasterPos2s(GLshort x, GLshort y);

extern void
_mesa_RasterPos3d(GLdouble x, GLdouble y, GLdouble z);

extern void
_mesa_RasterPos3f(GLfloat x, GLfloat y, GLfloat z);

extern void
_mesa_RasterPos3i(GLint x, GLint y, GLint z);

extern void
_mesa_RasterPos3s(GLshort x, GLshort y, GLshort z);

extern void
_mesa_RasterPos4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w);

extern void
_mesa_RasterPos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w);

extern void
_mesa_RasterPos4i(GLint x, GLint y, GLint z, GLint w);

extern void
_mesa_RasterPos4s(GLshort x, GLshort y, GLshort z, GLshort w);

extern void
_mesa_RasterPos2dv(const GLdouble *v);

extern void
_mesa_RasterPos2fv(const GLfloat *v);

extern void
_mesa_RasterPos2iv(const GLint *v);

extern void
_mesa_RasterPos2sv(const GLshort *v);

extern void
_mesa_RasterPos3dv(const GLdouble *v);

extern void
_mesa_RasterPos3fv(const GLfloat *v);


#include "types.h"
extern void
_mesa_RasterPos3iv(const GLint *v);


extern void
_mesa_RasterPos3sv(const GLshort *v);


extern void gl_RasterPos4f( GLcontext *ctx,
GLfloat x, GLfloat y, GLfloat z, GLfloat w );
extern void
_mesa_RasterPos4dv(const GLdouble *v);


extern void
_mesa_RasterPos4fv(const GLfloat *v);


extern void gl_windowpos( GLcontext *ctx,
GLfloat x, GLfloat y, GLfloat z, GLfloat w );
extern void
_mesa_RasterPos4iv(const GLint *v);


extern void
_mesa_RasterPos4sv(const GLshort *v);




#endif #endif

+ 17
- 16
src/mesa/main/stencil.c View File

/* $Id: stencil.c,v 1.8 1999/11/08 15:28:08 brianp Exp $ */
/* $Id: stencil.c,v 1.9 1999/11/11 01:22:27 brianp Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
* Version: 3.1
* Version: 3.3
* *
* Copyright (C) 1999 Brian Paul All Rights Reserved. * Copyright (C) 1999 Brian Paul All Rights Reserved.
* *
*/ */




/* $XFree86: xc/lib/GL/mesa/src/stencil.c,v 1.3 1999/04/04 00:20:32 dawes Exp $ */

#ifdef PC_HEADER #ifdef PC_HEADER
#include "all.h" #include "all.h"
#else #else
#ifndef XFree86Server
#include <stdlib.h>
#include <string.h>
#else
#include "GL/xf86glx.h"
#endif
#include "glheader.h"
#include "context.h" #include "context.h"
#include "macros.h"
#include "mem.h"
#include "pb.h" #include "pb.h"
#include "stencil.h" #include "stencil.h"
#include "types.h" #include "types.h"
#define STENCIL_ADDRESS(X,Y) (ctx->Buffer->Stencil + ctx->Buffer->Width * (Y) + (X)) #define STENCIL_ADDRESS(X,Y) (ctx->Buffer->Stencil + ctx->Buffer->Width * (Y) + (X))




void gl_ClearStencil( GLcontext *ctx, GLint s )
void
_mesa_ClearStencil( GLint s )
{ {
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glClearStencil"); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glClearStencil");
ctx->Stencil.Clear = (GLstencil) s; ctx->Stencil.Clear = (GLstencil) s;








void gl_StencilFunc( GLcontext *ctx, GLenum func, GLint ref, GLuint mask )
void
_mesa_StencilFunc( GLenum func, GLint ref, GLuint mask )
{ {
GET_CURRENT_CONTEXT(ctx);
GLint maxref; GLint maxref;


ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glStencilFunc"); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glStencilFunc");






void gl_StencilMask( GLcontext *ctx, GLuint mask )
void
_mesa_StencilMask( GLuint mask )
{ {
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glStencilMask"); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glStencilMask");
ctx->Stencil.WriteMask = (GLstencil) mask; ctx->Stencil.WriteMask = (GLstencil) mask;








void gl_StencilOp( GLcontext *ctx, GLenum fail, GLenum zfail, GLenum zpass )
void
_mesa_StencilOp( GLenum fail, GLenum zfail, GLenum zpass )
{ {
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glStencilOp"); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glStencilOp");
switch (fail) { switch (fail) {
case GL_KEEP: case GL_KEEP:
ctx->Buffer->Stencil = (GLstencil *) MALLOC(buffersize * sizeof(GLstencil)); ctx->Buffer->Stencil = (GLstencil *) MALLOC(buffersize * sizeof(GLstencil));
if (!ctx->Buffer->Stencil) { if (!ctx->Buffer->Stencil) {
/* out of memory */ /* out of memory */
gl_set_enable( ctx, GL_STENCIL_TEST, GL_FALSE );
_mesa_set_enable( ctx, GL_STENCIL_TEST, GL_FALSE );
gl_error( ctx, GL_OUT_OF_MEMORY, "gl_alloc_stencil_buffer" ); gl_error( ctx, GL_OUT_OF_MEMORY, "gl_alloc_stencil_buffer" );
} }
} }

+ 10
- 11
src/mesa/main/stencil.h View File

/* $Id: stencil.h,v 1.1 1999/08/19 00:55:41 jtg Exp $ */
/* $Id: stencil.h,v 1.2 1999/11/11 01:22:27 brianp Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
* Version: 3.1
* Version: 3.3
* *
* Copyright (C) 1999 Brian Paul All Rights Reserved. * Copyright (C) 1999 Brian Paul All Rights Reserved.
* *
*/ */







#ifndef STENCIL_H #ifndef STENCIL_H
#define STENCIL_H #define STENCIL_H


#include "types.h" #include "types.h"




extern void gl_ClearStencil( GLcontext *ctx, GLint s );
extern void
_mesa_ClearStencil( GLint s );




extern void gl_StencilFunc( GLcontext *ctx, GLenum func,
GLint ref, GLuint mask );
extern void
_mesa_StencilFunc( GLenum func, GLint ref, GLuint mask );




extern void gl_StencilMask( GLcontext *ctx, GLuint mask );
extern void
_mesa_StencilMask( GLuint mask );




extern void gl_StencilOp( GLcontext *ctx, GLenum fail,
GLenum zfail, GLenum zpass );
extern void
_mesa_StencilOp( GLenum fail, GLenum zfail, GLenum zpass );







+ 91
- 90
src/mesa/main/teximage.c View File

/* $Id: teximage.c,v 1.11 1999/11/08 07:36:44 brianp Exp $ */
/* $Id: teximage.c,v 1.12 1999/11/11 01:22:27 brianp Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
* Version: 3.1
* Version: 3.3
* *
* Copyright (C) 1999 Brian Paul All Rights Reserved. * Copyright (C) 1999 Brian Paul All Rights Reserved.
* *
#ifdef PC_HEADER #ifdef PC_HEADER
#include "all.h" #include "all.h"
#else #else
#ifndef XFree86Server
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#else
#include "GL/xf86glx.h"
#endif
#include "glheader.h"
#include "context.h" #include "context.h"
#include "image.h" #include "image.h"
#include "macros.h"
#include "mem.h"
#include "mmath.h" #include "mmath.h"
#include "span.h" #include "span.h"
#include "teximage.h" #include "teximage.h"






static struct gl_pixelstore_attrib defaultPacking = {
1, /* Alignment */
0, /* RowLength */
0, /* SkipPixels */
0, /* SkipRows */
0, /* ImageHeight */
0, /* SkipImages */
GL_FALSE, /* SwapBytes */
GL_FALSE /* LsbFirst */
};



/* /*
* Compute log base 2 of n. * Compute log base 2 of n.
* If n isn't an exact power of two return -1. * If n isn't an exact power of two return -1.
* If n<0 return -1. * If n<0 return -1.
*/ */
static int logbase2( int n )
static int
logbase2( int n )
{ {
GLint i = 1; GLint i = 1;
GLint log2 = 0; GLint log2 = 0;
* GL_LUMANCE_ALPHA, GL_INTENSITY, GL_RGB, or GL_RGBA. * GL_LUMANCE_ALPHA, GL_INTENSITY, GL_RGB, or GL_RGBA.
* Return -1 if invalid enum. * Return -1 if invalid enum.
*/ */
static GLint decode_internal_format( GLint format )
static GLint
decode_internal_format( GLint format )
{ {
switch (format) { switch (format) {
case GL_ALPHA: case GL_ALPHA:
* GL_LUMANCE_ALPHA, GL_INTENSITY, GL_RGB, or GL_RGBA. Return the * GL_LUMANCE_ALPHA, GL_INTENSITY, GL_RGB, or GL_RGBA. Return the
* number of components for the format. Return -1 if invalid enum. * number of components for the format. Return -1 if invalid enum.
*/ */
static GLint components_in_intformat( GLint format )
static GLint
components_in_intformat( GLint format )
{ {
switch (format) { switch (format) {
case GL_ALPHA: case GL_ALPHA:






struct gl_texture_image *gl_alloc_texture_image( void )
struct gl_texture_image *
gl_alloc_texture_image( void )
{ {
return CALLOC_STRUCT(gl_texture_image); return CALLOC_STRUCT(gl_texture_image);
} }






void gl_free_texture_image( struct gl_texture_image *teximage )
void
gl_free_texture_image( struct gl_texture_image *teximage )
{ {
if (teximage->Data) { if (teximage->Data) {
FREE( teximage->Data ); FREE( teximage->Data );
* These fields are set only here by core Mesa but device drivers may * These fields are set only here by core Mesa but device drivers may
* overwritting these fields to indicate true texel resolution. * overwritting these fields to indicate true texel resolution.
*/ */
static void set_teximage_component_sizes( struct gl_texture_image *texImage )
static void
set_teximage_component_sizes( struct gl_texture_image *texImage )
{ {
switch (texImage->Format) { switch (texImage->Format) {
case GL_ALPHA: case GL_ALPHA:
* Return: GL_TRUE = an error was detected, GL_FALSE = no errors * Return: GL_TRUE = an error was detected, GL_FALSE = no errors
*/ */
static GLboolean static GLboolean
subtexture_error_check( GLcontext *ctx, GLint dimensions,
subtexture_error_check( GLcontext *ctx, GLuint dimensions,
GLenum target, GLint level, GLenum target, GLint level,
GLint xoffset, GLint yoffset, GLint zoffset, GLint xoffset, GLint yoffset, GLint zoffset,
GLint width, GLint height, GLint depth, GLint width, GLint height, GLint depth,
* Return: GL_TRUE = an error was detected, GL_FALSE = no errors * Return: GL_TRUE = an error was detected, GL_FALSE = no errors
*/ */
static GLboolean static GLboolean
copytexture_error_check( GLcontext *ctx, GLint dimensions,
copytexture_error_check( GLcontext *ctx, GLuint dimensions,
GLenum target, GLint level, GLint internalFormat, GLenum target, GLint level, GLint internalFormat,
GLint width, GLint height, GLint border ) GLint width, GLint height, GLint border )
{ {




static GLboolean static GLboolean
copytexsubimage_error_check( GLcontext *ctx, GLint dimensions,
copytexsubimage_error_check( GLcontext *ctx, GLuint dimensions,
GLenum target, GLint level, GLenum target, GLint level,
GLint xoffset, GLint yoffset, GLint zoffset, GLint xoffset, GLint yoffset, GLint zoffset,
GLsizei width, GLsizei height ) GLsizei width, GLsizei height )
return GL_TRUE; return GL_TRUE;
} }


teximage = texUnit->CurrentD[dimensions]->Image[level];
teximage = texUnit->CurrentD[3]->Image[level];
if (!teximage) { if (!teximage) {
char message[100]; char message[100];
sprintf(message, "glCopyTexSubImage%dD(undefined texture)", dimensions); sprintf(message, "glCopyTexSubImage%dD(undefined texture)", dimensions);
/* /*
* Called from the API. Note that width includes the border. * Called from the API. Note that width includes the border.
*/ */
void gl_TexImage1D( GLcontext *ctx, GLenum target, GLint level,
GLint internalformat,
GLsizei width, GLint border, GLenum format,
GLenum type, const GLvoid *pixels )
void
_mesa_TexImage1D( GLenum target, GLint level, GLint internalformat,
GLsizei width, GLint border, GLenum format,
GLenum type, const GLvoid *pixels )
{ {
GET_CURRENT_CONTEXT(ctx);
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glTexImage1D"); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glTexImage1D");


} }




void gl_TexImage2D( GLcontext *ctx, GLenum target, GLint level,
GLint internalformat,
GLsizei width, GLsizei height, GLint border,
GLenum format, GLenum type,
const GLvoid *pixels )
void
_mesa_TexImage2D( GLenum target, GLint level, GLint internalformat,
GLsizei width, GLsizei height, GLint border,
GLenum format, GLenum type,
const GLvoid *pixels )
{ {
GET_CURRENT_CONTEXT(ctx);
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glTexImage2D"); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glTexImage2D");


* Called by the API or display list executor. * Called by the API or display list executor.
* Note that width and height include the border. * Note that width and height include the border.
*/ */
void gl_TexImage3D( GLcontext *ctx, GLenum target, GLint level,
GLint internalformat,
GLsizei width, GLsizei height, GLsizei depth,
GLint border, GLenum format, GLenum type,
const GLvoid *pixels )
void
_mesa_TexImage3D( GLenum target, GLint level, GLint internalformat,
GLsizei width, GLsizei height, GLsizei depth,
GLint border, GLenum format, GLenum type,
const GLvoid *pixels )
{ {
GET_CURRENT_CONTEXT(ctx);
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glTexImage3D");
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glTexImage3DEXT");


if (target==GL_TEXTURE_3D) {
if (target==GL_TEXTURE_3D_EXT) {
struct gl_texture_image *teximage; struct gl_texture_image *teximage;
if (texture_error_check( ctx, target, level, internalformat, if (texture_error_check( ctx, target, level, internalformat,
format, type, 3, width, height, depth, format, type, 3, width, height, depth,






void gl_GetTexImage( GLcontext *ctx, GLenum target, GLint level, GLenum format,
GLenum type, GLvoid *pixels )
void
_mesa_GetTexImage( GLenum target, GLint level, GLenum format,
GLenum type, GLvoid *pixels )
{ {
GET_CURRENT_CONTEXT(ctx);
const struct gl_texture_object *texObj; const struct gl_texture_object *texObj;


ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetTexImage"); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetTexImage");






void gl_TexSubImage1D( GLcontext *ctx, GLenum target, GLint level,
GLint xoffset, GLsizei width,
GLenum format, GLenum type,
const GLvoid *pixels )
void
_mesa_TexSubImage1D( GLenum target, GLint level,
GLint xoffset, GLsizei width,
GLenum format, GLenum type,
const GLvoid *pixels )
{ {
GET_CURRENT_CONTEXT(ctx);
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
struct gl_texture_image *destTex; struct gl_texture_image *destTex;


} }




void gl_TexSubImage2D( GLcontext *ctx, GLenum target, GLint level,
GLint xoffset, GLint yoffset,
GLsizei width, GLsizei height,
GLenum format, GLenum type,
const GLvoid *pixels )
void
_mesa_TexSubImage2D( GLenum target, GLint level,
GLint xoffset, GLint yoffset,
GLsizei width, GLsizei height,
GLenum format, GLenum type,
const GLvoid *pixels )
{ {
GET_CURRENT_CONTEXT(ctx);
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
struct gl_texture_image *destTex; struct gl_texture_image *destTex;








void gl_TexSubImage3D( GLcontext *ctx, GLenum target, GLint level,
GLint xoffset, GLint yoffset, GLint zoffset,
GLsizei width, GLsizei height, GLsizei depth,
GLenum format, GLenum type,
const GLvoid *pixels )
void
_mesa_TexSubImage3D( GLenum target, GLint level,
GLint xoffset, GLint yoffset, GLint zoffset,
GLsizei width, GLsizei height, GLsizei depth,
GLenum format, GLenum type,
const GLvoid *pixels )
{ {
GET_CURRENT_CONTEXT(ctx);
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
struct gl_texture_image *destTex; struct gl_texture_image *destTex;








void gl_CopyTexImage1D( GLcontext *ctx, GLenum target, GLint level,
GLenum internalFormat,
GLint x, GLint y,
GLsizei width, GLint border )
void
_mesa_CopyTexImage1D( GLenum target, GLint level,
GLenum internalFormat,
GLint x, GLint y,
GLsizei width, GLint border )
{ {
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glCopyTexImage1D"); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glCopyTexImage1D");


if (!copytexture_error_check(ctx, 1, target, level, internalFormat, if (!copytexture_error_check(ctx, 1, target, level, internalFormat,
gl_error( ctx, GL_OUT_OF_MEMORY, "glCopyTexImage1D" ); gl_error( ctx, GL_OUT_OF_MEMORY, "glCopyTexImage1D" );
return; return;
} }
(*ctx->Exec.TexImage1D)( ctx, target, level, internalFormat, width,
border, GL_RGBA, GL_UNSIGNED_BYTE, image );
(*ctx->Exec.TexImage1D)( target, level, internalFormat, width,
border, GL_RGBA, GL_UNSIGNED_BYTE, image );
FREE(image); FREE(image);
} }
} }






void gl_CopyTexImage2D( GLcontext *ctx, GLenum target, GLint level,
GLenum internalFormat,
GLint x, GLint y, GLsizei width, GLsizei height,
GLint border )
void
_mesa_CopyTexImage2D( GLenum target, GLint level, GLenum internalFormat,
GLint x, GLint y, GLsizei width, GLsizei height,
GLint border )
{ {
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glCopyTexImage2D"); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glCopyTexImage2D");


if (!copytexture_error_check(ctx, 2, target, level, internalFormat, if (!copytexture_error_check(ctx, 2, target, level, internalFormat,
gl_error( ctx, GL_OUT_OF_MEMORY, "glCopyTexImage2D" ); gl_error( ctx, GL_OUT_OF_MEMORY, "glCopyTexImage2D" );
return; return;
} }
{
struct gl_pixelstore_attrib save = ctx->Unpack;
ctx->Unpack = defaultPacking;
(ctx->Exec.TexImage2D)( ctx, target, level, internalFormat, width,
(ctx->Exec.TexImage2D)( target, level, internalFormat, width,
height, border, GL_RGBA, GL_UNSIGNED_BYTE, image ); height, border, GL_RGBA, GL_UNSIGNED_BYTE, image );
ctx->Unpack = save; /* restore */
}
FREE(image); FREE(image);
} }
} }






void gl_CopyTexSubImage1D( GLcontext *ctx, GLenum target, GLint level,
GLint xoffset, GLint x, GLint y, GLsizei width )
void
_mesa_CopyTexSubImage1D( GLenum target, GLint level,
GLint xoffset, GLint x, GLint y, GLsizei width )
{ {
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glCopyTexSubImage1D"); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glCopyTexSubImage1D");


if (!copytexsubimage_error_check(ctx, 1, target, level, if (!copytexsubimage_error_check(ctx, 1, target, level,






void gl_CopyTexSubImage2D( GLcontext *ctx, GLenum target, GLint level,
GLint xoffset, GLint yoffset,
GLint x, GLint y, GLsizei width, GLsizei height )
void
_mesa_CopyTexSubImage2D( GLenum target, GLint level,
GLint xoffset, GLint yoffset,
GLint x, GLint y, GLsizei width, GLsizei height )
{ {
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glCopyTexSubImage2D"); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glCopyTexSubImage2D");


if (!copytexsubimage_error_check(ctx, 2, target, level, if (!copytexsubimage_error_check(ctx, 2, target, level,






void gl_CopyTexSubImage3D( GLcontext *ctx, GLenum target, GLint level,
GLint xoffset, GLint yoffset, GLint zoffset,
GLint x, GLint y, GLsizei width, GLsizei height )
void
_mesa_CopyTexSubImage3D( GLenum target, GLint level,
GLint xoffset, GLint yoffset, GLint zoffset,
GLint x, GLint y, GLsizei width, GLsizei height )
{ {
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glCopyTexSubImage3D"); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glCopyTexSubImage3D");


if (!copytexsubimage_error_check(ctx, 3, target, level, if (!copytexsubimage_error_check(ctx, 3, target, level,

+ 57
- 64
src/mesa/main/teximage.h View File

/* $Id: teximage.h,v 1.2 1999/11/03 17:27:05 brianp Exp $ */
/* $Id: teximage.h,v 1.3 1999/11/11 01:22:28 brianp Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
* Version: 3.1
* Version: 3.3
* *
* Copyright (C) 1999 Brian Paul All Rights Reserved. * Copyright (C) 1999 Brian Paul All Rights Reserved.
* *
/*** Internal functions ***/ /*** Internal functions ***/




extern struct gl_texture_image *gl_alloc_texture_image( void );
extern struct gl_texture_image *
gl_alloc_texture_image( void );




extern void gl_free_texture_image( struct gl_texture_image *teximage );
extern void
gl_free_texture_image( struct gl_texture_image *teximage );






/*** API entry point functions ***/


/*** API entry points ***/


extern void
_mesa_TexImage1D( GLenum target, GLint level, GLint internalformat,
GLsizei width, GLint border,
GLenum format, GLenum type, const GLvoid *pixels );


extern void gl_TexImage1D( GLcontext *ctx,
GLenum target, GLint level, GLint internalformat,
GLsizei width, GLint border, GLenum format,
GLenum type, const GLvoid *pixels );


extern void
_mesa_TexImage2D( GLenum target, GLint level, GLint internalformat,
GLsizei width, GLsizei height, GLint border,
GLenum format, GLenum type, const GLvoid *pixels );


extern void gl_TexImage2D( GLcontext *ctx,
GLenum target, GLint level, GLint internalformat,
GLsizei width, GLsizei height, GLint border,
GLenum format, GLenum type,
const GLvoid *pixels );


extern void
_mesa_TexImage3D( GLenum target, GLint level, GLint internalformat,
GLsizei width, GLsizei height, GLsizei depth, GLint border,
GLenum format, GLenum type, const GLvoid *pixels );


extern void gl_TexImage3D( GLcontext *ctx,
GLenum target, GLint level, GLint internalformat,
GLsizei width, GLsizei height, GLsizei depth,
GLint border, GLenum format, GLenum type,
const GLvoid *pixels );


extern void
_mesa_GetTexImage( GLenum target, GLint level,
GLenum format, GLenum type, GLvoid *pixels );


extern void gl_GetTexImage( GLcontext *ctx, GLenum target, GLint level,
GLenum format, GLenum type, GLvoid *pixels );


extern void
_mesa_TexSubImage1D( GLenum target, GLint level, GLint xoffset,
GLsizei width,
GLenum format, GLenum type,
const GLvoid *pixels );




extern void gl_TexSubImage1D( GLcontext *ctx,
GLenum target, GLint level, GLint xoffset,
GLsizei width, GLenum format, GLenum type,
const GLvoid *pixels );
extern void
_mesa_TexSubImage2D( GLenum target, GLint level,
GLint xoffset, GLint yoffset,
GLsizei width, GLsizei height,
GLenum format, GLenum type,
const GLvoid *pixels );




extern void gl_TexSubImage2D( GLcontext *ctx,
GLenum target, GLint level,
GLint xoffset, GLint yoffset,
GLsizei width, GLsizei height,
GLenum format, GLenum type,
const GLvoid *pixels );
extern void
_mesa_TexSubImage3D( GLenum target, GLint level,
GLint xoffset, GLint yoffset, GLint zoffset,
GLsizei width, GLsizei height, GLsizei depth,
GLenum format, GLenum type,
const GLvoid *pixels );




extern void gl_TexSubImage3D( GLcontext *ctx,
GLenum target, GLint level,
GLint xoffset, GLint yoffset, GLint zoffset,
GLsizei width, GLsizei height, GLsizei depth,
GLenum format, GLenum type,
const GLvoid *pixels );
extern void
_mesa_CopyTexImage1D( GLenum target, GLint level, GLenum internalformat,
GLint x, GLint y, GLsizei width, GLint border );




extern void gl_CopyTexImage1D( GLcontext *ctx,
GLenum target, GLint level,
GLenum internalformat,
GLint x, GLint y,
GLsizei width, GLint border );
extern void
_mesa_CopyTexImage2D( GLenum target, GLint level,
GLenum internalformat, GLint x, GLint y,
GLsizei width, GLsizei height, GLint border );




extern void gl_CopyTexImage2D( GLcontext *ctx,
GLenum target, GLint level,
GLenum internalformat, GLint x, GLint y,
GLsizei width, GLsizei height,
GLint border );
extern void
_mesa_CopyTexSubImage1D( GLenum target, GLint level, GLint xoffset,
GLint x, GLint y, GLsizei width );




extern void gl_CopyTexSubImage1D( GLcontext *ctx,
GLenum target, GLint level,
GLint xoffset, GLint x, GLint y,
GLsizei width );
extern void
_mesa_CopyTexSubImage2D( GLenum target, GLint level,
GLint xoffset, GLint yoffset,
GLint x, GLint y, GLsizei width, GLsizei height );




extern void gl_CopyTexSubImage2D( GLcontext *ctx,
GLenum target, GLint level,
GLint xoffset, GLint yoffset,
GLint x, GLint y,
GLsizei width, GLsizei height );


extern void gl_CopyTexSubImage3D( GLcontext *ctx,
GLenum target, GLint level,
GLint xoffset, GLint yoffset,
GLint zoffset,
GLint x, GLint y,
GLsizei width, GLsizei height );
extern void
_mesa_CopyTexSubImage3D( GLenum target, GLint level,
GLint xoffset, GLint yoffset, GLint zoffset,
GLint x, GLint y, GLsizei width, GLsizei height );


#endif #endif



+ 31
- 30
src/mesa/main/texobj.c View File

/* $Id: texobj.c,v 1.7 1999/11/05 06:43:11 brianp Exp $ */
/* $Id: texobj.c,v 1.8 1999/11/11 01:22:28 brianp Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
* Version: 3.1
* Version: 3.3
* *
* Copyright (C) 1999 Brian Paul All Rights Reserved. * Copyright (C) 1999 Brian Paul All Rights Reserved.
* *
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
/* $XFree86: xc/lib/GL/mesa/src/texobj.c,v 1.3 1999/04/04 00:20:32 dawes Exp $ */






#ifdef PC_HEADER #ifdef PC_HEADER
#include "all.h" #include "all.h"
#else #else
#ifndef XFree86Server
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#else
#include "GL/xf86glx.h"
#endif
#include "glheader.h"
#include "context.h" #include "context.h"
#include "enums.h" #include "enums.h"
#include "hash.h" #include "hash.h"
#include "macros.h"
#include "mem.h"
#include "teximage.h" #include "teximage.h"
#include "texstate.h" #include "texstate.h"
#include "texobj.h" #include "texobj.h"
obj->BaseLevel = 0; obj->BaseLevel = 0;
obj->MaxLevel = 1000; obj->MaxLevel = 1000;
obj->MinMagThresh = 0.0F; obj->MinMagThresh = 0.0F;
obj->Palette[0] = 255;
obj->Palette[1] = 255;
obj->Palette[2] = 255;
obj->Palette[3] = 255;
obj->PaletteSize = 1;
obj->PaletteIntFormat = GL_RGBA;
obj->PaletteFormat = GL_RGBA;
obj->Palette.Table[0] = 255;
obj->Palette.Table[1] = 255;
obj->Palette.Table[2] = 255;
obj->Palette.Table[3] = 255;
obj->Palette.Size = 1;
obj->Palette.IntFormat = GL_RGBA;
obj->Palette.Format = GL_RGBA;


/* insert into linked list */ /* insert into linked list */
if (shared) { if (shared) {
/* /*
* Execute glGenTextures * Execute glGenTextures
*/ */
void gl_GenTextures( GLcontext *ctx, GLsizei n, GLuint *texName )
void
_mesa_GenTextures( GLsizei n, GLuint *texName )
{ {
GET_CURRENT_CONTEXT(ctx);
GLuint first; GLuint first;
GLint i; GLint i;


/* /*
* Execute glDeleteTextures * Execute glDeleteTextures
*/ */
void gl_DeleteTextures( GLcontext *ctx, GLsizei n, const GLuint *texName)
void
_mesa_DeleteTextures( GLsizei n, const GLuint *texName)
{ {
GET_CURRENT_CONTEXT(ctx);
GLint i; GLint i;


ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glDeleteTextures"); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glDeleteTextures");
/* /*
* Execute glBindTexture * Execute glBindTexture
*/ */
void gl_BindTexture( GLcontext *ctx, GLenum target, GLuint texName )
void
_mesa_BindTexture( GLenum target, GLuint texName )
{ {
GET_CURRENT_CONTEXT(ctx);
GLuint unit = ctx->Texture.CurrentUnit; GLuint unit = ctx->Texture.CurrentUnit;
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
struct gl_texture_object *oldTexObj; struct gl_texture_object *oldTexObj;
/* /*
* Execute glPrioritizeTextures * Execute glPrioritizeTextures
*/ */
void gl_PrioritizeTextures( GLcontext *ctx,
GLsizei n, const GLuint *texName,
const GLclampf *priorities )
void
_mesa_PrioritizeTextures( GLsizei n, const GLuint *texName,
const GLclampf *priorities )
{ {
GET_CURRENT_CONTEXT(ctx);
GLint i; GLint i;


ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPrioritizeTextures"); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPrioritizeTextures");
/* /*
* Execute glAreTexturesResident * Execute glAreTexturesResident
*/ */
GLboolean gl_AreTexturesResident( GLcontext *ctx, GLsizei n,
const GLuint *texName,
GLboolean *residences )
GLboolean
_mesa_AreTexturesResident( GLsizei n, const GLuint *texName,
GLboolean *residences )
{ {
GET_CURRENT_CONTEXT(ctx);
GLboolean resident = GL_TRUE; GLboolean resident = GL_TRUE;
GLint i; GLint i;


/* /*
* Execute glIsTexture * Execute glIsTexture
*/ */
GLboolean gl_IsTexture( GLcontext *ctx, GLuint texture )
GLboolean
_mesa_IsTexture( GLuint texture )
{ {
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, "glIsTextures", ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, "glIsTextures",
GL_FALSE); GL_FALSE);
if (texture>0 && HashLookup(ctx->Shared->TexObjects, texture)) { if (texture>0 && HashLookup(ctx->Shared->TexObjects, texture)) {

+ 16
- 16
src/mesa/main/texobj.h View File

/* $Id: texobj.h,v 1.1 1999/08/19 00:55:41 jtg Exp $ */
/* $Id: texobj.h,v 1.2 1999/11/11 01:22:28 brianp Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
* Version: 3.1
* Version: 3.3
* *
* Copyright (C) 1999 Brian Paul All Rights Reserved. * Copyright (C) 1999 Brian Paul All Rights Reserved.
* *
*/ */







#ifndef TEXTOBJ_H #ifndef TEXTOBJ_H
#define TEXTOBJ_H #define TEXTOBJ_H


* API functions * API functions
*/ */


extern void gl_GenTextures( GLcontext *ctx, GLsizei n, GLuint *textures );
extern void
_mesa_GenTextures( GLsizei n, GLuint *textures );




extern void gl_DeleteTextures( GLcontext *ctx,
GLsizei n, const GLuint *textures);
extern void
_mesa_DeleteTextures( GLsizei n, const GLuint *textures );




extern void gl_BindTexture( GLcontext *ctx, GLenum target, GLuint texture );
extern void
_mesa_BindTexture( GLenum target, GLuint texture );




extern void gl_PrioritizeTextures( GLcontext *ctx,
GLsizei n, const GLuint *textures,
const GLclampf *priorities );
extern void
_mesa_PrioritizeTextures( GLsizei n, const GLuint *textures,
const GLclampf *priorities );




extern GLboolean gl_AreTexturesResident( GLcontext *ctx, GLsizei n,
const GLuint *textures,
GLboolean *residences );
extern GLboolean
_mesa_AreTexturesResident( GLsizei n, const GLuint *textures,
GLboolean *residences );




extern GLboolean gl_IsTexture( GLcontext *ctx, GLuint texture );
extern GLboolean
_mesa_IsTexture( GLuint texture );




#endif #endif

+ 150
- 42
src/mesa/main/texstate.c View File

/* $Id: texstate.c,v 1.4 1999/11/05 06:43:11 brianp Exp $ */
/* $Id: texstate.c,v 1.5 1999/11/11 01:22:28 brianp Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
* Version: 3.1
* Version: 3.3
* *
* Copyright (C) 1999 Brian Paul All Rights Reserved. * Copyright (C) 1999 Brian Paul All Rights Reserved.
* *
*/ */





#ifdef PC_HEADER #ifdef PC_HEADER
#include "all.h" #include "all.h"
#else #else
#ifndef XFree86Server
#include <assert.h>
#include <stdio.h>
#else
#include "GL/xf86glx.h"
#endif
#include "glheader.h"
#include "context.h" #include "context.h"
#include "enums.h" #include "enums.h"
#include "macros.h" #include "macros.h"
/**********************************************************************/ /**********************************************************************/




void gl_TexEnvfv( GLcontext *ctx,
GLenum target, GLenum pname, const GLfloat *param )
void
_mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param )
{ {
GET_CURRENT_CONTEXT(ctx);
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];


ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glTexEnv"); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glTexEnv");
} }




void
_mesa_TexEnvf( GLenum target, GLenum pname, GLfloat param )
{
_mesa_TexEnvfv( target, pname, &param );
}



void
_mesa_TexEnvi( GLenum target, GLenum pname, GLint param )
{
GLfloat p[4];
p[0] = (GLfloat) param;
p[1] = p[2] = p[3] = 0.0;
_mesa_TexEnvfv( target, pname, p );
}



void
_mesa_TexEnviv( GLenum target, GLenum pname, const GLint *param )
{
GLfloat p[4];
p[0] = INT_TO_FLOAT( param[0] );
p[1] = INT_TO_FLOAT( param[1] );
p[2] = INT_TO_FLOAT( param[2] );
p[3] = INT_TO_FLOAT( param[3] );
_mesa_TexEnvfv( target, pname, p );
}




void gl_GetTexEnvfv( GLcontext *ctx,
GLenum target, GLenum pname, GLfloat *params )
void
_mesa_GetTexEnvfv( GLenum target, GLenum pname, GLfloat *params )
{ {
GET_CURRENT_CONTEXT(ctx);
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
if (target!=GL_TEXTURE_ENV) { if (target!=GL_TEXTURE_ENV) {
gl_error( ctx, GL_INVALID_ENUM, "glGetTexEnvfv(target)" ); gl_error( ctx, GL_INVALID_ENUM, "glGetTexEnvfv(target)" );
} }




void gl_GetTexEnviv( GLcontext *ctx,
GLenum target, GLenum pname, GLint *params )
void
_mesa_GetTexEnviv( GLenum target, GLenum pname, GLint *params )
{ {
GET_CURRENT_CONTEXT(ctx);
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
if (target!=GL_TEXTURE_ENV) { if (target!=GL_TEXTURE_ENV) {
gl_error( ctx, GL_INVALID_ENUM, "glGetTexEnviv(target)" ); gl_error( ctx, GL_INVALID_ENUM, "glGetTexEnviv(target)" );
/**********************************************************************/ /**********************************************************************/




void gl_TexParameterfv( GLcontext *ctx,
GLenum target, GLenum pname, const GLfloat *params )
void
_mesa_TexParameterf( GLenum target, GLenum pname, GLfloat param )
{
_mesa_TexParameterfv(target, pname, &param);
}


void
_mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params )
{ {
GET_CURRENT_CONTEXT(ctx);
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
GLenum eparam = (GLenum) (GLint) params[0]; GLenum eparam = (GLenum) (GLint) params[0];
struct gl_texture_object *texObj; struct gl_texture_object *texObj;
} }




void
_mesa_TexParameteri( GLenum target, GLenum pname, const GLint param )
{
GLfloat fparam[4];
fparam[0] = (GLfloat) param;
fparam[1] = fparam[2] = fparam[3] = 0.0;
_mesa_TexParameterfv(target, pname, fparam);
}

void
_mesa_TexParameteriv( GLenum target, GLenum pname, const GLint *params )
{
GLfloat fparam[4];
fparam[0] = (GLfloat) params[0];
fparam[1] = fparam[2] = fparam[3] = 0.0;
_mesa_TexParameterfv(target, pname, fparam);
}



void gl_GetTexLevelParameterfv( GLcontext *ctx, GLenum target, GLint level,
GLenum pname, GLfloat *params )
void
_mesa_GetTexLevelParameterfv( GLenum target, GLint level,
GLenum pname, GLfloat *params )
{ {
GLint iparam; GLint iparam;
gl_GetTexLevelParameteriv( ctx, target, level, pname, &iparam );
_mesa_GetTexLevelParameteriv( target, level, pname, &iparam );
*params = (GLfloat) iparam; *params = (GLfloat) iparam;
} }






void gl_GetTexLevelParameteriv( GLcontext *ctx, GLenum target, GLint level,
GLenum pname, GLint *params )
void
_mesa_GetTexLevelParameteriv( GLenum target, GLint level,
GLenum pname, GLint *params )
{ {
GET_CURRENT_CONTEXT(ctx);
const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
const struct gl_texture_image *img = NULL; const struct gl_texture_image *img = NULL;
GLuint dimensions; GLuint dimensions;







void gl_GetTexParameterfv( GLcontext *ctx,
GLenum target, GLenum pname, GLfloat *params )
void
_mesa_GetTexParameterfv( GLenum target, GLenum pname, GLfloat *params )
{ {
GET_CURRENT_CONTEXT(ctx);
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
struct gl_texture_object *obj; struct gl_texture_object *obj;


} }




void gl_GetTexParameteriv( GLcontext *ctx,
GLenum target, GLenum pname, GLint *params )
void
_mesa_GetTexParameteriv( GLenum target, GLenum pname, GLint *params )
{ {
GET_CURRENT_CONTEXT(ctx);
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
struct gl_texture_object *obj; struct gl_texture_object *obj;


/**********************************************************************/ /**********************************************************************/




void gl_TexGenfv( GLcontext *ctx,
GLenum coord, GLenum pname, const GLfloat *params )
void
_mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params )
{ {
GET_CURRENT_CONTEXT(ctx);
GLuint tUnit = ctx->Texture.CurrentTransformUnit; GLuint tUnit = ctx->Texture.CurrentTransformUnit;
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[tUnit]; struct gl_texture_unit *texUnit = &ctx->Texture.Unit[tUnit];
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glTexGenfv"); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glTexGenfv");
gl_lookup_enum_by_nr(pname), gl_lookup_enum_by_nr(pname),
*(int *)params); *(int *)params);


switch( coord ) {
switch (coord) {
case GL_S: case GL_S:
if (pname==GL_TEXTURE_GEN_MODE) { if (pname==GL_TEXTURE_GEN_MODE) {
GLenum mode = (GLenum) (GLint) *params; GLenum mode = (GLenum) (GLint) *params;
} }




void
_mesa_TexGeniv(GLenum coord, GLenum pname, const GLint *params )
{
GLfloat p[4];
p[0] = params[0];
p[1] = params[1];
p[2] = params[2];
p[3] = params[3];
_mesa_TexGenfv(coord, pname, p);
}


void
_mesa_TexGend(GLenum coord, GLenum pname, GLdouble param )
{
GLfloat p = (GLfloat) param;
_mesa_TexGenfv( coord, pname, &p );
}


void
_mesa_TexGendv(GLenum coord, GLenum pname, const GLdouble *params )
{
GLfloat p[4];
p[0] = params[0];
p[1] = params[1];
p[2] = params[2];
p[3] = params[3];
_mesa_TexGenfv( coord, pname, p );
}



void gl_GetTexGendv( GLcontext *ctx,
GLenum coord, GLenum pname, GLdouble *params )
void
_mesa_TexGenf( GLenum coord, GLenum pname, GLfloat param )
{ {
_mesa_TexGenfv(coord, pname, &param);
}


void
_mesa_TexGeni( GLenum coord, GLenum pname, GLint param )
{
_mesa_TexGeniv( coord, pname, &param );
}



void
_mesa_GetTexGendv( GLenum coord, GLenum pname, GLdouble *params )
{
GET_CURRENT_CONTEXT(ctx);
GLuint tUnit = ctx->Texture.CurrentTransformUnit; GLuint tUnit = ctx->Texture.CurrentTransformUnit;
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[tUnit]; struct gl_texture_unit *texUnit = &ctx->Texture.Unit[tUnit];








void gl_GetTexGenfv( GLcontext *ctx,
GLenum coord, GLenum pname, GLfloat *params )
void
_mesa_GetTexGenfv( GLenum coord, GLenum pname, GLfloat *params )
{ {
GET_CURRENT_CONTEXT(ctx);
GLuint tUnit = ctx->Texture.CurrentTransformUnit; GLuint tUnit = ctx->Texture.CurrentTransformUnit;
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[tUnit]; struct gl_texture_unit *texUnit = &ctx->Texture.Unit[tUnit];








void gl_GetTexGeniv( GLcontext *ctx,
GLenum coord, GLenum pname, GLint *params )
void
_mesa_GetTexGeniv( GLenum coord, GLenum pname, GLint *params )
{ {
GET_CURRENT_CONTEXT(ctx);
GLuint tUnit = ctx->Texture.CurrentTransformUnit; GLuint tUnit = ctx->Texture.CurrentTransformUnit;
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[tUnit]; struct gl_texture_unit *texUnit = &ctx->Texture.Unit[tUnit];


break; break;
case GL_T: case GL_T:
if (pname==GL_TEXTURE_GEN_MODE) { if (pname==GL_TEXTURE_GEN_MODE) {
params[0] = (GLint) texUnit->GenModeT;
params[0] = texUnit->GenModeT;
} }
else if (pname==GL_OBJECT_PLANE) { else if (pname==GL_OBJECT_PLANE) {
params[0] = (GLint) texUnit->ObjectPlaneT[0]; params[0] = (GLint) texUnit->ObjectPlaneT[0];
break; break;
case GL_R: case GL_R:
if (pname==GL_TEXTURE_GEN_MODE) { if (pname==GL_TEXTURE_GEN_MODE) {
params[0] = (GLint) texUnit->GenModeR;
params[0] = texUnit->GenModeR;
} }
else if (pname==GL_OBJECT_PLANE) { else if (pname==GL_OBJECT_PLANE) {
params[0] = (GLint) texUnit->ObjectPlaneR[0]; params[0] = (GLint) texUnit->ObjectPlaneR[0];
break; break;
case GL_Q: case GL_Q:
if (pname==GL_TEXTURE_GEN_MODE) { if (pname==GL_TEXTURE_GEN_MODE) {
params[0] = (GLint) texUnit->GenModeQ;
params[0] = texUnit->GenModeQ;
} }
else if (pname==GL_OBJECT_PLANE) { else if (pname==GL_OBJECT_PLANE) {
params[0] = (GLint) texUnit->ObjectPlaneQ[0]; params[0] = (GLint) texUnit->ObjectPlaneQ[0];
params[1] = (GLint) texUnit->EyePlaneQ[1]; params[1] = (GLint) texUnit->EyePlaneQ[1];
params[2] = (GLint) texUnit->EyePlaneQ[2]; params[2] = (GLint) texUnit->EyePlaneQ[2];
params[3] = (GLint) texUnit->EyePlaneQ[3]; params[3] = (GLint) texUnit->EyePlaneQ[3];
}
}
else { else {
gl_error( ctx, GL_INVALID_ENUM, "glGetTexGeniv(pname)" ); gl_error( ctx, GL_INVALID_ENUM, "glGetTexGeniv(pname)" );
return; return;




/* GL_ARB_multitexture */ /* GL_ARB_multitexture */
void gl_ActiveTexture( GLcontext *ctx, GLenum target )
void
_mesa_ActiveTextureARB( GLenum target )
{ {
GET_CURRENT_CONTEXT(ctx);
GLint maxUnits = ctx->Const.MaxTextureUnits; GLint maxUnits = ctx->Const.MaxTextureUnits;


ASSERT_OUTSIDE_BEGIN_END( ctx, "glActiveTextureARB" ); ASSERT_OUTSIDE_BEGIN_END( ctx, "glActiveTextureARB" );




/* GL_ARB_multitexture */ /* GL_ARB_multitexture */
void gl_ClientActiveTexture( GLcontext *ctx, GLenum target )
void
_mesa_ClientActiveTextureARB( GLenum target )
{ {
GET_CURRENT_CONTEXT(ctx);
GLint maxUnits = ctx->Const.MaxTextureUnits; GLint maxUnits = ctx->Const.MaxTextureUnits;


ASSERT_OUTSIDE_BEGIN_END( ctx, "glClientActiveTextureARB" ); ASSERT_OUTSIDE_BEGIN_END( ctx, "glClientActiveTextureARB" );

+ 65
- 29
src/mesa/main/texstate.h View File

/* $Id: texstate.h,v 1.1 1999/08/19 00:55:41 jtg Exp $ */
/* $Id: texstate.h,v 1.2 1999/11/11 01:22:28 brianp Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library


/*** Called from API ***/ /*** Called from API ***/


extern void gl_GetTexEnvfv( GLcontext *ctx,
GLenum target, GLenum pname, GLfloat *params );
extern void
_mesa_GetTexEnvfv( GLenum target, GLenum pname, GLfloat *params );


extern void gl_GetTexEnviv( GLcontext *ctx,
GLenum target, GLenum pname, GLint *params );
extern void
_mesa_GetTexEnviv( GLenum target, GLenum pname, GLint *params );


extern void gl_GetTexGendv( GLcontext *ctx,
GLenum coord, GLenum pname, GLdouble *params );
extern void
_mesa_GetTexGendv( GLenum coord, GLenum pname, GLdouble *params );


extern void gl_GetTexGenfv( GLcontext *ctx,
GLenum coord, GLenum pname, GLfloat *params );
extern void
_mesa_GetTexGenfv( GLenum coord, GLenum pname, GLfloat *params );


extern void gl_GetTexGeniv( GLcontext *ctx,
GLenum coord, GLenum pname, GLint *params );
extern void
_mesa_GetTexGeniv( GLenum coord, GLenum pname, GLint *params );


extern void gl_GetTexLevelParameterfv( GLcontext *ctx,
GLenum target, GLint level,
GLenum pname, GLfloat *params );
extern void
_mesa_GetTexLevelParameterfv( GLenum target, GLint level,
GLenum pname, GLfloat *params );


extern void gl_GetTexLevelParameteriv( GLcontext *ctx,
GLenum target, GLint level,
GLenum pname, GLint *params );
extern void
_mesa_GetTexLevelParameteriv( GLenum target, GLint level,
GLenum pname, GLint *params );


extern void gl_GetTexParameterfv( GLcontext *ctx, GLenum target,
GLenum pname, GLfloat *params );
extern void
_mesa_GetTexParameterfv( GLenum target, GLenum pname, GLfloat *params );


extern void gl_GetTexParameteriv( GLcontext *ctx,
GLenum target, GLenum pname, GLint *params );
extern void
_mesa_GetTexParameteriv( GLenum target, GLenum pname, GLint *params );




extern void gl_TexEnvfv( GLcontext *ctx,
GLenum target, GLenum pname, const GLfloat *param );
extern void
_mesa_TexEnvf( GLenum target, GLenum pname, GLfloat param );


extern void
_mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param );


extern void gl_TexParameterfv( GLcontext *ctx, GLenum target, GLenum pname,
const GLfloat *params );
extern void
_mesa_TexEnvi( GLenum target, GLenum pname, GLint param );


extern void
_mesa_TexEnviv( GLenum target, GLenum pname, const GLint *param );


extern void gl_TexGenfv( GLcontext *ctx,
GLenum coord, GLenum pname, const GLfloat *params );

extern void
_mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params );

extern void
_mesa_TexParameterf( GLenum target, GLenum pname, GLfloat param );


extern void
_mesa_TexParameteri( GLenum target, GLenum pname, GLint param );

extern void
_mesa_TexParameteriv( GLenum target, GLenum pname, const GLint *params );


extern void
_mesa_TexGend( GLenum coord, GLenum pname, GLdouble param );

extern void
_mesa_TexGendv( GLenum coord, GLenum pname, const GLdouble *params );

extern void
_mesa_TexGenf( GLenum coord, GLenum pname, GLfloat param );

extern void
_mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params );

extern void
_mesa_TexGeni( GLenum coord, GLenum pname, GLint param );

extern void
_mesa_TexGeniv( GLenum coord, GLenum pname, const GLint *params );






/* /*
* GL_ARB_multitexture * GL_ARB_multitexture
*/ */
extern void gl_ActiveTexture( GLcontext *ctx, GLenum target );
extern void
_mesa_ActiveTextureARB( GLenum target );


extern void gl_ClientActiveTexture( GLcontext *ctx, GLenum target );
extern void
_mesa_ClientActiveTextureARB( GLenum target );







+ 90
- 98
src/mesa/main/varray.c View File

/* $Id: varray.c,v 1.13 1999/11/09 17:26:15 keithw Exp $ */
/* $Id: varray.c,v 1.14 1999/11/11 01:22:28 brianp Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
#ifdef PC_HEADER #ifdef PC_HEADER
#include "all.h" #include "all.h"
#else #else
#ifndef XFree86Server
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#else
#include "GL/xf86glx.h"
#endif
#include "glheader.h"
#include "context.h" #include "context.h"
#include "api.h"
#include "cva.h" #include "cva.h"
#include "enable.h" #include "enable.h"
#include "enums.h" #include "enums.h"
#include "vbindirect.h" #include "vbindirect.h"
#include "vbxform.h" #include "vbxform.h"
#include "xform.h" #include "xform.h"
#ifdef XFree86Server
#include "GL/xf86glx.h"
#endif
#endif #endif


#if defined(GLX_DIRECT_RENDERING) && !defined(XFree86Server) && !defined(GLX_USE_DLOPEN)
#define NEED_MESA_FUNCS_WRAPPED
#include "mesa_api.h"
#endif




void GLAPIENTRY glVertexPointer(CTX_ARG GLint size, GLenum type, GLsizei stride,
const GLvoid *ptr )
void
_mesa_VertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr)
{ {
GLcontext *ctx;
GET_CONTEXT;
CHECK_CONTEXT;
ctx = CC;
GET_CURRENT_CONTEXT(ctx);
if (size<2 || size>4) { if (size<2 || size>4) {
gl_error( ctx, GL_INVALID_VALUE, "glVertexPointer(size)" ); gl_error( ctx, GL_INVALID_VALUE, "glVertexPointer(size)" );






void GLAPIENTRY glNormalPointer(CTX_ARG GLenum type, GLsizei stride,
const GLvoid *ptr )
void
_mesa_NormalPointer(GLenum type, GLsizei stride, const GLvoid *ptr )
{ {
GLcontext *ctx;
GET_CONTEXT;
CHECK_CONTEXT;
ctx = CC;
GET_CURRENT_CONTEXT(ctx);
if (stride<0) { if (stride<0) {
gl_error( ctx, GL_INVALID_VALUE, "glNormalPointer(stride)" ); gl_error( ctx, GL_INVALID_VALUE, "glNormalPointer(stride)" );






void GLAPIENTRY glColorPointer(CTX_ARG GLint size, GLenum type, GLsizei stride,
const GLvoid *ptr )
void
_mesa_ColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr)
{ {
GLcontext *ctx;
GET_CONTEXT;
CHECK_CONTEXT;
ctx = CC;
GET_CURRENT_CONTEXT(ctx);

if (size<3 || size>4) { if (size<3 || size>4) {
gl_error( ctx, GL_INVALID_VALUE, "glColorPointer(size)" ); gl_error( ctx, GL_INVALID_VALUE, "glColorPointer(size)" );
return; return;






void GLAPIENTRY glIndexPointer(CTX_ARG GLenum type, GLsizei stride,
const GLvoid *ptr )
void
_mesa_IndexPointer(GLenum type, GLsizei stride, const GLvoid *ptr)
{ {
GLcontext *ctx;
GET_CONTEXT;
CHECK_CONTEXT;
ctx = CC;
GET_CURRENT_CONTEXT(ctx);
if (stride<0) { if (stride<0) {
gl_error( ctx, GL_INVALID_VALUE, "glIndexPointer(stride)" ); gl_error( ctx, GL_INVALID_VALUE, "glIndexPointer(stride)" );






void GLAPIENTRY glTexCoordPointer(CTX_ARG GLint size, GLenum type,
GLsizei stride, const GLvoid *ptr )
void
_mesa_TexCoordPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr)
{ {
GET_CURRENT_CONTEXT(ctx);
GLuint texUnit; GLuint texUnit;
GLcontext *ctx;
GET_CONTEXT;
CHECK_CONTEXT;
ctx = CC;
texUnit = ctx->Array.ActiveTexture; texUnit = ctx->Array.ActiveTexture;


if (size<1 || size>4) { if (size<1 || size>4) {






void GLAPIENTRY glEdgeFlagPointer(CTX_ARG GLsizei stride, const void *vptr )
void
_mesa_EdgeFlagPointer(GLsizei stride, const void *vptr)
{ {
GET_CURRENT_CONTEXT(ctx);
const GLboolean *ptr = (GLboolean *)vptr; const GLboolean *ptr = (GLboolean *)vptr;
GLcontext *ctx;
GET_CONTEXT;
CHECK_CONTEXT;
ctx = CC;


if (stride<0) { if (stride<0) {
gl_error( ctx, GL_INVALID_VALUE, "glEdgeFlagPointer(stride)" ); gl_error( ctx, GL_INVALID_VALUE, "glEdgeFlagPointer(stride)" );






void gl_DrawArrays( GLcontext *ctx, GLenum mode, GLint start, GLsizei count )
/* Enough funny business going on in here it might be quicker to use a
* function pointer.
*/
#define ARRAY_ELT( IM, i ) \
{ \
GLuint count = IM->Count; \
IM->Elt[count] = i; \
IM->Flag[count] = ((IM->Flag[count] & IM->ArrayAndFlags) | \
VERT_ELT); \
IM->FlushElt |= IM->ArrayEltFlush; \
IM->Count = count += IM->ArrayIncr; \
if (count == VB_MAX) \
IM->maybe_transform_vb( IM ); \
}


void
_mesa_ArrayElement( GLint i )
{
GET_IMMEDIATE;
ARRAY_ELT( IM, i );
}


void gl_ArrayElement( GLcontext *CC, GLint i )
{
struct immediate *im = CC->input;
ARRAY_ELT( im, i );
}



void
_mesa_DrawArrays(GLenum mode, GLint start, GLsizei count)
{ {
GET_CURRENT_CONTEXT(ctx);
struct vertex_buffer *VB = ctx->VB; struct vertex_buffer *VB = ctx->VB;
GLint i; GLint i;


0 /* f */ 0 /* f */
}; };


void GLAPIENTRY glDrawElements(CTX_ARG GLenum mode, GLsizei count,
GLenum type, const GLvoid *indices )

void
_mesa_DrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices)
{ {
GLcontext *ctx;
GET_CURRENT_CONTEXT(ctx);
struct gl_cva *cva; struct gl_cva *cva;
GET_CONTEXT;
CHECK_CONTEXT;
ctx = CC;

cva = &ctx->CVA; cva = &ctx->CVA;
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glDrawElements"); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glDrawElements");








void GLAPIENTRY glInterleavedArrays(CTX_ARG GLenum format, GLsizei stride,
const GLvoid *pointer )
void
_mesa_InterleavedArrays(GLenum format, GLsizei stride, const GLvoid *pointer)
{ {
GLcontext *ctx;
GET_CURRENT_CONTEXT(ctx);
GLboolean tflag, cflag, nflag; /* enable/disable flags */ GLboolean tflag, cflag, nflag; /* enable/disable flags */
GLint tcomps, ccomps, vcomps; /* components per texcoord, color, vertex */ GLint tcomps, ccomps, vcomps; /* components per texcoord, color, vertex */


GLint c, f; GLint c, f;
GLint coordUnitSave; GLint coordUnitSave;
GET_CONTEXT;
CHECK_CONTEXT;
ctx = CC;


f = sizeof(GLfloat); f = sizeof(GLfloat);
c = f * ((4*sizeof(GLubyte) + (f-1)) / f); c = f * ((4*sizeof(GLubyte) + (f-1)) / f);


stride = defstride; stride = defstride;
} }


gl_DisableClientState( ctx, GL_EDGE_FLAG_ARRAY );
gl_DisableClientState( ctx, GL_INDEX_ARRAY );
_mesa_DisableClientState( GL_EDGE_FLAG_ARRAY );
_mesa_DisableClientState( GL_INDEX_ARRAY );


/* Texcoords */ /* Texcoords */
coordUnitSave = ctx->Array.ActiveTexture; coordUnitSave = ctx->Array.ActiveTexture;
GLint i; GLint i;
GLint factor = ctx->Array.TexCoordInterleaveFactor; GLint factor = ctx->Array.TexCoordInterleaveFactor;
for (i = 0; i < factor; i++) { for (i = 0; i < factor; i++) {
gl_ClientActiveTexture( ctx, (GLenum) (GL_TEXTURE0_ARB + i) );
gl_EnableClientState( ctx, GL_TEXTURE_COORD_ARRAY );
glTexCoordPointer(CTX_PRM tcomps, GL_FLOAT, stride,
_mesa_ClientActiveTextureARB( (GLenum) (GL_TEXTURE0_ARB + i) );
_mesa_EnableClientState( GL_TEXTURE_COORD_ARRAY );
glTexCoordPointer( tcomps, GL_FLOAT, stride,
(GLubyte *) pointer + i * coffset ); (GLubyte *) pointer + i * coffset );
} }
for (i = factor; i < ctx->Const.MaxTextureUnits; i++) { for (i = factor; i < ctx->Const.MaxTextureUnits; i++) {
gl_ClientActiveTexture( ctx, (GLenum) (GL_TEXTURE0_ARB + i) );
gl_DisableClientState( ctx, GL_TEXTURE_COORD_ARRAY );
_mesa_ClientActiveTextureARB( (GLenum) (GL_TEXTURE0_ARB + i) );
_mesa_DisableClientState( GL_TEXTURE_COORD_ARRAY );
} }
} }
else { else {
GLint i; GLint i;
for (i = 0; i < ctx->Const.MaxTextureUnits; i++) { for (i = 0; i < ctx->Const.MaxTextureUnits; i++) {
gl_ClientActiveTexture( ctx, (GLenum) (GL_TEXTURE0_ARB + i) );
gl_DisableClientState( ctx, GL_TEXTURE_COORD_ARRAY );
_mesa_ClientActiveTextureARB( (GLenum) (GL_TEXTURE0_ARB + i) );
_mesa_DisableClientState( GL_TEXTURE_COORD_ARRAY );
} }
} }
/* Restore texture coordinate unit index */ /* Restore texture coordinate unit index */
gl_ClientActiveTexture( ctx, (GLenum) (GL_TEXTURE0_ARB + coordUnitSave) );
_mesa_ClientActiveTextureARB( (GLenum) (GL_TEXTURE0_ARB + coordUnitSave) );




/* Color */ /* Color */
if (cflag) { if (cflag) {
gl_EnableClientState( ctx, GL_COLOR_ARRAY );
glColorPointer(CTX_PRM ccomps, ctype, stride,
_mesa_EnableClientState( GL_COLOR_ARRAY );
glColorPointer( ccomps, ctype, stride,
(GLubyte*) pointer + coffset ); (GLubyte*) pointer + coffset );
} }
else { else {
gl_DisableClientState( ctx, GL_COLOR_ARRAY );
_mesa_DisableClientState( GL_COLOR_ARRAY );
} }




/* Normals */ /* Normals */
if (nflag) { if (nflag) {
gl_EnableClientState( ctx, GL_NORMAL_ARRAY );
glNormalPointer(CTX_PRM GL_FLOAT, stride,
_mesa_EnableClientState( GL_NORMAL_ARRAY );
glNormalPointer( GL_FLOAT, stride,
(GLubyte*) pointer + noffset ); (GLubyte*) pointer + noffset );
} }
else { else {
gl_DisableClientState( ctx, GL_NORMAL_ARRAY );
_mesa_DisableClientState( GL_NORMAL_ARRAY );
} }


gl_EnableClientState( ctx, GL_VERTEX_ARRAY );
glVertexPointer(CTX_PRM vcomps, GL_FLOAT, stride,
_mesa_EnableClientState( GL_VERTEX_ARRAY );
glVertexPointer( vcomps, GL_FLOAT, stride,
(GLubyte *) pointer + voffset ); (GLubyte *) pointer + voffset );
} }






void GLAPIENTRY glDrawRangeElements(CTX_ARG GLenum mode, GLuint start,
GLuint end, GLsizei count,
GLenum type, const GLvoid *indices )
void
_mesa_DrawRangeElements(GLenum mode, GLuint start,
GLuint end, GLsizei count,
GLenum type, const GLvoid *indices)
{ {
GLcontext *ctx;
GET_CONTEXT;
CHECK_CONTEXT;
ctx = CC;
GET_CURRENT_CONTEXT(ctx);


if (end < start) { if (end < start) {
gl_error(ctx, GL_INVALID_VALUE, "glDrawRangeElements( end < start )"); gl_error(ctx, GL_INVALID_VALUE, "glDrawRangeElements( end < start )");
} }


if (!ctx->Array.LockCount && 2*count > (GLint) 3*(end-start)) { if (!ctx->Array.LockCount && 2*count > (GLint) 3*(end-start)) {
glLockArraysEXT(CTX_PRM start, end );
glDrawElements(CTX_PRM mode, count, type, indices );
glUnlockArraysEXT(CTX_VPRM );
glLockArraysEXT( start, end );
glDrawElements( mode, count, type, indices );
glUnlockArraysEXT();
} else { } else {
glDrawElements(CTX_PRM mode, count, type, indices );
glDrawElements( mode, count, type, indices );
} }
} }



+ 39
- 41
src/mesa/main/varray.h View File

/* $Id: varray.h,v 1.4 1999/10/19 18:37:05 keithw Exp $ */
/* $Id: varray.h,v 1.5 1999/11/11 01:22:28 brianp Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
#include "types.h" #include "types.h"




extern void gl_VertexPointer( GLcontext *ctx,
GLint size, GLenum type, GLsizei stride,
const GLvoid *ptr );
extern void
_mesa_VertexPointer(GLint size, GLenum type, GLsizei stride,
const GLvoid *ptr);




extern void gl_NormalPointer( GLcontext *ctx,
GLenum type, GLsizei stride, const GLvoid *ptr );
extern void
_mesa_NormalPointer(GLenum type, GLsizei stride, const GLvoid *ptr);




extern void gl_ColorPointer( GLcontext *ctx,
GLint size, GLenum type, GLsizei stride,
const GLvoid *ptr );
extern void
_mesa_ColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr);




extern void gl_IndexPointer( GLcontext *ctx,
GLenum type, GLsizei stride,
const GLvoid *ptr );
extern void
_mesa_IndexPointer(GLenum type, GLsizei stride, const GLvoid *ptr);




extern void gl_TexCoordPointer( GLcontext *ctx,
GLint size, GLenum type, GLsizei stride,
const GLvoid *ptr );
extern void
_mesa_TexCoordPointer(GLint size, GLenum type, GLsizei stride,
const GLvoid *ptr);




extern void gl_EdgeFlagPointer( GLcontext *ctx,
GLsizei stride, const GLboolean *ptr );
extern void
_mesa_EdgeFlagPointer(GLsizei stride, const GLvoid *ptr);




extern void gl_GetPointerv( GLcontext *ctx, GLenum pname, GLvoid **params );
extern void
_mesa_DrawArrays(GLenum mode, GLint first, GLsizei count);




extern void
_mesa_save_DrawArrays(GLenum mode, GLint first, GLsizei count);


extern void gl_DrawArrays( GLcontext *ctx,
GLenum mode, GLint first, GLsizei count );


extern void gl_save_DrawArrays( GLcontext *ctx,
GLenum mode, GLint first, GLsizei count );
extern void
_mesa_DrawElements(GLenum mode, GLsizei count, GLenum type,
const GLvoid *indices);




extern void gl_DrawElements( GLcontext *ctx,
GLenum mode, GLsizei count,
GLenum type, const GLvoid *indices );

extern void gl_save_DrawElements( GLcontext *ctx,
GLenum mode, GLsizei count,
GLenum type, const GLvoid *indices );
extern void
_mesa_save_DrawElements(GLenum mode, GLsizei count,
GLenum type, const GLvoid *indices);




extern void gl_InterleavedArrays( GLcontext *ctx,
GLenum format, GLsizei stride,
const GLvoid *pointer );
extern void
_mesa_InterleavedArrays(GLenum format, GLsizei stride, const GLvoid *pointer);


extern void gl_save_InterleavedArrays( GLcontext *ctx,
GLenum format, GLsizei stride,
const GLvoid *pointer );
extern void
_mesa_save_InterleavedArrays(GLenum format, GLsizei stride,
const GLvoid *pointer);




extern void gl_DrawRangeElements( GLcontext *ctx, GLenum mode, GLuint start,
GLuint end, GLsizei count, GLenum type,
const GLvoid *indices );
extern void
_mesa_DrawRangeElements(GLenum mode, GLuint start,
GLuint end, GLsizei count, GLenum type,
const GLvoid *indices);


extern void gl_save_DrawRangeElements( GLcontext *ctx, GLenum mode,
GLuint start, GLuint end, GLsizei count,
GLenum type, const GLvoid *indices );
extern void
_mesa_save_DrawRangeElements(GLenum mode,
GLuint start, GLuint end, GLsizei count,
GLenum type, const GLvoid *indices );




extern void gl_exec_array_elements( GLcontext *ctx, extern void gl_exec_array_elements( GLcontext *ctx,


extern void gl_update_client_state( GLcontext *ctx ); extern void gl_update_client_state( GLcontext *ctx );



#endif #endif

Loading…
Cancel
Save