diff options
author | keithw <keithw> | 2002-09-23 17:26:11 +0000 |
---|---|---|
committer | keithw <keithw> | 2002-09-23 17:26:11 +0000 |
commit | fd13aaf9b416871a4e25af4cd6c1a7b86a1cf4ba (patch) | |
tree | 4525def1db7e25ce5681712d856da17e264a18df /xc/extras/Mesa | |
parent | 12854f0c6996cded6128c9a4e3df7ea48d07cedb (diff) |
merged r200-0-2-branch to trunk
Diffstat (limited to 'xc/extras/Mesa')
37 files changed, 2004 insertions, 636 deletions
diff --git a/xc/extras/Mesa/include/GL/gl.h b/xc/extras/Mesa/include/GL/gl.h index 87ad11f1a..1a062ed65 100644 --- a/xc/extras/Mesa/include/GL/gl.h +++ b/xc/extras/Mesa/include/GL/gl.h @@ -1,9 +1,10 @@ +/* $Id: gl.h,v 1.26 2002/09/23 17:26:11 keithw Exp $ */ /* * Mesa 3-D graphics library - * Version: 4.0.3 + * Version: 4.0.4 * - * Copyright (C) 1999-2003 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -62,6 +63,10 @@ # define GLAPIENTRY #endif /* WIN32 / CYGWIN bracket */ +#if (defined(__BEOS__) && defined(__POWERPC__)) || defined(__QUICKDRAW__) +# define PRAGMA_EXPORT_SUPPORTED 1 +#endif + #if defined(_WIN32) && !defined(_WINGDI_) && !defined(_GNU_H_WINDOWS32_DEFINES) && !defined(OPENSTEP) && !defined(__CYGWIN__) #include <gl/mesa_wgl.h> #endif @@ -1912,6 +1917,9 @@ GLAPI void GLAPIENTRY glMultTransposeMatrixf( const GLfloat m[16] ); GLAPI void GLAPIENTRY glSampleCoverage( GLclampf value, GLboolean invert ); +#if defined(GL_GLEXT_LEGACY) + + /* * GL_ARB_multitexture (ARB extension 1 and OpenGL 1.2.1) */ @@ -1989,12 +1997,43 @@ GLAPI void GLAPIENTRY glMultiTexCoord4ivARB(GLenum target, const GLint *v); GLAPI void GLAPIENTRY glMultiTexCoord4sARB(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); GLAPI void GLAPIENTRY glMultiTexCoord4svARB(GLenum target, const GLshort *v); -#endif /* GL_ARB_multitexture */ - - +typedef void (GLAPIENTRY * PFNGLACTIVETEXTUREARBPROC) (GLenum texture); +typedef void (GLAPIENTRY * PFNGLCLIENTACTIVETEXTUREARBPROC) (GLenum texture); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1DARBPROC) (GLenum target, GLdouble s); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1DVARBPROC) (GLenum target, const GLdouble *v); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1FARBPROC) (GLenum target, GLfloat s); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1FVARBPROC) (GLenum target, const GLfloat *v); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1IARBPROC) (GLenum target, GLint s); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1IVARBPROC) (GLenum target, const GLint *v); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1SARBPROC) (GLenum target, GLshort s); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1SVARBPROC) (GLenum target, const GLshort *v); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2DARBPROC) (GLenum target, GLdouble s, GLdouble t); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2DVARBPROC) (GLenum target, const GLdouble *v); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2FARBPROC) (GLenum target, GLfloat s, GLfloat t); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2FVARBPROC) (GLenum target, const GLfloat *v); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2IARBPROC) (GLenum target, GLint s, GLint t); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2IVARBPROC) (GLenum target, const GLint *v); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2SARBPROC) (GLenum target, GLshort s, GLshort t); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2SVARBPROC) (GLenum target, const GLshort *v); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3DVARBPROC) (GLenum target, const GLdouble *v); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3FVARBPROC) (GLenum target, const GLfloat *v); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3IARBPROC) (GLenum target, GLint s, GLint t, GLint r); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3IVARBPROC) (GLenum target, const GLint *v); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3SVARBPROC) (GLenum target, const GLshort *v); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4DVARBPROC) (GLenum target, const GLdouble *v); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4FVARBPROC) (GLenum target, const GLfloat *v); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4IARBPROC) (GLenum target, GLint s, GLint t, GLint r, GLint q); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4IVARBPROC) (GLenum target, const GLint *v); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4SVARBPROC) (GLenum target, const GLshort *v); +#endif /* GL_ARB_multitexture */ -#if defined(GL_GLEXT_LEGACY) /* @@ -2369,8 +2408,6 @@ GLAPI void GLAPIENTRY glUnlockArraysEXT( void ); - - /* * 197. GL_MESA_window_pos */ @@ -2485,21 +2522,50 @@ GLAPI void GLAPIENTRY glTracePointerRangeMESA( const GLvoid* first, const GLvoid #endif /* GL_MESA_packed_depth_stencil */ -/* - * ??. GL_MESA_sprite_point - */ -#ifndef GL_MESA_sprite_point -#define GL_MESA_sprite_point 1 -#define GL_SPRITE_POINT_MESA 0x8757 /* XXX not finalized! */ +#ifndef GL_MESA_ycbcr_texture +#define GL_MESA_ycbcr_texture 1 -#endif +#define GL_YCBCR_MESA 0x8757 +#define GL_UNSIGNED_SHORT_8_8_MESA 0x85BA /* same as Apple */ +#define GL_UNSIGNED_SHORT_8_8_REV_MESA 0x85BB /* same as Apple */ + +#endif /* GL_MESA_texture_ycbcr */ + + + +#ifndef GL_MESA_pack_invert +#define GL_MESA_pack_invert 1 + +#define GL_PACK_INVERT_MESA 0x8758 + +#endif /* GL_MESA_pack_invert */ + + + +#ifndef GL_APPLE_client_storage +#define GL_APPLE_client_storage 1 + +#define GL_UNPACK_CLIENT_STORAGE_APPLE 0x85B2 + +#endif /* GL_APPLE_client_storage */ + + + +#ifndef GL_APPLE_ycbcr_422 +#define GL_APPLE_ycbcr_422 1 + +#define GL_YCBCR_422_APPLE 0x85B9 +#define GL_UNSIGNED_SHORT_8_8_APPLE 0x85BA +#define GL_UNSIGNED_SHORT_8_8_REV_APPLE 0x85BB + +#endif /* GL_APPLE_ycbcr_422 */ /********************************************************************** * Begin system-specific stuff */ -#if defined(__BEOS__) || defined(__QUICKDRAW__) +#if defined(PRAGMA_EXPORT_SUPPORTED) #pragma export off #endif diff --git a/xc/extras/Mesa/include/GL/glext.h b/xc/extras/Mesa/include/GL/glext.h index fc9cb3c17..245f100c7 100644 --- a/xc/extras/Mesa/include/GL/glext.h +++ b/xc/extras/Mesa/include/GL/glext.h @@ -24,7 +24,7 @@ extern "C" { ** ** Original Code. The Original Code is: OpenGL Sample Implementation, ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, -** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Inc. The Original Code is Copyright (c) 1991-2002 Silicon Graphics, Inc. ** Copyright in any portions created by third parties is as indicated ** elsewhere herein. All Rights Reserved. ** @@ -49,9 +49,9 @@ extern "C" { /*************************************************************/ /* Header file version number, required by OpenGL ABI for Linux */ -/* glext.h last updated 2002/05/30 */ +/* glext.h last updated 2002/08/21 */ /* Current version at http://oss.sgi.com/projects/ogl-sample/registry/ */ -#define GL_GLEXT_VERSION 15 +#define GL_GLEXT_VERSION 17 #ifndef GL_VERSION_1_2 #define GL_UNSIGNED_BYTE_3_3_2 0x8032 @@ -60,6 +60,16 @@ extern "C" { #define GL_UNSIGNED_INT_8_8_8_8 0x8035 #define GL_UNSIGNED_INT_10_10_10_2 0x8036 #define GL_RESCALE_NORMAL 0x803A +#define GL_TEXTURE_BINDING_3D 0x806A +#define GL_PACK_SKIP_IMAGES 0x806B +#define GL_PACK_IMAGE_HEIGHT 0x806C +#define GL_UNPACK_SKIP_IMAGES 0x806D +#define GL_UNPACK_IMAGE_HEIGHT 0x806E +#define GL_TEXTURE_3D 0x806F +#define GL_PROXY_TEXTURE_3D 0x8070 +#define GL_TEXTURE_DEPTH 0x8071 +#define GL_TEXTURE_WRAP_R 0x8072 +#define GL_MAX_3D_TEXTURE_SIZE 0x8073 #define GL_UNSIGNED_BYTE_2_3_3_REV 0x8362 #define GL_UNSIGNED_SHORT_5_6_5 0x8363 #define GL_UNSIGNED_SHORT_5_6_5_REV 0x8364 @@ -143,7 +153,7 @@ extern "C" { #define GL_POST_COLOR_MATRIX_RED_BIAS 0x80B8 #define GL_POST_COLOR_MATRIX_GREEN_BIAS 0x80B9 #define GL_POST_COLOR_MATRIX_BLUE_BIAS 0x80BA -#define GL_POST_COLOR_MATIX_ALPHA_BIAS 0x80BB +#define GL_POST_COLOR_MATRIX_ALPHA_BIAS 0x80BB #define GL_COLOR_TABLE 0x80D0 #define GL_POST_CONVOLUTION_COLOR_TABLE 0x80D1 #define GL_POST_COLOR_MATRIX_COLOR_TABLE 0x80D2 @@ -160,9 +170,7 @@ extern "C" { #define GL_COLOR_TABLE_ALPHA_SIZE 0x80DD #define GL_COLOR_TABLE_LUMINANCE_SIZE 0x80DE #define GL_COLOR_TABLE_INTENSITY_SIZE 0x80DF -#define GL_IGNORE_BORDER 0x8150 #define GL_CONSTANT_BORDER 0x8151 -#define GL_WRAP_BORDER 0x8152 #define GL_REPLICATE_BORDER 0x8153 #define GL_CONVOLUTION_BORDER_COLOR 0x8154 #endif @@ -267,6 +275,48 @@ extern "C" { #define GL_DOT3_RGBA 0x86AF #endif +#ifndef GL_VERSION_1_4 +#define GL_BLEND_DST_RGB 0x80C8 +#define GL_BLEND_SRC_RGB 0x80C9 +#define GL_BLEND_DST_ALPHA 0x80CA +#define GL_BLEND_SRC_ALPHA 0x80CB +#define GL_POINT_SIZE_MIN 0x8126 +#define GL_POINT_SIZE_MAX 0x8127 +#define GL_POINT_FADE_THRESHOLD_SIZE 0x8128 +#define GL_POINT_DISTANCE_ATTENUATION 0x8129 +#define GL_GENERATE_MIPMAP 0x8191 +#define GL_GENERATE_MIPMAP_HINT 0x8192 +#define GL_DEPTH_COMPONENT16 0x81A5 +#define GL_DEPTH_COMPONENT24 0x81A6 +#define GL_DEPTH_COMPONENT32 0x81A7 +#define GL_MIRRORED_REPEAT 0x8370 +#define GL_FOG_COORDINATE_SOURCE 0x8450 +#define GL_FOG_COORDINATE 0x8451 +#define GL_FRAGMENT_DEPTH 0x8452 +#define GL_CURRENT_FOG_COORDINATE 0x8453 +#define GL_FOG_COORDINATE_ARRAY_TYPE 0x8454 +#define GL_FOG_COORDINATE_ARRAY_STRIDE 0x8455 +#define GL_FOG_COORDINATE_ARRAY_POINTER 0x8456 +#define GL_FOG_COORDINATE_ARRAY 0x8457 +#define GL_COLOR_SUM 0x8458 +#define GL_CURRENT_SECONDARY_COLOR 0x8459 +#define GL_SECONDARY_COLOR_ARRAY_SIZE 0x845A +#define GL_SECONDARY_COLOR_ARRAY_TYPE 0x845B +#define GL_SECONDARY_COLOR_ARRAY_STRIDE 0x845C +#define GL_SECONDARY_COLOR_ARRAY_POINTER 0x845D +#define GL_SECONDARY_COLOR_ARRAY 0x845E +#define GL_MAX_TEXTURE_LOD_BIAS 0x84FD +#define GL_TEXTURE_FILTER_CONTROL 0x8500 +#define GL_TEXTURE_LOD_BIAS 0x8501 +#define GL_INCR_WRAP 0x8507 +#define GL_DECR_WRAP 0x8508 +#define GL_TEXTURE_DEPTH_SIZE 0x884A +#define GL_DEPTH_TEXTURE_MODE 0x884B +#define GL_TEXTURE_COMPARE_MODE 0x884C +#define GL_TEXTURE_COMPARE_FUNC 0x884D +#define GL_COMPARE_R_TO_TEXTURE 0x884E +#endif + #ifndef GL_ARB_multitexture #define GL_TEXTURE0_ARB 0x84C0 #define GL_TEXTURE1_ARB 0x84C1 @@ -362,17 +412,9 @@ extern "C" { #ifndef GL_ARB_point_parameters #define GL_POINT_SIZE_MIN_ARB 0x8126 -#define GL_POINT_SIZE_MIN_EXT 0x8126 -#define GL_POINT_SIZE_MIN_SGIS 0x8126 #define GL_POINT_SIZE_MAX_ARB 0x8127 -#define GL_POINT_SIZE_MAX_EXT 0x8127 -#define GL_POINT_SIZE_MAX_SGIS 0x8127 #define GL_POINT_FADE_THRESHOLD_SIZE_ARB 0x8128 -#define GL_POINT_FADE_THRESHOLD_SIZE_EXT 0x8128 -#define GL_POINT_FADE_THRESHOLD_SIZE_SGIS 0x8128 #define GL_POINT_DISTANCE_ATTENUATION_ARB 0x8129 -#define GL_DISTANCE_ATTENUATION_EXT 0x8129 -#define GL_DISTANCE_ATTENUATION_SGIS 0x8129 #endif #ifndef GL_ARB_vertex_blend @@ -491,6 +533,88 @@ extern "C" { #ifndef GL_ARB_window_pos #endif +#ifndef GL_ARB_vertex_program +#define GL_VERTEX_PROGRAM_ARB 0x8620 +#define GL_VERTEX_PROGRAM_POINT_SIZE_ARB 0x8642 +#define GL_VERTEX_PROGRAM_TWO_SIDE_ARB 0x8643 +#define GL_COLOR_SUM_ARB 0x8458 +#define GL_PROGRAM_FORMAT_ASCII_ARB 0x8875 +#define GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB 0x8622 +#define GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB 0x8623 +#define GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB 0x8624 +#define GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB 0x8625 +#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB 0x886A +#define GL_CURRENT_VERTEX_ATTRIB_ARB 0x8626 +#define GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB 0x8645 +#define GL_PROGRAM_LENGTH_ARB 0x8627 +#define GL_PROGRAM_FORMAT_ARB 0x8876 +#define GL_PROGRAM_BINDING_ARB 0x8677 +#define GL_PROGRAM_INSTRUCTIONS_ARB 0x88A0 +#define GL_MAX_PROGRAM_INSTRUCTIONS_ARB 0x88A1 +#define GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB 0x88A2 +#define GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB 0x88A3 +#define GL_PROGRAM_TEMPORARIES_ARB 0x88A4 +#define GL_MAX_PROGRAM_TEMPORARIES_ARB 0x88A5 +#define GL_PROGRAM_NATIVE_TEMPORARIES_ARB 0x88A6 +#define GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB 0x88A7 +#define GL_PROGRAM_PARAMETERS_ARB 0x88A8 +#define GL_MAX_PROGRAM_PARAMETERS_ARB 0x88A9 +#define GL_PROGRAM_NATIVE_PARAMETERS_ARB 0x88AA +#define GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB 0x88AB +#define GL_PROGRAM_ATTRIBS_ARB 0x88AC +#define GL_MAX_PROGRAM_ATTRIBS_ARB 0x88AD +#define GL_PROGRAM_NATIVE_ATTRIBS_ARB 0x88AE +#define GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB 0x88AF +#define GL_PROGRAM_ADDRESS_REGISTERS_ARB 0x88B0 +#define GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB 0x88B1 +#define GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB 0x88B2 +#define GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB 0x88B3 +#define GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB 0x88B4 +#define GL_MAX_PROGRAM_ENV_PARAMETERS_ARB 0x88B5 +#define GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB 0x88B6 +#define GL_PROGRAM_STRING_ARB 0x8628 +#define GL_PROGRAM_ERROR_POSITION_ARB 0x864B +#define GL_CURRENT_MATRIX_ARB 0x8641 +#define GL_TRANSPOSE_CURRENT_MATRIX_ARB 0x88B7 +#define GL_CURRENT_MATRIX_STACK_DEPTH_ARB 0x8640 +#define GL_MAX_VERTEX_ATTRIBS_ARB 0x8869 +#define GL_MAX_PROGRAM_MATRICES_ARB 0x862F +#define GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB 0x862E +#define GL_PROGRAM_ERROR_STRING_ARB 0x8874 +#define GL_MATRIX0_ARB 0x88C0 +#define GL_MATRIX1_ARB 0x88C1 +#define GL_MATRIX2_ARB 0x88C2 +#define GL_MATRIX3_ARB 0x88C3 +#define GL_MATRIX4_ARB 0x88C4 +#define GL_MATRIX5_ARB 0x88C5 +#define GL_MATRIX6_ARB 0x88C6 +#define GL_MATRIX7_ARB 0x88C7 +#define GL_MATRIX8_ARB 0x88C8 +#define GL_MATRIX9_ARB 0x88C9 +#define GL_MATRIX10_ARB 0x88CA +#define GL_MATRIX11_ARB 0x88CB +#define GL_MATRIX12_ARB 0x88CC +#define GL_MATRIX13_ARB 0x88CD +#define GL_MATRIX14_ARB 0x88CE +#define GL_MATRIX15_ARB 0x88CF +#define GL_MATRIX16_ARB 0x88D0 +#define GL_MATRIX17_ARB 0x88D1 +#define GL_MATRIX18_ARB 0x88D2 +#define GL_MATRIX19_ARB 0x88D3 +#define GL_MATRIX20_ARB 0x88D4 +#define GL_MATRIX21_ARB 0x88D5 +#define GL_MATRIX22_ARB 0x88D6 +#define GL_MATRIX23_ARB 0x88D7 +#define GL_MATRIX24_ARB 0x88D8 +#define GL_MATRIX25_ARB 0x88D9 +#define GL_MATRIX26_ARB 0x88DA +#define GL_MATRIX27_ARB 0x88DB +#define GL_MATRIX28_ARB 0x88DC +#define GL_MATRIX29_ARB 0x88DD +#define GL_MATRIX30_ARB 0x88DE +#define GL_MATRIX31_ARB 0x88DF +#endif + #ifndef GL_EXT_abgr #define GL_ABGR_EXT 0x8000 #endif @@ -556,23 +680,14 @@ extern "C" { #endif #ifndef GL_EXT_texture3D -#define GL_PACK_SKIP_IMAGES 0x806B #define GL_PACK_SKIP_IMAGES_EXT 0x806B -#define GL_PACK_IMAGE_HEIGHT 0x806C #define GL_PACK_IMAGE_HEIGHT_EXT 0x806C -#define GL_UNPACK_SKIP_IMAGES 0x806D #define GL_UNPACK_SKIP_IMAGES_EXT 0x806D -#define GL_UNPACK_IMAGE_HEIGHT 0x806E #define GL_UNPACK_IMAGE_HEIGHT_EXT 0x806E -#define GL_TEXTURE_3D 0x806F #define GL_TEXTURE_3D_EXT 0x806F -#define GL_PROXY_TEXTURE_3D 0x8070 #define GL_PROXY_TEXTURE_3D_EXT 0x8070 -#define GL_TEXTURE_DEPTH 0x8071 #define GL_TEXTURE_DEPTH_EXT 0x8071 -#define GL_TEXTURE_WRAP_R 0x8072 #define GL_TEXTURE_WRAP_R_EXT 0x8072 -#define GL_MAX_3D_TEXTURE_SIZE 0x8073 #define GL_MAX_3D_TEXTURE_SIZE_EXT 0x8073 #endif @@ -899,6 +1014,20 @@ extern "C" { #define GL_TEXTURE_MULTI_BUFFER_HINT_SGIX 0x812E #endif +#ifndef GL_EXT_point_parameters +#define GL_POINT_SIZE_MIN_EXT 0x8126 +#define GL_POINT_SIZE_MAX_EXT 0x8127 +#define GL_POINT_FADE_THRESHOLD_SIZE_EXT 0x8128 +#define GL_DISTANCE_ATTENUATION_EXT 0x8129 +#endif + +#ifndef GL_SGIS_point_parameters +#define GL_POINT_SIZE_MIN_SGIS 0x8126 +#define GL_POINT_SIZE_MAX_SGIS 0x8127 +#define GL_POINT_FADE_THRESHOLD_SIZE_SGIS 0x8128 +#define GL_DISTANCE_ATTENUATION_SGIS 0x8129 +#endif + #ifndef GL_SGIX_instruments #define GL_INSTRUMENT_BUFFER_POINTER_SGIX 0x8180 #define GL_INSTRUMENT_MEASUREMENTS_SGIX 0x8181 @@ -2289,6 +2418,11 @@ extern "C" { #ifndef GL_EXT_shadow_funcs #endif +#ifndef GL_EXT_stencil_two_side +#define GL_STENCIL_TEST_TWO_SIDE_EXT 0x8910 +#define GL_ACTIVE_STENCIL_FACE_EXT 0x8911 +#endif + /*************************************************************/ @@ -2472,6 +2606,102 @@ typedef void (APIENTRY * PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC) (GLenum target, GLint typedef void (APIENTRY * PFNGLGETCOMPRESSEDTEXIMAGEPROC) (GLenum target, GLint level, void *img); #endif +#ifndef GL_VERSION_1_4 +#define GL_VERSION_1_4 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBlendFuncSeparate (GLenum, GLenum, GLenum, GLenum); +GLAPI void APIENTRY glFogCoordf (GLfloat); +GLAPI void APIENTRY glFogCoordfv (const GLfloat *); +GLAPI void APIENTRY glFogCoordd (GLdouble); +GLAPI void APIENTRY glFogCoorddv (const GLdouble *); +GLAPI void APIENTRY glFogCoordPointer (GLenum, GLsizei, const GLvoid *); +GLAPI void APIENTRY glMultiDrawArrays (GLenum, GLint *, GLsizei *, GLsizei); +GLAPI void APIENTRY glMultiDrawElements (GLenum, const GLsizei *, GLenum, const GLvoid* *, GLsizei); +GLAPI void APIENTRY glPointParameterf (GLenum, GLfloat); +GLAPI void APIENTRY glPointParameterfv (GLenum, const GLfloat *); +GLAPI void APIENTRY glPointParameteri (GLenum, GLint); +GLAPI void APIENTRY glPointParameteriv (GLenum, const GLint *); +GLAPI void APIENTRY glSecondaryColor3b (GLbyte, GLbyte, GLbyte); +GLAPI void APIENTRY glSecondaryColor3bv (const GLbyte *); +GLAPI void APIENTRY glSecondaryColor3d (GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glSecondaryColor3dv (const GLdouble *); +GLAPI void APIENTRY glSecondaryColor3f (GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glSecondaryColor3fv (const GLfloat *); +GLAPI void APIENTRY glSecondaryColor3i (GLint, GLint, GLint); +GLAPI void APIENTRY glSecondaryColor3iv (const GLint *); +GLAPI void APIENTRY glSecondaryColor3s (GLshort, GLshort, GLshort); +GLAPI void APIENTRY glSecondaryColor3sv (const GLshort *); +GLAPI void APIENTRY glSecondaryColor3ub (GLubyte, GLubyte, GLubyte); +GLAPI void APIENTRY glSecondaryColor3ubv (const GLubyte *); +GLAPI void APIENTRY glSecondaryColor3ui (GLuint, GLuint, GLuint); +GLAPI void APIENTRY glSecondaryColor3uiv (const GLuint *); +GLAPI void APIENTRY glSecondaryColor3us (GLushort, GLushort, GLushort); +GLAPI void APIENTRY glSecondaryColor3usv (const GLushort *); +GLAPI void APIENTRY glSecondaryColorPointer (GLint, GLenum, GLsizei, const GLvoid *); +GLAPI void APIENTRY glWindowPos2d (GLdouble, GLdouble); +GLAPI void APIENTRY glWindowPos2dv (const GLdouble *); +GLAPI void APIENTRY glWindowPos2f (GLfloat, GLfloat); +GLAPI void APIENTRY glWindowPos2fv (const GLfloat *); +GLAPI void APIENTRY glWindowPos2i (GLint, GLint); +GLAPI void APIENTRY glWindowPos2iv (const GLint *); +GLAPI void APIENTRY glWindowPos2s (GLshort, GLshort); +GLAPI void APIENTRY glWindowPos2sv (const GLshort *); +GLAPI void APIENTRY glWindowPos3d (GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glWindowPos3dv (const GLdouble *); +GLAPI void APIENTRY glWindowPos3f (GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glWindowPos3fv (const GLfloat *); +GLAPI void APIENTRY glWindowPos3i (GLint, GLint, GLint); +GLAPI void APIENTRY glWindowPos3iv (const GLint *); +GLAPI void APIENTRY glWindowPos3s (GLshort, GLshort, GLshort); +GLAPI void APIENTRY glWindowPos3sv (const GLshort *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLBLENDFUNCSEPARATEPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); +typedef void (APIENTRY * PFNGLFOGCOORDFPROC) (GLfloat coord); +typedef void (APIENTRY * PFNGLFOGCOORDFVPROC) (const GLfloat *coord); +typedef void (APIENTRY * PFNGLFOGCOORDDPROC) (GLdouble coord); +typedef void (APIENTRY * PFNGLFOGCOORDDVPROC) (const GLdouble *coord); +typedef void (APIENTRY * PFNGLFOGCOORDPOINTERPROC) (GLenum type, GLsizei stride, const GLvoid *pointer); +typedef void (APIENTRY * PFNGLMULTIDRAWARRAYSPROC) (GLenum mode, GLint *first, GLsizei *count, GLsizei primcount); +typedef void (APIENTRY * PFNGLMULTIDRAWELEMENTSPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount); +typedef void (APIENTRY * PFNGLPOINTPARAMETERFPROC) (GLenum pname, GLfloat param); +typedef void (APIENTRY * PFNGLPOINTPARAMETERFVPROC) (GLenum pname, const GLfloat *params); +typedef void (APIENTRY * PFNGLPOINTPARAMETERIPROC) (GLenum pname, GLint param); +typedef void (APIENTRY * PFNGLPOINTPARAMETERIVPROC) (GLenum pname, const GLint *params); +typedef void (APIENTRY * PFNGLSECONDARYCOLOR3BPROC) (GLbyte red, GLbyte green, GLbyte blue); +typedef void (APIENTRY * PFNGLSECONDARYCOLOR3BVPROC) (const GLbyte *v); +typedef void (APIENTRY * PFNGLSECONDARYCOLOR3DPROC) (GLdouble red, GLdouble green, GLdouble blue); +typedef void (APIENTRY * PFNGLSECONDARYCOLOR3DVPROC) (const GLdouble *v); +typedef void (APIENTRY * PFNGLSECONDARYCOLOR3FPROC) (GLfloat red, GLfloat green, GLfloat blue); +typedef void (APIENTRY * PFNGLSECONDARYCOLOR3FVPROC) (const GLfloat *v); +typedef void (APIENTRY * PFNGLSECONDARYCOLOR3IPROC) (GLint red, GLint green, GLint blue); +typedef void (APIENTRY * PFNGLSECONDARYCOLOR3IVPROC) (const GLint *v); +typedef void (APIENTRY * PFNGLSECONDARYCOLOR3SPROC) (GLshort red, GLshort green, GLshort blue); +typedef void (APIENTRY * PFNGLSECONDARYCOLOR3SVPROC) (const GLshort *v); +typedef void (APIENTRY * PFNGLSECONDARYCOLOR3UBPROC) (GLubyte red, GLubyte green, GLubyte blue); +typedef void (APIENTRY * PFNGLSECONDARYCOLOR3UBVPROC) (const GLubyte *v); +typedef void (APIENTRY * PFNGLSECONDARYCOLOR3UIPROC) (GLuint red, GLuint green, GLuint blue); +typedef void (APIENTRY * PFNGLSECONDARYCOLOR3UIVPROC) (const GLuint *v); +typedef void (APIENTRY * PFNGLSECONDARYCOLOR3USPROC) (GLushort red, GLushort green, GLushort blue); +typedef void (APIENTRY * PFNGLSECONDARYCOLOR3USVPROC) (const GLushort *v); +typedef void (APIENTRY * PFNGLSECONDARYCOLORPOINTERPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +typedef void (APIENTRY * PFNGLWINDOWPOS2DPROC) (GLdouble x, GLdouble y); +typedef void (APIENTRY * PFNGLWINDOWPOS2DVPROC) (const GLdouble *v); +typedef void (APIENTRY * PFNGLWINDOWPOS2FPROC) (GLfloat x, GLfloat y); +typedef void (APIENTRY * PFNGLWINDOWPOS2FVPROC) (const GLfloat *v); +typedef void (APIENTRY * PFNGLWINDOWPOS2IPROC) (GLint x, GLint y); +typedef void (APIENTRY * PFNGLWINDOWPOS2IVPROC) (const GLint *v); +typedef void (APIENTRY * PFNGLWINDOWPOS2SPROC) (GLshort x, GLshort y); +typedef void (APIENTRY * PFNGLWINDOWPOS2SVPROC) (const GLshort *v); +typedef void (APIENTRY * PFNGLWINDOWPOS3DPROC) (GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRY * PFNGLWINDOWPOS3DVPROC) (const GLdouble *v); +typedef void (APIENTRY * PFNGLWINDOWPOS3FPROC) (GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRY * PFNGLWINDOWPOS3FVPROC) (const GLfloat *v); +typedef void (APIENTRY * PFNGLWINDOWPOS3IPROC) (GLint x, GLint y, GLint z); +typedef void (APIENTRY * PFNGLWINDOWPOS3IVPROC) (const GLint *v); +typedef void (APIENTRY * PFNGLWINDOWPOS3SPROC) (GLshort x, GLshort y, GLshort z); +typedef void (APIENTRY * PFNGLWINDOWPOS3SVPROC) (const GLshort *v); +#endif + #ifndef GL_ARB_multitexture #define GL_ARB_multitexture 1 #ifdef GL_GLEXT_PROTOTYPES @@ -2718,6 +2948,136 @@ typedef void (APIENTRY * PFNGLWINDOWPOS3SARBPROC) (GLshort x, GLshort y, GLshort typedef void (APIENTRY * PFNGLWINDOWPOS3SVARBPROC) (const GLshort *v); #endif +#ifndef GL_ARB_vertex_program +#define GL_ARB_vertex_program 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glVertexAttrib1dARB (GLuint, GLdouble); +GLAPI void APIENTRY glVertexAttrib1dvARB (GLuint, const GLdouble *); +GLAPI void APIENTRY glVertexAttrib1fARB (GLuint, GLfloat); +GLAPI void APIENTRY glVertexAttrib1fvARB (GLuint, const GLfloat *); +GLAPI void APIENTRY glVertexAttrib1sARB (GLuint, GLshort); +GLAPI void APIENTRY glVertexAttrib1svARB (GLuint, const GLshort *); +GLAPI void APIENTRY glVertexAttrib2dARB (GLuint, GLdouble, GLdouble); +GLAPI void APIENTRY glVertexAttrib2dvARB (GLuint, const GLdouble *); +GLAPI void APIENTRY glVertexAttrib2fARB (GLuint, GLfloat, GLfloat); +GLAPI void APIENTRY glVertexAttrib2fvARB (GLuint, const GLfloat *); +GLAPI void APIENTRY glVertexAttrib2sARB (GLuint, GLshort, GLshort); +GLAPI void APIENTRY glVertexAttrib2svARB (GLuint, const GLshort *); +GLAPI void APIENTRY glVertexAttrib3dARB (GLuint, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glVertexAttrib3dvARB (GLuint, const GLdouble *); +GLAPI void APIENTRY glVertexAttrib3fARB (GLuint, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glVertexAttrib3fvARB (GLuint, const GLfloat *); +GLAPI void APIENTRY glVertexAttrib3sARB (GLuint, GLshort, GLshort, GLshort); +GLAPI void APIENTRY glVertexAttrib3svARB (GLuint, const GLshort *); +GLAPI void APIENTRY glVertexAttrib4NbvARB (GLuint, const GLbyte *); +GLAPI void APIENTRY glVertexAttrib4NivARB (GLuint, const GLint *); +GLAPI void APIENTRY glVertexAttrib4NsvARB (GLuint, const GLshort *); +GLAPI void APIENTRY glVertexAttrib4NubARB (GLuint, GLubyte, GLubyte, GLubyte, GLubyte); +GLAPI void APIENTRY glVertexAttrib4NubvARB (GLuint, const GLubyte *); +GLAPI void APIENTRY glVertexAttrib4NuivARB (GLuint, const GLuint *); +GLAPI void APIENTRY glVertexAttrib4NusvARB (GLuint, const GLushort *); +GLAPI void APIENTRY glVertexAttrib4bvARB (GLuint, const GLbyte *); +GLAPI void APIENTRY glVertexAttrib4dARB (GLuint, GLdouble, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glVertexAttrib4dvARB (GLuint, const GLdouble *); +GLAPI void APIENTRY glVertexAttrib4fARB (GLuint, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glVertexAttrib4fvARB (GLuint, const GLfloat *); +GLAPI void APIENTRY glVertexAttrib4ivARB (GLuint, const GLint *); +GLAPI void APIENTRY glVertexAttrib4sARB (GLuint, GLshort, GLshort, GLshort, GLshort); +GLAPI void APIENTRY glVertexAttrib4svARB (GLuint, const GLshort *); +GLAPI void APIENTRY glVertexAttrib4ubvARB (GLuint, const GLubyte *); +GLAPI void APIENTRY glVertexAttrib4uivARB (GLuint, const GLuint *); +GLAPI void APIENTRY glVertexAttrib4usvARB (GLuint, const GLushort *); +GLAPI void APIENTRY glVertexAttribPointerARB (GLuint, GLint, GLenum, GLboolean, GLsizei, const GLvoid *); +GLAPI void APIENTRY glEnableVertexAttribArrayARB (GLuint); +GLAPI void APIENTRY glDisableVertexAttribArrayARB (GLuint); +GLAPI void APIENTRY glProgramStringARB (GLenum, GLenum, GLsizei, const GLvoid *); +GLAPI void APIENTRY glBindProgramARB (GLenum, GLuint); +GLAPI void APIENTRY glDeleteProgramsARB (GLsizei, const GLuint *); +GLAPI void APIENTRY glGenProgramsARB (GLsizei, GLuint *); +GLAPI void APIENTRY glProgramEnvParameter4dARB (GLenum, GLuint, GLdouble, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glProgramEnvParameter4dvARB (GLenum, GLuint, const GLdouble *); +GLAPI void APIENTRY glProgramEnvParameter4fARB (GLenum, GLuint, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glProgramEnvParameter4fvARB (GLenum, GLuint, const GLfloat *); +GLAPI void APIENTRY glProgramLocalParameter4dARB (GLenum, GLuint, GLdouble, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glProgramLocalParameter4dvARB (GLenum, GLuint, const GLdouble *); +GLAPI void APIENTRY glProgramLocalParameter4fARB (GLenum, GLuint, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glProgramLocalParameter4fvARB (GLenum, GLuint, const GLfloat *); +GLAPI void APIENTRY glGetProgramEnvParameterdvARB (GLenum, GLuint, GLdouble *); +GLAPI void APIENTRY glGetProgramEnvParameterfvARB (GLenum, GLuint, GLfloat *); +GLAPI void APIENTRY glGetProgramLocalParameterdvARB (GLenum, GLuint, GLdouble *); +GLAPI void APIENTRY glGetProgramLocalParameterfvARB (GLenum, GLuint, GLfloat *); +GLAPI void APIENTRY glGetProgramivARB (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetProgramStringARB (GLenum, GLenum, GLvoid *); +GLAPI void APIENTRY glGetVertexAttribdvARB (GLuint, GLenum, GLdouble *); +GLAPI void APIENTRY glGetVertexAttribfvARB (GLuint, GLenum, GLfloat *); +GLAPI void APIENTRY glGetVertexAttribivARB (GLuint, GLenum, GLint *); +GLAPI void APIENTRY glGetVertexAttribPointervARB (GLuint, GLenum, GLvoid* *); +GLAPI GLboolean APIENTRY glIsProgramARB (GLuint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLVERTEXATTRIB1DARBPROC) (GLuint index, GLdouble x); +typedef void (APIENTRY * PFNGLVERTEXATTRIB1DVARBPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRY * PFNGLVERTEXATTRIB1FARBPROC) (GLuint index, GLfloat x); +typedef void (APIENTRY * PFNGLVERTEXATTRIB1FVARBPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRY * PFNGLVERTEXATTRIB1SARBPROC) (GLuint index, GLshort x); +typedef void (APIENTRY * PFNGLVERTEXATTRIB1SVARBPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRY * PFNGLVERTEXATTRIB2DARBPROC) (GLuint index, GLdouble x, GLdouble y); +typedef void (APIENTRY * PFNGLVERTEXATTRIB2DVARBPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRY * PFNGLVERTEXATTRIB2FARBPROC) (GLuint index, GLfloat x, GLfloat y); +typedef void (APIENTRY * PFNGLVERTEXATTRIB2FVARBPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRY * PFNGLVERTEXATTRIB2SARBPROC) (GLuint index, GLshort x, GLshort y); +typedef void (APIENTRY * PFNGLVERTEXATTRIB2SVARBPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRY * PFNGLVERTEXATTRIB3DARBPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRY * PFNGLVERTEXATTRIB3DVARBPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRY * PFNGLVERTEXATTRIB3FARBPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRY * PFNGLVERTEXATTRIB3FVARBPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRY * PFNGLVERTEXATTRIB3SARBPROC) (GLuint index, GLshort x, GLshort y, GLshort z); +typedef void (APIENTRY * PFNGLVERTEXATTRIB3SVARBPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRY * PFNGLVERTEXATTRIB4NBVARBPROC) (GLuint index, const GLbyte *v); +typedef void (APIENTRY * PFNGLVERTEXATTRIB4NIVARBPROC) (GLuint index, const GLint *v); +typedef void (APIENTRY * PFNGLVERTEXATTRIB4NSVARBPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRY * PFNGLVERTEXATTRIB4NUBARBPROC) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); +typedef void (APIENTRY * PFNGLVERTEXATTRIB4NUBVARBPROC) (GLuint index, const GLubyte *v); +typedef void (APIENTRY * PFNGLVERTEXATTRIB4NUIVARBPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRY * PFNGLVERTEXATTRIB4NUSVARBPROC) (GLuint index, const GLushort *v); +typedef void (APIENTRY * PFNGLVERTEXATTRIB4BVARBPROC) (GLuint index, const GLbyte *v); +typedef void (APIENTRY * PFNGLVERTEXATTRIB4DARBPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRY * PFNGLVERTEXATTRIB4DVARBPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRY * PFNGLVERTEXATTRIB4FARBPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRY * PFNGLVERTEXATTRIB4FVARBPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRY * PFNGLVERTEXATTRIB4IVARBPROC) (GLuint index, const GLint *v); +typedef void (APIENTRY * PFNGLVERTEXATTRIB4SARBPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); +typedef void (APIENTRY * PFNGLVERTEXATTRIB4SVARBPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRY * PFNGLVERTEXATTRIB4UBVARBPROC) (GLuint index, const GLubyte *v); +typedef void (APIENTRY * PFNGLVERTEXATTRIB4UIVARBPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRY * PFNGLVERTEXATTRIB4USVARBPROC) (GLuint index, const GLushort *v); +typedef void (APIENTRY * PFNGLVERTEXATTRIBPOINTERARBPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer); +typedef void (APIENTRY * PFNGLENABLEVERTEXATTRIBARRAYARBPROC) (GLuint index); +typedef void (APIENTRY * PFNGLDISABLEVERTEXATTRIBARRAYARBPROC) (GLuint index); +typedef void (APIENTRY * PFNGLPROGRAMSTRINGARBPROC) (GLenum target, GLenum format, GLsizei len, const GLvoid *string); +typedef void (APIENTRY * PFNGLBINDPROGRAMARBPROC) (GLenum target, GLuint program); +typedef void (APIENTRY * PFNGLDELETEPROGRAMSARBPROC) (GLsizei n, const GLuint *programs); +typedef void (APIENTRY * PFNGLGENPROGRAMSARBPROC) (GLsizei n, GLuint *programs); +typedef void (APIENTRY * PFNGLPROGRAMENVPARAMETER4DARBPROC) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRY * PFNGLPROGRAMENVPARAMETER4DVARBPROC) (GLenum target, GLuint index, const GLdouble *params); +typedef void (APIENTRY * PFNGLPROGRAMENVPARAMETER4FARBPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRY * PFNGLPROGRAMENVPARAMETER4FVARBPROC) (GLenum target, GLuint index, const GLfloat *params); +typedef void (APIENTRY * PFNGLPROGRAMLOCALPARAMETER4DARBPROC) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRY * PFNGLPROGRAMLOCALPARAMETER4DVARBPROC) (GLenum target, GLuint index, const GLdouble *params); +typedef void (APIENTRY * PFNGLPROGRAMLOCALPARAMETER4FARBPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRY * PFNGLPROGRAMLOCALPARAMETER4FVARBPROC) (GLenum target, GLuint index, const GLfloat *params); +typedef void (APIENTRY * PFNGLGETPROGRAMENVPARAMETERDVARBPROC) (GLenum target, GLuint index, GLdouble *params); +typedef void (APIENTRY * PFNGLGETPROGRAMENVPARAMETERFVARBPROC) (GLenum target, GLuint index, GLfloat *params); +typedef void (APIENTRY * PFNGLGETPROGRAMLOCALPARAMETERDVARBPROC) (GLenum target, GLuint index, GLdouble *params); +typedef void (APIENTRY * PFNGLGETPROGRAMLOCALPARAMETERFVARBPROC) (GLenum target, GLuint index, GLfloat *params); +typedef void (APIENTRY * PFNGLGETPROGRAMIVARBPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRY * PFNGLGETPROGRAMSTRINGARBPROC) (GLenum target, GLenum pname, GLvoid *string); +typedef void (APIENTRY * PFNGLGETVERTEXATTRIBDVARBPROC) (GLuint index, GLenum pname, GLdouble *params); +typedef void (APIENTRY * PFNGLGETVERTEXATTRIBFVARBPROC) (GLuint index, GLenum pname, GLfloat *params); +typedef void (APIENTRY * PFNGLGETVERTEXATTRIBIVARBPROC) (GLuint index, GLenum pname, GLint *params); +typedef void (APIENTRY * PFNGLGETVERTEXATTRIBPOINTERVARBPROC) (GLuint index, GLenum pname, GLvoid* *pointer); +typedef GLboolean (APIENTRY * PFNGLISPROGRAMARBPROC) (GLuint program); +#endif + #ifndef GL_EXT_abgr #define GL_EXT_abgr 1 #endif @@ -3762,9 +4122,15 @@ typedef void (APIENTRY * PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3F #define GL_EXT_blend_func_separate 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glBlendFuncSeparateEXT (GLenum, GLenum, GLenum, GLenum); -GLAPI void APIENTRY glBlendFuncSeparateINGR (GLenum, GLenum, GLenum, GLenum); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRY * PFNGLBLENDFUNCSEPARATEEXTPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); +#endif + +#ifndef GL_INGR_blend_func_separate +#define GL_INGR_blend_func_separate 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBlendFuncSeparateINGR (GLenum, GLenum, GLenum, GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRY * PFNGLBLENDFUNCSEPARATEINGRPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); #endif @@ -4642,6 +5008,14 @@ typedef void (APIENTRY * PFNGLPOINTPARAMETERIVNVPROC) (GLenum pname, const GLint #define GL_EXT_shadow_funcs 1 #endif +#ifndef GL_EXT_stencil_two_side +#define GL_EXT_stencil_two_side 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glActiveStencilFaceEXT (GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLACTIVESTENCILFACEEXTPROC) (GLenum face); +#endif + #ifdef __cplusplus } diff --git a/xc/extras/Mesa/src/X/fakeglx.c b/xc/extras/Mesa/src/X/fakeglx.c index d900c0c10..0ffd0596a 100644 --- a/xc/extras/Mesa/src/X/fakeglx.c +++ b/xc/extras/Mesa/src/X/fakeglx.c @@ -1,7 +1,7 @@ /* * Mesa 3-D graphics library - * Version: 4.0.3 + * Version: 4.0.4 * * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. * @@ -65,7 +65,7 @@ #define SERVER_MINOR_VERSION 4 /* This is appended onto the glXGetClient/ServerString version strings. */ -#define MESA_GLX_VERSION "Mesa 4.0.3" +#define MESA_GLX_VERSION "Mesa 4.0.4" /* Who implemented this GLX? */ #define VENDOR "Brian Paul" @@ -2476,6 +2476,34 @@ Fake_glXSet3DfxModeMESA( int mode ) +/*** AGP memory allocation ***/ +static void * +Fake_glXAllocateMemoryNV( GLsizei size, + GLfloat readFrequency, + GLfloat writeFrequency, + GLfloat priority ) +{ + (void) size; + (void) readFrequency; + (void) writeFrequency; + (void) priority; + return NULL; +} + + +static void +Fake_glXFreeMemoryNV( GLvoid *pointer ) +{ + (void) pointer; +} + + +static GLuint +Fake_glXGetAGPOffsetMESA( const GLvoid *pointer ) +{ + return ~0; +} + extern struct _glxapi_table *_mesa_GetGLXDispatchTable(void); struct _glxapi_table *_mesa_GetGLXDispatchTable(void) @@ -2614,5 +2642,10 @@ struct _glxapi_table *_mesa_GetGLXDispatchTable(void) /*** GLX_MESA_set_3dfx_mode ***/ glx.Set3DfxModeMESA = Fake_glXSet3DfxModeMESA; + /*** GLX AGP memory allocation ***/ + glx.AllocateMemoryNV = Fake_glXAllocateMemoryNV; + glx.FreeMemoryNV = Fake_glXFreeMemoryNV; + glx.GetAGPOffsetMESA = Fake_glXGetAGPOffsetMESA; + return &glx; } diff --git a/xc/extras/Mesa/src/X/glxapi.c b/xc/extras/Mesa/src/X/glxapi.c index 4ddd7a92e..33b6eb416 100644 --- a/xc/extras/Mesa/src/X/glxapi.c +++ b/xc/extras/Mesa/src/X/glxapi.c @@ -1,9 +1,9 @@ /* * Mesa 3-D graphics library - * Version: 4.0.2 + * Version: 4.0.4 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -988,6 +988,49 @@ Bool glXSet3DfxModeMESA(int mode) +/*** GLX_NV_vertex_array_range ***/ + +void * +glXAllocateMemoryNV( GLsizei size, + GLfloat readFrequency, + GLfloat writeFrequency, + GLfloat priority ) +{ + struct _glxapi_table *t; + Display *dpy = glXGetCurrentDisplay(); + GET_DISPATCH(dpy, t); + if (!t) + return NULL; + return (t->AllocateMemoryNV)(size, readFrequency, writeFrequency, priority); +} + + +void +glXFreeMemoryNV( GLvoid *pointer ) +{ + struct _glxapi_table *t; + Display *dpy = glXGetCurrentDisplay(); + GET_DISPATCH(dpy, t); + if (!t) + return; + (t->FreeMemoryNV)(pointer); +} + + +/*** GLX_MESA_agp_offset */ + +GLuint +glXGetAGPOffsetMESA( const GLvoid *pointer ) +{ + struct _glxapi_table *t; + Display *dpy = glXGetCurrentDisplay(); + GET_DISPATCH(dpy, t); + if (!t) + return ~0; + return (t->GetAGPOffsetMESA)(pointer); +} + + /**********************************************************************/ /* GLX API management functions */ /**********************************************************************/ @@ -1197,6 +1240,10 @@ static struct name_address_pair GLX_functions[] = { /*** GLX_ARB_get_proc_address ***/ { "glXGetProcAddressARB", (GLvoid *) glXGetProcAddressARB }, + /*** GLX AGP memory allocation ***/ + { "glXAllocateMemoryNV", (GLvoid *) glXAllocateMemoryNV }, + { "glXFreeMemoryNV", (GLvoid *) glXFreeMemoryNV }, + { NULL, NULL } /* end of list */ }; diff --git a/xc/extras/Mesa/src/X/glxapi.h b/xc/extras/Mesa/src/X/glxapi.h index 31e257e6f..417f6987e 100644 --- a/xc/extras/Mesa/src/X/glxapi.h +++ b/xc/extras/Mesa/src/X/glxapi.h @@ -1,9 +1,9 @@ /* * Mesa 3-D graphics library - * Version: 4.0.2 + * Version: 4.0.4 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -195,6 +195,13 @@ struct _glxapi_table { /*** GLX_MESA_set_3dfx_mode ***/ Bool (*Set3DfxModeMESA)(int mode); + /*** GLX AGP functions ***/ + void * (*AllocateMemoryNV)( GLsizei size, + GLfloat readFrequency, + GLfloat writeFrequency, + GLfloat priority ); + void (*FreeMemoryNV)( GLvoid *pointer ); + GLuint (*GetAGPOffsetMESA)( const GLvoid *pointer ); }; diff --git a/xc/extras/Mesa/src/X/realglx.c b/xc/extras/Mesa/src/X/realglx.c index c1ea49afd..8e018ac45 100644 --- a/xc/extras/Mesa/src/X/realglx.c +++ b/xc/extras/Mesa/src/X/realglx.c @@ -1,9 +1,9 @@ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.0.4 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -169,5 +169,9 @@ _real_GetGLXDispatchTable(void) /*** GLX_MESA_set_3dfx_mode ***/ glx.Set3DfxModeMESA = _real_glXSet3DfxModeMESA; + /*** GLX AGP memory allocation ***/ + glx.AllocateMemoryNV = _real_glXAllocateMemoryNV; + glx.FreeMemoryNV = _real_glXFreeMemoryNV; + return &glx; } diff --git a/xc/extras/Mesa/src/X/realglx.h b/xc/extras/Mesa/src/X/realglx.h index 05f46f547..db863427b 100644 --- a/xc/extras/Mesa/src/X/realglx.h +++ b/xc/extras/Mesa/src/X/realglx.h @@ -311,4 +311,21 @@ _real_glXCopySubBufferMESA( Display *dpy, GLXDrawable drawable, int x, int y, int width, int height ); #endif + +#ifdef GLX_NV_vertex_array_range +extern void * +_real_glXAllocateMemoryNV( GLsizei size, GLfloat readFrequency, + GLfloat writeFrequency, GLfloat priority ); + + +extern void +_real_glXFreeMemoryNV( GLvoid *pointer ); +#endif + +#ifdef GLX_MESA_agp_offset +extern GLuint +_real_glXGetAGPOffset( const GLvoid *pointer ); +#endif + + #endif /* REALGLX_H */ diff --git a/xc/extras/Mesa/src/X86/common_x86_asm.S b/xc/extras/Mesa/src/X86/common_x86_asm.S index 2de2d73fb..841463acc 100644 --- a/xc/extras/Mesa/src/X86/common_x86_asm.S +++ b/xc/extras/Mesa/src/X86/common_x86_asm.S @@ -76,6 +76,7 @@ GLOBL GLNAME( _mesa_identify_x86_cpu_features ) GLNAME( _mesa_identify_x86_cpu_features ): PUSH_L ( EBX ) + PUSH_L ( ESI ) /* Test for the CPUID command. If the ID Flag bit in EFLAGS * (bit 21) is writable, the CPUID command is present. @@ -171,6 +172,7 @@ LLBL(cpuid_failed): LLBL (cpuid_done): + POP_L ( ESI ) POP_L ( EBX ) RET diff --git a/xc/extras/Mesa/src/attrib.c b/xc/extras/Mesa/src/attrib.c index f86632393..636c33ee5 100644 --- a/xc/extras/Mesa/src/attrib.c +++ b/xc/extras/Mesa/src/attrib.c @@ -1,7 +1,7 @@ /* * Mesa 3-D graphics library - * Version: 4.0.3 + * Version: 4.0.4 * * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. * @@ -352,6 +352,8 @@ _mesa_PushAttrib(GLbitfield mask) attr->Unit[u].Current3D); _mesa_copy_texture_object(&attr->Unit[u].SavedCubeMap, attr->Unit[u].CurrentCubeMap); + _mesa_copy_texture_object(&attr->Unit[u].SavedRect, + attr->Unit[u].CurrentRect); } newnode = new_attrib_node( GL_TEXTURE_BIT ); newnode->data = attr; @@ -518,6 +520,12 @@ pop_enable_group(GLcontext *ctx, const struct gl_enable_attrib *enable) (GLboolean) (enable->Texture[i] & TEXTURE0_2D) ); (*ctx->Driver.Enable)( ctx, GL_TEXTURE_3D, (GLboolean) (enable->Texture[i] & TEXTURE0_3D) ); + if (ctx->Extensions.ARB_texture_cube_map) + (*ctx->Driver.Enable)( ctx, GL_TEXTURE_CUBE_MAP_ARB, + (GLboolean) (enable->Texture[i] & TEXTURE0_CUBE) ); + if (ctx->Extensions.NV_texture_rectangle) + (*ctx->Driver.Enable)( ctx, GL_TEXTURE_RECTANGLE_NV, + (GLboolean) (enable->Texture[i] & TEXTURE0_RECT) ); } } @@ -560,7 +568,7 @@ pop_texture_group(GLcontext *ctx, const struct gl_texture_attrib *texAttrib) for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { const struct gl_texture_unit *unit = &texAttrib->Unit[u]; - GLuint numObjs, i; + GLuint i; _mesa_ActiveTextureARB(GL_TEXTURE0_ARB + u); _mesa_set_enable(ctx, GL_TEXTURE_1D, @@ -573,6 +581,10 @@ pop_texture_group(GLcontext *ctx, const struct gl_texture_attrib *texAttrib) _mesa_set_enable(ctx, GL_TEXTURE_CUBE_MAP_ARB, (GLboolean) (unit->Enabled & TEXTURE0_CUBE ? GL_TRUE : GL_FALSE)); } + if (ctx->Extensions.NV_texture_rectangle) { + _mesa_set_enable(ctx, GL_TEXTURE_RECTANGLE_NV, + (GLboolean) (unit->Enabled & TEXTURE0_RECT ? GL_TRUE : GL_FALSE)); + } _mesa_TexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, unit->EnvMode); _mesa_TexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, unit->EnvColor); _mesa_TexGeni(GL_S, GL_TEXTURE_GEN_MODE, unit->GenModeS); @@ -628,9 +640,7 @@ pop_texture_group(GLcontext *ctx, const struct gl_texture_attrib *texAttrib) } /* Restore texture object state */ - numObjs = ctx->Extensions.ARB_texture_cube_map ? 4 : 3; - - for (i = 0; i < numObjs; i++) { + for (i = 0; i < NUM_TEXTURE_TARGETS; i++) { GLenum target = 0; const struct gl_texture_object *obj = NULL; GLfloat bordColor[4]; @@ -649,9 +659,17 @@ pop_texture_group(GLcontext *ctx, const struct gl_texture_attrib *texAttrib) obj = &unit->Saved3D; break; case 3: + if (!ctx->Extensions.ARB_texture_cube_map) + continue; target = GL_TEXTURE_CUBE_MAP_ARB; obj = &unit->SavedCubeMap; break; + case 4: + if (!ctx->Extensions.NV_texture_rectangle) + continue; + target = GL_TEXTURE_RECTANGLE_NV; + obj = &unit->SavedRect; + break; default: ; /* silence warnings */ } @@ -703,6 +721,7 @@ pop_texture_group(GLcontext *ctx, const struct gl_texture_attrib *texAttrib) ctx->Texture.Unit[u].Current2D->RefCount--; ctx->Texture.Unit[u].Current3D->RefCount--; ctx->Texture.Unit[u].CurrentCubeMap->RefCount--; + ctx->Texture.Unit[u].CurrentRect->RefCount--; } } diff --git a/xc/extras/Mesa/src/config.c b/xc/extras/Mesa/src/config.c index 8157964f4..9975fb326 100644 --- a/xc/extras/Mesa/src/config.c +++ b/xc/extras/Mesa/src/config.c @@ -1,9 +1,9 @@ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.0.4 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -72,7 +72,7 @@ static void print_list( struct cnode *n, int indent ) print_list( n->data.l.head, indent + 2 ); break; case word_t: - printf( n->data.l.head->data.w.text ); + printf( "%s", n->data.l.head->data.w.text ); break; case nil_t: printf("()"); @@ -268,17 +268,17 @@ static void fx_catch_signals( GLcontext *ctx, struct cnode *args ) * Should environment vars override config vars? */ -struct var { - struct var *next, *prev; +struct configvar { + struct configvar *next, *prev; const char *name; void (*notify)(const char *value, int line); }; -static struct var varlist = { &varlist, &varlist, 0, 0 }; +static struct configvar varlist = { &varlist, &varlist, 0, 0 }; static void set_var( GLcontext *ctx, struct cnode *args ) { - struct var *v; + struct configvar *v; struct cnode *head, *tail; const char *variable, *value; @@ -306,7 +306,7 @@ void _mesa_register_config_var(const char *name, void (*notify)( const char *, int )) { - struct var *v = MALLOC_STRUCT(var); + struct configvar *v = MALLOC_STRUCT(configvar); v->name = name; v->notify = notify; insert_at_tail( &varlist, v ); diff --git a/xc/extras/Mesa/src/config.h b/xc/extras/Mesa/src/config.h index 97a832c74..f65114aca 100644 --- a/xc/extras/Mesa/src/config.h +++ b/xc/extras/Mesa/src/config.h @@ -1,9 +1,9 @@ /* * Mesa 3-D graphics library - * Version: 4.0.1 + * Version: 4.0.4 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -107,8 +107,11 @@ /* Number of cube texture mipmap levels */ #define MAX_CUBE_TEXTURE_LEVELS 12 +/* Maximum rectangular texture size - GL_NV_texture_rectangle */ +#define MAX_TEXTURE_RECT_SIZE 2048 + /* Number of texture units - GL_ARB_multitexture */ -#define MAX_TEXTURE_UNITS 8 +#define MAX_TEXTURE_UNITS 6 /* Maximum viewport/image size: */ #define MAX_WIDTH 2048 diff --git a/xc/extras/Mesa/src/context.c b/xc/extras/Mesa/src/context.c index bc2fef813..35d3a9d78 100644 --- a/xc/extras/Mesa/src/context.c +++ b/xc/extras/Mesa/src/context.c @@ -1,7 +1,7 @@ /* * Mesa 3-D graphics library - * Version: 4.0.3 + * Version: 4.0.4 * * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. * @@ -490,26 +490,33 @@ alloc_shared_state( void ) /* Default Texture objects */ outOfMemory = GL_FALSE; - ss->Default1D = _mesa_alloc_texture_object(ss, 0, 1); + ss->Default1D = _mesa_alloc_texture_object(ss, 0, GL_TEXTURE_1D); if (!ss->Default1D) { outOfMemory = GL_TRUE; } - ss->Default2D = _mesa_alloc_texture_object(ss, 0, 2); + ss->Default2D = _mesa_alloc_texture_object(ss, 0, GL_TEXTURE_2D); if (!ss->Default2D) { outOfMemory = GL_TRUE; } - ss->Default3D = _mesa_alloc_texture_object(ss, 0, 3); + ss->Default3D = _mesa_alloc_texture_object(ss, 0, GL_TEXTURE_3D); if (!ss->Default3D) { outOfMemory = GL_TRUE; } - ss->DefaultCubeMap = _mesa_alloc_texture_object(ss, 0, 6); + ss->DefaultCubeMap = _mesa_alloc_texture_object(ss, 0, + GL_TEXTURE_CUBE_MAP_ARB); if (!ss->DefaultCubeMap) { outOfMemory = GL_TRUE; } + ss->DefaultRect = _mesa_alloc_texture_object(ss, 0, + GL_TEXTURE_RECTANGLE_NV); + if (!ss->DefaultRect) { + outOfMemory = GL_TRUE; + } + if (!ss->DisplayList || !ss->TexObjects || outOfMemory) { /* Ran out of memory at some point. Free everything and return NULL */ if (ss->DisplayList) @@ -524,6 +531,8 @@ alloc_shared_state( void ) _mesa_free_texture_object(ss, ss->Default3D); if (ss->DefaultCubeMap) _mesa_free_texture_object(ss, ss->DefaultCubeMap); + if (ss->DefaultRect) + _mesa_free_texture_object(ss, ss->DefaultRect); FREE(ss); return NULL; } @@ -670,6 +679,7 @@ init_texture_unit( GLcontext *ctx, GLuint unit ) texUnit->Current2D = ctx->Shared->Default2D; texUnit->Current3D = ctx->Shared->Default3D; texUnit->CurrentCubeMap = ctx->Shared->DefaultCubeMap; + texUnit->CurrentRect = ctx->Shared->DefaultRect; } @@ -727,6 +737,7 @@ init_attrib_groups( GLcontext *ctx ) ctx->Const.MaxTextureLevels = MAX_TEXTURE_LEVELS; ctx->Const.Max3DTextureLevels = MAX_3D_TEXTURE_LEVELS; ctx->Const.MaxCubeTextureLevels = MAX_CUBE_TEXTURE_LEVELS; + ctx->Const.MaxTextureRectSize = MAX_TEXTURE_RECT_SIZE; ctx->Const.MaxTextureUnits = MAX_TEXTURE_UNITS; ctx->Const.MaxTextureMaxAnisotropy = MAX_TEXTURE_MAX_ANISOTROPY; ctx->Const.MaxTextureLodBias = MAX_TEXTURE_LOD_BIAS; @@ -1082,7 +1093,6 @@ init_attrib_groups( GLcontext *ctx ) ctx->Point.MinSize = 0.0; ctx->Point.MaxSize = ctx->Const.MaxPointSize; ctx->Point.Threshold = 1.0; - ctx->Point.SpriteMode = GL_FALSE; /* GL_MESA_sprite_point */ /* Polygon group */ ctx->Polygon.CullFlag = GL_FALSE; @@ -1312,25 +1322,25 @@ alloc_proxy_textures( GLcontext *ctx ) GLboolean out_of_memory; GLint i; - ctx->Texture.Proxy1D = _mesa_alloc_texture_object(NULL, 0, 1); + ctx->Texture.Proxy1D = _mesa_alloc_texture_object(NULL, 0, GL_TEXTURE_1D); if (!ctx->Texture.Proxy1D) { return GL_FALSE; } - ctx->Texture.Proxy2D = _mesa_alloc_texture_object(NULL, 0, 2); + ctx->Texture.Proxy2D = _mesa_alloc_texture_object(NULL, 0, GL_TEXTURE_2D); if (!ctx->Texture.Proxy2D) { _mesa_free_texture_object(NULL, ctx->Texture.Proxy1D); return GL_FALSE; } - ctx->Texture.Proxy3D = _mesa_alloc_texture_object(NULL, 0, 3); + ctx->Texture.Proxy3D = _mesa_alloc_texture_object(NULL, 0, GL_TEXTURE_3D); if (!ctx->Texture.Proxy3D) { _mesa_free_texture_object(NULL, ctx->Texture.Proxy1D); _mesa_free_texture_object(NULL, ctx->Texture.Proxy2D); return GL_FALSE; } - ctx->Texture.ProxyCubeMap = _mesa_alloc_texture_object(NULL, 0, 6); + ctx->Texture.ProxyCubeMap = _mesa_alloc_texture_object(NULL, 0, GL_TEXTURE_CUBE_MAP_ARB); if (!ctx->Texture.ProxyCubeMap) { _mesa_free_texture_object(NULL, ctx->Texture.Proxy1D); _mesa_free_texture_object(NULL, ctx->Texture.Proxy2D); @@ -1338,16 +1348,27 @@ alloc_proxy_textures( GLcontext *ctx ) return GL_FALSE; } + ctx->Texture.ProxyRect = _mesa_alloc_texture_object(NULL, 0, GL_TEXTURE_RECTANGLE_NV); + if (!ctx->Texture.ProxyRect) { + _mesa_free_texture_object(NULL, ctx->Texture.Proxy1D); + _mesa_free_texture_object(NULL, ctx->Texture.Proxy2D); + _mesa_free_texture_object(NULL, ctx->Texture.Proxy3D); + _mesa_free_texture_object(NULL, ctx->Texture.ProxyCubeMap); + return GL_FALSE; + } + out_of_memory = GL_FALSE; for (i=0;i<MAX_TEXTURE_LEVELS;i++) { ctx->Texture.Proxy1D->Image[i] = _mesa_alloc_texture_image(); ctx->Texture.Proxy2D->Image[i] = _mesa_alloc_texture_image(); ctx->Texture.Proxy3D->Image[i] = _mesa_alloc_texture_image(); ctx->Texture.ProxyCubeMap->Image[i] = _mesa_alloc_texture_image(); + ctx->Texture.ProxyRect->Image[i] = _mesa_alloc_texture_image(); if (!ctx->Texture.Proxy1D->Image[i] || !ctx->Texture.Proxy2D->Image[i] || !ctx->Texture.Proxy3D->Image[i] - || !ctx->Texture.ProxyCubeMap->Image[i]) { + || !ctx->Texture.ProxyCubeMap->Image[i] + || !ctx->Texture.ProxyRect->Image[i]) { out_of_memory = GL_TRUE; } } @@ -1365,11 +1386,15 @@ alloc_proxy_textures( GLcontext *ctx ) if (ctx->Texture.ProxyCubeMap->Image[i]) { _mesa_free_texture_image(ctx->Texture.ProxyCubeMap->Image[i]); } + if (ctx->Texture.ProxyRect->Image[i]) { + _mesa_free_texture_image(ctx->Texture.ProxyRect->Image[i]); + } } _mesa_free_texture_object(NULL, ctx->Texture.Proxy1D); _mesa_free_texture_object(NULL, ctx->Texture.Proxy2D); _mesa_free_texture_object(NULL, ctx->Texture.Proxy3D); _mesa_free_texture_object(NULL, ctx->Texture.ProxyCubeMap); + _mesa_free_texture_object(NULL, ctx->Texture.ProxyRect); return GL_FALSE; } else { @@ -1467,6 +1492,7 @@ _mesa_initialize_context( GLcontext *ctx, ctx->Shared->Default2D->RefCount += MAX_TEXTURE_UNITS; ctx->Shared->Default3D->RefCount += MAX_TEXTURE_UNITS; ctx->Shared->DefaultCubeMap->RefCount += MAX_TEXTURE_UNITS; + ctx->Shared->DefaultRect->RefCount += MAX_TEXTURE_UNITS; init_attrib_groups( ctx ); @@ -1550,36 +1576,6 @@ _mesa_initialize_context( GLcontext *ctx, } ctx->MRD = 1.0; /* Minimum resolvable depth value, for polygon offset */ - -#if defined(MESA_TRACE) - ctx->TraceCtx = (trace_context_t *) CALLOC( sizeof(trace_context_t) ); -#if 0 - /* Brian: do you want to have CreateContext fail here, - or should we just trap in NewTrace (currently done)? */ - if (!(ctx->TraceCtx)) { - free_shared_state(ctx, ctx->Shared); - FREE( ctx->Exec ); - FREE( ctx->Save ); - return GL_FALSE; - } -#endif - trInitContext(ctx->TraceCtx); - - ctx->TraceDispatch = (struct _glapi_table *) - CALLOC(dispatchSize * sizeof(void*)); -#if 0 - if (!(ctx->TraceCtx)) { - free_shared_state(ctx, ctx->Shared); - FREE( ctx->Exec ); - FREE( ctx->Save ); - FREE( ctx->TraceCtx ); - return GL_FALSE; - } -#endif - trInitDispatch(ctx->TraceDispatch); -#endif - - if (getenv("MESA_DEBUG")) add_debug_flags(getenv("MESA_DEBUG")); @@ -1676,6 +1672,7 @@ _mesa_free_context_data( GLcontext *ctx ) _mesa_free_texture_object( NULL, ctx->Texture.Proxy2D ); _mesa_free_texture_object( NULL, ctx->Texture.Proxy3D ); _mesa_free_texture_object( NULL, ctx->Texture.ProxyCubeMap ); + _mesa_free_texture_object( NULL, ctx->Texture.ProxyRect ); /* Free evaluator data */ if (ctx->EvalMap.Map1Vertex3.Points) diff --git a/xc/extras/Mesa/src/enable.c b/xc/extras/Mesa/src/enable.c index de93fc03f..8c848d986 100644 --- a/xc/extras/Mesa/src/enable.c +++ b/xc/extras/Mesa/src/enable.c @@ -1,7 +1,7 @@ /* * Mesa 3-D graphics library - * Version: 4.0.2 + * Version: 4.0.4 * * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. * @@ -792,7 +792,7 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) ctx->Multisample.SampleCoverageInvert = state; break; - /* GL_IBM_rasterpos_clip */ + /* GL_IBM_rasterpos_clip */ case GL_RASTER_POSITION_UNCLIPPED_IBM: if (!ctx->Extensions.IBM_rasterpos_clip) { _mesa_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable"); @@ -804,21 +804,28 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) ctx->Transform.RasterPositionUnclipped = state; break; - /* GL_MESA_sprite_point */ - case GL_SPRITE_POINT_MESA: - if (!ctx->Extensions.MESA_sprite_point) { - _mesa_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable"); - return; + /* GL_NV_texture_rectangle */ + case GL_TEXTURE_RECTANGLE_NV: + { + const GLuint curr = ctx->Texture.CurrentUnit; + struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr]; + GLuint newenabled = texUnit->Enabled & ~TEXTURE0_RECT; + if (!ctx->Extensions.NV_texture_rectangle) { + _mesa_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable"); + return; + } + if (state) + newenabled |= TEXTURE0_RECT; + if (!ctx->Visual.rgbMode || texUnit->Enabled == newenabled) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texUnit->Enabled = newenabled; } - if (ctx->Point.SpriteMode == state) - return; - FLUSH_VERTICES(ctx, _NEW_POINT); - ctx->Point.SpriteMode = state; break; - default: - _mesa_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable"); - return; + default: + _mesa_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable"); + return; } if (ctx->Driver.Enable) { @@ -1116,9 +1123,17 @@ _mesa_IsEnabled( GLenum cap ) return GL_FALSE; } - /* GL_MESA_sprite_point */ - case GL_SPRITE_POINT_MESA: - return ctx->Point.SpriteMode; + /* GL_NV_texture_rectangle */ + case GL_TEXTURE_RECTANGLE_NV: + if (ctx->Extensions.NV_texture_rectangle) { + const struct gl_texture_unit *texUnit; + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + return (texUnit->Enabled & TEXTURE0_RECT) ? GL_TRUE : GL_FALSE; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, "glIsEnabled"); + return GL_FALSE; + } default: _mesa_error( ctx, GL_INVALID_ENUM, "glIsEnabled" ); diff --git a/xc/extras/Mesa/src/extensions.c b/xc/extras/Mesa/src/extensions.c index 422e22904..ce4e2af0a 100644 --- a/xc/extras/Mesa/src/extensions.c +++ b/xc/extras/Mesa/src/extensions.c @@ -1,9 +1,9 @@ /* * Mesa 3-D graphics library - * Version: 3.5.1 + * Version: 4.0.4 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -102,12 +102,14 @@ static struct { { ON, "GL_IBM_rasterpos_clip", F(IBM_rasterpos_clip) }, { OFF, "GL_IBM_texture_mirrored_repeat", F(ARB_texture_mirrored_repeat)}, { OFF, "GL_INGR_blend_func_separate", F(INGR_blend_func_separate) }, + { OFF, "GL_MESA_pack_invert", F(MESA_pack_invert) }, { OFF, "GL_MESA_packed_depth_stencil", 0 }, { OFF, "GL_MESA_resize_buffers", F(MESA_resize_buffers) }, - { OFF, "GL_MESA_sprite_point", F(MESA_sprite_point) }, + { OFF, "GL_MESA_ycbcr_texture", F(MESA_ycbcr_texture) }, { ON, "GL_MESA_window_pos", F(MESA_window_pos) }, { OFF, "GL_NV_blend_square", F(NV_blend_square) }, { ON, "GL_NV_texgen_reflection", F(NV_texgen_reflection) }, + { ON, "GL_NV_texture_rectangle", F(NV_texture_rectangle) }, { OFF, "GL_SGI_color_matrix", F(SGI_color_matrix) }, { OFF, "GL_SGI_color_table", F(SGI_color_table) }, { OFF, "GL_SGIS_generate_mipmap", F(SGIS_generate_mipmap) }, @@ -118,7 +120,8 @@ static struct { { OFF, "GL_SGIX_pixel_texture", F(SGIX_pixel_texture) }, { OFF, "GL_SGIX_shadow", F(SGIX_shadow) }, { OFF, "GL_SGIX_shadow_ambient", F(SGIX_shadow_ambient) }, - { OFF, "GL_3DFX_texture_compression_FXT1", F(_3DFX_texture_compression_FXT1) } + { OFF, "GL_3DFX_texture_compression_FXT1", F(_3DFX_texture_compression_FXT1) }, + { OFF, "GL_APPLE_client_storage", F(APPLE_client_storage) }, }; @@ -161,9 +164,12 @@ _mesa_enable_sw_extensions(GLcontext *ctx) "GL_HP_occlusion_test", "GL_IBM_texture_mirrored_repeat", "GL_INGR_blend_func_separate", + "GL_MESA_pack_invert", "GL_MESA_resize_buffers", + "GL_MESA_ycbcr_texture", "GL_NV_blend_square", "GL_NV_texgen_reflection", + "GL_NV_texture_rectangle", "GL_SGI_color_matrix", "GL_SGI_color_table", "GL_SGIS_generate_mipmap", diff --git a/xc/extras/Mesa/src/get.c b/xc/extras/Mesa/src/get.c index a80901b8c..0b4e21680 100644 --- a/xc/extras/Mesa/src/get.c +++ b/xc/extras/Mesa/src/get.c @@ -1,7 +1,7 @@ /* * Mesa 3-D graphics library - * Version: 4.0.3 + * Version: 4.0.4 * * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. * @@ -59,6 +59,42 @@ +/* Check if named extension is enabled, if not generate error and return */ + +#define CHECK_EXTENSION_B(EXTNAME, PNAME) \ + if (!ctx->Extensions.EXTNAME) { \ + char message[100]; \ + sprintf(message, "glGetBooleanv(0x%x)", (int) PNAME); \ + _mesa_error(ctx, GL_INVALID_VALUE, message); \ + return; \ + } + +#define CHECK_EXTENSION_I(EXTNAME, PNAME) \ + if (!ctx->Extensions.EXTNAME) { \ + char message[100]; \ + sprintf(message, "glGetIntegerv(0x%x)", (int) PNAME); \ + _mesa_error(ctx, GL_INVALID_VALUE, message); \ + return; \ + } + +#define CHECK_EXTENSION_F(EXTNAME, PNAME) \ + if (!ctx->Extensions.EXTNAME) { \ + char message[100]; \ + sprintf(message, "glGetFloatv(0x%x)", (int) PNAME); \ + _mesa_error(ctx, GL_INVALID_VALUE, message); \ + return; \ + } + +#define CHECK_EXTENSION_D(EXTNAME, PNAME) \ + if (!ctx->Extensions.EXTNAME) { \ + char message[100]; \ + sprintf(message, "glGetDoublev(0x%x)", (int) PNAME); \ + _mesa_error(ctx, GL_INVALID_VALUE, message); \ + return; \ + } + + + static GLenum pixel_texgen_mode(const GLcontext *ctx) { @@ -635,6 +671,9 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) case GL_PACK_IMAGE_HEIGHT_EXT: *params = ctx->Pack.ImageHeight; break; + case GL_PACK_INVERT_MESA: + *params = ctx->Pack.Invert; + break; case GL_PERSPECTIVE_CORRECTION_HINT: *params = ENUM_TO_BOOL(ctx->Hint.PerspectiveCorrection); break; @@ -1180,12 +1219,6 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) return; } break; - case GL_MAX_CONVOLUTION_WIDTH: - *params = INT_TO_BOOL(ctx->Const.MaxConvolutionWidth); - break; - case GL_MAX_CONVOLUTION_HEIGHT: - *params = INT_TO_BOOL(ctx->Const.MaxConvolutionHeight); - break; case GL_POST_CONVOLUTION_RED_SCALE_EXT: *params = FLOAT_TO_BOOL(ctx->Pixel.PostConvolutionScale[0]); break; @@ -1361,17 +1394,6 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) } break; - /* GL_MESA_sprite_point */ - case GL_SPRITE_POINT_MESA: - if (ctx->Extensions.MESA_sprite_point) { - *params = ctx->Point.SpriteMode; - } - else { - _mesa_error( ctx, GL_INVALID_ENUM, "glGetBooleanv" ); - return; - } - break; - /* GL_SGIS_generate_mipmap */ case GL_GENERATE_MIPMAP_HINT_SGIS: if (ctx->Extensions.SGIS_generate_mipmap) { @@ -1383,6 +1405,20 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) } break; + /* GL_NV_texture_rectangle */ + case GL_TEXTURE_RECTANGLE_NV: + CHECK_EXTENSION_B(NV_texture_rectangle, pname); + *params = _mesa_IsEnabled(GL_TEXTURE_RECTANGLE_NV); + break; + case GL_TEXTURE_BINDING_RECTANGLE_NV: + CHECK_EXTENSION_B(NV_texture_rectangle, pname); + *params = INT_TO_BOOL(textureUnit->CurrentRect->Name); + break; + case GL_MAX_RECTANGLE_TEXTURE_SIZE_NV: + CHECK_EXTENSION_B(NV_texture_rectangle, pname); + *params = INT_TO_BOOL(ctx->Const.MaxTextureRectSize); + break; + default: _mesa_error( ctx, GL_INVALID_ENUM, "glGetBooleanv" ); } @@ -1942,6 +1978,9 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) case GL_PACK_IMAGE_HEIGHT_EXT: *params = (GLdouble) ctx->Pack.ImageHeight; break; + case GL_PACK_INVERT_MESA: + *params = (GLdouble) ctx->Pack.Invert; + break; case GL_PERSPECTIVE_CORRECTION_HINT: *params = ENUM_TO_DOUBLE(ctx->Hint.PerspectiveCorrection); break; @@ -2484,12 +2523,6 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) return; } break; - case GL_MAX_CONVOLUTION_WIDTH: - *params = (GLdouble) ctx->Const.MaxConvolutionWidth; - break; - case GL_MAX_CONVOLUTION_HEIGHT: - *params = (GLdouble) ctx->Const.MaxConvolutionHeight; - break; case GL_POST_CONVOLUTION_RED_SCALE_EXT: *params = (GLdouble) ctx->Pixel.PostConvolutionScale[0]; break; @@ -2665,17 +2698,6 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) } break; - /* GL_MESA_sprite_point */ - case GL_SPRITE_POINT_MESA: - if (ctx->Extensions.MESA_sprite_point) { - *params = (GLdouble) ctx->Point.SpriteMode; - } - else { - _mesa_error( ctx, GL_INVALID_ENUM, "glGetDoublev" ); - return; - } - break; - /* GL_SGIS_generate_mipmap */ case GL_GENERATE_MIPMAP_HINT_SGIS: if (ctx->Extensions.SGIS_generate_mipmap) { @@ -2687,6 +2709,20 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) } break; + /* GL_NV_texture_rectangle */ + case GL_TEXTURE_RECTANGLE_NV: + CHECK_EXTENSION_D(NV_texture_rectangle, pname); + *params = (GLdouble) _mesa_IsEnabled(GL_TEXTURE_RECTANGLE_NV); + break; + case GL_TEXTURE_BINDING_RECTANGLE_NV: + CHECK_EXTENSION_D(NV_texture_rectangle, pname); + *params = (GLdouble) textureUnit->CurrentRect->Name; + break; + case GL_MAX_RECTANGLE_TEXTURE_SIZE_NV: + CHECK_EXTENSION_D(NV_texture_rectangle, pname); + *params = (GLdouble) ctx->Const.MaxTextureRectSize; + break; + default: _mesa_error( ctx, GL_INVALID_ENUM, "glGetDoublev" ); } @@ -3253,6 +3289,9 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) case GL_PACK_IMAGE_HEIGHT_EXT: *params = (GLfloat) ctx->Pack.ImageHeight; break; + case GL_PACK_INVERT_MESA: + *params = (GLfloat) ctx->Pack.Invert; + break; case GL_PERSPECTIVE_CORRECTION_HINT: *params = ENUM_TO_FLOAT(ctx->Hint.PerspectiveCorrection); break; @@ -3769,12 +3808,6 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) return; } break; - case GL_MAX_CONVOLUTION_WIDTH: - *params = (GLfloat) ctx->Const.MaxConvolutionWidth; - break; - case GL_MAX_CONVOLUTION_HEIGHT: - *params = (GLfloat) ctx->Const.MaxConvolutionHeight; - break; case GL_POST_CONVOLUTION_RED_SCALE_EXT: *params = ctx->Pixel.PostConvolutionScale[0]; break; @@ -3950,17 +3983,6 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) } break; - /* GL_MESA_sprite_point */ - case GL_SPRITE_POINT_MESA: - if (ctx->Extensions.MESA_sprite_point) { - *params = (GLfloat) ctx->Point.SpriteMode; - } - else { - GET_FLOAT_ERROR; - return; - } - break; - /* GL_SGIS_generate_mipmap */ case GL_GENERATE_MIPMAP_HINT_SGIS: if (ctx->Extensions.SGIS_generate_mipmap) { @@ -3972,7 +3994,21 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) } break; - default: + /* GL_NV_texture_rectangle */ + case GL_TEXTURE_RECTANGLE_NV: + CHECK_EXTENSION_F(NV_texture_rectangle, pname); + *params = (GLfloat) _mesa_IsEnabled(GL_TEXTURE_RECTANGLE_NV); + break; + case GL_TEXTURE_BINDING_RECTANGLE_NV: + CHECK_EXTENSION_F(NV_texture_rectangle, pname); + *params = (GLfloat) textureUnit->CurrentRect->Name; + break; + case GL_MAX_RECTANGLE_TEXTURE_SIZE_NV: + CHECK_EXTENSION_F(NV_texture_rectangle, pname); + *params = (GLfloat) ctx->Const.MaxTextureRectSize; + break; + + default: GET_FLOAT_ERROR; } } @@ -4533,6 +4569,9 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) case GL_PACK_IMAGE_HEIGHT_EXT: *params = ctx->Pack.ImageHeight; break; + case GL_PACK_INVERT_MESA: + *params = ctx->Pack.Invert; + break; case GL_PERSPECTIVE_CORRECTION_HINT: *params = (GLint) ctx->Hint.PerspectiveCorrection; break; @@ -5075,12 +5114,6 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) return; } break; - case GL_MAX_CONVOLUTION_WIDTH: - *params = ctx->Const.MaxConvolutionWidth; - break; - case GL_MAX_CONVOLUTION_HEIGHT: - *params = ctx->Const.MaxConvolutionHeight; - break; case GL_POST_CONVOLUTION_RED_SCALE_EXT: *params = (GLint) ctx->Pixel.PostConvolutionScale[0]; break; @@ -5277,17 +5310,6 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) } break; - /* GL_MESA_sprite_point */ - case GL_SPRITE_POINT_MESA: - if (ctx->Extensions.MESA_sprite_point) { - *params = (GLint) ctx->Point.SpriteMode; - } - else { - _mesa_error( ctx, GL_INVALID_ENUM, "glGetIntegerv" ); - return; - } - break; - /* GL_SGIS_generate_mipmap */ case GL_GENERATE_MIPMAP_HINT_SGIS: if (ctx->Extensions.SGIS_generate_mipmap) { @@ -5299,6 +5321,20 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) } break; + /* GL_NV_texture_rectangle */ + case GL_TEXTURE_RECTANGLE_NV: + CHECK_EXTENSION_I(NV_texture_rectangle, pname); + *params = (GLint) _mesa_IsEnabled(GL_TEXTURE_RECTANGLE_NV); + break; + case GL_TEXTURE_BINDING_RECTANGLE_NV: + CHECK_EXTENSION_I(NV_texture_rectangle, pname); + *params = (GLint) textureUnit->CurrentRect->Name; + break; + case GL_MAX_RECTANGLE_TEXTURE_SIZE_NV: + CHECK_EXTENSION_I(NV_texture_rectangle, pname); + *params = (GLint) ctx->Const.MaxTextureRectSize; + break; + default: _mesa_error( ctx, GL_INVALID_ENUM, "glGetIntegerv" ); } @@ -5368,8 +5404,8 @@ _mesa_GetString( GLenum name ) GET_CURRENT_CONTEXT(ctx); static const char *vendor = "Brian Paul"; static const char *renderer = "Mesa"; - static const char *version_1_2 = "1.2 Mesa 4.0.3"; - static const char *version_1_3 = "1.3 Mesa 4.0.3"; + static const char *version_1_2 = "1.2 Mesa 4.0.4"; + static const char *version_1_3 = "1.3 Mesa 4.0.4"; ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, 0); diff --git a/xc/extras/Mesa/src/image.c b/xc/extras/Mesa/src/image.c index da2e6953f..d6ef5cf7f 100644 --- a/xc/extras/Mesa/src/image.c +++ b/xc/extras/Mesa/src/image.c @@ -1,9 +1,9 @@ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.0.4 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -56,7 +56,9 @@ const struct gl_pixelstore_attrib _mesa_native_packing = { 0, /* ImageHeight */ 0, /* SkipImages */ GL_FALSE, /* SwapBytes */ - GL_FALSE /* LsbFirst */ + GL_FALSE, /* LsbFirst */ + GL_FALSE, /* ClientStorage */ + GL_FALSE /* Invert */ }; @@ -202,6 +204,9 @@ GLint _mesa_sizeof_packed_type( GLenum type ) return sizeof(GLuint); case GL_UNSIGNED_INT_2_10_10_10_REV: return sizeof(GLuint); + case GL_UNSIGNED_SHORT_8_8_MESA: + case GL_UNSIGNED_SHORT_8_8_REV_MESA: + return sizeof(GLushort); default: return -1; } @@ -244,6 +249,8 @@ GLint _mesa_components_in_format( GLenum format ) return 4; case GL_ABGR_EXT: return 4; + case GL_YCBCR_MESA: + return 2; default: return -1; } @@ -302,6 +309,12 @@ GLint _mesa_bytes_per_pixel( GLenum format, GLenum type ) return sizeof(GLuint); else return -1; + case GL_UNSIGNED_SHORT_8_8_MESA: + case GL_UNSIGNED_SHORT_8_8_REV_MESA: + if (format == GL_YCBCR_MESA) + return sizeof(GLushort); + else + return -1; default: return -1; } @@ -392,6 +405,12 @@ _mesa_is_legal_format_and_type( GLenum format, GLenum type ) default: return GL_FALSE; } + case GL_YCBCR_MESA: + if (type == GL_UNSIGNED_SHORT_8_8_MESA || + type == GL_UNSIGNED_SHORT_8_8_REV_MESA) + return GL_TRUE; + else + return GL_FALSE; default: ; /* fall-through */ } @@ -475,6 +494,7 @@ _mesa_image_address( const struct gl_pixelstore_attrib *packing, else { /* Non-BITMAP data */ GLint bytes_per_pixel, bytes_per_row, remainder, bytes_per_image; + GLint topOfImage; bytes_per_pixel = _mesa_bytes_per_pixel( format, type ); @@ -490,9 +510,19 @@ _mesa_image_address( const struct gl_pixelstore_attrib *packing, bytes_per_image = bytes_per_row * rows_per_image; + if (packing->Invert) { + /* set pixel_addr to the last row */ + topOfImage = bytes_per_row * (height - 1); + bytes_per_row = -bytes_per_row; + } + else { + topOfImage = 0; + } + /* compute final pixel address */ pixel_addr = (GLubyte *) image + (skipimages + img) * bytes_per_image + + topOfImage + (skiprows + row) * bytes_per_row + (skippixels + column) * bytes_per_pixel; } @@ -513,14 +543,18 @@ _mesa_image_row_stride( const struct gl_pixelstore_attrib *packing, ASSERT(packing); if (type == GL_BITMAP) { /* BITMAP data */ + GLint bytes; if (packing->RowLength == 0) { - GLint bytes = (width + 7) / 8; - return bytes; + bytes = (width + 7) / 8; } else { - GLint bytes = (packing->RowLength + 7) / 8; - return bytes; + bytes = (packing->RowLength + 7) / 8; + } + if (packing->Invert) { + /* negate the bytes per row (negative row stride) */ + bytes = -bytes; } + return bytes; } else { /* Non-BITMAP data */ @@ -537,6 +571,8 @@ _mesa_image_row_stride( const struct gl_pixelstore_attrib *packing, remainder = bytesPerRow % packing->Alignment; if (remainder > 0) bytesPerRow += (packing->Alignment - remainder); + if (packing->Invert) + bytesPerRow = -bytesPerRow; return bytesPerRow; } } diff --git a/xc/extras/Mesa/src/mtypes.h b/xc/extras/Mesa/src/mtypes.h index 4fe498f04..73c4133c6 100644 --- a/xc/extras/Mesa/src/mtypes.h +++ b/xc/extras/Mesa/src/mtypes.h @@ -1,9 +1,9 @@ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.0.4 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -613,7 +613,6 @@ struct gl_pixel_attrib { struct gl_point_attrib { GLboolean SmoothFlag; /* True if GL_POINT_SMOOTH is enabled */ - GLboolean SpriteMode; /* GL_MESA_sprite_point extension */ GLfloat Size; /* User-specified point size */ GLfloat _Size; /* Size clamped to Const.Min/MaxPointSize */ GLfloat Params[3]; /* GL_EXT_point_parameters */ @@ -668,49 +667,51 @@ struct gl_stencil_attrib { #define R_BIT 4 #define Q_BIT 8 -#define NUM_TEXTURE_TARGETS 4 /* 1D, 2D, 3D and CUBE */ +#define NUM_TEXTURE_TARGETS 5 /* 1D, 2D, 3D, CUBE, and RECT */ /* Texture Enabled flags */ #define TEXTURE0_1D 0x1 /* Texture unit 0 (default) */ #define TEXTURE0_2D 0x2 #define TEXTURE0_3D 0x4 #define TEXTURE0_CUBE 0x8 -#define TEXTURE0_ANY (TEXTURE0_1D | TEXTURE0_2D | TEXTURE0_3D | TEXTURE0_CUBE) -#define TEXTURE1_1D (TEXTURE0_1D << 4) /* Texture unit 1 */ -#define TEXTURE1_2D (TEXTURE0_2D << 4) -#define TEXTURE1_3D (TEXTURE0_3D << 4) -#define TEXTURE1_CUBE (TEXTURE0_CUBE << 4) -#define TEXTURE1_ANY (TEXTURE1_1D | TEXTURE1_2D | TEXTURE1_3D | TEXTURE1_CUBE) -#define TEXTURE2_1D (TEXTURE0_1D << 8) /* Texture unit 2 */ -#define TEXTURE2_2D (TEXTURE0_2D << 8) -#define TEXTURE2_3D (TEXTURE0_3D << 8) -#define TEXTURE2_CUBE (TEXTURE0_CUBE << 8) -#define TEXTURE2_ANY (TEXTURE2_1D | TEXTURE2_2D | TEXTURE2_3D | TEXTURE2_CUBE) -#define TEXTURE3_1D (TEXTURE0_1D << 12) /* Texture unit 3 */ -#define TEXTURE3_2D (TEXTURE0_2D << 12) -#define TEXTURE3_3D (TEXTURE0_3D << 12) -#define TEXTURE3_CUBE (TEXTURE0_CUBE << 12) -#define TEXTURE3_ANY (TEXTURE3_1D | TEXTURE3_2D | TEXTURE3_3D | TEXTURE3_CUBE) -#define TEXTURE4_1D (TEXTURE0_1D << 16) /* Texture unit 4 */ -#define TEXTURE4_2D (TEXTURE0_2D << 16) -#define TEXTURE4_3D (TEXTURE0_3D << 16) -#define TEXTURE4_CUBE (TEXTURE0_CUBE << 16) -#define TEXTURE5_ANY (TEXTURE3_1D | TEXTURE3_2D | TEXTURE3_3D | TEXTURE3_CUBE) -#define TEXTURE5_1D (TEXTURE0_1D << 20) /* Texture unit 5 */ -#define TEXTURE5_2D (TEXTURE0_2D << 20) -#define TEXTURE5_3D (TEXTURE0_3D << 20) -#define TEXTURE5_CUBE (TEXTURE0_CUBE << 20) -#define TEXTURE5_ANY (TEXTURE3_1D | TEXTURE3_2D | TEXTURE3_3D | TEXTURE3_CUBE) -#define TEXTURE6_1D (TEXTURE0_1D << 24) /* Texture unit 6 */ -#define TEXTURE6_2D (TEXTURE0_2D << 24) -#define TEXTURE6_3D (TEXTURE0_3D << 24) -#define TEXTURE6_CUBE (TEXTURE0_CUBE << 24) -#define TEXTURE6_ANY (TEXTURE3_1D | TEXTURE3_2D | TEXTURE3_3D | TEXTURE3_CUBE) -#define TEXTURE7_1D (TEXTURE0_1D << 28) /* Texture unit 7 */ -#define TEXTURE7_2D (TEXTURE0_2D << 28) -#define TEXTURE7_3D (TEXTURE0_3D << 28) -#define TEXTURE7_CUBE (TEXTURE0_CUBE << 28) -#define TEXTURE7_ANY (TEXTURE3_1D | TEXTURE3_2D | TEXTURE3_3D | TEXTURE3_CUBE) +#define TEXTURE0_RECT 0x10 +#define TEXTURE0_ANY (TEXTURE0_1D | TEXTURE0_2D | TEXTURE0_3D | TEXTURE0_CUBE | TEXTURE0_RECT) + +#define TEXTURE1_1D (TEXTURE0_1D << 5) /* Texture unit 1 */ +#define TEXTURE1_2D (TEXTURE0_2D << 5) +#define TEXTURE1_3D (TEXTURE0_3D << 5) +#define TEXTURE1_CUBE (TEXTURE0_CUBE << 5) +#define TEXTURE1_RECT (TEXTURE0_RECT << 5) +#define TEXTURE1_ANY (TEXTURE1_1D | TEXTURE1_2D | TEXTURE1_3D | TEXTURE1_CUBE | TEXTURE1_RECT) + +#define TEXTURE2_1D (TEXTURE0_1D << 10) /* Texture unit 2 */ +#define TEXTURE2_2D (TEXTURE0_2D << 10) +#define TEXTURE2_3D (TEXTURE0_3D << 10) +#define TEXTURE2_CUBE (TEXTURE0_CUBE << 10) +#define TEXTURE2_RECT (TEXTURE0_RECT << 10) +#define TEXTURE2_ANY (TEXTURE2_1D | TEXTURE2_2D | TEXTURE2_3D | TEXTURE2_CUBE | TEXTURE2_RECT) + +#define TEXTURE3_1D (TEXTURE0_1D << 15) /* Texture unit 3 */ +#define TEXTURE3_2D (TEXTURE0_2D << 15) +#define TEXTURE3_3D (TEXTURE0_3D << 15) +#define TEXTURE3_CUBE (TEXTURE0_CUBE << 15) +#define TEXTURE3_RECT (TEXTURE0_RECT << 15) +#define TEXTURE3_ANY (TEXTURE3_1D | TEXTURE3_2D | TEXTURE3_3D | TEXTURE3_CUBE | TEXTURE3_RECT) + +#define TEXTURE4_1D (TEXTURE0_1D << 20) /* Texture unit 4 */ +#define TEXTURE4_2D (TEXTURE0_2D << 20) +#define TEXTURE4_3D (TEXTURE0_3D << 20) +#define TEXTURE4_CUBE (TEXTURE0_CUBE << 20) +#define TEXTURE4_RECT (TEXTURE0_RECT << 20) +#define TEXTURE4_ANY (TEXTURE4_1D | TEXTURE4_2D | TEXTURE4_3D | TEXTURE4_CUBE | TEXTURE4_TECT) + +#define TEXTURE5_1D (TEXTURE0_1D << 25) /* Texture unit 5 */ +#define TEXTURE5_2D (TEXTURE0_2D << 25) +#define TEXTURE5_3D (TEXTURE0_3D << 25) +#define TEXTURE5_CUBE (TEXTURE0_CUBE << 25) +#define TEXTURE5_RECT (TEXTURE0_CUBE << 25) +#define TEXTURE5_ANY (TEXTURE5_1D | TEXTURE5_2D | TEXTURE5_3D | TEXTURE5_CUBE | TEXTURE5_RECT) + /* Bitmap versions of the GL_ constants. */ @@ -799,6 +800,7 @@ struct gl_texture_image { GLuint Width; /* = 2^WidthLog2 + 2*Border */ GLuint Height; /* = 2^HeightLog2 + 2*Border */ GLuint Depth; /* = 2^DepthLog2 + 2*Border */ + GLuint RowStride; /* == Width unless IsClientData and padded */ GLuint Width2; /* = Width - 2*Border */ GLuint Height2; /* = Height - 2*Border */ GLuint Depth2; /* = Depth - 2*Border */ @@ -807,6 +809,7 @@ struct gl_texture_image { GLuint DepthLog2; /* = log2(Depth2) */ GLuint MaxLog2; /* = MAX(WidthLog2, HeightLog2) */ GLvoid *Data; /* Image data, accessed via FetchTexel() */ + GLboolean IsClientData; /* Data owned by client? */ const struct gl_texture_format *TexFormat; @@ -825,7 +828,7 @@ struct gl_texture_object { _glthread_Mutex Mutex; /* for thread safety */ GLint RefCount; /* reference count */ GLuint Name; /* an unsigned integer */ - GLuint Dimensions; /* 1 or 2 or 3 or 6 (cube map) */ + GLenum Target; /* GL_TEXTURE_1D, GL_TEXTURE_2D, etc. */ GLfloat Priority; /* in [0,1] */ GLchan BorderColor[4]; GLenum WrapS; /* Wrap modes are: GL_CLAMP, REPEAT */ @@ -871,8 +874,8 @@ struct gl_texture_object { * Texture units are new with the multitexture extension. */ struct gl_texture_unit { - GLuint Enabled; /* bitmask of TEXTURE0_1D, _2D, _3D, _CUBE */ - GLuint _ReallyEnabled; /* 0 or one of TEXTURE0_1D, _2D, _3D, _CUBE */ + GLuint Enabled; /* bitmask of TEXTURE0_1D, _2D, _3D, _CUBE, _RECT */ + GLuint _ReallyEnabled; /* 0 or one of TEXTURE0_1D, _2D, _3D, _CUBE, _RECT */ GLenum EnvMode; /* GL_MODULATE, GL_DECAL, GL_BLEND, etc. */ GLfloat EnvColor[4]; @@ -910,13 +913,15 @@ struct gl_texture_unit { struct gl_texture_object *Current2D; struct gl_texture_object *Current3D; struct gl_texture_object *CurrentCubeMap; /* GL_ARB_texture_cube_map */ + struct gl_texture_object *CurrentRect; /* GL_NV_texture_rectangle */ struct gl_texture_object *_Current; /* Points to really enabled tex obj */ struct gl_texture_object Saved1D; /* only used by glPush/PopAttrib */ struct gl_texture_object Saved2D; struct gl_texture_object Saved3D; - struct gl_texture_object SavedCubeMap; + struct gl_texture_object SavedCubeMap; /* GL_ARB_texture_cube_map */ + struct gl_texture_object SavedRect; /* GL_NV_texture_rectangle */ }; @@ -926,8 +931,8 @@ struct gl_texture_attrib { GLuint _ReallyEnabled; /* enables for all texture units: */ /* = (Unit[0]._ReallyEnabled << 0) | */ - /* (Unit[1]._ReallyEnabled << 4) | */ - /* (Unit[2]._ReallyEnabled << 8) | etc... */ + /* (Unit[1]._ReallyEnabled << 5) | */ + /* (Unit[2]._ReallyEnabled << 10) | etc... */ GLuint _GenFlags; /* for texgen */ GLuint _TexGenEnabled; @@ -938,7 +943,8 @@ struct gl_texture_attrib { struct gl_texture_object *Proxy1D; struct gl_texture_object *Proxy2D; struct gl_texture_object *Proxy3D; - struct gl_texture_object *ProxyCubeMap; + struct gl_texture_object *ProxyCubeMap; /* GL_ARB_texture_cube_map */ + struct gl_texture_object *ProxyRect; /* GL_NV_texture_rectangle */ /* GL_EXT_shared_texture_palette */ GLboolean SharedPalette; @@ -986,6 +992,8 @@ struct gl_pixelstore_attrib { GLint SkipImages; /* for GL_EXT_texture3D */ GLboolean SwapBytes; GLboolean LsbFirst; + GLboolean ClientStorage; /* GL_APPLE_client_storage */ + GLboolean Invert; /* GL_MESA_pack_invert */ }; @@ -1112,6 +1120,7 @@ struct gl_shared_state { struct gl_texture_object *Default2D; struct gl_texture_object *Default3D; struct gl_texture_object *DefaultCubeMap; + struct gl_texture_object *DefaultRect; void *DriverData; /* Device driver shared state */ }; @@ -1162,7 +1171,8 @@ struct gl_frame_buffer { struct gl_constants { GLint MaxTextureLevels; GLint Max3DTextureLevels; - GLint MaxCubeTextureLevels; + GLint MaxCubeTextureLevels; /* GL_ARB_texture_cube_map */ + GLint MaxTextureRectSize; /* GL_NV_texture_rectangle */ GLuint MaxTextureUnits; GLfloat MaxTextureMaxAnisotropy; /* GL_EXT_texture_filter_anisotropic */ GLfloat MaxTextureLodBias; /* GL_EXT_texture_lod_bias */ @@ -1234,11 +1244,13 @@ struct gl_extensions { GLboolean HP_occlusion_test; GLboolean IBM_rasterpos_clip; GLboolean INGR_blend_func_separate; + GLboolean MESA_pack_invert; GLboolean MESA_window_pos; GLboolean MESA_resize_buffers; - GLboolean MESA_sprite_point; + GLboolean MESA_ycbcr_texture; GLboolean NV_blend_square; GLboolean NV_texgen_reflection; + GLboolean NV_texture_rectangle; GLboolean SGI_color_matrix; GLboolean SGI_color_table; GLboolean SGIS_generate_mipmap; @@ -1249,6 +1261,7 @@ struct gl_extensions { GLboolean SGIX_shadow; GLboolean SGIX_shadow_ambient; GLboolean _3DFX_texture_compression_FXT1; + GLboolean APPLE_client_storage; }; diff --git a/xc/extras/Mesa/src/pixel.c b/xc/extras/Mesa/src/pixel.c index f6e3322c4..f1263ba4c 100644 --- a/xc/extras/Mesa/src/pixel.c +++ b/xc/extras/Mesa/src/pixel.c @@ -1,7 +1,7 @@ /* * Mesa 3-D graphics library - * Version: 4.0.3 + * Version: 4.0.4 * * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. * @@ -145,6 +145,17 @@ _mesa_PixelStorei( GLenum pname, GLint param ) FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); ctx->Pack.Alignment = param; break; + case GL_PACK_INVERT_MESA: + if (!ctx->Extensions.MESA_pack_invert) { + _mesa_error( ctx, GL_INVALID_ENUM, "glPixelstore(pname)" ); + return; + } + if (ctx->Pack.Invert == param) + return; + FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); + ctx->Pack.Invert = param; + break; + case GL_UNPACK_SWAP_BYTES: if (param == (GLint)ctx->Unpack.SwapBytes) return; @@ -222,6 +233,13 @@ _mesa_PixelStorei( GLenum pname, GLint param ) FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); ctx->Unpack.Alignment = param; break; + case GL_UNPACK_CLIENT_STORAGE_APPLE: + if (param == (GLint)ctx->Unpack.ClientStorage) + return; + FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); + ctx->Unpack.ClientStorage = param ? GL_TRUE : GL_FALSE; + break; + default: _mesa_error( ctx, GL_INVALID_ENUM, "glPixelStore" ); return; diff --git a/xc/extras/Mesa/src/state.c b/xc/extras/Mesa/src/state.c index a611fdb12..9ea5e118c 100644 --- a/xc/extras/Mesa/src/state.c +++ b/xc/extras/Mesa/src/state.c @@ -1,7 +1,7 @@ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.0.4 * * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * @@ -772,6 +772,17 @@ update_texture_state( GLcontext *ctx ) } } + if (!texUnit->_ReallyEnabled && (texUnit->Enabled & TEXTURE0_RECT)) { + struct gl_texture_object *texObj = texUnit->CurrentRect; + if (!texObj->Complete) { + _mesa_test_texobj_completeness(ctx, texObj); + } + if (texObj->Complete) { + texUnit->_ReallyEnabled = TEXTURE0_RECT; + texUnit->_Current = texObj; + } + } + if (!texUnit->_ReallyEnabled && (texUnit->Enabled & TEXTURE0_2D)) { struct gl_texture_object *texObj = texUnit->Current2D; if (!texObj->Complete) { diff --git a/xc/extras/Mesa/src/swrast/s_points.c b/xc/extras/Mesa/src/swrast/s_points.c index 81583879a..679d0232a 100644 --- a/xc/extras/Mesa/src/swrast/s_points.c +++ b/xc/extras/Mesa/src/swrast/s_points.c @@ -45,7 +45,6 @@ #define SPECULAR 0x8 #define LARGE 0x10 #define ATTENUATE 0x20 -#define SPRITE 0x40 /* @@ -144,19 +143,6 @@ #include "s_pointtemp.h" -/* - * Sprite (textured point) - */ -#define FLAGS (RGBA | TEXTURE | SPRITE) -#define NAME sprite_point -#include "s_pointtemp.h" - - -#define FLAGS (RGBA | ATTENUATE | TEXTURE | SPRITE) -#define NAME atten_sprite_point -#include "s_pointtemp.h" - - void _swrast_add_spec_terms_point( GLcontext *ctx, const SWvertex *v0 ) @@ -201,14 +187,7 @@ _swrast_choose_point( GLcontext *ctx ) GLboolean rgbMode = ctx->Visual.rgbMode; if (ctx->RenderMode==GL_RENDER) { - if (ctx->Point.SpriteMode) { - /* XXX this might not be good enough */ - if (ctx->Point._Attenuated) - USE(atten_sprite_point); - else - USE(sprite_point); - } - else if (ctx->Point.SmoothFlag) { + if (ctx->Point.SmoothFlag) { /* Smooth points */ if (rgbMode) { if (ctx->Point._Attenuated) { diff --git a/xc/extras/Mesa/src/swrast/s_pointtemp.h b/xc/extras/Mesa/src/swrast/s_pointtemp.h index 83d953136..e4c485a31 100644 --- a/xc/extras/Mesa/src/swrast/s_pointtemp.h +++ b/xc/extras/Mesa/src/swrast/s_pointtemp.h @@ -35,7 +35,6 @@ * SPECULAR = do separate specular color * LARGE = do points with diameter > 1 pixel * ATTENUATE = compute point size attenuation - * SPRITE = GL_MESA_sprite_point * * Notes: LARGE and ATTENUATE are exclusive of each other. * TEXTURE requires RGBA @@ -126,62 +125,7 @@ NAME ( GLcontext *ctx, const SWvertex *vert ) return; } -#if FLAGS & SPRITE - { - SWcontext *swctx = SWRAST_CONTEXT(ctx); - const GLfloat radius = 0.5F * vert->pointSize; /* XXX threshold, alpha */ - SWvertex v0, v1, v2, v3; - GLuint unit; - - (void) red; - (void) green; - (void) blue; - (void) alpha; - (void) z; - - /* lower left corner */ - v0 = *vert; - v0.win[0] -= radius; - v0.win[1] -= radius; - - /* lower right corner */ - v1 = *vert; - v1.win[0] += radius; - v1.win[1] -= radius; - - /* upper right corner */ - v2 = *vert; - v2.win[0] += radius; - v2.win[1] += radius; - - /* upper left corner */ - v3 = *vert; - v3.win[0] -= radius; - v3.win[1] += radius; - - for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) { - if (ctx->Texture.Unit[unit]._ReallyEnabled) { - v0.texcoord[unit][0] = 0.0; - v0.texcoord[unit][1] = 0.0; - v1.texcoord[unit][0] = 1.0; - v1.texcoord[unit][1] = 0.0; - v2.texcoord[unit][0] = 1.0; - v2.texcoord[unit][1] = 1.0; - v3.texcoord[unit][0] = 0.0; - v3.texcoord[unit][1] = 1.0; - } - } - - /* XXX if radius < threshold, attenuate alpha? */ - - /* XXX need to implement clipping!!! */ - - /* render */ - swctx->Triangle(ctx, &v0, &v1, &v2); - swctx->Triangle(ctx, &v0, &v2, &v3); - } - -#elif FLAGS & (LARGE | ATTENUATE | SMOOTH) +#if FLAGS & (LARGE | ATTENUATE | SMOOTH) { GLint x, y; diff --git a/xc/extras/Mesa/src/swrast/s_readpix.c b/xc/extras/Mesa/src/swrast/s_readpix.c index 1846552bf..3582e979e 100644 --- a/xc/extras/Mesa/src/swrast/s_readpix.c +++ b/xc/extras/Mesa/src/swrast/s_readpix.c @@ -281,8 +281,15 @@ read_fast_rgba_pixels( GLcontext *ctx, if (0) { #endif GLchan *dest = (GLchan *) pixels - + (skipRows * rowLength + skipPixels) * 4; + + (skipRows * rowLength + skipPixels) * 4; GLint row; + + if (packing->Invert) { + /* start at top and go down */ + dest += (readHeight - 1) * rowLength * 4; + rowLength = -rowLength; + } + for (row=0; row<readHeight; row++) { (*swrast->Driver.ReadRGBASpan)(ctx, readWidth, srcX, srcY, (GLchan (*)[4]) dest); diff --git a/xc/extras/Mesa/src/swrast/s_texstore.c b/xc/extras/Mesa/src/swrast/s_texstore.c index 12dd5c005..053430633 100644 --- a/xc/extras/Mesa/src/swrast/s_texstore.c +++ b/xc/extras/Mesa/src/swrast/s_texstore.c @@ -1,9 +1,9 @@ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.0.4 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -193,7 +193,7 @@ _swrast_copy_teximage1d( GLcontext *ctx, GLenum target, GLint level, /* GL_SGIS_generate_mipmap */ if (level == texObj->BaseLevel && texObj->GenerateMipmap) { - _mesa_generate_mipmap(ctx, texUnit, texObj); + _mesa_generate_mipmap(ctx, target, texUnit, texObj); } } @@ -252,7 +252,7 @@ _swrast_copy_teximage2d( GLcontext *ctx, GLenum target, GLint level, /* GL_SGIS_generate_mipmap */ if (level == texObj->BaseLevel && texObj->GenerateMipmap) { - _mesa_generate_mipmap(ctx, texUnit, texObj); + _mesa_generate_mipmap(ctx, target, texUnit, texObj); } } @@ -324,7 +324,7 @@ _swrast_copy_texsubimage1d(GLcontext *ctx, GLenum target, GLint level, /* GL_SGIS_generate_mipmap */ if (level == texObj->BaseLevel && texObj->GenerateMipmap) { - _mesa_generate_mipmap(ctx, texUnit, texObj); + _mesa_generate_mipmap(ctx, target, texUnit, texObj); } } @@ -400,7 +400,7 @@ _swrast_copy_texsubimage2d( GLcontext *ctx, /* GL_SGIS_generate_mipmap */ if (level == texObj->BaseLevel && texObj->GenerateMipmap) { - _mesa_generate_mipmap(ctx, texUnit, texObj); + _mesa_generate_mipmap(ctx, target, texUnit, texObj); } } @@ -475,6 +475,6 @@ _swrast_copy_texsubimage3d( GLcontext *ctx, /* GL_SGIS_generate_mipmap */ if (level == texObj->BaseLevel && texObj->GenerateMipmap) { - _mesa_generate_mipmap(ctx, texUnit, texObj); + _mesa_generate_mipmap(ctx, target, texUnit, texObj); } } diff --git a/xc/extras/Mesa/src/swrast/s_texture.c b/xc/extras/Mesa/src/swrast/s_texture.c index c3e215eca..c6cd5186f 100644 --- a/xc/extras/Mesa/src/swrast/s_texture.c +++ b/xc/extras/Mesa/src/swrast/s_texture.c @@ -1,7 +1,7 @@ /* * Mesa 3-D graphics library - * Version: 4.0.3 + * Version: 4.0.4 * * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. * @@ -882,7 +882,8 @@ sample_linear_2d( GLcontext *ctx, GLuint texUnit, * Optimized 2-D texture sampling: * S and T wrap mode == GL_REPEAT * GL_NEAREST min/mag filter - * No border + * No border, + * RowStride == Width, * Format = GL_RGB */ static void @@ -923,6 +924,7 @@ opt_sample_rgb_2d( GLcontext *ctx, GLuint texUnit, * S and T wrap mode == GL_REPEAT * GL_NEAREST min/mag filter * No border + * RowStride == Width, * Format = GL_RGBA */ static void @@ -979,7 +981,7 @@ sample_lambda_2d( GLcontext *ctx, GLuint texUnit, switch (tObj->MagFilter) { case GL_NEAREST: if (tObj->WrapS == GL_REPEAT && tObj->WrapT == GL_REPEAT && - img->Border == 0) { + img->Border == 0 && img->Width == img->RowStride) { switch (img->Format) { case GL_RGB: opt_sample_rgb_2d(ctx, texUnit, tObj, n, s, t, NULL, @@ -1758,6 +1760,217 @@ sample_lambda_cube( GLcontext *ctx, GLuint texUnit, } + +/**********************************************************************/ +/* Texture Rectangle Sampling Functions */ +/**********************************************************************/ + +static void +sample_nearest_rect(GLcontext *ctx, GLuint texUnit, + const struct gl_texture_object *tObj, GLuint n, + const GLfloat s[], const GLfloat t[], + const GLfloat u[], const GLfloat lambda[], + GLchan rgba[][4]) +{ + const struct gl_texture_image *img = tObj->Image[0]; + const GLfloat width = (GLfloat) img->Width; + const GLfloat height = (GLfloat) img->Height; + const GLint width_minus_1 = img->Width - 1; + const GLint height_minus_1 = img->Height - 1; + GLuint i; + + (void) texUnit; + (void) lambda; + + ASSERT(tObj->WrapS == GL_CLAMP || + tObj->WrapS == GL_CLAMP_TO_EDGE || + tObj->WrapS == GL_CLAMP_TO_BORDER_ARB); + ASSERT(tObj->WrapT == GL_CLAMP || + tObj->WrapT == GL_CLAMP_TO_EDGE || + tObj->WrapT == GL_CLAMP_TO_BORDER_ARB); + ASSERT(img->Format != GL_COLOR_INDEX); + + /* XXX move Wrap mode tests outside of loops for common cases */ + for (i = 0; i < n; i++) { + GLint row, col; + /* NOTE: we DO NOT use [0, 1] texture coordinates! */ + if (tObj->WrapS == GL_CLAMP) { + col = IFLOOR( CLAMP(s[i], 0.0F, width) ); + } + else if (tObj->WrapS == GL_CLAMP_TO_EDGE) { + col = IFLOOR( CLAMP(s[i], 0.5F, width - 0.5F) ); + } + else { + col = IFLOOR( CLAMP(s[i], -0.5F, width + 0.5F) ); + } + if (tObj->WrapT == GL_CLAMP) { + row = IFLOOR( CLAMP(t[i], 0.0F, height) ); + } + else if (tObj->WrapT == GL_CLAMP_TO_EDGE) { + row = IFLOOR( CLAMP(t[i], 0.5F, height - 0.5F) ); + } + else { + row = IFLOOR( CLAMP(t[i], -0.5F, height + 0.5F) ); + } + + col = CLAMP(col, 0, width_minus_1); + row = CLAMP(row, 0, height_minus_1); + + (*img->FetchTexel)(img, col, row, 0, (GLvoid *) rgba[i]); + } +} + + +static void +sample_linear_rect(GLcontext *ctx, GLuint texUnit, + const struct gl_texture_object *tObj, GLuint n, + const GLfloat s[], const GLfloat t[], + const GLfloat u[], const GLfloat lambda[], + GLchan rgba[][4]) +{ + const struct gl_texture_image *img = tObj->Image[0]; + const GLfloat width = (GLfloat) img->Width; + const GLfloat height = (GLfloat) img->Height; + const GLint width_minus_1 = img->Width - 1; + const GLint height_minus_1 = img->Height - 1; + GLuint i; + + (void) texUnit; + (void) lambda; + + ASSERT(tObj->WrapS == GL_CLAMP || + tObj->WrapS == GL_CLAMP_TO_EDGE || + tObj->WrapS == GL_CLAMP_TO_BORDER_ARB); + ASSERT(tObj->WrapT == GL_CLAMP || + tObj->WrapT == GL_CLAMP_TO_EDGE || + tObj->WrapT == GL_CLAMP_TO_BORDER_ARB); + ASSERT(img->Format != GL_COLOR_INDEX); + + /* XXX lots of opportunity for optimization in this loop */ + for (i = 0; i < n; i++) { + GLfloat frow, fcol; + GLint row0, col0, row1, col1; + GLchan t00[4], t01[4], t10[4], t11[4]; + GLfloat a, b, w00, w01, w10, w11; + + /* NOTE: we DO NOT use [0, 1] texture coordinates! */ + if (tObj->WrapS == GL_CLAMP) { + fcol = CLAMP(s[i], 0.0F, width); + } + else if (tObj->WrapS == GL_CLAMP_TO_EDGE) { + fcol = CLAMP(s[i], 0.5F, width - 0.5F); + } + else { + fcol = CLAMP(s[i], -0.5F, width + 0.5F); + } + if (tObj->WrapT == GL_CLAMP) { + frow = CLAMP(t[i], 0.0F, height); + } + else if (tObj->WrapT == GL_CLAMP_TO_EDGE) { + frow = CLAMP(t[i], 0.5F, height - 0.5F); + } + else { + frow = CLAMP(t[i], -0.5F, height + 0.5F); + } + + /* compute integer rows/columns */ + col0 = IFLOOR(fcol); + col1 = col0 + 1; + col0 = CLAMP(col0, 0, width_minus_1); + col1 = CLAMP(col1, 0, width_minus_1); + row0 = IFLOOR(frow); + row1 = row0 + 1; + row0 = CLAMP(row0, 0, height_minus_1); + row1 = CLAMP(row1, 0, height_minus_1); + + /* get four texel samples */ + (*img->FetchTexel)(img, col0, row0, 0, (GLvoid *) t00); + (*img->FetchTexel)(img, col1, row0, 0, (GLvoid *) t10); + (*img->FetchTexel)(img, col0, row1, 0, (GLvoid *) t01); + (*img->FetchTexel)(img, col1, row1, 0, (GLvoid *) t11); + + /* compute sample weights */ + a = FRAC(fcol); + b = FRAC(frow); + w00 = (1.0F-a) * (1.0F-b); + w10 = a * (1.0F-b); + w01 = (1.0F-a) * b ; + w11 = a * b ; + + /* compute weighted average of samples */ + rgba[i][0] = (GLchan) + (w00 * t00[0] + w10 * t10[0] + w01 * t01[0] + w11 * t11[0]); + rgba[i][1] = (GLchan) + (w00 * t00[1] + w10 * t10[1] + w01 * t01[1] + w11 * t11[1]); + rgba[i][2] = (GLchan) + (w00 * t00[2] + w10 * t10[2] + w01 * t01[2] + w11 * t11[2]); + rgba[i][3] = (GLchan) + (w00 * t00[3] + w10 * t10[3] + w01 * t01[3] + w11 * t11[3]); + } +} + + + +static void +sample_lambda_rect( GLcontext *ctx, GLuint texUnit, + const struct gl_texture_object *tObj, GLuint n, + const GLfloat s[], const GLfloat t[], + const GLfloat u[], const GLfloat lambda[], + GLchan rgba[][4]) +{ + const GLfloat minMagThresh = SWRAST_CONTEXT(ctx)->_MinMagThresh[texUnit]; + GLuint i; + + { + for (i = 0; i < n; i++) { + GLfloat coord[4]; + coord[0] = s[i]; + coord[1] = t[i]; + coord[2] = u[i]; + coord[3] = 1.0; + if (lambda[i] > minMagThresh) { + /* minification */ + switch (tObj->MinFilter) { + case GL_NEAREST: + sample_nearest_rect(ctx, texUnit, tObj, 1, + s + i, t + i, u + i, lambda + i, + rgba + i ); + break; + case GL_LINEAR: + sample_linear_rect(ctx, texUnit, tObj, 1, + s + i, t + i, u + i, lambda + i, + rgba + i ); + break; + default: + _mesa_problem(NULL, "Bad min filter in sample_lambda_rect"); + return; + } + } + else { + /* magnification */ + switch (tObj->MagFilter) { + case GL_NEAREST: + sample_nearest_rect(ctx, texUnit, tObj, 1, + s + i, t + i, u + i, lambda + i, + rgba + i ); + break; + case GL_LINEAR: + sample_linear_rect(ctx, texUnit, tObj, 1, + s + i, t + i, u + i, lambda + i, + rgba + i ); + break; + default: + _mesa_problem(NULL, "Bad mag filter in sample_lambda_rect"); + return; + } + } + } + } + +} + + + static void null_sample_func( GLcontext *ctx, GLuint texUnit, const struct gl_texture_object *tObj, GLuint n, @@ -1801,8 +2014,8 @@ _swrast_choose_texture_sample_func( GLcontext *ctx, GLuint texUnit, } } - switch (t->Dimensions) { - case 1: + switch (t->Target) { + case GL_TEXTURE_1D: if (needLambda) { swrast->TextureSample[texUnit] = sample_lambda_1d; } @@ -1814,7 +2027,7 @@ _swrast_choose_texture_sample_func( GLcontext *ctx, GLuint texUnit, swrast->TextureSample[texUnit] = sample_nearest_1d; } break; - case 2: + case GL_TEXTURE_2D: if (needLambda) { swrast->TextureSample[texUnit] = sample_lambda_2d; } @@ -1827,12 +2040,14 @@ _swrast_choose_texture_sample_func( GLcontext *ctx, GLuint texUnit, if (t->WrapS == GL_REPEAT && t->WrapT == GL_REPEAT && t->Image[baseLevel]->Border == 0 && + t->Image[baseLevel]->Width == t->Image[baseLevel]->RowStride && t->Image[baseLevel]->TexFormat->MesaFormat == MESA_FORMAT_RGB) { swrast->TextureSample[texUnit] = opt_sample_rgb_2d; } else if (t->WrapS == GL_REPEAT && t->WrapT == GL_REPEAT && t->Image[baseLevel]->Border == 0 && + t->Image[baseLevel]->Width == t->Image[baseLevel]->RowStride && t->Image[baseLevel]->TexFormat->MesaFormat == MESA_FORMAT_RGBA) { swrast->TextureSample[texUnit] = opt_sample_rgba_2d; } @@ -1840,7 +2055,7 @@ _swrast_choose_texture_sample_func( GLcontext *ctx, GLuint texUnit, swrast->TextureSample[texUnit] = sample_nearest_2d; } break; - case 3: + case GL_TEXTURE_3D: if (needLambda) { swrast->TextureSample[texUnit] = sample_lambda_3d; } @@ -1852,7 +2067,7 @@ _swrast_choose_texture_sample_func( GLcontext *ctx, GLuint texUnit, swrast->TextureSample[texUnit] = sample_nearest_3d; } break; - case 6: /* cube map */ + case GL_TEXTURE_CUBE_MAP_ARB: if (needLambda) { swrast->TextureSample[texUnit] = sample_lambda_cube; } @@ -1864,6 +2079,18 @@ _swrast_choose_texture_sample_func( GLcontext *ctx, GLuint texUnit, swrast->TextureSample[texUnit] = sample_nearest_cube; } break; + case GL_TEXTURE_RECTANGLE_NV: + if (needLambda) { + swrast->TextureSample[texUnit] = sample_lambda_rect; + } + else if (t->MinFilter == GL_LINEAR) { + swrast->TextureSample[texUnit] = sample_linear_rect; + } + else { + ASSERT(t->MinFilter == GL_NEAREST); + swrast->TextureSample[texUnit] = sample_nearest_rect; + } + break; default: _mesa_problem(NULL, "invalid dimensions in _mesa_set_texture_sampler"); } @@ -2377,7 +2604,7 @@ apply_texture( const GLcontext *ctx, format = texUnit->_Current->Image[baseLevel]->Format; - if (format==GL_COLOR_INDEX || format==GL_DEPTH_COMPONENT) { + if (format==GL_COLOR_INDEX || format==GL_DEPTH_COMPONENT || format==GL_YCBCR_MESA) { format = GL_RGBA; /* XXXX a hack! */ } @@ -2723,7 +2950,7 @@ sample_depth_texture(const GLcontext *ctx, const GLchan ambient = texObj->ShadowAmbient; GLboolean lequal, gequal; - if (texObj->Dimensions != 2) { + if (texObj->Target != GL_TEXTURE_2D) { _mesa_problem(ctx, "only 2-D depth textures supported at this time"); return; } diff --git a/xc/extras/Mesa/src/swrast/s_triangle.c b/xc/extras/Mesa/src/swrast/s_triangle.c index bc17a4b57..8f035d10a 100644 --- a/xc/extras/Mesa/src/swrast/s_triangle.c +++ b/xc/extras/Mesa/src/swrast/s_triangle.c @@ -1695,6 +1695,7 @@ _swrast_choose_triangle( GLcontext *ctx ) && texObj2D->WrapS==GL_REPEAT && texObj2D->WrapT==GL_REPEAT && texImg->Border==0 + && texImg->Width==texImg->RowStride && (format == MESA_FORMAT_RGB || format == MESA_FORMAT_RGBA) && minFilter == magFilter && ctx->Light.Model.ColorControl == GL_SINGLE_COLOR diff --git a/xc/extras/Mesa/src/texformat.c b/xc/extras/Mesa/src/texformat.c index a55d9ddb0..d811f742d 100644 --- a/xc/extras/Mesa/src/texformat.c +++ b/xc/extras/Mesa/src/texformat.c @@ -1,9 +1,9 @@ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.0.4 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -22,8 +22,9 @@ * 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. * - * Author: + * Authors: * Gareth Hughes <gareth@valinux.com> + * Brian Paul */ #ifdef PC_HEADER @@ -437,6 +438,45 @@ const struct gl_texture_format _mesa_texformat_ci8 = { }; +const struct gl_texture_format _mesa_texformat_ycbcr = { + MESA_FORMAT_YCBCR, /* MesaFormat */ + GL_YCBCR_MESA, /* BaseFormat */ + GL_UNSIGNED_SHORT_8_8_MESA, /* Type */ + 0, /* RedBits */ + 0, /* GreenBits */ + 0, /* BlueBits */ + 0, /* AlphaBits */ + 0, /* LuminanceBits */ + 0, /* IntensityBits */ + 0, /* IndexBits */ + 0, /* DepthBits */ + 2, /* TexelBytes */ + fetch_1d_texel_ycbcr, /* FetchTexel1D */ + fetch_2d_texel_ycbcr, /* FetchTexel2D */ + fetch_3d_texel_ycbcr, /* FetchTexel3D */ +}; + + +const struct gl_texture_format _mesa_texformat_ycbcr_rev = { + MESA_FORMAT_YCBCR_REV, /* MesaFormat */ + GL_YCBCR_MESA, /* BaseFormat */ + GL_UNSIGNED_SHORT_8_8_REV_MESA, /* Type */ + 0, /* RedBits */ + 0, /* GreenBits */ + 0, /* BlueBits */ + 0, /* AlphaBits */ + 0, /* LuminanceBits */ + 0, /* IntensityBits */ + 0, /* IndexBits */ + 0, /* DepthBits */ + 2, /* TexelBytes */ + fetch_1d_texel_ycbcr_rev, /* FetchTexel1D */ + fetch_2d_texel_ycbcr_rev, /* FetchTexel2D */ + fetch_3d_texel_ycbcr_rev, /* FetchTexel3D */ +}; + + + /* ============================================================= * Null format: */ @@ -589,6 +629,12 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, _mesa_problem(ctx, "texture compression extension not enabled"); return &_mesa_texformat_rgba; + case GL_YCBCR_MESA: + if (type == GL_UNSIGNED_SHORT_8_8_MESA) + return &_mesa_texformat_ycbcr; + else + return &_mesa_texformat_ycbcr_rev; + default: _mesa_problem(ctx, "unexpected format in _mesa_choose_tex_format()"); printf("intformat = %d %x\n", internalFormat, internalFormat); diff --git a/xc/extras/Mesa/src/texformat.h b/xc/extras/Mesa/src/texformat.h index 72b473cdf..d8ba56ae1 100644 --- a/xc/extras/Mesa/src/texformat.h +++ b/xc/extras/Mesa/src/texformat.h @@ -1,9 +1,9 @@ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.0.4 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -22,8 +22,9 @@ * 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. * - * Author: + * Authors: * Gareth Hughes <gareth@valinux.com> + * Brian Paul */ #ifndef TEXFORMAT_H @@ -32,8 +33,7 @@ #include "mtypes.h" -/* The Mesa internal texture image types. These will be set to their - * default value, but may be changed by drivers as required. +/* The Mesa internal texture image types. */ enum _format { /* Hardware-friendly formats. Drivers can override the default @@ -60,6 +60,8 @@ enum _format { MESA_FORMAT_L8, /* LLLL LLLL */ MESA_FORMAT_I8, /* IIII IIII */ MESA_FORMAT_CI8, /* CCCC CCCC */ + MESA_FORMAT_YCBCR, /* YYYY YYYY UorV UorV */ + MESA_FORMAT_YCBCR_REV, /* UorV UorV YYYY YYYY */ /* Generic GLchan-based formats. These are the default formats used * by the software rasterizer and, unless the driver overrides the @@ -90,11 +92,11 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, GLenum format, GLenum type ); extern GLint -_mesa_base_compressed_texformat(GLcontext *ctx, GLint intFormat); +_mesa_base_compressed_texformat( GLcontext *ctx, GLint intFormat ); extern GLint -_mesa_compressed_texture_size(GLcontext *ctx, - const struct gl_texture_image *texImage); +_mesa_compressed_texture_size( GLcontext *ctx, + const struct gl_texture_image *texImage ); /* The default formats, GLchan per component: @@ -122,6 +124,8 @@ extern const struct gl_texture_format _mesa_texformat_a8; extern const struct gl_texture_format _mesa_texformat_l8; extern const struct gl_texture_format _mesa_texformat_i8; extern const struct gl_texture_format _mesa_texformat_ci8; +extern const struct gl_texture_format _mesa_texformat_ycbcr; +extern const struct gl_texture_format _mesa_texformat_ycbcr_rev; /* The null format: */ diff --git a/xc/extras/Mesa/src/texformat_tmp.h b/xc/extras/Mesa/src/texformat_tmp.h index 2d71e1e88..56160ee2c 100644 --- a/xc/extras/Mesa/src/texformat_tmp.h +++ b/xc/extras/Mesa/src/texformat_tmp.h @@ -1,9 +1,9 @@ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.0.4 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -22,8 +22,9 @@ * 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. * - * Author: + * Authors: * Gareth Hughes <gareth@valinux.com> + * Brian Paul */ #if DIM == 1 @@ -42,13 +43,13 @@ #elif DIM == 2 #define CHAN_SRC( t, i, j, k, sz ) \ - ((GLchan *)(t)->Data + ((t)->Width * (j) + (i)) * (sz)) + ((GLchan *)(t)->Data + ((t)->RowStride * (j) + (i)) * (sz)) #define UBYTE_SRC( t, i, j, k, sz ) \ - ((GLubyte *)(t)->Data + ((t)->Width * (j) + (i)) * (sz)) + ((GLubyte *)(t)->Data + ((t)->RowStride * (j) + (i)) * (sz)) #define USHORT_SRC( t, i, j, k ) \ - ((GLushort *)(t)->Data + ((t)->Width * (j) + (i))) + ((GLushort *)(t)->Data + ((t)->RowStride * (j) + (i))) #define FLOAT_SRC( t, i, j, k ) \ - ((GLfloat *)(t)->Data + ((t)->Width * (j) + (i))) + ((GLfloat *)(t)->Data + ((t)->RowStride * (j) + (i))) #define FETCH(x) fetch_2d_texel_##x @@ -56,16 +57,16 @@ #define CHAN_SRC( t, i, j, k, sz ) \ (GLchan *)(t)->Data + (((t)->Height * (k) + (j)) * \ - (t)->Width + (i)) * (sz) + (t)->RowStride + (i)) * (sz) #define UBYTE_SRC( t, i, j, k, sz ) \ ((GLubyte *)(t)->Data + (((t)->Height * (k) + (j)) * \ - (t)->Width + (i)) * (sz)) + (t)->RowStride + (i)) * (sz)) #define USHORT_SRC( t, i, j, k ) \ ((GLushort *)(t)->Data + (((t)->Height * (k) + (j)) * \ - (t)->Width + (i))) + (t)->RowStride + (i))) #define FLOAT_SRC( t, i, j, k ) \ ((GLfloat *)(t)->Data + (((t)->Height * (k) + (j)) * \ - (t)->Width + (i))) + (t)->RowStride + (i))) #define FETCH(x) fetch_3d_texel_##x @@ -190,7 +191,8 @@ static void FETCH(rgb565)( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLvoid *texel ) { const GLushort *src = USHORT_SRC( texImage, i, j, k ); - GLchan *rgba = (GLchan *) texel; GLushort s = *src; + const GLushort s = *src; + GLchan *rgba = (GLchan *) texel; rgba[RCOMP] = UBYTE_TO_CHAN( ((s >> 8) & 0xf8) * 255 / 0xf8 ); rgba[GCOMP] = UBYTE_TO_CHAN( ((s >> 3) & 0xfc) * 255 / 0xfc ); rgba[BCOMP] = UBYTE_TO_CHAN( ((s << 3) & 0xf8) * 255 / 0xf8 ); @@ -201,7 +203,8 @@ static void FETCH(argb4444)( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLvoid *texel ) { const GLushort *src = USHORT_SRC( texImage, i, j, k ); - GLchan *rgba = (GLchan *) texel; GLushort s = *src; + const GLushort s = *src; + GLchan *rgba = (GLchan *) texel; rgba[RCOMP] = UBYTE_TO_CHAN( ((s >> 8) & 0xf) * 255 / 0xf ); rgba[GCOMP] = UBYTE_TO_CHAN( ((s >> 4) & 0xf) * 255 / 0xf ); rgba[BCOMP] = UBYTE_TO_CHAN( ((s ) & 0xf) * 255 / 0xf ); @@ -212,7 +215,8 @@ static void FETCH(argb1555)( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLvoid *texel ) { const GLushort *src = USHORT_SRC( texImage, i, j, k ); - GLchan *rgba = (GLchan *) texel; GLushort s = *src; + const GLushort s = *src; + GLchan *rgba = (GLchan *) texel; rgba[RCOMP] = UBYTE_TO_CHAN( ((s >> 10) & 0x1f) * 255 / 0x1f ); rgba[GCOMP] = UBYTE_TO_CHAN( ((s >> 5) & 0x1f) * 255 / 0x1f ); rgba[BCOMP] = UBYTE_TO_CHAN( ((s ) & 0x1f) * 255 / 0x1f ); @@ -234,7 +238,8 @@ static void FETCH(rgb332)( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLvoid *texel ) { const GLubyte *src = UBYTE_SRC( texImage, i, j, k, 1 ); - GLchan *rgba = (GLchan *) texel; GLubyte s = *src; + const GLubyte s = *src; + GLchan *rgba = (GLchan *) texel; rgba[RCOMP] = UBYTE_TO_CHAN( ((s ) & 0xe0) * 255 / 0xe0 ); rgba[GCOMP] = UBYTE_TO_CHAN( ((s << 3) & 0xe0) * 255 / 0xe0 ); rgba[BCOMP] = UBYTE_TO_CHAN( ((s << 5) & 0xc0) * 255 / 0xc0 ); @@ -282,6 +287,66 @@ static void FETCH(ci8)( const struct gl_texture_image *texImage, *index = UBYTE_TO_CHAN( *src ); } +/* XXX this may break if GLchan != GLubyte */ +static void FETCH(ycbcr)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLvoid *texel ) +{ + const GLushort *src0 = USHORT_SRC( texImage, (i & ~1), j, k ); /* even */ + const GLushort *src1 = src0 + 1; /* odd */ + const GLubyte y0 = (*src0 >> 8) & 0xff; /* luminance */ + const GLubyte cb = *src0 & 0xff; /* chroma U */ + const GLubyte y1 = (*src1 >> 8) & 0xff; /* luminance */ + const GLubyte cr = *src1 & 0xff; /* chroma V */ + GLchan *rgba = (GLchan *) texel; + GLint r, g, b; + if (i & 1) { + /* odd pixel: use y1,cr,cb */ + r = (GLint) (1.164 * (y1-16) + 1.596 * (cr-128)); + g = (GLint) (1.164 * (y1-16) - 0.813 * (cr-128) - 0.391 * (cb-128)); + b = (GLint) (1.164 * (y1-16) + 2.018 * (cb-128)); + } + else { + /* even pixel: use y0,cr,cb */ + r = (GLint) (1.164 * (y0-16) + 1.596 * (cr-128)); + g = (GLint) (1.164 * (y0-16) - 0.813 * (cr-128) - 0.391 * (cb-128)); + b = (GLint) (1.164 * (y0-16) + 2.018 * (cb-128)); + } + rgba[RCOMP] = CLAMP(r, 0, CHAN_MAX); + rgba[GCOMP] = CLAMP(g, 0, CHAN_MAX); + rgba[BCOMP] = CLAMP(b, 0, CHAN_MAX); + rgba[ACOMP] = CHAN_MAX; +} + +/* XXX this may break if GLchan != GLubyte */ +static void FETCH(ycbcr_rev)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLvoid *texel ) +{ + const GLushort *src0 = USHORT_SRC( texImage, (i & ~1), j, k ); /* even */ + const GLushort *src1 = src0 + 1; /* odd */ + const GLubyte y0 = *src0 & 0xff; /* luminance */ + const GLubyte cr = (*src0 >> 8) & 0xff; /* chroma U */ + const GLubyte y1 = *src1 & 0xff; /* luminance */ + const GLubyte cb = (*src1 >> 8) & 0xff; /* chroma V */ + GLchan *rgba = (GLchan *) texel; + GLint r, g, b; + if (i & 1) { + /* odd pixel: use y1,cr,cb */ + r = (GLint) (1.164 * (y1-16) + 1.596 * (cr-128)); + g = (GLint) (1.164 * (y1-16) - 0.813 * (cr-128) - 0.391 * (cb-128)); + b = (GLint) (1.164 * (y1-16) + 2.018 * (cb-128)); + } + else { + /* even pixel: use y0,cr,cb */ + r = (GLint) (1.164 * (y0-16) + 1.596 * (cr-128)); + g = (GLint) (1.164 * (y0-16) - 0.813 * (cr-128) - 0.391 * (cb-128)); + b = (GLint) (1.164 * (y0-16) + 2.018 * (cb-128)); + } + rgba[RCOMP] = CLAMP(r, 0, CHAN_MAX); + rgba[GCOMP] = CLAMP(g, 0, CHAN_MAX); + rgba[BCOMP] = CLAMP(b, 0, CHAN_MAX); + rgba[ACOMP] = CHAN_MAX; +} + #undef CHAN_SRC #undef UBYTE_SRC diff --git a/xc/extras/Mesa/src/teximage.c b/xc/extras/Mesa/src/teximage.c index 57bd7b528..e5cce8428 100644 --- a/xc/extras/Mesa/src/teximage.c +++ b/xc/extras/Mesa/src/teximage.c @@ -1,7 +1,7 @@ /* * Mesa 3-D graphics library - * Version: 4.0.3 + * Version: 4.0.4 * * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. * @@ -101,6 +101,7 @@ static void PrintTexture(const struct gl_texture_image *img) printf("%02x%02x%02x%02x ", data[0], data[1], data[2], data[3]); data += c; } + data += (img->RowStride - img->Width) * c; printf("\n"); } #endif @@ -222,6 +223,11 @@ _mesa_base_tex_format( GLcontext *ctx, GLint format ) return GL_DEPTH_COMPONENT; else return -1; + case GL_YCBCR_MESA: + if (ctx->Extensions.MESA_ycbcr_texture) + return GL_YCBCR_MESA; + else + return -1; default: return -1; /* error */ } @@ -279,6 +285,7 @@ is_color_format(GLenum format) case GL_RGBA12: case GL_RGBA16: return GL_TRUE; + case GL_YCBCR_MESA: /* not considered to be RGB */ default: return GL_FALSE; } @@ -358,6 +365,10 @@ _mesa_set_tex_image(struct gl_texture_object *tObj, case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB: tObj->NegZ[level] = texImage; return; + case GL_TEXTURE_RECTANGLE_NV: + ASSERT(level == 0); + tObj->Image[level] = texImage; + return; default: _mesa_problem(NULL, "bad target in _mesa_set_tex_image()"); return; @@ -434,6 +445,12 @@ _mesa_select_tex_object(GLcontext *ctx, const struct gl_texture_unit *texUnit, case GL_PROXY_TEXTURE_CUBE_MAP_ARB: return ctx->Extensions.ARB_texture_cube_map ? ctx->Texture.ProxyCubeMap : NULL; + case GL_TEXTURE_RECTANGLE_NV: + return ctx->Extensions.NV_texture_rectangle + ? texUnit->CurrentRect : NULL; + case GL_PROXY_TEXTURE_RECTANGLE_NV: + return ctx->Extensions.NV_texture_rectangle + ? ctx->Texture.ProxyRect : NULL; default: _mesa_problem(NULL, "bad target in _mesa_select_tex_object()"); return NULL; @@ -499,6 +516,22 @@ _mesa_select_tex_image(GLcontext *ctx, const struct gl_texture_unit *texUnit, return ctx->Texture.ProxyCubeMap->Image[level]; else return NULL; + case GL_TEXTURE_RECTANGLE_NV: + if (ctx->Extensions.NV_texture_rectangle) { + ASSERT(level == 0); + return texUnit->CurrentRect->Image[level]; + } + else { + return NULL; + } + case GL_PROXY_TEXTURE_RECTANGLE_NV: + if (ctx->Extensions.NV_texture_rectangle) { + ASSERT(level == 0); + return ctx->Texture.ProxyRect->Image[level]; + } + else { + return NULL; + } default: _mesa_problem(ctx, "bad target in _mesa_select_tex_image()"); return NULL; @@ -579,6 +612,7 @@ clear_teximage_fields(struct gl_texture_image *img) img->Width = 0; img->Height = 0; img->Depth = 0; + img->RowStride = 0; img->Width2 = 0; img->Height2 = 0; img->Depth2 = 0; @@ -597,7 +631,7 @@ clear_teximage_fields(struct gl_texture_image *img) * Initialize basic fields of the gl_texture_image struct. */ void -_mesa_init_teximage_fields(GLcontext *ctx, +_mesa_init_teximage_fields(GLcontext *ctx, GLenum target, struct gl_texture_image *img, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum internalFormat) @@ -610,6 +644,7 @@ _mesa_init_teximage_fields(GLcontext *ctx, img->Width = width; img->Height = height; img->Depth = depth; + img->RowStride = img->Width; img->WidthLog2 = logbase2(width - 2 * border); if (height == 1) /* 1-D texture */ img->HeightLog2 = 0; @@ -647,31 +682,73 @@ texture_error_check( GLcontext *ctx, GLenum target, GLint maxLevels = 0, maxTextureSize; if (dimensions == 1) { - isProxy = (GLboolean) (target == GL_PROXY_TEXTURE_1D); - if (target != GL_TEXTURE_1D && !isProxy) { + if (target == GL_PROXY_TEXTURE_1D) { + isProxy = GL_TRUE; + } + else if (target == GL_TEXTURE_1D) { + isProxy = GL_FALSE; + } + else { _mesa_error( ctx, GL_INVALID_ENUM, "glTexImage1D(target)" ); return GL_TRUE; } maxLevels = ctx->Const.MaxTextureLevels; } else if (dimensions == 2) { - isProxy = (GLboolean) (target == GL_PROXY_TEXTURE_2D || - target == GL_PROXY_TEXTURE_CUBE_MAP_ARB); - if (target != GL_TEXTURE_2D && !isProxy && - !(ctx->Extensions.ARB_texture_cube_map && - target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB && - target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB)) { - _mesa_error( ctx, GL_INVALID_ENUM, "glTexImage2D(target)" ); - return GL_TRUE; - } - if (target == GL_PROXY_TEXTURE_2D || target == GL_TEXTURE_2D) + if (target == GL_PROXY_TEXTURE_2D) { + isProxy = GL_TRUE; maxLevels = ctx->Const.MaxTextureLevels; - else + } + else if (target == GL_TEXTURE_2D) { + isProxy = GL_FALSE; + maxLevels = ctx->Const.MaxTextureLevels; + } + else if (target == GL_PROXY_TEXTURE_CUBE_MAP_ARB) { + if (!ctx->Extensions.ARB_texture_cube_map) { + _mesa_error(ctx, GL_INVALID_ENUM, "glTexImage2D(target)"); + return GL_TRUE; + } + isProxy = GL_TRUE; maxLevels = ctx->Const.MaxCubeTextureLevels; + } + else if (target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB && + target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB) { + if (!ctx->Extensions.ARB_texture_cube_map) { + _mesa_error(ctx, GL_INVALID_ENUM, "glTexImage2D(target)"); + return GL_TRUE; + } + isProxy = GL_FALSE; + maxLevels = ctx->Const.MaxCubeTextureLevels; + } + else if (target == GL_PROXY_TEXTURE_RECTANGLE_NV) { + if (!ctx->Extensions.NV_texture_rectangle) { + _mesa_error(ctx, GL_INVALID_ENUM, "glTexImage2D(target)"); + return GL_TRUE; + } + isProxy = GL_TRUE; + maxLevels = 1; + } + else if (target == GL_TEXTURE_RECTANGLE_NV) { + if (!ctx->Extensions.NV_texture_rectangle) { + _mesa_error(ctx, GL_INVALID_ENUM, "glTexImage2D(target)"); + return GL_TRUE; + } + isProxy = GL_FALSE; + maxLevels = 1; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, "glTexImage2D(target)"); + return GL_TRUE; + } } else if (dimensions == 3) { - isProxy = (GLboolean) (target == GL_PROXY_TEXTURE_3D); - if (target != GL_TEXTURE_3D && !isProxy) { + if (target == GL_PROXY_TEXTURE_3D) { + isProxy = GL_TRUE; + } + else if (target == GL_TEXTURE_3D) { + isProxy = GL_FALSE; + } + else { _mesa_error( ctx, GL_INVALID_ENUM, "glTexImage3D(target)" ); return GL_TRUE; } @@ -694,9 +771,24 @@ texture_error_check( GLcontext *ctx, GLenum target, } return GL_TRUE; } + if ((target == GL_TEXTURE_RECTANGLE_NV || + target == GL_PROXY_TEXTURE_RECTANGLE_NV) && border != 0) { + return GL_TRUE; + } /* Width */ - if (width < 2 * border || width > 2 + maxTextureSize + if (target == GL_TEXTURE_RECTANGLE_NV || + target == GL_PROXY_TEXTURE_RECTANGLE_NV) { + if (width < 1 || width > ctx->Const.MaxTextureRectSize) { + if (!isProxy) { + char message[100]; + sprintf(message, "glTexImage%dD(width=%d)", dimensions, width); + _mesa_error(ctx, GL_INVALID_VALUE, message); + } + return GL_TRUE; + } + } + else if (width < 2 * border || width > 2 + maxTextureSize || logbase2( width - 2 * border ) < 0) { if (!isProxy) { char message[100]; @@ -707,7 +799,18 @@ texture_error_check( GLcontext *ctx, GLenum target, } /* Height */ - if (dimensions >= 2) { + if (target == GL_TEXTURE_RECTANGLE_NV || + target == GL_PROXY_TEXTURE_RECTANGLE_NV) { + if (height < 1 || height > ctx->Const.MaxTextureRectSize) { + if (!isProxy) { + char message[100]; + sprintf(message, "glTexImage%dD(height=%d)", dimensions, height); + _mesa_error(ctx, GL_INVALID_VALUE, message); + } + return GL_TRUE; + } + } + else if (dimensions >= 2) { if (height < 2 * border || height > 2 + maxTextureSize || logbase2( height - 2 * border ) < 0) { if (!isProxy) { @@ -744,7 +847,18 @@ texture_error_check( GLcontext *ctx, GLenum target, } /* Level */ - if (level < 0 || level >= maxLevels) { + if (target == GL_TEXTURE_RECTANGLE_NV || + target == GL_PROXY_TEXTURE_RECTANGLE_NV) { + if (level != 0) { + if (!isProxy) { + char message[100]; + sprintf(message, "glTexImage%dD(level=%d)", dimensions, level); + _mesa_error(ctx, GL_INVALID_VALUE, message); + } + return GL_TRUE; + } + } + else if (level < 0 || level >= maxLevels) { if (!isProxy) { char message[100]; sprintf(message, "glTexImage%dD(level=%d)", dimensions, level); @@ -788,6 +902,21 @@ texture_error_check( GLcontext *ctx, GLenum target, return GL_TRUE; } + if (format == GL_YCBCR_MESA || iformat == GL_YCBCR_MESA) { + ASSERT(ctx->Extensions.MESA_ycbcr_texture); + if (format != GL_YCBCR_MESA || + iformat != GL_YCBCR_MESA || + (type != GL_UNSIGNED_SHORT_8_8_MESA && + type != GL_UNSIGNED_SHORT_8_8_REV_MESA)) { + char message[100]; + sprintf(message, + "glTexImage%d(format/type/internalFormat YCBCR mismatch", + dimensions); + _mesa_error(ctx, GL_INVALID_ENUM, message); + return GL_TRUE; /* error */ + } + } + /* if we get here, the parameters are OK */ return GL_FALSE; } @@ -965,10 +1094,15 @@ copytexture_error_check( GLcontext *ctx, GLuint dimensions, maxLevels = ctx->Const.MaxTextureLevels; } else if (dimensions == 2) { - if (ctx->Extensions.ARB_texture_cube_map) { - if ((target < GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB || - target > GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB) && - target != GL_TEXTURE_2D) { + if (target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB && + target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB) { + if (!ctx->Extensions.ARB_texture_cube_map) { + _mesa_error( ctx, GL_INVALID_ENUM, "glCopyTexImage2D(target)" ); + return GL_TRUE; + } + } + else if (target == GL_TEXTURE_RECTANGLE_NV) { + if (!ctx->Extensions.NV_texture_rectangle) { _mesa_error( ctx, GL_INVALID_ENUM, "glCopyTexImage2D(target)" ); return GL_TRUE; } @@ -979,6 +1113,8 @@ copytexture_error_check( GLcontext *ctx, GLuint dimensions, } if (target == GL_TEXTURE_2D) maxLevels = ctx->Const.MaxTextureLevels; + else if (target == GL_TEXTURE_RECTANGLE_NV) + maxLevels = 1; else maxLevels = ctx->Const.MaxCubeTextureLevels; } @@ -1192,7 +1328,7 @@ _mesa_GetTexImage( GLenum target, GLint level, GLenum format, { const struct gl_texture_unit *texUnit; const struct gl_texture_object *texObj; - struct gl_texture_image *texImage; + const struct gl_texture_image *texImage; GLint maxLevels = 0; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); @@ -1210,6 +1346,9 @@ _mesa_GetTexImage( GLenum target, GLint level, GLenum format, else if (target == GL_TEXTURE_3D) { maxLevels = ctx->Const.Max3DTextureLevels; } + else if (target == GL_TEXTURE_RECTANGLE_NV) { + maxLevels = 1; + } else { maxLevels = ctx->Const.MaxCubeTextureLevels; } @@ -1240,6 +1379,10 @@ _mesa_GetTexImage( GLenum target, GLint level, GLenum format, _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexImage(format)"); } + if (!ctx->Extensions.MESA_ycbcr_texture && format == GL_YCBCR_MESA) { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexImage(format)"); + } + /* XXX what if format/type doesn't match texture format/type? */ if (!pixels) @@ -1264,7 +1407,7 @@ _mesa_GetTexImage( GLenum target, GLint level, GLenum format, for (img = 0; img < depth; img++) { for (row = 0; row < height; row++) { /* compute destination address in client memory */ - GLvoid *dest = _mesa_image_address( &ctx->Unpack, pixels, + GLvoid *dest = _mesa_image_address( &ctx->Pack, pixels, width, height, format, type, img, row, 0); assert(dest); @@ -1290,6 +1433,23 @@ _mesa_GetTexImage( GLenum target, GLint level, GLenum format, _mesa_pack_depth_span(ctx, width, dest, type, depthRow, &ctx->Pack); } + else if (format == GL_YCBCR_MESA) { + const GLint rowstride = texImage->RowStride; + /* No pixel transfer */ + MEMCPY(dest, (const GLushort *) texImage->Data + row * rowstride, + width * sizeof(GLushort)); + /* check for byte swapping */ + if ((texImage->TexFormat->MesaFormat == MESA_FORMAT_YCBCR + && type == GL_UNSIGNED_SHORT_8_8_REV_MESA) || + (texImage->TexFormat->MesaFormat == MESA_FORMAT_YCBCR_REV + && type == GL_UNSIGNED_SHORT_8_8_MESA)) { + if (!ctx->Pack.SwapBytes) + _mesa_swap2((GLushort *) dest, width); + } + else if (ctx->Pack.SwapBytes) { + _mesa_swap2((GLushort *) dest, width); + } + } else { /* general case: convert row to RGBA format */ GLchan rgba[MAX_WIDTH][4]; @@ -1353,7 +1513,7 @@ _mesa_TexImage1D( GLenum target, GLint level, GLint internalFormat, texImage->Data = NULL; } clear_teximage_fields(texImage); /* not really needed, but helpful */ - _mesa_init_teximage_fields(ctx, texImage, postConvWidth, 1, 1, + _mesa_init_teximage_fields(ctx, target, texImage, postConvWidth, 1, 1, border, internalFormat); if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE) @@ -1409,7 +1569,7 @@ _mesa_TexImage1D( GLenum target, GLint level, GLint internalFormat, struct gl_texture_image *texImage; texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; texImage = _mesa_select_tex_image(ctx, texUnit, target, level); - _mesa_init_teximage_fields(ctx, texImage, postConvWidth, 1, 1, + _mesa_init_teximage_fields(ctx, target, texImage, postConvWidth, 1, 1, border, internalFormat); ASSERT(ctx->Driver.TestProxyTexImage); error = !(*ctx->Driver.TestProxyTexImage)(ctx, target, level, @@ -1448,7 +1608,9 @@ _mesa_TexImage2D( GLenum target, GLint level, GLint internalFormat, if (target == GL_TEXTURE_2D || (ctx->Extensions.ARB_texture_cube_map && target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB && - target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB)) { + target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB) || + (ctx->Extensions.NV_texture_rectangle && + target == GL_TEXTURE_RECTANGLE_NV)) { /* non-proxy target */ struct gl_texture_unit *texUnit; struct gl_texture_object *texObj; @@ -1478,7 +1640,8 @@ _mesa_TexImage2D( GLenum target, GLint level, GLint internalFormat, texImage->Data = NULL; } clear_teximage_fields(texImage); /* not really needed, but helpful */ - _mesa_init_teximage_fields(ctx, texImage, postConvWidth, postConvHeight, + _mesa_init_teximage_fields(ctx, target, texImage, + postConvWidth, postConvHeight, 1, border, internalFormat); if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE) @@ -1526,7 +1689,9 @@ _mesa_TexImage2D( GLenum target, GLint level, GLint internalFormat, } else if (target == GL_PROXY_TEXTURE_2D || (target == GL_PROXY_TEXTURE_CUBE_MAP_ARB && - ctx->Extensions.ARB_texture_cube_map)) { + ctx->Extensions.ARB_texture_cube_map) || + (target == GL_PROXY_TEXTURE_RECTANGLE_NV && + ctx->Extensions.NV_texture_rectangle)) { /* Proxy texture: check for errors and update proxy state */ GLenum error = texture_error_check(ctx, target, level, internalFormat, format, type, 2, @@ -1536,7 +1701,7 @@ _mesa_TexImage2D( GLenum target, GLint level, GLint internalFormat, struct gl_texture_image *texImage; texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; texImage = _mesa_select_tex_image(ctx, texUnit, target, level); - _mesa_init_teximage_fields(ctx, texImage, postConvWidth, + _mesa_init_teximage_fields(ctx, target, texImage, postConvWidth, postConvHeight, 1, border, internalFormat); ASSERT(ctx->Driver.TestProxyTexImage); error = !(*ctx->Driver.TestProxyTexImage)(ctx, target, level, @@ -1599,8 +1764,8 @@ _mesa_TexImage3D( GLenum target, GLint level, GLenum internalFormat, texImage->Data = NULL; } clear_teximage_fields(texImage); /* not really needed, but helpful */ - _mesa_init_teximage_fields(ctx, texImage, width, height, depth, border, - internalFormat); + _mesa_init_teximage_fields(ctx, target, texImage, width, height, depth, + border, internalFormat); if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE) _mesa_update_state(ctx); @@ -1656,7 +1821,7 @@ _mesa_TexImage3D( GLenum target, GLint level, GLenum internalFormat, struct gl_texture_image *texImage; texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; texImage = _mesa_select_tex_image(ctx, texUnit, target, level); - _mesa_init_teximage_fields(ctx, texImage, width, height, 1, + _mesa_init_teximage_fields(ctx, target, texImage, width, height, 1, border, internalFormat); ASSERT(ctx->Driver.TestProxyTexImage); error = !(*ctx->Driver.TestProxyTexImage)(ctx, target, level, @@ -1870,7 +2035,7 @@ _mesa_CopyTexImage1D( GLenum target, GLint level, } clear_teximage_fields(texImage); /* not really needed, but helpful */ - _mesa_init_teximage_fields(ctx, texImage, postConvWidth, 1, 1, + _mesa_init_teximage_fields(ctx, target, texImage, postConvWidth, 1, 1, border, internalFormat); @@ -1934,7 +2099,8 @@ _mesa_CopyTexImage2D( GLenum target, GLint level, GLenum internalFormat, } clear_teximage_fields(texImage); /* not really needed, but helpful */ - _mesa_init_teximage_fields(ctx, texImage, postConvWidth, postConvHeight, 1, + _mesa_init_teximage_fields(ctx, target, texImage, + postConvWidth, postConvHeight, 1, border, internalFormat); ASSERT(ctx->Driver.CopyTexImage2D); @@ -2118,7 +2284,7 @@ _mesa_CompressedTexImage1DARB(GLenum target, GLint level, texImage->Data = NULL; } - _mesa_init_teximage_fields(ctx, texImage, width, 1, 1, + _mesa_init_teximage_fields(ctx, target, texImage, width, 1, 1, border, internalFormat); if (ctx->Extensions.ARB_texture_compression) { @@ -2143,7 +2309,7 @@ _mesa_CompressedTexImage1DARB(GLenum target, GLint level, struct gl_texture_image *texImage; texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; texImage = _mesa_select_tex_image(ctx, texUnit, target, level); - _mesa_init_teximage_fields(ctx, texImage, width, 1, 1, + _mesa_init_teximage_fields(ctx, target, texImage, width, 1, 1, border, internalFormat); ASSERT(ctx->Driver.TestProxyTexImage); error = !(*ctx->Driver.TestProxyTexImage)(ctx, target, level, @@ -2190,13 +2356,15 @@ _mesa_CompressedTexImage2DARB(GLenum target, GLint level, if (target == GL_TEXTURE_2D || (ctx->Extensions.ARB_texture_cube_map && target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB && - target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB)) { + target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB) || + (ctx->Extensions.NV_texture_rectangle && + target == GL_TEXTURE_RECTANGLE_NV)) { struct gl_texture_unit *texUnit; struct gl_texture_object *texObj; struct gl_texture_image *texImage; if (texture_error_check(ctx, target, level, internalFormat, - GL_NONE, GL_NONE, 1, width, height, 1, border)) { + GL_NONE, GL_NONE, 2, width, height, 1, border)) { return; /* error in texture image was detected */ } @@ -2217,8 +2385,8 @@ _mesa_CompressedTexImage2DARB(GLenum target, GLint level, texImage->Data = NULL; } - _mesa_init_teximage_fields(ctx, texImage, width, height, 1, border, - internalFormat); + _mesa_init_teximage_fields(ctx, target, texImage, width, height, 1, + border, internalFormat); if (ctx->Extensions.ARB_texture_compression) { ASSERT(ctx->Driver.CompressedTexImage2D); @@ -2242,7 +2410,7 @@ _mesa_CompressedTexImage2DARB(GLenum target, GLint level, struct gl_texture_image *texImage; texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; texImage = _mesa_select_tex_image(ctx, texUnit, target, level); - _mesa_init_teximage_fields(ctx, texImage, width, height, 1, + _mesa_init_teximage_fields(ctx, target, texImage, width, height, 1, border, internalFormat); ASSERT(ctx->Driver.TestProxyTexImage); error = !(*ctx->Driver.TestProxyTexImage)(ctx, target, level, @@ -2294,7 +2462,7 @@ _mesa_CompressedTexImage3DARB(GLenum target, GLint level, struct gl_texture_image *texImage; if (texture_error_check(ctx, target, level, internalFormat, - GL_NONE, GL_NONE, 1, width, height, depth, border)) { + GL_NONE, GL_NONE, 3, width, height, depth, border)) { return; /* error in texture image was detected */ } @@ -2315,8 +2483,8 @@ _mesa_CompressedTexImage3DARB(GLenum target, GLint level, texImage->Data = NULL; } - _mesa_init_teximage_fields(ctx, texImage, width, height, depth, border, - internalFormat); + _mesa_init_teximage_fields(ctx, target, texImage, width, height, depth, + border, internalFormat); if (ctx->Extensions.ARB_texture_compression) { ASSERT(ctx->Driver.CompressedTexImage3D); @@ -2335,13 +2503,14 @@ _mesa_CompressedTexImage3DARB(GLenum target, GLint level, else if (target == GL_PROXY_TEXTURE_3D) { /* Proxy texture: check for errors and update proxy state */ GLenum error = texture_error_check(ctx, target, level, internalFormat, - GL_NONE, GL_NONE, 1, width, height, depth, border); + GL_NONE, GL_NONE, 3, width, height, depth, border); if (!error) { struct gl_texture_unit *texUnit; struct gl_texture_image *texImage; texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; texImage = _mesa_select_tex_image(ctx, texUnit, target, level); - _mesa_init_teximage_fields(ctx, texImage, width, height, depth, + _mesa_init_teximage_fields(ctx, target, texImage, + width, height, depth, border, internalFormat); ASSERT(ctx->Driver.TestProxyTexImage); error = !(*ctx->Driver.TestProxyTexImage)(ctx, target, level, diff --git a/xc/extras/Mesa/src/teximage.h b/xc/extras/Mesa/src/teximage.h index 614bc3b5a..46f9b60a5 100644 --- a/xc/extras/Mesa/src/teximage.h +++ b/xc/extras/Mesa/src/teximage.h @@ -1,7 +1,7 @@ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.0.4 * * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * @@ -47,7 +47,7 @@ _mesa_free_texture_image( struct gl_texture_image *teximage ); extern void -_mesa_init_teximage_fields(GLcontext *ctx, +_mesa_init_teximage_fields(GLcontext *ctx, GLenum target, struct gl_texture_image *img, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum internalFormat); diff --git a/xc/extras/Mesa/src/texobj.c b/xc/extras/Mesa/src/texobj.c index 96c097df3..1b0e583a2 100644 --- a/xc/extras/Mesa/src/texobj.c +++ b/xc/extras/Mesa/src/texobj.c @@ -1,7 +1,7 @@ /* * Mesa 3-D graphics library - * Version: 4.0.3 + * Version: 4.0.4 * * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. * @@ -54,11 +54,16 @@ */ struct gl_texture_object * _mesa_alloc_texture_object( struct gl_shared_state *shared, - GLuint name, GLuint dimensions ) + GLuint name, GLenum target ) { struct gl_texture_object *obj; - ASSERT(dimensions <= 3 || dimensions == 6); + ASSERT(target == 0 || + target == GL_TEXTURE_1D || + target == GL_TEXTURE_2D || + target == GL_TEXTURE_3D || + target == GL_TEXTURE_CUBE_MAP_ARB || + target == GL_TEXTURE_RECTANGLE_NV); obj = CALLOC_STRUCT(gl_texture_object); @@ -67,11 +72,20 @@ _mesa_alloc_texture_object( struct gl_shared_state *shared, _glthread_INIT_MUTEX(obj->Mutex); obj->RefCount = 1; obj->Name = name; - obj->Dimensions = dimensions; + obj->Target = target; obj->Priority = 1.0F; - obj->WrapS = GL_REPEAT; - obj->WrapT = GL_REPEAT; - obj->WrapR = GL_REPEAT; + if (target == GL_TEXTURE_RECTANGLE_NV) { + obj->WrapS = GL_CLAMP_TO_EDGE; + obj->WrapT = GL_CLAMP_TO_EDGE; + obj->WrapR = GL_CLAMP_TO_EDGE; + obj->MinFilter = GL_LINEAR; + } + else { + obj->WrapS = GL_REPEAT; + obj->WrapT = GL_REPEAT; + obj->WrapR = GL_REPEAT; + obj->MinFilter = GL_NEAREST_MIPMAP_LINEAR; + } obj->MinFilter = GL_NEAREST_MIPMAP_LINEAR; obj->MagFilter = GL_LINEAR; obj->MinLod = -1000.0; @@ -227,24 +241,32 @@ _mesa_test_texobj_completeness( const GLcontext *ctx, } /* Compute _MaxLevel */ - if (t->Dimensions == 1) { + if (t->Target == GL_TEXTURE_1D) { maxLog2 = t->Image[baseLevel]->WidthLog2; maxLevels = ctx->Const.MaxTextureLevels; } - else if (t->Dimensions == 2 || t->Dimensions == 6) { + else if (t->Target == GL_TEXTURE_2D) { maxLog2 = MAX2(t->Image[baseLevel]->WidthLog2, t->Image[baseLevel]->HeightLog2); - maxLevels = (t->Dimensions == 2) ? - ctx->Const.MaxTextureLevels : ctx->Const.MaxCubeTextureLevels; + maxLevels = ctx->Const.MaxTextureLevels; } - else if (t->Dimensions == 3) { + else if (t->Target == GL_TEXTURE_3D) { GLint max = MAX2(t->Image[baseLevel]->WidthLog2, t->Image[baseLevel]->HeightLog2); maxLog2 = MAX2(max, (GLint)(t->Image[baseLevel]->DepthLog2)); maxLevels = ctx->Const.Max3DTextureLevels; } + else if (t->Target == GL_TEXTURE_CUBE_MAP_ARB) { + maxLog2 = MAX2(t->Image[baseLevel]->WidthLog2, + t->Image[baseLevel]->HeightLog2); + maxLevels = ctx->Const.MaxCubeTextureLevels; + } + else if (t->Target == GL_TEXTURE_RECTANGLE_NV) { + maxLog2 = 0; /* not applicable */ + maxLevels = 1; /* no mipmapping */ + } else { - _mesa_problem(ctx, "Bad t->Dimension in _mesa_test_texobj_completeness"); + _mesa_problem(ctx, "Bad t->Target in _mesa_test_texobj_completeness"); return; } @@ -257,7 +279,7 @@ _mesa_test_texobj_completeness( const GLcontext *ctx, /* Compute _MaxLambda = q - b (see the 1.2 spec) used during mipmapping */ t->_MaxLambda = (GLfloat) (t->_MaxLevel - t->BaseLevel); - if (t->Dimensions == 6) { + if (t->Target == GL_TEXTURE_CUBE_MAP_ARB) { /* make sure that all six cube map level 0 images are the same size */ const GLuint w = t->Image[baseLevel]->Width2; const GLuint h = t->Image[baseLevel]->Height2; @@ -313,7 +335,7 @@ _mesa_test_texobj_completeness( const GLcontext *ctx, } /* Test things which depend on number of texture image dimensions */ - if (t->Dimensions == 1) { + if (t->Target == GL_TEXTURE_1D) { /* Test 1-D mipmaps */ GLuint width = t->Image[baseLevel]->Width2; for (i = baseLevel + 1; i < maxLevels; i++) { @@ -337,7 +359,7 @@ _mesa_test_texobj_completeness( const GLcontext *ctx, } } } - else if (t->Dimensions == 2) { + else if (t->Target == GL_TEXTURE_2D) { /* Test 2-D mipmaps */ GLuint width = t->Image[baseLevel]->Width2; GLuint height = t->Image[baseLevel]->Height2; @@ -370,7 +392,7 @@ _mesa_test_texobj_completeness( const GLcontext *ctx, } } } - else if (t->Dimensions == 3) { + else if (t->Target == GL_TEXTURE_3D) { /* Test 3-D mipmaps */ GLuint width = t->Image[baseLevel]->Width2; GLuint height = t->Image[baseLevel]->Height2; @@ -412,7 +434,7 @@ _mesa_test_texobj_completeness( const GLcontext *ctx, } } } - else if (t->Dimensions == 6) { + else if (t->Target == GL_TEXTURE_CUBE_MAP_ARB) { /* make sure 6 cube faces are consistant */ GLuint width = t->Image[baseLevel]->Width2; GLuint height = t->Image[baseLevel]->Height2; @@ -448,6 +470,10 @@ _mesa_test_texobj_completeness( const GLcontext *ctx, } } } + else if (t->Target == GL_TEXTURE_RECTANGLE_NV) { + /* XXX special checking? */ + + } else { /* Dimensions = ??? */ _mesa_problem(ctx, "Bug in gl_test_texture_object_completeness\n"); @@ -581,7 +607,6 @@ _mesa_BindTexture( GLenum target, GLuint texName ) struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; struct gl_texture_object *oldTexObj; struct gl_texture_object *newTexObj = 0; - GLuint targetDim; ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) @@ -590,24 +615,28 @@ _mesa_BindTexture( GLenum target, GLuint texName ) switch (target) { case GL_TEXTURE_1D: - targetDim = 1; oldTexObj = texUnit->Current1D; break; case GL_TEXTURE_2D: - targetDim = 2; oldTexObj = texUnit->Current2D; break; case GL_TEXTURE_3D: - targetDim = 3; oldTexObj = texUnit->Current3D; break; case GL_TEXTURE_CUBE_MAP_ARB: - if (ctx->Extensions.ARB_texture_cube_map) { - targetDim = 6; - oldTexObj = texUnit->CurrentCubeMap; - break; + if (!ctx->Extensions.ARB_texture_cube_map) { + _mesa_error( ctx, GL_INVALID_ENUM, "glBindTexture(target)" ); + return; + } + oldTexObj = texUnit->CurrentCubeMap; + break; + case GL_TEXTURE_RECTANGLE_NV: + if (!ctx->Extensions.NV_texture_rectangle) { + _mesa_error( ctx, GL_INVALID_ENUM, "glBindTexture(target)" ); + return; } - /* fallthrough */ + oldTexObj = texUnit->CurrentRect; + break; default: _mesa_error( ctx, GL_INVALID_ENUM, "glBindTexture(target)" ); return; @@ -634,6 +663,9 @@ _mesa_BindTexture( GLenum target, GLuint texName ) case GL_TEXTURE_CUBE_MAP_ARB: newTexObj = ctx->Shared->DefaultCubeMap; break; + case GL_TEXTURE_RECTANGLE_NV: + newTexObj = ctx->Shared->DefaultRect; + break; default: ; /* Bad targets are caught above */ } @@ -644,23 +676,30 @@ _mesa_BindTexture( GLenum target, GLuint texName ) newTexObj = (struct gl_texture_object *) _mesa_HashLookup(hash, texName); if (newTexObj) { /* error checking */ - if (newTexObj->Dimensions > 0 && newTexObj->Dimensions != targetDim) { + if (newTexObj->Target != 0 && newTexObj->Target != target) { /* the named texture object's dimensions don't match the target */ _mesa_error( ctx, GL_INVALID_OPERATION, "glBindTexture(wrong dimensionality)" ); return; } + if (newTexObj->Target == 0 && target == GL_TEXTURE_RECTANGLE_NV) { + /* have to init wrap and filter state here - kind of klunky */ + newTexObj->WrapS = GL_CLAMP_TO_EDGE; + newTexObj->WrapT = GL_CLAMP_TO_EDGE; + newTexObj->WrapR = GL_CLAMP_TO_EDGE; + newTexObj->MinFilter = GL_LINEAR; + } } else { /* if this is a new texture id, allocate a texture object now */ newTexObj = _mesa_alloc_texture_object( ctx->Shared, texName, - targetDim); + target); if (!newTexObj) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBindTexture"); return; } } - newTexObj->Dimensions = targetDim; + newTexObj->Target = target; } newTexObj->RefCount++; @@ -682,6 +721,9 @@ _mesa_BindTexture( GLenum target, GLuint texName ) case GL_TEXTURE_CUBE_MAP_ARB: texUnit->CurrentCubeMap = newTexObj; break; + case GL_TEXTURE_RECTANGLE_NV: + texUnit->CurrentRect = newTexObj; + break; default: _mesa_problem(ctx, "bad target in BindTexture"); } diff --git a/xc/extras/Mesa/src/texobj.h b/xc/extras/Mesa/src/texobj.h index da701be0b..c04f732eb 100644 --- a/xc/extras/Mesa/src/texobj.h +++ b/xc/extras/Mesa/src/texobj.h @@ -1,7 +1,7 @@ /* * Mesa 3-D graphics library - * Version: 4.0.3 + * Version: 4.0.4 * * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. * @@ -38,7 +38,7 @@ extern struct gl_texture_object * _mesa_alloc_texture_object( struct gl_shared_state *shared, GLuint name, - GLuint dimensions ); + GLenum target ); extern void diff --git a/xc/extras/Mesa/src/texstate.c b/xc/extras/Mesa/src/texstate.c index 89db8520c..eae7db349 100644 --- a/xc/extras/Mesa/src/texstate.c +++ b/xc/extras/Mesa/src/texstate.c @@ -1,7 +1,7 @@ /* * Mesa 3-D graphics library - * Version: 4.0.3 + * Version: 4.0.4 * * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. * @@ -113,6 +113,8 @@ _mesa_copy_texture_state( const GLcontext *src, GLcontext *dst ) src->Texture.Unit[i].Current3D); _mesa_copy_texture_object(dst->Texture.Unit[i].CurrentCubeMap, src->Texture.Unit[i].CurrentCubeMap); + _mesa_copy_texture_object(dst->Texture.Unit[i].CurrentRect, + src->Texture.Unit[i].CurrentRect); } } @@ -985,11 +987,19 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params ) texObj = texUnit->Current3D; break; case GL_TEXTURE_CUBE_MAP_ARB: - if (ctx->Extensions.ARB_texture_cube_map) { - texObj = texUnit->CurrentCubeMap; - break; + if (!ctx->Extensions.ARB_texture_cube_map) { + _mesa_error( ctx, GL_INVALID_ENUM, "glTexParameter(target)" ); + return; } - /* fallthrough */ + texObj = texUnit->CurrentCubeMap; + break; + case GL_TEXTURE_RECTANGLE_NV: + if (!ctx->Extensions.NV_texture_rectangle) { + _mesa_error( ctx, GL_INVALID_ENUM, "glTexParameter(target)" ); + return; + } + texObj = texUnit->CurrentRect; + break; default: _mesa_error( ctx, GL_INVALID_ENUM, "glTexParameter(target)" ); return; @@ -1001,11 +1011,15 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params ) if (texObj->MinFilter == eparam) return; - if (eparam==GL_NEAREST || eparam==GL_LINEAR - || eparam==GL_NEAREST_MIPMAP_NEAREST - || eparam==GL_LINEAR_MIPMAP_NEAREST - || eparam==GL_NEAREST_MIPMAP_LINEAR - || eparam==GL_LINEAR_MIPMAP_LINEAR) { + if (eparam==GL_NEAREST || eparam==GL_LINEAR) { + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texObj->MinFilter = eparam; + } + else if ((eparam==GL_NEAREST_MIPMAP_NEAREST || + eparam==GL_LINEAR_MIPMAP_NEAREST || + eparam==GL_NEAREST_MIPMAP_LINEAR || + eparam==GL_LINEAR_MIPMAP_LINEAR) && + texObj->Target != GL_TEXTURE_RECTANGLE_NV) { FLUSH_VERTICES(ctx, _NEW_TEXTURE); texObj->MinFilter = eparam; } @@ -1031,13 +1045,18 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params ) case GL_TEXTURE_WRAP_S: if (texObj->WrapS == eparam) return; - if (eparam==GL_CLAMP || - eparam==GL_REPEAT || - eparam==GL_CLAMP_TO_EDGE || + if (eparam == GL_CLAMP || eparam == GL_CLAMP_TO_EDGE || (eparam == GL_CLAMP_TO_BORDER_ARB && - ctx->Extensions.ARB_texture_border_clamp) || - (eparam == GL_MIRRORED_REPEAT_ARB && - ctx->Extensions.ARB_texture_mirrored_repeat)) { + ctx->Extensions.ARB_texture_border_clamp)) { + /* any texture target */ + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texObj->WrapS = eparam; + } + else if (texObj->Target != GL_TEXTURE_RECTANGLE_NV && + (eparam == GL_REPEAT || + (eparam == GL_MIRRORED_REPEAT_ARB && + ctx->Extensions.ARB_texture_mirrored_repeat))) { + /* non-rectangle texture */ FLUSH_VERTICES(ctx, _NEW_TEXTURE); texObj->WrapS = eparam; } @@ -1049,13 +1068,18 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params ) case GL_TEXTURE_WRAP_T: if (texObj->WrapT == eparam) return; - if (eparam==GL_CLAMP || - eparam==GL_REPEAT || - eparam==GL_CLAMP_TO_EDGE || + if (eparam == GL_CLAMP || eparam == GL_CLAMP_TO_EDGE || (eparam == GL_CLAMP_TO_BORDER_ARB && - ctx->Extensions.ARB_texture_border_clamp) || - (eparam == GL_MIRRORED_REPEAT_ARB && - ctx->Extensions.ARB_texture_mirrored_repeat)) { + ctx->Extensions.ARB_texture_border_clamp)) { + /* any texture target */ + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texObj->WrapT = eparam; + } + else if (texObj->Target != GL_TEXTURE_RECTANGLE_NV && + (eparam == GL_REPEAT || + (eparam == GL_MIRRORED_REPEAT_ARB && + ctx->Extensions.ARB_texture_mirrored_repeat))) { + /* non-rectangle texture */ FLUSH_VERTICES(ctx, _NEW_TEXTURE); texObj->WrapT = eparam; } @@ -1067,13 +1091,18 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params ) case GL_TEXTURE_WRAP_R_EXT: if (texObj->WrapR == eparam) return; - if (eparam==GL_CLAMP || - eparam==GL_REPEAT || - eparam==GL_CLAMP_TO_EDGE || + if (eparam == GL_CLAMP || eparam == GL_CLAMP_TO_EDGE || (eparam == GL_CLAMP_TO_BORDER_ARB && - ctx->Extensions.ARB_texture_border_clamp) || - (eparam == GL_MIRRORED_REPEAT_ARB && - ctx->Extensions.ARB_texture_mirrored_repeat)) { + ctx->Extensions.ARB_texture_border_clamp)) { + /* any texture target */ + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texObj->WrapR = eparam; + } + else if (texObj->Target != GL_TEXTURE_RECTANGLE_NV && + (eparam == GL_REPEAT || + (eparam == GL_MIRRORED_REPEAT_ARB && + ctx->Extensions.ARB_texture_mirrored_repeat))) { + /* non-rectangle texture */ FLUSH_VERTICES(ctx, _NEW_TEXTURE); texObj->WrapR = eparam; } @@ -1105,6 +1134,10 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params ) _mesa_error(ctx, GL_INVALID_VALUE, "glTexParameter(param)" ); return; } + if (target == GL_TEXTURE_RECTANGLE_NV && params[0] != 0.0) { + _mesa_error(ctx, GL_INVALID_VALUE, "glTexParameter(param)" ); + return; + } FLUSH_VERTICES(ctx, _NEW_TEXTURE); texObj->BaseLevel = (GLint) params[0]; break; @@ -1255,6 +1288,9 @@ tex_image_dimensions(GLcontext *ctx, GLenum target) case GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB: case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB: return ctx->Extensions.ARB_texture_cube_map ? 2 : 0; + case GL_TEXTURE_RECTANGLE_NV: + case GL_PROXY_TEXTURE_RECTANGLE_NV: + return ctx->Extensions.NV_texture_rectangle ? 2 : 0; default: _mesa_problem(ctx, "bad target in _mesa_tex_target_dimensions()"); return 0; @@ -1291,6 +1327,19 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level, case GL_PROXY_TEXTURE_3D: maxLevels = ctx->Const.Max3DTextureLevels; break; + case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB: + case GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB: + case GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB: + case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB: + case GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB: + case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB: + case GL_PROXY_TEXTURE_CUBE_MAP_ARB: + maxLevels = ctx->Const.MaxCubeTextureLevels; + break; + case GL_TEXTURE_RECTANGLE_NV: + case GL_PROXY_TEXTURE_RECTANGLE_NV: + maxLevels = 1; + break; default: maxLevels = ctx->Const.MaxCubeTextureLevels; break; @@ -1314,7 +1363,8 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level, isProxy = (target == GL_PROXY_TEXTURE_1D) || (target == GL_PROXY_TEXTURE_2D) || (target == GL_PROXY_TEXTURE_3D) || - (target == GL_PROXY_TEXTURE_CUBE_MAP_ARB); + (target == GL_PROXY_TEXTURE_CUBE_MAP_ARB) || + (target == GL_PROXY_TEXTURE_RECTANGLE_NV); switch (pname) { case GL_TEXTURE_WIDTH: @@ -1362,9 +1412,6 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level, *params = 0; else if (img->TexFormat->IntensityBits > 0) *params = img->TexFormat->IntensityBits; - else if (img->TexFormat->LuminanceBits > 0) - /* intensity probably stored as luminance-alpha texture */ - *params = MIN2(img->TexFormat->LuminanceBits, img->TexFormat->AlphaBits); else /* intensity probably stored as rgb texture */ *params = MIN2(img->TexFormat->RedBits, img->TexFormat->GreenBits); return; diff --git a/xc/extras/Mesa/src/texstore.c b/xc/extras/Mesa/src/texstore.c index 04c20d447..634f719be 100644 --- a/xc/extras/Mesa/src/texstore.c +++ b/xc/extras/Mesa/src/texstore.c @@ -1,7 +1,7 @@ /* * Mesa 3-D graphics library - * Version: 4.0.3 + * Version: 4.0.4 * * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. * @@ -114,6 +114,8 @@ components_in_intformat( GLint format ) case GL_DEPTH_COMPONENT24_SGIX: case GL_DEPTH_COMPONENT32_SGIX: return 1; + case GL_YCBCR_MESA: + return 2; /* Y + (Cb or Cr) */ default: return -1; /* error */ } @@ -254,6 +256,27 @@ transfer_teximage(GLcontext *ctx, GLuint dimensions, dest += dstImageStride; } } + else if (texDestFormat == GL_YCBCR_MESA) { + /* YCbCr texture */ + GLint img, row; + GLushort *dest = (GLushort *) texDestAddr + + dstZoffset * (dstImageStride / sizeof(GLushort)) + + dstYoffset * (dstRowStride / sizeof(GLushort)) + + dstXoffset * texComponents; + ASSERT(ctx->Extensions.MESA_ycbcr_texture); + printf("copy ycbcr\n"); + for (img = 0; img < srcDepth; img++) { + GLushort *destRow = dest; + for (row = 0; row < srcHeight; row++) { + const GLvoid *srcRow = _mesa_image_address(srcPacking, + srcAddr, srcWidth, srcHeight, + srcFormat, srcType, img, row, 0); + MEMCPY(destRow, srcRow, srcWidth * sizeof(GLushort)); + destRow += (dstRowStride / sizeof(GLushort)); + } + dest += dstImageStride / sizeof(GLushort); + } + } else if (texDestFormat == GL_DEPTH_COMPONENT) { /* Depth texture (shadow maps) */ GLint img, row; @@ -665,7 +688,7 @@ _mesa_store_teximage1d(GLcontext *ctx, GLenum target, GLint level, /* GL_SGIS_generate_mipmap */ if (level == texObj->BaseLevel && texObj->GenerateMipmap) { - _mesa_generate_mipmap(ctx, + _mesa_generate_mipmap(ctx, target, &ctx->Texture.Unit[ctx->Texture.CurrentUnit], texObj); } @@ -738,7 +761,7 @@ _mesa_store_teximage2d(GLcontext *ctx, GLenum target, GLint level, /* GL_SGIS_generate_mipmap */ if (level == texObj->BaseLevel && texObj->GenerateMipmap) { - _mesa_generate_mipmap(ctx, + _mesa_generate_mipmap(ctx, target, &ctx->Texture.Unit[ctx->Texture.CurrentUnit], texObj); } @@ -804,7 +827,7 @@ _mesa_store_teximage3d(GLcontext *ctx, GLenum target, GLint level, /* GL_SGIS_generate_mipmap */ if (level == texObj->BaseLevel && texObj->GenerateMipmap) { - _mesa_generate_mipmap(ctx, + _mesa_generate_mipmap(ctx, target, &ctx->Texture.Unit[ctx->Texture.CurrentUnit], texObj); } @@ -836,7 +859,8 @@ _mesa_store_texsubimage1d(GLcontext *ctx, GLenum target, GLint level, /* GL_SGIS_generate_mipmap */ if (level == texObj->BaseLevel && texObj->GenerateMipmap) { - _mesa_generate_mipmap(ctx, &ctx->Texture.Unit[ctx->Texture.CurrentUnit], + _mesa_generate_mipmap(ctx, target, + &ctx->Texture.Unit[ctx->Texture.CurrentUnit], texObj); } } @@ -865,7 +889,8 @@ _mesa_store_texsubimage2d(GLcontext *ctx, GLenum target, GLint level, /* GL_SGIS_generate_mipmap */ if (level == texObj->BaseLevel && texObj->GenerateMipmap) { - _mesa_generate_mipmap(ctx, &ctx->Texture.Unit[ctx->Texture.CurrentUnit], + _mesa_generate_mipmap(ctx, target, + &ctx->Texture.Unit[ctx->Texture.CurrentUnit], texObj); } } @@ -894,7 +919,8 @@ _mesa_store_texsubimage3d(GLcontext *ctx, GLenum target, GLint level, format, type, pixels, packing); /* GL_SGIS_generate_mipmap */ if (level == texObj->BaseLevel && texObj->GenerateMipmap) { - _mesa_generate_mipmap(ctx, &ctx->Texture.Unit[ctx->Texture.CurrentUnit], + _mesa_generate_mipmap(ctx, target, + &ctx->Texture.Unit[ctx->Texture.CurrentUnit], texObj); } } @@ -1602,44 +1628,32 @@ make_3d_mipmap(const struct gl_texture_format *format, GLint border, * Stop at texObj's MaxLevel or when we get to the 1x1 texture. */ void -_mesa_generate_mipmap(GLcontext *ctx, +_mesa_generate_mipmap(GLcontext *ctx, GLenum target, const struct gl_texture_unit *texUnit, struct gl_texture_object *texObj) { - const GLenum targets1D[] = { GL_TEXTURE_1D, 0 }; - const GLenum targets2D[] = { GL_TEXTURE_2D, 0 }; - const GLenum targets3D[] = { GL_TEXTURE_3D, 0 }; - const GLenum targetsCube[] = { GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB, - GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB, - GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB, - GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB, - GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB, - GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB, - 0 }; - const GLenum *targets; GLint level; GLint maxLevels = 0; ASSERT(texObj); ASSERT(texObj->Image[texObj->BaseLevel]); - switch (texObj->Dimensions) { - case 1: - targets = targets1D; + switch (texObj->Target) { + case GL_TEXTURE_1D: maxLevels = ctx->Const.MaxTextureLevels; break; - case 2: - targets = targets2D; + case GL_TEXTURE_2D: maxLevels = ctx->Const.MaxTextureLevels; break; - case 3: - targets = targets3D; + case GL_TEXTURE_3D: maxLevels = ctx->Const.Max3DTextureLevels; break; - case 6: - targets = targetsCube; + case GL_TEXTURE_CUBE_MAP_ARB: maxLevels = ctx->Const.MaxCubeTextureLevels; break; + case GL_TEXTURE_RECTANGLE_NV: + maxLevels = 1; + break; default: _mesa_problem(ctx, "Bad texture object dimension in _mesa_generate_mipmaps"); @@ -1654,7 +1668,6 @@ _mesa_generate_mipmap(GLcontext *ctx, GLint srcWidth, srcHeight, srcDepth; GLint dstWidth, dstHeight, dstDepth; GLint border, bytesPerTexel; - GLint t; srcImage = texObj->Image[level]; ASSERT(srcImage); @@ -1691,67 +1704,73 @@ _mesa_generate_mipmap(GLcontext *ctx, return; } - /* Need this loop just because of cubemaps */ - for (t = 0; targets[t]; t++) { - ASSERT(t < 6); - - dstImage = _mesa_select_tex_image(ctx, texUnit, targets[t], level+1); + /* get dest gl_texture_image */ + dstImage = _mesa_select_tex_image(ctx, texUnit, target, level+1); + if (!dstImage) { + dstImage = _mesa_alloc_texture_image(); if (!dstImage) { - dstImage = _mesa_alloc_texture_image(); - if (!dstImage) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "generating mipmaps"); - return; - } - _mesa_set_tex_image(texObj, targets[t], level + 1, dstImage); - } - - /* Free old image data */ - if (dstImage->Data) - MESA_PBUFFER_FREE(dstImage->Data); - - /* initialize new image */ - _mesa_init_teximage_fields(ctx, dstImage, dstWidth, dstHeight, - dstDepth, border, srcImage->Format); - dstImage->DriverData = NULL; - dstImage->TexFormat = srcImage->TexFormat; - dstImage->FetchTexel = srcImage->FetchTexel; - ASSERT(dstImage->TexFormat); - ASSERT(dstImage->FetchTexel); - - ASSERT(dstWidth * dstHeight * dstDepth * bytesPerTexel > 0); - - /* alloc new image buffer */ - dstImage->Data = MESA_PBUFFER_ALLOC(dstWidth * dstHeight * dstDepth - * bytesPerTexel); - if (!dstImage->Data) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "generating mipmaps"); return; } + _mesa_set_tex_image(texObj, target, level + 1, dstImage); + } - /* - * We use simple 2x2 averaging to compute the next mipmap level. - */ - switch (texObj->Dimensions) { - case 1: - make_1d_mipmap(srcImage->TexFormat, border, - srcWidth, (const GLubyte *) srcImage->Data, - dstWidth, (GLubyte *) dstImage->Data); - break; - case 2: - case 6: - make_2d_mipmap(srcImage->TexFormat, border, - srcWidth, srcHeight, (const GLubyte *) srcImage->Data, - dstWidth, dstHeight, (GLubyte *) dstImage->Data); - break; - case 3: - make_3d_mipmap(srcImage->TexFormat, border, - srcWidth, srcHeight, srcDepth, (const GLubyte *) srcImage->Data, - dstWidth, dstHeight, dstDepth, (GLubyte *) dstImage->Data); - break; - default: - _mesa_problem(ctx, "bad dimensions in _mesa_generate_mipmaps"); - return; - } - } /* loop over tex image targets */ + /* Free old image data */ + if (dstImage->Data) + MESA_PBUFFER_FREE(dstImage->Data); + + /* initialize new image */ + _mesa_init_teximage_fields(ctx, target, dstImage, dstWidth, dstHeight, + dstDepth, border, srcImage->Format); + dstImage->DriverData = NULL; + dstImage->TexFormat = srcImage->TexFormat; + dstImage->FetchTexel = srcImage->FetchTexel; + ASSERT(dstImage->TexFormat); + ASSERT(dstImage->FetchTexel); + + ASSERT(dstWidth * dstHeight * dstDepth * bytesPerTexel > 0); + + /* alloc new image buffer */ + dstImage->Data = MESA_PBUFFER_ALLOC(dstWidth * dstHeight * dstDepth + * bytesPerTexel); + if (!dstImage->Data) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "generating mipmaps"); + return; + } + + /* + * We use simple 2x2 averaging to compute the next mipmap level. + */ + switch (target) { + case GL_TEXTURE_1D: + make_1d_mipmap(srcImage->TexFormat, border, + srcWidth, (const GLubyte *) srcImage->Data, + dstWidth, (GLubyte *) dstImage->Data); + break; + case GL_TEXTURE_2D: + case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB: + case GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB: + case GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB: + case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB: + case GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB: + case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB: + make_2d_mipmap(srcImage->TexFormat, border, + srcWidth, srcHeight, (const GLubyte *) srcImage->Data, + dstWidth, dstHeight, (GLubyte *) dstImage->Data); + break; + case GL_TEXTURE_3D: + make_3d_mipmap(srcImage->TexFormat, border, + srcWidth, srcHeight, srcDepth, + (const GLubyte *) srcImage->Data, + dstWidth, dstHeight, dstDepth, + (GLubyte *) dstImage->Data); + break; + case GL_TEXTURE_RECTANGLE_NV: + /* no mipmaps, do nothing */ + break; + default: + _mesa_problem(ctx, "bad dimensions in _mesa_generate_mipmaps"); + return; + } } /* loop over tex levels */ } diff --git a/xc/extras/Mesa/src/texstore.h b/xc/extras/Mesa/src/texstore.h index 5f5eabc64..553732b34 100644 --- a/xc/extras/Mesa/src/texstore.h +++ b/xc/extras/Mesa/src/texstore.h @@ -1,9 +1,9 @@ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.0.4 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -148,7 +148,7 @@ _mesa_test_proxy_teximage(GLcontext *ctx, GLenum target, GLint level, extern void -_mesa_generate_mipmap(GLcontext *ctx, +_mesa_generate_mipmap(GLcontext *ctx, GLenum target, const struct gl_texture_unit *texUnit, struct gl_texture_object *texObj); diff --git a/xc/extras/Mesa/src/texutil.c b/xc/extras/Mesa/src/texutil.c index bf9285a7e..38f4f7fae 100644 --- a/xc/extras/Mesa/src/texutil.c +++ b/xc/extras/Mesa/src/texutil.c @@ -26,6 +26,14 @@ * Gareth Hughes <gareth@valinux.com> */ +/* + * Description: + * Functions for texture image conversion. This takes care of converting + * typical GL_RGBA/GLubyte textures into hardware-specific formats. + * We can handle non-standard row strides and pixel unpacking parameters. + */ + + #ifdef PC_HEADER #include "all.h" #else @@ -50,7 +58,7 @@ #endif -struct gl_texture_convert { +struct convert_info { GLint xoffset, yoffset, zoffset; /* Subimage offset */ GLint width, height, depth; /* Subimage region */ @@ -66,15 +74,16 @@ struct gl_texture_convert { GLint index; }; -typedef GLboolean (*convert_func)( struct gl_texture_convert *convert ); +typedef GLboolean (*convert_func)( const struct convert_info *convert ); +/* bitvalues for convert->index */ #define CONVERT_STRIDE_BIT 0x1 #define CONVERT_UNPACKING_BIT 0x2 /* ============================================================= - * RGBA8888 textures: + * Convert to RGBA8888 textures: */ #define DST_TYPE GLuint @@ -117,7 +126,7 @@ typedef GLboolean (*convert_func)( struct gl_texture_convert *convert ); #define CONVERT_RGBA8888( name ) \ static GLboolean \ -convert_##name##_rgba8888( struct gl_texture_convert *convert ) \ +convert_##name##_rgba8888( const struct convert_info *convert ) \ { \ convert_func *tab; \ GLint index = convert->index; \ @@ -153,7 +162,7 @@ CONVERT_RGBA8888( texsubimage3d ) /* ============================================================= - * ARGB8888 textures: + * Convert to ARGB8888 textures: */ #define DST_TYPE GLuint @@ -196,7 +205,7 @@ CONVERT_RGBA8888( texsubimage3d ) #define CONVERT_ARGB8888( name ) \ static GLboolean \ -convert_##name##_argb8888( struct gl_texture_convert *convert ) \ +convert_##name##_argb8888( const struct convert_info *convert ) \ { \ convert_func *tab; \ GLint index = convert->index; \ @@ -231,11 +240,11 @@ CONVERT_ARGB8888( texsubimage3d ) /* ============================================================= - * RGB888 textures: + * Convert to RGB888 textures: */ static GLboolean -convert_texsubimage2d_rgb888( struct gl_texture_convert *convert ) +convert_texsubimage2d_rgb888( const struct convert_info *convert ) { /* This is a placeholder for now... */ @@ -243,7 +252,7 @@ convert_texsubimage2d_rgb888( struct gl_texture_convert *convert ) } static GLboolean -convert_texsubimage3d_rgb888( struct gl_texture_convert *convert ) +convert_texsubimage3d_rgb888( const struct convert_info *convert ) { /* This is a placeholder for now... */ @@ -253,7 +262,7 @@ convert_texsubimage3d_rgb888( struct gl_texture_convert *convert ) /* ============================================================= - * RGB565 textures: + * Convert to RGB565 textures: */ #define DST_TYPE GLushort @@ -300,7 +309,7 @@ convert_texsubimage3d_rgb888( struct gl_texture_convert *convert ) #define CONVERT_RGB565( name ) \ static GLboolean \ -convert_##name##_rgb565( struct gl_texture_convert *convert ) \ +convert_##name##_rgb565( const struct convert_info *convert ) \ { \ convert_func *tab; \ GLint index = convert->index; \ @@ -335,7 +344,7 @@ CONVERT_RGB565( texsubimage3d ) /* ============================================================= - * ARGB4444 textures: + * Convert to ARGB4444 textures: */ #define DST_TYPE GLushort @@ -368,7 +377,7 @@ CONVERT_RGB565( texsubimage3d ) #define CONVERT_ARGB4444( name ) \ static GLboolean \ -convert_##name##_argb4444( struct gl_texture_convert *convert ) \ +convert_##name##_argb4444( const struct convert_info *convert ) \ { \ convert_func *tab; \ GLint index = convert->index; \ @@ -398,7 +407,7 @@ CONVERT_ARGB4444( texsubimage3d ) /* ============================================================= - * ARGB1555 textures: + * Convert to ARGB1555 textures: */ #define DST_TYPE GLushort @@ -462,7 +471,7 @@ CONVERT_ARGB4444( texsubimage3d ) #define CONVERT_ARGB1555( name ) \ static GLboolean \ -convert_##name##_argb1555( struct gl_texture_convert *convert ) \ +convert_##name##_argb1555( const struct convert_info *convert ) \ { \ convert_func *tab; \ GLint index = convert->index; \ @@ -497,7 +506,7 @@ CONVERT_ARGB1555( texsubimage3d ) /* ============================================================= - * AL88 textures: + * Conver to AL88 textures: */ #define DST_TYPE GLushort @@ -519,7 +528,7 @@ CONVERT_ARGB1555( texsubimage3d ) dst = PACK_COLOR_88_LE( src[0], 0x00 ) #define CONVERT_TEXEL_DWORD( dst, src ) \ - dst = APPEND16( PACK_COLOR_88_LE( src[0], 0x00 ), \ + dst = APPEND16( PACK_COLOR_88_LE( src[0], 0x00 ), \ PACK_COLOR_88_LE( src[1], 0x00 ) ) #define SRC_TEXEL_BYTES 1 @@ -558,7 +567,7 @@ CONVERT_ARGB1555( texsubimage3d ) #define CONVERT_AL88( name ) \ static GLboolean \ -convert_##name##_al88( struct gl_texture_convert *convert ) \ +convert_##name##_al88( const struct convert_info *convert ) \ { \ convert_func *tab; \ GLint index = convert->index; \ @@ -598,11 +607,11 @@ CONVERT_AL88( texsubimage3d ) /* ============================================================= - * RGB332 textures: + * Convert to RGB332 textures: */ static GLboolean -convert_texsubimage2d_rgb332( struct gl_texture_convert *convert ) +convert_texsubimage2d_rgb332( const struct convert_info *convert ) { /* This is a placeholder for now... */ @@ -610,7 +619,7 @@ convert_texsubimage2d_rgb332( struct gl_texture_convert *convert ) } static GLboolean -convert_texsubimage3d_rgb332( struct gl_texture_convert *convert ) +convert_texsubimage3d_rgb332( const struct convert_info *convert ) { /* This is a placeholder for now... */ @@ -620,7 +629,7 @@ convert_texsubimage3d_rgb332( struct gl_texture_convert *convert ) /* ============================================================= - * CI8 (and all other single-byte texel) textures: + * Convert to CI8 (and all other single-byte texel) textures: */ #define DST_TYPE GLubyte @@ -638,7 +647,7 @@ convert_texsubimage3d_rgb332( struct gl_texture_convert *convert ) #define CONVERT_CI8( name ) \ static GLboolean \ -convert_##name##_ci8( struct gl_texture_convert *convert ) \ +convert_##name##_ci8( const struct convert_info *convert ) \ { \ convert_func *tab; \ GLint index = convert->index; \ @@ -664,12 +673,88 @@ CONVERT_CI8( texsubimage2d ) CONVERT_CI8( texsubimage3d ) +/* ============================================================= + * convert to YCBCR textures: + */ + +#define DST_TYPE GLushort +#define DST_TEXELS_PER_DWORD 2 + +#define CONVERT_TEXEL( dst, src ) \ + dst = (src[0] << 8) | src[1]; + +#define CONVERT_DIRECT + +#define SRC_TEXEL_BYTES 2 + +#define TAG(x) x##_ycbcr_direct +#include "texutil_tmp.h" + + +#define CONVERT_YCBCR( name ) \ +static GLboolean \ +convert_##name##_ycbcr( const struct convert_info *convert ) \ +{ \ + convert_func *tab; \ + GLint index = convert->index; \ + \ + if (convert->format != GL_YCBCR_MESA) { \ + /* Can't handle this source format/type combination */ \ + return GL_FALSE; \ + } \ + tab = name##_tab_ycbcr_direct; \ + \ + return tab[index]( convert ); \ +} + +CONVERT_YCBCR( texsubimage2d ) +CONVERT_YCBCR( texsubimage3d ) + + +/* ============================================================= + * convert to YCBCR_REV textures: + */ + +#define DST_TYPE GLushort +#define DST_TEXELS_PER_DWORD 2 + +#define CONVERT_TEXEL( dst, src ) \ + dst = (src[1] << 8) | src[0]; + +#define CONVERT_DIRECT + +#define SRC_TEXEL_BYTES 2 + +#define TAG(x) x##_ycbcr_rev_direct +#include "texutil_tmp.h" + + +#define CONVERT_YCBCR_REV( name ) \ +static GLboolean \ +convert_##name##_ycbcr_rev( const struct convert_info *convert ) \ +{ \ + convert_func *tab; \ + GLint index = convert->index; \ + \ + if (convert->format != GL_YCBCR_MESA) { \ + /* Can't handle this source format/type combination */ \ + return GL_FALSE; \ + } \ + tab = name##_tab_ycbcr_rev_direct; \ + \ + return tab[index]( convert ); \ +} + +CONVERT_YCBCR_REV( texsubimage2d ) +CONVERT_YCBCR_REV( texsubimage3d ) + + /* ============================================================= - * Global entry points + * Tables of texture conversion/packing functions. */ -static convert_func gl_convert_texsubimage2d_tab[] = { +static convert_func convert_texsubimage2d_table[] = { convert_texsubimage2d_rgba8888, convert_texsubimage2d_argb8888, convert_texsubimage2d_rgb888, @@ -682,9 +767,11 @@ static convert_func gl_convert_texsubimage2d_tab[] = { convert_texsubimage2d_ci8, convert_texsubimage2d_ci8, convert_texsubimage2d_ci8, + convert_texsubimage2d_ycbcr, + convert_texsubimage2d_ycbcr_rev, }; -static convert_func gl_convert_texsubimage3d_tab[] = { +static convert_func convert_texsubimage3d_table[] = { convert_texsubimage3d_rgba8888, convert_texsubimage3d_argb8888, convert_texsubimage3d_rgb888, @@ -697,6 +784,8 @@ static convert_func gl_convert_texsubimage3d_tab[] = { convert_texsubimage3d_ci8, convert_texsubimage3d_ci8, convert_texsubimage3d_ci8, + convert_texsubimage3d_ycbcr, + convert_texsubimage3d_ycbcr_rev, }; @@ -727,21 +816,21 @@ convert_needs_unpacking( const struct gl_pixelstore_attrib *unpacking, GLboolean -_mesa_convert_texsubimage1d( GLint mesaFormat, +_mesa_convert_texsubimage1d( GLint mesaFormat, /* dest */ GLint xoffset, GLint width, - GLenum format, GLenum type, + GLenum format, GLenum type, /* source */ const struct gl_pixelstore_attrib *unpacking, const GLvoid *srcImage, GLvoid *dstImage ) { - struct gl_texture_convert convert; + struct convert_info convert; ASSERT( unpacking ); ASSERT( srcImage ); ASSERT( dstImage ); ASSERT( mesaFormat >= MESA_FORMAT_RGBA8888 ); - ASSERT( mesaFormat <= MESA_FORMAT_CI8 ); + ASSERT( mesaFormat <= MESA_FORMAT_YCBCR_REV ); /* Make it easier to pass all the parameters around. */ @@ -760,7 +849,9 @@ _mesa_convert_texsubimage1d( GLint mesaFormat, if ( convert_needs_unpacking( unpacking, format, type ) ) convert.index |= CONVERT_UNPACKING_BIT; - return gl_convert_texsubimage2d_tab[mesaFormat]( &convert ); + ASSERT(convert.index < 4); + + return convert_texsubimage2d_table[mesaFormat]( &convert ); } @@ -790,22 +881,22 @@ _mesa_convert_texsubimage1d( GLint mesaFormat, * destImage - pointer to dest image */ GLboolean -_mesa_convert_texsubimage2d( GLint mesaFormat, +_mesa_convert_texsubimage2d( GLint mesaFormat, /* dest */ GLint xoffset, GLint yoffset, GLint width, GLint height, GLint destImageWidth, - GLenum format, GLenum type, + GLenum format, GLenum type, /* source */ const struct gl_pixelstore_attrib *unpacking, const GLvoid *srcImage, GLvoid *dstImage ) { - struct gl_texture_convert convert; + struct convert_info convert; ASSERT( unpacking ); ASSERT( srcImage ); ASSERT( dstImage ); ASSERT( mesaFormat >= MESA_FORMAT_RGBA8888 ); - ASSERT( mesaFormat <= MESA_FORMAT_CI8 ); + ASSERT( mesaFormat <= MESA_FORMAT_YCBCR_REV ); /* Make it easier to pass all the parameters around. */ @@ -814,8 +905,8 @@ _mesa_convert_texsubimage2d( GLint mesaFormat, convert.width = width; convert.height = height; convert.dstImageWidth = destImageWidth; - convert.format = format; - convert.type = type; + convert.format = format; /* src */ + convert.type = type; /* src */ convert.unpacking = unpacking; convert.srcImage = srcImage; convert.dstImage = dstImage; @@ -828,26 +919,31 @@ _mesa_convert_texsubimage2d( GLint mesaFormat, if ( width != destImageWidth ) convert.index |= CONVERT_STRIDE_BIT; - return gl_convert_texsubimage2d_tab[mesaFormat]( &convert ); + ASSERT(convert.index < 4); + + ASSERT(mesaFormat < sizeof(convert_texsubimage2d_table) / + sizeof(convert_texsubimage2d_table[0])); + + return convert_texsubimage2d_table[mesaFormat]( &convert ); } GLboolean -_mesa_convert_texsubimage3d( GLint mesaFormat, +_mesa_convert_texsubimage3d( GLint mesaFormat, /* dest */ GLint xoffset, GLint yoffset, GLint zoffset, GLint width, GLint height, GLint depth, GLint dstImageWidth, GLint dstImageHeight, - GLenum format, GLenum type, + GLenum format, GLenum type, /* source */ const struct gl_pixelstore_attrib *unpacking, const GLvoid *srcImage, GLvoid *dstImage ) { - struct gl_texture_convert convert; + struct convert_info convert; ASSERT( unpacking ); ASSERT( srcImage ); ASSERT( dstImage ); ASSERT( mesaFormat >= MESA_FORMAT_RGBA8888 ); - ASSERT( mesaFormat <= MESA_FORMAT_CI8 ); + ASSERT( mesaFormat <= MESA_FORMAT_YCBCR_REV ); /* Make it easier to pass all the parameters around. */ @@ -873,7 +969,9 @@ _mesa_convert_texsubimage3d( GLint mesaFormat, if ( width != dstImageWidth || height != dstImageHeight ) convert.index |= CONVERT_STRIDE_BIT; - return gl_convert_texsubimage3d_tab[mesaFormat]( &convert ); + ASSERT(convert.index < 4); + + return convert_texsubimage3d_table[mesaFormat]( &convert ); } diff --git a/xc/extras/Mesa/src/texutil_tmp.h b/xc/extras/Mesa/src/texutil_tmp.h index 44f463e35..5c5e4862b 100644 --- a/xc/extras/Mesa/src/texutil_tmp.h +++ b/xc/extras/Mesa/src/texutil_tmp.h @@ -1,7 +1,7 @@ /* * Mesa 3-D graphics library - * Version: 4.0.2 + * Version: 4.0.4 * * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. * @@ -27,7 +27,23 @@ */ /* - * NOTE: All 3D teximage code is untested and most definitely broken... + * For 2D and 3D texture images, we generate functions for + * - conversion without pixel unpacking and standard stride + * - conversion without pixel unpacking and non-standard stride + * - conversion with pixel unpacking and standard stride + * - conversion with pixel unpacking and non-standard stride + * + * + * Macros which need to be defined before including this file: + * TAG(x) - the function name wrapper + * DST_TYPE - the destination texel datatype (GLuint, GLushort, etc) + * DST_TEXELS_PER_DWORD - number of dest texels that'll fit in 4 bytes + * CONVERT_TEXEL - code to convert from source to dest texel + * CONVER_TEXEL_DWORD - if multiple texels fit in 4 bytes, this macros + * will convert/store multiple texels at once + * CONVERT_DIRECT - if defined, just memcpy texels from src to dest + * SRC_TEXEL_BYTES - bytes per source texel + * PRESERVE_DST_TYPE - if defined, don't undefined these macros at end */ @@ -42,7 +58,7 @@ * PRE: No pixelstore attribs, width == dstImageWidth. */ static GLboolean -TAG(texsubimage2d)( struct gl_texture_convert *convert ) +TAG(texsubimage2d)( const struct convert_info *convert ) { const GLubyte *src = (const GLubyte *)convert->srcImage; GLuint *dst = (GLuint *)((GLubyte *)convert->dstImage + @@ -78,7 +94,7 @@ TAG(texsubimage2d)( struct gl_texture_convert *convert ) /* PRE: As above, height == dstImageHeight also. */ static GLboolean -TAG(texsubimage3d)( struct gl_texture_convert *convert ) +TAG(texsubimage3d)( const struct convert_info *convert ) { const GLubyte *src = (const GLubyte *)convert->srcImage; GLuint *dst = (GLuint *)((GLubyte *)convert->dstImage + @@ -117,7 +133,7 @@ TAG(texsubimage3d)( struct gl_texture_convert *convert ) * PRE: No pixelstore attribs, width != dstImageWidth. */ static GLboolean -TAG(texsubimage2d_stride)( struct gl_texture_convert *convert ) +TAG(texsubimage2d_stride)( const struct convert_info *convert ) { const GLubyte *src = (const GLubyte *)convert->srcImage; DST_TYPE *dst = (DST_TYPE *)((GLubyte *)convert->dstImage + @@ -150,7 +166,7 @@ TAG(texsubimage2d_stride)( struct gl_texture_convert *convert ) /* PRE: As above, or height != dstImageHeight also. */ static GLboolean -TAG(texsubimage3d_stride)( struct gl_texture_convert *convert ) +TAG(texsubimage3d_stride)( const struct convert_info *convert ) { const GLubyte *src = (const GLubyte *)convert->srcImage; DST_TYPE *dst = (DST_TYPE *)((GLubyte *)convert->dstImage + @@ -190,7 +206,7 @@ TAG(texsubimage3d_stride)( struct gl_texture_convert *convert ) * PRE: Require pixelstore attribs, width == dstImageWidth. */ static GLboolean -TAG(texsubimage2d_unpack)( struct gl_texture_convert *convert ) +TAG(texsubimage2d_unpack)( const struct convert_info *convert ) { const GLubyte *src = (const GLubyte *) _mesa_image_address( convert->unpacking, convert->srcImage, @@ -248,7 +264,7 @@ TAG(texsubimage2d_unpack)( struct gl_texture_convert *convert ) /* PRE: as above, height == dstImageHeight also. */ static GLboolean -TAG(texsubimage3d_unpack)( struct gl_texture_convert *convert ) +TAG(texsubimage3d_unpack)( const struct convert_info *convert ) { const GLubyte *src = (const GLubyte *) _mesa_image_address( convert->unpacking, convert->srcImage, @@ -323,7 +339,7 @@ TAG(texsubimage3d_unpack)( struct gl_texture_convert *convert ) * PRE: Require pixelstore attribs, width != dstImageWidth. */ static GLboolean -TAG(texsubimage2d_stride_unpack)( struct gl_texture_convert *convert ) +TAG(texsubimage2d_stride_unpack)( const struct convert_info *convert ) { const GLubyte *src = (const GLubyte *) _mesa_image_address( convert->unpacking, convert->srcImage, @@ -371,7 +387,7 @@ TAG(texsubimage2d_stride_unpack)( struct gl_texture_convert *convert ) /* PRE: As above, or height != dstImageHeight also. */ static GLboolean -TAG(texsubimage3d_stride_unpack)( struct gl_texture_convert *convert ) +TAG(texsubimage3d_stride_unpack)( const struct convert_info *convert ) { const GLubyte *src = (const GLubyte *) _mesa_image_address( convert->unpacking, convert->srcImage, |